Pass VM instead of ExecState to simple builtin constructors.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Sep 2013 22:20:26 +0000 (22:20 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Sep 2013 22:20:26 +0000 (22:20 +0000)
<https://webkit.org/b/122077>

Reviewed by Sam Weinig.

None of the simple builtins need the ExecState for anything during
their construction, so reduce the amount of loads by just passing
the VM around instead.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156620 268f45cc-cd09-0410-ab3c-d52691b4dbfc

31 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/BooleanPrototype.cpp
Source/JavaScriptCore/runtime/BooleanPrototype.h
Source/JavaScriptCore/runtime/DateConstructor.cpp
Source/JavaScriptCore/runtime/DateInstance.cpp
Source/JavaScriptCore/runtime/DateInstance.h
Source/JavaScriptCore/runtime/DatePrototype.cpp
Source/JavaScriptCore/runtime/DatePrototype.h
Source/JavaScriptCore/runtime/ErrorPrototype.cpp
Source/JavaScriptCore/runtime/ErrorPrototype.h
Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp
Source/JavaScriptCore/runtime/JSArrayBufferPrototype.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Source/JavaScriptCore/runtime/JSObject.cpp
Source/JavaScriptCore/runtime/JSObject.h
Source/JavaScriptCore/runtime/Lookup.cpp
Source/JavaScriptCore/runtime/MapPrototype.cpp
Source/JavaScriptCore/runtime/MapPrototype.h
Source/JavaScriptCore/runtime/NativeErrorConstructor.h
Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp
Source/JavaScriptCore/runtime/NativeErrorPrototype.h
Source/JavaScriptCore/runtime/NumberPrototype.cpp
Source/JavaScriptCore/runtime/NumberPrototype.h
Source/JavaScriptCore/runtime/SetPrototype.cpp
Source/JavaScriptCore/runtime/SetPrototype.h
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/runtime/StringPrototype.h
Source/JavaScriptCore/runtime/WeakMapPrototype.cpp
Source/JavaScriptCore/runtime/WeakMapPrototype.h
Source/WebCore/bindings/js/JSDOMBinding.cpp
Source/WebCore/bindings/js/SerializedScriptValue.cpp

index 15533e5..dbb610a 100644 (file)
@@ -1,3 +1,14 @@
+2013-09-29  Andreas Kling  <akling@apple.com>
+
+        Pass VM instead of ExecState to simple builtin constructors.
+        <https://webkit.org/b/122077>
+
+        Reviewed by Sam Weinig.
+
+        None of the simple builtins need the ExecState for anything during
+        their construction, so reduce the amount of loads by just passing
+        the VM around instead.
+
 2013-09-29  Nadav Rotem  <nrotem@apple.com>
 
         Refactor code for finding x86 scratch register.
index 5b59cf1..a54499d 100644 (file)
@@ -50,8 +50,8 @@ const ClassInfo BooleanPrototype::s_info = { "Boolean", &BooleanObject::s_info,
 
 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(BooleanPrototype);
 
-BooleanPrototype::BooleanPrototype(ExecState* exec, Structure* structure)
-    : BooleanObject(exec->vm(), structure)
+BooleanPrototype::BooleanPrototype(VM& vm, Structure* structure)
+    : BooleanObject(vm, structure)
 {
 }
 
index c69789b..35ece4b 100644 (file)
@@ -29,10 +29,9 @@ class BooleanPrototype : public BooleanObject {
 public:
     typedef BooleanObject Base;
 
-    static BooleanPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+    static BooleanPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     {
-        VM& vm = exec->vm();
-        BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(vm.heap)) BooleanPrototype(exec, structure);
+        BooleanPrototype* prototype = new (NotNull, allocateCell<BooleanPrototype>(vm.heap)) BooleanPrototype(vm, structure);
         prototype->finishCreation(vm, globalObject);
         return prototype;
     }
@@ -49,7 +48,7 @@ protected:
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags;
 
 private:
-    BooleanPrototype(ExecState*, Structure*);
+    BooleanPrototype(VM&, Structure*);
     static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
 };
 
index 347c92b..f3e2faf 100644 (file)
@@ -94,6 +94,7 @@ bool DateConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, Prop
 // ECMA 15.9.3
 JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args)
 {
+    VM& vm = exec->vm();
     int numArgs = args.size();
 
     double value;
@@ -106,7 +107,7 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg
         else {
             JSValue primitive = args.at(0).toPrimitive(exec);
             if (primitive.isString())
-                value = parseDate(exec->vm(), primitive.getString(exec));
+                value = parseDate(vm, primitive.getString(exec));
             else
                 value = primitive.toNumber(exec);
         }
@@ -139,11 +140,11 @@ JSObject* constructDate(ExecState* exec, JSGlobalObject* globalObject, const Arg
             t.setSecond(JSC::toInt32(doubleArguments[5]));
             t.setIsDST(-1);
             double ms = (numArgs >= 7) ? doubleArguments[6] : 0;
-            value = gregorianDateTimeToMS(exec->vm(), t, ms, false);
+            value = gregorianDateTimeToMS(vm, t, ms, false);
         }
     }
 
