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/runtime/JSGlobalData.h

    r46598 r47022  
    3434#include "JITStubs.h"
    3535#include "JSValue.h"
     36#include "MarkStack.h"
    3637#include "SmallStrings.h"
    3738#include "TimeoutChecker.h"
     
    9899        RefPtr<Structure> notAnObjectErrorStubStructure;
    99100        RefPtr<Structure> notAnObjectStructure;
     101        RefPtr<Structure> propertyNameIteratorStructure;
     102        RefPtr<Structure> getterSetterStructure;
     103        RefPtr<Structure> apiWrapperStructure;
     104
    100105#if USE(JSVALUE32)
    101106        RefPtr<Structure> numberStructure;
     
    144149        Stringifier* firstStringifierToMark;
    145150
     151        MarkStack markStack;
    146152    private:
    147153        JSGlobalData(bool isShared, const VPtrSet&);
Note: See TracChangeset for help on using the changeset viewer.