Unzip initialization lists and constructors in JSCell hierarchy (5/7)
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Sep 2011 02:13:37 +0000 (02:13 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Sep 2011 02:13:37 +0000 (02:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67420

Patch by Mark Hahnenberg <mhahnenberg@apple.com> on 2011-09-06
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Completed the fifth level of the refactoring to add finishCreation()
methods to all classes within the JSCell hierarchy with non-trivial
constructor bodies.

This primarily consists of pushing the calls to finishCreation() down
into the constructors of the subclasses of the second level of the hierarchy
as well as pulling the finishCreation() calls out into the class's corresponding
create() method if it has one.  Doing both simultaneously allows us to
maintain the invariant that the finishCreation() method chain is called exactly
once during the creation of an object, since calling it any other number of
times (0, 2, or more) will cause an assertion failure.

* API/JSCallbackConstructor.cpp:
(JSC::JSCallbackConstructor::JSCallbackConstructor):
* API/JSCallbackConstructor.h:
(JSC::JSCallbackConstructor::create):
* API/JSCallbackFunction.cpp:
(JSC::JSCallbackFunction::JSCallbackFunction):
(JSC::JSCallbackFunction::finishCreation):
* API/JSCallbackFunction.h:
* JavaScriptCore.exp:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* debugger/DebuggerActivation.cpp:
* debugger/DebuggerActivation.h:
(JSC::DebuggerActivation::create):
* jsc.cpp:
(GlobalObject::finishCreation):
(GlobalObject::GlobalObject):
* runtime/ArrayConstructor.cpp:
(JSC::ArrayConstructor::ArrayConstructor):
(JSC::ArrayConstructor::finishCreation):
* runtime/ArrayConstructor.h:
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::ArrayPrototype):
* runtime/ArrayPrototype.h:
(JSC::ArrayPrototype::create):
* runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::BooleanConstructor):
(JSC::BooleanConstructor::finishCreation):
* runtime/BooleanConstructor.h:
* runtime/BooleanObject.cpp:
(JSC::BooleanObject::BooleanObject):
* runtime/BooleanObject.h:
(JSC::BooleanObject::create):
* runtime/BooleanPrototype.cpp:
(JSC::BooleanPrototype::BooleanPrototype):
(JSC::BooleanPrototype::finishCreation):
* runtime/BooleanPrototype.h:
* runtime/DateConstructor.cpp:
(JSC::DateConstructor::DateConstructor):
(JSC::DateConstructor::finishCreation):
* runtime/DateConstructor.h:
* runtime/DateInstance.cpp:
(JSC::DateInstance::DateInstance):
* runtime/DateInstance.h:
(JSC::DateInstance::create):
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::DatePrototype):
(JSC::DatePrototype::finishCreation):
* runtime/DatePrototype.h:
* runtime/Error.cpp:
(JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
* runtime/ErrorConstructor.cpp:
(JSC::ErrorConstructor::ErrorConstructor):
(JSC::ErrorConstructor::finishCreation):
* runtime/ErrorConstructor.h:
* runtime/ErrorPrototype.cpp:
(JSC::ErrorPrototype::ErrorPrototype):
* runtime/ErrorPrototype.h:
(JSC::ErrorPrototype::create):
* runtime/FunctionConstructor.cpp:
(JSC::FunctionConstructor::FunctionConstructor):
(JSC::FunctionConstructor::finishCreation):
* runtime/FunctionConstructor.h:
* runtime/FunctionPrototype.cpp:
(JSC::FunctionPrototype::FunctionPrototype):
(JSC::FunctionPrototype::finishCreation):
* runtime/FunctionPrototype.h:
* runtime/InternalFunction.cpp:
(JSC::InternalFunction::InternalFunction):
* runtime/InternalFunction.h:
* runtime/JSActivation.cpp:
(JSC::JSActivation::JSActivation):
* runtime/JSActivation.h:
(JSC::JSActivation::create):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::create):
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSONObject.cpp:
(JSC::JSONObject::JSONObject):
* runtime/JSONObject.h:
(JSC::JSONObject::create):
* runtime/JSStaticScopeObject.h:
(JSC::JSStaticScopeObject::create):
(JSC::JSStaticScopeObject::JSStaticScopeObject):
* runtime/JSString.cpp:
(JSC::StringObject::create):
* runtime/MathObject.cpp:
(JSC::MathObject::MathObject):
* runtime/MathObject.h:
(JSC::MathObject::create):
* runtime/NativeErrorConstructor.cpp:
(JSC::NativeErrorConstructor::NativeErrorConstructor):
* runtime/NativeErrorConstructor.h:
(JSC::NativeErrorConstructor::finishCreation):
* runtime/NativeErrorPrototype.cpp:
(JSC::NativeErrorPrototype::NativeErrorPrototype):
(JSC::NativeErrorPrototype::finishCreation):
* runtime/NativeErrorPrototype.h:
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::NumberConstructor):
(JSC::NumberConstructor::finishCreation):
* runtime/NumberConstructor.h:
* runtime/NumberObject.cpp:
(JSC::NumberObject::NumberObject):
* runtime/NumberObject.h:
(JSC::NumberObject::create):
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::NumberPrototype):
(JSC::NumberPrototype::finishCreation):
* runtime/NumberPrototype.h:
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::ObjectConstructor):
(JSC::ObjectConstructor::finishCreation):
* runtime/ObjectConstructor.h:
* runtime/RegExpConstructor.cpp:
(JSC::RegExpConstructor::RegExpConstructor):
(JSC::RegExpConstructor::finishCreation):
(JSC::RegExpMatchesArray::RegExpMatchesArray):
* runtime/RegExpConstructor.h:
* runtime/RegExpMatchesArray.h:
(JSC::RegExpMatchesArray::create):
* runtime/RegExpObject.cpp:
(JSC::RegExpObject::RegExpObject):
* runtime/RegExpObject.h:
(JSC::RegExpObject::create):
* runtime/RegExpPrototype.cpp:
(JSC::RegExpPrototype::RegExpPrototype):
* runtime/StringConstructor.cpp:
(JSC::StringConstructor::StringConstructor):
(JSC::StringConstructor::finishCreation):
* runtime/StringConstructor.h:
* runtime/StringObject.cpp:
(JSC::StringObject::StringObject):
* runtime/StringObject.h:
(JSC::StringObject::create):
* runtime/StringObjectThatMasqueradesAsUndefined.h:
(JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::StringPrototype):
(JSC::StringPrototype::finishCreation):
* runtime/StringPrototype.h:

Source/JavaScriptGlue:

Completed the fifth level of the refactoring to add finishCreation()
methods to all classes within the JSCell hierarchy with non-trivial
constructor bodies.

This primarily consists of pushing the calls to finishCreation() down
into the constructors of the subclasses of the second level of the hierarchy
as well as pulling the finishCreation() calls out into the class's corresponding
create() method if it has one.  Doing both simultaneously allows us to
maintain the invariant that the finishCreation() method chain is called exactly
once during the creation of an object, since calling it any other number of
times (0, 2, or more) will cause an assertion failure.

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

Source/WebCore:

No new tests.

Completed the fifth level of the refactoring to add finishCreation()
methods to all classes within the JSCell hierarchy with non-trivial
constructor bodies.

This primarily consists of pushing the calls to finishCreation() down
into the constructors of the subclasses of the second level of the hierarchy
as well as pulling the finishCreation() calls out into the class's corresponding
create() method if it has one.  Doing both simultaneously allows us to
maintain the invariant that the finishCreation() method chain is called exactly
once during the creation of an object, since calling it any other number of
times (0, 2, or more) will cause an assertion failure.

* WebCore.exp.in:
* bindings/js/JSDOMBinding.h:
(WebCore::DOMConstructorObject::DOMConstructorObject):
* bindings/js/JSDOMGlobalObject.cpp:
(WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
(WebCore::JSDOMGlobalObject::finishCreation):
* bindings/js/JSDOMGlobalObject.h:
* bindings/js/JSDOMWindowShell.cpp:
* bindings/js/JSDOMWindowShell.h:
(WebCore::JSDOMWindowShell::create):
* bindings/js/JSDOMWrapper.h:
(WebCore::JSDOMWrapper::JSDOMWrapper):
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterface::JSTestInterface):
* bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::JSTestMediaQueryListListener::JSTestMediaQueryListListener):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::JSTestObj::JSTestObj):
* bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::JSTestSerializedScriptValueInterface::JSTestSerializedScriptValueInterface):
* bridge/c/CRuntimeObject.cpp:
(JSC::Bindings::CRuntimeObject::CRuntimeObject):
(JSC::Bindings::CRuntimeObject::finishCreation):
* bridge/c/CRuntimeObject.h:
* bridge/jni/jsc/JavaRuntimeObject.cpp:
(JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
(JSC::Bindings::JavaRuntimeObject::finishCreation):
* bridge/jni/jsc/JavaRuntimeObject.h:
* bridge/objc/ObjCRuntimeObject.h:
* bridge/objc/ObjCRuntimeObject.mm:
(JSC::Bindings::ObjCRuntimeObject::ObjCRuntimeObject):
(JSC::Bindings::ObjCRuntimeObject::finishCreation):
* 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::QtRuntimeObject):
* bridge/qt/qt_pixmapruntime.cpp:
(JSC::Bindings::QtPixmapRuntimeObject::QtPixmapRuntimeObject):
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
(JSC::Bindings::QtRuntimeMethod::finishCreation):
* bridge/qt/qt_runtime.h:
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::RuntimeArray):
* bridge/runtime_array.h:
(JSC::RuntimeArray::create):
* bridge/runtime_method.cpp:
(JSC::RuntimeMethod::RuntimeMethod):
(JSC::RuntimeMethod::finishCreation):
* bridge/runtime_method.h:
* bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::RuntimeObject):
* bridge/runtime_object.h:
(JSC::Bindings::RuntimeObject::create):

Source/WebKit/mac:

Completed the fifth level of the refactoring to add finishCreation()
methods to all classes within the JSCell hierarchy with non-trivial
constructor bodies.

This primarily consists of pushing the calls to finishCreation() down
into the constructors of the subclasses of the second level of the hierarchy
as well as pulling the finishCreation() calls out into the class's corresponding
create() method if it has one.  Doing both simultaneously allows us to
maintain the invariant that the finishCreation() method chain is called exactly
once during the creation of an object, since calling it any other number of
times (0, 2, or more) will cause an assertion failure.

* Plugins/Hosted/ProxyRuntimeObject.h:
* Plugins/Hosted/ProxyRuntimeObject.mm:
(WebKit::ProxyRuntimeObject::ProxyRuntimeObject):
(WebKit::ProxyRuntimeObject::finishCreation):

Source/WebKit2:

Completed the fifth level of the refactoring to add finishCreation()
methods to all classes within the JSCell hierarchy with non-trivial
constructor bodies.

This primarily consists of pushing the calls to finishCreation() down
into the constructors of the subclasses of the second level of the hierarchy
as well as pulling the finishCreation() calls out into the class's corresponding
create() method if it has one.  Doing both simultaneously allows us to
maintain the invariant that the finishCreation() method chain is called exactly
once during the creation of an object, since calling it any other number of
times (0, 2, or more) will cause an assertion failure.

* WebProcess/Plugins/Netscape/JSNPMethod.cpp:
(WebKit::JSNPMethod::JSNPMethod):
(WebKit::JSNPMethod::finishCreation):
* WebProcess/Plugins/Netscape/JSNPMethod.h:
(WebKit::JSNPMethod::create):
* WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::JSNPObject):
* WebProcess/Plugins/Netscape/JSNPObject.h:
(WebKit::JSNPObject::create):

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

