Index: src/heap/incremental-marking.cc |
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc |
index 51b91badccaf7ef01b60096b808f062d5671bc0e..3575bcbe31821e234e18ed00c56fb58e12a5fb9c 100644 |
--- a/src/heap/incremental-marking.cc |
+++ b/src/heap/incremental-marking.cc |
@@ -7,6 +7,7 @@ |
#include "src/code-stubs.h" |
#include "src/compilation-cache.h" |
#include "src/conversions.h" |
+#include "src/heap/gc-idle-time-handler.h" |
#include "src/heap/gc-tracer.h" |
#include "src/heap/mark-compact-inl.h" |
#include "src/heap/objects-visiting.h" |
@@ -815,6 +816,34 @@ void IncrementalMarking::Epilogue() { |
} |
+double IncrementalMarking::AdvanceIncrementalMarking( |
+ intptr_t step_size_in_bytes, double deadline_in_ms, |
+ IncrementalMarking::StepActions step_actions) { |
+ DCHECK(!IsStopped()); |
+ |
+ if (step_size_in_bytes == 0) { |
+ step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
+ static_cast<size_t>(GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs), |
+ static_cast<size_t>( |
+ heap() |
+ ->tracer() |
+ ->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond())); |
+ } |
+ |
+ double remaining_time_in_ms = 0.0; |
+ do { |
+ Step(step_size_in_bytes, step_actions.completion_action, |
+ step_actions.force_marking, step_actions.force_completion); |
+ remaining_time_in_ms = |
+ deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs(); |
+ } while (remaining_time_in_ms >= |
+ 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs && |
+ !IsComplete() && |
+ !heap()->mark_compact_collector()->marking_deque()->IsEmpty()); |
+ return remaining_time_in_ms; |
+} |
+ |
+ |
void IncrementalMarking::OldSpaceStep(intptr_t allocated) { |
if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { |
heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags, |