Title: [93059] trunk/Source
Revision
93059
Author
[email protected]
Date
2011-08-15 14:12:11 -0700 (Mon, 15 Aug 2011)

Log Message

Refactor JS objects to allocate in static create methods rather than constructors
https://bugs.webkit.org/show_bug.cgi?id=65347

Patch by Mark Hahnenberg <[email protected]> on 2011-08-15
Reviewed by Geoffrey Garen.

Source/_javascript_Glue:

Removed all calls to deprecatedGetDOMObject from initialization lists as part of a
larger refactoring to get rid of all allocation during initialization.

* JSRun.cpp:
(JSGlueGlobalObject::JSGlueGlobalObject):
* JSRun.h:
(JSGlueGlobalObject::create):

Source/WebCore:

No new tests.

Removed all calls to deprecatedGetDOMObject from initialization lists as part of a
larger refactoring to get rid of all allocation during initialization.

* bindings/js/JSDOMBinding.h:
* bridge/c/CRuntimeObject.cpp:
(JSC::Bindings::CRuntimeObject::CRuntimeObject):
* bridge/c/CRuntimeObject.h:
(JSC::Bindings::CRuntimeObject::create):
* bridge/c/c_instance.cpp:
(JSC::Bindings::CRuntimeMethod::create):
(JSC::Bindings::CRuntimeMethod::CRuntimeMethod):
* bridge/jni/jsc/JavaInstanceJSC.cpp:
(JavaRuntimeMethod::create):
(JavaRuntimeMethod::JavaRuntimeMethod):
* bridge/jni/jsc/JavaRuntimeObject.cpp:
(JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
* bridge/jni/jsc/JavaRuntimeObject.h:
(JSC::Bindings::JavaRuntimeObject::create):
* bridge/objc/objc_runtime.h:
(JSC::Bindings::ObjcFallbackObjectImp::create):
* bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp):
* bridge/qt/qt_instance.cpp:
(JSC::Bindings::QtRuntimeObject::create):
(JSC::Bindings::QtRuntimeObject::QtRuntimeObject):
* bridge/qt/qt_pixmapruntime.cpp:
(JSC::Bindings::QtPixmapRuntimeObject::create):
(JSC::Bindings::QtPixmapRuntimeObject::QtPixmapRuntimeObject):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
(JSC::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
(JSC::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
* bridge/qt/qt_runtime.h:
(JSC::Bindings::QtRuntimeMetaMethod::create):
(JSC::Bindings::QtRuntimeConnectionMethod::create):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::RuntimeArray):
* bridge/runtime_array.h:
(JSC::RuntimeArray::create):
* bridge/runtime_object.cpp:

Source/WebKit/mac:

Removed all calls to deprecatedGetDOMObject from initialization lists as part of a
larger refactoring to get rid of all allocation during initialization.

* Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyRuntimeMethod::create):
(WebKit::ProxyRuntimeMethod::ProxyRuntimeMethod):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Glue/ChangeLog (93058 => 93059)


--- trunk/Source/_javascript_Glue/ChangeLog	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/_javascript_Glue/ChangeLog	2011-08-15 21:12:11 UTC (rev 93059)
@@ -1,3 +1,18 @@
+2011-08-15  Mark Hahnenberg  <[email protected]>
+
+        Refactor JS objects to allocate in static create methods rather than constructors
+        https://bugs.webkit.org/show_bug.cgi?id=65347
+
+        Reviewed by Geoffrey Garen.
+
+        Removed all calls to deprecatedGetDOMObject from initialization lists as part of a 
+        larger refactoring to get rid of all allocation during initialization.
+
+        * JSRun.cpp:
+        (JSGlueGlobalObject::JSGlueGlobalObject):
+        * JSRun.h:
+        (JSGlueGlobalObject::create):
+
 2011-08-12  Mark Rowe  <[email protected]>
 
         Be more forward-looking in the choice of compiler.

Modified: trunk/Source/_javascript_Glue/JSRun.cpp (93058 => 93059)


