Skip to content

Commit 5b292ff

Browse files
committed
[JSC] Rename the GC's bytes-visited counts to bytes marked and old generation cell bytes
https://bugs.webkit.org/show_bug.cgi?id=327452 rdar://189949396 Reviewed by Yusuke Suzuki. The term "bytes visited" is confusing because a cell is counted only once, when it is first marked. When it is visited again, due to a write barrier or a constraint, it is not counted. So the count is not literally the bytes visited. What it does count is the number of bytes that are newly marked. So rename the SlotVisitor fields and related methods to make it clear that they are accounting marked bytes. Then, what the heap is calculating is also not "total bytes visited". It's accumulating bytes marked to determine the size of the old generation's cells. So, name it accordingly: - Heap::m_totalBytesVisited is now m_oldGenerationCellBytes. - Heap::m_totalBytesVisitedAfterLastFullCollect is now m_oldGenerationCellBytesAtStartOfLastFullCollect. "After" named when it is assigned, at the last Full collection's End, but the value it holds is the old generation as it stood when that collection began. - Heap::recordBytesVisited() is now updateOldGenerationCellBytes(). - Heap::m_bytesVisitedDuringMarking is now m_bytesMarkedThisCycle. SlotVisitor::performIncrementOfDraining() keeps "visited", since it does actually count every cell it visits in order to estimate work. Also document the terminology of the heap sizing fields: what a size counts, and what "before" and "after" a collection and "this cycle" mean. And fix the spelling of m_lastOversidedAllocationThisCycle. No behavior change. * Source/JavaScriptCore/heap/Collector.cpp: (JSC::Collector::runFixpointPhase): (JSC::Collector::runEndPhase): (JSC::Collector::bytesMarked): (JSC::Collector::bytesMarkedPerVisitorDump): (JSC::Collector::bytesVisited): Deleted. (JSC::Collector::bytesVisitedPerVisitorDump): Deleted. * Source/JavaScriptCore/heap/Collector.h: * Source/JavaScriptCore/heap/Heap.cpp: (JSC::Heap::beginMarking): (JSC::Heap::updateOldGenerationCellBytes): (JSC::Heap::endMarking): (JSC::Heap::clearConcurrentRetainedDataIfPossible): (JSC::Heap::recordBytesVisited): Deleted. * Source/JavaScriptCore/heap/Heap.h: (JSC::Heap::reportBytesMarked): (JSC::Heap::reportBytesVisited): Deleted. * Source/JavaScriptCore/heap/SlotVisitor.cpp: (JSC::SlotVisitor::didStartMarking): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::noteLiveAuxiliaryCell): (JSC::SlotVisitor::noteBytesMarked): (JSC::SlotVisitor::flushBytesMarked): (JSC::SlotVisitor::noteBytesVisited): Deleted. (JSC::SlotVisitor::flushBytesVisited): Deleted. * Source/JavaScriptCore/heap/SlotVisitor.h: * Source/JavaScriptCore/runtime/VM.cpp: (JSC::VM::performOpportunisticallyScheduledTasks): Canonical link: https://commits.webkit.org/323735@main
1 parent 73f2c86 commit 5b292ff

7 files changed

Lines changed: 67 additions & 57 deletions

File tree

‎Source/JavaScriptCore/heap/Collector.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ NEVER_INLINE bool Collector::runFixpointPhase(GCConductor conn)
499499

500500
SlotVisitor& visitor = *m_collectorSlotVisitor;
501501

502-
dataLogIf(Options::logGC(), "v=", bytesVisited() / 1024, "kb (", bytesVisitedPerVisitorDump(), ") o=", m_opaqueRoots.size(), " b=", barriersExecuted(), " ");
502+
dataLogIf(Options::logGC(), "v=", bytesMarked() / 1024, "kb (", bytesMarkedPerVisitorDump(), ") o=", m_opaqueRoots.size(), " b=", barriersExecuted(), " ");
503503

