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 4103b78a348c81e3be0b60b030a04d107eaa4ea1..730d2bb2568888ca8208e875c0ab6587cab101b1 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -11,6 +11,7 @@ namespace internal { |
const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; |
const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; |
+const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; |
const size_t GCIdleTimeHandler::kMinTimeForFinalizeSweeping = 100; |
const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7; |
const int GCIdleTimeHandler::kIdleScavengeThreshold = 5; |
@@ -84,8 +85,7 @@ 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. |
+ // makes a huge difference if compaction is happening. |
if (mark_compact_speed_in_bytes_per_ms == 0) { |
mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed; |
} |
@@ -94,6 +94,19 @@ size_t GCIdleTimeHandler::EstimateMarkCompactTime( |
} |
+size_t GCIdleTimeHandler::EstimateFinalIncrementalMarkCompactTime( |
+ size_t size_of_objects, |
+ size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
+ if (final_incremental_mark_compact_speed_in_bytes_per_ms == 0) { |
+ final_incremental_mark_compact_speed_in_bytes_per_ms = |
+ kInitialConservativeFinalIncrementalMarkCompactSpeed; |
+ } |
+ size_t result = |
+ size_of_objects / final_incremental_mark_compact_speed_in_bytes_per_ms; |
+ return Min(result, kMaxFinalIncrementalMarkCompactTimeInMs); |
+} |
+ |
+ |
bool GCIdleTimeHandler::ShouldDoScavenge( |
size_t idle_time_in_ms, size_t new_space_size, size_t used_new_space_size, |
size_t scavenge_speed_in_bytes_per_ms, |
@@ -149,6 +162,16 @@ bool GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact( |
} |
+bool GCIdleTimeHandler::ShouldDoFinalIncrementalMarkCompact( |
+ size_t idle_time_in_ms, size_t size_of_objects, |
+ size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
+ return idle_time_in_ms >= |
+ EstimateFinalIncrementalMarkCompactTime( |
+ size_of_objects, |
+ final_incremental_mark_compact_speed_in_bytes_per_ms); |
+} |
+ |
+ |
// The following logic is implemented by the controller: |
// (1) If we don't have any idle time, do nothing, unless a context was |
// disposed, incremental marking is stopped, and the heap is small. Then do |