Ignore:
Timestamp:
Sep 29, 2011, 3:52:45 PM (14 years ago)
Author:
[email protected]
Message:

Add logic to collect dirty objects as roots
https://bugs.webkit.org/show_bug.cgi?id=69100

Reviewed by Geoff Garen.

This gives us the ability to walk all the MarkedBlocks in an
AllocationSpace and collect the dirty objects, and then use
them as GC roots.

  • dfg/DFGJITCodeGenerator.cpp:

(JSC::DFG::JITCodeGenerator::markCellCard):

  • dfg/DFGJITCodeGenerator32_64.cpp:

(JSC::DFG::JITCodeGenerator::markCellCard):

  • heap/AllocationSpace.cpp:

Tidy up the write barrier logic a bit

(JSC::MarkedBlock::gatherDirtyObjects):
(JSC::TakeIfDirty::returnValue):
(JSC::TakeIfDirty::TakeIfDirty):
(JSC::TakeIfDirty::operator()):
(JSC::AllocationSpace::gatherDirtyObjects):

  • heap/AllocationSpace.h:
  • heap/CardSet.h:

(JSC::::isCardMarked):
(JSC::::clearCard):

  • heap/Heap.cpp:

(JSC::Heap::markRoots):

  • heap/Heap.h:

(JSC::Heap::writeBarrier):

  • heap/MarkStack.cpp:

(JSC::SlotVisitor::visitChildren):

  • heap/MarkedBlock.h:

(JSC::MarkedBlock::setDirtyObject):
(JSC::MarkedBlock::addressOfCardFor):

  • heap/SlotVisitor.h:
  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emitWriteBarrier):

Tidy the write barrier a bit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r95912 r96372  
    472472    registerFile().gatherConservativeRoots(registerFileRoots, m_jettisonedCodeBlocks);
    473473    m_jettisonedCodeBlocks.deleteUnmarkedCodeBlocks();
    474 
    475     clearMarks();
     474#if ENABLE(GGC)
     475    MarkedBlock::DirtyCellVector dirtyCells;
     476    // Until we have a sensible policy we just random choose to perform
     477    // young generation collections 90% of the time.
     478    if (WTF::randomNumber() > 0.1)
     479        m_objectSpace.gatherDirtyCells(dirtyCells);
     480    else
     481#endif
     482        clearMarks();
     483
    476484
    477485    SlotVisitor& visitor = m_slotVisitor;
    478486    HeapRootVisitor heapRootVisitor(visitor);
    479    
     487
     488#if ENABLE(GGC)
     489    for (size_t i = 0; i < dirtyObjectCount; i++) {
     490        heapRootVisitor.visitChildren(dirtyCells[i]);
     491        visitor.drain();
     492    }
     493#endif
     494
    480495    visitor.append(machineThreadRoots);
    481496    visitor.drain();
Note: See TracChangeset for help on using the changeset viewer.