Ignore:
Timestamp:
Aug 28, 2014, 2:38:18 PM (11 years ago)
Author:
[email protected]
Message:

Use JSString::toIdentifier() in more places.
<https://webkit.org/b/136348>

Call sites that grab the WTF::String from a JSString using value() can
use the more efficient toIdentifier() if the string is going to be used
to construct an Identifier.

If the JSString is a rope that resolves to something that is already
present in the VM's Identifier table, using toIdentifier() can avoid
allocating a new StringImpl.

Reviewed by Geoffrey Garen.

  • jit/JITOperations.cpp:
  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.cpp:

(JSC::SLOW_PATH_DECL):

  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::opIn):

  • runtime/JSONObject.cpp:

(JSC::Stringifier::Stringifier):

  • runtime/ObjectConstructor.cpp:

(JSC::objectConstructorGetOwnPropertyDescriptor):
(JSC::objectConstructorDefineProperty):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncPropertyIsEnumerable):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r172820 r173082  
    794794    }
    795795
    796     Identifier property(exec, subscript.toString(exec)->value(exec));
     796    Identifier property = subscript.toString(exec)->toIdentifier(exec);
    797797    LLINT_CHECK_EXCEPTION();
    798798    PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode());
     
    817817        baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
    818818    } else {
    819         Identifier property(exec, subscript.toString(exec)->value(exec));
     819        Identifier property = subscript.toString(exec)->toIdentifier(exec);
    820820        if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception.
    821821            PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode());
     
    843843    else {
    844844        LLINT_CHECK_EXCEPTION();
    845         Identifier property(exec, subscript.toString(exec)->value(exec));
     845        Identifier property = subscript.toString(exec)->toIdentifier(exec);
    846846        LLINT_CHECK_EXCEPTION();
    847847        couldDelete = baseObject->methodTable()->deleteProperty(baseObject, exec, property);
Note: See TracChangeset for help on using the changeset viewer.