Changeset 94875 in webkit for trunk/Source/JavaScriptCore/API


Ignore:
Timestamp:
Sep 9, 2011, 2:43:14 PM (14 years ago)
Author:
[email protected]
Message:

Unzip initialization lists and constructors in JSCell hierarchy (5/7)
https://bugs.webkit.org/show_bug.cgi?id=67420

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:
  • API/JSCallbackObject.h:
  • API/JSCallbackObjectFunctions.h:

(JSC::::JSCallbackObject):
(JSC::::finishCreation):

  • 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):

Location:
trunk/Source/JavaScriptCore/API
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSCallbackConstructor.cpp

    r94701 r94875  
    4444    , m_callback(callback)
    4545{
    46     finishCreation(globalObject, jsClass);
    4746}
    4847
  • trunk/Source/JavaScriptCore/API/JSCallbackConstructor.h

    r94701 r94875  
    3838    static JSCallbackConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, JSClassRef classRef, JSObjectCallAsConstructorCallback callback)
    3939    {
    40         return new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback);
     40        JSCallbackConstructor* constructor = new (allocateCell<JSCallbackConstructor>(*exec->heap())) JSCallbackConstructor(globalObject, structure, classRef, callback);
     41        constructor->finishCreation(globalObject, classRef);
     42        return constructor;
    4143    }
    4244   
  • trunk/Source/JavaScriptCore/API/JSCallbackFunction.cpp

    r94644 r94875  
    4444
    4545JSCallbackFunction::JSCallbackFunction(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const Identifier& name)
    46     : InternalFunction(&exec->globalData(), globalObject, globalObject->callbackFunctionStructure(), name)
     46    : InternalFunction(globalObject, globalObject->callbackFunctionStructure())
    4747    , m_callback(callback)
    4848{
     49    finishCreation(exec->globalData(), name);
     50}
     51
     52void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const Identifier& name)
     53{
     54    Base::finishCreation(globalData, name);
    4955    ASSERT(inherits(&s_info));
    5056}
  • trunk/Source/JavaScriptCore/API/JSCallbackFunction.h

    r94644 r94875  
    3535protected:
    3636    JSCallbackFunction(ExecState*, JSGlobalObject*, JSObjectCallAsFunctionCallback, const Identifier& name);
     37    void finishCreation(JSGlobalData&, const Identifier& name);
    3738
    3839public:
  • trunk/Source/JavaScriptCore/API/JSCallbackObject.h

    r94704 r94875  
    126126
    127127    void finishCreation(ExecState*);
    128     void finishCreation();
     128    void finishCreation(JSGlobalData&);
    129129
    130130public:
  • trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r94701 r94875  
    6565    , m_callbackObjectData(adoptPtr(new JSCallbackObjectData(0, jsClass)))
    6666{
    67     finishCreation();
     67    finishCreation(globalData);
    6868}
    6969
     
    7676}
    7777
    78 // This is just for Global object, so we can assume that Base::finishCreation is JSGlobalObject::constructorBody.
    79 template <class Parent>
    80 void JSCallbackObject<Parent>::finishCreation()
     78// This is just for Global object, so we can assume that Base::finishCreation is JSGlobalObject::finishCreation.
     79template <class Parent>
     80void JSCallbackObject<Parent>::finishCreation(JSGlobalData& globalData)
    8181{
    8282    ASSERT(Parent::inherits(&s_info));
    8383    ASSERT(Parent::isGlobalObject());
     84    Base::finishCreation(globalData, this);
    8485    init(static_cast<JSGlobalObject*>(this)->globalExec());
    8586}
Note: See TracChangeset for help on using the changeset viewer.