[string] Clean up String.UTF8View

Extract slow paths into non-inlinable functions so that fast-paths can
be faster and we don't pay the large code bloat for the Unicode
parsers.

Some tests proactively extended to highlight UTF8View of multiple
kinds of Strings.
This commit is contained in:
Michael Ilseman
2018-05-10 11:09:31 -07:00
committed by Michael Ilseman
parent 60b6789206
commit 00e214ec50
3 changed files with 167 additions and 64 deletions

View File

@@ -123,8 +123,15 @@ extension _StringGuts {
@inlinable
public // @testable
var isASCII: Bool {
// FIXME: Currently used to sometimes mean contiguous ASCII
return _object.isContiguousASCII
@inline(__always) get { return _object.isContiguousASCII }
}
@inlinable
internal
var _isASCIIOrSmallASCII: Bool {
@inline(__always) get {
return isASCII || _isSmall && _smallUTF8String.isASCII
}
}
@inlinable