Reduce String allocations
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 May 2018 19:21:34 +0000 (19:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 May 2018 19:21:34 +0000 (19:21 +0000)
commita0f8cc54c054458c68f12b0ef67b96f6481f8041
treeb0d69b084489d91454c20449dffce49c63c6a7ef
parent67870c2102cb986a8683185f9c47ab440d3c1cf6
Reduce String allocations
https://bugs.webkit.org/show_bug.cgi?id=186059

Patch by Alex Christensen <achristensen@webkit.org> on 2018-05-30
Reviewed by Darin Adler.

Source/WebCore:

Don't allocate Strings just to convert it to another form.
Based mostly on Darin's feedback on bug 185986.

No change in behavior.

* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::hostName):
(WebCore::WebSocketHandshake::host const):
* css/parser/CSSSelectorParser.cpp:
(WebCore::CSSSelectorParser::consumePseudo):
(WebCore::CSSSelectorParser::consumeANPlusB):
* loader/mac/LoaderNSURLExtras.mm:
(suggestedFilenameWithMIMEType):
* page/SecurityOriginData.h:
(WebCore::SecurityOriginData::fromURL):
* page/csp/ContentSecurityPolicySource.cpp:
(WebCore::wildcardMatches):
(WebCore::ContentSecurityPolicySource::hostMatches const):
* platform/URL.cpp:
(WebCore::URL::hostAndPort const):
* platform/network/cf/SocketStreamHandleImplCFNet.cpp:
(WebCore::SocketStreamHandleImpl::createStreams):

Source/WTF:

* wtf/text/StringView.cpp:
(WTF::convertASCIICase):
(WTF::StringView::convertToASCIILowercase const):
(WTF::StringView::convertToASCIIUppercase const):
* wtf/text/StringView.h:
* wtf/text/cf/StringViewCF.cpp:
(WTF::StringView::createCFString const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232302 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringView.cpp
Source/WTF/wtf/text/StringView.h
Source/WTF/wtf/text/cf/StringViewCF.cpp
Source/WebCore/ChangeLog
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/css/parser/CSSSelectorParser.cpp
Source/WebCore/loader/mac/LoaderNSURLExtras.mm
Source/WebCore/page/SecurityOriginData.h
Source/WebCore/page/csp/ContentSecurityPolicySource.cpp
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp