Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Unified Diff: src/heap/gc-idle-time-handler.cc

Issue 1042483002: Ensure that GC idle notifications either make progress or stop requesting more GCs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: size_t -> int Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | test/unittests/heap/gc-idle-time-handler-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698