Pass VM instead of JSGlobalObject to ArrayPrototype constructor.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2013 00:57:07 +0000 (00:57 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Sep 2013 00:57:07 +0000 (00:57 +0000)
<https://webkit.org/b/122079>

Reviewed by Geoffrey Garen.

ArrayPrototype doesn't need the global object for anything during
construction, so reduce the amount of loads by just passing the VM.

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

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/ArrayPrototype.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp

index dbb610a..3780ff5 100644 (file)
@@ -1,5 +1,15 @@
 2013-09-29  Andreas Kling  <akling@apple.com>
 
 2013-09-29  Andreas Kling  <akling@apple.com>
 
+        Pass VM instead of JSGlobalObject to ArrayPrototype constructor.
+        <https://webkit.org/b/122079>
+
+        Reviewed by Geoffrey Garen.
+
+        ArrayPrototype doesn't need the global object for anything during
+        construction, so reduce the amount of loads by just passing the VM.
+
+2013-09-29  Andreas Kling  <akling@apple.com>
+
         Pass VM instead of ExecState to simple builtin constructors.
         <https://webkit.org/b/122077>
 
         Pass VM instead of ExecState to simple builtin constructors.
         <https://webkit.org/b/122077>
 
index fcc082e..5f8c76d 100644 (file)
@@ -115,22 +115,21 @@ const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecStat
 @end
 */
 
 @end
 */
 
-ArrayPrototype* ArrayPrototype::create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+ArrayPrototype* ArrayPrototype::create(VM& vm, Structure* structure)
 {
 {
-    ArrayPrototype* prototype = new (NotNull, allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure);
-    prototype->finishCreation(globalObject);
+    ArrayPrototype* prototype = new (NotNull, allocateCell<ArrayPrototype>(vm.heap)) ArrayPrototype(vm, structure);
+    prototype->finishCreation(vm);
     return prototype;
 }
 
 // ECMA 15.4.4
     return prototype;
 }
 
 // ECMA 15.4.4
-ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, Structure* structure)
-    : JSArray(globalObject->vm(), structure, 0)
+ArrayPrototype::ArrayPrototype(VM& vm, Structure* structure)
+    : JSArray(vm, structure, 0)
 {
 }
 
 {
 }
 
-void ArrayPrototype::finishCreation(JSGlobalObject* globalObject)
+void ArrayPrototype::finishCreation(VM& vm)
 {
 {
-    VM& vm = globalObject->vm();
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
     vm.prototypeMap.addPrototype(this);
index b4fa7b3..545f019 100644 (file)
@@ -28,12 +28,12 @@ namespace JSC {
 
 class ArrayPrototype : public JSArray {
 private:
 
 class ArrayPrototype : public JSArray {
 private:
-    ArrayPrototype(JSGlobalObject*, Structure*);
+    ArrayPrototype(VM&, Structure*);
 
 public:
     typedef JSArray Base;
 
 
 public:
     typedef JSArray Base;
 
-    static ArrayPrototype* create(ExecState*, JSGlobalObject*, Structure*);
+    static ArrayPrototype* create(VM&, Structure*);
         
     static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
 
         
     static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
 
@@ -45,7 +45,7 @@ public:
     }
 
 protected:
     }
 
 protected:
-    void finishCreation(JSGlobalObject*);
+    void finishCreation(VM&);
 };
 
 } // namespace JSC
 };
 
 } // namespace JSC
index f87fa92..c00567e 100644 (file)
@@ -283,7 +283,7 @@ void JSGlobalObject::reset(JSValue prototype)
     m_objcWrapperObjectStructure.set(vm, this, JSCallbackObject<JSAPIWrapperObject>::createStructure(vm, this, m_objectPrototype.get()));
 #endif
 
     m_objcWrapperObjectStructure.set(vm, this, JSCallbackObject<JSAPIWrapperObject>::createStructure(vm, this, m_objectPrototype.get()));
 #endif
 
-    m_arrayPrototype.set(vm, this, ArrayPrototype::create(exec, this, ArrayPrototype::createStructure(vm, this, m_objectPrototype.get())));
+    m_arrayPrototype.set(vm, this, ArrayPrototype::create(vm, ArrayPrototype::createStructure(vm, this, m_objectPrototype.get())));
     
     m_originalArrayStructureForIndexingShape[UndecidedShape >> IndexingShapeShift].set(vm, this, JSArray::createStructure(vm, this, m_arrayPrototype.get(), ArrayWithUndecided));
     m_originalArrayStructureForIndexingShape[Int32Shape >> IndexingShapeShift].set(vm, this, JSArray::createStructure(vm, this, m_arrayPrototype.get(), ArrayWithInt32));
     
     m_originalArrayStructureForIndexingShape[UndecidedShape >> IndexingShapeShift].set(vm, this, JSArray::createStructure(vm, this, m_arrayPrototype.get(), ArrayWithUndecided));
     m_originalArrayStructureForIndexingShape[Int32Shape >> IndexingShapeShift].set(vm, this, JSArray::createStructure(vm, this, m_arrayPrototype.get(), ArrayWithInt32));