Changeset 124123 in webkit for trunk/Source/JavaScriptCore/heap/IncrementalSweeper.cpp
- Timestamp:
- Jul 30, 2012, 5:33:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/IncrementalSweeper.cpp
r121381 r124123 70 70 } 71 71 72 bool IncrementalSweeper::structuresCanBeSwept() 73 { 74 ASSERT(m_currentBlockToSweepIndex <= m_blocksToSweep.size()); 75 return !m_blocksToSweep.size() || m_currentBlockToSweepIndex >= m_blocksToSweep.size(); 76 } 77 72 78 void IncrementalSweeper::doSweep(double sweepBeginTime) 73 79 { 74 80 while (m_currentBlockToSweepIndex < m_blocksToSweep.size()) { 75 MarkedBlock* block = m_blocksToSweep[m_currentBlockToSweepIndex++]; 81 MarkedBlock* block = m_blocksToSweep[m_currentBlockToSweepIndex]; 82 if (block->onlyContainsStructures()) { 83 m_currentBlockToSweepIndex++; 84 continue; 85 } 86 87 m_blocksToSweep[m_currentBlockToSweepIndex++] = 0; 88 89 if (!block->needsSweeping()) 90 continue; 91 92 block->sweep(); 93 m_globalData->heap.objectSpace().freeOrShrinkBlock(block); 94 95 CFTimeInterval elapsedTime = WTF::monotonicallyIncreasingTime() - sweepBeginTime; 96 if (elapsedTime < sweepTimeSlice) 97 continue; 98 99 scheduleTimer(); 100 return; 101 } 102 103 while (m_currentStructureBlockToSweepIndex < m_blocksToSweep.size()) { 104 MarkedBlock* block = m_blocksToSweep[m_currentStructureBlockToSweepIndex]; 105 if (!block) { 106 m_currentStructureBlockToSweepIndex++; 107 continue; 108 } 109 110 m_blocksToSweep[m_currentStructureBlockToSweepIndex++] = 0; 111 76 112 if (!block->needsSweeping()) 77 113 continue; … … 96 132 WTF::copyToVector(blockSnapshot, m_blocksToSweep); 97 133 m_currentBlockToSweepIndex = 0; 134 m_currentStructureBlockToSweepIndex = 0; 98 135 scheduleTimer(); 136 } 137 138 void IncrementalSweeper::willFinishSweeping() 139 { 140 m_currentBlockToSweepIndex = m_currentStructureBlockToSweepIndex = 0; 141 m_blocksToSweep.clear(); 142 if (m_globalData) 143 cancelTimer(); 99 144 } 100 145 … … 103 148 IncrementalSweeper::IncrementalSweeper(JSGlobalData* globalData) 104 149 : HeapTimer(globalData) 150 , m_structuresCanBeSwept(false) 105 151 { 106 152 } … … 115 161 } 116 162 163 bool IncrementalSweeper::structuresCanBeSwept() 164 { 165 return m_structuresCanBeSwept; 166 } 167 117 168 void IncrementalSweeper::startSweeping(const HashSet<MarkedBlock*>&) 118 169 { 170 m_structuresCanBeSwept = false; 119 171 } 120 172 173 void IncrementalSweeper::willFinishSweeping() 174 { 175 m_structuresCanBeSwept = true; 176 } 177 121 178 #endif 122 179
Note:
See TracChangeset
for help on using the changeset viewer.