Changeset 156602 in webkit


Ignore:
Timestamp:
Sep 28, 2013 7:15:24 AM (11 years ago)
Author:
akling@apple.com
Message:

Pass VM instead of ExecState to JSFunction constructors.
<https://webkit.org/b/122014>

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

JSFunction doesn't need the ExecState for anything during its
construction, so reduce the amount of loads by just passing the
VM around instead.

Factored out putDirectNonIndexAccessor() from the existing
putDirectAccessor() to avoid snowballing the patch (and because
it's kinda neat to avoid the extra branch.)

JSC release binary size -= 9680 bytes.

Source/WebCore:

Updated for new JSFunction::create() signature.

Location:
trunk/Source
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r156597 r156602  
     12013-09-28  Andreas Kling  <akling@apple.com>
     2
     3        Pass VM instead of ExecState to JSFunction constructors.
     4        <https://webkit.org/b/122014>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        JSFunction doesn't need the ExecState for anything during its
     9        construction, so reduce the amount of loads by just passing the
     10        VM around instead.
     11
     12        Factored out putDirectNonIndexAccessor() from the existing
     13        putDirectAccessor() to avoid snowballing the patch (and because
     14        it's kinda neat to avoid the extra branch.)
     15
     16        JSC release binary size -= 9680 bytes.
     17
    1182013-09-28  Mark Rowe  <mrowe@apple.com>
    219
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r156490 r156602  
    858858    VM& vm = exec->vm();
    859859    NativeCallFrameTracer tracer(&vm, exec);
    860     return JSFunction::create(exec, static_cast<FunctionExecutable*>(functionExecutable), exec->scope());
     860    return JSFunction::create(vm, static_cast<FunctionExecutable*>(functionExecutable), exec->scope());
    861861}
    862862
     
    866866    VM& vm = exec->vm();
    867867    NativeCallFrameTracer tracer(&vm, exec);
    868     return JSValue::encode(JSFunction::create(exec, static_cast<FunctionExecutable*>(functionExecutable), exec->scope()));
     868    return JSValue::encode(JSFunction::create(vm, static_cast<FunctionExecutable*>(functionExecutable), exec->scope()));
    869869}
    870870
     
    878878    FunctionExecutable* functionExecutable =
    879879        static_cast<FunctionExecutable*>(functionExecutableAsCell);
    880     return JSFunction::create(exec, functionExecutable, exec->scope());
     880    return JSFunction::create(vm, functionExecutable, exec->scope());
    881881}
    882882
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r156597 r156602  
    12101210            FunctionExecutable* function = codeBlock->functionDecl(i);
    12111211            PutPropertySlot slot;
    1212             variableObject->methodTable()->put(variableObject, callFrame, function->name(), JSFunction::create(callFrame, function, scope), slot);
     1212            variableObject->methodTable()->put(variableObject, callFrame, function->name(), JSFunction::create(vm, function, scope), slot);
    12131213        }
    12141214    }
  • trunk/Source/JavaScriptCore/jit/JITStubs.cpp

    r156521 r156602  
    11561156   
    11571157    ASSERT(stackFrame.callFrame->codeBlock()->codeType() != FunctionCode || !stackFrame.callFrame->codeBlock()->needsFullScopeChain() || stackFrame.callFrame->uncheckedR(stackFrame.callFrame->codeBlock()->activationRegister().offset()).jsValue());
    1158     return JSFunction::create(stackFrame.callFrame, stackFrame.args[0].function(), stackFrame.callFrame->scope());
     1158    return JSFunction::create(stackFrame.callFrame->vm(), stackFrame.args[0].function(), stackFrame.callFrame->scope());
    11591159}
    11601160
     
    19311931
    19321932    FunctionExecutable* function = stackFrame.args[0].function();
    1933     JSFunction* func = JSFunction::create(callFrame, function, callFrame->scope());
     1933    JSFunction* func = JSFunction::create(callFrame->vm(), function, callFrame->scope());
    19341934    ASSERT(callFrame->codeBlock()->codeType() != FunctionCode || !callFrame->codeBlock()->needsFullScopeChain() || callFrame->uncheckedR(callFrame->codeBlock()->activationRegister().offset()).jsValue());
    19351935
  • trunk/Source/JavaScriptCore/jsc.cpp

    r156402 r156602  
    251251    void addFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
    252252    {
    253         Identifier identifier(globalExec(), name);
    254         putDirect(vm, identifier, JSFunction::create(globalExec(), this, arguments, identifier.string(), function));
     253        Identifier identifier(&vm, name);
     254        putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function));
    255255    }
    256256   
    257257    void addConstructableFunction(VM& vm, const char* name, NativeFunction function, unsigned arguments)
    258258    {
    259         Identifier identifier(globalExec(), name);
    260         putDirect(vm, identifier, JSFunction::create(globalExec(), this, arguments, identifier.string(), function, NoIntrinsic, function));
     259        Identifier identifier(&vm, name);
     260        putDirect(vm, identifier, JSFunction::create(vm, this, arguments, identifier.string(), function, NoIntrinsic, function));
    261261    }
    262262};
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r156521 r156602  
    922922    dataLogF("Creating function!\n");
    923923#endif
    924     LLINT_RETURN(JSFunction::create(exec, codeBlock->functionDecl(pc[2].u.operand), exec->scope()));
     924    LLINT_RETURN(JSFunction::create(vm, codeBlock->functionDecl(pc[2].u.operand), exec->scope()));
    925925}
    926926
     
    930930    CodeBlock* codeBlock = exec->codeBlock();
    931931    FunctionExecutable* function = codeBlock->functionExpr(pc[2].u.operand);
    932     JSFunction* func = JSFunction::create(exec, function, exec->scope());
     932    JSFunction* func = JSFunction::create(vm, function, exec->scope());
    933933   
    934934    LLINT_RETURN(func);
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r156229 r156602  
    107107        return;
    108108
     109    VM& vm = exec->vm();
    109110    m_overrodeCaller = true;
    110111    PropertyDescriptor descriptor;
    111     descriptor.setAccessorDescriptor(globalObject()->throwTypeErrorGetterSetter(exec), DontEnum | DontDelete | Accessor);
    112     methodTable()->defineOwnProperty(this, exec, exec->propertyNames().caller, descriptor, false);
     112    descriptor.setAccessorDescriptor(globalObject()->throwTypeErrorGetterSetter(vm), DontEnum | DontDelete | Accessor);
     113    methodTable()->defineOwnProperty(this, exec, vm.propertyNames->caller, descriptor, false);
    113114}
    114115
     
    117118    if (m_overrodeCallee)
    118119        return;
    119    
     120
     121    VM& vm = exec->vm();
    120122    m_overrodeCallee = true;
    121123    PropertyDescriptor descriptor;
    122     descriptor.setAccessorDescriptor(globalObject()->throwTypeErrorGetterSetter(exec), DontEnum | DontDelete | Accessor);
    123     methodTable()->defineOwnProperty(this, exec, exec->propertyNames().callee, descriptor, false);
     124    descriptor.setAccessorDescriptor(globalObject()->throwTypeErrorGetterSetter(vm), DontEnum | DontDelete | Accessor);
     125    methodTable()->defineOwnProperty(this, exec, vm.propertyNames->callee, descriptor, false);
    124126}
    125127
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r155889 r156602  
    434434    const UnlinkedProgramCodeBlock::FunctionDeclations& functionDeclarations = unlinkedCode->functionDeclarations();
    435435
    436     CallFrame* globalExec = globalObject->globalExec();
    437 
    438436    for (size_t i = 0; i < functionDeclarations.size(); ++i) {
    439437        UnlinkedFunctionExecutable* unlinkedFunctionExecutable = functionDeclarations[i].second.get();
    440         JSValue value = JSFunction::create(globalExec, unlinkedFunctionExecutable->link(vm, m_source, lineNo(), 0), scope);
     438        JSValue value = JSFunction::create(vm, unlinkedFunctionExecutable->link(vm, m_source, lineNo(), 0), scope);
    441439        globalObject->addFunction(callFrame, functionDeclarations[i].first, value);
    442440    }
  • trunk/Source/JavaScriptCore/runtime/FunctionConstructor.cpp

    r156498 r156602  
    119119    }
    120120
    121     return JSFunction::create(exec, function, globalObject);
     121    return JSFunction::create(exec->vm(), function, globalObject);
    122122}
    123123
  • trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp

    r156498 r156602  
    5656void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, JSFunction** callFunction, JSFunction** applyFunction)
    5757{
    58     JSFunction* toStringFunction = JSFunction::create(exec, globalObject, 0, exec->propertyNames().toString.string(), functionProtoFuncToString);
    59     putDirectWithoutTransition(exec->vm(), exec->propertyNames().toString, toStringFunction, DontEnum);
    60 
    61     *applyFunction = JSFunction::create(exec, globalObject, 2, exec->propertyNames().apply.string(), functionProtoFuncApply);
    62     putDirectWithoutTransition(exec->vm(), exec->propertyNames().apply, *applyFunction, DontEnum);
    63 
    64     *callFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().call.string(), functionProtoFuncCall);
    65     putDirectWithoutTransition(exec->vm(), exec->propertyNames().call, *callFunction, DontEnum);
    66 
    67     JSFunction* bindFunction = JSFunction::create(exec, globalObject, 1, exec->propertyNames().bind.string(), functionProtoFuncBind);
    68     putDirectWithoutTransition(exec->vm(), exec->propertyNames().bind, bindFunction, DontEnum);
     58    VM& vm = exec->vm();
     59
     60    JSFunction* toStringFunction = JSFunction::create(vm, globalObject, 0, vm.propertyNames->toString.string(), functionProtoFuncToString);
     61    putDirectWithoutTransition(vm, vm.propertyNames->toString, toStringFunction, DontEnum);
     62
     63    *applyFunction = JSFunction::create(vm, globalObject, 2, vm.propertyNames->apply.string(), functionProtoFuncApply);
     64    putDirectWithoutTransition(vm, vm.propertyNames->apply, *applyFunction, DontEnum);
     65
     66    *callFunction = JSFunction::create(vm, globalObject, 1, vm.propertyNames->call.string(), functionProtoFuncCall);
     67    putDirectWithoutTransition(vm, vm.propertyNames->call, *callFunction, DontEnum);
     68
     69    JSFunction* bindFunction = JSFunction::create(vm, globalObject, 1, vm.propertyNames->bind.string(), functionProtoFuncBind);
     70    putDirectWithoutTransition(vm, vm.propertyNames->bind, bindFunction, DontEnum);
    6971}
    7072
     
    185187    ASSERT(target.isObject());
    186188    JSObject* targetObject = asObject(target);
     189    VM& vm = exec->vm();
    187190
    188191    // Let A be a new (possibly empty) internal list of all of the argument values provided after thisArg (arg1, arg2 etc), in order.
    189192    size_t numBoundArgs = exec->argumentCount() > 1 ? exec->argumentCount() - 1 : 0;
    190     JSArray* boundArgs = JSArray::tryCreateUninitialized(exec->vm(), globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithUndecided), numBoundArgs);
     193    JSArray* boundArgs = JSArray::tryCreateUninitialized(vm, globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithUndecided), numBoundArgs);
    191194    if (!boundArgs)
    192195        return JSValue::encode(throwOutOfMemoryError(exec));
    193196
    194197    for (size_t i = 0; i < numBoundArgs; ++i)
    195         boundArgs->initializeIndex(exec->vm(), i, exec->argument(i + 1));
     198        boundArgs->initializeIndex(vm, i, exec->argument(i + 1));
    196199
    197200    // If the [[Class]] internal property of Target is "Function", then ...
     
    208211
    209212    JSString* name = target.get(exec, exec->propertyNames().name).toString(exec);
    210     return JSValue::encode(JSBoundFunction::create(exec, globalObject, targetObject, exec->argument(0), boundArgs, length, name->value(exec)));
     213    return JSValue::encode(JSBoundFunction::create(vm, globalObject, targetObject, exec->argument(0), boundArgs, length, name->value(exec)));
    211214}
    212215
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.cpp

    r156498 r156602  
    7575}
    7676
    77 JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
     77JSBoundFunction* JSBoundFunction::create(VM& vm, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
    7878{
    79     VM& vm = exec->vm();
    8079    ConstructData constructData;
    8180    ConstructType constructType = JSC::getConstructData(targetFunction, constructData);
    8281    bool canConstruct = constructType != ConstructTypeNone;
    8382    NativeExecutable* executable = vm.getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor);
    84     JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
     83    JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(vm, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
    8584
    86     function->finishCreation(exec, executable, length, name);
     85    function->finishCreation(vm, executable, length, name);
    8786    return function;
    8887}
     
    9897}
    9998
    100 JSBoundFunction::JSBoundFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs)
    101     : Base(exec, globalObject, structure)
    102     , m_targetFunction(exec->vm(), this, targetFunction)
    103     , m_boundThis(exec->vm(), this, boundThis)
    104     , m_boundArgs(exec->vm(), this, boundArgs)
     99JSBoundFunction::JSBoundFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs)
     100    : Base(vm, globalObject, structure)
     101    , m_targetFunction(vm, this, targetFunction)
     102    , m_boundThis(vm, this, boundThis)
     103    , m_boundArgs(vm, this, boundArgs)
    105104{
    106105}
    107106
    108 void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name)
     107void JSBoundFunction::finishCreation(VM& vm, NativeExecutable* executable, int length, const String& name)
    109108{
    110     VM& vm = exec->vm();
    111109    Base::finishCreation(vm, executable, length, name);
    112110    ASSERT(inherits(info()));
    113111
    114     putDirectAccessor(exec, vm.propertyNames->arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
    115     putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
     112    putDirectNonIndexAccessor(vm, vm.propertyNames->arguments, globalObject()->throwTypeErrorGetterSetter(vm), DontDelete | DontEnum | Accessor);
     113    putDirectNonIndexAccessor(vm, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(vm), DontDelete | DontEnum | Accessor);
    116114}
    117115
  • trunk/Source/JavaScriptCore/runtime/JSBoundFunction.h

    r154038 r156602  
    3838    typedef JSFunction Base;
    3939
    40     static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const String&);
     40    static JSBoundFunction* create(VM&, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const String&);
    4141   
    4242    static void destroy(JSCell*);
     
    6262
    6363private:
    64     JSBoundFunction(ExecState*, JSGlobalObject*, Structure*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs);
     64    JSBoundFunction(VM&, JSGlobalObject*, Structure*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs);
    6565   
    66     void finishCreation(ExecState*, NativeExecutable*, int, const String&);
     66    void finishCreation(VM&, NativeExecutable*, int, const String&);
    6767
    6868    WriteBarrier<JSObject> m_targetFunction;
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r156498 r156602  
    6262}
    6363
    64 JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
    65 {
    66     VM& vm = exec->vm();
    67 
     64JSFunction* JSFunction::create(VM& vm, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
     65{
    6866    NativeExecutable* executable;
    6967#if !ENABLE(JIT)
    7068    UNUSED_PARAM(intrinsic);
    7169#else
    72     if (intrinsic != NoIntrinsic && exec->vm().canUseJIT()) {
     70    if (intrinsic != NoIntrinsic && vm.canUseJIT()) {
    7371        ASSERT(nativeConstructor == callHostFunctionAsConstructor);
    7472        executable = vm.getHostFunction(nativeFunction, intrinsic);
     
    7775        executable = vm.getHostFunction(nativeFunction, nativeConstructor);
    7876
    79     JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(exec, globalObject, globalObject->functionStructure());
     77    JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, globalObject, globalObject->functionStructure());
    8078    // Can't do this during initialization because getHostFunction might do a GC allocation.
    8179    function->finishCreation(vm, executable, length, name);
     
    8886}
    8987
    90 JSFunction::JSFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
    91     : Base(exec->vm(), structure)
     88JSFunction::JSFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     89    : Base(vm, structure)
    9290    , m_executable()
    93     , m_scope(exec->vm(), this, globalObject)
     91    , m_scope(vm, this, globalObject)
    9492    // We initialize blind so that changes to the prototype after function creation but before
    9593    // the optimizer kicks in don't disable optimizations. Once the optimizer kicks in, the
     
    326324            bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    327325            if (!result) {
    328                 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
     326                thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor);
    329327                result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    330328                ASSERT(result);
     
    350348            bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    351349            if (!result) {
    352                 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
     350                thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor);
    353351                result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);
    354352                ASSERT(result);
     
    448446            PropertySlot slot(thisObject);
    449447            if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
    450                 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
     448                thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor);
    451449            return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
    452450        }
     
    456454            PropertySlot slot(thisObject);
    457455            if (!Base::getOwnPropertySlot(thisObject, exec, propertyName, slot))
    458                 thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
     456                thisObject->putDirectAccessor(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec->vm()), DontDelete | DontEnum | Accessor);
    459457            return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException);
    460458        }
  • trunk/Source/JavaScriptCore/runtime/JSFunction.h

    r156498 r156602  
    5959        typedef JSDestructibleObject Base;
    6060
    61         JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
    62 
    63         static JSFunction* create(ExecState* exec, FunctionExecutable* executable, JSScope* scope)
    64         {
    65             VM& vm = exec->vm();
     61        JS_EXPORT_PRIVATE static JSFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
     62
     63        static JSFunction* create(VM& vm, FunctionExecutable* executable, JSScope* scope)
     64        {
    6665            JSFunction* function = new (NotNull, allocateCell<JSFunction>(vm.heap)) JSFunction(vm, executable, scope);
    6766            ASSERT(function->structure()->globalObject());
     
    163162        const static unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
    164163
    165         JS_EXPORT_PRIVATE JSFunction(ExecState*, JSGlobalObject*, Structure*);
     164        JS_EXPORT_PRIVATE JSFunction(VM&, JSGlobalObject*, Structure*);
    166165        JSFunction(VM&, FunctionExecutable*, JSScope*);
    167166       
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r156521 r156602  
    241241    m_objectPrototype.set(vm, this, ObjectPrototype::create(exec, this, ObjectPrototype::createStructure(vm, this, jsNull())));
    242242    GetterSetter* protoAccessor = GetterSetter::create(vm);
    243     protoAccessor->setGetter(vm, JSFunction::create(exec, this, 0, String(), globalFuncProtoGetter));
    244     protoAccessor->setSetter(vm, JSFunction::create(exec, this, 0, String(), globalFuncProtoSetter));
    245     m_objectPrototype->putDirectAccessor(exec, vm.propertyNames->underscoreProto, protoAccessor, Accessor | DontEnum);
     243    protoAccessor->setGetter(vm, JSFunction::create(vm, this, 0, String(), globalFuncProtoGetter));
     244    protoAccessor->setSetter(vm, JSFunction::create(vm, this, 0, String(), globalFuncProtoSetter));
     245    m_objectPrototype->putDirectNonIndexAccessor(vm, vm.propertyNames->underscoreProto, protoAccessor, Accessor | DontEnum);
    246246    m_functionPrototype->structure()->setPrototypeWithoutTransition(vm, m_objectPrototype.get());
    247247   
     
    385385
    386386
    387     m_evalFunction.set(vm, this, JSFunction::create(exec, this, 1, vm.propertyNames->eval.string(), globalFuncEval));
     387    m_evalFunction.set(vm, this, JSFunction::create(vm, this, 1, vm.propertyNames->eval.string(), globalFuncEval));
    388388    putDirectWithoutTransition(vm, vm.propertyNames->eval, m_evalFunction.get(), DontEnum);
    389389
     
    549549}
    550550
    551 void JSGlobalObject::createThrowTypeError(ExecState* exec)
    552 {
    553     VM& vm = exec->vm();
    554     JSFunction* thrower = JSFunction::create(exec, this, 0, String(), globalFuncThrowTypeError);
     551void JSGlobalObject::createThrowTypeError(VM& vm)
     552{
     553    JSFunction* thrower = JSFunction::create(vm, this, 0, String(), globalFuncThrowTypeError);
    555554    GetterSetter* getterSetter = GetterSetter::create(vm);
    556555    getterSetter->setGetter(vm, thrower);
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r156492 r156602  
    336336    JSFunction* callFunction() const { return m_callFunction.get(); }
    337337    JSFunction* applyFunction() const { return m_applyFunction.get(); }
    338     GetterSetter* throwTypeErrorGetterSetter(ExecState* exec)
     338    GetterSetter* throwTypeErrorGetterSetter(VM& vm)
    339339    {
    340340        if (!m_throwTypeErrorGetterSetter)
    341             createThrowTypeError(exec);
     341            createThrowTypeError(vm);
    342342        return m_throwTypeErrorGetterSetter.get();
    343343    }
     
    545545    void reset(JSValue prototype);
    546546
    547     void createThrowTypeError(ExecState*);
     547    void createThrowTypeError(VM&);
    548548
    549549    JS_EXPORT_PRIVATE static void clearRareData(JSCell*);
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r156521 r156602  
    11931193    }
    11941194
    1195     VM& vm = exec->vm();
    1196 
     1195    putDirectNonIndexAccessor(exec->vm(), propertyName, value, attributes);
     1196}
     1197
     1198void JSObject::putDirectNonIndexAccessor(VM& vm, PropertyName propertyName, JSValue value, unsigned attributes)
     1199{
    11971200    PutPropertySlot slot;
    11981201    putDirectInternal<PutModeDefineOwnProperty>(vm, propertyName, value, attributes, slot, getCallableObject(value));
     
    22032206    StringImpl* name = propertyName.publicName();
    22042207    ASSERT(name);
    2205    
    2206     JSFunction* function = JSFunction::create(exec, globalObject, functionLength, name, nativeFunction, intrinsic);
    2207     putDirect(exec->vm(), propertyName, function, attributes);
     2208
     2209    VM& vm = exec->vm();
     2210    JSFunction* function = JSFunction::create(vm, globalObject, functionLength, name, nativeFunction, intrinsic);
     2211    putDirect(vm, propertyName, function, attributes);
    22082212}
    22092213
     
    22122216    StringImpl* name = propertyName.publicName();
    22132217    ASSERT(name);
    2214    
    2215     JSFunction* function = JSFunction::create(exec, globalObject, functionLength, name, nativeFunction, intrinsic);
    2216     putDirectWithoutTransition(exec->vm(), propertyName, function, attributes);
     2218
     2219    VM& vm = exec->vm();
     2220    JSFunction* function = JSFunction::create(vm, globalObject, functionLength, name, nativeFunction, intrinsic);
     2221    putDirectWithoutTransition(vm, propertyName, function, attributes);
    22172222}
    22182223
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r154471 r156602  
    461461    void putDirect(VM&, PropertyName, JSValue, PutPropertySlot&);
    462462    void putDirectWithoutTransition(VM&, PropertyName, JSValue, unsigned attributes = 0);
     463    void putDirectNonIndexAccessor(VM&, PropertyName, JSValue, unsigned attributes);
    463464    void putDirectAccessor(ExecState*, PropertyName, JSValue, unsigned attributes);
    464465
  • trunk/Source/JavaScriptCore/runtime/MapPrototype.cpp

    r156521 r156602  
    6565
    6666    GetterSetter* accessor = GetterSetter::create(vm);
    67     JSFunction* function = JSFunction::create(exec, globalObject, 0, vm.propertyNames->size.string(), mapProtoFuncSize);
     67    JSFunction* function = JSFunction::create(vm, globalObject, 0, vm.propertyNames->size.string(), mapProtoFuncSize);
    6868    accessor->setGetter(vm, function);
    69     putDirectAccessor(exec, vm.propertyNames->size, accessor, DontEnum | Accessor);
     69    putDirectNonIndexAccessor(vm, vm.propertyNames->size, accessor, DontEnum | Accessor);
    7070}
    7171
  • trunk/Source/JavaScriptCore/runtime/SetPrototype.cpp

    r156521 r156602  
    6363
    6464    GetterSetter* accessor = GetterSetter::create(vm);
    65     JSFunction* function = JSFunction::create(exec, globalObject, 0, vm.propertyNames->size.string(), setProtoFuncSize);
     65    JSFunction* function = JSFunction::create(vm, globalObject, 0, vm.propertyNames->size.string(), setProtoFuncSize);
    6666    accessor->setGetter(vm, function);
    67     putDirectAccessor(exec, vm.propertyNames->size, accessor, DontEnum | Accessor);
     67    putDirectNonIndexAccessor(vm, vm.propertyNames->size, accessor, DontEnum | Accessor);
    6868}
    6969
  • trunk/Source/WebCore/ChangeLog

    r156601 r156602  
     12013-09-28  Andreas Kling  <akling@apple.com>
     2
     3        Pass VM instead of ExecState to JSFunction constructors.
     4        <https://webkit.org/b/122014>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Updated for new JSFunction::create() signature.
     9
    1102013-09-28  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    211
  • trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp

    r156550 r156602  
    275275JSValue objectToStringFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    276276{
    277     return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), objectProtoFuncToString);
     277    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), objectProtoFuncToString);
    278278}
    279279
  • trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r156485 r156602  
    7474JSValue nonCachingStaticFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    7575{
    76     return JSFunction::create(exec, exec->lexicalGlobalObject(), length, propertyName.publicName(), nativeFunction);
     76    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), length, propertyName.publicName(), nativeFunction);
    7777}
    7878
  • trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp

    r156419 r156602  
    4141static JSValue nonCachingStaticBackFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    4242{
    43     return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionBack);
     43    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionBack);
    4444}
    4545
    4646static JSValue nonCachingStaticForwardFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    4747{
    48     return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionForward);
     48    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsHistoryPrototypeFunctionForward);
    4949}
    5050
    5151static JSValue nonCachingStaticGoFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    5252{
    53     return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsHistoryPrototypeFunctionGo);
     53    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsHistoryPrototypeFunctionGo);
    5454}
    5555
  • trunk/Source/WebCore/bindings/js/JSLocationCustom.cpp

    r154422 r156602  
    3333static JSValue nonCachingStaticReplaceFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    3434{
    35     return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionReplace);
     35    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionReplace);
    3636}
    3737
    3838static JSValue nonCachingStaticReloadFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    3939{
    40     return JSFunction::create(exec, exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsLocationPrototypeFunctionReload);
     40    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 0, propertyName.publicName(), jsLocationPrototypeFunctionReload);
    4141}
    4242
    4343static JSValue nonCachingStaticAssignFunctionGetter(ExecState* exec, JSValue, PropertyName propertyName)
    4444{
    45     return JSFunction::create(exec, exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionAssign);
     45    return JSFunction::create(exec->vm(), exec->lexicalGlobalObject(), 1, propertyName.publicName(), jsLocationPrototypeFunctionAssign);
    4646}
    4747
Note: See TracChangeset for help on using the changeset viewer.