Reviewers: Hannes Payer,
Message:
ptal
Description:
Fix idle notification for background tab.
The idle time handler should never return DONE or DO_SCAVENGE for
background tabs. Upon receiving DONE chrome will stop sending idle
notifications.
BUG=chromium:515174
LOG=NO
Please review this at https://codereview.chromium.org/1269583002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+10, -5 lines):
M src/heap/gc-idle-time-handler.h
M src/heap/gc-idle-time-handler.cc
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_++;
@@ -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);
}
}
Index: src/heap/gc-idle-time-handler.h
diff --git a/src/heap/gc-idle-time-handler.h
b/src/heap/gc-idle-time-handler.h
index
2d0114b82ef89cec98726f96f39fbe31a01c0913..8f12a446f2a1609276cf8310f1e06030738dedc7
100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -198,7 +198,7 @@ class GCIdleTimeHandler {
size_t new_space_allocation_throughput_in_bytes_per_ms);
private:
- GCIdleTimeAction NothingOrDone();
+ GCIdleTimeAction NothingOrDone(double idle_time_in_ms);
// Idle notifications with no progress.
int idle_times_which_made_no_progress_;
--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.