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

Pass VM instead of JSGlobalObject to function constructors.

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

Reviewed by Darin Adler.

Functions don't need anything from the global object during their
construction and only use it to get to the VM. Reduce loads by
simply passing the VM around instead.

This patch is mostly mechanical, I just changed the signature of
InternalFunction and worked my way from there until it built.

JSC release binary size -= 4840 bytes.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6d7750ca
...@@ -45,8 +45,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSCallbackFunction); ...@@ -45,8 +45,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSCallbackFunction);
const ClassInfo JSCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackFunction) }; const ClassInfo JSCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackFunction) };
JSCallbackFunction::JSCallbackFunction(JSGlobalObject* globalObject, Structure* structure, JSObjectCallAsFunctionCallback callback) JSCallbackFunction::JSCallbackFunction(VM& vm, Structure* structure, JSObjectCallAsFunctionCallback callback)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
, m_callback(callback) , m_callback(callback)
{ {
} }
...@@ -57,10 +57,10 @@ void JSCallbackFunction::finishCreation(VM& vm, const String& name) ...@@ -57,10 +57,10 @@ void JSCallbackFunction::finishCreation(VM& vm, const String& name)
ASSERT(inherits(info())); ASSERT(inherits(info()));
} }
JSCallbackFunction* JSCallbackFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name) JSCallbackFunction* JSCallbackFunction::create(VM& vm, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name)
{ {
JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, globalObject->callbackFunctionStructure(), callback); JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(vm.heap)) JSCallbackFunction(vm, globalObject->callbackFunctionStructure(), callback);
function->finishCreation(exec->vm(), name); function->finishCreation(vm, name);
return function; return function;
} }
......
...@@ -36,7 +36,7 @@ class JSCallbackFunction : public InternalFunction { ...@@ -36,7 +36,7 @@ class JSCallbackFunction : public InternalFunction {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static JSCallbackFunction* create(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const String& name); static JSCallbackFunction* create(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, const String& name);
DECLARE_INFO; DECLARE_INFO;
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
} }
private: private:
JSCallbackFunction(JSGlobalObject*, Structure*, JSObjectCallAsFunctionCallback); JSCallbackFunction(VM&, Structure*, JSObjectCallAsFunctionCallback);
void finishCreation(VM&, const String& name); void finishCreation(VM&, const String& name);
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
......
...@@ -592,15 +592,15 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue ...@@ -592,15 +592,15 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue
PropertySlot slot2(thisObj); PropertySlot slot2(thisObj);
if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2)) if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2))
return slot2.getValue(exec, propertyName); return slot2.getValue(exec, propertyName);
if (StringImpl* name = propertyName.publicName()) { if (StringImpl* name = propertyName.publicName()) {
for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) { for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) { if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
if (StaticFunctionEntry* entry = staticFunctions->get(name)) { if (StaticFunctionEntry* entry = staticFunctions->get(name)) {
if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) { if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
VM& vm = exec->vm();
JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, name); JSObject* o = JSCallbackFunction::create(vm, thisObj->globalObject(), callAsFunction, name);
thisObj->putDirect(exec->vm(), propertyName, o, entry->attributes); thisObj->putDirect(vm, propertyName, o, entry->attributes);
return o; return o;
} }
} }
......
...@@ -105,7 +105,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name, ...@@ -105,7 +105,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
} }
ExecState* exec = toJS(ctx); ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec); APIEntryShim entryShim(exec);
return toRef(JSCallbackFunction::create(exec, exec->lexicalGlobalObject(), callAsFunction, name ? name->string() : ASCIILiteral("anonymous"))); return toRef(JSCallbackFunction::create(exec->vm(), exec->lexicalGlobalObject(), callAsFunction, name ? name->string() : ASCIILiteral("anonymous")));
} }
JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor) JSObjectRef JSObjectMakeConstructor(JSContextRef ctx, JSClassRef jsClass, JSObjectCallAsConstructorCallback callAsConstructor)
......
...@@ -47,7 +47,7 @@ class ObjCCallbackFunction : public InternalFunction { ...@@ -47,7 +47,7 @@ class ObjCCallbackFunction : public InternalFunction {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static ObjCCallbackFunction* create(ExecState*, JSGlobalObject*, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl>); static ObjCCallbackFunction* create(VM&, JSGlobalObject*, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl>);
static void destroy(JSCell*); static void destroy(JSCell*);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
...@@ -61,7 +61,7 @@ public: ...@@ -61,7 +61,7 @@ public:
ObjCCallbackFunctionImpl* impl() { return m_impl.get(); } ObjCCallbackFunctionImpl* impl() { return m_impl.get(); }
protected: protected:
ObjCCallbackFunction(JSGlobalObject*, JSObjectCallAsFunctionCallback, PassOwnPtr<ObjCCallbackFunctionImpl>); ObjCCallbackFunction(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, PassOwnPtr<ObjCCallbackFunctionImpl>);
private: private:
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
......
...@@ -467,17 +467,17 @@ static JSValueRef objCCallbackFunctionCallAsFunction(JSContextRef callerContext, ...@@ -467,17 +467,17 @@ static JSValueRef objCCallbackFunctionCallAsFunction(JSContextRef callerContext,
const JSC::ClassInfo ObjCCallbackFunction::s_info = { "CallbackFunction", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ObjCCallbackFunction) }; const JSC::ClassInfo ObjCCallbackFunction::s_info = { "CallbackFunction", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ObjCCallbackFunction) };
ObjCCallbackFunction::ObjCCallbackFunction(JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, PassOwnPtr<ObjCCallbackFunctionImpl> impl) ObjCCallbackFunction::ObjCCallbackFunction(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
: Base(globalObject, globalObject->objcCallbackFunctionStructure()) : Base(vm, globalObject->objcCallbackFunctionStructure())
, m_callback(callback) , m_callback(callback)
, m_impl(impl) , m_impl(impl)
{ {
} }
ObjCCallbackFunction* ObjCCallbackFunction::create(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl> impl) ObjCCallbackFunction* ObjCCallbackFunction::create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, const String& name, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
{ {
ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(*exec->heap())) ObjCCallbackFunction(globalObject, objCCallbackFunctionCallAsFunction, impl); ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(vm.heap)) ObjCCallbackFunction(vm, globalObject, objCCallbackFunctionCallAsFunction, impl);
function->finishCreation(exec->vm(), name); function->finishCreation(vm, name);
return function; return function;
} }
...@@ -589,7 +589,7 @@ static JSObjectRef objCCallbackFunctionForInvocation(JSContext *context, NSInvoc ...@@ -589,7 +589,7 @@ static JSObjectRef objCCallbackFunctionForInvocation(JSContext *context, NSInvoc
JSC::APIEntryShim shim(exec); JSC::APIEntryShim shim(exec);
OwnPtr<JSC::ObjCCallbackFunctionImpl> impl = adoptPtr(new JSC::ObjCCallbackFunctionImpl(context, invocation, type, instanceClass, arguments.release(), result.release())); OwnPtr<JSC::ObjCCallbackFunctionImpl> impl = adoptPtr(new JSC::ObjCCallbackFunctionImpl(context, invocation, type, instanceClass, arguments.release(), result.release()));
// FIXME: Maybe we could support having the selector as the name of the function to make it a bit more user-friendly from the JS side? // FIXME: Maybe we could support having the selector as the name of the function to make it a bit more user-friendly from the JS side?
return toRef(JSC::ObjCCallbackFunction::create(exec, exec->lexicalGlobalObject(), "", impl.release())); return toRef(JSC::ObjCCallbackFunction::create(exec->vm(), exec->lexicalGlobalObject(), "", impl.release()));
} }
JSObjectRef objCCallbackFunctionForMethod(JSContext *context, Class cls, Protocol *protocol, BOOL isInstanceMethod, SEL sel, const char* types) JSObjectRef objCCallbackFunctionForMethod(JSContext *context, Class cls, Protocol *protocol, BOOL isInstanceMethod, SEL sel, const char* types)
......
2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of JSGlobalObject to function constructors.
<https://webkit.org/b/122082>
Reviewed by Darin Adler.
Functions don't need anything from the global object during their
construction and only use it to get to the VM. Reduce loads by
simply passing the VM around instead.
This patch is mostly mechanical, I just changed the signature of
InternalFunction and worked my way from there until it built.
JSC release binary size -= 4840 bytes.
2013-09-29 Andreas Kling <akling@apple.com> 2013-09-29 Andreas Kling <akling@apple.com>
Pass VM instead of JSGlobalObject to ArrayPrototype constructor. Pass VM instead of JSGlobalObject to ArrayPrototype constructor.
...@@ -54,8 +54,8 @@ const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_in ...@@ -54,8 +54,8 @@ const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_in
@end @end
*/ */
ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* structure) ArrayConstructor::ArrayConstructor(VM& vm, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
{ {
} }
......
...@@ -33,10 +33,9 @@ class ArrayConstructor : public InternalFunction { ...@@ -33,10 +33,9 @@ class ArrayConstructor : public InternalFunction {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static ArrayConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype) static ArrayConstructor* create(VM& vm, Structure* structure, ArrayPrototype* arrayPrototype)
{ {
VM& vm = exec->vm(); ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(vm, structure);
ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(globalObject, structure);
constructor->finishCreation(vm, arrayPrototype); constructor->finishCreation(vm, arrayPrototype);
return constructor; return constructor;
} }
...@@ -53,7 +52,7 @@ protected: ...@@ -53,7 +52,7 @@ protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private: private:
ArrayConstructor(JSGlobalObject*, Structure*); ArrayConstructor(VM&, Structure*);
static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&); static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
static ConstructType getConstructData(JSCell*, ConstructData&); static ConstructType getConstructData(JSCell*, ConstructData&);
......
...@@ -31,8 +31,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanConstructor); ...@@ -31,8 +31,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanConstructor);
const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) }; const ClassInfo BooleanConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(BooleanConstructor) };
BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure) BooleanConstructor::BooleanConstructor(VM& vm, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
{ {
} }
......
...@@ -31,10 +31,9 @@ class BooleanConstructor : public InternalFunction { ...@@ -31,10 +31,9 @@ class BooleanConstructor : public InternalFunction {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static BooleanConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype) static BooleanConstructor* create(VM& vm, Structure* structure, BooleanPrototype* booleanPrototype)
{ {
VM& vm = exec->vm(); BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(vm, structure);
BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(globalObject, structure);
constructor->finishCreation(vm, booleanPrototype); constructor->finishCreation(vm, booleanPrototype);
return constructor; return constructor;
} }
...@@ -50,7 +49,7 @@ protected: ...@@ -50,7 +49,7 @@ protected:
void finishCreation(VM&, BooleanPrototype*); void finishCreation(VM&, BooleanPrototype*);
private: private:
BooleanConstructor(JSGlobalObject*, Structure*); BooleanConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&); static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
}; };
......
...@@ -74,8 +74,8 @@ const ClassInfo DateConstructor::s_info = { "Function", &InternalFunction::s_inf ...@@ -74,8 +74,8 @@ const ClassInfo DateConstructor::s_info = { "Function", &InternalFunction::s_inf
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(DateConstructor); STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(DateConstructor);
DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* structure) DateConstructor::DateConstructor(VM& vm, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
{ {
} }
......
...@@ -31,10 +31,10 @@ namespace JSC { ...@@ -31,10 +31,10 @@ namespace JSC {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static DateConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype) static DateConstructor* create(VM& vm, Structure* structure, DatePrototype* datePrototype)
{ {
DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(*exec->heap())) DateConstructor(globalObject, structure); DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(vm.heap)) DateConstructor(vm, structure);
constructor->finishCreation(exec->vm(), datePrototype); constructor->finishCreation(vm, datePrototype);
return constructor; return constructor;
} }
...@@ -50,7 +50,7 @@ namespace JSC { ...@@ -50,7 +50,7 @@ namespace JSC {
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags; static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
private: private:
DateConstructor(JSGlobalObject*, Structure*); DateConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&); static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
......
...@@ -73,8 +73,8 @@ namespace JSC { ...@@ -73,8 +73,8 @@ namespace JSC {
class StrictModeTypeErrorFunction : public InternalFunction { class StrictModeTypeErrorFunction : public InternalFunction {
private: private:
StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const String& message) StrictModeTypeErrorFunction(VM& vm, Structure* structure, const String& message)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
, m_message(message) , m_message(message)
{ {
} }
...@@ -84,10 +84,10 @@ namespace JSC { ...@@ -84,10 +84,10 @@ namespace JSC {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const String& message) static StrictModeTypeErrorFunction* create(VM& vm, Structure* structure, const String& message)
{ {
StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message); StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(vm.heap)) StrictModeTypeErrorFunction(vm, structure, message);
function->finishCreation(exec->vm(), String()); function->finishCreation(vm, String());
return function; return function;
} }
......
...@@ -33,8 +33,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ErrorConstructor); ...@@ -33,8 +33,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(ErrorConstructor);
const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorConstructor) }; const ClassInfo ErrorConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(ErrorConstructor) };
ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* structure) ErrorConstructor::ErrorConstructor(VM& vm, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
{ {
} }
......
...@@ -32,10 +32,9 @@ namespace JSC { ...@@ -32,10 +32,9 @@ namespace JSC {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static ErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype) static ErrorConstructor* create(VM& vm, Structure* structure, ErrorPrototype* errorPrototype)
{ {
VM& vm = exec->vm(); ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(vm, structure);
ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(globalObject, structure);
constructor->finishCreation(vm, errorPrototype); constructor->finishCreation(vm, errorPrototype);
return constructor; return constructor;
} }
...@@ -51,7 +50,7 @@ namespace JSC { ...@@ -51,7 +50,7 @@ namespace JSC {
void finishCreation(VM&, ErrorPrototype*); void finishCreation(VM&, ErrorPrototype*);
private: private:
ErrorConstructor(JSGlobalObject*, Structure*); ErrorConstructor(VM&, Structure*);
static ConstructType getConstructData(JSCell*, ConstructData&); static ConstructType getConstructData(JSCell*, ConstructData&);
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
}; };
......
...@@ -39,8 +39,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(FunctionConstructor); ...@@ -39,8 +39,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(FunctionConstructor);
const ClassInfo FunctionConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionConstructor) }; const ClassInfo FunctionConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionConstructor) };
FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure* structure) FunctionConstructor::FunctionConstructor(VM& vm, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
{ {
} }
......
...@@ -35,10 +35,9 @@ namespace JSC { ...@@ -35,10 +35,9 @@ namespace JSC {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static FunctionConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype) static FunctionConstructor* create(VM& vm, Structure* structure, FunctionPrototype* functionPrototype)
{ {
VM& vm = exec->vm(); FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(vm, structure);
FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(globalObject, structure);
constructor->finishCreation(vm, functionPrototype); constructor->finishCreation(vm, functionPrototype);
return constructor; return constructor;
} }
...@@ -51,7 +50,7 @@ namespace JSC { ...@@ -51,7 +50,7 @@ namespace JSC {
} }
private: private:
FunctionConstructor(JSGlobalObject*, Structure*); FunctionConstructor(VM&, Structure*);
void finishCreation(VM&, 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&);
......
...@@ -42,8 +42,8 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*); ...@@ -42,8 +42,8 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*); static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*); static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*);
FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure) FunctionPrototype::FunctionPrototype(VM& vm, Structure* structure)
: InternalFunction(globalObject, structure) : InternalFunction(vm, structure)
{ {
} }
......
...@@ -29,10 +29,9 @@ namespace JSC { ...@@ -29,10 +29,9 @@ namespace JSC {
public: public:
typedef InternalFunction Base; typedef InternalFunction Base;
static FunctionPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure) static FunctionPrototype* create(VM& vm, Structure* structure)
{ {
VM& vm = exec->vm(); FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(vm, structure);
FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(globalObject, structure);
prototype->finishCreation(vm, String()); prototype->finishCreation(vm, String());
return prototype; return prototype;
} }
...@@ -50,7 +49,7 @@ namespace JSC { ...@@ -50,7 +49,7 @@ namespace JSC {
void finishCreation(VM&, const String& name); void finishCreation(VM&, const String& name);
private: private:
FunctionPrototype(JSGlobalObject*, Structure*); FunctionPrototype(VM&, Structure*);
static CallType getCallData(JSCell*, CallData&); static CallType getCallData(JSCell*, CallData&);
}; };
......
...@@ -34,8 +34,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(InternalFunction); ...@@ -34,8 +34,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(InternalFunction);
const ClassInfo InternalFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(InternalFunction) }; const ClassInfo InternalFunction::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(InternalFunction) };
InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* structure) InternalFunction::InternalFunction(VM& vm, Structure* structure)
: JSDestructibleObject(globalObject->vm(), structure) : JSDestructibleObject(vm, structure)
{ {
} }
......
...@@ -49,7 +49,7 @@ namespace JSC { ...@@ -49,7 +49,7 @@ namespace JSC {
protected: protected:
static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags; static const unsigned StructureFlags = ImplementsHasInstance | JSObject::StructureFlags;
JS_EXPORT_PRIVATE InternalFunction(JSGlobalObject*, Structure*); JS_EXPORT_PRIVATE InternalFunction(VM&, Structure*);
JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name); JS_EXPORT_PRIVATE void finishCreation(VM&, const String& name);
......
...@@ -40,9 +40,8 @@ const ClassInfo JSArrayBufferConstructor::s_info = { ...@@ -40,9 +40,8 @@ const ClassInfo JSArrayBufferConstructor::s_info = {
CREATE_METHOD_TABLE(JSArrayBufferConstructor) CREATE_METHOD_TABLE(JSArrayBufferConstructor)
}; };
JSArrayBufferConstructor::JSArrayBufferConstructor( JSArrayBufferConstructor::JSArrayBufferConstructor(VM& vm, Structure* structure)
JSGlobalObject* globalObject, Structure* structure) : Base(vm, structure)
: Base(globalObject, structure)
{ {
} }
...@@ -53,12 +52,11 @@ void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* pr ...@@ -53,12 +52,11 @@ void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* pr
putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly); putDirectWithoutTransition(vm, vm.propertyNames->length