Changeset 96432 in webkit for trunk/Source/JavaScriptCore/heap
- Timestamp:
- Sep 30, 2011, 3:23:33 PM (14 years ago)
- Location:
- trunk/Source/JavaScriptCore/heap
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/AllocationSpace.cpp
r96372 r96432 56 56 AllocationEffort allocationEffort; 57 57 58 if (m_markedSpace.waterMark() < m_markedSpace.highWaterMark() || !m_heap->m_isSafeToCollect) 58 if (( 59 #if ENABLE(GGC) 60 m_markedSpace.nurseryWaterMark() < m_heap->m_minBytesPerCycle 61 #else 62 m_markedSpace.waterMark() < m_markedSpace.highWaterMark() 63 #endif 64 ) || !m_heap->m_isSafeToCollect) 59 65 allocationEffort = AllocationMustSucceed; 60 66 else -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r96372 r96432 215 215 : m_heapSize(heapSize) 216 216 , m_minBytesPerCycle(heapSizeForHint(heapSize)) 217 , m_lastFullGCSize(0) 217 218 , m_operationInProgress(NoOperation) 218 219 , m_objectSpace(this) … … 454 455 } 455 456 456 void Heap::markRoots() 457 { 457 void Heap::markRoots(bool fullGC) 458 { 459 UNUSED_PARAM(fullGC); 458 460 ASSERT(isValidThreadState(m_globalData)); 459 461 if (m_operationInProgress != NoOperation) … … 474 476 #if ENABLE(GGC) 475 477 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) 478 if (!fullGC) 479 479 m_objectSpace.gatherDirtyCells(dirtyCells); 480 480 else … … 487 487 488 488 #if ENABLE(GGC) 489 for (size_t i = 0; i < dirtyObjectCount; i++) { 489 size_t dirtyCellCount = dirtyCells.size(); 490 for (size_t i = 0; i < dirtyCellCount; i++) { 490 491 heapRootVisitor.visitChildren(dirtyCells[i]); 491 492 visitor.drain(); … … 600 601 ASSERT(m_isSafeToCollect); 601 602 JAVASCRIPTCORE_GC_BEGIN(); 602 603 bool fullGC = sweepToggle == DoSweep; 604 if (!fullGC) 605 fullGC = (capacity() > 4 * m_lastFullGCSize); 603 606 canonicalizeCellLivenessData(); 604 markRoots(); 607 608 markRoots(fullGC); 605 609 606 610 harvestWeakReferences(); … … 622 626 // new bytes allocated) proportion, and seems to work well in benchmarks. 623 627 size_t proportionalBytes = 2 * size(); 628 if (fullGC) 629 m_lastFullGCSize = proportionalBytes / 2; 630 624 631 m_objectSpace.setHighWaterMark(max(proportionalBytes, m_minBytesPerCycle)); 625 632 JAVASCRIPTCORE_GC_END(); -
trunk/Source/JavaScriptCore/heap/Heap.h
r96372 r96432 145 145 146 146 void clearMarks(); 147 void markRoots( );147 void markRoots(bool fullGC); 148 148 void markProtectedObjects(HeapRootVisitor&); 149 149 void markTempSortVectors(HeapRootVisitor&); … … 165 165 const HeapSize m_heapSize; 166 166 const size_t m_minBytesPerCycle; 167 size_t m_lastFullGCSize; 167 168 168 169 OperationInProgress m_operationInProgress; -
trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp
r96424 r96432 33 33 MarkedSpace::MarkedSpace(Heap* heap) 34 34 : m_waterMark(0) 35 , m_nurseryWaterMark(0) 35 36 , m_highWaterMark(0) 36 37 , m_heap(heap) … … 64 65 { 65 66 m_waterMark = 0; 67 m_nurseryWaterMark = 0; 66 68 67 69 for (size_t cellSize = preciseStep; cellSize <= preciseCutoff; cellSize += preciseStep) -
trunk/Source/JavaScriptCore/heap/MarkedSpace.h
r96424 r96432 73 73 size_t waterMark(); 74 74 size_t highWaterMark(); 75 size_t nurseryWaterMark(); 75 76 void setHighWaterMark(size_t); 76 77 … … 92 93 FixedArray<SizeClass, impreciseCount> m_impreciseSizeClasses; 93 94 size_t m_waterMark; 95 size_t m_nurseryWaterMark; 94 96 size_t m_highWaterMark; 95 97 Heap* m_heap; … … 104 106 { 105 107 return m_highWaterMark; 108 } 109 110 inline size_t MarkedSpace::nurseryWaterMark() 111 { 112 return m_nurseryWaterMark; 106 113 } 107 114 … … 127 134 if (firstFreeCell) 128 135 break; 129 136 m_nurseryWaterMark += block->capacity() - block->size(); 130 137 m_waterMark += block->capacity(); 131 138 block->didConsumeFreeList();
Note:
See TracChangeset
for help on using the changeset viewer.