-    return DateInstance::create(exec, globalObject->dateStructure(), value);
+    return DateInstance::create(vm, globalObject->dateStructure(), value);
 }
     
 static EncodedJSValue JSC_HOST_CALL constructWithDateConstructor(ExecState* exec)
index 470d9bb..a0d53ef 100644 (file)
@@ -34,8 +34,8 @@ namespace JSC {
 
 const ClassInfo DateInstance::s_info = {"Date", &JSWrapperObject::s_info, 0, 0, CREATE_METHOD_TABLE(DateInstance)};
 
-DateInstance::DateInstance(ExecState* exec, Structure* structure)
-    : JSWrapperObject(exec->vm(), structure)
+DateInstance::DateInstance(VM& vm, Structure* structure)
+    : JSWrapperObject(vm, structure)
 {
 }
 
index 6c9a0a7..193e054 100644 (file)
@@ -27,7 +27,7 @@ namespace JSC {
 
     class DateInstance : public JSWrapperObject {
     protected:
-        JS_EXPORT_PRIVATE DateInstance(ExecState*, Structure*);
+        JS_EXPORT_PRIVATE DateInstance(VM&, Structure*);
         void finishCreation(VM&);
         JS_EXPORT_PRIVATE void finishCreation(VM&, double);
 
@@ -36,17 +36,17 @@ namespace JSC {
     public:
         typedef JSWrapperObject Base;
 
-        static DateInstance* create(ExecState* exec, Structure* structure, double date)
+        static DateInstance* create(VM& vm, Structure* structure, double date)
         {
-            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
-            instance->finishCreation(exec->vm(), date);
+            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
+            instance->finishCreation(vm, date);
             return instance;
         }
 
-        static DateInstance* create(ExecState* exec, Structure* structure)
+        static DateInstance* create(VM& vm, Structure* structure)
         {
-            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
-            instance->finishCreation(exec->vm());
+            DateInstance* instance = new (NotNull, allocateCell<DateInstance>(vm.heap)) DateInstance(vm, structure);
+            instance->finishCreation(vm);
             return instance;
         }
 
index 96d032c..c2b8a0c 100644 (file)
@@ -501,8 +501,8 @@ const ClassInfo DatePrototype::s_info = {"Date", &DateInstance::s_info, 0, ExecS
 
 // ECMA 15.9.4
 
-DatePrototype::DatePrototype(ExecState* exec, Structure* structure)
-    : DateInstance(exec, structure)
+DatePrototype::DatePrototype(VM& vm, Structure* structure)
+    : DateInstance(vm, structure)
 {
 }
 
index 5f8d33e..a9bfbd4 100644 (file)
@@ -29,15 +29,14 @@ namespace JSC {
 
     class DatePrototype : public DateInstance {
     private:
-        DatePrototype(ExecState*, Structure*);
+        DatePrototype(VM&, Structure*);
 
     public:
         typedef DateInstance Base;
 
-        static DatePrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+        static DatePrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
         {
-            VM& vm = exec->vm();
-            DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(exec, structure);
+            DatePrototype* prototype = new (NotNull, allocateCell<DatePrototype>(vm.heap)) DatePrototype(vm, structure);
             prototype->finishCreation(vm, globalObject);
             return prototype;
         }
index 613e0e9..25eb1fb 100644 (file)
@@ -49,8 +49,8 @@ const ClassInfo ErrorPrototype::s_info = { "Error", &ErrorInstance::s_info, 0, E
 @end
 */
 
-ErrorPrototype::ErrorPrototype(ExecState* exec, Structure* structure)
-    : ErrorInstance(exec->vm(), structure)
+ErrorPrototype::ErrorPrototype(VM& vm, Structure* structure)
+    : ErrorInstance(vm, structure)
 {
 }
 
index 8383f7e..10707ab 100644 (file)
@@ -31,10 +31,9 @@ namespace JSC {
     public:
         typedef ErrorInstance Base;
 
-        static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+        static ErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
         {
-            VM& vm = exec->vm();
-            ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(exec, structure);
+            ErrorPrototype* prototype = new (NotNull, allocateCell<ErrorPrototype>(vm.heap)) ErrorPrototype(vm, structure);
             prototype->finishCreation(vm, globalObject);
             return prototype;
         }
@@ -47,7 +46,7 @@ namespace JSC {
         }
 
     protected:
-        ErrorPrototype(ExecState*, Structure*);
+        ErrorPrototype(VM&, Structure*);
         void finishCreation(VM&, JSGlobalObject*);
 
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
index 0b6bf7d..42889f7 100644 (file)
@@ -78,23 +78,19 @@ JSArrayBufferPrototype::JSArrayBufferPrototype(VM& vm, Structure* structure)
 {
 }
 
-void JSArrayBufferPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+void JSArrayBufferPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
 {
-    VM& vm = exec->vm();
-    
     Base::finishCreation(vm);
     
     JSC_NATIVE_FUNCTION(vm.propertyNames->slice, arrayBufferProtoFuncSlice, DontEnum, 2);
 }
 
-JSArrayBufferPrototype* JSArrayBufferPrototype::create(
-    ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+JSArrayBufferPrototype* JSArrayBufferPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
 {
-    VM& vm = exec->vm();
     JSArrayBufferPrototype* prototype =
         new (NotNull, allocateCell<JSArrayBufferPrototype>(vm.heap))
         JSArrayBufferPrototype(vm, structure);
-    prototype->finishCreation(exec, globalObject);
+    prototype->finishCreation(vm, globalObject);
     return prototype;
 }
 
index 0b930b5..9acd65b 100644 (file)
@@ -36,10 +36,10 @@ public:
 
 protected:
     JSArrayBufferPrototype(VM&, Structure*);
-    void finishCreation(ExecState*, JSGlobalObject*);
+    void finishCreation(VM&, JSGlobalObject*);
 
 public:
-    static JSArrayBufferPrototype* create(ExecState*, JSGlobalObject*, Structure*);
+    static JSArrayBufferPrototype* create(VM&, JSGlobalObject*, Structure*);
     
     DECLARE_INFO;
     
index 1d20a5c..f87fa92 100644 (file)
@@ -312,7 +312,7 @@ void JSGlobalObject::reset(JSValue prototype)
 #endif // ENABLE(PROMISES)
 
 #define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \
-    m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(exec, this, capitalName##Prototype::createStructure(vm, this, m_objectPrototype.get()))); \
+    m_ ## lowerName ## Prototype.set(vm, this, capitalName##Prototype::create(vm, this, capitalName##Prototype::createStructure(vm, this, m_objectPrototype.get()))); \
     m_ ## properName ## Structure.set(vm, this, instanceType::createStructure(vm, this, m_ ## lowerName ## Prototype.get()));
 
     FOR_EACH_SIMPLE_BUILTIN_TYPE(CREATE_PROTOTYPE_FOR_SIMPLE_TYPE)
@@ -344,12 +344,12 @@ void JSGlobalObject::reset(JSValue prototype)
 
     Structure* nativeErrorPrototypeStructure = NativeErrorPrototype::createStructure(vm, this, m_errorPrototype.get());
     Structure* nativeErrorStructure = NativeErrorConstructor::createStructure(vm, this, m_functionPrototype.get());
-    m_evalErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError")));
-    m_rangeErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("RangeError")));
-    m_referenceErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("ReferenceError")));
-    m_syntaxErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("SyntaxError")));
-    m_typeErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("TypeError")));
-    m_URIErrorConstructor.set(vm, this, NativeErrorConstructor::create(exec, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("URIError")));
+    m_evalErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("EvalError")));
+    m_rangeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("RangeError")));
+    m_referenceErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("ReferenceError")));
+    m_syntaxErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("SyntaxError")));
+    m_typeErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("TypeError")));
+    m_URIErrorConstructor.set(vm, this, NativeErrorConstructor::create(vm, this, nativeErrorStructure, nativeErrorPrototypeStructure, ASCIILiteral("URIError")));
 
     m_objectPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, objectConstructor, DontEnum);
     m_functionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, functionConstructor, DontEnum);
