Pass VM instead of JSGlobalObject to function constructors.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2013 03:45:30 +0000 (03:45 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2013 03:45:30 +0000 (03:45 +0000)
<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: https://svn.webkit.org/repository/webkit/trunk@156624 268f45cc-cd09-0410-ab3c-d52691b4dbfc

52 files changed:
Source/JavaScriptCore/API/JSCallbackFunction.cpp
Source/JavaScriptCore/API/JSCallbackFunction.h
Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
Source/JavaScriptCore/API/JSObjectRef.cpp
Source/JavaScriptCore/API/ObjCCallbackFunction.h
Source/JavaScriptCore/API/ObjCCallbackFunction.mm
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayConstructor.cpp
Source/JavaScriptCore/runtime/ArrayConstructor.h
Source/JavaScriptCore/runtime/BooleanConstructor.cpp
Source/JavaScriptCore/runtime/BooleanConstructor.h
Source/JavaScriptCore/runtime/DateConstructor.cpp
Source/JavaScriptCore/runtime/DateConstructor.h
Source/JavaScriptCore/runtime/Error.h
Source/JavaScriptCore/runtime/ErrorConstructor.cpp
Source/JavaScriptCore/runtime/ErrorConstructor.h
Source/JavaScriptCore/runtime/FunctionConstructor.cpp
Source/JavaScriptCore/runtime/FunctionConstructor.h
Source/JavaScriptCore/runtime/FunctionPrototype.cpp
Source/JavaScriptCore/runtime/FunctionPrototype.h
Source/JavaScriptCore/runtime/InternalFunction.cpp
Source/JavaScriptCore/runtime/InternalFunction.h
Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
Source/JavaScriptCore/runtime/JSArrayBufferConstructor.h
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructor.h
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructorInlines.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSPromiseCallback.cpp
Source/JavaScriptCore/runtime/JSPromiseCallback.h
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
Source/JavaScriptCore/runtime/JSPromiseConstructor.h
Source/JavaScriptCore/runtime/JSPromisePrototype.cpp
Source/JavaScriptCore/runtime/JSPromiseResolver.cpp
Source/JavaScriptCore/runtime/JSPromiseResolverConstructor.cpp
Source/JavaScriptCore/runtime/JSPromiseResolverConstructor.h
Source/JavaScriptCore/runtime/MapConstructor.h
Source/JavaScriptCore/runtime/NameConstructor.cpp
Source/JavaScriptCore/runtime/NameConstructor.h
Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
Source/JavaScriptCore/runtime/NativeErrorConstructor.h
Source/JavaScriptCore/runtime/NumberConstructor.cpp
Source/JavaScriptCore/runtime/NumberConstructor.h
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.h
Source/JavaScriptCore/runtime/RegExpConstructor.cpp
Source/JavaScriptCore/runtime/RegExpConstructor.h
Source/JavaScriptCore/runtime/SetConstructor.h
Source/JavaScriptCore/runtime/StringConstructor.cpp
Source/JavaScriptCore/runtime/StringConstructor.h
Source/JavaScriptCore/runtime/WeakMapConstructor.h
Source/WebCore/bridge/runtime_method.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp

index b3268bf..1996991 100644 (file)
@@ -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) };
 
-JSCallbackFunction::JSCallbackFunction(JSGlobalObject* globalObject, Structure* structure, JSObjectCallAsFunctionCallback callback)
-    : InternalFunction(globalObject, structure)
+JSCallbackFunction::JSCallbackFunction(VM& vm, Structure* structure, JSObjectCallAsFunctionCallback callback)
+    : InternalFunction(vm, structure)
     , m_callback(callback)
 {
 }
@@ -57,10 +57,10 @@ void JSCallbackFunction::finishCreation(VM& vm, const String& name)
     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);
-    function->finishCreation(exec->vm(), name);
+    JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(vm.heap)) JSCallbackFunction(vm, globalObject->callbackFunctionStructure(), callback);
+    function->finishCreation(vm, name);
     return function;
 }
 
index db49511..5b78967 100644 (file)
@@ -36,7 +36,7 @@ class JSCallbackFunction : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static JSCallbackFunction* create(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const String& name);
+    static JSCallbackFunction* create(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, const String& name);
 
     DECLARE_INFO;
     
@@ -48,7 +48,7 @@ public:
     }
 
 private:
-    JSCallbackFunction(JSGlobalObject*, Structure*, JSObjectCallAsFunctionCallback);
+    JSCallbackFunction(VM&, Structure*, JSObjectCallAsFunctionCallback);
     void finishCreation(VM&, const String& name);
 
     static CallType getCallData(JSCell*, CallData&);