504504
if (visitor.didReachTermination()) {
505505
m_opaqueRoots.deleteOldTables();
@@ -627,7 +627,7 @@ NEVER_INLINE bool Collector::runEndPhase(GCConductor conn)
627627
// Each heap's End step reads these counts, so flush them now.
628628
forEachSlotVisitor(
629629
[&](SlotVisitor& visitor) {
630-
visitor.flushBytesVisited();
630+
visitor.flushBytesMarked();
631631
visitor.flushExtraMemoryVisited();
632632
});
633633

@@ -944,23 +944,23 @@ SUPPRESS_NODELETE size_t Collector::totalMaxEdenSize()
944944
return result;
945945
}
946946

947-
size_t Collector::bytesVisited()
947+
size_t Collector::bytesMarked()
948948
{
949949
size_t result = 0;
950950
forEachSlotVisitor(
951951
[&] (SlotVisitor& visitor) {
952-
result += visitor.bytesVisited();
952+
result += visitor.bytesMarked();
953953
});
954954
return result;
955955
}
956956

957-
UTF8CString Collector::bytesVisitedPerVisitorDump()
957+
UTF8CString Collector::bytesMarkedPerVisitorDump()
958958
{
959959
// Every heap's mutator visitor has the same name, so their counts are summed.
960960
UncheckedKeyHashMap<ASCIICString, size_t> visitMap;
961961
forEachSlotVisitor(
962962
[&](SlotVisitor& visitor) {
963-
visitMap.add(visitor.codeName(), 0).iterator->value += visitor.bytesVisited() / 1024;
963+
visitMap.add(visitor.codeName(), 0).iterator->value += visitor.bytesMarked() / 1024;
964964
});
965965
return sortedMapDump(visitMap, std::less<>(), ":"_s, " "_s);
966966
}

‎Source/JavaScriptCore/heap/Collector.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ class Collector {
204204

205205
void assertMarkStacksEmpty();
206206

207-
size_t bytesVisited();
208-
UTF8CString bytesVisitedPerVisitorDump();
207+
size_t bytesMarked();
208+
UTF8CString bytesMarkedPerVisitorDump();
209209

210210
// Summed over the heaps, for logging.
211211
size_t capacity();

‎Source/JavaScriptCore/heap/Heap.cpp‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ void Heap::beginMarking()
786786
TimingScope timingScope(*this, "Heap::beginMarking"_s);
787787
ASSERT(isInPhase(CollectorPhase::Begin));
788788
ASSERT(m_collectionScope);
789-
ASSERT(!m_bytesVisitedDuringMarking.load(std::memory_order_relaxed));
789+
ASSERT(!m_bytesMarkedThisCycle.load(std::memory_order_relaxed));
790790
if (*m_collectionScope == CollectionScope::Full)
791791
m_mutatorMarkStack->clear();
792792
m_jitStubRoutines->clearMarks();
@@ -871,21 +871,21 @@ void Heap::rememberExecutingAndCompilingCodeBlocks()
871871
});
872872
}
873873

874-
void Heap::recordBytesVisited(size_t bytesVisited)
874+
void Heap::updateOldGenerationCellBytes(size_t bytesMarked)
875875
{
876876
if (m_collectionScope && m_collectionScope.value() == CollectionScope::Full) {
877-
m_totalBytesVisitedAfterLastFullCollect = m_totalBytesVisited;
878-
m_totalBytesVisited = 0;
877+
m_oldGenerationCellBytesAtStartOfLastFullCollect = m_oldGenerationCellBytes;
878+
m_oldGenerationCellBytes = 0;
879879
}
880-
m_totalBytesVisited += bytesVisited;
880+
m_oldGenerationCellBytes += bytesMarked;
881881
}
882882