index 9f67208..2519010 100644 (file)
@@ -2201,12 +2201,11 @@ bool JSObject::putDirectIndexBeyondVectorLength(ExecState* exec, unsigned i, JSV
     }
 }
 
-void JSObject::putDirectNativeFunction(ExecState* exec, JSGlobalObject* globalObject, const PropertyName& propertyName, unsigned functionLength, NativeFunction nativeFunction, Intrinsic intrinsic, unsigned attributes)
+void JSObject::putDirectNativeFunction(VM& vm, JSGlobalObject* globalObject, const PropertyName& propertyName, unsigned functionLength, NativeFunction nativeFunction, Intrinsic intrinsic, unsigned attributes)
 {
     StringImpl* name = propertyName.publicName();
     ASSERT(name);
 
-    VM& vm = exec->vm();
     JSFunction* function = JSFunction::create(vm, globalObject, functionLength, name, nativeFunction, intrinsic);
     putDirect(vm, propertyName, function, attributes);
 }
index 1b82b2e..3d65347 100644 (file)
@@ -577,7 +577,7 @@ public:
     void putDirect(VM& vm, PropertyOffset offset, JSValue value) { locationForOffset(offset)->set(vm, this, value); }
     void putDirectUndefined(PropertyOffset offset) { locationForOffset(offset)->setUndefined(); }
 