index 3b035a3..661a718 100644 (file)
@@ -592,15 +592,15 @@ JSValue JSCallbackObject<Parent>::staticFunctionGetter(ExecState* exec, JSValue
     PropertySlot slot2(thisObj);
     if (Parent::getOwnPropertySlot(thisObj, exec, propertyName, slot2))
         return slot2.getValue(exec, propertyName);
-    
+
     if (StringImpl* name = propertyName.publicName()) {
         for (JSClassRef jsClass = thisObj->classRef(); jsClass; jsClass = jsClass->parentClass) {
             if (OpaqueJSClassStaticFunctionsTable* staticFunctions = jsClass->staticFunctions(exec)) {
                 if (StaticFunctionEntry* entry = staticFunctions->get(name)) {
                     if (JSObjectCallAsFunctionCallback callAsFunction = entry->callAsFunction) {
-                        
-                        JSObject* o = JSCallbackFunction::create(exec, thisObj->globalObject(), callAsFunction, name);
-                        thisObj->putDirect(exec->vm(), propertyName, o, entry->attributes);
+                        VM& vm = exec->vm();
+                        JSObject* o = JSCallbackFunction::create(vm, thisObj->globalObject(), callAsFunction, name);
+                        thisObj->putDirect(vm, propertyName, o, entry->attributes);
                         return o;
                     }
                 }
index 5e6baa0..4c1b518 100644 (file)
@@ -105,7 +105,7 @@ JSObjectRef JSObjectMakeFunctionWithCallback(JSContextRef ctx, JSStringRef name,
     }
     ExecState* exec = toJS(ctx);
     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)
index 2f2cb97..d313543 100644 (file)
@@ -47,7 +47,7 @@ class ObjCCallbackFunction : public InternalFunction {
 public:
     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 Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
@@ -61,7 +61,7 @@ public:
     ObjCCallbackFunctionImpl* impl() { return m_impl.get(); }
 
 protected:
-    ObjCCallbackFunction(JSGlobalObject*, JSObjectCallAsFunctionCallback, PassOwnPtr<ObjCCallbackFunctionImpl>);
+    ObjCCallbackFunction(VM&, JSGlobalObject*, JSObjectCallAsFunctionCallback, PassOwnPtr<ObjCCallbackFunctionImpl>);
 
 private:
     static CallType getCallData(JSCell*, CallData&);
index e61874d..1b2b5c8 100644 (file)
@@ -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) };
 
-ObjCCallbackFunction::ObjCCallbackFunction(JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
-    : Base(globalObject, globalObject->objcCallbackFunctionStructure())
+ObjCCallbackFunction::ObjCCallbackFunction(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, PassOwnPtr<ObjCCallbackFunctionImpl> impl)
+    : Base(vm, globalObject->objcCallbackFunctionStructure())
     , m_callback(callback)
     , 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);
-    function->finishCreation(exec->vm(), name);
+    ObjCCallbackFunction* function = new (NotNull, allocateCell<ObjCCallbackFunction>(vm.heap)) ObjCCallbackFunction(vm, globalObject, objCCallbackFunctionCallAsFunction, impl);
+    function->finishCreation(vm, name);
     return function;
 }
 
@@ -589,7 +589,7 @@ static JSObjectRef objCCallbackFunctionForInvocation(JSContext *context, NSInvoc
     JSC::APIEntryShim shim(exec);
     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?
-    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)
index 3780ff5..a7639e4 100644 (file)
@@ -1,5 +1,21 @@
 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>
+
         Pass VM instead of JSGlobalObject to ArrayPrototype constructor.
         <https://webkit.org/b/122079>
 
index 26e4d96..3d2766d 100644 (file)
@@ -54,8 +54,8 @@ const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_in
 @end
 */
 
-ArrayConstructor::ArrayConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+ArrayConstructor::ArrayConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 005f6db..a6ac76e 100644 (file)
@@ -33,10 +33,9 @@ class ArrayConstructor : public InternalFunction {
 public:
     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(globalObject, structure);
+        ArrayConstructor* constructor = new (NotNull, allocateCell<ArrayConstructor>(vm.heap)) ArrayConstructor(vm, structure);
         constructor->finishCreation(vm, arrayPrototype);
         return constructor;
     }
@@ -53,7 +52,7 @@ protected:
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
 private:
-    ArrayConstructor(JSGlobalObject*, Structure*);
+    ArrayConstructor(VM&, Structure*);
     static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
 
     static ConstructType getConstructData(JSCell*, ConstructData&);
index f7e6b64..09fa260 100644 (file)
@@ -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) };
 
-BooleanConstructor::BooleanConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+BooleanConstructor::BooleanConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index f2440bc..177f69e 100644 (file)
@@ -31,10 +31,9 @@ class BooleanConstructor : public InternalFunction {
 public:
     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(globalObject, structure);
+        BooleanConstructor* constructor = new (NotNull, allocateCell<BooleanConstructor>(vm.heap)) BooleanConstructor(vm, structure);
         constructor->finishCreation(vm, booleanPrototype);
         return constructor;
     }
@@ -50,7 +49,7 @@ protected:
     void finishCreation(VM&, BooleanPrototype*);
 
 private:
-    BooleanConstructor(JSGlobalObject*, Structure*);
+    BooleanConstructor(VM&, Structure*);
     static ConstructType getConstructData(JSCell*, ConstructData&);
     static CallType getCallData(JSCell*, CallData&);
 };
index f3e2faf..174c645 100644 (file)
@@ -74,8 +74,8 @@ const ClassInfo DateConstructor::s_info = { "Function", &InternalFunction::s_inf
 
 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(DateConstructor);
 
-DateConstructor::DateConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure) 
+DateConstructor::DateConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 8137461..383e6f1 100644 (file)
@@ -31,10 +31,10 @@ namespace JSC {
     public:
         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);
-            constructor->finishCreation(exec->vm(), datePrototype);
+            DateConstructor* constructor = new (NotNull, allocateCell<DateConstructor>(vm.heap)) DateConstructor(vm, structure);
+            constructor->finishCreation(vm, datePrototype);
             return constructor;
         }
 
@@ -50,7 +50,7 @@ namespace JSC {
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
-        DateConstructor(JSGlobalObject*, Structure*);
+        DateConstructor(VM&, Structure*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
 
index 2b3b4b3..bec5dd7 100644 (file)
@@ -73,8 +73,8 @@ namespace JSC {
 
     class StrictModeTypeErrorFunction : public InternalFunction {
     private:
-        StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const String& message)
-            : InternalFunction(globalObject, structure)
+        StrictModeTypeErrorFunction(VM& vm, Structure* structure, const String& message)
+            : InternalFunction(vm, structure)
             , m_message(message)
         {
         }
@@ -84,10 +84,10 @@ namespace JSC {
     public:
         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);
-            function->finishCreation(exec->vm(), String());
+            StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(vm.heap)) StrictModeTypeErrorFunction(vm, structure, message);
+            function->finishCreation(vm, String());
             return function;
         }
     
index 2087595..2e31e7f 100644 (file)
@@ -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) };
 
-ErrorConstructor::ErrorConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+ErrorConstructor::ErrorConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 672a7e6..29283d0 100644 (file)
@@ -32,10 +32,9 @@ namespace JSC {
     public:
         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(globalObject, structure);
+            ErrorConstructor* constructor = new (NotNull, allocateCell<ErrorConstructor>(vm.heap)) ErrorConstructor(vm, structure);
             constructor->finishCreation(vm, errorPrototype);
             return constructor;
         }
@@ -51,7 +50,7 @@ namespace JSC {
         void finishCreation(VM&, ErrorPrototype*);
         
     private:
-        ErrorConstructor(JSGlobalObject*, Structure*);
+        ErrorConstructor(VM&, Structure*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
     };
index 9173b78..ab8411b 100644 (file)
@@ -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) };
 
-FunctionConstructor::FunctionConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+FunctionConstructor::FunctionConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 75bf715..61443e9 100644 (file)
@@ -35,10 +35,9 @@ namespace JSC {
     public:
         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(globalObject, structure);
+            FunctionConstructor* constructor = new (NotNull, allocateCell<FunctionConstructor>(vm.heap)) FunctionConstructor(vm, structure);
             constructor->finishCreation(vm, functionPrototype);
             return constructor;
         }
@@ -51,7 +50,7 @@ namespace JSC {
         }
 
     private:
-        FunctionConstructor(JSGlobalObject*, Structure*);
+        FunctionConstructor(VM&, Structure*);
         void finishCreation(VM&, FunctionPrototype*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
index d25cb7d..2eb2a5c 100644 (file)
@@ -42,8 +42,8 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
 static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
 static EncodedJSValue JSC_HOST_CALL functionProtoFuncBind(ExecState*);
 
-FunctionPrototype::FunctionPrototype(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+FunctionPrototype::FunctionPrototype(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 99393f5..68d2f6a 100644 (file)
@@ -29,10 +29,9 @@ namespace JSC {
     public:
         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(globalObject, structure);
+            FunctionPrototype* prototype = new (NotNull, allocateCell<FunctionPrototype>(vm.heap)) FunctionPrototype(vm, structure);
             prototype->finishCreation(vm, String());
             return prototype;
         }
@@ -50,7 +49,7 @@ namespace JSC {
         void finishCreation(VM&, const String& name);
 
     private:
-        FunctionPrototype(JSGlobalObject*, Structure*);
+        FunctionPrototype(VM&, Structure*);
         static CallType getCallData(JSCell*, CallData&);
     };
 
index df7c8f2..69120be 100644 (file)
@@ -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) };
 
-InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* structure)
-    : JSDestructibleObject(globalObject->vm(), structure)
+InternalFunction::InternalFunction(VM& vm, Structure* structure)
+    : JSDestructibleObject(vm, structure)
 {
 }
 
index 216abd7..e216c2f 100644 (file)
@@ -49,7 +49,7 @@ namespace JSC {
     protected:
         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);
 
index 82a214c..fdeb9ea 100644 (file)
@@ -40,9 +40,8 @@ const ClassInfo JSArrayBufferConstructor::s_info = {
     CREATE_METHOD_TABLE(JSArrayBufferConstructor)
 };
 
-JSArrayBufferConstructor::JSArrayBufferConstructor(
-    JSGlobalObject* globalObject, Structure* structure)
-    : Base(globalObject, structure)
+JSArrayBufferConstructor::JSArrayBufferConstructor(VM& vm, Structure* structure)
+    : Base(vm, structure)
 {
 }
 
@@ -53,12 +52,11 @@ void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* pr
     putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly);
 }
 
-JSArrayBufferConstructor* JSArrayBufferConstructor::create(CallFrame* callFrame, JSGlobalObject* globalObject, Structure* structure, JSArrayBufferPrototype* prototype)
+JSArrayBufferConstructor* JSArrayBufferConstructor::create(VM& vm, Structure* structure, JSArrayBufferPrototype* prototype)
 {
-    VM& vm = callFrame->vm();
     JSArrayBufferConstructor* result =
         new (NotNull, allocateCell<JSArrayBufferConstructor>(vm.heap))
-        JSArrayBufferConstructor(globalObject, structure);
+        JSArrayBufferConstructor(vm, structure);
     result->finishCreation(vm, prototype);
     return result;
 }
index dadf903..b65b523 100644 (file)
@@ -37,11 +37,11 @@ public:
     typedef InternalFunction Base;
 
 protected:
-    JSArrayBufferConstructor(JSGlobalObject*, Structure*);
+    JSArrayBufferConstructor(VM&, Structure*);
     void finishCreation(VM&, JSArrayBufferPrototype*);
 
 public:
-    static JSArrayBufferConstructor* create(CallFrame*, JSGlobalObject*, Structure*, JSArrayBufferPrototype*);
+    static JSArrayBufferConstructor* create(VM&, Structure*, JSArrayBufferPrototype*);
     
     DECLARE_INFO;
     
index 744ca48..3dffe3c 100644 (file)
@@ -36,13 +36,13 @@ public:
     typedef InternalFunction Base;
 
 protected:
-    JSGenericTypedArrayViewConstructor(JSGlobalObject*, Structure*);
+    JSGenericTypedArrayViewConstructor(VM&, Structure*);
     void finishCreation(VM&, JSObject* prototype, const String& name);
 
 public:
     static JSGenericTypedArrayViewConstructor* create(
-        JSGlobalObject*, Structure*, JSObject* prototype, const String& name);
-    
+        VM&, Structure*, JSObject* prototype, const String& name);
+
     DECLARE_INFO;
     
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype);
index ce8ba63..870395a 100644 (file)
@@ -34,8 +34,8 @@
 namespace JSC {
 
 template<typename ViewClass>
-JSGenericTypedArrayViewConstructor<ViewClass>::JSGenericTypedArrayViewConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : Base(globalObject, structure)
+JSGenericTypedArrayViewConstructor<ViewClass>::JSGenericTypedArrayViewConstructor(VM& vm, Structure* structure)
+    : Base(vm, structure)
 {
 }
 
@@ -51,13 +51,12 @@ void JSGenericTypedArrayViewConstructor<ViewClass>::finishCreation(VM& vm, JSObj
 template<typename ViewClass>
 JSGenericTypedArrayViewConstructor<ViewClass>*
 JSGenericTypedArrayViewConstructor<ViewClass>::create(
-    JSGlobalObject* globalObject, Structure* structure, JSObject* prototype,
+    VM& vm, Structure* structure, JSObject* prototype,
     const String& name)
 {
-    VM& vm = globalObject->vm();
     JSGenericTypedArrayViewConstructor* result =
         new (NotNull, allocateCell<JSGenericTypedArrayViewConstructor>(vm.heap))
-        JSGenericTypedArrayViewConstructor(globalObject, structure);
+        JSGenericTypedArrayViewConstructor(vm, structure);
     result->finishCreation(vm, prototype, name);
     return result;
 }
index c00567e..4e08985 100644 (file)
@@ -228,7 +228,7 @@ void JSGlobalObject::reset(JSValue prototype)
     ExecState* exec = JSGlobalObject::globalExec();
     VM& vm = exec->vm();
 
-    m_functionPrototype.set(vm, this, FunctionPrototype::create(exec, this, FunctionPrototype::createStructure(vm, this, jsNull()))); // The real prototype will be set once ObjectPrototype is created.
+    m_functionPrototype.set(vm, this, FunctionPrototype::create(vm, FunctionPrototype::createStructure(vm, this, jsNull()))); // The real prototype will be set once ObjectPrototype is created.
     m_functionStructure.set(vm, this, JSFunction::createStructure(vm, this, m_functionPrototype.get()));
     m_boundFunctionStructure.set(vm, this, JSBoundFunction::createStructure(vm, this, m_functionPrototype.get()));
     m_namedFunctionStructure.set(vm, this, Structure::addPropertyTransition(vm, m_functionStructure.get(), vm.propertyNames->name, DontDelete | ReadOnly | DontEnum, 0, m_functionNameOffset));
@@ -321,19 +321,19 @@ void JSGlobalObject::reset(JSValue prototype)
 
     // Constructors
 
-    JSCell* objectConstructor = ObjectConstructor::create(exec, this, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get());
-    JSCell* functionConstructor = FunctionConstructor::create(exec, this, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get());
-    JSCell* arrayConstructor = ArrayConstructor::create(exec, this, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get());
+    JSCell* objectConstructor = ObjectConstructor::create(vm, ObjectConstructor::createStructure(vm, this, m_functionPrototype.get()), m_objectPrototype.get());
+    JSCell* functionConstructor = FunctionConstructor::create(vm, FunctionConstructor::createStructure(vm, this, m_functionPrototype.get()), m_functionPrototype.get());
+    JSCell* arrayConstructor = ArrayConstructor::create(vm, ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_arrayPrototype.get());
 
 #if ENABLE(PROMISES)
-    JSCell* promiseConstructor = JSPromiseConstructor::create(exec, this, JSPromiseConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promisePrototype.get());
-    JSCell* promiseResolverConstructor = JSPromiseResolverConstructor::create(exec, this, JSPromiseResolverConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promiseResolverPrototype.get());
+    JSCell* promiseConstructor = JSPromiseConstructor::create(vm, JSPromiseConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promisePrototype.get());
+    JSCell* promiseResolverConstructor = JSPromiseResolverConstructor::create(vm, JSPromiseResolverConstructor::createStructure(vm, this, m_functionPrototype.get()), m_promiseResolverPrototype.get());
 #endif // ENABLE(PROMISES)
 
-    m_regExpConstructor.set(vm, this, RegExpConstructor::create(exec, this, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get()));
+    m_regExpConstructor.set(vm, this, RegExpConstructor::create(vm, RegExpConstructor::createStructure(vm, this, m_functionPrototype.get()), m_regExpPrototype.get()));
 
 #define CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
-    capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(exec, this, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get()); \
+    capitalName ## Constructor* lowerName ## Constructor = capitalName ## Constructor::create(vm, capitalName ## Constructor::createStructure(vm, this, m_functionPrototype.get()), m_ ## lowerName ## Prototype.get()); \
     m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, lowerName ## Constructor, DontEnum); \
 
     FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_CONSTRUCTOR_FOR_SIMPLE_TYPE)
@@ -391,16 +391,16 @@ void JSGlobalObject::reset(JSValue prototype)
     putDirectWithoutTransition(vm, vm.propertyNames->Math, MathObject::create(exec, this, MathObject::createStructure(vm, this, m_objectPrototype.get())), DontEnum);
     
     FixedArray<InternalFunction*, NUMBER_OF_TYPED_ARRAY_TYPES> typedArrayConstructors;
-    typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(this, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
-    typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(this, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
-    typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(this, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), "Int32Array");
-    typedArrayConstructors[toIndex(TypeUint8)] = JSUint8ArrayConstructor::create(this, JSUint8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8)].prototype.get(), "Uint8Array");
-    typedArrayConstructors[toIndex(TypeUint8Clamped)] = JSUint8ClampedArrayConstructor::create(this, JSUint8ClampedArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), "Uint8ClampedArray");
-    typedArrayConstructors[toIndex(TypeUint16)] = JSUint16ArrayConstructor::create(this, JSUint16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint16)].prototype.get(), "Uint16Array");
-    typedArrayConstructors[toIndex(TypeUint32)] = JSUint32ArrayConstructor::create(this, JSUint32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint32)].prototype.get(), "Uint32Array");
-    typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(this, JSFloat32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), "Float32Array");
-    typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(this, JSFloat64ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), "Float64Array");
-    typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(this, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), "DataView");
+    typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(vm, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
+    typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(vm, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
+    typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(vm, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), "Int32Array");
+    typedArrayConstructors[toIndex(TypeUint8)] = JSUint8ArrayConstructor::create(vm, JSUint8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8)].prototype.get(), "Uint8Array");
+    typedArrayConstructors[toIndex(TypeUint8Clamped)] = JSUint8ClampedArrayConstructor::create(vm, JSUint8ClampedArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), "Uint8ClampedArray");
+    typedArrayConstructors[toIndex(TypeUint16)] = JSUint16ArrayConstructor::create(vm, JSUint16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint16)].prototype.get(), "Uint16Array");
+    typedArrayConstructors[toIndex(TypeUint32)] = JSUint32ArrayConstructor::create(vm, JSUint32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint32)].prototype.get(), "Uint32Array");
+    typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(vm, JSFloat32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), "Float32Array");
+    typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(vm, JSFloat64ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), "Float64Array");
+    typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(vm, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), "DataView");
 
     for (unsigned typedArrayIndex = NUMBER_OF_TYPED_ARRAY_TYPES; typedArrayIndex--;) {
         m_typedArrays[typedArrayIndex].prototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, typedArrayConstructors[typedArrayIndex], DontEnum);
@@ -423,7 +423,7 @@ void JSGlobalObject::reset(JSValue prototype)
         NamePrototype* privateNamePrototype = NamePrototype::create(exec, NamePrototype::createStructure(vm, this, m_objectPrototype.get()));
         m_privateNameStructure.set(vm, this, NameInstance::createStructure(vm, this, privateNamePrototype));
 
-        JSCell* privateNameConstructor = NameConstructor::create(exec, this, NameConstructor::createStructure(vm, this, m_functionPrototype.get()), privateNamePrototype);
+        JSCell* privateNameConstructor = NameConstructor::create(vm, NameConstructor::createStructure(vm, this, m_functionPrototype.get()), privateNamePrototype);
         privateNamePrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, privateNameConstructor, DontEnum);
         putDirectWithoutTransition(vm, Identifier(exec, "Name"), privateNameConstructor, DontEnum);
     }
index d5e89c7..79d3421 100644 (file)
@@ -39,10 +39,10 @@ namespace JSC {
 
 const ClassInfo JSPromiseCallback::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSPromiseCallback) };
 