--- trunk/Source/_javascript_Glue/JSRun.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/_javascript_Glue/JSRun.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -33,10 +33,10 @@
 #include <_javascript_Core/Completion.h>
 #include <_javascript_Core/SourceCode.h>
 
-JSGlueGlobalObject::JSGlueGlobalObject(JSGlobalData& globalData, Structure* structure, JSFlags flags)
+JSGlueGlobalObject::JSGlueGlobalObject(JSGlobalData& globalData, Structure* structure, Structure* userObjectStructure, JSFlags flags)
     : JSGlobalObject(globalData, structure)
     , m_flags(flags)
-    , m_userObjectStructure(globalData, UserObjectImp::createStructure(globalData, jsNull()))
+    , m_userObjectStructure(globalData, userObjectStructure)
 {
 }
 

Modified: trunk/Source/_javascript_Glue/JSRun.h (93058 => 93059)


--- trunk/Source/_javascript_Glue/JSRun.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/_javascript_Glue/JSRun.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -32,6 +32,7 @@
 #include <_javascript_Core/Strong.h>
 #include "JSBase.h"
 #include "JSUtils.h"
+#include "UserObjectImp.h"
 
 class JSGlueGlobalObject : public JSGlobalObject {
     public:
@@ -39,14 +40,15 @@
 
         static JSGlueGlobalObject* create(JSGlobalData& globalData, Structure* structure, JSFlags flags = kJSFlagNone)
         {
-            return new (allocateCell<JSGlueGlobalObject>(globalData.heap)) JSGlueGlobalObject(globalData, structure, flags);
+            Structure* userObjectStructure = UserObjectImp::createStructure(globalData, jsNull());
+            return new (allocateCell<JSGlueGlobalObject>(globalData.heap)) JSGlueGlobalObject(globalData, structure, userObjectStructure, flags);
         }
 
         JSFlags Flags() const { return m_flags; }
         Structure* userObjectStructure() const { return m_userObjectStructure.get(); }
 
     private:
-        JSGlueGlobalObject(JSGlobalData&, Structure*, JSFlags = kJSFlagNone);
+        JSGlueGlobalObject(JSGlobalData&, Structure*, Structure*, JSFlags = kJSFlagNone);
         
         JSFlags m_flags;
         Strong<Structure> m_userObjectStructure;

Modified: trunk/Source/WebCore/ChangeLog (93058 => 93059)


--- trunk/Source/WebCore/ChangeLog	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/ChangeLog	2011-08-15 21:12:11 UTC (rev 93059)
@@ -1,3 +1,53 @@
+2011-08-15  Mark Hahnenberg  <[email protected]>
+
+        Refactor JS objects to allocate in static create methods rather than constructors
+        https://bugs.webkit.org/show_bug.cgi?id=65347
+
+        Reviewed by Geoffrey Garen.
+
+        No new tests.
+
+        Removed all calls to deprecatedGetDOMObject from initialization lists as part of a 
+        larger refactoring to get rid of all allocation during initialization.
+
+        * bindings/js/JSDOMBinding.h:
+        * bridge/c/CRuntimeObject.cpp:
+        (JSC::Bindings::CRuntimeObject::CRuntimeObject):
+        * bridge/c/CRuntimeObject.h:
+        (JSC::Bindings::CRuntimeObject::create):
+        * bridge/c/c_instance.cpp:
+        (JSC::Bindings::CRuntimeMethod::create):
+        (JSC::Bindings::CRuntimeMethod::CRuntimeMethod):
+        * bridge/jni/jsc/JavaInstanceJSC.cpp:
+        (JavaRuntimeMethod::create):
+        (JavaRuntimeMethod::JavaRuntimeMethod):
+        * bridge/jni/jsc/JavaRuntimeObject.cpp:
+        (JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
+        * bridge/jni/jsc/JavaRuntimeObject.h:
+        (JSC::Bindings::JavaRuntimeObject::create):
+        * bridge/objc/objc_runtime.h:
+        (JSC::Bindings::ObjcFallbackObjectImp::create):
+        * bridge/objc/objc_runtime.mm:
+        (JSC::Bindings::ObjcFallbackObjectImp::ObjcFallbackObjectImp):
+        * bridge/qt/qt_instance.cpp:
+        (JSC::Bindings::QtRuntimeObject::create):
+        (JSC::Bindings::QtRuntimeObject::QtRuntimeObject):
+        * bridge/qt/qt_pixmapruntime.cpp:
+        (JSC::Bindings::QtPixmapRuntimeObject::create):
+        (JSC::Bindings::QtPixmapRuntimeObject::QtPixmapRuntimeObject):
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
+        (JSC::Bindings::QtRuntimeMetaMethod::QtRuntimeMetaMethod):
+        (JSC::Bindings::QtRuntimeConnectionMethod::QtRuntimeConnectionMethod):
+        * bridge/qt/qt_runtime.h:
+        (JSC::Bindings::QtRuntimeMetaMethod::create):
+        (JSC::Bindings::QtRuntimeConnectionMethod::create):
+        * bridge/runtime_array.cpp:
+        (JSC::RuntimeArray::RuntimeArray):
+        * bridge/runtime_array.h:
+        (JSC::RuntimeArray::create):
+        * bridge/runtime_object.cpp:
+
 2011-08-15  Adam Roben  <[email protected]>
 
         Update pages' style and content scale when the window's backing scale factor changes

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (93058 => 93059)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -29,7 +29,9 @@
 #include "Element.h"
 #include "StyleBase.h"
 #include <heap/Weak.h>
+#include <runtime/FunctionPrototype.h>
 #include <runtime/Lookup.h>
+#include <runtime/ObjectPrototype.h>
 #include <wtf/Forward.h>
 #include <wtf/Noncopyable.h>
 

Modified: trunk/Source/WebCore/bridge/c/CRuntimeObject.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/c/CRuntimeObject.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/c/CRuntimeObject.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -37,10 +37,8 @@
 
 const ClassInfo CRuntimeObject::s_info = { "CRuntimeObject", &RuntimeObject::s_info, 0, 0 };
 
-CRuntimeObject::CRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<CInstance> instance)
-    // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
-    // We need to pass in the right global object for "i".
-    : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<CRuntimeObject>(exec), instance)
+CRuntimeObject::CRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<CInstance> instance)
+    : RuntimeObject(exec, globalObject, structure, instance)
 {
     ASSERT(inherits(&s_info));
 }

