From 1c76394503333b602df07b8ea4f440c0fb520c4d Mon Sep 17 00:00:00 2001 From: "ulan@chromium.org" Date: Thu, 11 Sep 2014 11:54:49 +0000 Subject: [PATCH] Do full GC for small heaps in idle time handler. BUG=407593 LOG=N R=hpayer@chromium.org Review URL: https://codereview.chromium.org/563573002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23871 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap/gc-idle-time-handler.cc | 4 +++- src/heap/gc-idle-time-handler.h | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc index 8def900..bd174c0 100644 --- a/src/heap/gc-idle-time-handler.cc +++ b/src/heap/gc-idle-time-handler.cc @@ -80,7 +80,9 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, if (heap_state.incremental_marking_stopped) { if (idle_time_in_ms >= EstimateMarkCompactTime( heap_state.size_of_objects, - heap_state.mark_compact_speed_in_bytes_per_ms)) { + 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 // allowed to do a full GC, then make those GCs full in order to compact // the code space. diff --git a/src/heap/gc-idle-time-handler.h b/src/heap/gc-idle-time-handler.h index b0bdce6..2890578 100644 --- a/src/heap/gc-idle-time-handler.h +++ b/src/heap/gc-idle-time-handler.h @@ -98,6 +98,10 @@ class GCIdleTimeHandler { // Number of scavenges that will trigger start of new idle round. static const int kIdleScavengeThreshold; + // Heap size threshold below which we prefer mark-compact over incremental + // step. + static const size_t kSmallHeapSize = 2 * kPointerSize * MB; + struct HeapState { int contexts_disposed; size_t size_of_objects; -- 2.7.4