Ignore:
Timestamp:
May 19, 2015, 10:57:55 PM (10 years ago)
Author:
[email protected]
Message:

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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jsc.cpp

    r184354 r184617  
    691691            putchar(' ');
    692692
    693         printf("%s", exec->uncheckedArgument(i).toString(exec)->value(exec).utf8().data());
     693        printf("%s", exec->uncheckedArgument(i).toString(exec)->view(exec).utf8().data());
    694694    }
    695695
     
    712712EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
    713713{
    714     fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec)->value(exec).utf8().data());
     714    fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec)->view(exec).utf8().data());
    715715    return JSValue::encode(jsUndefined());
    716716}
Note: See TracChangeset for help on using the changeset viewer.