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, ...@@ -856,7 +856,7 @@ void ThreadState::AtomicPauseMarkPrologue(BlinkGC::StackState stack_state,
ThreadHeapStatsCollector::EnabledScope mark_prologue_scope( ThreadHeapStatsCollector::EnabledScope mark_prologue_scope(
Heap().stats_collector(), Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseMarkPrologue, "epoch", gc_age_, ThreadHeapStatsCollector::kAtomicPauseMarkPrologue, "epoch", gc_age_,
"forced", reason == BlinkGC::GCReason::kForcedGCForTesting); "forced", IsForcedGC(reason));
EnterAtomicPause(); EnterAtomicPause();
EnterGCForbiddenScope(); EnterGCForbiddenScope();
// Compaction needs to be canceled when incremental marking ends with a // Compaction needs to be canceled when incremental marking ends with a
...@@ -919,8 +919,7 @@ void ThreadState::CompleteSweep() { ...@@ -919,8 +919,7 @@ void ThreadState::CompleteSweep() {
SweepForbiddenScope scope(this); SweepForbiddenScope scope(this);
ThreadHeapStatsCollector::EnabledScope stats_scope( ThreadHeapStatsCollector::EnabledScope stats_scope(
Heap().stats_collector(), ThreadHeapStatsCollector::kCompleteSweep, Heap().stats_collector(), ThreadHeapStatsCollector::kCompleteSweep,
"forced", "forced", IsForcedGC(current_gc_data_.reason));
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
Heap().CompleteSweep(); Heap().CompleteSweep();
SynchronizeAndFinishConcurrentSweeping(); SynchronizeAndFinishConcurrentSweeping();
...@@ -1444,8 +1443,7 @@ void ThreadState::AtomicPauseMarkRoots(BlinkGC::StackState stack_state, ...@@ -1444,8 +1443,7 @@ void ThreadState::AtomicPauseMarkRoots(BlinkGC::StackState stack_state,
BlinkGC::GCReason reason) { BlinkGC::GCReason reason) {
ThreadHeapStatsCollector::EnabledScope advance_tracing_scope( ThreadHeapStatsCollector::EnabledScope advance_tracing_scope(
Heap().stats_collector(), ThreadHeapStatsCollector::kAtomicPauseMarkRoots, Heap().stats_collector(), ThreadHeapStatsCollector::kAtomicPauseMarkRoots,
"epoch", gc_age_, "forced", "epoch", gc_age_, "forced", IsForcedGC(current_gc_data_.reason));
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
MarkPhaseVisitRoots(); MarkPhaseVisitRoots();
MarkPhaseVisitNotFullyConstructedObjects(); MarkPhaseVisitNotFullyConstructedObjects();
} }
...@@ -1454,8 +1452,7 @@ void ThreadState::AtomicPauseMarkTransitiveClosure() { ...@@ -1454,8 +1452,7 @@ void ThreadState::AtomicPauseMarkTransitiveClosure() {
ThreadHeapStatsCollector::EnabledScope advance_tracing_scope( ThreadHeapStatsCollector::EnabledScope advance_tracing_scope(
Heap().stats_collector(), Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseMarkTransitiveClosure, "epoch", ThreadHeapStatsCollector::kAtomicPauseMarkTransitiveClosure, "epoch",
gc_age_, "forced", gc_age_, "forced", IsForcedGC(current_gc_data_.reason));
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
CHECK(MarkPhaseAdvanceMarking(base::TimeTicks::Max())); CHECK(MarkPhaseAdvanceMarking(base::TimeTicks::Max()));
} }
...@@ -1463,8 +1460,7 @@ void ThreadState::AtomicPauseMarkEpilogue(BlinkGC::MarkingType marking_type) { ...@@ -1463,8 +1460,7 @@ void ThreadState::AtomicPauseMarkEpilogue(BlinkGC::MarkingType marking_type) {
ThreadHeapStatsCollector::EnabledScope stats_scope( ThreadHeapStatsCollector::EnabledScope stats_scope(
Heap().stats_collector(), Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseMarkEpilogue, "epoch", gc_age_, ThreadHeapStatsCollector::kAtomicPauseMarkEpilogue, "epoch", gc_age_,
"forced", "forced", IsForcedGC(current_gc_data_.reason));
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
MarkPhaseEpilogue(marking_type); MarkPhaseEpilogue(marking_type);
LeaveAtomicPause(); LeaveAtomicPause();
LeaveGCForbiddenScope(); LeaveGCForbiddenScope();
...@@ -1476,8 +1472,7 @@ void ThreadState::AtomicPauseSweepAndCompact( ...@@ -1476,8 +1472,7 @@ void ThreadState::AtomicPauseSweepAndCompact(
ThreadHeapStatsCollector::EnabledScope stats( ThreadHeapStatsCollector::EnabledScope stats(
Heap().stats_collector(), Heap().stats_collector(),
ThreadHeapStatsCollector::kAtomicPauseSweepAndCompact, "epoch", gc_age_, ThreadHeapStatsCollector::kAtomicPauseSweepAndCompact, "epoch", gc_age_,
"forced", "forced", IsForcedGC(current_gc_data_.reason));
current_gc_data_.reason == BlinkGC::GCReason::kForcedGCForTesting);
AtomicPauseScope atomic_pause_scope(this); AtomicPauseScope atomic_pause_scope(this);
DCHECK(InAtomicMarkingPause()); DCHECK(InAtomicMarkingPause());
...@@ -1556,7 +1551,7 @@ void ThreadState::RunAtomicPause(BlinkGC::StackState stack_state, ...@@ -1556,7 +1551,7 @@ void ThreadState::RunAtomicPause(BlinkGC::StackState stack_state,
// Legacy scope that is used to add stand-alone Oilpan GCs to DevTools // Legacy scope that is used to add stand-alone Oilpan GCs to DevTools
// timeline. // timeline.
TRACE_EVENT1("blink_gc,devtools.timeline", "BlinkGC.AtomicPhase", "forced", TRACE_EVENT1("blink_gc,devtools.timeline", "BlinkGC.AtomicPhase", "forced",
reason == BlinkGC::GCReason::kForcedGCForTesting); IsForcedGC(reason));
AtomicPauseMarkPrologue(stack_state, marking_type, reason); AtomicPauseMarkPrologue(stack_state, marking_type, reason);
AtomicPauseMarkRoots(stack_state, marking_type, reason); AtomicPauseMarkRoots(stack_state, marking_type, reason);
......
...@@ -563,6 +563,11 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver { ...@@ -563,6 +563,11 @@ class PLATFORM_EXPORT ThreadState final : private RAILModeObserver {
// The argument must be registered before calling this. // The argument must be registered before calling this.
void RemoveObserver(BlinkGCObserver*); void RemoveObserver(BlinkGCObserver*);
bool IsForcedGC(BlinkGC::GCReason reason) {
return reason == BlinkGC::GCReason::kThreadTerminationGC ||
reason == BlinkGC::GCReason::kForcedGCForTesting;
}
std::unique_ptr<ThreadHeap> heap_; std::unique_ptr<ThreadHeap> heap_;
base::PlatformThreadId thread_; base::PlatformThreadId thread_;
std::unique_ptr<PersistentRegion> persistent_region_; 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