Ignore:
Timestamp:
Jan 9, 2014, 6:28:27 PM (11 years ago)
Author:
[email protected]
Message:

Marking should be generational
https://bugs.webkit.org/show_bug.cgi?id=126552

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Re-marking the same objects over and over is a waste of effort. This patch implements
the sticky mark bit algorithm (along with our already-present write barriers) to reduce
overhead during garbage collection caused by rescanning objects.

There are now two collection modes, EdenCollection and FullCollection. EdenCollections
only visit new objects or objects that were added to the remembered set by a write barrier.
FullCollections are normal collections that visit all objects regardless of their
generation.

In this patch EdenCollections do not do anything in CopiedSpace. This will be fixed in
https://bugs.webkit.org/show_bug.cgi?id=126555.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::visitAggregate):

  • bytecode/CodeBlock.h:

(JSC::CodeBlockSet::mark):

  • dfg/DFGOperations.cpp:
  • heap/CodeBlockSet.cpp:

(JSC::CodeBlockSet::add):
(JSC::CodeBlockSet::traceMarked):
(JSC::CodeBlockSet::rememberCurrentlyExecutingCodeBlocks):

  • heap/CodeBlockSet.h:
  • heap/CopiedBlockInlines.h:

(JSC::CopiedBlock::reportLiveBytes):

  • heap/CopiedSpace.cpp:

(JSC::CopiedSpace::didStartFullCollection):

  • heap/CopiedSpace.h:

(JSC::CopiedSpace::heap):

  • heap/Heap.cpp:

(JSC::Heap::Heap):
(JSC::Heap::didAbandon):
(JSC::Heap::markRoots):
(JSC::Heap::copyBackingStores):
(JSC::Heap::addToRememberedSet):
(JSC::Heap::collectAllGarbage):
(JSC::Heap::collect):
(JSC::Heap::didAllocate):
(JSC::Heap::writeBarrier):

  • heap/Heap.h:

(JSC::Heap::isInRememberedSet):
(JSC::Heap::operationInProgress):
(JSC::Heap::shouldCollect):
(JSC::Heap::isCollecting):
(JSC::Heap::isWriteBarrierEnabled):
(JSC::Heap::writeBarrier):

  • heap/HeapOperation.h:
  • heap/MarkStack.cpp:

(JSC::MarkStackArray::~MarkStackArray):
(JSC::MarkStackArray::clear):
(JSC::MarkStackArray::fillVector):

  • heap/MarkStack.h:
  • heap/MarkedAllocator.cpp:

(JSC::isListPagedOut):
(JSC::MarkedAllocator::isPagedOut):
(JSC::MarkedAllocator::tryAllocateHelper):
(JSC::MarkedAllocator::addBlock):
(JSC::MarkedAllocator::removeBlock):
(JSC::MarkedAllocator::reset):

  • heap/MarkedAllocator.h:

(JSC::MarkedAllocator::MarkedAllocator):

  • heap/MarkedBlock.cpp:

(JSC::MarkedBlock::clearMarks):
(JSC::MarkedBlock::clearRememberedSet):
(JSC::MarkedBlock::clearMarksWithCollectionType):
(JSC::MarkedBlock::lastChanceToFinalize):

  • heap/MarkedBlock.h: Changed atomSize to 16 bytes because we have no objects smaller

than 16 bytes. This is also to pay for the additional Bitmap for the remembered set.
(JSC::MarkedBlock::didConsumeEmptyFreeList):
(JSC::MarkedBlock::setRemembered):
(JSC::MarkedBlock::clearRemembered):
(JSC::MarkedBlock::atomicClearRemembered):
(JSC::MarkedBlock::isRemembered):

  • heap/MarkedSpace.cpp:

(JSC::MarkedSpace::~MarkedSpace):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::visitWeakSets):
(JSC::MarkedSpace::reapWeakSets):
(JSC::VerifyMarked::operator()):
(JSC::MarkedSpace::clearMarks):

  • heap/MarkedSpace.h:

(JSC::ClearMarks::operator()):
(JSC::ClearRememberedSet::operator()):
(JSC::MarkedSpace::didAllocateInBlock):
(JSC::MarkedSpace::clearRememberedSet):

  • heap/SlotVisitor.cpp:

(JSC::SlotVisitor::~SlotVisitor):
(JSC::SlotVisitor::clearMarkStack):

  • heap/SlotVisitor.h:

(JSC::SlotVisitor::markStack):
(JSC::SlotVisitor::sharedData):

  • heap/SlotVisitorInlines.h:

(JSC::SlotVisitor::internalAppend):
(JSC::SlotVisitor::unconditionallyAppend):
(JSC::SlotVisitor::copyLater):
(JSC::SlotVisitor::reportExtraMemoryUsage):
(JSC::SlotVisitor::heap):

  • jit/Repatch.cpp:
  • runtime/JSGenericTypedArrayViewInlines.h:

(JSC::JSGenericTypedArrayView<Adaptor>::visitChildren):

  • runtime/JSPropertyNameIterator.h:

(JSC::StructureRareData::setEnumerationCache):

  • runtime/JSString.cpp:

(JSC::JSString::visitChildren):

  • runtime/StructureRareDataInlines.h:

(JSC::StructureRareData::setPreviousID):
(JSC::StructureRareData::setObjectToStringValue):

  • runtime/WeakMapData.cpp:

(JSC::WeakMapData::visitChildren):

Source/WTF:

  • wtf/Bitmap.h:

(WTF::WordType>::count): Added a cast that became necessary when Bitmap
is used with smaller types than int32_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r161585 r161615  
     12014-01-07  Mark Hahnenberg  <[email protected]>
     2
     3        Marking should be generational
     4        https://bugs.webkit.org/show_bug.cgi?id=126552
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Re-marking the same objects over and over is a waste of effort. This patch implements
     9        the sticky mark bit algorithm (along with our already-present write barriers) to reduce
     10        overhead during garbage collection caused by rescanning objects.
     11
     12        There are now two collection modes, EdenCollection and FullCollection. EdenCollections
     13        only visit new objects or objects that were added to the remembered set by a write barrier.
     14        FullCollections are normal collections that visit all objects regardless of their
     15        generation.
     16
     17        In this patch EdenCollections do not do anything in CopiedSpace. This will be fixed in
     18        https://bugs.webkit.org/show_bug.cgi?id=126555.
     19
     20        * bytecode/CodeBlock.cpp:
     21        (JSC::CodeBlock::visitAggregate):
     22        * bytecode/CodeBlock.h:
     23        (JSC::CodeBlockSet::mark):
     24        * dfg/DFGOperations.cpp:
     25        * heap/CodeBlockSet.cpp:
     26        (JSC::CodeBlockSet::add):
     27        (JSC::CodeBlockSet::traceMarked):
     28        (JSC::CodeBlockSet::rememberCurrentlyExecutingCodeBlocks):
     29        * heap/CodeBlockSet.h:
     30        * heap/CopiedBlockInlines.h:
     31        (JSC::CopiedBlock::reportLiveBytes):
     32        * heap/CopiedSpace.cpp:
     33        (JSC::CopiedSpace::didStartFullCollection):
     34        * heap/CopiedSpace.h:
     35        (JSC::CopiedSpace::heap):
     36        * heap/Heap.cpp:
     37        (JSC::Heap::Heap):
     38        (JSC::Heap::didAbandon):
     39        (JSC::Heap::markRoots):
     40        (JSC::Heap::copyBackingStores):
     41        (JSC::Heap::addToRememberedSet):
     42        (JSC::Heap::collectAllGarbage):
     43        (JSC::Heap::collect):
     44        (JSC::Heap::didAllocate):
     45        (JSC::Heap::writeBarrier):
     46        * heap/Heap.h:
     47        (JSC::Heap::isInRememberedSet):
     48        (JSC::Heap::operationInProgress):
     49        (JSC::Heap::shouldCollect):
     50        (JSC::Heap::isCollecting):
     51        (JSC::Heap::isWriteBarrierEnabled):
     52        (JSC::Heap::writeBarrier):
     53        * heap/HeapOperation.h:
     54        * heap/MarkStack.cpp:
     55        (JSC::MarkStackArray::~MarkStackArray):
     56        (JSC::MarkStackArray::clear):
     57        (JSC::MarkStackArray::fillVector):
     58        * heap/MarkStack.h:
     59        * heap/MarkedAllocator.cpp:
     60        (JSC::isListPagedOut):
     61        (JSC::MarkedAllocator::isPagedOut):
     62        (JSC::MarkedAllocator::tryAllocateHelper):
     63        (JSC::MarkedAllocator::addBlock):
     64        (JSC::MarkedAllocator::removeBlock):
     65        (JSC::MarkedAllocator::reset):
     66        * heap/MarkedAllocator.h:
     67        (JSC::MarkedAllocator::MarkedAllocator):
     68        * heap/MarkedBlock.cpp:
     69        (JSC::MarkedBlock::clearMarks):
     70        (JSC::MarkedBlock::clearRememberedSet):
     71        (JSC::MarkedBlock::clearMarksWithCollectionType):
     72        (JSC::MarkedBlock::lastChanceToFinalize):
     73        * heap/MarkedBlock.h: Changed atomSize to 16 bytes because we have no objects smaller
     74        than 16 bytes. This is also to pay for the additional Bitmap for the remembered set.
     75        (JSC::MarkedBlock::didConsumeEmptyFreeList):
     76        (JSC::MarkedBlock::setRemembered):
     77        (JSC::MarkedBlock::clearRemembered):
     78        (JSC::MarkedBlock::atomicClearRemembered):
     79        (JSC::MarkedBlock::isRemembered):
     80        * heap/MarkedSpace.cpp:
     81        (JSC::MarkedSpace::~MarkedSpace):
     82        (JSC::MarkedSpace::resetAllocators):
     83        (JSC::MarkedSpace::visitWeakSets):
     84        (JSC::MarkedSpace::reapWeakSets):
     85        (JSC::VerifyMarked::operator()):
     86        (JSC::MarkedSpace::clearMarks):
     87        * heap/MarkedSpace.h:
     88        (JSC::ClearMarks::operator()):
     89        (JSC::ClearRememberedSet::operator()):
     90        (JSC::MarkedSpace::didAllocateInBlock):
     91        (JSC::MarkedSpace::clearRememberedSet):
     92        * heap/SlotVisitor.cpp:
     93        (JSC::SlotVisitor::~SlotVisitor):
     94        (JSC::SlotVisitor::clearMarkStack):
     95        * heap/SlotVisitor.h:
     96        (JSC::SlotVisitor::markStack):
     97        (JSC::SlotVisitor::sharedData):
     98        * heap/SlotVisitorInlines.h:
     99        (JSC::SlotVisitor::internalAppend):
     100        (JSC::SlotVisitor::unconditionallyAppend):
     101        (JSC::SlotVisitor::copyLater):
     102        (JSC::SlotVisitor::reportExtraMemoryUsage):
     103        (JSC::SlotVisitor::heap):
     104        * jit/Repatch.cpp:
     105        * runtime/JSGenericTypedArrayViewInlines.h:
     106        (JSC::JSGenericTypedArrayView<Adaptor>::visitChildren):
     107        * runtime/JSPropertyNameIterator.h:
     108        (JSC::StructureRareData::setEnumerationCache):
     109        * runtime/JSString.cpp:
     110        (JSC::JSString::visitChildren):
     111        * runtime/StructureRareDataInlines.h:
     112        (JSC::StructureRareData::setPreviousID):
     113        (JSC::StructureRareData::setObjectToStringValue):
     114        * runtime/WeakMapData.cpp:
     115        (JSC::WeakMapData::visitChildren):
     116
    11172014-01-09  Joseph Pecoraro  <[email protected]>
    2118
Note: See TracChangeset for help on using the changeset viewer.