Ignore:
Timestamp:
Aug 26, 2011, 3:32:53 PM (14 years ago)
Author:
[email protected]
Message:

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

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

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

  • runtime/Executable.h:

(JSC::ExecutableBase::ExecutableBase):
(JSC::ExecutableBase::create):
(JSC::NativeExecutable::create):
(JSC::NativeExecutable::finishCreation):
(JSC::NativeExecutable::NativeExecutable):
(JSC::ScriptExecutable::ScriptExecutable):
(JSC::ScriptExecutable::finishCreation):

  • runtime/GetterSetter.h:

(JSC::GetterSetter::GetterSetter):
(JSC::GetterSetter::create):

  • runtime/JSAPIValueWrapper.h:

(JSC::JSAPIValueWrapper::create):
(JSC::JSAPIValueWrapper::JSAPIValueWrapper):

  • runtime/JSObject.h:

(JSC::JSNonFinalObject::JSNonFinalObject):
(JSC::JSNonFinalObject::finishCreation):
(JSC::JSFinalObject::create):
(JSC::JSFinalObject::finishCreation):
(JSC::JSFinalObject::JSFinalObject):
(JSC::JSObject::JSObject):

  • runtime/JSPropertyNameIterator.cpp:

(JSC::JSPropertyNameIterator::JSPropertyNameIterator):
(JSC::JSPropertyNameIterator::create):

  • runtime/JSPropertyNameIterator.h:

(JSC::JSPropertyNameIterator::create):

  • runtime/RegExp.cpp:

(JSC::RegExp::RegExp):
(JSC::RegExp::createWithoutCaching):

  • runtime/ScopeChain.h:

(JSC::ScopeChainNode::ScopeChainNode):
(JSC::ScopeChainNode::create):

  • runtime/Structure.cpp:

(JSC::Structure::Structure):

  • runtime/Structure.h:

(JSC::Structure::create):
(JSC::Structure::finishCreation):
(JSC::Structure::createStructure):

  • runtime/StructureChain.cpp:

(JSC::StructureChain::StructureChain):

  • runtime/StructureChain.h:

(JSC::StructureChain::create):

File:
1 edited

Legend:

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

    r93835 r93920  
    5959            , m_numParametersForConstruct(numParameters)
    6060        {
    61             finishCreation(globalData);
    6261        }
    6362
     
    7675        static ExecutableBase* create(JSGlobalData& globalData, Structure* structure, int numParameters)
    7776        {
    78             return new (allocateCell<ExecutableBase>(globalData.heap)) ExecutableBase(globalData, structure, numParameters);
     77            ExecutableBase* executable = new (allocateCell<ExecutableBase>(globalData.heap)) ExecutableBase(globalData, structure, numParameters);
     78            executable->finishCreation(globalData);
     79            return executable;
    7980        }
    8081
     
    181182        static NativeExecutable* create(JSGlobalData& globalData, MacroAssemblerCodePtr callThunk, NativeFunction function, MacroAssemblerCodePtr constructThunk, NativeFunction constructor)
    182183        {
     184            NativeExecutable* executable;
    183185            if (!callThunk)
    184                 return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor);
    185             return new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor);
     186                executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode(), function, JITCode(), constructor);
     187            else
     188                executable = new (allocateCell<NativeExecutable>(globalData.heap)) NativeExecutable(globalData, JITCode::HostFunction(callThunk), function, JITCode::HostFunction(constructThunk), constructor);
     189            return executable;
    186190        }
    187191#else
     
    199203       
    200204        static const ClassInfo s_info;
    201    
     205
     206    protected:
     207#if ENABLE(JIT)
     208        void finishCreation(JSGlobalData& globalData, JITCode callThunk, JITCode constructThunk)
     209        {
     210            Base::finishCreation(globalData);
     211            m_jitCodeForCall = callThunk;
     212            m_jitCodeForConstruct = constructThunk;
     213            m_jitCodeForCallWithArityCheck = callThunk.addressForCall();
     214            m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall();
     215        }
     216#endif
     217 
    202218    private:
    203219#if ENABLE(JIT)
     
    207223            , m_constructor(constructor)
    208224        {
    209             m_jitCodeForCall = callThunk;
    210             m_jitCodeForConstruct = constructThunk;
    211             m_jitCodeForCallWithArityCheck = callThunk.addressForCall();
    212             m_jitCodeForConstructWithArityCheck = constructThunk.addressForCall();
     225            finishCreation(globalData, callThunk, constructThunk);
    213226        }
    214227#else
     
    218231            , m_constructor(constructor)
    219232        {
     233            finishCreation(globalData);
    220234        }
    221235#endif
     
    236250            , m_features(isInStrictContext ? StrictModeFeature : 0)
    237251        {
    238 #if ENABLE(CODEBLOCK_SAMPLING)
    239             if (SamplingTool* sampler = globalData.interpreter->sampler())
    240                 sampler->notifyOfScope(globalData, this);
    241 #else
    242             UNUSED_PARAM(globalData);
    243 #endif
     252            finishCreation(globalData);
    244253        }
    245254
     
    249258            , m_features(isInStrictContext ? StrictModeFeature : 0)
    250259        {
    251 #if ENABLE(CODEBLOCK_SAMPLING)
    252             if (SamplingTool* sampler = exec->globalData().interpreter->sampler())
    253                 sampler->notifyOfScope(exec->globalData(), this);
    254 #else
    255             UNUSED_PARAM(exec);
    256 #endif
     260            finishCreation(exec->globalData());
    257261        }
    258262
     
    271275       
    272276        static const ClassInfo s_info;
     277
    273278    protected:
     279        void finishCreation(JSGlobalData& globalData)
     280        {
     281            Base::finishCreation(globalData);
     282#if ENABLE(CODEBLOCK_SAMPLING)
     283            if (SamplingTool* sampler = globalData.interpreter->sampler())
     284                sampler->notifyOfScope(globalData, this);
     285#endif
     286        }
     287
    274288        void recordParse(CodeFeatures features, bool hasCapturedVariables, int firstLine, int lastLine)
    275289        {
Note: See TracChangeset for help on using the changeset viewer.