Ignore:
Timestamp:
Sep 17, 2012, 6:15:04 PM (13 years ago)
Author:
[email protected]
Message:

Refactored the arguments object so it doesn't dictate closure layout
https://bugs.webkit.org/show_bug.cgi?id=96955

Reviewed by Oliver Hunt.

  • bytecode/CodeBlock.h:

(JSC::ExecState::argumentAfterCapture): Helper function for accessing an
argument that has been moved for capture.

  • bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::BytecodeGenerator): Generate metadata for arguments
that are captured. We don't move any arguments yet, but we do use this
metadata to tell the arguments object if an argument is stored in the
activation.

  • dfg/DFGOperations.cpp:
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetByValOnArguments):
(JSC::DFG::SpeculativeJIT::compileGetArgumentsLength):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile): Updated for the arguments object not
malloc'ing a separate backing store, and for a rename from deletedArguments
to slowArguments.

  • interpreter/CallFrame.h:

(ExecState):

  • interpreter/Interpreter.cpp:

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

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL): Updated for small interface changes.

  • runtime/Arguments.cpp:

(JSC::Arguments::visitChildren):
(JSC::Arguments::copyToArguments):
(JSC::Arguments::fillArgList):
(JSC::Arguments::getOwnPropertySlotByIndex):
(JSC::Arguments::createStrictModeCallerIfNecessary):
(JSC::Arguments::createStrictModeCalleeIfNecessary):
(JSC::Arguments::getOwnPropertySlot):
(JSC::Arguments::getOwnPropertyDescriptor):
(JSC::Arguments::getOwnPropertyNames):
(JSC::Arguments::putByIndex):
(JSC::Arguments::put):
(JSC::Arguments::deletePropertyByIndex):
(JSC::Arguments::deleteProperty):
(JSC::Arguments::defineOwnProperty):
(JSC::Arguments::tearOff): Moved all data inline into the object, for speed,
and refactored all internal argument accesses to use helper functions, so
we can change the implementation without changing lots of code.

(JSC::Arguments::didTearOffActivation): This function needs to account
for arguments that were moved by the activation object. We do this accounting
through a side vector that tells us where our arguments will be in the
activation.

(JSC::Arguments::tearOffForInlineCallFrame):

  • runtime/Arguments.h:

(Arguments):
(JSC::Arguments::length):
(JSC::Arguments::isTornOff):
(JSC::Arguments::Arguments):
(JSC::Arguments::allocateSlowArguments):
(JSC::Arguments::tryDeleteArgument):
(JSC::Arguments::trySetArgument):
(JSC::Arguments::tryGetArgument):
(JSC::Arguments::isDeletedArgument):
(JSC::Arguments::isArgument):
(JSC::Arguments::argument):
(JSC::Arguments::finishCreation):

  • runtime/JSActivation.h:

(JSC::JSActivation::create):
(JSActivation):
(JSC::JSActivation::captureStart):
(JSC::JSActivation::storageSize):
(JSC::JSActivation::registerOffset):
(JSC::JSActivation::isValid): The activation object is no longer responsible
for copying extra arguments provided by the caller. The argumnents object
does this instead. This means we can allocate and initialize an activation
without worrying about the call frame's argument count.

  • runtime/SymbolTable.h:

(JSC::SlowArgument::SlowArgument):
(SlowArgument):
(JSC):
(JSC::SharedSymbolTable::parameterCount):
(SharedSymbolTable):
(JSC::SharedSymbolTable::slowArguments):
(JSC::SharedSymbolTable::setSlowArguments): Added data structures to back
the algorithms above.

File:
1 edited

Legend:

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

    r128813 r128832  
    4141    class WatchpointSet;
    4242
     43    struct SlowArgument {
     44        enum Status {
     45            Normal = 0,
     46            Captured = 1,
     47            Deleted = 2
     48        };
     49
     50        SlowArgument()
     51            : status(Normal)
     52            , indexIfCaptured(0)
     53        {
     54        }
     55
     56        Status status;
     57        int indexIfCaptured; // If status is 'Captured', indexIfCaptured is our index in the CallFrame.
     58    };
     59
    4360    static ALWAYS_INLINE int missingSymbolMarker() { return std::numeric_limits<int>::max(); }
    4461
     
    360377        void setCaptureEnd(int captureEnd) { m_captureEnd = captureEnd; }
    361378
     379        int parameterCount() { return m_parameterCountIncludingThis - 1; }
    362380        int parameterCountIncludingThis() { return m_parameterCountIncludingThis; }
    363381        void setParameterCountIncludingThis(int parameterCountIncludingThis) { m_parameterCountIncludingThis = parameterCountIncludingThis; }
     382
     383        // 0 if we don't capture any arguments; parameterCount() in length if we do.
     384        const SlowArgument* slowArguments() { return m_slowArguments.get(); }
     385        void setSlowArguments(PassOwnArrayPtr<SlowArgument> slowArguments) { m_slowArguments = slowArguments; }
    364386
    365387        static JS_EXPORTDATA const ClassInfo s_info;
     
    382404        int m_captureStart;
    383405        int m_captureEnd;
     406
     407        OwnArrayPtr<SlowArgument> m_slowArguments;
    384408    };
    385409   
    386410    HAS_IMMORTAL_STRUCTURE(SharedSymbolTable);
    387  
     411
    388412} // namespace JSC
    389413
Note: See TracChangeset for help on using the changeset viewer.