Ignore:
Timestamp:
May 19, 2010, 4:24:31 PM (15 years ago)
Author:
[email protected]
Message:

2010-05-19 Geoffrey Garen <[email protected]>

Reviewed by Sam Weinig.

Slight refactoring to CodeBlock bytecode access
https://bugs.webkit.org/show_bug.cgi?id=39384

  • bytecode/CodeBlock.h: (JSC::CodeBlock::bytecodeOffset):
  • interpreter/CallFrame.h: (JSC::ExecState::returnPC):
  • interpreter/Interpreter.cpp: (JSC::Interpreter::unwindCallFrame): (JSC::Interpreter::retrieveLastCaller): Moved bytecode access into a CodeBlock helper function. Changed CallFrame to accurately represent how the returnPC is stored in JIT vs Interpreter.
File:
1 edited

Legend:

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

    r59781 r59791  
    7171
    7272namespace JSC {
    73 
    74 static ALWAYS_INLINE unsigned bytecodeOffsetForPC(CallFrame* callFrame, CodeBlock* codeBlock, void* pc)
    75 {
    76 #if ENABLE(JIT)
    77     return codeBlock->bytecodeOffset(callFrame, ReturnAddressPtr(pc));
    78 #else
    79     UNUSED_PARAM(callFrame);
    80     return static_cast<Instruction*>(pc) - codeBlock->instructions().begin();
    81 #endif
    82 }
    8373
    8474// Returns the depth of the scope chain within a given call frame.
     
    552542        scopeChain->deref();
    553543
    554     void* returnPC = callFrame->returnPC();
    555     callFrame = callFrame->callerFrame();
    556     if (callFrame->hasHostCallFrameFlag())
     544    CallFrame* callerFrame = callFrame->callerFrame();
     545    if (callerFrame->hasHostCallFrameFlag())
    557546        return false;
    558547
    559     codeBlock = callFrame->codeBlock();
    560     bytecodeOffset = bytecodeOffsetForPC(callFrame, codeBlock, returnPC);
     548    codeBlock = callerFrame->codeBlock();
     549    bytecodeOffset = codeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
     550    callFrame = callerFrame;
    561551    return true;
    562552}
     
    44664456        return;
    44674457
    4468     unsigned bytecodeOffset = bytecodeOffsetForPC(callerFrame, callerCodeBlock, callFrame->returnPC());
     4458    unsigned bytecodeOffset = callerCodeBlock->bytecodeOffset(callerFrame, callFrame->returnPC());
    44694459    lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1);
    44704460    sourceID = callerCodeBlock->ownerExecutable()->sourceID();
Note: See TracChangeset for help on using the changeset viewer.