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 3e3644956b15956239feef2bb06117786089ee62..5c46842e22f17fd04bd4e50a8a6b0ca927f02e2f 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -63,6 +63,9 @@ size_t GCIdleTimeHandler::EstimateMarkingStepSize( |
size_t GCIdleTimeHandler::EstimateMarkCompactTime( |
size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms) { |
+ // TODO(hpayer): Be more precise about the type of mark-compact event. It |
+ // makes a huge difference if it is incremental or non-incremental and if |
+ // compaction is happening. |
if (mark_compact_speed_in_bytes_per_ms == 0) { |
mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed; |
} |
@@ -110,6 +113,15 @@ bool GCIdleTimeHandler::DoScavenge( |
} |
+bool GCIdleTimeHandler::DoMarkCompact( |
+ 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); |
+} |
+ |
+ |
// The following logic is implemented by the controller: |
// (1) If the new space is almost full and we can affort a Scavenge or if the |
// next Scavenge will very likely take long, then a Scavenge is performed. |
@@ -148,10 +160,8 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, |
} |
if (heap_state.incremental_marking_stopped) { |
- size_t estimated_time_in_ms = |
- EstimateMarkCompactTime(heap_state.size_of_objects, |
- heap_state.mark_compact_speed_in_bytes_per_ms); |
- if (idle_time_in_ms >= estimated_time_in_ms || |
+ if (DoMarkCompact(idle_time_in_ms, heap_state.size_of_objects, |
+ heap_state.mark_compact_speed_in_bytes_per_ms) || |
(heap_state.size_of_objects < kSmallHeapSize && |
heap_state.contexts_disposed > 0)) { |
// If there are no more than two GCs left in this idle round and we are |