Changeset 226885 in webkit
- Timestamp:
- Jan 12, 2018 4:16:12 AM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r226881 r226885 1 2018-01-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 [JSC] Create parallel SlotVisitors apriori 4 https://bugs.webkit.org/show_bug.cgi?id=180907 5 6 Reviewed by Saam Barati. 7 8 The number of SlotVisitors are capped with the number of HeapHelperPool's threads + 2. 9 If we create these SlotVisitors apropri, we do not need to create SlotVisitors dynamically. 10 Then we do not need to grab locks while iterating all the SlotVisitors. 11 12 In addition, we do not need to consider the case that the number of SlotVisitors increases 13 after setting up VisitCounters in MarkingConstraintSolver since the number of SlotVisitors 14 does not increase any more. 15 16 * heap/Heap.cpp: 17 (JSC::Heap::Heap): 18 (JSC::Heap::runBeginPhase): 19 * heap/Heap.h: 20 * heap/HeapInlines.h: 21 (JSC::Heap::forEachSlotVisitor): 22 (JSC::Heap::numberOfSlotVisitors): Deleted. 23 * heap/MarkingConstraintSolver.cpp: 24 (JSC::MarkingConstraintSolver::didVisitSomething const): 25 1 26 2018-01-12 Saam Barati <sbarati@apple.com> 2 27 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r226822 r226885 315 315 { 316 316 m_worldState.store(0); 317 318 for (unsigned i = 0, numberOfParallelThreads = heapHelperPool().numberOfThreads(); i < numberOfParallelThreads; ++i) { 319 std::unique_ptr<SlotVisitor> visitor = std::make_unique<SlotVisitor>(*this, toCString("P", i + 1)); 320 if (Options::optimizeParallelSlotVisitorsForStoppedMutator()) 321 visitor->optimizeForStoppedMutator(); 322 m_availableParallelSlotVisitors.append(visitor.get()); 323 m_parallelSlotVisitors.append(WTFMove(visitor)); 324 } 317 325 318 326 if (Options::useConcurrentGC()) { … … 1240 1248 { 1241 1249 LockHolder locker(m_parallelSlotVisitorLock); 1242 if (m_availableParallelSlotVisitors.isEmpty()) { 1243 std::unique_ptr<SlotVisitor> newVisitor = std::make_unique<SlotVisitor>( 1244 *this, toCString("P", m_parallelSlotVisitors.size() + 1)); 1245 1246 if (Options::optimizeParallelSlotVisitorsForStoppedMutator()) 1247 newVisitor->optimizeForStoppedMutator(); 1248 1249 newVisitor->didStartMarking(); 1250 1251 slotVisitor = newVisitor.get(); 1252 m_parallelSlotVisitors.append(WTFMove(newVisitor)); 1253 } else 1254 slotVisitor = m_availableParallelSlotVisitors.takeLast(); 1250 RELEASE_ASSERT_WITH_MESSAGE(!m_availableParallelSlotVisitors.isEmpty(), "Parallel SlotVisitors are allocated apriori"); 1251 slotVisitor = m_availableParallelSlotVisitors.takeLast(); 1255 1252 } 1256 1253 -
trunk/Source/JavaScriptCore/heap/Heap.h
r226822 r226885 373 373 template<typename Func> 374 374 void forEachSlotVisitor(const Func&); 375 unsigned numberOfSlotVisitors();376 375 377 376 private: -
trunk/Source/JavaScriptCore/heap/HeapInlines.h
r226783 r226885 263 263 void Heap::forEachSlotVisitor(const Func& func) 264 264 { 265 auto locker = holdLock(m_parallelSlotVisitorLock);266 265 func(*m_collectorSlotVisitor); 267 266 func(*m_mutatorSlotVisitor); … … 270 269 } 271 270 272 inline unsigned Heap::numberOfSlotVisitors()273 {274 auto locker = holdLock(m_parallelSlotVisitorLock);275 return m_parallelSlotVisitors.size() + 2; // m_collectorSlotVisitor and m_mutatorSlotVisitor276 }277 278 271 } // namespace JSC -
trunk/Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp
r226783 r226885 52 52 return true; 53 53 } 54 // If the number of SlotVisitors increases after creating m_visitCounters,55 // we conservatively say there could be something visited by added SlotVisitors.56 if (m_heap.numberOfSlotVisitors() > m_visitCounters.size())57 return true;58 54 return false; 59 55 } -
trunk/Source/JavaScriptCore/heap/SlotVisitor.h
r226783 r226885 237 237 MarkingConstraintSolver* m_currentSolver { nullptr }; 238 238 239 // Put padding here to mitigate false sharing between multiple SlotVisitors. 240 char padding[64]; 239 241 public: 240 242 #if !ASSERT_DISABLED
Note: See TracChangeset
for help on using the changeset viewer.