Give StringView a utf8() API.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 05:57:55 +0000 (05:57 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 05:57:55 +0000 (05:57 +0000)
commitbb492c459d13981af47070599015f21778deace2
tree018752ba827aa78ae4b38b4ff50380cc357f3db6
parent57d986765a7efe3f413f6f7d9336f011b2f306f8
Give StringView a utf8() API.
<https://webkit.org/b/145201>

Source/JavaScriptCore:

Reviewed by Anders Carlsson.

Use JSString::view() in a few places where we couldn't before due to StringView
lacking a utf8() API. This is a minor speed-up on Kraken's crypto subtests,
which like to call encode() with substring JSStrings.

* jsc.cpp:
(functionPrint):
(functionDebug):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::encode):

Source/WTF:

Reviewed by Anders Carlsson

Added an LChar version of StringImpl::utf8ForCharacters() and use that to give
StringView a utf8() API just like String has.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::utf8ForCharacters):
* wtf/text/StringImpl.h:
* wtf/text/StringView.cpp:
(WTF::StringView::utf8):
* wtf/text/StringView.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/StringView.cpp
Source/WTF/wtf/text/StringView.h