-    void putDirectNativeFunction(ExecState*, JSGlobalObject*, const PropertyName&, unsigned functionLength, NativeFunction, Intrinsic, unsigned attributes);
+    void putDirectNativeFunction(VM&, JSGlobalObject*, const PropertyName&, unsigned functionLength, NativeFunction, Intrinsic, unsigned attributes);
     void putDirectNativeFunctionWithoutTransition(ExecState*, JSGlobalObject*, const PropertyName&, unsigned functionLength, NativeFunction, Intrinsic, unsigned attributes);
 
     JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
@@ -1498,12 +1498,12 @@ inline int offsetRelativeToBase(PropertyOffset offset)
 
 COMPILE_ASSERT(!(sizeof(JSObject) % sizeof(WriteBarrierBase<Unknown>)), JSObject_inline_storage_has_correct_alignment);
 
-ALWAYS_INLINE Identifier makeIdentifier(ExecState* exec, const char* name)
+ALWAYS_INLINE Identifier makeIdentifier(VM& vm, const char* name)
 {
-    return Identifier(exec, name);
+    return Identifier(&vm, name);
 }
 
-ALWAYS_INLINE Identifier makeIdentifier(ExecState*, const Identifier& name)
+ALWAYS_INLINE Identifier makeIdentifier(VM&, const Identifier& name)
 {
     return name;
 }
