Changeset 95318 in webkit


Ignore:
Timestamp:
Sep 16, 2011 1:32:15 PM (13 years ago)
Author:
barraclough@apple.com
Message:

Rationalize JSObject::putDirect* methods
https://bugs.webkit.org/show_bug.cgi?id=68274

Reviewed by Sam Weinig.

Delete the *Function variants. These are overall inefficient,
in the way they get the name back from the function rather
than just passing it in.

(GlobalObject::finishCreation):
(GlobalObject::addFunction):

  • runtime/FunctionPrototype.cpp:

(JSC::FunctionPrototype::addFunctionProperties):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):

  • runtime/JSObject.cpp:

(JSC::JSObject::put):
(JSC::JSObject::putWithAttributes):
(JSC::JSObject::defineGetter):
(JSC::JSObject::defineSetter):

  • runtime/JSObject.h:

(JSC::JSObject::putDirect):
(JSC::JSObject::putDirectWithoutTransition):

  • runtime/Lookup.cpp:

(JSC::setUpStaticFunctionSlot):

  • runtime/Lookup.h:

(JSC::lookupPut):

Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r95316 r95318  
     12011-09-16  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Rationalize JSObject::putDirect* methods
     4        https://bugs.webkit.org/show_bug.cgi?id=68274
     5
     6        Reviewed by Sam Weinig.
     7       
     8        Delete the *Function variants. These are overall inefficient,
     9        in the way they get the name back from the function rather
     10        than just passing it in.
     11
     12        * JavaScriptCore.exp:
     13        * jsc.cpp:
     14        (GlobalObject::finishCreation):
     15        (GlobalObject::addFunction):
     16        * runtime/FunctionPrototype.cpp:
     17        (JSC::FunctionPrototype::addFunctionProperties):
     18        * runtime/JSGlobalObject.cpp:
     19        (JSC::JSGlobalObject::reset):
     20        * runtime/JSObject.cpp:
     21        (JSC::JSObject::put):
     22        (JSC::JSObject::putWithAttributes):
     23        (JSC::JSObject::defineGetter):
     24        (JSC::JSObject::defineSetter):
     25        * runtime/JSObject.h:
     26        (JSC::JSObject::putDirect):
     27        (JSC::JSObject::putDirectWithoutTransition):
     28        * runtime/Lookup.cpp:
     29        (JSC::setUpStaticFunctionSlot):
     30        * runtime/Lookup.h:
     31        (JSC::lookupPut):
     32
    1332011-09-16  Filip Pizlo  <fpizlo@apple.com>
    234
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r95229 r95318  
    133133__ZN3JSC12JSGlobalData13startSamplingEv
    134134__ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE
     135__ZN3JSC12JSGlobalData14jsFunctionVPtrE
    135136__ZN3JSC12JSGlobalData14resetDateCacheEv
    136137__ZN3JSC12JSGlobalData14sharedInstanceEv
     
    249250__ZN3JSC4Heap8capacityEv
    250251__ZN3JSC4Heap9unprotectENS_7JSValueE
    251 __ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi
    252252__ZN3JSC4Yarr11YarrPatternC1ERKNS_7UStringEbbPPKc
    253253__ZN3JSC4Yarr11byteCompileERNS0_11YarrPatternEPN3WTF20BumpPointerAllocatorE
     254__ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi
    254255__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE
    255256__ZN3JSC6JSCell11getCallDataERNS_8CallDataE
     
    315316__ZN3JSC8JSObject17defineOwnPropertyEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb
    316317__ZN3JSC8JSObject17preventExtensionsERNS_12JSGlobalDataE
    317 __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_10JSFunctionEj
    318 __ZN3JSC8JSObject17putDirectFunctionEPNS_9ExecStateEPNS_16InternalFunctionEj
    319318__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEj
    320319__ZN3JSC8JSObject17putWithAttributesEPNS_12JSGlobalDataERKNS_10IdentifierENS_7JSValueEjbRNS_15PutPropertySlotE
  • trunk/Source/JavaScriptCore/jsc.cpp

    r95108 r95318  
    163163    {
    164164        Base::finishCreation(globalData, this);
    165         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
    166         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
    167         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
    168         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "gc"), functionGC));
     165       
     166        addFunction(globalData, "debug", functionDebug, 1);
     167        addFunction(globalData, "print", functionPrint, 1);
     168        addFunction(globalData, "quit", functionQuit, 0);
     169        addFunction(globalData, "gc", functionGC, 0);
    169170#ifndef NDEBUG
    170         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "releaseExecutableMemory"), functionReleaseExecutableMemory));
    171 #endif
    172         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "version"), functionVersion));
    173         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "run"), functionRun));
    174         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "load"), functionLoad));
    175         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "checkSyntax"), functionCheckSyntax));
    176         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "readline"), functionReadline));
    177         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "preciseTime"), functionPreciseTime));
    178 
     171        addFunction(globalData, "releaseExecutableMemory", functionReleaseExecutableMemory, 0);
     172#endif
     173        addFunction(globalData, "version", functionVersion, 1);
     174        addFunction(globalData, "run", functionRun, 1);
     175        addFunction(globalData, "load", functionLoad, 1);
     176        addFunction(globalData, "checkSyntax", functionCheckSyntax, 1);
     177        addFunction(globalData, "readline", functionReadline, 0);
     178        addFunction(globalData, "preciseTime", functionPreciseTime, 0);
    179179#if ENABLE(SAMPLING_FLAGS)
    180         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "setSamplingFlags"), functionSetSamplingFlags));
    181         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "clearSamplingFlags"), functionClearSamplingFlags));
     180        addFunction(globalData, "setSamplingFlags", functionSetSamplingFlags, 1);
     181        addFunction(globalData, "clearSamplingFlags", functionClearSamplingFlags, 1);
    182182#endif
    183183
     
    185185        for (size_t i = 0; i < arguments.size(); ++i)
    186186            array->put(globalExec(), i, jsString(globalExec(), arguments[i]));
    187         putDirect(globalExec()->globalData(), Identifier(globalExec(), "arguments"), array);
     187        putDirect(globalData, Identifier(globalExec(), "arguments"), array);
     188    }
     189
     190    void addFunction(JSGlobalData& globalData, const char* name, NativeFunction function, unsigned arguments)
     191    {
     192        Identifier identifier(globalExec(), name);
     193        putDirect(globalData, identifier, JSFunction::create(globalExec(), this, functionStructure(), arguments, identifier, function));
    188194    }
    189195};
  • trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp

    r95108 r95318  
    5151void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, Structure* functionStructure, JSFunction** callFunction, JSFunction** applyFunction)
    5252{
    53     putDirectFunctionWithoutTransition(exec, JSFunction::create(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString), DontEnum);
     53    JSFunction* toStringFunction = JSFunction::create(exec, globalObject, functionStructure, 0, exec->propertyNames().toString, functionProtoFuncToString);
     54    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().toString, toStringFunction, DontEnum);
     55
    5456    *applyFunction = JSFunction::create(exec, globalObject, functionStructure, 2, exec->propertyNames().apply, functionProtoFuncApply);
    55     putDirectFunctionWithoutTransition(exec, *applyFunction, DontEnum);
     57    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().apply, *applyFunction, DontEnum);
     58
    5659    *callFunction = JSFunction::create(exec, globalObject, functionStructure, 1, exec->propertyNames().call, functionProtoFuncCall);
    57     putDirectFunctionWithoutTransition(exec, *callFunction, DontEnum);
     60    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().call, *callFunction, DontEnum);
    5861}
    5962
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r94701 r95318  
    255255    m_URIErrorConstructor.set(exec->globalData(), this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, "URIError"));
    256256
    257     m_objectPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum);
    258     m_functionPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, functionConstructor, DontEnum);
    259     m_arrayPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, arrayConstructor, DontEnum);
    260     m_booleanPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, booleanConstructor, DontEnum);
    261     m_stringPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, stringConstructor, DontEnum);
    262     m_numberPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, numberConstructor, DontEnum);
    263     m_datePrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, dateConstructor, DontEnum);
    264     m_regExpPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum);
    265     errorPrototype->putDirectFunctionWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum);
    266 
    267     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum);
    268     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Function"), functionConstructor, DontEnum);
    269     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Array"), arrayConstructor, DontEnum);
    270     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
    271     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "String"), stringConstructor, DontEnum);
    272     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Number"), numberConstructor, DontEnum);
    273     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Date"), dateConstructor, DontEnum);
    274     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "RegExp"), m_regExpConstructor.get(), DontEnum);
    275     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "Error"), m_errorConstructor.get(), DontEnum);
    276     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "EvalError"), m_evalErrorConstructor.get(), DontEnum);
    277     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "RangeError"), m_rangeErrorConstructor.get(), DontEnum);
    278     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "ReferenceError"), m_referenceErrorConstructor.get(), DontEnum);
    279     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "SyntaxError"), m_syntaxErrorConstructor.get(), DontEnum);
    280     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum);
    281     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum);
     257    m_objectPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, objectConstructor, DontEnum);
     258    m_functionPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, functionConstructor, DontEnum);
     259    m_arrayPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, arrayConstructor, DontEnum);
     260    m_booleanPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, booleanConstructor, DontEnum);
     261    m_stringPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, stringConstructor, DontEnum);
     262    m_numberPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, numberConstructor, DontEnum);
     263    m_datePrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, dateConstructor, DontEnum);
     264    m_regExpPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_regExpConstructor.get(), DontEnum);
     265    errorPrototype->putDirectWithoutTransition(exec->globalData(), exec->propertyNames().constructor, m_errorConstructor.get(), DontEnum);
     266
     267    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Object"), objectConstructor, DontEnum);
     268    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Function"), functionConstructor, DontEnum);
     269    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Array"), arrayConstructor, DontEnum);
     270    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Boolean"), booleanConstructor, DontEnum);
     271    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "String"), stringConstructor, DontEnum);
     272    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Number"), numberConstructor, DontEnum);
     273    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Date"), dateConstructor, DontEnum);
     274    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "RegExp"), m_regExpConstructor.get(), DontEnum);
     275    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "Error"), m_errorConstructor.get(), DontEnum);
     276    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "EvalError"), m_evalErrorConstructor.get(), DontEnum);
     277    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "RangeError"), m_rangeErrorConstructor.get(), DontEnum);
     278    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "ReferenceError"), m_referenceErrorConstructor.get(), DontEnum);
     279    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "SyntaxError"), m_syntaxErrorConstructor.get(), DontEnum);
     280    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "TypeError"), m_typeErrorConstructor.get(), DontEnum);
     281    putDirectWithoutTransition(exec->globalData(), Identifier(exec, "URIError"), m_URIErrorConstructor.get(), DontEnum);
    282282
    283283    m_evalFunction.set(exec->globalData(), this, JSFunction::create(exec, this, m_functionStructure.get(), 1, exec->propertyNames().eval, globalFuncEval));
    284     putDirectFunctionWithoutTransition(exec, m_evalFunction.get(), DontEnum);
     284    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().eval, m_evalFunction.get(), DontEnum);
    285285
    286286    GlobalPropertyInfo staticGlobals[] = {
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r95011 r95318  
    106106    ASSERT(value);
    107107    ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
     108    JSGlobalData& globalData = exec->globalData();
    108109
    109110    if (propertyName == exec->propertyNames().underscoreProto) {
     
    118119        }
    119120           
    120         if (!setPrototypeWithCycleCheck(exec->globalData(), value))
     121        if (!setPrototypeWithCycleCheck(globalData, value))
    121122            throwError(exec, createError(exec, "cyclic __proto__ value"));
    122123        return;
     
    128129        prototype = obj->prototype();
    129130        if (prototype.isNull()) {
    130             if (!putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot) && slot.isStrictMode())
     131            if (!putDirectInternal(globalData, propertyName, value, 0, true, slot, getJSFunction(globalData, value)) && slot.isStrictMode())
    131132                throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
    132133            return;
     
    136137    unsigned attributes;
    137138    JSCell* specificValue;
    138     if ((m_structure->get(exec->globalData(), propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) {
     139    if ((m_structure->get(globalData, propertyName, attributes, specificValue) != WTF::notFound) && attributes & ReadOnly) {
    139140        if (slot.isStrictMode())
    140141            throwError(exec, createTypeError(exec, StrictModeReadonlyPropertyWriteError));
     
    143144
    144145    for (JSObject* obj = this; ; obj = asObject(prototype)) {
    145         if (JSValue gs = obj->getDirect(exec->globalData(), propertyName)) {
     146        if (JSValue gs = obj->getDirect(globalData, propertyName)) {
    146147            if (gs.isGetterSetter()) {
    147148                JSObject* setterFunc = asGetterSetter(gs)->setter();       
     
    170171            break;
    171172    }
    172 
    173     if (!putDirectInternal(exec->globalData(), propertyName, value, 0, true, slot) && slot.isStrictMode())
     173   
     174    if (!putDirectInternal(globalData, propertyName, value, 0, true, slot, getJSFunction(globalData, value)) && slot.isStrictMode())
    174175        throwTypeError(exec, StrictModeReadonlyPropertyWriteError);
    175176    return;
     
    184185void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
    185186{
    186     putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot);
     187    putDirectInternal(*globalData, propertyName, value, attributes, checkReadOnly, slot, getJSFunction(*globalData, value));
    187188}
    188189
    189190void JSObject::putWithAttributes(JSGlobalData* globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
    190191{
    191     putDirectInternal(*globalData, propertyName, value, attributes);
     192    PutPropertySlot slot;
     193    putDirectInternal(*globalData, propertyName, value, attributes, true, slot, getJSFunction(*globalData, value));
    192194}
    193195
     
    199201void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
    200202{
    201     putDirectInternal(exec->globalData(), propertyName, value, attributes, checkReadOnly, slot);
     203    JSGlobalData& globalData = exec->globalData();
     204    putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, getJSFunction(globalData, value));
    202205}
    203206
    204207void JSObject::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes)
    205208{
    206     putDirectInternal(exec->globalData(), propertyName, value, attributes);
     209    PutPropertySlot slot;
     210    JSGlobalData& globalData = exec->globalData();
     211    putDirectInternal(globalData, propertyName, value, attributes, true, slot, getJSFunction(globalData, value));
    207212}
    208213
     
    338343    PutPropertySlot slot;
    339344    GetterSetter* getterSetter = GetterSetter::create(exec);
    340     putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot);
     345    putDirectInternal(globalData, propertyName, getterSetter, attributes | Getter, true, slot, 0);
    341346
    342347    // putDirect will change our Structure if we add a new property. For
     
    368373    PutPropertySlot slot;
    369374    GetterSetter* getterSetter = GetterSetter::create(exec);
    370     putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot);
     375    putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot, 0);
    371376
    372377    // putDirect will change our Structure if we add a new property. For
     
    565570    if (offset != WTF::notFound)
    566571        putUndefinedAtDirectOffset(offset);
    567 }
    568 
    569 void JSObject::putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr)
    570 {
    571     putDirectFunction(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
    572 }
    573 
    574 void JSObject::putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr)
    575 {
    576     putDirectFunction(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
    577 }
    578 
    579 void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr)
    580 {
    581     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
    582 }
    583 
    584 void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr)
    585 {
    586     putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
    587572}
    588573
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r95229 r95318  
    181181        bool putDirect(JSGlobalData&, const Identifier& propertyName, JSValue, PutPropertySlot&);
    182182
    183         void putDirectFunction(JSGlobalData&, const Identifier& propertyName, JSCell*, unsigned attr = 0);
    184         void putDirectFunction(JSGlobalData&, const Identifier& propertyName, JSCell*, unsigned attr, bool checkReadOnly, PutPropertySlot&);
    185         void putDirectFunction(ExecState* exec, InternalFunction* function, unsigned attr = 0);
    186         void putDirectFunction(ExecState* exec, JSFunction* function, unsigned attr = 0);
    187 
    188183        void putDirectWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr = 0);
    189         void putDirectFunctionWithoutTransition(JSGlobalData&, const Identifier& propertyName, JSCell* value, unsigned attr = 0);
    190         void putDirectFunctionWithoutTransition(ExecState* exec, InternalFunction* function, unsigned attr = 0);
    191         void putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* function, unsigned attr = 0);
    192184
    193185        // Fast access to known property offsets.
     
    302294
    303295        bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&, JSCell*);
    304         bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&);
    305         void putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue value, unsigned attr = 0);
    306296
    307297        bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
     
    716706}
    717707
    718 inline bool JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
     708inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
    719709{
    720710    ASSERT(value);
     
    724714}
    725715
    726 inline void JSObject::putDirectInternal(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
     716inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
    727717{
    728718    PutPropertySlot slot;
     
    730720}
    731721
    732 inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
    733 {
    734     ASSERT(value);
    735     ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
    736 
    737     return putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, 0);
    738 }
    739 
    740 inline void JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, unsigned attributes)
    741 {
    742     PutPropertySlot slot;
    743     putDirectInternal(globalData, propertyName, value, attributes, false, slot, 0);
    744 }
    745 
    746722inline bool JSObject::putDirect(JSGlobalData& globalData, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
    747723{
    748     return putDirectInternal(globalData, propertyName, value, 0, false, slot, 0);
    749 }
    750 
    751 inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot)
    752 {
    753     putDirectInternal(globalData, propertyName, value, attributes, checkReadOnly, slot, value);
    754 }
    755 
    756 inline void JSObject::putDirectFunction(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attr)
    757 {
    758     PutPropertySlot slot;
    759     putDirectInternal(globalData, propertyName, value, attr, false, slot, value);
     724    return putDirectInternal(globalData, propertyName, value, 0, false, slot, getJSFunction(globalData, value));
    760725}
    761726
     
    763728{
    764729    size_t currentCapacity = m_structure->propertyStorageCapacity();
    765     size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, 0);
    766     if (currentCapacity != m_structure->propertyStorageCapacity())
    767         allocatePropertyStorage(globalData, currentCapacity, m_structure->propertyStorageCapacity());
    768     putDirectOffset(globalData, offset, value);
    769 }
    770 
    771 inline void JSObject::putDirectFunctionWithoutTransition(JSGlobalData& globalData, const Identifier& propertyName, JSCell* value, unsigned attributes)
    772 {
    773     size_t currentCapacity = m_structure->propertyStorageCapacity();
    774     size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, value);
     730    size_t offset = m_structure->addPropertyWithoutTransition(globalData, propertyName, attributes, getJSFunction(globalData, value));
    775731    if (currentCapacity != m_structure->propertyStorageCapacity())
    776732        allocatePropertyStorage(globalData, currentCapacity, m_structure->propertyStorageCapacity());
  • trunk/Source/JavaScriptCore/runtime/Lookup.cpp

    r95310 r95318  
    8888            function = JSFunction::create(exec, globalObject, globalObject->functionStructure(), entry->functionLength(), propertyName, entry->function());
    8989
    90         thisObj->putDirectFunction(exec->globalData(), propertyName, function, entry->attributes());
     90        thisObj->putDirect(exec->globalData(), propertyName, function, entry->attributes());
    9191        location = thisObj->getDirectLocation(exec->globalData(), propertyName);
    9292    }
  • trunk/Source/JavaScriptCore/runtime/Lookup.h

    r95310 r95318  
    334334        if (entry->attributes() & Function) { // function: put as override property
    335335            if (LIKELY(value.isCell()))
    336                 thisObj->putDirectFunction(exec->globalData(), propertyName, value.asCell());
     336                thisObj->putDirect(exec->globalData(), propertyName, value.asCell());
    337337            else
    338338                thisObj->putDirect(exec->globalData(), propertyName, value);
Note: See TracChangeset for help on using the changeset viewer.