-JSPromiseCallback* JSPromiseCallback::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromiseResolver* resolver, Algorithm algorithm)
+JSPromiseCallback* JSPromiseCallback::create(VM& vm, Structure* structure, JSPromiseResolver* resolver, Algorithm algorithm)
 {
-    JSPromiseCallback* constructor = new (NotNull, allocateCell<JSPromiseCallback>(*exec->heap())) JSPromiseCallback(globalObject, structure, algorithm);
-    constructor->finishCreation(exec, resolver);
+    JSPromiseCallback* constructor = new (NotNull, allocateCell<JSPromiseCallback>(vm.heap)) JSPromiseCallback(vm, structure, algorithm);
+    constructor->finishCreation(vm, resolver);
     return constructor;
 }
 
@@ -51,16 +51,16 @@ Structure* JSPromiseCallback::createStructure(VM& vm, JSGlobalObject* globalObje
     return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
 }
 
-JSPromiseCallback::JSPromiseCallback(JSGlobalObject* globalObject, Structure* structure, Algorithm algorithm)
-    : InternalFunction(globalObject, structure)
+JSPromiseCallback::JSPromiseCallback(VM& vm, Structure* structure, Algorithm algorithm)
+    : InternalFunction(vm, structure)
     , m_algorithm(algorithm)
 {
 }
 
-void JSPromiseCallback::finishCreation(ExecState* exec, JSPromiseResolver* resolver)
+void JSPromiseCallback::finishCreation(VM& vm, JSPromiseResolver* resolver)
 {
-    Base::finishCreation(exec->vm(), "PromiseCallback");
-    m_resolver.set(exec->vm(), this, resolver);
+    Base::finishCreation(vm, "PromiseCallback");
+    m_resolver.set(vm, this, resolver);
 }
 
 void JSPromiseCallback::visitChildren(JSCell* cell, SlotVisitor& visitor)
@@ -112,10 +112,10 @@ CallType JSPromiseCallback::getCallData(JSCell*, CallData& callData)
 
 const ClassInfo JSPromiseWrapperCallback::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSPromiseWrapperCallback) };
 
-JSPromiseWrapperCallback* JSPromiseWrapperCallback::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromiseResolver* resolver, JSValue callback)
+JSPromiseWrapperCallback* JSPromiseWrapperCallback::create(VM& vm, Structure* structure, JSPromiseResolver* resolver, JSValue callback)
 {
-    JSPromiseWrapperCallback* constructor = new (NotNull, allocateCell<JSPromiseWrapperCallback>(*exec->heap())) JSPromiseWrapperCallback(globalObject, structure);
-    constructor->finishCreation(exec, resolver, callback);
+    JSPromiseWrapperCallback* constructor = new (NotNull, allocateCell<JSPromiseWrapperCallback>(vm.heap)) JSPromiseWrapperCallback(vm, structure);
+    constructor->finishCreation(vm, resolver, callback);
     return constructor;
 }
 
@@ -124,16 +124,16 @@ Structure* JSPromiseWrapperCallback::createStructure(VM& vm, JSGlobalObject* glo
     return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
 }
 
-JSPromiseWrapperCallback::JSPromiseWrapperCallback(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+JSPromiseWrapperCallback::JSPromiseWrapperCallback(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
-void JSPromiseWrapperCallback::finishCreation(ExecState* exec, JSPromiseResolver* resolver, JSValue callback)
+void JSPromiseWrapperCallback::finishCreation(VM& vm, JSPromiseResolver* resolver, JSValue callback)
 {
-    Base::finishCreation(exec->vm(), "PromiseWrapperCallback");
-    m_resolver.set(exec->vm(), this, resolver);
-    m_callback.set(exec->vm(), this, callback);
+    Base::finishCreation(vm, "PromiseWrapperCallback");
+    m_resolver.set(vm, this, resolver);
+    m_callback.set(vm, this, callback);
 }
 
 void JSPromiseWrapperCallback::visitChildren(JSCell* cell, SlotVisitor& visitor)
index c9bea04..ab9353b 100644 (file)
@@ -44,14 +44,14 @@ public:
         Reject,
     };
 
-    static JSPromiseCallback* create(ExecState*, JSGlobalObject*, Structure*, JSPromiseResolver*, Algorithm);
+    static JSPromiseCallback* create(VM&, Structure*, JSPromiseResolver*, Algorithm);
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
 
     DECLARE_INFO;
 
 private:
-    JSPromiseCallback(JSGlobalObject*, Structure*, Algorithm);
-    void finishCreation(ExecState*, JSPromiseResolver*);
+    JSPromiseCallback(VM&, Structure*, Algorithm);
+    void finishCreation(VM&, JSPromiseResolver*);
     static const unsigned StructureFlags = OverridesVisitChildren | JSObject::StructureFlags;
 
     static EncodedJSValue JSC_HOST_CALL callPromiseCallback(ExecState*);
@@ -67,14 +67,14 @@ class JSPromiseWrapperCallback : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static JSPromiseWrapperCallback* create(ExecState*, JSGlobalObject*, Structure*, JSPromiseResolver*, JSValue callback);
+    static JSPromiseWrapperCallback* create(VM&, Structure*, JSPromiseResolver*, JSValue callback);
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
 
     DECLARE_INFO;
 
 private:
-    JSPromiseWrapperCallback(JSGlobalObject*, Structure*);
-    void finishCreation(ExecState*, JSPromiseResolver*, JSValue callback);
+    JSPromiseWrapperCallback(VM&, Structure*);
+    void finishCreation(VM&, JSPromiseResolver*, JSValue callback);
     static const unsigned StructureFlags = OverridesVisitChildren | JSObject::StructureFlags;
 
     static EncodedJSValue JSC_HOST_CALL callPromiseWrapperCallback(ExecState*);
index 69b39dc..88cfb48 100644 (file)
@@ -65,10 +65,9 @@ const ClassInfo JSPromiseConstructor::s_info = { "Function", &InternalFunction::
 @end
 */
 
-JSPromiseConstructor* JSPromiseConstructor::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromisePrototype* promisePrototype)
+JSPromiseConstructor* JSPromiseConstructor::create(VM& vm, Structure* structure, JSPromisePrototype* promisePrototype)
 {
-    VM& vm = exec->vm();
-    JSPromiseConstructor* constructor = new (NotNull, allocateCell<JSPromiseConstructor>(vm.heap)) JSPromiseConstructor(globalObject, structure);
+    JSPromiseConstructor* constructor = new (NotNull, allocateCell<JSPromiseConstructor>(vm.heap)) JSPromiseConstructor(vm, structure);
     constructor->finishCreation(vm, promisePrototype);
     return constructor;
 }
@@ -78,8 +77,8 @@ Structure* JSPromiseConstructor::createStructure(VM& vm, JSGlobalObject* globalO
     return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
 }
 
-JSPromiseConstructor::JSPromiseConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure) 
+JSPromiseConstructor::JSPromiseConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 3faa257..601e955 100644 (file)
@@ -38,7 +38,7 @@ class JSPromiseConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static JSPromiseConstructor* create(ExecState*, JSGlobalObject*, Structure*, JSPromisePrototype*);
+    static JSPromiseConstructor* create(VM&, Structure*, JSPromisePrototype*);
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
 
     DECLARE_INFO;
