Chromium Code Reviews| 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 c74b46ea9b6d126b0770df551a830593198d63ef..b572ca2527de57a13cd8aa960c30830dda2ac76c 100644 |
| --- a/src/heap/gc-idle-time-handler.cc |
| +++ b/src/heap/gc-idle-time-handler.cc |
| @@ -152,10 +152,15 @@ bool GCIdleTimeHandler::ShouldDoScavenge( |
| bool GCIdleTimeHandler::ShouldDoMarkCompact( |
| size_t idle_time_in_ms, size_t size_of_objects, |
| - size_t mark_compact_speed_in_bytes_per_ms) { |
| - return idle_time_in_ms >= |
| - EstimateMarkCompactTime(size_of_objects, |
| - mark_compact_speed_in_bytes_per_ms); |
| + size_t mark_compact_speed_in_bytes_per_ms, |
| + size_t last_mark_compact_time_in_ms, size_t current_time_in_ms) { |
| + bool mark_compact_rate_high = |
| + current_time_in_ms < |
| + last_mark_compact_time_in_ms + kMinTimeInBetweenMarkCompactsInMs; |
| + return (!mark_compact_rate_high || idle_time_in_ms > kMaxScheduledIdleTime) && |
| + idle_time_in_ms >= |
| + EstimateMarkCompactTime(size_of_objects, |
|
rmcilroy
2015/03/20 14:56:08
this is looking pretty complex condition now - cou
|
| + mark_compact_speed_in_bytes_per_ms); |
| } |
| @@ -233,9 +238,10 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms, |
| } |
| if (heap_state.incremental_marking_stopped) { |
|
Erik Corry
2015/03/20 15:21:27
It feels like we are piling more and more heuristi
|
| - if (ShouldDoMarkCompact(static_cast<size_t>(idle_time_in_ms), |
| - heap_state.size_of_objects, |
| - heap_state.mark_compact_speed_in_bytes_per_ms)) { |
| + if (ShouldDoMarkCompact( |
| + static_cast<size_t>(idle_time_in_ms), heap_state.size_of_objects, |
| + heap_state.mark_compact_speed_in_bytes_per_ms, |
| + heap_state.last_mark_compact_time, heap_state.current_time)) { |
| // If there are no more than two GCs left in this idle round and we are |
| // allowed to do a full GC, then make those GCs full in order to compact |
| // the code space. |