Allow more scavenges in idle notification by increasing the new space limit distance.

BUG=chromium:468554
LOG=n

Review URL: https://codereview.chromium.org/1034403002

Cr-Commit-Position: refs/heads/master@{#27517}
This commit is contained in:
hpayer 2015-03-30 04:39:50 -07:00 committed by Commit bot
parent f5a6f73ce6
commit bffde6f4ab
3 changed files with 11 additions and 3 deletions

View File

@ -131,8 +131,12 @@ bool GCIdleTimeHandler::ShouldDoScavenge(
static_cast<size_t>(new_space_size * kConservativeTimeRatio);
} else {
// We have to trigger scavenge before we reach the end of new space.
new_space_allocation_limit -=
new_space_allocation_throughput_in_bytes_per_ms * kMaxScheduledIdleTime;
size_t adjust_limit = new_space_allocation_throughput_in_bytes_per_ms *
kTimeUntilNextIdleEvent;
if (adjust_limit > new_space_allocation_limit)
new_space_allocation_limit = 0;
else
new_space_allocation_limit -= adjust_limit;
}
if (scavenge_speed_in_bytes_per_ms == 0) {

View File

@ -122,6 +122,10 @@ class GCIdleTimeHandler {
// 16 ms when there is currently no rendering going on.
static const size_t kMaxScheduledIdleTime = 50;
// We conservatively assume that in the next kTimeUntilNextIdleEvent ms
// no idle notification happens.
static const size_t kTimeUntilNextIdleEvent = 100;
// If we haven't recorded any scavenger events yet, we use a conservative
// lower bound for the scavenger speed.
static const size_t kInitialConservativeScavengeSpeed = 100 * KB;

View File

@ -136,7 +136,7 @@ TEST_F(GCIdleTimeHandlerTest, DoScavengeUnknownScavengeSpeed) {
GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
heap_state.used_new_space_size = kNewSpaceCapacity;
heap_state.scavenge_speed_in_bytes_per_ms = 0;
int idle_time_in_ms = 16;
int idle_time_in_ms = 8;
EXPECT_FALSE(GCIdleTimeHandler::ShouldDoScavenge(
idle_time_in_ms, heap_state.new_space_capacity,
heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms,