Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 951199d8166568caac66afe426a4299c92e3d172..06b55f84d1ea3fb23e633ba2a500ac8f4770daaf 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -4176,19 +4176,18 @@ void Heap::ReduceNewSpaceSize() { |
} |
} |
-bool Heap::MarkingDequesAreEmpty() { |
- return mark_compact_collector()->marking_deque()->IsEmpty() && |
- local_embedder_heap_tracer()->NumberOfWrappersToTrace() == 0; |
-} |
- |
void Heap::FinalizeIncrementalMarkingIfComplete( |
GarbageCollectionReason gc_reason) { |
if (incremental_marking()->IsMarking() && |
(incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
(!incremental_marking()->finalize_marking_completed() && |
- MarkingDequesAreEmpty()))) { |
+ mark_compact_collector()->marking_deque()->IsEmpty() && |
+ local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking()))) { |
FinalizeIncrementalMarking(gc_reason); |
- } else if (incremental_marking()->IsComplete() || MarkingDequesAreEmpty()) { |
+ } else if (incremental_marking()->IsComplete() || |
+ (mark_compact_collector()->marking_deque()->IsEmpty() && |
+ local_embedder_heap_tracer() |
+ ->ShouldFinalizeIncrementalMarking())) { |
CollectAllGarbage(current_gc_flags_, gc_reason); |
} |
} |
@@ -4200,13 +4199,16 @@ bool Heap::TryFinalizeIdleIncrementalMarking( |
tracer()->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond(); |
if (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
(!incremental_marking()->finalize_marking_completed() && |
- MarkingDequesAreEmpty() && |
+ mark_compact_collector()->marking_deque()->IsEmpty() && |
+ local_embedder_heap_tracer()->ShouldFinalizeIncrementalMarking() && |
gc_idle_time_handler_->ShouldDoOverApproximateWeakClosure( |
idle_time_in_ms))) { |
FinalizeIncrementalMarking(gc_reason); |
return true; |
} else if (incremental_marking()->IsComplete() || |
- (MarkingDequesAreEmpty() && |
+ (mark_compact_collector()->marking_deque()->IsEmpty() && |
+ local_embedder_heap_tracer() |
+ ->ShouldFinalizeIncrementalMarking() && |
gc_idle_time_handler_->ShouldDoFinalIncrementalMarkCompact( |
idle_time_in_ms, size_of_objects, |
final_incremental_mark_compact_speed_in_bytes_per_ms))) { |