Commit 22558063 authored by akling@apple.com's avatar akling@apple.com

Pass VM instead of ExecState to many finishCreation() functions.

<https://webkit.org/b/121975>

Reviewed by Sam Weinig.

Reduce unnecessary loads by passing the VM to object creation
functions that don't need the ExecState.

There are tons of opportunities in this area, I'm just scratching
the surface.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156498 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c68e9807
2013-09-26 Andreas Kling <akling@apple.com>
Pass VM instead of ExecState to many finishCreation() functions.
<https://webkit.org/b/121975>
Reviewed by Sam Weinig.
Reduce unnecessary loads by passing the VM to object creation
functions that don't need the ExecState.
There are tons of opportunities in this area, I'm just scratching
the surface.
2013-09-26 Commit Queue <commit-queue@webkit.org> 2013-09-26 Commit Queue <commit-queue@webkit.org>
Unreviewed, rolling out r156464 and r156480. Unreviewed, rolling out r156464 and r156480.
...@@ -59,11 +59,11 @@ ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* stru ...@@ -59,11 +59,11 @@ ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* stru
{ {
} }
void ArrayConstructor::finishCreation(ExecState* exec, ArrayPrototype* arrayPrototype) void ArrayConstructor::finishCreation(VM& vm, ArrayPrototype* arrayPrototype)
{ {
Base::finishCreation(exec->vm(), arrayPrototype->classInfo()->className); Base::finishCreation(vm, arrayPrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
} }
bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot) bool ArrayConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
......
...@@ -35,8 +35,9 @@ public: ...@@ -35,8 +35,9 @@ public:
static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype) static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype)
{ {
ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(*exec->heap())) ArrayConstructor(globalObject, structure); VM& vm = exec->vm();
constructor->finishCreation(exec, arrayPrototype); ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(globalObject, structure);
constructor->finishCreation(vm, arrayPrototype);
return constructor; return constructor;
} }
...@@ -48,7 +49,7 @@ public: ...@@ -48,7 +49,7 @@ public:
} }
protected: protected:
void finishCreation(ExecState*, ArrayPrototype*); void finishCreation(VM&, ArrayPrototype*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private: private:
......
...@@ -36,13 +36,13 @@ BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* ...@@ -36,13 +36,13 @@ BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure*
{ {
} }
void BooleanConstructor::finishCreation(ExecState* exec, BooleanPrototype* booleanPrototype) void BooleanConstructor::finishCreation(VM& vm, BooleanPrototype* booleanPrototype)
{ {
Base::finishCreation(exec->vm(), booleanPrototype->classInfo()->className); Base::finishCreation(vm, booleanPrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
// no. of arguments for constructor // no. of arguments for constructor
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
} }
// ECMA 15.6.2 // ECMA 15.6.2
......
...@@ -33,8 +33,9 @@ public: ...@@ -33,8 +33,9 @@ public:
static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype) static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype)
{ {
BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(*exec->heap())) BooleanConstructor(globalObject, structure); VM& vm = exec->vm();
constructor->finishCreation(exec, booleanPrototype); BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(globalObject, structure);
constructor->finishCreation(vm, booleanPrototype);
return constructor; return constructor;
} }
...@@ -46,7 +47,7 @@ public: ...@@ -46,7 +47,7 @@ public:
} }
protected: protected:
void finishCreation(ExecState*, BooleanPrototype*); void finishCreation(VM&, BooleanPrototype*);
private: private:
BooleanConstructor(JSGlobalObject*, Structure*); BooleanConstructor(JSGlobalObject*, Structure*);
......
...@@ -55,10 +55,10 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, Structure* structure) ...@@ -55,10 +55,10 @@ BooleanPrototype::BooleanPrototype(ExecState* exec, Structure* structure)
{ {
} }
void BooleanPrototype::finishCreation(ExecState* exec, JSGlobalObject*) void BooleanPrototype::finishCreation(VM& vm, JSGlobalObject*)
{ {
Base::finishCreation(exec->vm()); Base::finishCreation(vm);
setInternalValue(exec->vm(), jsBoolean(false)); setInternalValue(vm, jsBoolean(false));
ASSERT(inherits(info())); ASSERT(inherits(info()));
} }
......
...@@ -31,8 +31,9 @@ public: ...@@ -31,8 +31,9 @@ public:
static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{ {
BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(*exec->heap())) BooleanPrototype(exec, structure); VM& vm = exec->vm();
prototype->finishCreation(exec, globalObject); BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(vm.heap)) BooleanPrototype(exec, structure);
prototype->finishCreation(vm, globalObject);
return prototype; return prototype;
} }
...@@ -44,7 +45,7 @@ public: ...@@ -44,7 +45,7 @@ public:
} }
protected: protected:
void finishCreation(ExecState*, JSGlobalObject*); void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags;
private: private:
......
...@@ -79,11 +79,11 @@ DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* struct ...@@ -79,11 +79,11 @@ DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* struct
{ {
} }
void DateConstructor::finishCreation(ExecState* exec, DatePrototype* datePrototype) void DateConstructor::finishCreation(VM& vm, DatePrototype* datePrototype)
{ {
Base::finishCreation(exec->vm(), datePrototype->classInfo()->className); Base::finishCreation(vm, datePrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
} }
bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot) bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
......
...@@ -34,7 +34,7 @@ namespace JSC { ...@@ -34,7 +34,7 @@ namespace JSC {
static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype) static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype)
{ {
DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure); DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure);
constructor->finishCreation(exec, datePrototype); constructor->finishCreation(exec->vm(), datePrototype);
return constructor; return constructor;
} }
...@@ -46,7 +46,7 @@ namespace JSC { ...@@ -46,7 +46,7 @@ namespace JSC {
} }
protected: protected:
void finishCreation(ExecState*, DatePrototype*); void finishCreation(VM&, DatePrototype*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private: private:
......
...@@ -506,9 +506,9 @@ DatePrototype::DatePrototype(ExecState* exec, Structure* structure) ...@@ -506,9 +506,9 @@ DatePrototype::DatePrototype(ExecState* exec, Structure* structure)
{ {
} }
void DatePrototype::finishCreation(ExecState* exec, JSGlobalObject*) void DatePrototype::finishCreation(VM& vm, JSGlobalObject*)
{ {
Base::finishCreation(exec->vm()); Base::finishCreation(vm);
ASSERT(inherits(info())); ASSERT(inherits(info()));
// The constructor will be added later, after DateConstructor has been built. // The constructor will be added later, after DateConstructor has been built.
......
...@@ -36,8 +36,9 @@ namespace JSC { ...@@ -36,8 +36,9 @@ namespace JSC {
static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{ {
DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(*exec->heap())) DatePrototype(exec, structure); VM& vm = exec->vm();
prototype->finishCreation(exec, globalObject); DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(exec, structure);
prototype->finishCreation(vm, globalObject);
return prototype; return prototype;
} }
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
...@@ -50,7 +51,7 @@ namespace JSC { ...@@ -50,7 +51,7 @@ namespace JSC {
} }
protected: protected:
void finishCreation(ExecState*, JSGlobalObject*); void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
}; };
......
...@@ -38,12 +38,12 @@ ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* stru ...@@ -38,12 +38,12 @@ ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* stru
{ {
} }
void ErrorConstructor::finishCreation(ExecState* exec, ErrorPrototype* errorPrototype) void ErrorConstructor::finishCreation(VM& vm, ErrorPrototype* errorPrototype)
{ {
Base::finishCreation(exec->vm(), errorPrototype->classInfo()->className); Base::finishCreation(vm, errorPrototype->classInfo()->className);
// ECMA 15.11.3.1 Error.prototype // ECMA 15.11.3.1 Error.prototype
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
} }
// ECMA 15.9.3 // ECMA 15.9.3
......
...@@ -34,8 +34,9 @@ namespace JSC { ...@@ -34,8 +34,9 @@ namespace JSC {
static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype) static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype)
{ {
ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(*exec->heap())) ErrorConstructor(globalObject, structure); VM& vm = exec->vm();
constructor->finishCreation(exec, errorPrototype); ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(globalObject, structure);
constructor->finishCreation(vm, errorPrototype);
return constructor; return constructor;
} }
...@@ -47,7 +48,7 @@ namespace JSC { ...@@ -47,7 +48,7 @@ namespace JSC {
} }
protected: protected:
void finishCreation(ExecState*, ErrorPrototype*); void finishCreation(VM&, ErrorPrototype*);
private: private:
ErrorConstructor(JSGlobalObject*, Structure*); ErrorConstructor(JSGlobalObject*, Structure*);
......
...@@ -54,11 +54,11 @@ ErrorPrototype::ErrorPrototype(ExecState* exec, Structure* structure) ...@@ -54,11 +54,11 @@ ErrorPrototype::ErrorPrototype(ExecState* exec, Structure* structure)
{ {
} }
void ErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject*) void ErrorPrototype::finishCreation(VM& vm, JSGlobalObject*)
{ {
Base::finishCreation(exec->vm(), ""); Base::finishCreation(vm, "");
ASSERT(inherits(info())); ASSERT(inherits(info()));
putDirect(exec->vm(), exec->propertyNames().name, jsNontrivialString(exec, String(ASCIILiteral("Error"))), DontEnum); putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("Error"))), DontEnum);
} }
bool ErrorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot) bool ErrorPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot &slot)
......
...@@ -33,8 +33,9 @@ namespace JSC { ...@@ -33,8 +33,9 @@ namespace JSC {
static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{ {
ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, structure); VM& vm = exec->vm();
prototype->finishCreation(exec, globalObject); ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(exec, structure);
prototype->finishCreation(vm, globalObject);
return prototype; return prototype;
} }
...@@ -47,7 +48,7 @@ namespace JSC { ...@@ -47,7 +48,7 @@ namespace JSC {
protected: protected:
ErrorPrototype(ExecState*, Structure*); ErrorPrototype(ExecState*, Structure*);
void finishCreation(ExecState*, JSGlobalObject*); void finishCreation(VM&, JSGlobalObject*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
......
...@@ -44,13 +44,13 @@ FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure ...@@ -44,13 +44,13 @@ FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure
{ {
} }
void FunctionConstructor::finishCreation(ExecState* exec, FunctionPrototype* functionPrototype) void FunctionConstructor::finishCreation(VM& vm, FunctionPrototype* functionPrototype)
{ {
Base::finishCreation(exec->vm(), functionPrototype->classInfo()->className); Base::finishCreation(vm, functionPrototype->classInfo()->className);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
// Number of arguments for constructor // Number of arguments for constructor
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontDelete | DontEnum); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
} }
static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec) static EncodedJSValue JSC_HOST_CALL constructWithFunctionConstructor(ExecState* exec)
......
...@@ -37,8 +37,9 @@ namespace JSC { ...@@ -37,8 +37,9 @@ namespace JSC {
static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype) static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype)
{ {
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(*exec->heap())) FunctionConstructor(globalObject, structure); VM& vm = exec->vm();
constructor->finishCreation(exec, functionPrototype); FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(globalObject, structure);
constructor->finishCreation(vm, functionPrototype);
return constructor; return constructor;
} }
...@@ -51,7 +52,7 @@ namespace JSC { ...@@ -51,7 +52,7 @@ namespace JSC {
private: private:
FunctionConstructor(JSGlobalObject*, Structure*); FunctionConstructor(JSGlobalObject*, Structure*);
void finishCreation(ExecState*, FunctionPrototype*); void finishCreation(VM&, FunctionPrototype*);
static ConstructType getConstructData(JSCell*, ConstructData&); static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
}; };
......
...@@ -47,10 +47,10 @@ FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* st ...@@ -47,10 +47,10 @@ FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* st
{ {
} }
void FunctionPrototype::finishCreation(ExecState* exec, const String& name) void FunctionPrototype::finishCreation(VM& vm, const String& name)
{ {
Base::finishCreation(exec->vm(), name); Base::finishCreation(vm, name);
putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum); putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
} }
void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, JSFunction** callFunction, JSFunction** applyFunction) void FunctionPrototype::addFunctionProperties(ExecState* exec, JSGlobalObject* globalObject, JSFunction** callFunction, JSFunction** applyFunction)
......
...@@ -31,8 +31,9 @@ namespace JSC { ...@@ -31,8 +31,9 @@ namespace JSC {
static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
{ {
FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(*exec->heap())) FunctionPrototype(globalObject, structure); VM& vm = exec->vm();
prototype->finishCreation(exec, String()); FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(globalObject, structure);
prototype->finishCreation(vm, String());
return prototype; return prototype;
} }
...@@ -46,7 +47,7 @@ namespace JSC { ...@@ -46,7 +47,7 @@ namespace JSC {
DECLARE_INFO; DECLARE_INFO;
protected: protected:
void finishCreation(ExecState*, const String& name); void finishCreation(VM&, const String& name);
private: private:
FunctionPrototype(JSGlobalObject*, Structure*); FunctionPrototype(JSGlobalObject*, Structure*);
......
...@@ -46,16 +46,17 @@ namespace JSC { ...@@ -46,16 +46,17 @@ namespace JSC {
static JSAPIValueWrapper* create(ExecState* exec, JSValue value) static JSAPIValueWrapper* create(ExecState* exec, JSValue value)
{ {
JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(*exec->heap())) JSAPIValueWrapper(exec); VM& vm = exec->vm();
wrapper->finishCreation(exec, value); JSAPIValueWrapper* wrapper = new (NotNull, allocateCell<JSAPIValueWrapper>(vm.heap)) JSAPIValueWrapper(exec);
wrapper->finishCreation(vm, value);
return wrapper; return wrapper;
} }
protected: protected:
void finishCreation(ExecState* exec, JSValue value) void finishCreation(VM& vm, JSValue value)
{ {
Base::finishCreation(exec->vm()); Base::finishCreation(vm);
m_value.set(exec->vm(), this, value); m_value.set(vm, this, value);
ASSERT(!value.isCell()); ASSERT(!value.isCell());
} }
......
...@@ -76,11 +76,12 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec) ...@@ -76,11 +76,12 @@ EncodedJSValue JSC_HOST_CALL boundFunctionConstruct(ExecState* exec)
JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name) JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
{ {
VM& vm = exec->vm();
ConstructData constructData; ConstructData constructData;
ConstructType constructType = JSC::getConstructData(targetFunction, constructData); ConstructType constructType = JSC::getConstructData(targetFunction, constructData);
bool canConstruct = constructType != ConstructTypeNone; bool canConstruct = constructType != ConstructTypeNone;
NativeExecutable* executable = exec->vm().getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor); NativeExecutable* executable = vm.getHostFunction(boundFunctionCall, canConstruct ? boundFunctionConstruct : callHostFunctionAsConstructor);
JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(*exec->heap())) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs); JSBoundFunction* function = new (NotNull, allocateCell<JSBoundFunction>(vm.heap)) JSBoundFunction(exec, globalObject, globalObject->boundFunctionStructure(), targetFunction, boundThis, boundArgs);
function->finishCreation(exec, executable, length, name); function->finishCreation(exec, executable, length, name);
return function; return function;
...@@ -106,11 +107,12 @@ JSBoundFunction::JSBoundFunction(ExecState* exec, JSGlobalObject* globalObject, ...@@ -106,11 +107,12 @@ JSBoundFunction::JSBoundFunction(ExecState* exec, JSGlobalObject* globalObject,
void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name) void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name)
{ {
Base::finishCreation(exec, executable, length, name); VM& vm = exec->vm();
Base::finishCreation(vm, executable, length, name);
ASSERT(inherits(info())); ASSERT(inherits(info()));
putDirectAccessor(exec, exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); putDirectAccessor(exec, vm.propertyNames->arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
putDirectAccessor(exec, exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); putDirectAccessor(exec, vm.propertyNames->caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor);
} }
void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor) void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor)
......
...@@ -63,20 +63,22 @@ bool JSFunction::isHostFunctionNonInline() const ...@@ -63,20 +63,22 @@ bool JSFunction::isHostFunctionNonInline() const
JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor) JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
{ {
VM& vm = exec->vm();
NativeExecutable* executable; NativeExecutable* executable;
#if !ENABLE(JIT) #if !ENABLE(JIT)