Changeset 162711 in webkit for trunk/Source/JavaScriptCore/jit


Ignore:
Timestamp:
Jan 24, 2014, 11:07:31 AM (11 years ago)
Author:
[email protected]
Message:

Removing the need for Debugger* and m_shouldPause op_debug check.
<https://webkit.org/b/127532>

Reviewed by Geoffrey Garen.

This patch replaces the checking of the Debugger::m_shouldPause flag
with a procedure to set a SteppingMode flag on all CodeBlocks under
the management of the debugger. This simplifies the op_debug checking
logic in all the execution engines.

  • bytecode/CodeBlock.cpp:
  • bytecode/CodeBlock.h:

(JSC::CodeBlock::hasDebuggerRequests):
(JSC::CodeBlock::debuggerRequestsAddress):
(JSC::CodeBlock::setSteppingMode):
(JSC::CodeBlock::clearDebuggerRequests):

  • CodeBlock::m_debuggerRequests is a union of m_numBreakpoints and the new m_steppingMode. The debugger can add/remove breakpoints to the CodeBlock as well as set the stepping mode. By having m_debuggerRequests as a union of the 2 bit fields, the op_debug code can now check if any of the 2 requests made on the CodeBlock is still in effect just by testing a single int.
  • debugger/Debugger.cpp:

(JSC::Debugger::Debugger):
(JSC::Debugger::detach):

  • This was bug from before where I forgot to clear the CodeBlock breakpoints before detaching. We now take care of it by clearing all debugger requests made to the CodeBlock.

(JSC::Debugger::SetSteppingModeFunctor::SetSteppingModeFunctor):
(JSC::Debugger::SetSteppingModeFunctor::operator()):
(JSC::Debugger::setSteppingMode):
(JSC::Debugger::ClearCodeBlockDebuggerRequestsFunctor::ClearCodeBlockDebuggerRequestsFunctor):
(JSC::Debugger::ClearCodeBlockDebuggerRequestsFunctor::operator()):
(JSC::Debugger::clearBreakpoints):

(JSC::Debugger::ClearDebuggerRequestsFunctor::ClearDebuggerRequestsFunctor):
(JSC::Debugger::ClearDebuggerRequestsFunctor::operator()):
(JSC::Debugger::clearDebuggerRequests):

  • We need a distinct clearDebuggerRequests() from clearBreakpoints() because:
    1. When we detach a globalObject, we only want to clear the debugger requests in CodeBlocks from that global.
    2. Clearing the debugger requests in the CodeBlocks is not the same as clearing the breakpoints. The breakpoints are still in effect for the next time a globalObject is attached, or for other globalObjects that are still attached.

(JSC::Debugger::setPauseOnNextStatement):
(JSC::Debugger::breakProgram):
(JSC::Debugger::stepIntoStatement):
(JSC::Debugger::updateCallFrameAndPauseIfNeeded):
(JSC::Debugger::pauseIfNeeded):
(JSC::Debugger::exception):
(JSC::Debugger::willExecuteProgram):
(JSC::Debugger::didReachBreakpoint):

  • debugger/Debugger.h:
  • We're always going to support the debugger. So, there's no longer a need to check ENABLE(JAVASCRIPT_DEBUGGER). Removed the unneeded code.
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::compile):

  • interpreter/Interpreter.cpp:

(JSC::Interpreter::debug):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_debug):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_debug):

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

(JSC::JSGlobalObject::setDebugger):

Location:
trunk/Source/JavaScriptCore/jit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp

    r162598 r162711  
    711711void JIT::emit_op_debug(Instruction* currentInstruction)
    712712{
    713 #if ENABLE(DEBUG_WITH_BREAKPOINT)
    714     UNUSED_PARAM(currentInstruction);
    715     breakpoint();
    716 #elif ENABLE(JAVASCRIPT_DEBUGGER)
    717     JSGlobalObject* globalObject = codeBlock()->globalObject();
    718     char* debuggerAddress = reinterpret_cast<char*>(globalObject) + JSGlobalObject::debuggerOffset();
    719     Jump noDebugger = branchTestPtr(Zero, AbsoluteAddress(debuggerAddress));
    720 
    721     Debugger* debugger = globalObject->debugger();
    722     char* shouldPauseAddress = reinterpret_cast<char*>(debugger) + Debugger::shouldPauseOffset();
    723     Jump callbackNeeded = branchTest8(NonZero, AbsoluteAddress(shouldPauseAddress));
    724 
    725     char* numBreakpointsAddress = reinterpret_cast<char*>(codeBlock()) + CodeBlock::numBreakpointsOffset();
    726     load32(numBreakpointsAddress, regT0);
    727     Jump noBreakpointSet = branchTest32(Zero, regT0);
    728 
    729     callbackNeeded.link(this);
     713    load32(codeBlock()->debuggerRequestsAddress(), regT0);
     714    Jump noDebuggerRequests = branchTest32(Zero, regT0);
    730715    callOperation(operationDebug, currentInstruction[1].u.operand);
    731 
    732     noBreakpointSet.link(this);
    733     noDebugger.link(this);
    734 #else
    735     UNUSED_PARAM(currentInstruction);
    736 #endif
     716    noDebuggerRequests.link(this);
    737717}
    738718
  • trunk/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp

    r162598 r162711  
    993993void JIT::emit_op_debug(Instruction* currentInstruction)
    994994{
    995 #if ENABLE(DEBUG_WITH_BREAKPOINT)
    996     UNUSED_PARAM(currentInstruction);
    997     breakpoint();
    998 #elif ENABLE(JAVASCRIPT_DEBUGGER)
    999     JSGlobalObject* globalObject = codeBlock()->globalObject();
    1000     char* debuggerAddress = reinterpret_cast<char*>(globalObject) + JSGlobalObject::debuggerOffset();
    1001     loadPtr(debuggerAddress, regT0);
    1002     Jump noDebugger = branchTestPtr(Zero, regT0);
    1003 
    1004     Debugger* debugger = globalObject->debugger();
    1005     char* shouldPauseAddress = reinterpret_cast<char*>(debugger) + Debugger::shouldPauseOffset();
    1006     Jump callbackNeeded = branchTest8(NonZero, AbsoluteAddress(shouldPauseAddress));
    1007 
    1008     char* numBreakpointsAddress = reinterpret_cast<char*>(codeBlock()) + CodeBlock::numBreakpointsOffset();
    1009     load32(numBreakpointsAddress, regT0);
    1010     Jump noBreakpointSet = branchTest32(Zero, regT0);
    1011 
    1012     callbackNeeded.link(this);
     995    load32(codeBlock()->debuggerRequestsAddress(), regT0);
     996    Jump noDebuggerRequests = branchTest32(Zero, regT0);
    1013997    callOperation(operationDebug, currentInstruction[1].u.operand);
    1014 
    1015     noBreakpointSet.link(this);
    1016     noDebugger.link(this);
    1017 #else
    1018     UNUSED_PARAM(currentInstruction);
    1019 #endif
     998    noDebuggerRequests.link(this);
    1020999}
    10211000
Note: See TracChangeset for help on using the changeset viewer.