Ignore:
Timestamp:
Jan 24, 2014, 3:44:50 PM (11 years ago)
Author:
[email protected]
Message:

ASSERT(!m_markedSpace.m_currentDelayedReleaseScope) reloading page in inspector.
<https://webkit.org/b/127582>

Reviewed by Mark Hahnenberg.

Source/JavaScriptCore:

  1. We should not enter a HeapIterationScope when we iterate the CodeBlocks. Apparently, iterating the CodeBlocks does not count as heap iteration.
  1. If we're detaching the debugger due to the JSGlobalObject destructing, then we don't need to clear the debugger requests in the associated CodeBlocks. The JSGlobalObject destructing would mean that those CodeBlocks would be destructing too, and it may not be safe to access them anyway at this point.

The assertion failure is because we had entered a HeapIterationScope
while the JSGlobalObject is destructing, which in turn means that GC
sweeping is in progress. It's not legal to iterate the heap while the GC
is sweeping. Once we fixed the above 2 issues, we will no longer have
the conditions that manifests this assertion failure.

  • debugger/Debugger.cpp:

(JSC::Debugger::detach):
(JSC::Debugger::setSteppingMode):
(JSC::Debugger::toggleBreakpoint):
(JSC::Debugger::clearBreakpoints):
(JSC::Debugger::clearDebuggerRequests):

  • debugger/Debugger.h:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::~JSGlobalObject):

Source/WebCore:

No new tests.

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::attachDebugger):

  • bindings/js/WorkerScriptController.cpp:

(WebCore::WorkerScriptController::detachDebugger):

  • Adding reasons for detaching a globalObject from the debugger.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r162720 r162735  
    177177}
    178178
    179 void Debugger::detach(JSGlobalObject* globalObject)
     179void Debugger::detach(JSGlobalObject* globalObject, ReasonForDetach reason)
    180180{
    181181    // If we're detaching from the currently executing global object, manually tear down our
     
    191191    m_globalObjects.remove(globalObject);
    192192
    193     clearDebuggerRequests(globalObject);
     193    // If the globalObject is destructing, then its CodeBlocks will also be
     194    // destructed. There is no need to do the debugger requests clean up, and
     195    // it is not safe to access those CodeBlocks at this time anyway.
     196    if (reason != GlobalObjectIsDestructing)
     197        clearDebuggerRequests(globalObject);
     198
    194199    globalObject->setDebugger(0);
    195200    if (!m_globalObjects.size())
     
    229234    if (!m_vm)
    230235        return;
    231     HeapIterationScope iterationScope(m_vm->heap);
    232236    SetSteppingModeFunctor functor(this, mode);
    233237    m_vm->heap.forEachCodeBlock(functor);
     
    314318    if (!m_vm)
    315319        return;
    316     HeapIterationScope iterationScope(m_vm->heap);
    317320    ToggleBreakpointFunctor functor(this, breakpoint, enabledOrNot);
    318321    m_vm->heap.forEachCodeBlock(functor);
     
    494497    if (!m_vm)
    495498        return;
    496     HeapIterationScope iterationScope(m_vm->heap);
    497499    ClearCodeBlockDebuggerRequestsFunctor functor(this);
    498500    m_vm->heap.forEachCodeBlock(functor);
     
    520522{
    521523    ASSERT(m_vm);
    522     HeapIterationScope iterationScope(m_vm->heap);
    523524    ClearDebuggerRequestsFunctor functor(globalObject);
    524525    m_vm->heap.forEachCodeBlock(functor);
Note: See TracChangeset for help on using the changeset viewer.