883883
void Heap::endMarking()
884884
{
885885
ASSERT(isInPhase(CollectorPhase::End));
886886
ASSERT(m_objectSpace.isMarking());
887887

888-
recordBytesVisited(m_bytesVisitedDuringMarking.exchange(0, std::memory_order_relaxed));
888+
updateOldGenerationCellBytes(m_bytesMarkedThisCycle.exchange(0, std::memory_order_relaxed));
889889

890890
m_objectSpace.endMarking();
891891
setMutatorShouldBeFenced(Options::forceFencedBarrier());
@@ -1872,20 +1872,20 @@ void Heap::updateAllocationLimits()
18721872
// fragmentation, we may have size() much smaller than capacity().
18731873
size_t currentHeapSize = 0;
18741874

1875-
// For marked space, we use the total number of bytes visited. This matches the logic for
1875+
// For marked space, we use the old generation's cell bytes. This matches the logic for
18761876
// BlockDirectory's calls to didAllocate(), which effectively accounts for the total size of
18771877
// objects allocated rather than blocks used. This will underestimate capacity(), and in case
18781878
// of fragmentation, this may be substantial. Fortunately, marked space rarely fragments because
18791879
// cells usually have a narrow range of sizes. So, the underestimation is probably OK.
1880-
currentHeapSize += m_totalBytesVisited;
1881-
dataLogLnIf(verbose, "totalBytesVisited = ", m_totalBytesVisited, ", currentHeapSize = ", currentHeapSize);
1880+
currentHeapSize += m_oldGenerationCellBytes;
1881+
dataLogLnIf(verbose, "oldGenerationCellBytes = ", m_oldGenerationCellBytes, ", currentHeapSize = ", currentHeapSize);
18821882

18831883
// It's up to the user to ensure that extraMemorySize() ends up corresponding to allocation-time
18841884
// extra memory reporting.
18851885
auto computedExtraMemorySize = extraMemorySize();
18861886
currentHeapSize += computedExtraMemorySize;
18871887
if (ASSERT_ENABLED) {
1888-
CheckedSize checkedCurrentHeapSize = m_totalBytesVisited;
1888+
CheckedSize checkedCurrentHeapSize = m_oldGenerationCellBytes;
18891889
checkedCurrentHeapSize += computedExtraMemorySize;
18901890
ASSERT(!checkedCurrentHeapSize.hasOverflowed() && checkedCurrentHeapSize == currentHeapSize);
18911891
}
@@ -1940,7 +1940,7 @@ void Heap::updateAllocationLimits()
19401940
dataLogLnIf(verbose, "sizeAfterLastCollect = ", m_sizeAfterLastCollect);
19411941
m_nonOversizedBytesAllocatedThisCycle = 0;
19421942
m_oversizedBytesAllocatedThisCycle = 0;
1943-
m_lastOversidedAllocationThisCycle = 0;
1943+
m_lastOversizedAllocationThisCycle = 0;
19441944

19451945
dataLogIf(Options::logGC(), "=> ", currentHeapSize / 1024, "kb, ");
19461946
}
@@ -2019,7 +2019,7 @@ void Heap::didAllocate(size_t bytes)
20192019
{
20202020
if (bytes >= oversizedAllocationThreshold) {
20212021
m_oversizedBytesAllocatedThisCycle += bytes;
2022-
m_lastOversidedAllocationThisCycle = bytes;
2022+
m_lastOversizedAllocationThisCycle = bytes;
20232023
} else
20242024
m_nonOversizedBytesAllocatedThisCycle += bytes;
20252025

@@ -2283,11 +2283,11 @@ void Heap::collectIfNecessaryOrDefer(GCDeferralContext* deferralContext)
22832283
// if the system is cricital or we have a small heap we want to be very agressive about reclaiming memory to reduce overall
22842284
// pressure on the system.
22852285
if (!isCritical && m_heapType == HeapType::Large) {
2286-
if (static_cast<double>(m_lastOversidedAllocationThisCycle) / bytesAllocatedThisCycle > 1.0 / 3.0)
2286+
if (static_cast<double>(m_lastOversizedAllocationThisCycle) / bytesAllocatedThisCycle > 1.0 / 3.0)
22872287
return false;
22882288
}
22892289

2290-
dataLogLnIf(logRequestGC, "Requesting GC because bytes allocated this cycle: ", bytesAllocatedThisCycle, " exceed bytes allowed: ", bytesAllowedThisCycle, ConditionalDump(isCritical, " (critical)"), " normal bytes: ", m_nonOversizedBytesAllocatedThisCycle, " oversized bytes: ", m_oversizedBytesAllocatedThisCycle, " last oversized: ", m_lastOversidedAllocationThisCycle);
2290+
dataLogLnIf(logRequestGC, "Requesting GC because bytes allocated this cycle: ", bytesAllocatedThisCycle, " exceed bytes allowed: ", bytesAllowedThisCycle, ConditionalDump(isCritical, " (critical)"), " normal bytes: ", m_nonOversizedBytesAllocatedThisCycle, " oversized bytes: ", m_oversizedBytesAllocatedThisCycle, " last oversized: ", m_lastOversizedAllocationThisCycle);
22912291
return true;
22922292
};
22932293
if (!shouldRequestGC())