@@ -48,7 +48,7 @@ protected:
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
 private:
-    JSPromiseConstructor(JSGlobalObject*, Structure*);
+    JSPromiseConstructor(VM&, Structure*);
     static ConstructType getConstructData(JSCell*, ConstructData&);
     static CallType getCallData(JSCell*, CallData&);
     static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
index 0abe685..aaf3d2f 100644 (file)
@@ -92,8 +92,8 @@ bool JSPromisePrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, P
 static InternalFunction* wrapCallback(ExecState* exec, JSGlobalObject* globalObject, JSValue callback, JSPromiseResolver* resolver, JSPromiseCallback::Algorithm algorithm)
 {
     if (!callback.isUndefined())
-        return JSPromiseWrapperCallback::create(exec, globalObject, globalObject->promiseWrapperCallbackStructure(), resolver, callback);
-    return JSPromiseCallback::create(exec, globalObject, globalObject->promiseCallbackStructure(), resolver, algorithm);
+        return JSPromiseWrapperCallback::create(exec->vm(), globalObject->promiseWrapperCallbackStructure(), resolver, callback);
+    return JSPromiseCallback::create(exec->vm(), globalObject->promiseCallbackStructure(), resolver, algorithm);
 }
 
 EncodedJSValue JSC_HOST_CALL JSPromisePrototypeFuncThen(ExecState* exec)
@@ -158,15 +158,16 @@ EncodedJSValue JSC_HOST_CALL JSPromisePrototypeFuncCatch(ExecState* exec)
 
     JSFunction* callee = jsCast<JSFunction*>(exec->callee());
     JSGlobalObject* globalObject = callee->globalObject();
+    VM& vm = exec->vm();
 
     // 1. Let promise be a new promise.
-    JSPromise* promise = JSPromise::createWithResolver(exec->vm(), globalObject);
+    JSPromise* promise = JSPromise::createWithResolver(vm, globalObject);
 
     // 2. Let resolver be promise's associated resolver.
     JSPromiseResolver* resolver = promise->resolver();
 
     // 3. Let fulfillCallback be a new promise callback for resolver and its fulfill algorithm.
-    InternalFunction* fulfillWrapper = JSPromiseCallback::create(exec, globalObject, globalObject->promiseCallbackStructure(), resolver, JSPromiseCallback::Fulfill);
+    InternalFunction* fulfillWrapper = JSPromiseCallback::create(vm, globalObject->promiseCallbackStructure(), resolver, JSPromiseCallback::Fulfill);
 
     // 4. Let rejectWrapper be a promise wrapper callback for resolver and rejectCallback if rejectCallback is
     //    not omitted and a promise callback for resolver and its reject algorithm otherwise.
index 1497b5c..368b598 100644 (file)
@@ -148,11 +148,12 @@ void JSPromiseResolver::resolve(ExecState* exec, JSValue value, ResolverMode mod
         CallData callData;
         CallType callType = JSC::getCallData(then, callData);
         if (callType != CallTypeNone) {
+            VM& vm = exec->vm();
             // 4.1. Let fulfillCallback be a promise callback for the context object and its resolve algorithm.
-            JSPromiseCallback* fulfillCallback = JSPromiseCallback::create(exec, globalObject(), globalObject()->promiseCallbackStructure(), this, JSPromiseCallback::Resolve);
+            JSPromiseCallback* fulfillCallback = JSPromiseCallback::create(vm, globalObject()->promiseCallbackStructure(), this, JSPromiseCallback::Resolve);
 
             // 4.2. Let rejectCallback be a promise callback for the context object and its reject algorithm.
-            JSPromiseCallback* rejectCallback = JSPromiseCallback::create(exec, globalObject(), globalObject()->promiseCallbackStructure(), this, JSPromiseCallback::Reject);
+            JSPromiseCallback* rejectCallback = JSPromiseCallback::create(vm, globalObject()->promiseCallbackStructure(), this, JSPromiseCallback::Reject);
             
             // 4.3. Call the JavaScript [[Call]] internal method of then with this value value and fulfillCallback
             //      and rejectCallback as arguments.
index 6bfddef..47fc801 100644 (file)
@@ -40,10 +40,9 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSPromiseResolverConstructor);
 
 const ClassInfo JSPromiseResolverConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(JSPromiseResolverConstructor) };
 
-JSPromiseResolverConstructor* JSPromiseResolverConstructor::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSPromiseResolverPrototype* promisePrototype)
+JSPromiseResolverConstructor* JSPromiseResolverConstructor::create(VM& vm, Structure* structure, JSPromiseResolverPrototype* promisePrototype)
 {
-    VM& vm = exec->vm();
-    JSPromiseResolverConstructor* constructor = new (NotNull, allocateCell<JSPromiseResolverConstructor>(vm.heap)) JSPromiseResolverConstructor(globalObject, structure);
+    JSPromiseResolverConstructor* constructor = new (NotNull, allocateCell<JSPromiseResolverConstructor>(vm.heap)) JSPromiseResolverConstructor(vm, structure);
     constructor->finishCreation(vm, promisePrototype);
     return constructor;
 }
@@ -53,8 +52,8 @@ Structure* JSPromiseResolverConstructor::createStructure(VM& vm, JSGlobalObject*
     return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
 }
 