112 files changed:
Source/JavaScriptCore/API/JSCallbackConstructor.cpp
Source/JavaScriptCore/API/JSCallbackConstructor.h
Source/JavaScriptCore/API/JSCallbackFunction.cpp
Source/JavaScriptCore/API/JSCallbackFunction.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/debugger/DebuggerActivation.cpp
Source/JavaScriptCore/debugger/DebuggerActivation.h
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/ArrayConstructor.cpp
Source/JavaScriptCore/runtime/ArrayConstructor.h
Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Source/JavaScriptCore/runtime/ArrayPrototype.h
Source/JavaScriptCore/runtime/BooleanConstructor.cpp
Source/JavaScriptCore/runtime/BooleanConstructor.h
Source/JavaScriptCore/runtime/BooleanObject.cpp
Source/JavaScriptCore/runtime/BooleanObject.h
Source/JavaScriptCore/runtime/BooleanPrototype.cpp
Source/JavaScriptCore/runtime/BooleanPrototype.h
Source/JavaScriptCore/runtime/DateConstructor.cpp
Source/JavaScriptCore/runtime/DateConstructor.h
Source/JavaScriptCore/runtime/DateInstance.cpp
Source/JavaScriptCore/runtime/DateInstance.h
Source/JavaScriptCore/runtime/DatePrototype.cpp
Source/JavaScriptCore/runtime/DatePrototype.h
Source/JavaScriptCore/runtime/Error.cpp
Source/JavaScriptCore/runtime/ErrorConstructor.cpp
Source/JavaScriptCore/runtime/ErrorConstructor.h
Source/JavaScriptCore/runtime/ErrorPrototype.cpp
Source/JavaScriptCore/runtime/ErrorPrototype.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/JSActivation.cpp
Source/JavaScriptCore/runtime/JSActivation.h
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSONObject.cpp
Source/JavaScriptCore/runtime/JSONObject.h
Source/JavaScriptCore/runtime/JSStaticScopeObject.h
Source/JavaScriptCore/runtime/JSString.cpp
Source/JavaScriptCore/runtime/MathObject.cpp
Source/JavaScriptCore/runtime/MathObject.h
Source/JavaScriptCore/runtime/NativeErrorConstructor.cpp
Source/JavaScriptCore/runtime/NativeErrorConstructor.h
Source/JavaScriptCore/runtime/NativeErrorPrototype.cpp
Source/JavaScriptCore/runtime/NativeErrorPrototype.h
Source/JavaScriptCore/runtime/NumberConstructor.cpp
Source/JavaScriptCore/runtime/NumberConstructor.h
Source/JavaScriptCore/runtime/NumberObject.cpp
Source/JavaScriptCore/runtime/NumberObject.h
Source/JavaScriptCore/runtime/NumberPrototype.cpp
Source/JavaScriptCore/runtime/NumberPrototype.h
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/ObjectConstructor.h
Source/JavaScriptCore/runtime/RegExpConstructor.cpp
Source/JavaScriptCore/runtime/RegExpConstructor.h
Source/JavaScriptCore/runtime/RegExpMatchesArray.h
Source/JavaScriptCore/runtime/RegExpObject.cpp
Source/JavaScriptCore/runtime/RegExpObject.h
Source/JavaScriptCore/runtime/RegExpPrototype.cpp
Source/JavaScriptCore/runtime/StringConstructor.cpp
Source/JavaScriptCore/runtime/StringConstructor.h
Source/JavaScriptCore/runtime/StringObject.cpp
Source/JavaScriptCore/runtime/StringObject.h
Source/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/runtime/StringPrototype.h
Source/JavaScriptGlue/ChangeLog
Source/JavaScriptGlue/JSRun.cpp
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMGlobalObject.cpp
Source/WebCore/bindings/js/JSDOMGlobalObject.h
Source/WebCore/bindings/js/JSDOMWindowShell.cpp
Source/WebCore/bindings/js/JSDOMWindowShell.h
Source/WebCore/bindings/js/JSDOMWrapper.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp
Source/WebCore/bridge/c/CRuntimeObject.cpp
Source/WebCore/bridge/c/CRuntimeObject.h
Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.cpp
Source/WebCore/bridge/jni/jsc/JavaRuntimeObject.h
Source/WebCore/bridge/objc/ObjCRuntimeObject.h
Source/WebCore/bridge/objc/ObjCRuntimeObject.mm
Source/WebCore/bridge/objc/objc_runtime.h
Source/WebCore/bridge/objc/objc_runtime.mm
Source/WebCore/bridge/qt/qt_instance.cpp
Source/WebCore/bridge/qt/qt_pixmapruntime.cpp
Source/WebCore/bridge/qt/qt_runtime.cpp
Source/WebCore/bridge/qt/qt_runtime.h
Source/WebCore/bridge/runtime_array.cpp
Source/WebCore/bridge/runtime_array.h
Source/WebCore/bridge/runtime_method.cpp
Source/WebCore/bridge/runtime_method.h
Source/WebCore/bridge/runtime_object.cpp
Source/WebCore/bridge/runtime_object.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.h
Source/WebKit/mac/Plugins/Hosted/ProxyRuntimeObject.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPMethod.h
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.h

index 9504ad8..6a09934 100644 (file)
@@ -43,7 +43,6 @@ JSCallbackConstructor::JSCallbackConstructor(JSGlobalObject* globalObject, Struc
     , m_class(jsClass)
     , m_callback(callback)
 {
-    finishCreation(globalObject, jsClass);
 }
 
 void JSCallbackConstructor::finishCreation(JSGlobalObject* globalObject, JSClassRef jsClass)
index 59a5c44..0414a9e 100644 (file)
@@ -37,7 +37,9 @@ public:
 
     static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback) 
     {
-        return new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback);
+        JSCallbackConstructor* constructor = new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback);
+        constructor->finishCreation(globalObject, classRef);
+        return constructor;
     }
     
     virtual ~JSCallbackConstructor();
index 28b3419..cc5561f 100644 (file)
@@ -43,9 +43,15 @@ ASSERT_CLASS_FITS_IN_CELL(JSCallbackFunction);
 const ClassInfo JSCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0 };
 
 JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name)
-    : InternalFunction(&exec->globalData(), globalObject, globalObject->callbackFunctionStructure(), name)
+    : InternalFunction(globalObject, globalObject->callbackFunctionStructure())
     , m_callback(callback)
 {
+    finishCreation(exec->globalData(), globalObject, name);
+}
+
+void JSCallbackFunction::finishCreation(JSGlobalData& globalData, JSGlobalObject* globalObject, const Identifier& name)
+{
+    Base::finishCreation(globalData, globalObject, name);
     ASSERT(inherits(&s_info));
 }
 
index 7ebc788..f1ce5cc 100644 (file)
@@ -34,6 +34,7 @@ namespace JSC {
 class JSCallbackFunction : public InternalFunction {
 protected:
     JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name);
+    void finishCreation(JSGlobalData&, JSGlobalObject*, const Identifier& name);
 
 public:
     typedef InternalFunction Base;
index 4d0165c..5283a0d 100644 (file)
@@ -1,3 +1,163 @@
+2011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Unzip initialization lists and constructors in JSCell hierarchy (5/7)
+        https://bugs.webkit.org/show_bug.cgi?id=67420
+
+        Reviewed by Geoffrey Garen.
+
+        Completed the fifth level of the refactoring to add finishCreation() 
+        methods to all classes within the JSCell hierarchy with non-trivial 
+        constructor bodies.
+
+        This primarily consists of pushing the calls to finishCreation() down 
+        into the constructors of the subclasses of the second level of the hierarchy 
+        as well as pulling the finishCreation() calls out into the class's corresponding
+        create() method if it has one.  Doing both simultaneously allows us to 
+        maintain the invariant that the finishCreation() method chain is called exactly 
+        once during the creation of an object, since calling it any other number of 
+        times (0, 2, or more) will cause an assertion failure.
+
+        * API/JSCallbackConstructor.cpp:
+        (JSC::JSCallbackConstructor::JSCallbackConstructor):
+        * API/JSCallbackConstructor.h:
+        (JSC::JSCallbackConstructor::create):
+        * API/JSCallbackFunction.cpp:
+        (JSC::JSCallbackFunction::JSCallbackFunction):
+        (JSC::JSCallbackFunction::finishCreation):
+        * API/JSCallbackFunction.h:
+        * JavaScriptCore.exp:
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+        * debugger/DebuggerActivation.cpp:
+        * debugger/DebuggerActivation.h:
+        (JSC::DebuggerActivation::create):
+        * jsc.cpp:
+        (GlobalObject::finishCreation):
+        (GlobalObject::GlobalObject):
+        * runtime/ArrayConstructor.cpp:
+        (JSC::ArrayConstructor::ArrayConstructor):
+        (JSC::ArrayConstructor::finishCreation):
+        * runtime/ArrayConstructor.h:
+        * runtime/ArrayPrototype.cpp:
+        (JSC::ArrayPrototype::ArrayPrototype):
+        * runtime/ArrayPrototype.h:
+        (JSC::ArrayPrototype::create):
+        * runtime/BooleanConstructor.cpp:
+        (JSC::BooleanConstructor::BooleanConstructor):
+        (JSC::BooleanConstructor::finishCreation):
+        * runtime/BooleanConstructor.h:
+        * runtime/BooleanObject.cpp:
+        (JSC::BooleanObject::BooleanObject):
+        * runtime/BooleanObject.h:
+        (JSC::BooleanObject::create):
+        * runtime/BooleanPrototype.cpp:
+        (JSC::BooleanPrototype::BooleanPrototype):
+        (JSC::BooleanPrototype::finishCreation):
+        * runtime/BooleanPrototype.h:
+        * runtime/DateConstructor.cpp:
+        (JSC::DateConstructor::DateConstructor):
+        (JSC::DateConstructor::finishCreation):
+        * runtime/DateConstructor.h:
+        * runtime/DateInstance.cpp:
+        (JSC::DateInstance::DateInstance):
+        * runtime/DateInstance.h:
+        (JSC::DateInstance::create):
+        * runtime/DatePrototype.cpp:
+        (JSC::DatePrototype::DatePrototype):
+        (JSC::DatePrototype::finishCreation):
+        * runtime/DatePrototype.h:
+        * runtime/Error.cpp:
+        (JSC::StrictModeTypeErrorFunction::StrictModeTypeErrorFunction):
+        * runtime/ErrorConstructor.cpp:
+        (JSC::ErrorConstructor::ErrorConstructor):
+        (JSC::ErrorConstructor::finishCreation):
+        * runtime/ErrorConstructor.h:
+        * runtime/ErrorPrototype.cpp:
+        (JSC::ErrorPrototype::ErrorPrototype):
+        * runtime/ErrorPrototype.h:
+        (JSC::ErrorPrototype::create):
+        * runtime/FunctionConstructor.cpp:
+        (JSC::FunctionConstructor::FunctionConstructor):
+        (JSC::FunctionConstructor::finishCreation):
+        * runtime/FunctionConstructor.h:
+        * runtime/FunctionPrototype.cpp:
+        (JSC::FunctionPrototype::FunctionPrototype):
+        (JSC::FunctionPrototype::finishCreation):
+        * runtime/FunctionPrototype.h:
+        * runtime/InternalFunction.cpp:
+        (JSC::InternalFunction::InternalFunction):
+        * runtime/InternalFunction.h:
+        * runtime/JSActivation.cpp:
+        (JSC::JSActivation::JSActivation):
+        * runtime/JSActivation.h:
+        (JSC::JSActivation::create):
+        * runtime/JSGlobalObject.h:
+        (JSC::JSGlobalObject::create):
+        (JSC::JSGlobalObject::JSGlobalObject):
+        * runtime/JSONObject.cpp:
+        (JSC::JSONObject::JSONObject):
+        * runtime/JSONObject.h:
+        (JSC::JSONObject::create):
+        * runtime/JSStaticScopeObject.h:
+        (JSC::JSStaticScopeObject::create):
+        (JSC::JSStaticScopeObject::JSStaticScopeObject):
+        * runtime/JSString.cpp:
+        (JSC::StringObject::create):
+        * runtime/MathObject.cpp:
+        (JSC::MathObject::MathObject):
+        * runtime/MathObject.h:
+        (JSC::MathObject::create):
+        * runtime/NativeErrorConstructor.cpp:
+        (JSC::NativeErrorConstructor::NativeErrorConstructor):
+        * runtime/NativeErrorConstructor.h:
+        (JSC::NativeErrorConstructor::finishCreation):
+        * runtime/NativeErrorPrototype.cpp:
+        (JSC::NativeErrorPrototype::NativeErrorPrototype):
+        (JSC::NativeErrorPrototype::finishCreation):
+        * runtime/NativeErrorPrototype.h:
+        * runtime/NumberConstructor.cpp:
+        (JSC::NumberConstructor::NumberConstructor):
+        (JSC::NumberConstructor::finishCreation):
+        * runtime/NumberConstructor.h:
+        * runtime/NumberObject.cpp:
+        (JSC::NumberObject::NumberObject):
+        * runtime/NumberObject.h:
+        (JSC::NumberObject::create):
+        * runtime/NumberPrototype.cpp:
+        (JSC::NumberPrototype::NumberPrototype):
+        (JSC::NumberPrototype::finishCreation):
+        * runtime/NumberPrototype.h:
+        * runtime/ObjectConstructor.cpp:
+        (JSC::ObjectConstructor::ObjectConstructor):
+        (JSC::ObjectConstructor::finishCreation):
+        * runtime/ObjectConstructor.h:
+        * runtime/RegExpConstructor.cpp:
+        (JSC::RegExpConstructor::RegExpConstructor):
+        (JSC::RegExpConstructor::finishCreation):
+        (JSC::RegExpMatchesArray::RegExpMatchesArray):
+        * runtime/RegExpConstructor.h:
+        * runtime/RegExpMatchesArray.h:
+        (JSC::RegExpMatchesArray::create):
+        * runtime/RegExpObject.cpp:
+        (JSC::RegExpObject::RegExpObject):
+        * runtime/RegExpObject.h:
+        (JSC::RegExpObject::create):
+        * runtime/RegExpPrototype.cpp:
+        (JSC::RegExpPrototype::RegExpPrototype):
+        * runtime/StringConstructor.cpp:
+        (JSC::StringConstructor::StringConstructor):
+        (JSC::StringConstructor::finishCreation):
+        * runtime/StringConstructor.h:
+        * runtime/StringObject.cpp:
+        (JSC::StringObject::StringObject):
+        * runtime/StringObject.h:
+        (JSC::StringObject::create):
+        * runtime/StringObjectThatMasqueradesAsUndefined.h:
+        (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
+        * runtime/StringPrototype.cpp:
+        (JSC::StringPrototype::StringPrototype):
+        (JSC::StringPrototype::finishCreation):
+        * runtime/StringPrototype.h:
+
 2011-09-06  Filip Pizlo  <fpizlo@apple.com>
 
         Accessibility tests crashing in BasicRawSentinelNode code
index 568e40f..c5d8165 100644 (file)
@@ -123,8 +123,10 @@ __ZN3JSC11ParserArena5resetEv
 __ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeE
 __ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE
 __ZN3JSC11regExpFlagsERKNS_7UStringE
+__ZN3JSC12DateInstance14finishCreationERNS_12JSGlobalDataEd
+__ZN3JSC12DateInstance6createEPNS_9ExecStateEPNS_9StructureEd
 __ZN3JSC12DateInstance6s_infoE
-__ZN3JSC12DateInstanceC1EPNS_9ExecStateEPNS_9StructureEd
+__ZN3JSC12DateInstanceC1EPNS_9ExecStateEPNS_9StructureE
 __ZN3JSC12JSGlobalData10ClientDataD2Ev
 __ZN3JSC12JSGlobalData11jsArrayVPtrE
 __ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeENS_8HeapSizeE
@@ -138,19 +140,21 @@ __ZN3JSC12JSGlobalData15dumpRegExpTraceEv
 __ZN3JSC12JSGlobalData22clearBuiltinStructuresEv
 __ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeENS_8HeapSizeE
 __ZN3JSC12JSGlobalDataD1Ev
+__ZN3JSC12RegExpObject14finishCreationEPNS_14JSGlobalObjectE
 __ZN3JSC12RegExpObject6s_infoE
 __ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEPNS_6RegExpE
 __ZN3JSC12SamplingTool5setupEv
 __ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
 __ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
 __ZN3JSC12StringObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC12StringObject14finishCreationERNS_12JSGlobalDataEPNS_8JSStringE
 __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
 __ZN3JSC12StringObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
 __ZN3JSC12StringObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
 __ZN3JSC12StringObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
 __ZN3JSC12StringObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
 __ZN3JSC12StringObject6s_infoE
-__ZN3JSC12StringObjectC2ERNS_12JSGlobalDataEPNS_9StructureEPNS_8JSStringE
+__ZN3JSC12StringObjectC2ERNS_12JSGlobalDataEPNS_9StructureE
 __ZN3JSC13SamplingFlags4stopEv
 __ZN3JSC13SamplingFlags5startEv
 __ZN3JSC13SamplingFlags7s_flagsE
@@ -181,9 +185,10 @@ __ZN3JSC15WeakHandleOwner8finalizeENS_6HandleINS_7UnknownEEEPv
 __ZN3JSC15WeakHandleOwnerD2Ev
 __ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE
 __ZN3JSC16InternalFunction12vtableAnchorEv
+__ZN3JSC16InternalFunction14finishCreationERNS_12JSGlobalDataEPNS_14JSGlobalObjectERKNS_10IdentifierE
 __ZN3JSC16InternalFunction4nameEPNS_9ExecStateE
 __ZN3JSC16InternalFunction6s_infoE
-__ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEPNS_14JSGlobalObjectEPNS_9StructureERKNS_10IdentifierE
+__ZN3JSC16InternalFunctionC2EPNS_14JSGlobalObjectEPNS_9StructureE
 __ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
 __ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE
 __ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
@@ -195,7 +200,8 @@ __ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb
 __ZN3JSC17PropertyNameArray3addEPN3WTF10StringImplE
 __ZN3JSC17constructFunctionEPNS_9ExecStateEPNS_14JSGlobalObjectERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringEi
 __ZN3JSC17createSyntaxErrorEPNS_9ExecStateERKNS_7UStringE
-__ZN3JSC18DebuggerActivation6createERNS_12JSGlobalDataEPNS_8JSObjectE
+__ZN3JSC18DebuggerActivation14finishCreationERNS_12JSGlobalDataEPNS_8JSObjectE
+__ZN3JSC18DebuggerActivationC1ERNS_12JSGlobalDataE
 __ZN3JSC18PropertyDescriptor11setWritableEb
 __ZN3JSC18PropertyDescriptor12setUndefinedEv
 __ZN3JSC18PropertyDescriptor13setDescriptorENS_7JSValueEj
index 93681b7..70fe04a 100644 (file)
@@ -3,11 +3,11 @@ EXPORTS
     ??0CString@WTF@@QAE@PBD@Z
     ??0CString@WTF@@QAE@PBDI@Z
     ??0Collator@WTF@@QAE@PBD@Z
-    ??0DateInstance@JSC@@IAE@PAVExecState@1@PAVStructure@1@N@Z
+    ??0DateInstance@JSC@@IAE@PAVExecState@1@PAVStructure@1@@Z
     ??0DefaultGCActivityCallback@JSC@@QAE@PAVHeap@1@@Z
     ??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z
-    ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z  
-    ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@PAVJSGlobalObject@1@PAVStructure@1@ABVIdentifier@1@@Z
+    ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z 
+    ??0InternalFunction@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@@Z
     ??0JSArray@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z
     ??0JSByteArray@JSC@@AAE@PAVExecState@1@PAVStructure@1@PAVByteArray@WTF@@@Z
     ??0JSFunction@JSC@@AAE@PAVExecState@1@PAVJSGlobalObject@1@PAVStructure@1@@Z
@@ -19,7 +19,7 @@ EXPORTS
     ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
     ??0RegExpObject@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@@Z
     ??0SHA1@WTF@@QAE@XZ
-    ??0StringObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@PAVJSString@1@@Z
+    ??0StringObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z
     ??0Structure@JSC@@AAE@AAVJSGlobalData@1@VJSValue@1@ABVTypeInfo@1@IPBUClassInfo@1@@Z
     ??0ThreadCondition@WTF@@QAE@XZ
     ??0UString@JSC@@QAE@PBD@Z
@@ -175,10 +175,14 @@ EXPORTS
     ?fastZeroedMalloc@WTF@@YAPAXI@Z
     ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z
     ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z
+    ?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z
+    ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@PAVJSGlobalObject@2@ABVIdentifier@2@@Z
     ?finishCreation@JSArray@JSC@@IAEXAAVJSGlobalData@2@@Z
     ?finishCreation@JSArray@JSC@@IAEXAAVJSGlobalData@2@ABVArgList@2@@Z
     ?finishCreation@JSFunction@JSC@@IAEXPAVExecState@2@PAVJSGlobalObject@2@HABVIdentifier@2@PAVExecutableBase@2@@Z
     ?finishCreation@JSObjectWithGlobalObject@JSC@@IAEXAAVJSGlobalData@2@PAVJSGlobalObject@2@@Z
+    ?finishCreation@RegExpObject@JSC@@IAEXPAVJSGlobalObject@2@@Z
+    ?finishCreation@StringObject@JSC@@IAEXAAVJSGlobalData@2@PAVJSString@2@@Z
     ?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
     ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@H@Z
     ?from@Identifier@JSC@@SA?AV12@PAVExecState@2@I@Z
index a7101dc..af6a56f 100644 (file)
@@ -35,13 +35,6 @@ DebuggerActivation::DebuggerActivation(JSGlobalData& globalData)
 {
 }
 
-DebuggerActivation* DebuggerActivation::create(JSGlobalData& globalData, JSObject* object)
-{
-    DebuggerActivation* activation = new (allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData);
-    activation->finishCreation(globalData, object);
-    return activation;
-}
-
 void DebuggerActivation::finishCreation(JSGlobalData& globalData, JSObject* activation)
 {
     Base::finishCreation(globalData);
index 92a8a0e..44b6267 100644 (file)
@@ -34,7 +34,13 @@ namespace JSC {
     public:
         typedef JSNonFinalObject Base;
 
-        static DebuggerActivation* create(JSGlobalData&, JSObject*);
+        static DebuggerActivation* create(JSGlobalData& globalData, JSObject* object)
+        {
+            DebuggerActivation* activation = new (allocateCell<DebuggerActivation>(globalData.heap)) DebuggerActivation(globalData);
+            activation->finishCreation(globalData, object);
+            return activation;
+        }
+
         virtual void visitChildren(SlotVisitor&);
         virtual UString className() const;
         virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
index e103709..e14f808 100644 (file)
@@ -157,8 +157,9 @@ public:
     virtual UString className() const { return "global"; }
 
 protected:
-    void constructorBody(const Vector<UString>& arguments)
+    void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
     {
+        Base::finishCreation(globalData, this);
         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "debug"), functionDebug));
         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 1, Identifier(globalExec(), "print"), functionPrint));
         putDirectFunction(globalExec(), JSFunction::create(globalExec(), this, functionStructure(), 0, Identifier(globalExec(), "quit"), functionQuit));
@@ -190,7 +191,7 @@ ASSERT_CLASS_FITS_IN_CELL(GlobalObject);
 GlobalObject::GlobalObject(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments)
     : JSGlobalObject(globalData, structure)
 {
-    constructorBody(arguments);
+    finishCreation(globalData, arguments);
 }
 
 EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
index fd9e71d..521fcbb 100644 (file)
@@ -52,8 +52,14 @@ const ClassInfo ArrayConstructor::s_info = { "Function", &InternalFunction::s_in
 ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor);
 
 ArrayConstructor::ArrayConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ArrayPrototype* arrayPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, arrayPrototype->classInfo()->className))
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, arrayPrototype);
+}
+
+void ArrayConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, ArrayPrototype* arrayPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, arrayPrototype->classInfo()->className));
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly);
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
 }
index d18d12a..186ab8e 100644 (file)
@@ -44,6 +44,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, ArrayPrototype*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
index 99674bb..42f41a6 100644 (file)
@@ -117,7 +117,6 @@ const ClassInfo ArrayPrototype::s_info = {"Array", &JSArray::s_info, 0, ExecStat
 ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, Structure* structure)
     : JSArray(globalObject->globalData(), structure)
 {
-    finishCreation(globalObject);
 }
 
 void ArrayPrototype::finishCreation(JSGlobalObject* globalObject)
index 6041a62..75e6e80 100644 (file)
@@ -35,7 +35,9 @@ namespace JSC {
 
         static ArrayPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
         {
-            return new (allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure);
+            ArrayPrototype* prototype = new (allocateCell<ArrayPrototype>(*exec->heap())) ArrayPrototype(globalObject, structure);
+            prototype->finishCreation(globalObject);
+            return prototype;
         }
         
         bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
index ef6240e..2db4286 100644 (file)
@@ -29,8 +29,14 @@ namespace JSC {
 ASSERT_CLASS_FITS_IN_CELL(BooleanConstructor);
 
 BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, BooleanPrototype* booleanPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, booleanPrototype->classInfo()->className))
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, booleanPrototype);
+}
+
+void BooleanConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, BooleanPrototype* booleanPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, booleanPrototype->classInfo()->className));
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, booleanPrototype, DontEnum | DontDelete | ReadOnly);
 
     // no. of arguments for constructor
index e7ea583..e973109 100644 (file)
@@ -36,6 +36,9 @@ namespace JSC {
             return new (allocateCell<BooleanConstructor>(*exec->heap())) BooleanConstructor(exec, globalObject, structure, boolPrototype);
         }
 
+    protected:
+        void finishCreation(ExecState*, JSGlobalObject*, BooleanPrototype*);
+
     private:
         BooleanConstructor(ExecState*, JSGlobalObject*, Structure*, BooleanPrototype*);
         virtual ConstructType getConstructData(ConstructData&);
index b9e33dc..cbddd0e 100644 (file)
@@ -30,7 +30,6 @@ const ClassInfo BooleanObject::s_info = { "Boolean", &JSWrapperObject::s_info, 0
 BooleanObject::BooleanObject(JSGlobalData& globalData, Structure* structure)
     : JSWrapperObject(globalData, structure)
 {
-    finishCreation(globalData);
 }
 
 void BooleanObject::finishCreation(JSGlobalData& globalData)
index 0ffa425..ced1ceb 100644 (file)
@@ -35,7 +35,9 @@ namespace JSC {
 
         static BooleanObject* create(JSGlobalData& globalData, Structure* structure)
         {
-            return new (allocateCell<BooleanObject>(globalData.heap)) BooleanObject(globalData, structure);
+            BooleanObject* boolean = new (allocateCell<BooleanObject>(globalData.heap)) BooleanObject(globalData, structure);
+            boolean->finishCreation(globalData);
+            return boolean;
         }
         
         static const ClassInfo s_info;
index dd0194f..71db9c4 100644 (file)
@@ -52,6 +52,12 @@ ASSERT_CLASS_FITS_IN_CELL(BooleanPrototype);
 BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
     : BooleanObject(exec->globalData(), structure)
 {
+    finishCreation(exec, globalObject);
+}
+
+void BooleanPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+{
+    Base::finishCreation(exec->globalData());
     setInternalValue(exec->globalData(), jsBoolean(false));
 
     ASSERT(inherits(&s_info));
index 14a1638..b737dff 100644 (file)
@@ -42,6 +42,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | BooleanObject::StructureFlags;
         static const unsigned AnonymousSlotCount = BooleanObject::AnonymousSlotCount + 1;
 
index 9946fd3..27d0a9e 100644 (file)
@@ -74,8 +74,14 @@ const ClassInfo DateConstructor::s_info = { "Function", &InternalFunction::s_inf
 ASSERT_CLASS_FITS_IN_CELL(DateConstructor);
 
 DateConstructor::DateConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, DatePrototype* datePrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, datePrototype->classInfo()->className))
+    : InternalFunction(globalObject, structure) 
 {
+    finishCreation(exec, globalObject, datePrototype);
+}
+
+void DateConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, DatePrototype* datePrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, datePrototype->classInfo()->className));
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, datePrototype, DontEnum | DontDelete | ReadOnly);
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(7), ReadOnly | DontEnum | DontDelete);
 }
index 1fe74cc..7546574 100644 (file)
@@ -44,6 +44,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, DatePrototype*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
index 6df30d7..1b4add8 100644 (file)
@@ -37,13 +37,6 @@ const ClassInfo DateInstance::s_info = {"Date", &JSWrapperObject::s_info, 0, 0};
 DateInstance::DateInstance(ExecState* exec, Structure* structure)
     : JSWrapperObject(exec->globalData(), structure)
 {
-    finishCreation(exec->globalData());
-}
-
-DateInstance::DateInstance(ExecState* exec, Structure* structure, double time)
-    : JSWrapperObject(exec->globalData(), structure)
-{
-    finishCreation(exec->globalData(), time);
 }
 
 void DateInstance::finishCreation(JSGlobalData& globalData)
index ebc7dbf..bd36eb7 100644 (file)
@@ -31,7 +31,6 @@ namespace JSC {
 
     class DateInstance : public JSWrapperObject {
     protected:
-        DateInstance(ExecState*, Structure*, double);
         DateInstance(ExecState*, Structure*);
         void finishCreation(JSGlobalData&);
         void finishCreation(JSGlobalData&, double);
@@ -41,13 +40,18 @@ namespace JSC {
 
         static DateInstance* create(ExecState* exec, Structure* structure, double date)
         {
-            return new (allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure, date);
+            DateInstance* instance = new (allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
+            instance->finishCreation(exec->globalData(), date);
+            return instance;
         }
+
         static DateInstance* create(ExecState* exec, Structure* structure)
         {
-            return new (allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
+            DateInstance* instance = new (allocateCell<DateInstance>(*exec->heap())) DateInstance(exec, structure);
+            instance->finishCreation(exec->globalData());
+            return instance;
         }
-        
+
         double internalNumber() const { return internalValue().uncheckedGetNumber(); }
 
         static JS_EXPORTDATA const ClassInfo s_info;
index dda2941..176dc7e 100644 (file)
@@ -432,6 +432,12 @@ const ClassInfo DatePrototype::s_info = {"Date", &DateInstance::s_info, 0, ExecS
 DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
     : DateInstance(exec, structure)
 {
+    finishCreation(exec, globalObject);
+}
+
+void DatePrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+{
+    Base::finishCreation(exec->globalData(), jsNaN());
     ASSERT(inherits(&s_info));
 
     // The constructor will be added later, after DateConstructor has been built.
index b34c6b6..1069085 100644 (file)
@@ -49,6 +49,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | DateInstance::StructureFlags;
 
         COMPILE_ASSERT(!DateInstance::AnonymousSlotCount, DatePrototype_stomps_on_your_anonymous_slot);
index 786750b..50d4483 100644 (file)
@@ -168,9 +168,10 @@ JSObject* throwSyntaxError(ExecState* exec)
 class StrictModeTypeErrorFunction : public InternalFunction {
 private:
     StrictModeTypeErrorFunction(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message)
-        : InternalFunction(&exec->globalData(), globalObject, structure, exec->globalData().propertyNames->emptyIdentifier)
+        : InternalFunction(globalObject, structure)
         , m_message(message)
     {
+        finishCreation(exec->globalData(), globalObject, exec->globalData().propertyNames->emptyIdentifier);
     }
 
 public:
index df112dd..938f40a 100644 (file)
@@ -30,8 +30,14 @@ namespace JSC {
 ASSERT_CLASS_FITS_IN_CELL(ErrorConstructor);
 
 ErrorConstructor::ErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ErrorPrototype* errorPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, errorPrototype->classInfo()->className))
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, errorPrototype);
+}
+
+void ErrorConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, ErrorPrototype* errorPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, errorPrototype->classInfo()->className));
     // ECMA 15.11.3.1 Error.prototype
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, errorPrototype, DontEnum | DontDelete | ReadOnly);
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), DontDelete | ReadOnly | DontEnum);
index 3877a6d..944213f 100644 (file)
@@ -36,6 +36,9 @@ namespace JSC {
         {
             return new (allocateCell<ErrorConstructor>(*exec->heap())) ErrorConstructor(exec, globalObject, structure, errPrototype);
         }
+
+    protected:
+        void finishCreation(ExecState*, JSGlobalObject*, ErrorPrototype*);
         
     private:
         ErrorConstructor(ExecState*, JSGlobalObject*, Structure*, ErrorPrototype*);
index 6986752..2a9b9a9 100644 (file)
@@ -50,10 +50,9 @@ const ClassInfo ErrorPrototype::s_info = { "Error", &ErrorInstance::s_info, 0, E
 
 ASSERT_CLASS_FITS_IN_CELL(ErrorPrototype);
 
-ErrorPrototype::ErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+ErrorPrototype::ErrorPrototype(ExecState* exec, Structure* structure)
     : ErrorInstance(exec->globalData(), structure)
 {
-    finishCreation(exec, globalObject);
 }
 
 void ErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
index 0d0fd30..93484c2 100644 (file)
@@ -33,7 +33,9 @@ namespace JSC {
 
         static ErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
         {
-            return new (allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, globalObject, structure);
+            ErrorPrototype* prototype = new (allocateCell<ErrorPrototype>(*exec->heap())) ErrorPrototype(exec, structure);
+            prototype->finishCreation(exec, globalObject);
+            return prototype;
         }
         
         static const ClassInfo s_info;
@@ -44,7 +46,7 @@ namespace JSC {
         }
 
     protected:
-        ErrorPrototype(ExecState*, JSGlobalObject*, Structure*);
+        ErrorPrototype(ExecState*, Structure*);
         void finishCreation(ExecState*, JSGlobalObject*);
 
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ErrorInstance::StructureFlags;
index 50d9b5f..8cf0d2a 100644 (file)
@@ -38,8 +38,14 @@ namespace JSC {
 ASSERT_CLASS_FITS_IN_CELL(FunctionConstructor);
 
 FunctionConstructor::FunctionConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, FunctionPrototype* functionPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, functionPrototype->classInfo()->className))
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, functionPrototype);
+}
+
+void FunctionConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, FunctionPrototype* functionPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, functionPrototype->classInfo()->className));
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, functionPrototype, DontEnum | DontDelete | ReadOnly);
 
     // Number of arguments for constructor
index 9c55d88..e97c53f 100644 (file)
@@ -38,6 +38,7 @@ namespace JSC {
 
     private:
         FunctionConstructor(ExecState*, JSGlobalObject*, Structure*, FunctionPrototype*);
+        void finishCreation(ExecState*, JSGlobalObject*, FunctionPrototype*);
         virtual ConstructType getConstructData(ConstructData&);
         virtual CallType getCallData(CallData&);
     };
index 96cd677..00f8b25 100644 (file)
@@ -38,8 +38,14 @@ static EncodedJSValue JSC_HOST_CALL functionProtoFuncApply(ExecState*);
 static EncodedJSValue JSC_HOST_CALL functionProtoFuncCall(ExecState*);
 
 FunctionPrototype::FunctionPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
-    : InternalFunction(&exec->globalData(), globalObject, structure, exec->propertyNames().nullIdentifier)
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, exec->propertyNames().nullIdentifier);
+}
+
+void FunctionPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name)
+{
+    Base::finishCreation(exec->globalData(), globalObject, name);
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
 }
 
