Ignore:
Timestamp:
Nov 14, 2011, 5:39:52 PM (14 years ago)
Author:
[email protected]
Message:

A little bit of arguments / activation cleanup
https://bugs.webkit.org/show_bug.cgi?id=72339

Reviewed by Gavin Barraclough.

Renamed copyRegisters => tearOff to match bytecode and other terminology.

Renamed setActivation => didTearOffActivation to indicate that this is a
notification the object may choose to ignore. Moved "Should I ignore?"
code into the arguments object to avoid duplication elsewhere.

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::unwindCallFrame):
(JSC::Interpreter::privateExecute):
(JSC::Interpreter::retrieveArguments):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Arguments.h:

(JSC::Arguments::createAndTearOff):
(JSC::Arguments::didTearOffActivation):
(JSC::Arguments::finishCreationButDontTearOff):
(JSC::Arguments::finishCreation):
(JSC::Arguments::finishCreationAndTearOff):
(JSC::Arguments::tearOff):

  • runtime/JSActivation.h:

(JSC::JSActivation::tearOff): Moved Activation's code into its own header
because that's where it belongs.

File:
1 edited

Legend:

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

    r100165 r100224  
    7171        }
    7272       
    73         static Arguments* createAndCopyRegisters(JSGlobalData& globalData, CallFrame* callFrame)
     73        static Arguments* createAndTearOff(JSGlobalData& globalData, CallFrame* callFrame)
    7474        {
    7575            Arguments* arguments = new (allocateCell<Arguments>(globalData.heap)) Arguments(callFrame);
    76             arguments->finishCreationAndCopyRegisters(callFrame);
     76            arguments->finishCreationAndTearOff(callFrame);
    7777            return arguments;
    7878        }
     
    112112       
    113113        void copyToRegisters(ExecState* exec, Register* buffer, uint32_t maxSize);
    114         void copyRegisters(JSGlobalData&);
     114        void tearOff(JSGlobalData&);
    115115        bool isTornOff() const { return d->registerArray; }
    116         void setActivation(JSGlobalData& globalData, JSActivation* activation)
    117         {
    118             ASSERT(!d->registerArray);
     116        void didTearOffActivation(JSGlobalData& globalData, JSActivation* activation)
     117        {
     118            if (isTornOff())
     119                return;
    119120            d->activation.set(globalData, this, activation);
    120121            d->registers = &activation->registerAt(0);
     
    129130        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesVisitChildren | OverridesGetPropertyNames | JSObject::StructureFlags;
    130131
    131         void finishCreationButDontCopyRegisters(CallFrame*);
     132        void finishCreationButDontTearOff(CallFrame*);
    132133        void finishCreation(CallFrame*);
    133         void finishCreationAndCopyRegisters(CallFrame*);
     134        void finishCreationAndTearOff(CallFrame*);
    134135        void finishCreation(CallFrame*, NoParametersType);
    135136
     
    191192    }
    192193   
    193     inline void Arguments::finishCreationButDontCopyRegisters(CallFrame* callFrame)
     194    inline void Arguments::finishCreationButDontTearOff(CallFrame* callFrame)
    194195    {
    195196        Base::finishCreation(callFrame->globalData());
     
    234235    {
    235236        ASSERT(!callFrame->isInlineCallFrame());
    236         finishCreationButDontCopyRegisters(callFrame);
     237        finishCreationButDontTearOff(callFrame);
    237238        if (d->isStrictMode)
    238             copyRegisters(callFrame->globalData());
    239     }
    240 
    241     inline void Arguments::finishCreationAndCopyRegisters(CallFrame* callFrame)
     239            tearOff(callFrame->globalData());
     240    }
     241
     242    inline void Arguments::finishCreationAndTearOff(CallFrame* callFrame)
    242243    {
    243244        Base::finishCreation(callFrame->globalData());
     
    357358        d->isStrictMode = callFrame->codeBlock()->isStrictMode();
    358359        if (d->isStrictMode)
    359             copyRegisters(callFrame->globalData());
    360     }
    361 
    362     inline void Arguments::copyRegisters(JSGlobalData& globalData)
     360            tearOff(callFrame->globalData());
     361    }
     362
     363    inline void Arguments::tearOff(JSGlobalData& globalData)
    363364    {
    364365        ASSERT(!isTornOff());
     
    377378    }
    378379
    379     // This JSActivation function is defined here so it can get at Arguments::setRegisters.
    380     inline void JSActivation::copyRegisters(JSGlobalData& globalData)
    381     {
    382         ASSERT(!m_registerArray);
    383 
    384         size_t numLocals = m_numCapturedVars + m_numParametersMinusThis;
    385 
    386         if (!numLocals)
    387             return;
    388 
    389         int registerOffset = m_numParametersMinusThis + RegisterFile::CallFrameHeaderSize;
    390         size_t registerArraySize = numLocals + RegisterFile::CallFrameHeaderSize;
    391 
    392         OwnArrayPtr<WriteBarrier<Unknown> > registerArray = copyRegisterArray(globalData, m_registers - registerOffset, registerArraySize, m_numParametersMinusThis + 1);
    393         WriteBarrier<Unknown>* registers = registerArray.get() + registerOffset;
    394         setRegisters(registers, registerArray.release());
    395     }
    396 
    397380} // namespace JSC
    398381
Note: See TracChangeset for help on using the changeset viewer.