Modified: trunk/Source/WebCore/bridge/c/CRuntimeObject.h (93058 => 93059)


--- trunk/Source/WebCore/bridge/c/CRuntimeObject.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/c/CRuntimeObject.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -28,6 +28,7 @@
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
 
+#include "JSDOMBinding.h"
 #include "runtime_object.h"
 
 namespace JSC {
@@ -41,7 +42,10 @@
 
     static CRuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<CInstance> instance)
     {
-        return new (allocateCell<CRuntimeObject>(*exec->heap())) CRuntimeObject(exec, globalObject, instance);
+        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+        // We need to pass in the right global object for "i".
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<CRuntimeObject>(exec);
+        return new (allocateCell<CRuntimeObject>(*exec->heap())) CRuntimeObject(exec, globalObject, domStructure, instance);
     }
 
     virtual ~CRuntimeObject();
@@ -56,7 +60,7 @@
     }
 
 private:
-    CRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<CInstance>);
+    CRuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<CInstance>);
 };
 
 }

Modified: trunk/Source/WebCore/bridge/c/c_instance.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/c/c_instance.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/c/c_instance.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -115,7 +115,10 @@
 
     static CRuntimeMethod* create(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
     {
-        return new (allocateCell<CRuntimeMethod>(*exec->heap())) CRuntimeMethod(exec, globalObject, name, list);
+        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+        // We need to pass in the right global object for "i".
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<CRuntimeMethod>(exec);
+        return new (allocateCell<CRuntimeMethod>(*exec->heap())) CRuntimeMethod(exec, globalObject, domStructure, name, list);
     }
 
     static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
@@ -126,10 +129,8 @@
     static const ClassInfo s_info;
 
 private:
-    CRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
-        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
-        // We need to pass in the right global object for "i".
-        : RuntimeMethod(exec, globalObject, WebCore::deprecatedGetDOMStructure<CRuntimeMethod>(exec), name, list)
+    CRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const Identifier& name, Bindings::MethodList& list)
+        : RuntimeMethod(exec, globalObject, structure, name, list)
     {
         ASSERT(inherits(&s_info));
     }