-JSPromiseResolverConstructor::JSPromiseResolverConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure) 
+JSPromiseResolverConstructor::JSPromiseResolverConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 71ce6dd..c415ed8 100644 (file)
@@ -38,7 +38,7 @@ class JSPromiseResolverConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static JSPromiseResolverConstructor* create(ExecState*, JSGlobalObject*, Structure*, JSPromiseResolverPrototype*);
+    static JSPromiseResolverConstructor* create(VM&, Structure*, JSPromiseResolverPrototype*);
     static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
 
     DECLARE_INFO;
@@ -48,7 +48,7 @@ protected:
     static const unsigned StructureFlags = InternalFunction::StructureFlags;
 
 private:
-    JSPromiseResolverConstructor(JSGlobalObject*, Structure*);
+    JSPromiseResolverConstructor(VM&, Structure*);
     static ConstructType getConstructData(JSCell*, ConstructData&);
     static CallType getCallData(JSCell*, CallData&);
 };
index 7aeb7e5..1a85de5 100644 (file)
@@ -36,10 +36,9 @@ class MapConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static MapConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, MapPrototype* mapPrototype)
+    static MapConstructor* create(VM& vm, Structure* structure, MapPrototype* mapPrototype)
     {
-        VM& vm = exec->vm();
-        MapConstructor* constructor = new (NotNull, allocateCell<MapConstructor>(vm.heap)) MapConstructor(globalObject, structure);
+        MapConstructor* constructor = new (NotNull, allocateCell<MapConstructor>(vm.heap)) MapConstructor(vm, structure);
         constructor->finishCreation(vm, mapPrototype);
         return constructor;
     }
@@ -52,8 +51,8 @@ public:
     }
 
 private:
-    MapConstructor(JSGlobalObject* globalObject, Structure* structure)
-        : Base(globalObject, structure)
+    MapConstructor(VM& vm, Structure* structure)
+        : Base(vm, structure)
     {
     }
     void finishCreation(VM&, MapPrototype*);
index cb9358f..77d7c92 100644 (file)
@@ -36,8 +36,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(NameConstructor);
 
 const ClassInfo NameConstructor::s_info = { "Function", &Base::s_info, 0, 0, CREATE_METHOD_TABLE(NameConstructor) };
 
-NameConstructor::NameConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+NameConstructor::NameConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 4fbff60..8e20f28 100644 (file)
@@ -37,10 +37,9 @@ class NameConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static NameConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, NamePrototype* prototype)
+    static NameConstructor* create(VM& vm, Structure* structure, NamePrototype* prototype)
     {
-        VM& vm = exec->vm();
-        NameConstructor* constructor = new (NotNull, allocateCell<NameConstructor>(vm.heap)) NameConstructor(globalObject, structure);
+        NameConstructor* constructor = new (NotNull, allocateCell<NameConstructor>(vm.heap)) NameConstructor(vm, structure);
         constructor->finishCreation(vm, prototype);
         return constructor;
     }
@@ -56,7 +55,7 @@ protected:
     void finishCreation(VM&, NamePrototype*);
     
 private:
-    NameConstructor(JSGlobalObject*, Structure*);
+    NameConstructor(VM&, Structure*);
     static ConstructType getConstructData(JSCell*, ConstructData&);
     static CallType getCallData(JSCell*, CallData&);
 };
index 0a0ec8b..d5e728c 100644 (file)
@@ -33,8 +33,8 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(NativeErrorConstructor);
 
 const ClassInfo NativeErrorConstructor::s_info = { "Function", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(NativeErrorConstructor) };
 
-NativeErrorConstructor::NativeErrorConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+NativeErrorConstructor::NativeErrorConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index a74ea26..740d3f9 100644 (file)
@@ -36,7 +36,7 @@ namespace JSC {
 
         static NativeErrorConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
         {
-            NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(vm.heap)) NativeErrorConstructor(globalObject, structure);
+            NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(vm.heap)) NativeErrorConstructor(vm, structure);
             constructor->finishCreation(vm, globalObject, prototypeStructure, name);
             return constructor;
         }
@@ -66,7 +66,7 @@ namespace JSC {
         }
 
     private:
-        NativeErrorConstructor(JSGlobalObject*, Structure*);
+        NativeErrorConstructor(VM&, Structure*);
         static const unsigned StructureFlags = OverridesVisitChildren | InternalFunction::StructureFlags;
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
index d967102..12fc14d 100644 (file)
@@ -55,8 +55,8 @@ const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_i
 @end
 */
 
-NumberConstructor::NumberConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure) 
+NumberConstructor::NumberConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index d7b5316..629be4f 100644 (file)
@@ -31,10 +31,9 @@ namespace JSC {
     public:
         typedef InternalFunction Base;
 
-        static NumberConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, NumberPrototype* numberPrototype)
+        static NumberConstructor* create(VM& vm, Structure* structure, NumberPrototype* numberPrototype)
         {
-            VM& vm = exec->vm();
-            NumberConstructor* constructor = new (NotNull, allocateCell<NumberConstructor>(vm.heap)) NumberConstructor(globalObject, structure);
+            NumberConstructor* constructor = new (NotNull, allocateCell<NumberConstructor>(vm.heap)) NumberConstructor(vm, structure);
             constructor->finishCreation(vm, numberPrototype);
             return constructor;
         }
