Changeset 190217 in webkit
- Timestamp:
- Sep 24, 2015 1:13:07 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r190215 r190217 1 2015-09-23 Filip Pizlo <fpizlo@apple.com> 2 3 Remove special case code for the no-parallel-GC case 4 https://bugs.webkit.org/show_bug.cgi?id=149512 5 6 Reviewed by Mark Lam. 7 8 Make serial GC just a parallel GC where the helper threads don't do anything. Also make the 9 idle thread calculation a bit more explicit. 10 11 The main outcome is that we no longer use Options::numberOfGCMarkers() as much, so the code is 12 resilient against the number of GC markers changing. 13 14 * heap/Heap.h: 15 * heap/SlotVisitor.cpp: 16 (JSC::SlotVisitor::donateKnownParallel): 17 (JSC::SlotVisitor::drain): 18 (JSC::SlotVisitor::drainFromShared): 19 1 20 2015-09-23 Filip Pizlo <fpizlo@apple.com> 2 21 -
trunk/Source/JavaScriptCore/heap/Heap.h
r190179 r190217 429 429 MarkStackArray m_sharedMarkStack; 430 430 unsigned m_numberOfActiveParallelMarkers { 0 }; 431 unsigned m_numberOfWaitingParallelMarkers { 0 }; 431 432 bool m_parallelMarkersShouldExit { false }; 432 433 -
trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp
r190151 r190217 148 148 m_stack.donateSomeCellsTo(m_heap.m_sharedMarkStack); 149 149 150 if (m_heap.m_numberOfActiveParallelMarkers < Options::numberOfGCMarkers()) 151 m_heap.m_markingConditionVariable.notifyAll(); 150 m_heap.m_markingConditionVariable.notifyAll(); 152 151 } 153 152 … … 157 156 ASSERT(m_isInParallelMode); 158 157 159 if (Options::numberOfGCMarkers() > 1) {160 while (!m_stack.isEmpty()) {161 m_stack.refill();162 for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); m_stack.canRemoveLast() && countdown--;)163 visitChildren(*this, m_stack.removeLast());164 donateKnownParallel();165 }166 167 mergeOpaqueRootsIfNecessary();168 return;169 }170 171 158 while (!m_stack.isEmpty()) { 172 159 m_stack.refill(); 173 while (m_stack.canRemoveLast())160 for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); m_stack.canRemoveLast() && countdown--;) 174 161 visitChildren(*this, m_stack.removeLast()); 175 } 162 donateKnownParallel(); 163 } 164 165 mergeOpaqueRootsIfNecessary(); 176 166 } 177 167 … … 183 173 ASSERT(Options::numberOfGCMarkers()); 184 174 185 bool shouldBeParallel;186 187 shouldBeParallel = Options::numberOfGCMarkers() > 1;188 189 if (!shouldBeParallel) {190 // This call should be a no-op.191 ASSERT_UNUSED(sharedDrainMode, sharedDrainMode == MasterDrain);192 ASSERT(m_stack.isEmpty());193 ASSERT(m_heap.m_sharedMarkStack.isEmpty());194 return;195 }196 197 175 { 198 176 std::lock_guard<Lock> lock(m_heap.m_markingMutex); … … 203 181 std::unique_lock<Lock> lock(m_heap.m_markingMutex); 204 182 m_heap.m_numberOfActiveParallelMarkers--; 183 m_heap.m_numberOfWaitingParallelMarkers++; 205 184 206 185 // How we wait differs depending on drain mode. … … 210 189 while (true) { 211 190 // Did we reach termination? 212 if (!m_heap.m_numberOfActiveParallelMarkers && m_heap.m_sharedMarkStack.isEmpty()) { 191 if (!m_heap.m_numberOfActiveParallelMarkers 192 && m_heap.m_sharedMarkStack.isEmpty()) { 213 193 // Let any sleeping slaves know it's time for them to return; 214 194 m_heap.m_markingConditionVariable.notifyAll(); … … 227 207 228 208 // Did we detect termination? If so, let the master know. 229 if (!m_heap.m_numberOfActiveParallelMarkers && m_heap.m_sharedMarkStack.isEmpty()) 209 if (!m_heap.m_numberOfActiveParallelMarkers 210 && m_heap.m_sharedMarkStack.isEmpty()) 230 211 m_heap.m_markingConditionVariable.notifyAll(); 231 212 232 m_heap.m_markingConditionVariable.wait(lock, [this] { return !m_heap.m_sharedMarkStack.isEmpty() || m_heap.m_parallelMarkersShouldExit; }); 213 m_heap.m_markingConditionVariable.wait( 214 lock, 215 [this] { 216 return !m_heap.m_sharedMarkStack.isEmpty() 217 || m_heap.m_parallelMarkersShouldExit; 218 }); 233 219 234 220 // Is the current phase done? If so, return from this function. … … 237 223 } 238 224 239 size_t idleThreadCount = Options::numberOfGCMarkers() - m_heap.m_numberOfActiveParallelMarkers;240 m_stack.stealSomeCellsFrom(m_heap.m_sharedMarkStack, idleThreadCount);225 m_stack.stealSomeCellsFrom( 226 m_heap.m_sharedMarkStack, m_heap.m_numberOfWaitingParallelMarkers); 241 227 m_heap.m_numberOfActiveParallelMarkers++; 228 m_heap.m_numberOfWaitingParallelMarkers--; 242 229 } 243 230
Note: See TracChangeset
for help on using the changeset viewer.