Changeset 242070 in webkit
- Timestamp:
- Feb 25, 2019, 9:37:52 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
-
ChangeLog (modified) (1 diff)
-
heap/Heap.cpp (modified) (2 diffs)
-
heap/Heap.h (modified) (1 diff)
-
heap/HeapInlines.h (modified) (2 diffs)
-
heap/MarkingConstraintSolver.cpp (modified) (1 diff)
-
heap/SlotVisitor.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r242068 r242070 1 2019-02-25 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Revert r226885 to make SlotVisitor creation lazy 4 https://bugs.webkit.org/show_bug.cgi?id=195013 5 6 Reviewed by Saam Barati. 7 8 We once changed SlotVisitor creation apriori to drop the lock. Also, it turns out that SlotVisitor is memory-consuming. 9 We should defer SlotVisitor creation until it is actually required. This patch reverts r226885. Even with this patch, 10 we still hold many SlotVisitors after we execute many parallel markers at least once. But recovering the feature of 11 dynamically allocating SlotVisitors helps further memory optimizations in this area. 12 13 * heap/Heap.cpp: 14 (JSC::Heap::Heap): 15 (JSC::Heap::runBeginPhase): 16 * heap/Heap.h: 17 * heap/HeapInlines.h: 18 (JSC::Heap::forEachSlotVisitor): 19 (JSC::Heap::numberOfSlotVisitors): 20 * heap/MarkingConstraintSolver.cpp: 21 (JSC::MarkingConstraintSolver::didVisitSomething const): 22 * heap/SlotVisitor.h: 23 1 24 2019-02-25 Saam Barati <sbarati@apple.com> 2 25 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r241927 r242070 301 301 { 302 302 m_worldState.store(0); 303 304 for (unsigned i = 0, numberOfParallelThreads = heapHelperPool().numberOfThreads(); i < numberOfParallelThreads; ++i) {305 std::unique_ptr<SlotVisitor> visitor = std::make_unique<SlotVisitor>(*this, toCString("P", i + 1));306 if (Options::optimizeParallelSlotVisitorsForStoppedMutator())307 visitor->optimizeForStoppedMutator();308 m_availableParallelSlotVisitors.append(visitor.get());309 m_parallelSlotVisitors.append(WTFMove(visitor));310 }311 303 312 304 if (Options::useConcurrentGC()) { … … 1262 1254 { 1263 1255 LockHolder locker(m_parallelSlotVisitorLock); 1264 RELEASE_ASSERT_WITH_MESSAGE(!m_availableParallelSlotVisitors.isEmpty(), "Parallel SlotVisitors are allocated apriori"); 1265 slotVisitor = m_availableParallelSlotVisitors.takeLast(); 1256 if (m_availableParallelSlotVisitors.isEmpty()) { 1257 std::unique_ptr<SlotVisitor> newVisitor = std::make_unique<SlotVisitor>( 1258 *this, toCString("P", m_parallelSlotVisitors.size() + 1)); 1259 1260 if (Options::optimizeParallelSlotVisitorsForStoppedMutator()) 1261 newVisitor->optimizeForStoppedMutator(); 1262 1263 newVisitor->didStartMarking(); 1264 1265 slotVisitor = newVisitor.get(); 1266 m_parallelSlotVisitors.append(WTFMove(newVisitor)); 1267 } else 1268 slotVisitor = m_availableParallelSlotVisitors.takeLast(); 1266 1269 } 1267 1270 -
trunk/Source/JavaScriptCore/heap/Heap.h
r241849 r242070 394 394 template<typename Func> 395 395 void forEachSlotVisitor(const Func&); 396 unsigned numberOfSlotVisitors(); 396 397 397 398 Seconds totalGCTime() const { return m_totalGCTime; } -
trunk/Source/JavaScriptCore/heap/HeapInlines.h
r241927 r242070 276 276 void Heap::forEachSlotVisitor(const Func& func) 277 277 { 278 auto locker = holdLock(m_parallelSlotVisitorLock); 278 279 func(*m_collectorSlotVisitor); 279 280 func(*m_mutatorSlotVisitor); … … 282 283 } 283 284 285 inline unsigned Heap::numberOfSlotVisitors() 286 { 287 auto locker = holdLock(m_parallelSlotVisitorLock); 288 return m_parallelSlotVisitors.size() + 2; // m_collectorSlotVisitor and m_mutatorSlotVisitor 289 } 290 284 291 } // namespace JSC -
trunk/Source/JavaScriptCore/heap/MarkingConstraintSolver.cpp
r239427 r242070 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; 54 58 return false; 55 59 } -
trunk/Source/JavaScriptCore/heap/SlotVisitor.h
r240449 r242070 260 260 MarkingConstraintSolver* m_currentSolver { nullptr }; 261 261 262 // Put padding here to mitigate false sharing between multiple SlotVisitors.263 char padding[64];264 262 public: 265 263 #if !ASSERT_DISABLED
Note:
See TracChangeset
for help on using the changeset viewer.