Changeset 50896 in webkit for trunk/JavaScriptCore/interpreter


Ignore:
Timestamp:
Nov 12, 2009, 1:07:51 PM (16 years ago)
Author:
[email protected]
Message:

Start unifying entry logic for function and eval code.

Reviewed by Gavin Barraclough.

Eval now uses a ret instruction to end execution, and sets up
a callframe more in line with what we do for function entry.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Interpreter.cpp

    r50704 r50896  
    814814
    815815    Register* oldEnd = m_registerFile.end();
    816     Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->m_numCalleeRegisters;
    817     if (!m_registerFile.grow(newEnd)) {
     816    int argc = 1; // Implicit this argument
     817    if (!m_registerFile.grow(m_registerFile.start() + globalRegisterOffset + argc)) {
    818818        *exception = createStackOverflowError(callFrame);
    819819        return jsNull();
     
    821821
    822822    CallFrame* newCallFrame = CallFrame::create(m_registerFile.start() + globalRegisterOffset);
    823 
     823    newCallFrame->r(0) = JSValue(thisObj);
     824
     825    newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc);
     826    if (UNLIKELY(!newCallFrame)) {
     827        *exception = createStackOverflowError(callFrame);
     828        m_registerFile.shrink(oldEnd);
     829        return jsNull();
     830    }
    824831    // a 0 codeBlock indicates a built-in caller
    825     newCallFrame->r(codeBlock->thisRegister()) = JSValue(thisObj);
    826     newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0);
     832    newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, argc, 0);
    827833
    828834    if (codeBlock->needsFullScopeChain())
Note: See TracChangeset for help on using the changeset viewer.