Ignore:
Timestamp:
May 2, 2012, 12:18:28 PM (13 years ago)
Author:
[email protected]
Message:

Unreviewed, rolling out r115388.
http://trac.webkit.org/changeset/115388
https://bugs.webkit.org/show_bug.cgi?id=85011

This caused many weird performance problems, and needs to be
landed in pieces.

Source/JavaScriptCore:

  • dfg/DFGOperations.cpp:
  • heap/Heap.cpp:

(JSC::Heap::getConservativeRegisterRoots):
(JSC::Heap::markRoots):

  • interpreter/CallFrame.cpp:

(JSC::CallFrame::dumpCaller):
(JSC):

  • interpreter/CallFrame.h:

(JSC::ExecState::init):
(ExecState):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
(JSC::Interpreter::privateExecute):

  • interpreter/Interpreter.h:

(JSC::Interpreter::execute):

  • interpreter/RegisterFile.cpp:

(JSC::RegisterFile::growSlowCase):
(JSC::RegisterFile::gatherConservativeRoots):

  • interpreter/RegisterFile.h:

(JSC::RegisterFile::end):
(JSC::RegisterFile::size):
(JSC::RegisterFile::addressOfEnd):
(RegisterFile):
(JSC::RegisterFile::RegisterFile):
(JSC::RegisterFile::shrink):
(JSC::RegisterFile::grow):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):
(JSC::jitCompileFor):
(JSC::lazyLinkFor):

  • llint/LLIntSlowPaths.cpp:

(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::handleHostCall):

  • llint/LowLevelInterpreter.asm:
  • runtime/CommonSlowPaths.h:

(JSC::CommonSlowPaths::arityCheckFor):

LayoutTests:

  • fast/js/global-recursion-on-full-stack-expected.txt:
  • fast/js/stack-trace-expected.txt:
Location:
trunk/Source/JavaScriptCore/interpreter
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.cpp

    r115388 r115861  
    4343    dataLog("Callpoint => %s:%d\n", urlString.utf8().data(), signedLineNumber);
    4444}
    45 #endif
    4645
    4746RegisterFile* CallFrame::registerFile()
     
    4948    return &interpreter()->registerFile();
    5049}
     50
     51#endif
    5152
    5253#if USE(JSVALUE32_64)
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r115388 r115861  
    172172        {
    173173            ASSERT(callerFrame); // Use noCaller() rather than 0 for the outer host call frame caller.
    174             ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->commitEnd() >= this);
     174            ASSERT(callerFrame == noCaller() || callerFrame->removeHostCallFrameFlag()->registerFile()->end() >= this);
    175175
    176176            setCodeBlock(codeBlock);
     
    255255        CallFrame* trueCallFrameFromVMCode() { return trueCallFrame(AbstractPC()); }
    256256
    257         Register* startOfReusableRegisterFile()
    258         {
    259             CallFrame* result = globalData().topCallFrame;
    260             if (result == noCaller() || result == registerFile()->begin())
    261                 return registerFile()->begin();
    262             return result->frameExtent();
    263         }
    264        
    265257    private:
    266258        static const intptr_t HostCallFrameFlag = 1;
     
    268260        static const int s_firstArgumentOffset = s_thisArgumentOffset - 1;
    269261
     262#ifndef NDEBUG
    270263        RegisterFile* registerFile();
    271 
     264#endif
    272265#if ENABLE(DFG_JIT)
    273266        bool isInlineCallFrameSlow();
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r115657 r115861  
    12091209    CodeBlock* codeBlock = &program->generatedBytecode();
    12101210
    1211     Register* oldEnd = callFrame->startOfReusableRegisterFile();
     1211    Register* oldEnd = m_registerFile.end();
    12121212    Register* newEnd = oldEnd + codeBlock->numParameters() + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters;
    12131213    if (!m_registerFile.grow(newEnd))
     
    12581258        return checkedReturn(throwStackOverflowError(callFrame));
    12591259
    1260     Register* oldEnd = callFrame->startOfReusableRegisterFile();
     1260    Register* oldEnd = m_registerFile.end();
    12611261    ASSERT(callFrame->frameExtent() <= oldEnd || callFrame == callFrame->scopeChain()->globalObject->globalExec());
    12621262    int argCount = 1 + args.size(); // implicit "this" parameter
     
    13551355        return checkedReturn(throwStackOverflowError(callFrame));
    13561356
    1357     Register* oldEnd = callFrame->startOfReusableRegisterFile();
     1357    Register* oldEnd = m_registerFile.end();
    13581358    int argCount = 1 + args.size(); // implicit "this" parameter
    13591359    size_t registerOffset = argCount + RegisterFile::CallFrameHeaderSize;
     
    14571457    }
    14581458
    1459     Register* oldEnd = callFrame->startOfReusableRegisterFile();
     1459    Register* oldEnd = m_registerFile.end();
    14601460    size_t registerOffset = argumentCountIncludingThis + RegisterFile::CallFrameHeaderSize;
    14611461
     
    15831583    }
    15841584
     1585    Register* oldEnd = m_registerFile.end();
    15851586    Register* newEnd = m_registerFile.begin() + globalRegisterOffset + codeBlock->m_numCalleeRegisters;
    15861587    if (!m_registerFile.grow(newEnd)) {
     
    16261627        (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo());
    16271628
     1629    m_registerFile.shrink(oldEnd);
    16281630    if (pushedScope)
    16291631        scopeChain->pop();
     
    45174519            if (UNLIKELY(!callFrame)) {
    45184520                callFrame = previousCallFrame;
    4519                 *topCallFrameSlot = callFrame;
    45204521                exceptionValue = createStackOverflowError(callFrame);
    45214522                goto vm_throw;
     
    45964597            newCallFrame = slideRegisterWindowForCall(newCodeBlock, registerFile, newCallFrame, 0, argCount);
    45974598            if (UNLIKELY(!newCallFrame)) {
    4598                 *topCallFrameSlot = callFrame;
    45994599                exceptionValue = createStackOverflowError(callFrame);
    46004600                goto vm_throw;
     
    49184918            if (UNLIKELY(!callFrame)) {
    49194919                callFrame = previousCallFrame;
    4920                 *topCallFrameSlot = callFrame;
    49214920                exceptionValue = createStackOverflowError(callFrame);
    49224921                goto vm_throw;
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.h

    r115388 r115861  
    295295    inline JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSValue thisValue, ScopeChainNode* scopeChain)
    296296    {
    297         return execute(eval, callFrame, thisValue, scopeChain, (callFrame->startOfReusableRegisterFile() - m_registerFile.begin()) + 1 + RegisterFile::CallFrameHeaderSize);
     297        return execute(eval, callFrame, thisValue, scopeChain, m_registerFile.size() + 1 + RegisterFile::CallFrameHeaderSize);
    298298    }
    299299
  • trunk/Source/JavaScriptCore/interpreter/RegisterFile.cpp

    r115388 r115861  
    5353bool RegisterFile::growSlowCase(Register* newEnd)
    5454{
    55     ASSERT(newEnd > m_commitEnd);
     55    if (newEnd <= m_commitEnd) {
     56        m_end = newEnd;
     57        return true;
     58    }
    5659
    5760    long delta = roundUpAllocationSize(reinterpret_cast<char*>(newEnd) - reinterpret_cast<char*>(m_commitEnd), commitSize);
     
    6265    addToCommittedByteCount(delta);
    6366    m_commitEnd = reinterpret_cast_ptr<Register*>(reinterpret_cast<char*>(m_commitEnd) + delta);
     67    m_end = newEnd;
    6468    return true;
    6569}
    6670
    67 void RegisterFile::gatherConservativeRoots(JSGlobalData& globalData, ConservativeRoots& conservativeRoots)
     71void RegisterFile::gatherConservativeRoots(ConservativeRoots& conservativeRoots)
    6872{
    69     if (globalData.topCallFrame == CallFrame::noCaller())
    70         return;
    71     conservativeRoots.add(begin(), globalData.topCallFrame->frameExtent());
     73    conservativeRoots.add(begin(), end());
    7274}
    7375
    74 void RegisterFile::gatherConservativeRoots(JSGlobalData& globalData, ConservativeRoots& conservativeRoots, DFGCodeBlocks& dfgCodeBlocks)
     76void RegisterFile::gatherConservativeRoots(ConservativeRoots& conservativeRoots, DFGCodeBlocks& dfgCodeBlocks)
    7577{
    76     if (globalData.topCallFrame == CallFrame::noCaller())
    77         return;
    78     conservativeRoots.add(begin(), globalData.topCallFrame->frameExtent(), dfgCodeBlocks);
     78    conservativeRoots.add(begin(), end(), dfgCodeBlocks);
    7979}
    8080
  • trunk/Source/JavaScriptCore/interpreter/RegisterFile.h

    r115388 r115861  
    6464        ~RegisterFile();
    6565       
    66         void gatherConservativeRoots(JSGlobalData&, ConservativeRoots&);
    67         void gatherConservativeRoots(JSGlobalData&, ConservativeRoots&, DFGCodeBlocks&);
     66        void gatherConservativeRoots(ConservativeRoots&);
     67        void gatherConservativeRoots(ConservativeRoots&, DFGCodeBlocks&);
    6868
    6969        Register* begin() const { return static_cast<Register*>(m_reservation.base()); }
    70         Register* commitEnd() const { return m_commitEnd; }
     70        Register* end() const { return m_end; }
     71        size_t size() const { return end() - begin(); }
    7172
    7273        bool grow(Register*);
     
    7879        Register* const * addressOfEnd() const
    7980        {
    80             return &m_commitEnd;
     81            return &m_end;
    8182        }
    8283
     
    8788        void releaseExcessCapacity();
    8889        void addToCommittedByteCount(long);
     90        Register* m_end;
    8991        Register* m_commitEnd;
    9092        PageReservation m_reservation;
     
    9294
    9395    inline RegisterFile::RegisterFile(size_t capacity)
     96        : m_end(0)
    9497    {
    9598        ASSERT(capacity && isPageAligned(capacity));
    9699
    97100        m_reservation = PageReservation::reserve(roundUpAllocationSize(capacity * sizeof(Register), commitSize), OSAllocator::JSVMStackPages);
     101        m_end = static_cast<Register*>(m_reservation.base());
    98102        m_commitEnd = static_cast<Register*>(m_reservation.base());
    99103    }
     
    101105    inline void RegisterFile::shrink(Register* newEnd)
    102106    {
    103         ASSERT(newEnd <= m_commitEnd);
    104         if (newEnd == m_reservation.base() && (m_commitEnd - begin()) >= maxExcessCapacity)
     107        if (newEnd >= m_end)
     108            return;
     109        m_end = newEnd;
     110        if (m_end == m_reservation.base() && (m_commitEnd - begin()) >= maxExcessCapacity)
    105111            releaseExcessCapacity();
    106112    }
     
    108114    inline bool RegisterFile::grow(Register* newEnd)
    109115    {
    110         if (newEnd <= m_commitEnd)
     116        if (newEnd <= m_end)
    111117            return true;
    112118        return growSlowCase(newEnd);
Note: See TracChangeset for help on using the changeset viewer.