Reduce new space size during idle times only in memory mode after scavenge, full...
authorhpayer <hpayer@chromium.org>
Thu, 21 May 2015 13:09:29 +0000 (06:09 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 21 May 2015 13:09:10 +0000 (13:09 +0000)
BUG=

Review URL: https://codereview.chromium.org/1143973003

Cr-Commit-Position: refs/heads/master@{#28552}

src/heap/heap.cc
src/heap/heap.h

index d53acdc..5a10a5c 100644 (file)
@@ -4564,6 +4564,18 @@ void Heap::MakeHeapIterable() {
   DCHECK(IsHeapIterable());
 }
 
+
+void Heap::ReduceNewSpaceSize(GCIdleTimeAction action) {
+  if (action.reduce_memory &&
+      (action.type == DO_SCAVENGE || action.type == DO_FULL_GC ||
+       (action.type == DO_INCREMENTAL_MARKING &&
+        incremental_marking()->IsStopped()))) {
+    new_space_.Shrink();
+    UncommitFromSpace();
+  }
+}
+
+
 bool Heap::TryFinalizeIdleIncrementalMarking(
     double idle_time_in_ms, size_t size_of_objects,
     size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
@@ -4685,10 +4697,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action,
       break;
   }
 
-  if (action.reduce_memory) {
-    new_space_.Shrink();
-    UncommitFromSpace();
-  }
+  ReduceNewSpaceSize(action);
   return result;
 }
 
index 8b41fb7..8ecf7ae 100644 (file)
@@ -2127,6 +2127,8 @@ class Heap {
 
   void SelectScavengingVisitorsTable();
 
+  void ReduceNewSpaceSize(GCIdleTimeAction action);
+
   bool TryFinalizeIdleIncrementalMarking(
       double idle_time_in_ms, size_t size_of_objects,
       size_t mark_compact_speed_in_bytes_per_ms);