@@ -1514,7 +1514,7 @@ ALWAYS_INLINE Identifier makeIdentifier(ExecState*, const Identifier& name)
 // have the expected meanings.
 #define JSC_NATIVE_INTRINSIC_FUNCTION(jsName, cppName, attributes, length, intrinsic) \
     putDirectNativeFunction(\
-        exec, globalObject, makeIdentifier(exec, (jsName)), (length), cppName, \
+        vm, globalObject, makeIdentifier(vm, (jsName)), (length), cppName, \
         (intrinsic), (attributes))
 
 // As above, but this assumes that the function you're defining doesn't have an
index 7d8d232..9a25ed4 100644 (file)
@@ -69,8 +69,9 @@ bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject*
 {
     ASSERT(thisObj->globalObject());
     ASSERT(entry->attributes() & Function);
+    VM& vm = exec->vm();
     unsigned attributes;
-    PropertyOffset offset = thisObj->getDirectOffset(exec->vm(), propertyName, attributes);
+    PropertyOffset offset = thisObj->getDirectOffset(vm, propertyName, attributes);
 
     if (!isValidOffset(offset)) {
         // If a property is ever deleted from an object with a static table, then we reify
@@ -79,9 +80,9 @@ bool setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject*
             return false;
     
         thisObj->putDirectNativeFunction(
-            exec, thisObj->globalObject(), propertyName, entry->functionLength(),
+            vm, thisObj->globalObject(), propertyName, entry->functionLength(),
             entry->function(), entry->intrinsic(), entry->attributes());
-        offset = thisObj->getDirectOffset(exec->vm(), propertyName, attributes);
+        offset = thisObj->getDirectOffset(vm, propertyName, attributes);
         ASSERT(isValidOffset(offset));
     }
 
index b151ac8..25200f6 100644 (file)
@@ -48,10 +48,8 @@ static EncodedJSValue JSC_HOST_CALL mapProtoFuncSet(ExecState*);
 
 static EncodedJSValue JSC_HOST_CALL mapProtoFuncSize(ExecState*);
     
-void MapPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+void MapPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
 {
-    VM& vm = exec->vm();
-
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
index f6f0ab6..eaa5825 100644 (file)
@@ -34,10 +34,10 @@ class MapPrototype : public JSNonFinalObject {
 public:
     typedef JSNonFinalObject Base;
 
-    static MapPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+    static MapPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     {
-        MapPrototype* prototype = new (NotNull, allocateCell<MapPrototype>(*exec->heap())) MapPrototype(exec, structure);
-        prototype->finishCreation(exec, globalObject);
+        MapPrototype* prototype = new (NotNull, allocateCell<MapPrototype>(vm.heap)) MapPrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
         return prototype;
     }
 
@@ -49,11 +49,11 @@ public:
     }
 
 private:
-    MapPrototype(ExecState* exec, Structure* structure)
-        : Base(exec->vm(), structure)
+    MapPrototype(VM& vm, Structure* structure)
+        : Base(vm, structure)
     {
     }
-    void finishCreation(ExecState*, JSGlobalObject*);
+    void finishCreation(VM&, JSGlobalObject*);
 };
 
 }
index 240ed27..a74ea26 100644 (file)
@@ -34,10 +34,10 @@ namespace JSC {
     public:
         typedef InternalFunction Base;
 
-        static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
+        static NativeErrorConstructor* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
         {
-            NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(globalObject, structure);
-            constructor->finishCreation(exec, globalObject, prototypeStructure, name);
+            NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(vm.heap)) NativeErrorConstructor(globalObject, structure);
+            constructor->finishCreation(vm, globalObject, prototypeStructure, name);
             return constructor;
         }
         
@@ -51,16 +51,16 @@ namespace JSC {
         Structure* errorStructure() { return m_errorStructure.get(); }
 
     protected:
-        void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const String& name)
+        void finishCreation(VM& vm, JSGlobalObject* globalObject, Structure* prototypeStructure, const String& name)
         {
-            Base::finishCreation(exec->vm(), name);
+            Base::finishCreation(vm, name);
             ASSERT(inherits(info()));
 
-            NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this);
+            NativeErrorPrototype* prototype = NativeErrorPrototype::create(vm, globalObject, prototypeStructure, name, this);
 
-            putDirect(exec->vm(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
-            putDirect(exec->vm(), exec->propertyNames().prototype, prototype, DontDelete | ReadOnly | DontEnum);
-            m_errorStructure.set(exec->vm(), this, ErrorInstance::createStructure(exec->vm(), globalObject, prototype));
+            putDirect(vm, vm.propertyNames->length, jsNumber(1), DontDelete | ReadOnly | DontEnum); // ECMA 15.11.7.5
+            putDirect(vm, vm.propertyNames->prototype, prototype, DontDelete | ReadOnly | DontEnum);
+            m_errorStructure.set(vm, this, ErrorInstance::createStructure(vm, globalObject, prototype));
             ASSERT(m_errorStructure);
             ASSERT(m_errorStructure->isObject());
         }
index 8a93183..3dea209 100644 (file)
@@ -28,8 +28,8 @@
 
 namespace JSC {
 
-NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, Structure* structure)
-    : ErrorPrototype(exec, structure)
+NativeErrorPrototype::NativeErrorPrototype(VM& vm, Structure* structure)
+    : ErrorPrototype(vm, structure)
 {
 }
 
index 755df65..9326c5c 100644 (file)
@@ -28,15 +28,14 @@ namespace JSC {
 
     class NativeErrorPrototype : public ErrorPrototype {
     private:
-        NativeErrorPrototype(ExecState*, Structure*);
+        NativeErrorPrototype(VM&, Structure*);
     
     public:
         typedef ErrorPrototype Base;
 
-        static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
+        static NativeErrorPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
         {
-            VM& vm = exec->vm();
-            NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(exec, structure);
+            NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(vm.heap)) NativeErrorPrototype(vm, structure);
             prototype->finishCreation(vm, globalObject, name, constructor);
             return prototype;
         }
index 6647a7b..0977c50 100644 (file)
@@ -70,8 +70,8 @@ const ClassInfo NumberPrototype::s_info = { "Number", &NumberObject::s_info, 0,
 
 STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(NumberPrototype);
 
-NumberPrototype::NumberPrototype(ExecState* exec, Structure* structure)
-    : NumberObject(exec->vm(), structure)
+NumberPrototype::NumberPrototype(VM& vm, Structure* structure)
+    : NumberObject(vm, structure)
 {
 }
 
index 81a2811..723544f 100644 (file)
@@ -29,10 +29,9 @@ namespace JSC {
     public:
         typedef NumberObject Base;
 
-        static NumberPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+        static NumberPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
         {
-            VM& vm = exec->vm();
-            NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(vm.heap)) NumberPrototype(exec, structure);
+            NumberPrototype* prototype = new (NotNull, allocateCell<NumberPrototype>(vm.heap)) NumberPrototype(vm, structure);
             prototype->finishCreation(vm, globalObject);
             return prototype;
         }
@@ -49,7 +48,7 @@ namespace JSC {
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NumberObject::StructureFlags;
 
     private:
-        NumberPrototype(ExecState*, Structure*);
+        NumberPrototype(VM&, Structure*);
         static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
     };
 
index adbef75..280523c 100644 (file)
@@ -47,10 +47,8 @@ static EncodedJSValue JSC_HOST_CALL setProtoFuncHas(ExecState*);
 
 static EncodedJSValue JSC_HOST_CALL setProtoFuncSize(ExecState*);
 
-void SetPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+void SetPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
 {
-    VM& vm = exec->vm();
-
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
index ba05b94..bdf90f4 100644 (file)
@@ -34,10 +34,10 @@ class SetPrototype : public JSNonFinalObject {
 public:
     typedef JSNonFinalObject Base;
 
-    static SetPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+    static SetPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     {
-        SetPrototype* prototype = new (NotNull, allocateCell<SetPrototype>(*exec->heap())) SetPrototype(exec, structure);
-        prototype->finishCreation(exec, globalObject);
+        SetPrototype* prototype = new (NotNull, allocateCell<SetPrototype>(vm.heap)) SetPrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
         return prototype;
     }
 
@@ -49,11 +49,11 @@ public:
     }
 
 private:
-    SetPrototype(ExecState* exec, Structure* structure)
-        : Base(exec->vm(), structure)
+    SetPrototype(VM& vm, Structure* structure)
+        : Base(vm, structure)
     {
     }
-    void finishCreation(ExecState*, JSGlobalObject*);
+    void finishCreation(VM&, JSGlobalObject*);
 };
 
 }
index e2175d3..63b2afa 100644 (file)
@@ -85,15 +85,13 @@ static EncodedJSValue JSC_HOST_CALL stringProtoFuncTrimRight(ExecState*);
 const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0, 0, CREATE_METHOD_TABLE(StringPrototype) };
 
 // ECMA 15.5.4
-StringPrototype::StringPrototype(ExecState* exec, Structure* structure)
-    : StringObject(exec->vm(), structure)
+StringPrototype::StringPrototype(VM& vm, Structure* structure)
+    : StringObject(vm, structure)
 {
 }
 
-void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, JSString* nameAndMessage)
+void StringPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject, JSString* nameAndMessage)
 {
-    VM& vm = exec->vm();
-    
     Base::finishCreation(vm, nameAndMessage);
     ASSERT(inherits(info()));
 
@@ -134,14 +132,14 @@ void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObje
     JSC_NATIVE_FUNCTION("trimRight", stringProtoFuncTrimRight, DontEnum, 0);
 
     // The constructor will be added later, after StringConstructor has been built
-    putDirectWithoutTransition(exec->vm(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
 }
 
-StringPrototype* StringPrototype::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+StringPrototype* StringPrototype::create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
 {
-    JSString* empty = jsEmptyString(exec);
-    StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(*exec->heap())) StringPrototype(exec, structure);
-    prototype->finishCreation(exec, globalObject, empty);
+    JSString* empty = jsEmptyString(&vm);
+    StringPrototype* prototype = new (NotNull, allocateCell<StringPrototype>(vm.heap)) StringPrototype(vm, structure);
+    prototype->finishCreation(vm, globalObject, empty);
     return prototype;
 }
 
index 0698efe..fe22453 100644 (file)
@@ -29,12 +29,12 @@ namespace JSC {
 
     class StringPrototype : public StringObject {
     private:
-        StringPrototype(ExecState*, Structure*);
+        StringPrototype(VM&, Structure*);
 
     public:
         typedef StringObject Base;
 
-        static StringPrototype* create(ExecState*, JSGlobalObject*, Structure*);
+        static StringPrototype* create(VM&, JSGlobalObject*, Structure*);
 
         static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
         {
@@ -44,7 +44,7 @@ namespace JSC {
         DECLARE_INFO;
         
     protected:
-        void finishCreation(ExecState*, JSGlobalObject*, JSString*);
+        void finishCreation(VM&, JSGlobalObject*, JSString*);
         static const unsigned StructureFlags = StringObject::StructureFlags;
 
     };
index 5ccdaab..3a2f962 100644 (file)
@@ -40,19 +40,17 @@ static EncodedJSValue JSC_HOST_CALL protoFuncWeakMapGet(ExecState*);
 static EncodedJSValue JSC_HOST_CALL protoFuncWeakMapHas(ExecState*);
 static EncodedJSValue JSC_HOST_CALL protoFuncWeakMapSet(ExecState*);
 
-void WeakMapPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+void WeakMapPrototype::finishCreation(VM& vm, JSGlobalObject* globalObject)
 {
-    VM& vm = exec->vm();
-
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
 
-    JSC_NATIVE_FUNCTION(exec->propertyNames().clear, protoFuncWeakMapClear, DontEnum, 0);
-    JSC_NATIVE_FUNCTION(exec->propertyNames().deleteKeyword, protoFuncWeakMapDelete, DontEnum, 1);
-    JSC_NATIVE_FUNCTION(exec->propertyNames().get, protoFuncWeakMapGet, DontEnum, 1);
-    JSC_NATIVE_FUNCTION(exec->propertyNames().has, protoFuncWeakMapHas, DontEnum, 1);
-    JSC_NATIVE_FUNCTION(exec->propertyNames().set, protoFuncWeakMapSet, DontEnum, 2);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->clear, protoFuncWeakMapClear, DontEnum, 0);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->deleteKeyword, protoFuncWeakMapDelete, DontEnum, 1);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->get, protoFuncWeakMapGet, DontEnum, 1);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->has, protoFuncWeakMapHas, DontEnum, 1);
+    JSC_NATIVE_FUNCTION(vm.propertyNames->set, protoFuncWeakMapSet, DontEnum, 2);
 }
 
 static WeakMapData* getWeakMapData(CallFrame* callFrame, JSValue value)
