Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 8986087486995ac660de31f0d164b0a03ebc37f4..fa327641250cd51d24d01f822ff04e641a758ab4 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -4489,12 +4489,18 @@ bool Heap::IdleNotification(double deadline_in_seconds) { |
if (incremental_marking()->IsStopped()) { |
incremental_marking()->Start(); |
} |
- incremental_marking()->Step(action.parameter, |
- IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
- IncrementalMarking::FORCE_MARKING, |
- IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
- double remaining_idle_time_in_ms = |
- deadline_in_ms - MonotonicallyIncreasingTimeInMs(); |
+ double remaining_idle_time_in_ms = 0.0; |
+ do { |
+ incremental_marking()->Step( |
+ action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
+ IncrementalMarking::FORCE_MARKING, |
+ IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
+ remaining_idle_time_in_ms = |
+ deadline_in_ms - MonotonicallyIncreasingTimeInMs(); |
+ } while (remaining_idle_time_in_ms >= |
+ 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
+ !incremental_marking()->IsComplete() && |
+ !mark_compact_collector_.marking_deque()->IsEmpty()); |
if (remaining_idle_time_in_ms > 0.0) { |
TryFinalizeIdleIncrementalMarking( |
remaining_idle_time_in_ms, heap_state.size_of_objects, |