Reviewers: ulan,

Description:
Reduce new space size during idle times only in memory mode after scavenge, full
gc, or finalized incremental full gc.

BUG=

Please review this at https://codereview.chromium.org/1143973003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+15, -4 lines):
  M src/heap/heap.h
  M src/heap/heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index e801ff94cfb3ab9f4593712a68c62960a6748f3f..df12e79beaaf030d3d1039d079f701d461c8dec4 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -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: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 8b41fb7b2647295544c9eb1cf766b36972bbe979..8ecf7ae1328df4e495242eb777a128b1e7d6efc0 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to