Index: src/heap/gc-idle-time-handler.cc |
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc |
index a2e08b28c514e1c08c0c394a9100c8da6150897d..90f916e2f45a025b056eee843de8d6de4556d7c2 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -46,22 +46,20 @@ size_t GCIdleTimeHandler::EstimateMarkCompactTime( |
GCIdleTimeAction GCIdleTimeHandler::Compute(int idle_time_in_ms, |
- int contexts_disposed, |
- size_t size_of_objects, |
- bool incremental_marking_stopped, |
+ HeapState heap_state, |
GCTracer* gc_tracer) { |
if (IsIdleRoundFinished()) { |
- if (EnoughGarbageSinceLastIdleRound() || contexts_disposed > 0) { |
+ if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed > 0) { |
StartIdleRound(); |
} else { |
return GCIdleTimeAction::Nothing(); |
} |
} |
- if (incremental_marking_stopped) { |
+ if (heap_state.incremental_marking_stopped) { |
size_t speed = |
static_cast<size_t>(gc_tracer->MarkCompactSpeedInBytesPerMillisecond()); |
- if (idle_time_in_ms >= |
- static_cast<int>(EstimateMarkCompactTime(size_of_objects, speed))) { |
+ if (idle_time_in_ms >= static_cast<int>(EstimateMarkCompactTime( |
+ heap_state.size_of_objects, speed))) { |
// If there are no more than two GCs left in this idle round and we are |
// allowed to do a full GC, then make those GCs full in order to compact |
// the code space. |
@@ -69,10 +67,14 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(int idle_time_in_ms, |
// can get rid of this special case and always start incremental marking. |
int remaining_mark_sweeps = |
kMaxMarkCompactsInIdleRound - mark_compacts_since_idle_round_started_; |
- if (contexts_disposed > 0 || remaining_mark_sweeps <= 2) { |
+ if (heap_state.contexts_disposed > 0 || remaining_mark_sweeps <= 2 || |
+ !heap_state.can_start_incremental_marking) { |
return GCIdleTimeAction::FullGC(); |
} |
} |
+ if (!heap_state.can_start_incremental_marking) { |
+ return GCIdleTimeAction::Nothing(); |
+ } |
} |
intptr_t speed = gc_tracer->IncrementalMarkingSpeedInBytesPerMillisecond(); |
size_t step_size = |