@@ -58,7 +57,7 @@ namespace JSC {
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
 
     private:
-        NumberConstructor(JSGlobalObject*, Structure*);
+        NumberConstructor(VM&, Structure*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
     };
index 7780529..1cd5359 100644 (file)
@@ -80,8 +80,8 @@ const ClassInfo ObjectConstructor::s_info = { "Function", &InternalFunction::s_i
 @end
 */
 
-ObjectConstructor::ObjectConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+ObjectConstructor::ObjectConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 47001b1..4a6b471 100644 (file)
@@ -33,10 +33,9 @@ namespace JSC {
     public:
         typedef InternalFunction Base;
 
-        static ObjectConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype)
+        static ObjectConstructor* create(VM& vm, Structure* structure, ObjectPrototype* objectPrototype)
         {
-            VM& vm = exec->vm();
-            ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(vm.heap)) ObjectConstructor(globalObject, structure);
+            ObjectConstructor* constructor = new (NotNull, allocateCell<ObjectConstructor>(vm.heap)) ObjectConstructor(vm, structure);
             constructor->finishCreation(vm, objectPrototype);
             return constructor;
         }
@@ -55,7 +54,7 @@ namespace JSC {
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
-        ObjectConstructor(JSGlobalObject*, Structure*);
+        ObjectConstructor(VM&, Structure*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
     };
index 0c702ff..32a4c5b 100644 (file)
@@ -82,9 +82,9 @@ const ClassInfo RegExpConstructor::s_info = { "Function", &InternalFunction::s_i
 @end
 */
 
-RegExpConstructor::RegExpConstructor(JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype)
-    : InternalFunction(globalObject, structure)
-    , m_cachedResult(globalObject->vm(), this, regExpPrototype->regExp())
+RegExpConstructor::RegExpConstructor(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype)
+    : InternalFunction(vm, structure)
+    , m_cachedResult(vm, this, regExpPrototype->regExp())
     , m_multiline(false)
 {
 }
index 178b121..129559f 100644 (file)
@@ -36,10 +36,9 @@ namespace JSC {
     public:
         typedef InternalFunction Base;
 
-        static RegExpConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype)
+        static RegExpConstructor* create(VM& vm, Structure* structure, RegExpPrototype* regExpPrototype)
         {
-            VM& vm = exec->vm();
-            RegExpConstructor* constructor = new (NotNull, allocateCell<RegExpConstructor>(vm.heap)) RegExpConstructor(globalObject, structure, regExpPrototype);
+            RegExpConstructor* constructor = new (NotNull, allocateCell<RegExpConstructor>(vm.heap)) RegExpConstructor(vm, structure, regExpPrototype);
             constructor->finishCreation(vm, regExpPrototype);
             return constructor;
         }
@@ -76,7 +75,7 @@ namespace JSC {
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | Base::StructureFlags;
 
     private:
-        RegExpConstructor(JSGlobalObject*, Structure*, RegExpPrototype*);
+        RegExpConstructor(VM&, Structure*, RegExpPrototype*);
         static void destroy(JSCell*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
index f8e7426..efbd88b 100644 (file)
@@ -36,10 +36,9 @@ class SetConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static SetConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, SetPrototype* setPrototype)
+    static SetConstructor* create(VM& vm, Structure* structure, SetPrototype* setPrototype)
     {
-        VM& vm = exec->vm();
-        SetConstructor* constructor = new (NotNull, allocateCell<SetConstructor>(vm.heap)) SetConstructor(globalObject, structure);
+        SetConstructor* constructor = new (NotNull, allocateCell<SetConstructor>(vm.heap)) SetConstructor(vm, structure);
         constructor->finishCreation(vm, setPrototype);
         return constructor;
     }
@@ -52,8 +51,8 @@ public:
     }
 
 private:
-    SetConstructor(JSGlobalObject* globalObject, Structure* structure)
-        : Base(globalObject, structure)
+    SetConstructor(VM& vm, Structure* structure)
+        : Base(vm, structure)
     {
     }
     void finishCreation(VM&, SetPrototype*);
index 8eb6928..cb0697a 100644 (file)
@@ -48,8 +48,8 @@ const ClassInfo StringConstructor::s_info = { "Function", &InternalFunction::s_i
 
 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(StringConstructor);
 
-StringConstructor::StringConstructor(JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(globalObject, structure)
+StringConstructor::StringConstructor(VM& vm, Structure* structure)
+    : InternalFunction(vm, structure)
 {
 }
 
index 8b088f4..a2c0823 100644 (file)
@@ -31,10 +31,9 @@ namespace JSC {
     public:
         typedef InternalFunction Base;
 
-        static StringConstructor* create(ExecState* exec, JSGlobalObject* globalObject , Structure* structure, StringPrototype* stringPrototype)
+        static StringConstructor* create(VM& vm, Structure* structure, StringPrototype* stringPrototype)
         {
-            VM& vm = exec->vm();
-            StringConstructor* constructor = new (NotNull, allocateCell<StringConstructor>(vm.heap)) StringConstructor(globalObject, structure);
+            StringConstructor* constructor = new (NotNull, allocateCell<StringConstructor>(vm.heap)) StringConstructor(vm, structure);
             constructor->finishCreation(vm, stringPrototype);
             return constructor;
         }
@@ -50,7 +49,7 @@ namespace JSC {
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
-        StringConstructor(JSGlobalObject*, Structure*);
+        StringConstructor(VM&, Structure*);
         void finishCreation(VM&, StringPrototype*);
         static ConstructType getConstructData(JSCell*, ConstructData&);
         static CallType getCallData(JSCell*, CallData&);
index ed8ff70..66edbcb 100644 (file)
@@ -36,10 +36,9 @@ class WeakMapConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
 
-    static WeakMapConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, WeakMapPrototype* prototype)
+    static WeakMapConstructor* create(VM& vm, Structure* structure, WeakMapPrototype* prototype)
     {
-        VM& vm = exec->vm();
-        WeakMapConstructor* constructor = new (NotNull, allocateCell<WeakMapConstructor>(vm.heap)) WeakMapConstructor(globalObject, structure);
+        WeakMapConstructor* constructor = new (NotNull, allocateCell<WeakMapConstructor>(vm.heap)) WeakMapConstructor(vm, structure);
         constructor->finishCreation(vm, prototype);
         return constructor;
     }
@@ -52,8 +51,8 @@ public:
     }
 
 private:
-    WeakMapConstructor(JSGlobalObject* globalObject, Structure* structure)
-        : Base(globalObject, structure)
+    WeakMapConstructor(VM& vm, Structure* structure)
+        : Base(vm, structure)
     {
     }
     void finishCreation(VM&, WeakMapPrototype*);
index 4af3d65..22b18eb 100644 (file)
@@ -43,7 +43,7 @@ const ClassInfo RuntimeMethod::s_info = { "RuntimeMethod", &InternalFunction::s_
 
 RuntimeMethod::RuntimeMethod(JSGlobalObject* globalObject, Structure* structure, Method* method)
     // Callers will need to pass in the right global object corresponding to this native object "method".
-    : InternalFunction(globalObject, structure)
+    : InternalFunction(globalObject->vm(), structure)
     , m_method(method)
 {
 }
index 9fad20a..4ea63d1 100644 (file)
@@ -46,7 +46,7 @@ STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSNPMethod);
 const ClassInfo JSNPMethod::s_info = { "NPMethod", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(JSNPMethod) };
 
 JSNPMethod::JSNPMethod(JSGlobalObject* globalObject, Structure* structure, NPIdentifier npIdentifier)
-    : InternalFunction(globalObject, structure)
+    : InternalFunction(globalObject->vm(), structure)
     , m_npIdentifier(npIdentifier)
 {
 }