Modified: trunk/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -120,7 +120,10 @@
 
     static JavaRuntimeMethod* create(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
     {
-        return new (allocateCell<JavaRuntimeMethod>(*exec->heap())) JavaRuntimeMethod(exec, globalObject, name, list);
+        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+        // We need to pass in the right global object for "i".
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<JavaRuntimeMethod>(exec);
+        return new (allocateCell<JavaRuntimeMethod>(*exec->heap())) JavaRuntimeMethod(exec, globalObject, domStructure, name, list);
     }
 
     static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
@@ -131,10 +134,8 @@
     static const ClassInfo s_info;
 
 private:
-    JavaRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
-        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
-        // We need to pass in the right global object for "i".
-        : RuntimeMethod(exec, globalObject, WebCore::deprecatedGetDOMStructure<JavaRuntimeMethod>(exec), name, list)
+    JavaRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const Identifier& name, Bindings::MethodList& list)
+        : RuntimeMethod(exec, globalObject, structure, name, list)
     {
         ASSERT(inherits(&s_info));
     }

Modified: trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -35,10 +35,8 @@
 
 const ClassInfo JavaRuntimeObject::s_info = { "JavaRuntimeObject", &RuntimeObject::s_info, 0, 0 };
 
-JavaRuntimeObject::JavaRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<JavaInstance> instance)
-    // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
-    // We need to pass in the right global object for "i".
-    : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<JavaRuntimeObject>(exec), instance)
+JavaRuntimeObject::JavaRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<JavaInstance> instance)
+    : RuntimeObject(exec, globalObject, structure, instance)
 {
     ASSERT(inherits(&s_info));
 }

Modified: trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.h (93058 => 93059)


--- trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -26,6 +26,7 @@
 #ifndef JavaRuntimeObject_h
 #define JavaRuntimeObject_h
 
+#include "JSDOMBinding.h"
 #include "runtime_object.h"
 
 namespace JSC {
@@ -39,7 +40,10 @@
 
     static JavaRuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<JavaInstance> javaInst)
     {
-        return new (allocateCell<JavaRuntimeObject>(*exec->heap())) JavaRuntimeObject(exec, globalObject, javaInst);
+        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+        // We need to pass in the right global object for "i".
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<JavaRuntimeObject>(exec);
+        return new (allocateCell<JavaRuntimeObject>(*exec->heap())) JavaRuntimeObject(exec, globalObject, domStructure, javaInst);
     }
 
     virtual ~JavaRuntimeObject();
@@ -54,7 +58,7 @@
     }
 
 private:
-    JavaRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<JavaInstance>);
+    JavaRuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<JavaInstance>);
 };
 
 }

Modified: trunk/Source/WebCore/bridge/objc/objc_runtime.h (93058 => 93059)


--- trunk/Source/WebCore/bridge/objc/objc_runtime.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/objc/objc_runtime.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -27,6 +27,7 @@
 #define KJS_BINDINGS_OBJC_RUNTIME_H
 
 #include "BridgeJSC.h"
+#include "JSDOMBinding.h"
 #include "objc_header.h"
 #include <runtime/JSGlobalObject.h>
 #include <runtime/JSObjectWithGlobalObject.h>
@@ -96,7 +97,9 @@
 
     static ObjcFallbackObjectImp* create(ExecState* exec, JSGlobalObject* globalObject, ObjcInstance* instance, const Identifier& propertyName)
     {
-        return new (allocateCell<ObjcFallbackObjectImp>(*exec->heap())) ObjcFallbackObjectImp(exec, globalObject, instance, propertyName);
+        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<ObjcFallbackObjectImp>(exec);
+        return new (allocateCell<ObjcFallbackObjectImp>(*exec->heap())) ObjcFallbackObjectImp(globalObject, domStructure, instance, propertyName);
     }
 
     static const ClassInfo s_info;
@@ -114,7 +117,7 @@
     }
 
 private:
-    ObjcFallbackObjectImp(ExecState*, JSGlobalObject*, ObjcInstance*, const Identifier& propertyName);
+    ObjcFallbackObjectImp(JSGlobalObject*, Structure*, ObjcInstance*, const Identifier& propertyName);
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | JSObject::StructureFlags;
     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);

Modified: trunk/Source/WebCore/bridge/objc/objc_runtime.mm (93058 => 93059)


--- trunk/Source/WebCore/bridge/objc/objc_runtime.mm	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/objc/objc_runtime.mm	2011-08-15 21:12:11 UTC (rev 93059)
@@ -35,7 +35,6 @@
 #include <runtime/Error.h>
 #include <runtime/JSGlobalObject.h>
 #include <runtime/JSLock.h>
-#include <runtime/ObjectPrototype.h>
 #include <wtf/RetainPtr.h>
 
 using namespace WebCore;
@@ -197,9 +196,8 @@
 
 const ClassInfo ObjcFallbackObjectImp::s_info = { "ObjcFallbackObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
 
-ObjcFallbackObjectImp::ObjcFallbackObjectImp(ExecState* exec, JSGlobalObject* globalObject, ObjcInstance* i, const Identifier& propertyName)
-    // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
-    : JSObjectWithGlobalObject(globalObject, deprecatedGetDOMStructure<ObjcFallbackObjectImp>(exec))
+ObjcFallbackObjectImp::ObjcFallbackObjectImp(JSGlobalObject* globalObject, Structure* structure, ObjcInstance* i, const Identifier& propertyName)
+    : JSObjectWithGlobalObject(globalObject, structure)
     , _instance(i)
     , _item(propertyName)
 {

Modified: trunk/Source/WebCore/bridge/qt/qt_instance.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/qt/qt_instance.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/qt/qt_instance.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -54,7 +54,8 @@
 
     static QtRuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
     {
-        return new (allocateCell<QtRuntimeObject>(*exec->heap())) QtRuntimeObject(exec, globalObject, instance);
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<QtRuntimeObject>(exec);
+        return new (allocateCell<QtRuntimeObject>(*exec->heap())) QtRuntimeObject(exec, globalObject, domStructure, instance);
     }
     
     static const ClassInfo s_info;
@@ -76,13 +77,13 @@
     static const unsigned StructureFlags = RuntimeObject::StructureFlags | OverridesVisitChildren;
 
 private:
-    QtRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<Instance>);
+    QtRuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<Instance>);
 };
 
 const ClassInfo QtRuntimeObject::s_info = { "QtRuntimeObject", &RuntimeObject::s_info, 0, 0 };
 
-QtRuntimeObject::QtRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
-    : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<QtRuntimeObject>(exec), instance)
+QtRuntimeObject::QtRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance)
+    : RuntimeObject(exec, globalObject, structure, instance)
 {
 }
 

Modified: trunk/Source/WebCore/bridge/qt/qt_pixmapruntime.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/qt/qt_pixmapruntime.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/qt/qt_pixmapruntime.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -23,6 +23,7 @@
 #include "HTMLImageElement.h"
 #include "ImageData.h"
 #include "IntSize.h"
+#include "JSDOMBinding.h"
 #include "JSGlobalObject.h"
 #include "JSHTMLImageElement.h"
 #include "JSImageData.h"
@@ -202,7 +203,8 @@
 
     static QtPixmapRuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
     {
-        return new (allocateCell<QtPixmapRuntimeObject>(*exec->heap())) QtPixmapRuntimeObject(exec, globalObject, instance);
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<QtPixmapRuntimeObject>(exec);
+        return new (allocateCell<QtPixmapRuntimeObject>(*exec->heap())) QtPixmapRuntimeObject(exec, globalObject, domStructure, instance);
     }
 
     static const ClassInfo s_info;
@@ -216,11 +218,11 @@
     static const unsigned StructureFlags = RuntimeObject::StructureFlags | OverridesVisitChildren;
 
 private:
-    QtPixmapRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<Instance>);
+    QtPixmapRuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<Instance>);
 };
 
-QtPixmapRuntimeObject::QtPixmapRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<Instance> instance)
-    : RuntimeObject(exec, globalObject, WebCore::deprecatedGetDOMStructure<QtPixmapRuntimeObject>(exec), instance)
+QtPixmapRuntimeObject::QtPixmapRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance)
+    : RuntimeObject(exec, globalObject, structure, instance)
 {
 }
 

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -1006,8 +1006,8 @@
 
 const ClassInfo QtRuntimeMethod::s_info = { "QtRuntimeMethod", &InternalFunction::s_info, 0, 0 };
 
-QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, const Identifier& ident, PassRefPtr<QtInstance> inst)
-    : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject(), deprecatedGetDOMStructure<QtRuntimeMethod>(exec), ident)
+QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, Structure* structure, const Identifier& ident, PassRefPtr<QtInstance> inst)
+    : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject(), structure, ident)
     , d_ptr(dd)
 {
     QW_D(QtRuntimeMethod);
@@ -1420,8 +1420,8 @@
     return index;
 }
 
-QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, const Identifier& ident, PassRefPtr<QtInstance> inst, int index, const QByteArray& signature, bool allowPrivate)
-    : QtRuntimeMethod (new QtRuntimeMetaMethodData(), exec, ident, inst)
+QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, Structure* structure, const Identifier& ident, PassRefPtr<QtInstance> inst, int index, const QByteArray& signature, bool allowPrivate)
+    : QtRuntimeMethod (new QtRuntimeMetaMethodData(), exec, structure, ident, inst)
 {
     QW_D(QtRuntimeMetaMethod);
     d->m_signature = signature;
@@ -1564,8 +1564,8 @@
 
 QMultiMap<QObject*, QtConnectionObject*> QtRuntimeConnectionMethod::connections;
 
-QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, const Identifier& ident, bool isConnect, PassRefPtr<QtInstance> inst, int index, const QByteArray& signature)
-    : QtRuntimeMethod (new QtRuntimeConnectionMethodData(), exec, ident, inst)
+QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, Structure* structure, const Identifier& ident, bool isConnect, PassRefPtr<QtInstance> inst, int index, const QByteArray& signature)
+    : QtRuntimeMethod (new QtRuntimeConnectionMethodData(), exec, structure, ident, inst)
 {
     QW_D(QtRuntimeConnectionMethod);
 

Modified: trunk/Source/WebCore/bridge/qt/qt_runtime.h (93058 => 93059)


--- trunk/Source/WebCore/bridge/qt/qt_runtime.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/qt/qt_runtime.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -21,6 +21,7 @@
 #define BINDINGS_QT_RUNTIME_H_
 
 #include "BridgeJSC.h"
+#include "JSDOMBinding.h"
 #include "_javascript_.h"
 #include "Weak.h"
 #include "qt_instance.h"
@@ -145,18 +146,18 @@
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | InternalFunction::StructureFlags | OverridesVisitChildren;
 
     QtRuntimeMethodData *d_func() const {return d_ptr;}
-    QtRuntimeMethod(QtRuntimeMethodData *dd, ExecState *exec, const Identifier &n, PassRefPtr<QtInstance> inst);
+    QtRuntimeMethod(QtRuntimeMethodData *dd, ExecState *, Structure*, const Identifier &name, PassRefPtr<QtInstance>);
     QtRuntimeMethodData *d_ptr;
 };
 
-class QtRuntimeMetaMethod : public QtRuntimeMethod
-{
+class QtRuntimeMetaMethod : public QtRuntimeMethod {
 public:
     typedef QtRuntimeMethod Base;
 
     static QtRuntimeMetaMethod* create(ExecState* exec, const Identifier& n, PassRefPtr<QtInstance> inst, int index, const QByteArray& signature, bool allowPrivate)
     {
-        return new (allocateCell<QtRuntimeMetaMethod>(*exec->heap())) QtRuntimeMetaMethod(exec, n, inst, index, signature, allowPrivate);
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<QtRuntimeMethod>(exec);
+        return new (allocateCell<QtRuntimeMetaMethod>(*exec->heap())) QtRuntimeMetaMethod(exec, domStructure, n, inst, index, signature, allowPrivate);
     }
 
     virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
@@ -169,7 +170,7 @@
     QtRuntimeMetaMethodData* d_func() const {return reinterpret_cast<QtRuntimeMetaMethodData*>(d_ptr);}
 
 private:
-    QtRuntimeMetaMethod(ExecState*, const Identifier&, PassRefPtr<QtInstance>, int index, const QByteArray&, bool allowPrivate);
+    QtRuntimeMetaMethod(ExecState*, Structure*, const Identifier&, PassRefPtr<QtInstance>, int index, const QByteArray&, bool allowPrivate);
 
     virtual CallType getCallData(CallData&);
     static EncodedJSValue JSC_HOST_CALL call(ExecState* exec);
@@ -185,7 +186,8 @@
 
     static QtRuntimeConnectionMethod* create(ExecState* exec, const Identifier& n, bool isConnect, PassRefPtr<QtInstance> inst, int index, const QByteArray& signature)
     {
-        return new (allocateCell<QtRuntimeConnectionMethod>(*exec->heap())) QtRuntimeConnectionMethod(exec, n, isConnect, inst, index, signature);
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<QtRuntimeMethod>(exec);
+        return new (allocateCell<QtRuntimeConnectionMethod>(*exec->heap())) QtRuntimeConnectionMethod(exec, domStructure, n, isConnect, inst, index, signature);
     }
 
     virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
@@ -196,7 +198,7 @@
     QtRuntimeConnectionMethodData* d_func() const {return reinterpret_cast<QtRuntimeConnectionMethodData*>(d_ptr);}
 
 private:
-    QtRuntimeConnectionMethod(ExecState*, const Identifier&, bool isConnect, PassRefPtr<QtInstance>, int index, const QByteArray&);
+    QtRuntimeConnectionMethod(ExecState*, Structure*, const Identifier&, bool isConnect, PassRefPtr<QtInstance>, int index, const QByteArray&);
 
     virtual CallType getCallData(CallData&);
     static EncodedJSValue JSC_HOST_CALL call(ExecState* exec);

Modified: trunk/Source/WebCore/bridge/runtime_array.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/runtime_array.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/runtime_array.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -37,10 +37,10 @@
 
 const ClassInfo RuntimeArray::s_info = { "RuntimeArray", &JSArray::s_info, 0, 0 };
 
-RuntimeArray::RuntimeArray(ExecState* exec, Bindings::Array* array)
+RuntimeArray::RuntimeArray(ExecState* exec, Structure* structure, Bindings::Array* array)
     // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
     // We need to pass in the right global object for "array".
-    : JSArray(exec->globalData(), deprecatedGetDOMStructure<RuntimeArray>(exec))
+    : JSArray(exec->globalData(), structure)
 {
     ASSERT(inherits(&s_info));
     setSubclassData(array);

Modified: trunk/Source/WebCore/bridge/runtime_array.h (93058 => 93059)


--- trunk/Source/WebCore/bridge/runtime_array.h	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/runtime_array.h	2011-08-15 21:12:11 UTC (rev 93059)
@@ -27,6 +27,7 @@
 #define RUNTIME_ARRAY_H_
 
 #include "BridgeJSC.h"
+#include "JSDOMBinding.h"
 #include <runtime/ArrayPrototype.h>
 
 namespace JSC {
@@ -37,7 +38,8 @@
 
     static RuntimeArray* create(ExecState* exec, Bindings::Array* array)
     {
-        return new (allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, array);
+        Structure* domStructure = WebCore::deprecatedGetDOMStructure<RuntimeArray>(exec);
+        return new (allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, domStructure, array);
     }
 
     typedef Bindings::Array BindingsArray;
@@ -73,7 +75,7 @@
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSArray::StructureFlags;
 
 private:
-    RuntimeArray(ExecState*, Bindings::Array*);
+    RuntimeArray(ExecState*, Structure*, Bindings::Array*);
     static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
     static JSValue indexGetter(ExecState*, JSValue, unsigned);
 };

Modified: trunk/Source/WebCore/bridge/runtime_object.cpp (93058 => 93059)


--- trunk/Source/WebCore/bridge/runtime_object.cpp	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebCore/bridge/runtime_object.cpp	2011-08-15 21:12:11 UTC (rev 93059)
@@ -29,7 +29,6 @@
 #include "JSDOMBinding.h"
 #include "runtime_method.h"
 #include <runtime/Error.h>
-#include <runtime/ObjectPrototype.h>
 
 using namespace WebCore;
 

Modified: trunk/Source/WebKit/mac/ChangeLog (93058 => 93059)


--- trunk/Source/WebKit/mac/ChangeLog	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebKit/mac/ChangeLog	2011-08-15 21:12:11 UTC (rev 93059)
@@ -1,3 +1,17 @@
+2011-08-15  Mark Hahnenberg  <[email protected]>
+
+        Refactor JS objects to allocate in static create methods rather than constructors
+        https://bugs.webkit.org/show_bug.cgi?id=65347
+
+        Reviewed by Geoffrey Garen.
+
+        Removed all calls to deprecatedGetDOMObject from initialization lists as part of a 
+        larger refactoring to get rid of all allocation during initialization.
+
+        * Plugins/Hosted/ProxyInstance.mm:
+        (WebKit::ProxyRuntimeMethod::create):
+        (WebKit::ProxyRuntimeMethod::ProxyRuntimeMethod):
+
 2011-08-15  Adam Roben  <[email protected]>
 
         Update pages' style and content scale when the window's backing scale factor changes

Modified: trunk/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm (93058 => 93059)


--- trunk/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm	2011-08-15 21:06:53 UTC (rev 93058)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/ProxyInstance.mm	2011-08-15 21:12:11 UTC (rev 93059)
@@ -183,7 +183,10 @@
 
     static ProxyRuntimeMethod* create(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
     {
-        return new (allocateCell<ProxyRuntimeMethod>(*exec->heap())) ProxyRuntimeMethod(exec, globalObject, name, list);
+        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
+        // exec-globalData() is also likely wrong.
+        Structure* domStructure = deprecatedGetDOMStructure<ProxyRuntimeMethod>(exec);
+        return new (allocateCell<ProxyRuntimeMethod>(*exec->heap())) ProxyRuntimeMethod(exec, globalObject, domStructure, name, list);
     }
 
     static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
@@ -194,10 +197,8 @@
     static const ClassInfo s_info;
 
 private:
-    ProxyRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, Bindings::MethodList& list)
-        // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
-        // exec-globalData() is also likely wrong.
-        : RuntimeMethod(exec, globalObject, deprecatedGetDOMStructure<ProxyRuntimeMethod>(exec), name, list)
+    ProxyRuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const Identifier& name, Bindings::MethodList& list)
+        : RuntimeMethod(exec, globalObject, structure, name, list)
     {
         ASSERT(inherits(&s_info));
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to