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 efce981ee8c2037a60216e222384de34cf7408e8..bd8f7aeec32c2e10666d31fa52a53f0d0b36401b 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -114,6 +114,10 @@ bool GCIdleTimeHandler::ShouldDoScavenge( |
size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, |
size_t scavenge_speed_in_bytes_per_ms, |
size_t new_space_allocation_throughput_in_bytes_per_ms) { |
+ if (idle_time_in_ms >= kMinBackgroundIdleTime) { |
+ // It is better to do full GC for the background tab. |
+ return false; |
+ } |
size_t new_space_allocation_limit = |
kMaxScheduledIdleTime * scavenge_speed_in_bytes_per_ms; |
@@ -193,8 +197,9 @@ bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure( |
} |
-GCIdleTimeAction GCIdleTimeHandler::NothingOrDone() { |
- if (idle_times_which_made_no_progress_ >= kMaxNoProgressIdleTimes) { |
+GCIdleTimeAction GCIdleTimeHandler::NothingOrDone(double idle_time_in_ms) { |
+ if (idle_times_which_made_no_progress_ >= kMaxNoProgressIdleTimes && |
+ idle_time_in_ms < kMinBackgroundIdleTime) { |
return GCIdleTimeAction::Done(); |
} else { |
idle_times_which_made_no_progress_++; |
rmcilroy
2015/07/29 18:11:04
Could this cause wrapping of idle_times_which_made
ulan
2015/07/29 18:21:30
Thanks, rewrote to clap the counter.
Interval betw
rmcilroy
2015/07/30 07:14:07
Better safe than sorry ;). Thanks.
|
@@ -232,7 +237,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
// get the right idle signal. |
if (ShouldDoContextDisposalMarkCompact(heap_state.contexts_disposed, |
heap_state.contexts_disposal_rate)) { |
- return NothingOrDone(); |
+ return NothingOrDone(idle_time_in_ms); |
} |
if (ShouldDoScavenge( |
@@ -247,7 +252,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
if (heap_state.sweeping_completed) { |
return GCIdleTimeAction::FinalizeSweeping(); |
} else { |
- return NothingOrDone(); |
+ return NothingOrDone(idle_time_in_ms); |
} |
} |