Commit 39eba6cd authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

heap: Mark thread-termination GCs as forced

Avoid including thread-termination GCs in performance profiles as their
shutdown on benchmarks is not always deterministic across different
versions.

Bug: 948807
Change-Id: I45a8883b15bd5a1abbeb1f5db732249d0cba533b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1715191
Auto-Submit: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680407}
parent ee0034b5
......@@ -856,7 +856,7 @@ void ThreadState::AtomicPauseMarkPrologue(BlinkGC::StackState stack_state,
ThreadHeapStatsCollector::EnabledScope mark_prologue_scope(
Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseMarkPrologue, "epoch", gc_age_,
"forced", reason == BlinkGC::GCReason::kForcedGCForTesting);
"forced", IsForcedGC(reason));
EnterAtomicPause();
EnterGCForbiddenScope();
// Compaction needs to be canceled when incremental marking ends with a
......@@ -919,8 +919,7 @@ void ThreadState::CompleteSweep() {
SweepForbiddenScope scope(this);
ThreadHeapStatsCollector::EnabledScope stats_scope(
Heap().stats_collector(), ThreadHeapStatsCollector::kCompleteSweep,
"forced",
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
"forced", IsForcedGC(current_gc_data_.reason));
Heap().CompleteSweep();
SynchronizeAndFinishConcurrentSweeping();
......@@ -1444,8 +1443,7 @@ void ThreadState::AtomicPauseMarkRoots(BlinkGC::StackState stack_state,
BlinkGC::GCReason reason) {
ThreadHeapStatsCollector::EnabledScope advance_tracing_scope(
Heap().stats_collector(), ThreadHeapStatsCollector::kAtomicPauseMarkRoots,
"epoch", gc_age_, "forced",
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
"epoch", gc_age_, "forced", IsForcedGC(current_gc_data_.reason));
MarkPhaseVisitRoots();
MarkPhaseVisitNotFullyConstructedObjects();
}
......@@ -1454,8 +1452,7 @@ void ThreadState::AtomicPauseMarkTransitiveClosure() {
ThreadHeapStatsCollector::EnabledScope advance_tracing_scope(
Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseMarkTransitiveClosure, "epoch",
gc_age_, "forced",
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
gc_age_, "forced", IsForcedGC(current_gc_data_.reason));
CHECK(MarkPhaseAdvanceMarking(base::TimeTicks::Max()));
}
......@@ -1463,8 +1460,7 @@ void ThreadState::AtomicPauseMarkEpilogue(BlinkGC::MarkingType marking_type) {
ThreadHeapStatsCollector::EnabledScope stats_scope(
Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseMarkEpilogue, "epoch", gc_age_,
"forced",
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
"forced", IsForcedGC(current_gc_data_.reason));
MarkPhaseEpilogue(marking_type);
LeaveAtomicPause();
LeaveGCForbiddenScope();
......@@ -1476,8 +1472,7 @@ void ThreadState::AtomicPauseSweepAndCompact(
ThreadHeapStatsCollector::EnabledScope stats(
Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseSweepAndCompact, "epoch", gc_age_,
"forced",
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
"forced", IsForcedGC(current_gc_data_.reason));
AtomicPauseScope atomic_pause_scope(this);
DCHECK(InAtomicMarkingPause());
......@@ -1556,7 +1551,7 @@ void ThreadState::RunAtomicPause(BlinkGC::StackState stack_state,
// Legacy scope that is used to add stand-alone Oilpan GCs to DevTools
// timeline.
TRACE_EVENT1("blink_gc,devtools.timeline", "BlinkGC.AtomicPhase", "forced",
reason == BlinkGC::GCReason::kForcedGCForTesting);
IsForcedGC(reason));
AtomicPauseMarkPrologue(stack_state, marking_type, reason);
AtomicPauseMarkRoots(stack_state, marking_type, reason);
......
......@@ -563,6 +563,11 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
// The argument must be registered before calling this.
void RemoveObserver(BlinkGCObserver*);
bool IsForcedGC(BlinkGC::GCReason reason) {
return reason == BlinkGC::GCReason::kThreadTerminationGC ||
reason == BlinkGC::GCReason::kForcedGCForTesting;
}
std::unique_ptr<ThreadHeap> heap_;
base::PlatformThreadId thread_;
std::unique_ptr<PersistentRegion> persistent_region_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment