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 f76c48bf9e3ed615ac7f04af25bda87b92014eb0..e9324de4672738681e5119aad59266081f101102 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -129,10 +129,7 @@ bool GCIdleTimeHandler::ShouldDoScavenge( |
// We do not know the allocation throughput before the first scavenge. |
// TODO(hpayer): Estimate allocation throughput before the first scavenge. |
- if (new_space_allocation_throughput_in_bytes_per_ms == 0) { |
- new_space_allocation_limit = |
- static_cast<size_t>(new_space_size * kConservativeTimeRatio); |
- } else { |
+ if (new_space_allocation_throughput_in_bytes_per_ms > 0) { |
// We have to trigger scavenge before we reach the end of new space. |
size_t adjust_limit = new_space_allocation_throughput_in_bytes_per_ms * |
kTimeUntilNextIdleEvent; |
@@ -143,6 +140,13 @@ bool GCIdleTimeHandler::ShouldDoScavenge( |
} |
} |
+ if (new_space_allocation_throughput_in_bytes_per_ms < |
+ kLowAllocationThroughput) { |
+ new_space_allocation_limit = |
+ Min(new_space_allocation_limit, |
+ static_cast<size_t>(new_space_size * kConservativeTimeRatio)); |
+ } |
+ |
// The allocated new space limit to trigger a scavange has to be at least |
// kMinimumNewSpaceSizeToPerformScavenge. |
if (new_space_allocation_limit < kMinimumNewSpaceSizeToPerformScavenge) { |