index e70182f..9726c98 100644 (file)
@@ -41,6 +41,9 @@ namespace JSC {
             return Structure::create(globalData, globalObject, proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
         }
 
+    protected:
+        void finishCreation(ExecState*, JSGlobalObject*, const Identifier& name);
+
     private:
         FunctionPrototype(ExecState*, JSGlobalObject*, Structure*);
         virtual CallType getCallData(CallData&);
index 07c0f7f..5e76461 100644 (file)
@@ -41,10 +41,9 @@ InternalFunction::InternalFunction(VPtrStealingHackType)
 {
 }
 
-InternalFunction::InternalFunction(JSGlobalData* globalData, JSGlobalObject* globalObject, Structure* structure, const Identifier& name)
+InternalFunction::InternalFunction(JSGlobalObject* globalObject, Structure* structure)
     : JSObjectWithGlobalObject(globalObject, structure)
 {
-    finishCreation(*globalData, globalObject, name);
 }
 
 void InternalFunction::finishCreation(JSGlobalData& globalData, JSGlobalObject* globalObject, const Identifier& name)
index 7461e66..3315640 100644 (file)
@@ -52,7 +52,7 @@ namespace JSC {
         // Only used to allow us to determine the JSFunction vptr
         InternalFunction(VPtrStealingHackType);
 
-        InternalFunction(JSGlobalData*, JSGlobalObject*, Structure*, const Identifier&);
+        InternalFunction(JSGlobalObject*, Structure*);
 
         void finishCreation(JSGlobalData&, JSGlobalObject*, const Identifier& name);
 
index 5c99d7a..dbc967e 100644 (file)
@@ -46,7 +46,6 @@ JSActivation::JSActivation(CallFrame* callFrame, FunctionExecutable* functionExe
     , m_requiresDynamicChecks(functionExecutable->usesEval())
     , m_argumentsRegister(functionExecutable->generatedBytecode().argumentsRegister())
 {
-    finishCreation(callFrame);
 }
 
 void JSActivation::finishCreation(CallFrame* callFrame)
index 7e8fd98..701e218 100644 (file)
@@ -48,7 +48,9 @@ namespace JSC {
 
         static JSActivation* create(JSGlobalData& globalData, CallFrame* callFrame, FunctionExecutable* funcExec)
         {
-            return new (allocateCell<JSActivation>(globalData.heap)) JSActivation(callFrame, funcExec);
+            JSActivation* activation = new (allocateCell<JSActivation>(globalData.heap)) JSActivation(callFrame, funcExec);
+            activation->finishCreation(callFrame);
+            return activation;
         }
 
         virtual ~JSActivation();
index 330187e..d0a802e 100644 (file)
@@ -146,7 +146,9 @@ namespace JSC {
 
         static JSGlobalObject* create(JSGlobalData& globalData, Structure* structure)
         {
-            return new (allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);
+            JSGlobalObject* globalObject = new (allocateCell<JSGlobalObject>(globalData.heap)) JSGlobalObject(globalData, structure);
+            globalObject->finishCreation(globalData, globalObject);
+            return globalObject;
         }
 
         static JS_EXPORTDATA const ClassInfo s_info;
@@ -159,17 +161,6 @@ namespace JSC {
             , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
             , m_evalEnabled(true)
         {
-            finishCreation(globalData, this);
-        }
-
-        JSGlobalObject(JSGlobalData& globalData, Structure* structure, JSObject* thisValue)
-            : JSVariableObject(globalData, structure, &m_symbolTable, 0)
-            , m_registerArraySize(0)
-            , m_globalScopeChain()
-            , m_weakRandom(static_cast<unsigned>(randomNumber() * (std::numeric_limits<unsigned>::max() + 1.0)))
-            , m_evalEnabled(true)
-        {
-            finishCreation(globalData, thisValue);
         }
 
         void finishCreation(JSGlobalData& globalData, JSObject* thisValue)
index 173152b..1121468 100644 (file)
@@ -56,7 +56,6 @@ namespace JSC {
 JSONObject::JSONObject(JSGlobalObject* globalObject, Structure* structure)
     : JSObjectWithGlobalObject(globalObject, structure)
 {
-    finishCreation(globalObject);
 }
 
 void JSONObject::finishCreation(JSGlobalObject* globalObject)
index c355169..e69c3bc 100644 (file)
@@ -38,7 +38,9 @@ namespace JSC {
 
         static JSONObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
         {
-            return new (allocateCell<JSONObject>(*exec->heap())) JSONObject(globalObject, structure);
+            JSONObject* object = new (allocateCell<JSONObject>(*exec->heap())) JSONObject(globalObject, structure);
+            object->finishCreation(globalObject);
+            return object;
         }
         
         static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
index 6cf3575..2256386 100644 (file)
@@ -36,7 +36,9 @@ namespace JSC{
 
         static JSStaticScopeObject* create(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
         {
-            return new (allocateCell<JSStaticScopeObject>(*exec->heap())) JSStaticScopeObject(exec, identifier, value, attributes);
+            JSStaticScopeObject* scopeObject = new (allocateCell<JSStaticScopeObject>(*exec->heap())) JSStaticScopeObject(exec);
+            scopeObject->finishCreation(exec, identifier, value, attributes);
+            return scopeObject;
         }
 
         virtual void visitChildren(SlotVisitor&);
@@ -59,10 +61,9 @@ namespace JSC{
         static const unsigned StructureFlags = IsEnvironmentRecord | OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSVariableObject::StructureFlags;
 
     private:
-        JSStaticScopeObject(ExecState* exec, const Identifier& identifier, JSValue value, unsigned attributes)
+        JSStaticScopeObject(ExecState* exec)
             : JSVariableObject(exec->globalData(), exec->globalData().staticScopeStructure.get(), &m_symbolTable, reinterpret_cast<Register*>(&m_registerStore + 1))
         {
-            finishCreation(exec, identifier, value, attributes);
         }
         
         SymbolTable m_symbolTable;
index bd355f7..47db1ff 100644 (file)
@@ -298,7 +298,9 @@ UString JSString::toString(ExecState* exec) const
 
 inline StringObject* StringObject::create(ExecState* exec, JSGlobalObject* globalObject, JSString* string)
 {
-    return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure(), string);
+    StringObject* object = new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), globalObject->stringObjectStructure());
+    object->finishCreation(exec->globalData(), string);
+    return object;
 }
 
 JSObject* JSString::toObject(ExecState* exec, JSGlobalObject* globalObject) const
index 5ec56a3..a4e7596 100644 (file)
@@ -84,10 +84,9 @@ const ClassInfo MathObject::s_info = { "Math", &JSObjectWithGlobalObject::s_info
 @end
 */
 
-MathObject::MathObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
+MathObject::MathObject(JSGlobalObject* globalObject, Structure* structure)
     : JSObjectWithGlobalObject(globalObject, structure)
 {
-    finishCreation(exec, globalObject);
 }
 
 void MathObject::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
index e410a6e..78b62b3 100644 (file)
@@ -27,14 +27,16 @@ namespace JSC {
 
     class MathObject : public JSObjectWithGlobalObject {
     private:
-        MathObject(ExecState*, JSGlobalObject*, Structure*);
+        MathObject(JSGlobalObject*, Structure*);
 
     public:
         typedef JSObjectWithGlobalObject Base;
 
         static MathObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
         {
-            return new (allocateCell<MathObject>(*exec->heap())) MathObject(exec, globalObject, structure);
+            MathObject* object = new (allocateCell<MathObject>(*exec->heap())) MathObject(globalObject, structure);
+            object->finishCreation(exec, globalObject);
+            return object;
         }
         virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
         virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
index 8c66f7e..537a457 100644 (file)
@@ -33,9 +33,9 @@ ASSERT_CLASS_FITS_IN_CELL(NativeErrorConstructor);
 const ClassInfo NativeErrorConstructor::s_info = { "Function", &InternalFunction::s_info, 0, 0 };
 
 NativeErrorConstructor::NativeErrorConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& name)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, name))
+    : InternalFunction(globalObject, structure)
 {
-    constructorBody(exec, globalObject, prototypeStructure, name);
+    finishCreation(exec, globalObject, prototypeStructure, name);
 }
 
 void NativeErrorConstructor::visitChildren(SlotVisitor& visitor)
index a39d814..1d4942d 100644 (file)
@@ -49,8 +49,9 @@ namespace JSC {
         Structure* errorStructure() { return m_errorStructure.get(); }
 
     protected:
-        void constructorBody(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name)
+        void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name)
         {
+            Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, name));
             ASSERT(inherits(&s_info));
 
             NativeErrorPrototype* prototype = NativeErrorPrototype::create(exec, globalObject, prototypeStructure, name, this);
index e5fe7cc..8a1530b 100644 (file)
@@ -30,16 +30,17 @@ namespace JSC {
 
 ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype);
 
-NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& name, NativeErrorConstructor* constructor)
-    : ErrorPrototype(exec, globalObject, structure)
+NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+    : ErrorPrototype(exec, structure)
 {
-    constructorBody(exec, name, constructor);
+    finishCreation(exec, globalObject, nameAndMessage, constructor);
 }
 
-inline void NativeErrorPrototype::constructorBody(ExecState* exec, const UString& name, NativeErrorConstructor* constructor)
+inline void NativeErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, const UString& nameAndMessage, NativeErrorConstructor* constructor)
 {
-    putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, name), DontEnum);
-    putDirect(exec->globalData(), exec->propertyNames().message, jsEmptyString(exec), DontEnum);
+    Base::finishCreation(exec, globalObject);
+    putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), DontEnum);
+    putDirect(exec->globalData(), exec->propertyNames().message, jsString(exec, nameAndMessage), DontEnum);
     putDirect(exec->globalData(), exec->propertyNames().constructor, constructor, DontEnum);
 }
 
index 33492bd..d894ab4 100644 (file)
@@ -39,7 +39,7 @@ namespace JSC {
         }
 
     protected:
-        void constructorBody(ExecState*, const UString& name, NativeErrorConstructor*);
+        void finishCreation(ExecState*, JSGlobalObject*, const UString& nameAndMessage, NativeErrorConstructor*);
     };
 
 } // namespace JSC
index 4b7f683..dde6424 100644 (file)
@@ -55,8 +55,14 @@ const ClassInfo NumberConstructor::s_info = { "Function", &InternalFunction::s_i
 */
 
 NumberConstructor::NumberConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, NumberPrototype* numberPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, numberPrototype->s_info.className))
+    : InternalFunction(globalObject, structure) 
 {
+    finishCreation(exec, globalObject, numberPrototype);
+}
+
+void NumberConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, NumberPrototype* numberPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, numberPrototype->s_info.className));
     ASSERT(inherits(&s_info));
 
     // Number.Prototype
index 75d337a..91e50f2 100644 (file)
@@ -50,6 +50,7 @@ namespace JSC {
         enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue };
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, NumberPrototype*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
 
     private:
index 22676d0..cfbc23c 100644 (file)
@@ -34,7 +34,6 @@ const ClassInfo NumberObject::s_info = { "Number", &JSWrapperObject::s_info, 0,
 NumberObject::NumberObject(JSGlobalData& globalData, Structure* structure)
     : JSWrapperObject(globalData, structure)
 {
-    finishCreation(globalData);
 }
 
 void NumberObject::finishCreation(JSGlobalData& globalData)
index 9a05113..e6cd4cf 100644 (file)
@@ -35,7 +35,9 @@ namespace JSC {
 
         static NumberObject* create(JSGlobalData& globalData, Structure* structure)
         {
-            return new (allocateCell<NumberObject>(globalData.heap)) NumberObject(globalData, structure);
+            NumberObject* number = new (allocateCell<NumberObject>(globalData.heap)) NumberObject(globalData, structure);
+            number->finishCreation(globalData);
+            return number;
         }
 
         static const ClassInfo s_info;
index d744162..5c4d83d 100644 (file)
@@ -69,6 +69,12 @@ ASSERT_CLASS_FITS_IN_CELL(NumberPrototype);
 NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure)
     : NumberObject(exec->globalData(), structure)
 {
+    finishCreation(exec, globalObject);
+}
+
+void NumberPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject)
+{
+    Base::finishCreation(exec->globalData());
     setInternalValue(exec->globalData(), jsNumber(0));
 
     ASSERT(inherits(&s_info));
index 3eade6c..225b515 100644 (file)
@@ -42,6 +42,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | NumberObject::StructureFlags;
         static const unsigned AnonymousSlotCount = NumberObject::AnonymousSlotCount + 1;
 
index c325fa0..d47430e 100644 (file)
@@ -76,8 +76,14 @@ const ClassInfo ObjectConstructor::s_info = { "Function", &InternalFunction::s_i
 */
 
 ObjectConstructor::ObjectConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, ObjectPrototype* objectPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "Object"))
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, objectPrototype);
+}
+
+void ObjectConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, ObjectPrototype* objectPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, "Object"));
     // ECMA 15.2.3.1
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, objectPrototype, DontEnum | DontDelete | ReadOnly);
     // no. of arguments for constructor
index 383f402..9fc7a06 100644 (file)
@@ -47,6 +47,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, ObjectPrototype*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
index c8a133b..8259b6e 100644 (file)
@@ -96,9 +96,15 @@ const ClassInfo RegExpConstructor::s_info = { "Function", &InternalFunction::s_i
 */
 
 RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExpPrototype* regExpPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, "RegExp"))
+    : InternalFunction(globalObject, structure)
     , d(adoptPtr(new RegExpConstructorPrivate))
 {
+    finishCreation(exec, globalObject, regExpPrototype);
+}
+
+void RegExpConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, RegExpPrototype* regExpPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, "RegExp"));
     ASSERT(inherits(&s_info));
 
     // ECMA 15.10.5.1 RegExp.prototype
@@ -108,10 +114,9 @@ RegExpConstructor::RegExpConstructor(ExecState* exec, JSGlobalObject* globalObje
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
 }
 
-RegExpMatchesArray::RegExpMatchesArray(ExecState* exec, RegExpConstructorPrivate* data)
+RegExpMatchesArray::RegExpMatchesArray(ExecState* exec)
     : JSArray(exec->globalData(), exec->lexicalGlobalObject()->regExpMatchesArrayStructure())
 {
-    finishCreation(exec->globalData(), data);
 }
 
 void RegExpMatchesArray::finishCreation(JSGlobalData& globalData, RegExpConstructorPrivate* data)
index c02d06d..02f64c5 100644 (file)
@@ -90,6 +90,7 @@ namespace JSC {
         JSValue getRightContext(ExecState*) const;
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, RegExpPrototype*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | InternalFunction::StructureFlags;
 
     private:
index 87d59c7..ad94e07 100644 (file)
@@ -26,14 +26,16 @@ namespace JSC {
 
     class RegExpMatchesArray : public JSArray {
     private:
-        RegExpMatchesArray(ExecState*, RegExpConstructorPrivate*);
+        RegExpMatchesArray(ExecState*);
 
     public:
         typedef JSArray Base;
 
         static RegExpMatchesArray* create(ExecState* exec, RegExpConstructorPrivate* ctorPrivate)
         {
-            return new (allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec, ctorPrivate);
+            RegExpMatchesArray* regExp = new (allocateCell<RegExpMatchesArray>(*exec->heap())) RegExpMatchesArray(exec);
+            regExp->finishCreation(exec->globalData(), ctorPrivate);
+            return regExp;
         }
         virtual ~RegExpMatchesArray();
 
index 841d939..aaa3ee0 100644 (file)
@@ -66,7 +66,6 @@ RegExpObject::RegExpObject(JSGlobalObject* globalObject, Structure* structure, R
     : JSObjectWithGlobalObject(globalObject, structure)
     , d(adoptPtr(new RegExpObjectData(globalObject->globalData(), this, regExp)))
 {
-    finishCreation(globalObject);
 }
 
 void RegExpObject::finishCreation(JSGlobalObject* globalObject)
index e131fc5..03456db 100644 (file)
@@ -32,12 +32,16 @@ namespace JSC {
 
         static RegExpObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp)
         {
-            return new (allocateCell<RegExpObject>(*exec->heap())) RegExpObject(globalObject, structure, regExp);
+            RegExpObject* object = new (allocateCell<RegExpObject>(*exec->heap())) RegExpObject(globalObject, structure, regExp);
+            object->finishCreation(globalObject);
+            return object;
         }
         
         static RegExpObject* create(JSGlobalData& globalData, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp)
         {
-            return new (allocateCell<RegExpObject>(globalData.heap)) RegExpObject(globalObject, structure, regExp);
+            RegExpObject* object = new (allocateCell<RegExpObject>(globalData.heap)) RegExpObject(globalObject, structure, regExp);
+            object->finishCreation(globalObject);
+            return object;
         }
 
         virtual ~RegExpObject();
index 8bfc99f..91b8869 100644 (file)
@@ -65,6 +65,7 @@ ASSERT_CLASS_FITS_IN_CELL(RegExpPrototype);
 RegExpPrototype::RegExpPrototype(ExecState*, JSGlobalObject* globalObject, Structure* structure, RegExp* regExp)
     : RegExpObject(globalObject, structure, regExp)
 {
+    finishCreation(globalObject);
 }
 
 bool RegExpPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot &slot)
index 1d3b1c7..af9abf5 100644 (file)
@@ -48,8 +48,14 @@ const ClassInfo StringConstructor::s_info = { "Function", &InternalFunction::s_i
 ASSERT_CLASS_FITS_IN_CELL(StringConstructor);
 
 StringConstructor::StringConstructor(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, StringPrototype* stringPrototype)
-    : InternalFunction(&exec->globalData(), globalObject, structure, Identifier(exec, stringPrototype->classInfo()->className))
+    : InternalFunction(globalObject, structure)
 {
+    finishCreation(exec, globalObject, stringPrototype);
+}
+
+void StringConstructor::finishCreation(ExecState* exec, JSGlobalObject* globalObject, StringPrototype* stringPrototype)
+{
+    Base::finishCreation(exec->globalData(), globalObject, Identifier(exec, stringPrototype->classInfo()->className));
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().prototype, stringPrototype, ReadOnly | DontEnum | DontDelete);
     putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
 }
index a944e55..6dcd83d 100644 (file)
@@ -44,6 +44,7 @@ namespace JSC {
         }
 
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, StringPrototype*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
     private:
index b8fad9e..f6d69d1 100644 (file)
@@ -29,10 +29,9 @@ ASSERT_CLASS_FITS_IN_CELL(StringObject);
 
 const ClassInfo StringObject::s_info = { "String", &JSWrapperObject::s_info, 0, 0 };
 
-StringObject::StringObject(JSGlobalData& globalData, Structure* structure, JSString* string)
+StringObject::StringObject(JSGlobalData& globalData, Structure* structure)
     : JSWrapperObject(globalData, structure)
 {
-    finishCreation(globalData, string);
 }
 
 void StringObject::finishCreation(JSGlobalData& globalData, JSString* string)
index a777220..18afe72 100644 (file)
@@ -33,12 +33,16 @@ namespace JSC {
         static StringObject* create(ExecState* exec, Structure* structure)
         {
             JSString* string = jsEmptyString(exec);
-            return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure, string);  
+            StringObject* object = new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure);  
+            object->finishCreation(exec->globalData(), string);
+            return object;
         }
         static StringObject* create(ExecState* exec, Structure* structure, const UString& str)
         {
             JSString* string = jsString(exec, str);
-            return new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure, string);
+            StringObject* object = new (allocateCell<StringObject>(*exec->heap())) StringObject(exec->globalData(), structure);
+            object->finishCreation(exec->globalData(), string);
+            return object;
         }
         static StringObject* create(ExecState*, JSGlobalObject*, JSString*);
 
@@ -62,7 +66,7 @@ namespace JSC {
     protected:
         void finishCreation(JSGlobalData&, JSString*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
-        StringObject(JSGlobalData&, Structure*, JSString*);
+        StringObject(JSGlobalData&, Structure*);
     };
 
     StringObject* asStringObject(JSValue);
index a04464a..e21f9a1 100644 (file)
@@ -41,8 +41,9 @@ namespace JSC {
 
     private:
         StringObjectThatMasqueradesAsUndefined(ExecState* exec, Structure* structure, JSString* string)
-            : StringObject(exec->globalData(), structure, string)
+            : StringObject(exec->globalData(), structure)
         {
+            finishCreation(exec->globalData(), string);
         }
 
         static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto) 
index e14d977..5903909 100644 (file)
@@ -131,9 +131,15 @@ const ClassInfo StringPrototype::s_info = { "String", &StringObject::s_info, 0,
 */
 
 // ECMA 15.5.4
-StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSString* string)
-    : StringObject(exec->globalData(), structure, string)
+StringPrototype::StringPrototype(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSString* nameAndMessage)
+    : StringObject(exec->globalData(), structure)
 {
+    finishCreation(exec, globalObject, nameAndMessage);
+}
+
+void StringPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, JSString* nameAndMessage)
+{
+    Base::finishCreation(exec->globalData(), nameAndMessage);
     ASSERT(inherits(&s_info));
 
     putAnonymousValue(exec->globalData(), 0, globalObject);
index 6a0315f..651f9ac 100644 (file)
@@ -50,6 +50,7 @@ namespace JSC {
         static const ClassInfo s_info;
         
     protected:
+        void finishCreation(ExecState*, JSGlobalObject*, JSString*);
         static const unsigned StructureFlags = OverridesGetOwnPropertySlot | StringObject::StructureFlags;
 
         COMPILE_ASSERT(!StringObject::AnonymousSlotCount, StringPrototype_stomps_on_your_anonymous_slot);
index 2395a19..9d8ceac 100644 (file)
@@ -1,3 +1,25 @@
+2011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Unzip initialization lists and constructors in JSCell hierarchy (5/7)
+        https://bugs.webkit.org/show_bug.cgi?id=67420
+
+        Reviewed by Geoffrey Garen.
+
+        Completed the fifth level of the refactoring to add finishCreation() 
+        methods to all classes within the JSCell hierarchy with non-trivial 
+        constructor bodies.
+
+        This primarily consists of pushing the calls to finishCreation() down 
+        into the constructors of the subclasses of the second level of the hierarchy 
+        as well as pulling the finishCreation() calls out into the class's corresponding
+        create() method if it has one.  Doing both simultaneously allows us to 
+        maintain the invariant that the finishCreation() method chain is called exactly 
+        once during the creation of an object, since calling it any other number of 
+        times (0, 2, or more) will cause an assertion failure.
+
+        * JSRun.cpp:
+        (JSGlueGlobalObject::JSGlueGlobalObject):
+
 2011-09-05  Oliver Hunt  <oliver@apple.com>
 
         An object's structure should reference the global object responsible for its creation
index 8c88f85..bf22cbd 100644 (file)
@@ -38,6 +38,7 @@ JSGlueGlobalObject::JSGlueGlobalObject(JSGlobalData& globalData, Structure* stru
     , m_flags(flags)
     , m_userObjectStructure(globalData, userObjectStructure)
 {
+    finishCreation(globalData, this);
 }
 
 JSRun::JSRun(CFStringRef source, JSFlags inFlags)
index 1d3f683..ebc3062 100644 (file)
@@ -1,3 +1,83 @@
+2011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Unzip initialization lists and constructors in JSCell hierarchy (5/7)
+        https://bugs.webkit.org/show_bug.cgi?id=67420
+
+        Reviewed by Geoffrey Garen.
+
+        No new tests.
+
+        Completed the fifth level of the refactoring to add finishCreation() 
+        methods to all classes within the JSCell hierarchy with non-trivial 
+        constructor bodies.
+
+        This primarily consists of pushing the calls to finishCreation() down 
+        into the constructors of the subclasses of the second level of the hierarchy 
+        as well as pulling the finishCreation() calls out into the class's corresponding
+        create() method if it has one.  Doing both simultaneously allows us to 
+        maintain the invariant that the finishCreation() method chain is called exactly 
+        once during the creation of an object, since calling it any other number of 
+        times (0, 2, or more) will cause an assertion failure.
+
+        * WebCore.exp.in:
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::DOMConstructorObject::DOMConstructorObject):
+        * bindings/js/JSDOMGlobalObject.cpp:
+        (WebCore::JSDOMGlobalObject::JSDOMGlobalObject):
+        (WebCore::JSDOMGlobalObject::finishCreation):
+        * bindings/js/JSDOMGlobalObject.h:
+        * bindings/js/JSDOMWindowShell.cpp:
+        * bindings/js/JSDOMWindowShell.h:
+        (WebCore::JSDOMWindowShell::create):
+        * bindings/js/JSDOMWrapper.h:
+        (WebCore::JSDOMWrapper::JSDOMWrapper):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        (WebCore::JSTestInterface::JSTestInterface):
+        * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+        (WebCore::JSTestMediaQueryListListener::JSTestMediaQueryListListener):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::JSTestObj::JSTestObj):
+        * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
+        (WebCore::JSTestSerializedScriptValueInterface::JSTestSerializedScriptValueInterface):
+        * bridge/c/CRuntimeObject.cpp:
+        (JSC::Bindings::CRuntimeObject::CRuntimeObject):
+        (JSC::Bindings::CRuntimeObject::finishCreation):
+        * bridge/c/CRuntimeObject.h:
+        * bridge/jni/jsc/JavaRuntimeObject.cpp:
+        (JSC::Bindings::JavaRuntimeObject::JavaRuntimeObject):
+        (JSC::Bindings::JavaRuntimeObject::finishCreation):
+        * bridge/jni/jsc/JavaRuntimeObject.h:
+        * bridge/objc/ObjCRuntimeObject.h:
+        * bridge/objc/ObjCRuntimeObject.mm:
+        (JSC::Bindings::ObjCRuntimeObject::ObjCRuntimeObject):
+        (JSC::Bindings::ObjCRuntimeObject::finishCreation):
+        * 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::QtRuntimeObject):
+        * bridge/qt/qt_pixmapruntime.cpp:
+        (JSC::Bindings::QtPixmapRuntimeObject::QtPixmapRuntimeObject):
+        * bridge/qt/qt_runtime.cpp:
+        (JSC::Bindings::QtRuntimeMethod::QtRuntimeMethod):
+        (JSC::Bindings::QtRuntimeMethod::finishCreation):
+        * bridge/qt/qt_runtime.h:
+        * bridge/runtime_array.cpp:
+        (JSC::RuntimeArray::RuntimeArray):
+        * bridge/runtime_array.h:
+        (JSC::RuntimeArray::create):
+        * bridge/runtime_method.cpp:
+        (JSC::RuntimeMethod::RuntimeMethod):
+        (JSC::RuntimeMethod::finishCreation):
+        * bridge/runtime_method.h:
+        * bridge/runtime_object.cpp:
+        (JSC::Bindings::RuntimeObject::RuntimeObject):
+        * bridge/runtime_object.h:
+        (JSC::Bindings::RuntimeObject::create):
+
 2011-09-06  Luke Macpherson   <macpherson@chromium.org>
 
         Implement list style properties in CSSStyleApplyProperty.
index c965b0e..d551e4d 100644 (file)
@@ -1646,6 +1646,7 @@ __ZN3JSC13RuntimeMethodC2EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureERKN
 __ZN3JSC8Bindings10RootObjectD1Ev
 __ZN3JSC8Bindings13RuntimeObject11getCallDataERNS_8CallDataE
 __ZN3JSC8Bindings13RuntimeObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3JSC8Bindings13RuntimeObject14finishCreationEPNS_14JSGlobalObjectE
 __ZN3JSC8Bindings13RuntimeObject16getConstructDataERNS_13ConstructDataE
 __ZN3JSC8Bindings13RuntimeObject18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
 __ZN3JSC8Bindings13RuntimeObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
index 46530c3..01d51f0 100644 (file)
@@ -55,6 +55,7 @@ namespace WebCore {
         DOMConstructorObject(JSC::Structure* structure, JSDOMGlobalObject* globalObject)
             : JSDOMWrapper(structure, globalObject)
         {
+            finishCreation(globalObject->globalData(), globalObject);
         }
     };
 
index 4dafa68..f9eaf6a 100644 (file)
@@ -43,10 +43,16 @@ namespace WebCore {
 const ClassInfo JSDOMGlobalObject::s_info = { "DOMGlobalObject", &JSGlobalObject::s_info, 0, 0 };
 
 JSDOMGlobalObject::JSDOMGlobalObject(JSGlobalData& globalData, Structure* structure, PassRefPtr<DOMWrapperWorld> world, JSObject* thisValue)
-    : JSGlobalObject(globalData, structure, thisValue)
+    : JSGlobalObject(globalData, structure)
     , m_currentEvent(0)
     , m_world(world)
 {
+    finishCreation(globalData, thisValue);
+}
+
+void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData, JSObject* thisValue)
+{
+    Base::finishCreation(globalData, thisValue);
     ASSERT(inherits(&s_info));
 }
 
index e0a6a07..9a838bf 100644 (file)
@@ -47,6 +47,7 @@ namespace WebCore {
         struct JSDOMGlobalObjectData;
 
         JSDOMGlobalObject(JSC::JSGlobalData&, JSC::Structure*, PassRefPtr<DOMWrapperWorld>, JSC::JSObject* thisValue);
+        void finishCreation(JSC::JSGlobalData&, JSC::JSObject* thisValue);
 
     public:
         JSDOMStructureMap& structures() { return m_structures; }
index 49e1b4a..d3169b6 100644 (file)
@@ -181,13 +181,6 @@ void* JSDOMWindowShell::operator new(size_t size)
     return heap.allocate(size);
 }
 
-JSDOMWindowShell* JSDOMWindowShell::create(PassRefPtr<DOMWindow> window, JSC::Structure* structure, DOMWrapperWorld* world)
-{
-    JSDOMWindowShell* shell = new JSDOMWindowShell(structure, world);
-    shell->finishCreation(*world->globalData(), window);
-    return shell; 
-}
-
 // ----
 // Conversion methods
 // ----
index 534ea2a..87d026d 100644 (file)
@@ -55,7 +55,12 @@ namespace WebCore {
 
         DOMWindow* impl() const;
 
-        static JSDOMWindowShell* create(PassRefPtr<DOMWindow>, JSC::Structure*, DOMWrapperWorld*);
+        static JSDOMWindowShell* create(PassRefPtr<DOMWindow> window, JSC::Structure* structure, DOMWrapperWorld* world) 
+        {
+            JSDOMWindowShell* shell = new JSDOMWindowShell(structure, world);
+            shell->finishCreation(*world->globalData(), window);
+            return shell; 
+        }
 
         static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype) 
         {
index 8f2c08e..036ccbd 100644 (file)
@@ -59,7 +59,6 @@ protected:
         // new JavaScript objects on detached windows due to DOMWindow::document()
         // needing to reach through the frame to get to the Document*.  See bug 27640.
         // ASSERT(globalObject->scriptExecutionContext());
-        finishCreation(globalObject->globalData(), globalObject);
     }
 };
 
index 7a11a01..8f2cfd8 100644 (file)
@@ -1514,20 +1514,24 @@ sub GenerateImplementation
         AddIncludesForTypeInImpl("JSDOMWindowShell");
         push(@implContent, "${className}::$className(JSGlobalData& globalData, Structure* structure, PassRefPtr<$implType> impl, JSDOMWindowShell* shell)\n");
         push(@implContent, "    : $parentClassName(globalData, structure, impl, shell)\n");
+        push(@implContent, "{\n");
     } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) {
         AddIncludesForTypeInImpl($interfaceName);
         push(@implContent, "${className}::$className(JSGlobalData& globalData, Structure* structure, PassRefPtr<$implType> impl)\n");
         push(@implContent, "    : $parentClassName(globalData, structure, impl)\n");
+        push(@implContent, "{\n");
     } else {
         push(@implContent, "${className}::$className(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<$implType> impl)\n");
         if ($hasParent) {
             push(@implContent, "    : $parentClassName(structure, globalObject, impl)\n");
+            push(@implContent, "{\n");
         } else {
             push(@implContent, "    : $parentClassName(structure, globalObject)\n");
             push(@implContent, "    , m_impl(impl)\n");
+            push(@implContent, "{\n");
+            push(@implContent, "    finishCreation(globalObject->globalData(), globalObject);\n");
         }
     }
-    push(@implContent, "{\n");
     push(@implContent, "    ASSERT(inherits(&s_info));\n");
     if ($numCachedAttributes > 0) {
         push(@implContent, "    for (unsigned i = Base::AnonymousSlotCount; i < AnonymousSlotCount; i++)\n");
index a0de23f..f9bbd0b 100644 (file)
@@ -146,6 +146,7 @@ JSTestInterface::JSTestInterface(Structure* structure, JSDOMGlobalObject* global
     : JSDOMWrapper(structure, globalObject)
     , m_impl(impl)
 {
+    finishCreation(globalObject->globalData(), globalObject);
     ASSERT(inherits(&s_info));
 }
 
index 2c1e72b..059601a 100644 (file)
@@ -142,6 +142,7 @@ JSTestMediaQueryListListener::JSTestMediaQueryListListener(Structure* structure,
     : JSDOMWrapper(structure, globalObject)
     , m_impl(impl)
 {
+    finishCreation(globalObject->globalData(), globalObject);
     ASSERT(inherits(&s_info));
 }
 
index 0db3d88..d3256b7 100644 (file)
@@ -297,6 +297,7 @@ JSTestObj::JSTestObj(Structure* structure, JSDOMGlobalObject* globalObject, Pass
     : JSDOMWrapper(structure, globalObject)
     , m_impl(impl)
 {
+    finishCreation(globalObject->globalData(), globalObject);
     ASSERT(inherits(&s_info));
 }
 
index 77f9bdd..4e58f24 100644 (file)
@@ -132,6 +132,7 @@ JSTestSerializedScriptValueInterface::JSTestSerializedScriptValueInterface(Struc
     : JSDOMWrapper(structure, globalObject)
     , m_impl(impl)
 {
+    finishCreation(globalObject->globalData(), globalObject);
     ASSERT(inherits(&s_info));
 }
 
index c63e586..b460a91 100644 (file)
@@ -40,6 +40,12 @@ const ClassInfo CRuntimeObject::s_info = { "CRuntimeObject", &RuntimeObject::s_i
 CRuntimeObject::CRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<CInstance> instance)
     : RuntimeObject(exec, globalObject, structure, instance)
 {
+    finishCreation(globalObject);
+}
+
+void CRuntimeObject::finishCreation(JSGlobalObject* globalObject)
+{
+    Base::finishCreation(globalObject);
     ASSERT(inherits(&s_info));
 }
 
index 6fe7dfa..ef19c8a 100644 (file)
@@ -61,6 +61,7 @@ public:
 
 private:
     CRuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<CInstance>);
+    void finishCreation(JSGlobalObject*);
 };
 
 }
index fffe856..d684ab0 100644 (file)
@@ -38,6 +38,12 @@ const ClassInfo JavaRuntimeObject::s_info = { "JavaRuntimeObject", &RuntimeObjec
 JavaRuntimeObject::JavaRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<JavaInstance> instance)
     : RuntimeObject(exec, globalObject, structure, instance)
 {
+    finishCreation(globalObject);
+}
+
+void JavaRuntimeObject::finishCreation(JSGlobalObject* globalObject)
+{
+    Base::finishCreation(globalObject);
     ASSERT(inherits(&s_info));
 }
 
index 70a3ce9..bb17938 100644 (file)
@@ -59,6 +59,7 @@ public:
 
 private:
     JavaRuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<JavaInstance>);
+    void finishCreation(JSGlobalObject*);
 };
 
 }
index bfa1f91..0340c05 100644 (file)
@@ -58,6 +58,7 @@ public:
 
 private:
     ObjCRuntimeObject(ExecState*, JSGlobalObject*, PassRefPtr<ObjcInstance>, Structure*);
+    void finishCreation(JSGlobalObject*);
 };
 
 }
index ea86263..c51bd4d 100644 (file)
@@ -38,6 +38,12 @@ const ClassInfo ObjCRuntimeObject::s_info = { "ObjCRuntimeObject", &RuntimeObjec
 ObjCRuntimeObject::ObjCRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, PassRefPtr<ObjcInstance> instance, Structure* structure)
     : RuntimeObject(exec, globalObject, structure, instance)
 {
+    finishCreation(globalObject);
+}
+
+void ObjCRuntimeObject::finishCreation(JSGlobalObject* globalObject)
+{
+    Base::finishCreation(globalObject);
     ASSERT(inherits(&s_info));
 }
 
index a5a6725..e571a55 100644 (file)
@@ -99,7 +99,9 @@ public:
     {
         // 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);
+        ObjcFallbackObjectImp* fallbackObject = new (allocateCell<ObjcFallbackObjectImp>(*exec->heap())) ObjcFallbackObjectImp(globalObject, domStructure, instance, propertyName);
+        fallbackObject->finishCreation(globalObject);
+        return fallbackObject;
     }
 
     static const ClassInfo s_info;
index df0e71c..ace2ba7 100644 (file)
@@ -201,7 +201,6 @@ ObjcFallbackObjectImp::ObjcFallbackObjectImp(JSGlobalObject* globalObject, Struc
     , _instance(i)
     , _item(propertyName)
 {
-    finishCreation(globalObject);
 }
 
 void ObjcFallbackObjectImp::finishCreation(JSGlobalObject* globalObject)
index 9899160..fc1a346 100644 (file)
@@ -85,6 +85,7 @@ const ClassInfo QtRuntimeObject::s_info = { "QtRuntimeObject", &RuntimeObject::s
 QtRuntimeObject::QtRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance)
     : RuntimeObject(exec, globalObject, structure, instance)
 {
+    finishCreation(globalObject);
 }
 
 // QtInstance
index 879ac7d..68741b4 100644 (file)
@@ -224,6 +224,7 @@ private:
 QtPixmapRuntimeObject::QtPixmapRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance)
     : RuntimeObject(exec, globalObject, structure, instance)
 {
+    finishCreation(globalObject);
 }
 
 const ClassInfo QtPixmapRuntimeObject::s_info = { "QtPixmapRuntimeObject", &RuntimeObject::s_info, 0, 0 };
index d665b61..53e301f 100644 (file)
@@ -1006,12 +1006,18 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con
 
 const ClassInfo QtRuntimeMethod::s_info = { "QtRuntimeMethod", &InternalFunction::s_info, 0, 0 };
 
-QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, Structure* structure, const Identifier& ident, PassRefPtr<QtInstance> inst)
-    : InternalFunction(&exec->globalData(), exec->lexicalGlobalObject(), structure, ident)
+QtRuntimeMethod::QtRuntimeMethod(QtRuntimeMethodData* dd, ExecState* exec, Structure* structure, const Identifier& identifier, PassRefPtr<QtInstance> instance)
+    : InternalFunction(exec->lexicalGlobalObject(), structure)
     , d_ptr(dd)
 {
+    finishCreation(exec, identifier, instance);
+}
+
+void QtRuntimeMethod::finishCreation(ExecState* exec, const Identifier& identifier, PassRefPtr<QtInstance> instance)
+{
+    Base::finishCreation(exec->globalData(), exec->lexicalGlobalObject(), identifier);
     QW_D(QtRuntimeMethod);
-    d->m_instance = inst;
+    d->m_instance = instance;
     d->m_finalizer.set(exec->globalData(), this, d);
 }
 
index dea67d3..8b6f034 100644 (file)
@@ -144,6 +144,7 @@ public:
     }
 
 protected:
+    void finishCreation(ExecState*, const Identifier&, PassRefPtr<QtInstance>);
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | InternalFunction::StructureFlags | OverridesVisitChildren;
 
     QtRuntimeMethodData *d_func() const {return d_ptr;}
index e01a15f..8a037f9 100644 (file)
@@ -37,10 +37,9 @@ namespace JSC {
 
 const ClassInfo RuntimeArray::s_info = { "RuntimeArray", &JSArray::s_info, 0, 0 };
 
-RuntimeArray::RuntimeArray(ExecState* exec, Structure* structure, Bindings::Array* array)
+RuntimeArray::RuntimeArray(ExecState* exec, Structure* structure)
     : JSArray(exec->globalData(), structure)
 {
-    finishCreation(exec->globalData(), array);
 }
 
 void RuntimeArray::finishCreation(JSGlobalData& globalData, Bindings::Array* array)
index 1021e7d..6cb8eb3 100644 (file)
@@ -41,7 +41,9 @@ public:
         // FIXME: deprecatedGetDOMStructure uses the prototype off of the wrong global object
         // We need to pass in the right global object for "array".
         Structure* domStructure = WebCore::deprecatedGetDOMStructure<RuntimeArray>(exec);
-        return new (allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, domStructure, array);
+        RuntimeArray* runtimeArray = new (allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, domStructure);
+        runtimeArray->finishCreation(exec->globalData(), array);
+        return runtimeArray;
     }
 
     typedef Bindings::Array BindingsArray;
@@ -79,7 +81,7 @@ protected:
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSArray::StructureFlags;
 
 private:
