Ignore:
Timestamp:
Aug 10, 2009, 9:35:02 PM (16 years ago)
Author:
[email protected]
Message:

Stack overflow crash in JavaScript garbage collector mark pass
https://bugs.webkit.org/show_bug.cgi?id=12216

Reviewed by Gavin Barraclough and Sam Weinig

Make the GC mark phase iterative by using an explicit mark stack.
To do this marking any single object is performed in multiple stages

  • The object is appended to the MarkStack, this sets the marked bit for the object using the new markDirect() function, and then returns
  • When the MarkStack is drain()ed the object is popped off the stack and markChildren(MarkStack&) is called on the object to collect all of its children. drain() then repeats until the stack is empty.

Additionally I renamed a number of methods from 'mark' to 'markAggregate'
in order to make it more clear that marking of those object was not
going to result in an actual recursive mark.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/parser/Nodes.cpp

    r46598 r47022  
    18191819}
    18201820
    1821 void ScopeNodeData::mark()
     1821void ScopeNodeData::markAggregate(MarkStack& markStack)
    18221822{
    18231823    FunctionStack::iterator end = m_functionStack.end();
     
    18261826        if (!body->isGenerated())
    18271827            continue;
    1828         body->generatedBytecode().mark();
     1828        body->generatedBytecode().markAggregate(markStack);
    18291829    }
    18301830}
     
    19731973}
    19741974
    1975 void EvalNode::mark()
     1975void EvalNode::markAggregate(MarkStack& markStack)
    19761976{
    19771977    // We don't need to mark our own CodeBlock as the JSGlobalObject takes care of that
    1978     data()->mark();
     1978    data()->markAggregate(markStack);
    19791979}
    19801980
     
    20312031}
    20322032
    2033 void FunctionBodyNode::mark()
     2033void FunctionBodyNode::markAggregate(MarkStack& markStack)
    20342034{
    20352035    if (m_code)
    2036         m_code->mark();
     2036        m_code->markAggregate(markStack);
    20372037}
    20382038
Note: See TracChangeset for help on using the changeset viewer.