Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 4f5a064cca37a0f51ce644a815da5786008d664a..064ac32f58f36315f288bebb1ee6a26e6bfb5cfb 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -4886,6 +4886,24 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() { |
} |
+double Heap::AdvanceIncrementalMarking( |
+ double step_size_in_bytes, double deadline_in_ms, |
+ IncrementalMarking::ForceCompletionAction completion) { |
+ DCHECK(!incremental_marking()->IsStopped()); |
+ double remaining_time_in_ms = 0.0; |
+ do { |
+ incremental_marking()->Step(step_size_in_bytes, |
+ IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
+ IncrementalMarking::FORCE_MARKING, completion); |
+ remaining_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs(); |
+ } while (remaining_time_in_ms >= |
+ 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
+ !incremental_marking()->IsComplete() && |
+ !mark_compact_collector_.marking_deque()->IsEmpty()); |
+ return remaining_time_in_ms; |
+} |
+ |
+ |
bool Heap::PerformIdleTimeAction(GCIdleTimeAction action, |
GCIdleTimeHandler::HeapState heap_state, |
double deadline_in_ms) { |
@@ -4895,19 +4913,9 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action, |
result = true; |
break; |
case DO_INCREMENTAL_MARKING: { |
- DCHECK(!incremental_marking()->IsStopped()); |
- 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()); |
+ const double remaining_idle_time_in_ms = AdvanceIncrementalMarking( |
+ action.parameter, deadline_in_ms, |
+ IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
if (remaining_idle_time_in_ms > 0.0) { |
action.additional_work = TryFinalizeIdleIncrementalMarking( |
remaining_idle_time_in_ms, heap_state.size_of_objects, |