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 80417a7f25dcf81c20ebf6b8916f3855a82f5278..5c8354d935701b6a680b124753b47539bcf6efae 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -132,8 +132,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) { |