-    RuntimeArray(ExecState*, Structure*, Bindings::Array*);
+    RuntimeArray(ExecState*, Structure*);
     static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
     static JSValue indexGetter(ExecState*, JSValue, unsigned);
 };
index 28fbd3f..d14f54f 100644 (file)
@@ -45,9 +45,15 @@ const ClassInfo RuntimeMethod::s_info = { "RuntimeMethod", &InternalFunction::s_
 
 RuntimeMethod::RuntimeMethod(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const Identifier& ident, Bindings::MethodList& m)
     // Callers will need to pass in the right global object corresponding to this native object "m".
-    : InternalFunction(&exec->globalData(), globalObject, structure, ident)
+    : InternalFunction(globalObject, structure)
     , _methodList(adoptPtr(new MethodList(m)))
 {
+    finishCreation(exec->globalData(), globalObject, ident);
+}
+
+void RuntimeMethod::finishCreation(JSGlobalData& globalData, JSGlobalObject* globalObject, const Identifier& ident)
+{
+    Base::finishCreation(globalData, globalObject, ident);
     ASSERT(inherits(&s_info));
 }
 
index cf82073..b44e796 100644 (file)
@@ -58,6 +58,7 @@ public:
 
 protected:
     RuntimeMethod(ExecState*, JSGlobalObject*, Structure*, const Identifier& name, Bindings::MethodList&);
+    void finishCreation(JSGlobalData&, JSGlobalObject*, const Identifier&);
     static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InternalFunction::StructureFlags;
 
 private:
index 96640f0..9bfe467 100644 (file)
@@ -41,7 +41,6 @@ RuntimeObject::RuntimeObject(ExecState*, JSGlobalObject* globalObject, Structure
     : JSObjectWithGlobalObject(globalObject, structure)
     , m_instance(instance)
 {
-    finishCreation(globalObject);
 }
 
 void RuntimeObject::finishCreation(JSGlobalObject* globalObject)
index d8e00fc..620d90c 100644 (file)
@@ -39,7 +39,9 @@ public:
 
     static RuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance)
     {
-        return new (allocateCell<RuntimeObject>(*exec->heap())) RuntimeObject(exec, globalObject, structure, instance);
+        RuntimeObject* object = new (allocateCell<RuntimeObject>(*exec->heap())) RuntimeObject(exec, globalObject, structure, instance);
+        object->finishCreation(globalObject);
+        return object;
     }
 
     virtual ~RuntimeObject();
index 4dab740..052c6eb 100644 (file)
@@ -1,3 +1,27 @@
+2011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Unzip initialization lists and constructors in JSCell hierarchy (5/7)
+        https://bugs.webkit.org/show_bug.cgi?id=67420
+
+        Reviewed by Geoffrey Garen.
+
+        Completed the fifth level of the refactoring to add finishCreation() 
+        methods to all classes within the JSCell hierarchy with non-trivial 
+        constructor bodies.
+
+        This primarily consists of pushing the calls to finishCreation() down 
+        into the constructors of the subclasses of the second level of the hierarchy 
+        as well as pulling the finishCreation() calls out into the class's corresponding
+        create() method if it has one.  Doing both simultaneously allows us to 
+        maintain the invariant that the finishCreation() method chain is called exactly 
+        once during the creation of an object, since calling it any other number of 
+        times (0, 2, or more) will cause an assertion failure.
+
+        * Plugins/Hosted/ProxyRuntimeObject.h:
+        * Plugins/Hosted/ProxyRuntimeObject.mm:
+        (WebKit::ProxyRuntimeObject::ProxyRuntimeObject):
+        (WebKit::ProxyRuntimeObject::finishCreation):
+
 2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
 
         Rename confirmCompositionWithoutDisturbingSelection to cancelComposition
index 313715a..5ae9838 100644 (file)
@@ -59,6 +59,7 @@ public:
     static const JSC::ClassInfo s_info;
 private:
     ProxyRuntimeObject(JSC::ExecState*, JSC::JSGlobalObject*, JSC::Structure*, PassRefPtr<ProxyInstance>);
+    void finishCreation(JSC::JSGlobalObject*);
 };
 
 }
index 8a6481e..5cb2749 100644 (file)
@@ -39,6 +39,12 @@ const ClassInfo ProxyRuntimeObject::s_info = { "ProxyRuntimeObject", &RuntimeObj
 ProxyRuntimeObject::ProxyRuntimeObject(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<ProxyInstance> instance)
     : RuntimeObject(exec, globalObject, structure, instance)
 {
+    finishCreation(globalObject);
+}
+
+void ProxyRuntimeObject::finishCreation(JSGlobalObject* globalObject)
+{
+    Base::finishCreation(globalObject);
     ASSERT(inherits(&s_info));
 }
 
index 3b5ff6f..45e1594 100644 (file)
@@ -1,3 +1,32 @@
+2011-09-06  Mark Hahnenberg  <mhahnenberg@apple.com>
+
+        Unzip initialization lists and constructors in JSCell hierarchy (5/7)
+        https://bugs.webkit.org/show_bug.cgi?id=67420
+
+        Reviewed by Geoffrey Garen.
+
+        Completed the fifth level of the refactoring to add finishCreation() 
+        methods to all classes within the JSCell hierarchy with non-trivial 
+        constructor bodies.
+
+        This primarily consists of pushing the calls to finishCreation() down 
+        into the constructors of the subclasses of the second level of the hierarchy 
+        as well as pulling the finishCreation() calls out into the class's corresponding
+        create() method if it has one.  Doing both simultaneously allows us to 
+        maintain the invariant that the finishCreation() method chain is called exactly 
+        once during the creation of an object, since calling it any other number of 
+        times (0, 2, or more) will cause an assertion failure.
+
+        * WebProcess/Plugins/Netscape/JSNPMethod.cpp:
+        (WebKit::JSNPMethod::JSNPMethod):
+        (WebKit::JSNPMethod::finishCreation):
+        * WebProcess/Plugins/Netscape/JSNPMethod.h:
+        (WebKit::JSNPMethod::create):
+        * WebProcess/Plugins/Netscape/JSNPObject.cpp:
+        (WebKit::JSNPObject::JSNPObject):
+        * WebProcess/Plugins/Netscape/JSNPObject.h:
+        (WebKit::JSNPObject::create):
+
 2011-09-06  Ryosuke Niwa  <rniwa@webkit.org>
 
         Rename confirmCompositionWithoutDisturbingSelection to cancelComposition
index 8bb5969..06586d9 100644 (file)
@@ -30,6 +30,7 @@
 #include <JavaScriptCore/Error.h>
 #include <JavaScriptCore/FunctionPrototype.h>
 #include <JavaScriptCore/JSGlobalObject.h>
+#include <JavaScriptCore/JSObject.h>
 #include <WebCore/JSHTMLElement.h>
 #include <WebCore/JSPluginElementFunctions.h>
 #include <WebCore/NotImplemented.h>
@@ -41,17 +42,16 @@ namespace WebKit {
 
 const ClassInfo JSNPMethod::s_info = { "NPMethod", &InternalFunction::s_info, 0, 0 };
 
-JSNPMethod::JSNPMethod(ExecState* exec, JSGlobalObject* globalObject, const Identifier& name, NPIdentifier npIdentifier, Structure* structure)
-    : InternalFunction(&exec->globalData(), globalObject, structure, name)
-    , m_npIdentifier(npIdentifier)
+JSNPMethod::JSNPMethod(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const Identifier& name, NPIdentifier npIdentifier)
+    : InternalFunction(globalObject, structure)
 {
-    ASSERT(inherits(&s_info));
+    finishCreation(exec->globalData(), globalObject, name);
 }
 
-JSNPMethod* JSNPMethod::create(ExecState* exec, JSGlobalObject* globalObject, const Identifier& ident, NPIdentifier npIdent)
+void JSNPMethod::finishCreation(JSGlobalData& globalData, JSGlobalObject* globalObject, const Identifier& name)
 {
-    JSC::Structure* structure = createStructure(exec->globalData(), globalObject, globalObject->functionPrototype());
-    return new (JSC::allocateCell<JSNPMethod>(*exec->heap())) JSNPMethod(exec, globalObject, ident, npIdent, structure);
+    Base::finishCreation(globalData, globalObject, name);
+    ASSERT(inherits(&s_info));
 }
 
 static EncodedJSValue JSC_HOST_CALL callMethod(ExecState* exec)
index ef9ce94..d1da8c2 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef JSNPMethod_h
 #define JSNPMethod_h
 
+#include <JavaScriptCore/FunctionPrototype.h>
 #include <JavaScriptCore/InternalFunction.h>
 
 typedef void* NPIdentifier;
@@ -37,14 +38,21 @@ class JSNPMethod : public JSC::InternalFunction {
 public:
     typedef JSC::InternalFunction Base;
 
-    static JSNPMethod* create(JSC::ExecState*, JSC::JSGlobalObject*, const JSC::Identifier&, NPIdentifier);
+    static JSNPMethod* create(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, const JSC::Identifier& ident, NPIdentifier npIdent)
+    {
+        JSC::Structure* structure = createStructure(exec->globalData(), globalObject, globalObject->functionPrototype());
+        return new (JSC::allocateCell<JSNPMethod>(*exec->heap())) JSNPMethod(exec, globalObject, structure, ident, npIdent);
+    }
 
     static const JSC::ClassInfo s_info;
 
     NPIdentifier npIdentifier() const { return m_npIdentifier; }
 
+protected:
+    void finishCreation(JSC::JSGlobalData&, JSC::JSGlobalObject*, const JSC::Identifier& name);
+
 private:    
-    JSNPMethod(JSC::ExecState*, JSC::JSGlobalObject*, const JSC::Identifier&, NPIdentifier, JSC::Structure*);
+    JSNPMethod(JSC::ExecState*, JSC::JSGlobalObject*, JSC::Structure*, const JSC::Identifier&, NPIdentifier);
 
     static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
     {
index 6ed69a1..99a3b88 100644 (file)
@@ -50,12 +50,11 @@ static NPIdentifier npIdentifierFromIdentifier(const Identifier& identifier)
 
 const ClassInfo JSNPObject::s_info = { "NPObject", &JSObjectWithGlobalObject::s_info, 0, 0 };
 
-JSNPObject::JSNPObject(JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject, Structure* structure)
+JSNPObject::JSNPObject(JSGlobalObject* globalObject, Structure* structure, NPRuntimeObjectMap* objectMap, NPObject* npObject)
     : JSObjectWithGlobalObject(globalObject, structure)
     , m_objectMap(objectMap)
     , m_npObject(npObject)
 {
-    finishCreation(globalObject);
 }
 
 void JSNPObject::finishCreation(JSGlobalObject* globalObject)
@@ -69,12 +68,6 @@ void JSNPObject::finishCreation(JSGlobalObject* globalObject)
     retainNPObject(m_npObject);
 }
 
-JSNPObject* JSNPObject::create(JSC::JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
-{
-    Structure* structure = createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype());
-    return new (JSC::allocateCell<JSNPObject>(globalObject->globalData().heap)) JSNPObject(globalObject, objectMap, npObject, structure);
-}
-
 JSNPObject::~JSNPObject()
 {
     ASSERT(!m_npObject);
index 0bbd5b5..c074a8c 100644 (file)
@@ -27,6 +27,7 @@
 #define JSNPObject_h
 
 #include <JavaScriptCore/JSObjectWithGlobalObject.h>
+#include <JavaScriptCore/ObjectPrototype.h>
 
 typedef void* NPIdentifier;
 struct NPObject;
@@ -41,7 +42,14 @@ class JSNPObject : public JSC::JSObjectWithGlobalObject {
 public:
     typedef JSC::JSObjectWithGlobalObject Base;
 
-    static JSNPObject* create(JSC::JSGlobalObject*, NPRuntimeObjectMap*, NPObject*);
+    static JSNPObject* create(JSC::JSGlobalObject* globalObject, NPRuntimeObjectMap* objectMap, NPObject* npObject)
+    {
+        JSC::Structure* structure = createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype());
+        JSNPObject* object = new (JSC::allocateCell<JSNPObject>(globalObject->globalData().heap)) JSNPObject(globalObject, structure, objectMap, npObject);
+        object->finishCreation(globalObject);
+        return object;
+    }
+
     ~JSNPObject();
 
     void invalidate();
@@ -61,7 +69,7 @@ protected:
     void finishCreation(JSC::JSGlobalObject*);
 
 private:
-    JSNPObject(JSC::JSGlobalObject*, NPRuntimeObjectMap*, NPObject*, JSC::Structure*);
+    JSNPObject(JSC::JSGlobalObject*, JSC::Structure*, NPRuntimeObjectMap*, NPObject*);
 
     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesGetPropertyNames | JSObject::StructureFlags;