| 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 568cd3f29a07483752f7bae43d03ecd9c70ea650..a3383b9c0c0dcde34864a7fbbafef853d24d5d55 100644
|
| --- a/src/heap/gc-idle-time-handler.cc
|
| +++ b/src/heap/gc-idle-time-handler.cc
|
| @@ -187,11 +187,22 @@ bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure(
|
| }
|
|
|
|
|
| +GCIdleTimeAction GCIdleTimeHandler::NothingOrDone() {
|
| + if (idle_times_which_made_no_progress_since_last_idle_round_ >=
|
| + kMaxNoProgressIdleTimesPerIdleRound) {
|
| + return GCIdleTimeAction::Done();
|
| + } else {
|
| + idle_times_which_made_no_progress_since_last_idle_round_++;
|
| + return GCIdleTimeAction::Nothing();
|
| + }
|
| +}
|
| +
|
| +
|
| // The following logic is implemented by the controller:
|
| // (1) If we don't have any idle time, do nothing, unless a context was
|
| // disposed, incremental marking is stopped, and the heap is small. Then do
|
| // a full GC.
|
| -// (2) If the new space is almost full and we can affort a Scavenge or if the
|
| +// (2) If the new space is almost full and we can afford a Scavenge or if the
|
| // next Scavenge will very likely take long, then a Scavenge is performed.
|
| // (3) If there is currently no MarkCompact idle round going on, we start a
|
| // new idle round if enough garbage was created. Otherwise we do not perform
|
| @@ -243,15 +254,18 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
|
| return GCIdleTimeAction::FullGC();
|
| }
|
| }
|
| -
|
| - if (heap_state.sweeping_in_progress && heap_state.sweeping_completed) {
|
| - return GCIdleTimeAction::FinalizeSweeping();
|
| + if (heap_state.sweeping_in_progress) {
|
| + if (heap_state.sweeping_completed) {
|
| + return GCIdleTimeAction::FinalizeSweeping();
|
| + } else {
|
| + return NothingOrDone();
|
| + }
|
| }
|
| -
|
| if (heap_state.incremental_marking_stopped &&
|
| !heap_state.can_start_incremental_marking) {
|
| - return GCIdleTimeAction::Nothing();
|
| + return NothingOrDone();
|
| }
|
| +
|
| size_t step_size = EstimateMarkingStepSize(
|
| static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
|
| heap_state.incremental_marking_speed_in_bytes_per_ms);
|
|
|