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/jit/JITOperations.cpp

    r173031 r173082  
    481481        baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot);
    482482    } else {
    483         Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame));
     483        Identifier property = subscript.toString(callFrame)->toIdentifier(callFrame);
    484484        if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception.
    485485            PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode());
     
    921921size_t JIT_OPERATION operationHasProperty(ExecState* exec, JSObject* base, JSString* property)
    922922{
    923     int result = base->hasProperty(exec, Identifier(exec, property->value(exec)));
     923    int result = base->hasProperty(exec, property->toIdentifier(exec));
    924924    return result;
    925925}
Note: See TracChangeset for help on using the changeset viewer.