Ignore:
Timestamp:
Aug 29, 2011, 6:43:46 PM (14 years ago)
Author:
[email protected]
Message:

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

Patch by Mark Hahnenberg <[email protected]> on 2011-08-29
Reviewed by Darin Adler.

Source/JavaScriptCore:

Completed the third 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.

  • debugger/DebuggerActivation.cpp:

(JSC::DebuggerActivation::DebuggerActivation):
(JSC::DebuggerActivation::finishCreation):

  • debugger/DebuggerActivation.h:

(JSC::DebuggerActivation::create):

  • runtime/Arguments.h:

(JSC::Arguments::create):
(JSC::Arguments::createNoParameters):
(JSC::Arguments::Arguments):
(JSC::Arguments::finishCreation):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::ErrorInstance):

  • runtime/ErrorInstance.h:

(JSC::ErrorInstance::finishCreation):

  • runtime/ExceptionHelpers.cpp:

(JSC::InterruptedExecutionError::InterruptedExecutionError):
(JSC::TerminatedExecutionError::TerminatedExecutionError):

  • runtime/Executable.cpp:

(JSC::EvalExecutable::EvalExecutable):
(JSC::ProgramExecutable::ProgramExecutable):
(JSC::FunctionExecutable::FunctionExecutable):
Moved the assignment of m_firstLine and m_lastLine into the
FunctionExecutable::finishCreation() method in Executable.h

  • runtime/Executable.h:

(JSC::ScriptExecutable::ScriptExecutable):
(JSC::EvalExecutable::create):
(JSC::ProgramExecutable::create):
(JSC::FunctionExecutable::create):
(JSC::FunctionExecutable::finishCreation):

  • runtime/JSArray.cpp:

(JSC::JSArray::JSArray):
(JSC::JSArray::finishCreation):

  • runtime/JSArray.h:
  • runtime/JSByteArray.cpp:

(JSC::JSByteArray::JSByteArray):

  • runtime/JSByteArray.h:

(JSC::JSByteArray::finishCreation):

  • runtime/JSNotAnObject.h:

(JSC::JSNotAnObject::JSNotAnObject):

  • runtime/JSObject.h:

(JSC::JSNonFinalObject::JSNonFinalObject):

  • runtime/JSObjectWithGlobalObject.cpp:

(JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
(JSC::JSObjectWithGlobalObject::finishCreation):

  • runtime/JSObjectWithGlobalObject.h:
  • runtime/JSVariableObject.h:

(JSC::JSVariableObject::JSVariableObject):
(JSC::JSVariableObject::finishCreation):

  • runtime/JSWrapperObject.h:

(JSC::JSWrapperObject::JSWrapperObject):

  • runtime/ObjectPrototype.cpp:

(JSC::ObjectPrototype::ObjectPrototype):
(JSC::ObjectPrototype::finishCreation):

  • runtime/ObjectPrototype.h:
  • runtime/StrictEvalActivation.cpp:

(JSC::StrictEvalActivation::StrictEvalActivation):

Source/JavaScriptGlue:

Completed the third 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.

  • UserObjectImp.cpp:

(UserObjectImp::UserObjectImp):

Source/WebCore:

No new tests.

Completed the third 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.

  • bindings/js/JSDOMWindowShell.cpp:

(WebCore::JSDOMWindowShell::JSDOMWindowShell):
(WebCore::JSDOMWindowShell::finishCreation):

  • bindings/js/JSDOMWindowShell.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Executable.h

    r93947 r94035  
    244244            , m_features(isInStrictContext ? StrictModeFeature : 0)
    245245        {
    246             finishCreation(globalData);
    247246        }
    248247
     
    252251            , m_features(isInStrictContext ? StrictModeFeature : 0)
    253252        {
    254             finishCreation(exec->globalData());
    255253        }
    256254
     
    319317        static EvalExecutable* create(ExecState* exec, const SourceCode& source, bool isInStrictContext)
    320318        {
    321             return new (allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext);
     319            EvalExecutable* executable = new (allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext);
     320            return executable;
    322321        }
    323322
     
    355354        static ProgramExecutable* create(ExecState* exec, const SourceCode& source)
    356355        {
    357             return new (allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source);
     356            ProgramExecutable* executable = new (allocateCell<ProgramExecutable>(*exec->heap())) ProgramExecutable(exec, source);
     357            return executable;
    358358        }
    359359
     
    413413        static FunctionExecutable* create(ExecState* exec, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
    414414        {
    415             return new (allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
     415            FunctionExecutable* executable = new (allocateCell<FunctionExecutable>(*exec->heap())) FunctionExecutable(exec, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
     416            return executable;
    416417        }
    417418
    418419        static FunctionExecutable* create(JSGlobalData& globalData, const Identifier& name, const SourceCode& source, bool forceUsesArguments, FunctionParameters* parameters, bool isInStrictContext, int firstLine, int lastLine)
    419420        {
    420             return new (allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
     421            FunctionExecutable* executable = new (allocateCell<FunctionExecutable>(globalData.heap)) FunctionExecutable(globalData, name, source, forceUsesArguments, parameters, isInStrictContext, firstLine, lastLine);
     422            return executable;
    421423        }
    422424
     
    531533        void finishCreation(JSGlobalData& globalData, const Identifier& name, int firstLine, int lastLine)
    532534        {
     535            Base::finishCreation(globalData);
    533536            m_firstLine = firstLine;
    534537            m_lastLine = lastLine;
Note: See TracChangeset for help on using the changeset viewer.