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

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

Issue 1269583002: Fix idle notification for background tab. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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') | no next file » | 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 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);
}
}
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698