Changeset 162711 in webkit


Ignore:
Timestamp:
Jan 24, 2014 11:07:31 AM (10 years ago)
Author:
mark.lam@apple.com
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
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r162701 r162711  
     12014-01-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Removing the need for Debugger* and m_shouldPause op_debug check.
     4        <https://webkit.org/b/127532>
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        This patch replaces the checking of the Debugger::m_shouldPause flag
     9        with a procedure to set a SteppingMode flag on all CodeBlocks under
     10        the management of the debugger. This simplifies the op_debug checking
     11        logic in all the execution engines.
     12
     13        * bytecode/CodeBlock.cpp:
     14        * bytecode/CodeBlock.h:
     15        (JSC::CodeBlock::hasDebuggerRequests):
     16        (JSC::CodeBlock::debuggerRequestsAddress):
     17        (JSC::CodeBlock::setSteppingMode):
     18        (JSC::CodeBlock::clearDebuggerRequests):
     19        - CodeBlock::m_debuggerRequests is a union of m_numBreakpoints and the
     20          new m_steppingMode. The debugger can add/remove breakpoints to the
     21          CodeBlock as well as set the stepping mode. By having
     22          m_debuggerRequests as a union of the 2 bit fields, the op_debug code
     23          can now check if any of the 2 requests made on the CodeBlock is still
     24          in effect just by testing a single int.
     25
     26        * debugger/Debugger.cpp:
     27        (JSC::Debugger::Debugger):
     28        (JSC::Debugger::detach):
     29        - This was bug from before where I forgot to clear the CodeBlock
     30          breakpoints before detaching. We now take care of it by clearing all
     31          debugger requests made to the CodeBlock.
     32
     33        (JSC::Debugger::SetSteppingModeFunctor::SetSteppingModeFunctor):
     34        (JSC::Debugger::SetSteppingModeFunctor::operator()):
     35        (JSC::Debugger::setSteppingMode):
     36        (JSC::Debugger::ClearCodeBlockDebuggerRequestsFunctor::ClearCodeBlockDebuggerRequestsFunctor):
     37        (JSC::Debugger::ClearCodeBlockDebuggerRequestsFunctor::operator()):
     38        (JSC::Debugger::clearBreakpoints):
     39
     40        (JSC::Debugger::ClearDebuggerRequestsFunctor::ClearDebuggerRequestsFunctor):
     41        (JSC::Debugger::ClearDebuggerRequestsFunctor::operator()):
     42        (JSC::Debugger::clearDebuggerRequests):
     43        - We need a distinct clearDebuggerRequests() from clearBreakpoints()
     44          because:
     45          1. When we detach a globalObject, we only want to clear the debugger
     46             requests in CodeBlocks from that global.
     47          2. Clearing the debugger requests in the CodeBlocks is not the same
     48             as clearing the breakpoints. The breakpoints are still in effect
     49             for the next time a globalObject is attached, or for other
     50             globalObjects that are still attached.
     51
     52        (JSC::Debugger::setPauseOnNextStatement):
     53        (JSC::Debugger::breakProgram):
     54        (JSC::Debugger::stepIntoStatement):
     55        (JSC::Debugger::updateCallFrameAndPauseIfNeeded):
     56        (JSC::Debugger::pauseIfNeeded):
     57        (JSC::Debugger::exception):
     58        (JSC::Debugger::willExecuteProgram):
     59        (JSC::Debugger::didReachBreakpoint):
     60        * debugger/Debugger.h:
     61        - We're always going to support the debugger. So, there's no longer
     62          a need to check ENABLE(JAVASCRIPT_DEBUGGER). Removed the unneeded code.
     63
     64        * dfg/DFGSpeculativeJIT32_64.cpp:
     65        (JSC::DFG::SpeculativeJIT::compile):
     66        * dfg/DFGSpeculativeJIT64.cpp:
     67        (JSC::DFG::SpeculativeJIT::compile):
     68        * interpreter/Interpreter.cpp:
     69        (JSC::Interpreter::debug):
     70        * jit/JITOpcodes.cpp:
     71        (JSC::JIT::emit_op_debug):
     72        * jit/JITOpcodes32_64.cpp:
     73        (JSC::JIT::emit_op_debug):
     74        * llint/LowLevelInterpreter.asm:
     75        * runtime/JSGlobalObject.h:
     76        (JSC::JSGlobalObject::setDebugger):
     77
    1782014-01-24  Michael Saboff  <msaboff@apple.com>
    279
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r162598 r162711  
    14701470    , m_didFailFTLCompilation(false)
    14711471    , m_unlinkedCode(*other.m_vm, other.m_ownerExecutable.get(), other.m_unlinkedCode.get())
     1472    , m_steppingMode(SteppingModeDisabled)
    14721473    , m_numBreakpoints(0)
    14731474    , m_ownerExecutable(*other.m_vm, other.m_ownerExecutable.get(), other.m_ownerExecutable.get())
     
    15251526    , m_didFailFTLCompilation(false)
    15261527    , m_unlinkedCode(m_globalObject->vm(), ownerExecutable, unlinkedCodeBlock)
     1528    , m_steppingMode(SteppingModeDisabled)
    15271529    , m_numBreakpoints(0)
    15281530    , m_ownerExecutable(m_globalObject->vm(), ownerExecutable, ownerExecutable)
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r162652 r162711  
    872872    bool hasOpDebugForLineAndColumn(unsigned line, unsigned column);
    873873
    874     int numBreakpoints() const { return m_numBreakpoints; }
    875     static ptrdiff_t numBreakpointsOffset() { return OBJECT_OFFSETOF(CodeBlock, m_numBreakpoints); }
    876     void* numBreakpointsAddress() { return &m_numBreakpoints; }
    877 
    878     void addBreakpoint(int numBreakpoints) { m_numBreakpoints += numBreakpoints; }
    879     void removeBreakpoint(int numBreakpoints)
    880     {
     874    int hasDebuggerRequests() const { return !!m_debuggerRequests; }
     875    void* debuggerRequestsAddress() { return &m_debuggerRequests; }
     876
     877    void addBreakpoint(unsigned numBreakpoints) { m_numBreakpoints += numBreakpoints; }
     878    void removeBreakpoint(unsigned numBreakpoints)
     879    {
     880        ASSERT(m_numBreakpoints > numBreakpoints);
    881881        m_numBreakpoints -= numBreakpoints;
    882         ASSERT(m_numBreakpoints >= 0);
    883     }
    884     void clearAllBreakpoints() { m_numBreakpoints = 0; }
     882    }
     883
     884    enum SteppingMode {
     885        SteppingModeDisabled,
     886        SteppingModeEnabled
     887    };
     888    void setSteppingMode(SteppingMode mode) { m_steppingMode = mode; }
     889
     890    void clearDebuggerRequests() { m_debuggerRequests = 0; }
    885891
    886892    // FIXME: Make these remaining members private.
     
    10201026    WriteBarrier<UnlinkedCodeBlock> m_unlinkedCode;
    10211027    int m_numParameters;
    1022     int m_numBreakpoints;
     1028    union {
     1029        unsigned m_debuggerRequests;
     1030        struct {
     1031            unsigned m_steppingMode : 1;
     1032            unsigned m_numBreakpoints : 31;
     1033        };
     1034    };
    10231035    WriteBarrier<ScriptExecutable> m_ownerExecutable;
    10241036    VM* m_vm;
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r162652 r162711  
    149149    , m_hasHandlerForExceptionCallback(false)
    150150    , m_isInWorkerThread(isInWorkerThread)
     151    , m_steppingMode(SteppingModeDisabled)
    151152    , m_reasonForPause(NotPaused)
    152153    , m_pauseOnCallFrame(0)
     
    155156    , m_lastExecutedSourceID(noSourceID)
    156157    , m_topBreakpointID(noBreakpointID)
    157     , m_shouldPause(false)
    158158{
    159159}
     
    190190    ASSERT(m_globalObjects.contains(globalObject));
    191191    m_globalObjects.remove(globalObject);
     192
     193    clearDebuggerRequests(globalObject);
    192194    globalObject->setDebugger(0);
    193195    if (!m_globalObjects.size())
     
    195197}
    196198
    197 void Debugger::setShouldPause(bool value)
    198 {
    199     m_shouldPause = value;
     199class Debugger::SetSteppingModeFunctor {
     200public:
     201    SetSteppingModeFunctor(Debugger* debugger, SteppingMode mode)
     202        : m_debugger(debugger)
     203        , m_mode(mode)
     204    {
     205    }
     206
     207    bool operator()(CodeBlock* codeBlock)
     208    {
     209        if (m_debugger == codeBlock->globalObject()->debugger()) {
     210            if (m_mode == SteppingModeEnabled)
     211                codeBlock->setSteppingMode(CodeBlock::SteppingModeEnabled);
     212            else
     213                codeBlock->setSteppingMode(CodeBlock::SteppingModeDisabled);
     214        }
     215        return false;
     216    }
     217
     218private:
     219    Debugger* m_debugger;
     220    SteppingMode m_mode;
     221};
     222
     223void Debugger::setSteppingMode(SteppingMode mode)
     224{
     225    if (mode == m_steppingMode)
     226        return;
     227    m_steppingMode = mode;
     228
     229    if (!m_vm)
     230        return;
     231    HeapIterationScope iterationScope(m_vm->heap);
     232    SetSteppingModeFunctor functor(this, mode);
     233    m_vm->heap.forEachCodeBlock(functor);
    200234}
    201235
     
    203237{
    204238    applyBreakpoints(codeBlock);
    205 }
    206 
    207 void Debugger::unregisterCodeBlock(CodeBlock* codeBlock)
    208 {
    209     codeBlock->clearAllBreakpoints();
     239    if (isStepping())
     240        codeBlock->setSteppingMode(CodeBlock::SteppingModeEnabled);
    210241}
    211242
     
    436467}
    437468
    438 class Debugger::ClearBreakpointsFunctor {
     469class Debugger::ClearCodeBlockDebuggerRequestsFunctor {
    439470public:
    440     ClearBreakpointsFunctor(Debugger* debugger)
     471    ClearCodeBlockDebuggerRequestsFunctor(Debugger* debugger)
    441472        : m_debugger(debugger)
    442473    {
     
    445476    bool operator()(CodeBlock* codeBlock)
    446477    {
    447         if (codeBlock->numBreakpoints() && m_debugger == codeBlock->globalObject()->debugger())
    448             codeBlock->clearAllBreakpoints();
     478        if (codeBlock->hasDebuggerRequests() && m_debugger == codeBlock->globalObject()->debugger())
     479            codeBlock->clearDebuggerRequests();
    449480        return false;
    450481    }
     
    463494        return;
    464495    HeapIterationScope iterationScope(m_vm->heap);
    465     ClearBreakpointsFunctor functor(this);
     496    ClearCodeBlockDebuggerRequestsFunctor functor(this);
     497    m_vm->heap.forEachCodeBlock(functor);
     498}
     499
     500class Debugger::ClearDebuggerRequestsFunctor {
     501public:
     502    ClearDebuggerRequestsFunctor(JSGlobalObject* globalObject)
     503        : m_globalObject(globalObject)
     504    {
     505    }
     506
     507    bool operator()(CodeBlock* codeBlock)
     508    {
     509        if (codeBlock->hasDebuggerRequests() && m_globalObject == codeBlock->globalObject())
     510            codeBlock->clearDebuggerRequests();
     511        return false;
     512    }
     513
     514private:
     515    JSGlobalObject* m_globalObject;
     516};
     517
     518void Debugger::clearDebuggerRequests(JSGlobalObject* globalObject)
     519{
     520    ASSERT(m_vm);
     521    HeapIterationScope iterationScope(m_vm->heap);
     522    ClearDebuggerRequestsFunctor functor(globalObject);
    466523    m_vm->heap.forEachCodeBlock(functor);
    467524}
     
    481538    m_pauseOnNextStatement = pause;
    482539    if (pause)
    483         setShouldPause(true);
     540        setSteppingMode(SteppingModeEnabled);
    484541}
    485542
     
    490547
    491548    m_pauseOnNextStatement = true;
    492     setShouldPause(true);
     549    setSteppingMode(SteppingModeEnabled);
    493550    m_currentCallFrame = m_vm->topCallFrame;
    494551    ASSERT(m_currentCallFrame);
     
    511568
    512569    m_pauseOnNextStatement = true;
    513     setShouldPause(true);
     570    setSteppingMode(SteppingModeEnabled);
    514571    notifyDoneProcessingDebuggerEvents();
    515572}
     
    547604    updateCallFrame(callFrame);
    548605    pauseIfNeeded(callFrame);
    549     if (!shouldPause())
     606    if (!isStepping())
    550607        m_currentCallFrame = 0;
    551608}
     
    591648
    592649    if (!m_pauseOnNextStatement && !m_pauseOnCallFrame) {
    593         setShouldPause(false);
     650        setSteppingMode(SteppingModeDisabled);
    594651        m_currentCallFrame = nullptr;
    595652    }
     
    604661    if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler)) {
    605662        m_pauseOnNextStatement = true;
    606         setShouldPause(true);
     663        setSteppingMode(SteppingModeEnabled);
    607664    }
    608665
     
    662719    if (!m_isInWorkerThread)
    663720        updateCallFrameAndPauseIfNeeded(callFrame);
    664     else if (shouldPause())
     721    else if (isStepping())
    665722        updateCallFrame(callFrame);
    666723}
     
    692749    PauseReasonDeclaration reason(*this, PausedForBreakpoint);
    693750    m_pauseOnNextStatement = true;
    694     setShouldPause(true);
     751    setSteppingMode(SteppingModeEnabled);
    695752    updateCallFrameAndPauseIfNeeded(callFrame);
    696753}
  • trunk/Source/JavaScriptCore/debugger/Debugger.h

    r162652 r162711  
    4242typedef ExecState CallFrame;
    4343
    44 #if ENABLE(JAVASCRIPT_DEBUGGER)
    45 
    4644class JS_EXPORT_PRIVATE Debugger {
    4745public:
    4846    Debugger(bool isInWorkerThread = false);
    4947    virtual ~Debugger();
    50 
    51     bool shouldPause() const { return m_shouldPause; }
    52     static ptrdiff_t shouldPauseOffset() { return OBJECT_OFFSETOF(Debugger, m_shouldPause); }
    53     void* shouldPauseAddress() { return &m_shouldPause; }
    5448
    5549    JSC::DebuggerCallFrame* currentDebuggerCallFrame() const;
     
    107101
    108102    void registerCodeBlock(CodeBlock*);
    109     void unregisterCodeBlock(CodeBlock*);
    110103
    111104protected:
     
    135128    typedef HashMap<SourceID, LineToBreakpointsMap, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> SourceIDToBreakpointsMap;
    136129
     130    class ClearCodeBlockDebuggerRequestsFunctor;
     131    class ClearDebuggerRequestsFunctor;
     132    class SetSteppingModeFunctor;
    137133    class ToggleBreakpointFunctor;
    138     class ClearBreakpointsFunctor;
    139134
    140135    class PauseReasonDeclaration {
     
    156151    bool hasBreakpoint(SourceID, const TextPosition&, Breakpoint* hitBreakpoint);
    157152
    158     void setShouldPause(bool);
    159153    void updateNeedForOpDebugCallbacks();
    160154
     
    168162    void pauseIfNeeded(JSC::CallFrame*);
    169163
     164    enum SteppingMode {
     165        SteppingModeDisabled,
     166        SteppingModeEnabled
     167    };
     168    void setSteppingMode(SteppingMode);
     169    bool isStepping() const { return m_steppingMode == SteppingModeEnabled; }
     170
    170171    enum BreakpointState {
    171172        BreakpointDisabled,
     
    175176    void applyBreakpoints(CodeBlock*);
    176177    void toggleBreakpoint(Breakpoint&, BreakpointState);
     178
     179    void clearDebuggerRequests(JSGlobalObject*);
    177180
    178181    VM* m_vm;
     
    185188    bool m_hasHandlerForExceptionCallback : 1;
    186189    bool m_isInWorkerThread : 1;
     190    SteppingMode m_steppingMode : 1;
    187191
    188192    ReasonForPause m_reasonForPause;
     
    197201    SourceIDToBreakpointsMap m_sourceIDToBreakpoints;
    198202
    199     bool m_shouldPause;
    200 
    201203    RefPtr<JSC::DebuggerCallFrame> m_currentDebuggerCallFrame;
    202204
     
    206208};
    207209
    208 #else // ENABLE(JAVASCRIPT_DEBUGGER)
    209 
    210 class Debugger {
    211 public:
    212     Debugger(bool = false)
    213         : m_shouldPause(false)
    214     {
    215     }
    216     bool shouldPause() const { return false; }
    217     bool needsExceptionCallbacks() const { return false; }
    218     void detach(JSGlobalObject*) { }
    219     void sourceParsed(ExecState*, SourceProvider*, int, const WTF::String&) { }
    220     void exception(CallFrame*, JSValue, bool) { }
    221     void atStatement(CallFrame*) { }
    222     void callEvent(CallFrame*) { }
    223     void returnEvent(CallFrame*) { }
    224     void willExecuteProgram(CallFrame*) { }
    225     void didExecuteProgram(CallFrame*) { }
    226     void didReachBreakpoint(CallFrame*) { }
    227 
    228 private:
    229     bool m_shouldPause;
    230 };
    231 
    232 #endif // ENABLE(JAVASCRIPT_DEBUGGER)
    233 
    234210} // namespace JSC
    235211
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r162652 r162711  
    42344234
    42354235    case Breakpoint: {
    4236         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(m_currentNode->codeOrigin);
    42374236        GPRTemporary temp(this);
    4238         m_jit.loadPtr(globalObject->debuggerAddress(), temp.gpr());
     4237        GPRReg debuggerRequestsGPR = temp.gpr();
     4238        m_jit.load32(m_jit.codeBlock()->debuggerRequestsAddress(), debuggerRequestsGPR);
    42394239        speculationCheck(
    42404240            DebuggerEvent, JSValueRegs(), 0,
    4241             m_jit.branchTestPtr(JITCompiler::Zero, temp.gpr()));
    4242 
    4243         ASSERT(globalObject->hasDebugger());
    4244         speculationCheck(
    4245             DebuggerEvent, JSValueRegs(), 0,
    4246             m_jit.branchTest8(
    4247                 JITCompiler::NonZero,
    4248                 JITCompiler::AbsoluteAddress(globalObject->debugger()->shouldPauseAddress())));
    4249 
    4250         GPRReg numBreakpointsGPR = temp.gpr();
    4251         m_jit.load32(m_jit.codeBlock()->numBreakpointsAddress(), numBreakpointsGPR);
    4252         speculationCheck(
    4253             DebuggerEvent, JSValueRegs(), 0,
    4254             m_jit.branchTest32(JITCompiler::NonZero, numBreakpointsGPR));
    4255         break;
    4256     }
    4257        
     4241            m_jit.branchTest32(JITCompiler::NonZero, debuggerRequestsGPR));
     4242        break;
     4243    }
     4244
    42584245    case ProfileWillCall: {
    42594246        JSValueOperand profile(this, node->child1());
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r162652 r162711  
    45114511
    45124512    case Breakpoint: {
    4513         JSGlobalObject* globalObject = m_jit.graph().globalObjectFor(m_currentNode->codeOrigin);
     4513        GPRTemporary temp(this);
     4514        GPRReg debuggerRequestsGPR = temp.gpr();
     4515        m_jit.load32(m_jit.codeBlock()->debuggerRequestsAddress(), debuggerRequestsGPR);
    45144516        speculationCheck(
    45154517            DebuggerEvent, JSValueRegs(), 0,
    4516             m_jit.branchTestPtr(
    4517                 JITCompiler::Zero,
    4518                 JITCompiler::AbsoluteAddress(globalObject->debuggerAddress())));
    4519 
    4520         ASSERT(globalObject->hasDebugger());
    4521         speculationCheck(
    4522             DebuggerEvent, JSValueRegs(), 0,
    4523             m_jit.branchTest8(
    4524                 JITCompiler::NonZero,
    4525                 JITCompiler::AbsoluteAddress(globalObject->debugger()->shouldPauseAddress())));
    4526 
    4527         GPRTemporary temp(this);
    4528         GPRReg numBreakpointsGPR = temp.gpr();
    4529         m_jit.load32(m_jit.codeBlock()->numBreakpointsAddress(), numBreakpointsGPR);
    4530         speculationCheck(
    4531             DebuggerEvent, JSValueRegs(), 0,
    4532             m_jit.branchTest32(JITCompiler::NonZero, numBreakpointsGPR));
    4533         break;
    4534     }
    4535        
     4518            m_jit.branchTest32(JITCompiler::NonZero, debuggerRequestsGPR));
     4519        break;
     4520    }
     4521
    45364522    case ProfileWillCall: {
    45374523        JSValueOperand profile(this, node->child1());
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r162598 r162711  
    12081208    if (!debugger)
    12091209        return;
    1210     ASSERT(debugger->shouldPause() || callFrame->codeBlock()->numBreakpoints() || callFrame->hadException());
     1210    ASSERT(callFrame->codeBlock()->hasDebuggerRequests() || callFrame->hadException());
    12111211
    12121212    switch (debugHookID) {
  • 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
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r162598 r162711  
    836836_llint_op_debug:
    837837    traceExecution()
    838     loadp CodeBlock[cfr], t1
    839     loadp CodeBlock::m_globalObject[t1], t0
    840     loadp JSGlobalObject::m_debugger[t0], t0
     838    loadp CodeBlock[cfr], t0
     839    loadi CodeBlock::m_debuggerRequests[t0], t0
    841840    btiz t0, .opDebugDone
    842 
    843     loadb Debugger::m_shouldPause[t0], t0
    844     btbnz t0, .opDebugDoCallback
    845 
    846     loadi CodeBlock::m_numBreakpoints[t1], t0
    847     btiz t0, .opDebugDone
    848 
    849 .opDebugDoCallback:
    850841    callSlowPath(_llint_slow_path_debug)
    851842.opDebugDone:                   
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r162652 r162711  
    473473    Debugger* debugger() const { return m_debugger; }
    474474    void setDebugger(Debugger* debugger) { m_debugger = debugger; }
    475     static ptrdiff_t debuggerOffset() { return OBJECT_OFFSETOF(JSGlobalObject, m_debugger); }
    476     void* debuggerAddress() { return &m_debugger; }
    477475
    478476    const GlobalObjectMethodTable* globalObjectMethodTable() const { return m_globalObjectMethodTable; }
Note: See TracChangeset for help on using the changeset viewer.