index 785e49e..bbf81ca 100644 (file)
@@ -34,10 +34,10 @@ class WeakMapPrototype : public JSNonFinalObject {
 public:
     typedef JSNonFinalObject Base;
 
-    static WeakMapPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+    static WeakMapPrototype* create(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     {
-        WeakMapPrototype* prototype = new (NotNull, allocateCell<WeakMapPrototype>(*exec->heap())) WeakMapPrototype(exec, structure);
-        prototype->finishCreation(exec, globalObject);
+        WeakMapPrototype* prototype = new (NotNull, allocateCell<WeakMapPrototype>(vm.heap)) WeakMapPrototype(vm, structure);
+        prototype->finishCreation(vm, globalObject);
         return prototype;
     }
 
@@ -49,11 +49,11 @@ public:
     }
 
 private:
-    WeakMapPrototype(ExecState* exec, Structure* structure)
-        : Base(exec->vm(), structure)
+    WeakMapPrototype(VM& vm, Structure* structure)
+        : Base(vm, structure)
     {
     }
-    void finishCreation(ExecState*, JSGlobalObject*);
+    void finishCreation(VM&, JSGlobalObject*);
 };
 
 }
index f4c4249..97e8b03 100644 (file)
@@ -121,7 +121,7 @@ JSValue jsDateOrNull(ExecState* exec, double value)
 {
     if (!std::isfinite(value))
         return jsNull();
-    return DateInstance::create(exec, exec->lexicalGlobalObject()->dateStructure(), value);
+    return DateInstance::create(exec->vm(), exec->lexicalGlobalObject()->dateStructure(), value);
 }
 
 double valueToDate(ExecState* exec, JSValue value)
index 45d35bc..941b72f 100644 (file)
@@ -1516,7 +1516,7 @@ private:
             double d;
             if (!read(d))
                 return JSValue();
-            return DateInstance::create(m_exec, m_globalObject->dateStructure(), d);
+            return DateInstance::create(m_exec->vm(), m_globalObject->dateStructure(), d);
         }
         case FileTag: {
             RefPtr<File> file;