‎Source/JavaScriptCore/heap/Heap.h‎

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class Heap {
421421

422422
void completeAllJITPlans();
423423

424-
void reportBytesVisited(size_t bytes) { m_bytesVisitedDuringMarking.exchangeAdd(bytes, std::memory_order_relaxed); }
424+
void reportBytesMarked(size_t bytes) { m_bytesMarkedThisCycle.exchangeAdd(bytes, std::memory_order_relaxed); }
425425

426426
// Note that:
427427
// 1. Use this API to report non-GC memory referenced by GC objects. Be sure to
@@ -723,7 +723,7 @@ class Heap {
723723
void visitCompilerWorklistWeakReferences();
724724
void removeDeadCompilerWorklistEntries();
725725
void rememberExecutingAndCompilingCodeBlocks();
726-
void recordBytesVisited(size_t bytesVisited);
726+
void updateOldGenerationCellBytes(size_t bytesMarked);
727727
void endMarking();
728728
void verifyHeapAfterMarking();
729729
void pruneDeadReferences();
@@ -800,6 +800,11 @@ class Heap {
800800
const size_t m_minBytesPerCycle;
801801
const size_t m_maxEdenSizeForRateLimiting;
802802
double m_gcRateLimitingValue { 0.0 };
803+
804+
// Sizes count the bytes of cells plus the extra memory they keep alive.
805+
// A size "after" a collection is measured when it ends. A size "before" a collection is estimated
806+
// when it starts: the size after the previous collection plus the bytes allocated since.
807+
// "This cycle" means since the last collection ended.
803808
size_t m_bytesAllocatedBeforeLastEdenCollect { 0 };
804809
size_t m_sizeAfterLastCollect { 0 };
805810
size_t m_sizeAfterLastFullCollect { 0 };
@@ -808,16 +813,21 @@ class Heap {
808813
size_t m_sizeBeforeLastEdenCollect { 0 };
809814

810815
size_t m_oversizedBytesAllocatedThisCycle { 0 };
811-
size_t m_lastOversidedAllocationThisCycle { 0 };
816+
size_t m_lastOversizedAllocationThisCycle { 0 };
812817

813818
size_t m_nonOversizedBytesAllocatedThisCycle { 0 };
814819
size_t m_bytesAbandonedSinceLastFullCollect { 0 };
815820
size_t m_maxEdenSize;
816821
size_t m_maxEdenSizeWhenCritical;
817822
size_t m_maxHeapSize;
818-
size_t m_totalBytesVisitedAfterLastFullCollect { 0 };
819-
size_t m_totalBytesVisited { 0 };
820-
Atomic<size_t> m_bytesVisitedDuringMarking { 0 };
823+
824+
// The old generation's cells, in bytes: those the last Full collection marked, plus those each later
825+
// Eden collection marked. Old cells that die stay counted until the next Full collection.
826+
size_t m_oldGenerationCellBytes { 0 };
827+
size_t m_oldGenerationCellBytesAtStartOfLastFullCollect { 0 };
828+
// Bytes the visitors have marked this cycle, gathered for the End step.
829+
Atomic<size_t> m_bytesMarkedThisCycle { 0 };
830+
821831
double m_incrementBalance { 0 };
822832

823833
bool m_shouldDoOpportunisticFullCollection { false };

‎Source/JavaScriptCore/heap/SlotVisitor.cpp‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ SlotVisitor::~SlotVisitor()
9999
void SlotVisitor::didStartMarking(CollectionScope scope, HeapVersion markingVersion, bool isAnalyzingHeap)
100100
{
101101
// The previous collection's End reset this visitor.
102-
ASSERT(!m_bytesVisitedHeap);
103-
ASSERT(!m_bytesVisitedInHeap);
104-
ASSERT(!m_flushedBytesVisited);
102+
ASSERT(!m_bytesMarkedHeap);
103+
ASSERT(!m_bytesMarkedInHeap);
104+
ASSERT(!m_flushedBytesMarked);
105105
ASSERT(!m_extraMemoryHeap);
106106
ASSERT(!m_extraMemoryInHeap.hasOverflowed() && !m_extraMemoryInHeap);
107107
ASSERT(!m_currentCell);
@@ -113,10 +113,10 @@ void SlotVisitor::reset()
113113
{
114114
Base::reset();
115115
// These counts should have been flushed to each heap by now.
116-
RELEASE_ASSERT(!m_bytesVisitedInHeap);
116+
RELEASE_ASSERT(!m_bytesMarkedInHeap);
117117
RELEASE_ASSERT(!m_extraMemoryInHeap.hasOverflowed() && !m_extraMemoryInHeap);
118-
m_bytesVisitedHeap = nullptr;
119-
m_flushedBytesVisited = 0;
118+
m_bytesMarkedHeap = nullptr;
119+
m_flushedBytesMarked = 0;
120120
m_extraMemoryHeap = nullptr;
121121
RELEASE_ASSERT(!m_currentCell);
122122
}
@@ -291,7 +291,7 @@ ALWAYS_INLINE void SlotVisitor::appendToMarkStack(ContainerType& container, JSCe
291291
container.noteMarked();
292292

293293
m_visitCount++;
294-
noteBytesVisited(container.vm().heap, container.cellSize());
294+
noteBytesMarked(container.vm().heap, container.cellSize());
295295

296296
m_collectorStack.append(cell);
297297
}
@@ -324,26 +324,26 @@ void SlotVisitor::noteLiveAuxiliaryCell(HeapCell* cell)
324324
m_visitCount++;
325325

326326
size_t cellSize = container.cellSize();
327-
noteBytesVisited(container.vm().heap, cellSize);
327+
noteBytesMarked(container.vm().heap, cellSize);
328328
m_nonCellVisitCount += cellSize;
329329
}
330330

331-
ALWAYS_INLINE void SlotVisitor::noteBytesVisited(JSC::Heap& heap, size_t bytes)
331+
ALWAYS_INLINE void SlotVisitor::noteBytesMarked(JSC::Heap& heap, size_t bytes)
332332
{
333-
if (&heap != m_bytesVisitedHeap) [[unlikely]] {
334-
flushBytesVisited();
335-
m_bytesVisitedHeap = &heap;
333+
if (&heap != m_bytesMarkedHeap) [[unlikely]] {
334+
flushBytesMarked();
335+
m_bytesMarkedHeap = &heap;
336336
}
337-
m_bytesVisitedInHeap += bytes;
337+
m_bytesMarkedInHeap += bytes;
338338
}
339339

340-
NEVER_INLINE void SlotVisitor::flushBytesVisited()
340+
NEVER_INLINE void SlotVisitor::flushBytesMarked()
341341
{
342-
if (!m_bytesVisitedInHeap)
342+
if (!m_bytesMarkedInHeap)
343343
return;
344-
m_bytesVisitedHeap->reportBytesVisited(m_bytesVisitedInHeap);
345-
m_flushedBytesVisited += m_bytesVisitedInHeap;
346-
m_bytesVisitedInHeap = 0;
344+
m_bytesMarkedHeap->reportBytesMarked(m_bytesMarkedInHeap);
345+
m_flushedBytesMarked += m_bytesMarkedInHeap;
346+
m_bytesMarkedInHeap = 0;
347347
}
348348

349349
class SetCurrentCellScope {

‎Source/JavaScriptCore/heap/SlotVisitor.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ class alignas(slotVisitorAlignment) SlotVisitor final : public AbstractSlotVisit
133133
void LEGACY_NODELETE reset();
134134
void clearMarkStacks();
135135

136-
size_t bytesVisited() const { return m_flushedBytesVisited + m_bytesVisitedInHeap; }
137-
void flushBytesVisited();
136+
size_t bytesMarked() const { return m_flushedBytesMarked + m_bytesMarkedInHeap; }
137+
void flushBytesMarked();
138138
JS_EXPORT_PRIVATE void flushExtraMemoryVisited();
139139

140140
void donate();
@@ -214,7 +214,7 @@ class alignas(slotVisitorAlignment) SlotVisitor final : public AbstractSlotVisit
214214
void visitChildren(const JSCell*);
215215

216216
void propagateExternalMemoryVisitedIfNecessary();
217-
ALWAYS_INLINE void noteBytesVisited(JSC::Heap&, size_t);
217+
ALWAYS_INLINE void noteBytesMarked(JSC::Heap&, size_t);
218218

219219
void donateKnownParallel();
220220
void donateKnownParallel(MarkStackArray& from, MarkStackArray& to);
@@ -231,11 +231,11 @@ class alignas(slotVisitorAlignment) SlotVisitor final : public AbstractSlotVisit
231231

232232
HeapVersion m_markingVersion;
233233

234-
// Bytes of m_bytesVisitedHeap's cells this visitor marked and has not yet added to that heap's count. Marking a
234+
// Bytes of m_bytesMarkedHeap's cells this visitor marked and has not yet added to that heap's count. Marking a
235235
// cell of another heap flushes it, which is rare since a heap's cells mostly reference their own heap's cells.
236-
size_t m_bytesVisitedInHeap { 0 };
237-
SUPPRESS_FORWARD_DECL_MEMBER JSC::Heap* m_bytesVisitedHeap { nullptr }; // Heap is not refcounted.
238-
size_t m_flushedBytesVisited { 0 }; // What this visitor has added to the heaps' counts, for bytesVisited().
236+
size_t m_bytesMarkedInHeap { 0 };
237+
SUPPRESS_FORWARD_DECL_MEMBER JSC::Heap* m_bytesMarkedHeap { nullptr }; // Heap is not refcounted.
238+
size_t m_flushedBytesMarked { 0 }; // What this visitor has added to the heaps' counts, for bytesMarked().
239239

240240
size_t m_nonCellVisitCount { 0 }; // Used for incremental draining, ignored otherwise.
241241

‎Source/JavaScriptCore/runtime/VM.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,8 +2047,8 @@ void VM::performOpportunisticallyScheduledTasks(ApproximateTime deadline, Option
20472047
static constexpr auto extraDurationToAvoidExceedingDeadlineDuringEdenGC = 1_ms;
20482048

20492049
auto timeSinceFinishingLastFullGC = secondsSinceEpoch - heap.m_lastFullGCEndTime.secondsSinceEpoch();
2050-
if (timeSinceFinishingLastFullGC > minimumDelayBeforeOpportunisticFullGC && heap.m_shouldDoOpportunisticFullCollection && heap.m_totalBytesVisitedAfterLastFullCollect) {
2051-
auto estimatedGCDuration = (heap.lastFullGCLength() * heap.m_totalBytesVisited) / heap.m_totalBytesVisitedAfterLastFullCollect;
2050+
if (timeSinceFinishingLastFullGC > minimumDelayBeforeOpportunisticFullGC && heap.m_shouldDoOpportunisticFullCollection && heap.m_oldGenerationCellBytesAtStartOfLastFullCollect) {
2051+
auto estimatedGCDuration = (heap.lastFullGCLength() * heap.m_oldGenerationCellBytes) / heap.m_oldGenerationCellBytesAtStartOfLastFullCollect;
20522052
if (estimatedGCDuration + extraDurationToAvoidExceedingDeadlineDuringFullGC < remainingTime) {
20532053
dataLogLnIf(verbose, "[OPPORTUNISTIC TASK] FULL", " signpost:(", JSC::activeJSGlobalObjectSignpostIntervalCount.load(), ")");
20542054
heap.collectSync(CollectionScope::Full);
@@ -2060,7 +2060,7 @@ void VM::performOpportunisticallyScheduledTasks(ApproximateTime deadline, Option
20602060
if (timeSinceLastGC > minimumDelayBeforeOpportunisticEdenGC && heap.totalBytesAllocatedThisCycle() && heap.m_bytesAllocatedBeforeLastEdenCollect) {
20612061
auto estimatedGCDuration = (heap.lastEdenGCLength() * heap.totalBytesAllocatedThisCycle()) / heap.m_bytesAllocatedBeforeLastEdenCollect;
20622062
if (estimatedGCDuration + extraDurationToAvoidExceedingDeadlineDuringEdenGC < remainingTime) {
2063-
dataLogLnIf(verbose, "[OPPORTUNISTIC TASK] EDEN: ", timeSinceFinishingLastFullGC, " ", timeSinceLastGC, " ", heap.m_shouldDoOpportunisticFullCollection, " ", heap.m_totalBytesVisitedAfterLastFullCollect, " ", heap.totalBytesAllocatedThisCycle(), " ", heap.m_bytesAllocatedBeforeLastEdenCollect, " ", heap.m_lastGCEndTime, " ", heap.m_currentGCStartTime, " ", (heap.lastFullGCLength() * heap.m_totalBytesVisited) / heap.m_totalBytesVisitedAfterLastFullCollect, " ", remainingTime, " ", (heap.lastEdenGCLength() * heap.totalBytesAllocatedThisCycle()) / heap.m_bytesAllocatedBeforeLastEdenCollect, " signpost:(", JSC::activeJSGlobalObjectSignpostIntervalCount.load(), ")");
2063+
dataLogLnIf(verbose, "[OPPORTUNISTIC TASK] EDEN: ", timeSinceFinishingLastFullGC, " ", timeSinceLastGC, " ", heap.m_shouldDoOpportunisticFullCollection, " ", heap.m_oldGenerationCellBytesAtStartOfLastFullCollect, " ", heap.totalBytesAllocatedThisCycle(), " ", heap.m_bytesAllocatedBeforeLastEdenCollect, " ", heap.m_lastGCEndTime, " ", heap.m_currentGCStartTime, " ", (heap.lastFullGCLength() * heap.m_oldGenerationCellBytes) / heap.m_oldGenerationCellBytesAtStartOfLastFullCollect, " ", remainingTime, " ", (heap.lastEdenGCLength() * heap.totalBytesAllocatedThisCycle()) / heap.m_bytesAllocatedBeforeLastEdenCollect, " signpost:(", JSC::activeJSGlobalObjectSignpostIntervalCount.load(), ")");
20642064
heap.collectSync(CollectionScope::Eden);
20652065
return;
20662066
} else if (estimatedGCDuration < 2 * remainingTime) {
@@ -2071,7 +2071,7 @@ void VM::performOpportunisticallyScheduledTasks(ApproximateTime deadline, Option
20712071
}
20722072
}
20732073

2074-
dataLogLnIf(verbose, "[OPPORTUNISTIC TASK] GaveUp: nothing met. ", timeSinceFinishingLastFullGC, " ", timeSinceLastGC, " ", heap.m_shouldDoOpportunisticFullCollection, " ", heap.m_totalBytesVisitedAfterLastFullCollect, " ", heap.totalBytesAllocatedThisCycle(), " ", heap.m_bytesAllocatedBeforeLastEdenCollect, " ", heap.m_lastGCEndTime, " ", heap.m_currentGCStartTime, " ", (heap.lastFullGCLength() * heap.m_totalBytesVisited) / heap.m_totalBytesVisitedAfterLastFullCollect, " ", remainingTime, " ", (heap.lastEdenGCLength() * heap.totalBytesAllocatedThisCycle()) / heap.m_bytesAllocatedBeforeLastEdenCollect, " signpost:(", JSC::activeJSGlobalObjectSignpostIntervalCount.load(), ")");
2074+
dataLogLnIf(verbose, "[OPPORTUNISTIC TASK] GaveUp: nothing met. ", timeSinceFinishingLastFullGC, " ", timeSinceLastGC, " ", heap.m_shouldDoOpportunisticFullCollection, " ", heap.m_oldGenerationCellBytesAtStartOfLastFullCollect, " ", heap.totalBytesAllocatedThisCycle(), " ", heap.m_bytesAllocatedBeforeLastEdenCollect, " ", heap.m_lastGCEndTime, " ", heap.m_currentGCStartTime, " ", (heap.lastFullGCLength() * heap.m_oldGenerationCellBytes) / heap.m_oldGenerationCellBytesAtStartOfLastFullCollect, " ", remainingTime, " ", (heap.lastEdenGCLength() * heap.totalBytesAllocatedThisCycle()) / heap.m_bytesAllocatedBeforeLastEdenCollect, " signpost:(", JSC::activeJSGlobalObjectSignpostIntervalCount.load(), ")");
20752075
}();
20762076

20772077
heap.sweeper().doWorkUntil(*this, deadline);

0 commit comments

Comments
 (0)