Reviewers: Hannes Payer,

Description:
Introduce a new growth criterion for the new space behind a flag

With this flag, we grow if more than 10% survived the last scavenge.

BUG=none
[email protected]
LOG=n

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

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

Affected files (+20, -5 lines):
  M src/flag-definitions.h
  M src/heap/heap.h
  M src/heap/heap.cc


Index: src/flag-definitions.h
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 25426d67acfa1e799521b08dfd7e676afa607da4..9645dda215d629cd691a46a469f241f15b7348bd 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -531,6 +531,9 @@ DEFINE_INT(max_semi_space_size, 0,
"max size of a semi-space (in MBytes), the new space consists of two"
            "semi-spaces")
DEFINE_INT(semi_space_growth_factor, 2, "factor by which to grow the new space")
+DEFINE_BOOL(experimental_new_space_growth_heuristic, false,
+ "Grow the new space based on the percentage of survivors instead "
+            "of their absolute value.")
 DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)")
DEFINE_INT(max_executable_size, 0, "max size of executable memory (in Mbytes)")
 DEFINE_BOOL(gc_global, false, "always perform global GCs")
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 1c0eccaf68cf28b1e26a98bc5ab16e91fbb160fe..d728ec8c184c892d1759d49d010e31ff7de276ad 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -70,6 +70,7 @@ Heap::Heap()
       // generation can be aligned to its size.
       maximum_committed_(0),
       survived_since_last_expansion_(0),
+      survived_last_scavenge_(0),
       sweep_generation_(0),
       always_allocate_scope_depth_(0),
       contexts_disposed_(0),
@@ -1301,11 +1302,18 @@ static void VerifyNonPointerSpacePointers(Heap* heap) {


 void Heap::CheckNewSpaceExpansionCriteria() {
-  if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() &&
-      survived_since_last_expansion_ > new_space_.TotalCapacity()) {
-    // Grow the size of new space if there is room to grow, enough data
-    // has survived scavenge since the last expansion and we are not in
-    // high promotion mode.
+  if (FLAG_experimental_new_space_growth_heuristic) {
+    if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() &&
+        survived_last_scavenge_ * 100 / new_space_.TotalCapacity() >= 10) {
+ // Grow the size of new space if there is room to grow, and more than 10%
+      // have survived the last scavenge.
+      new_space_.Grow();
+      survived_since_last_expansion_ = 0;
+    }
+  } else if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() &&
+             survived_since_last_expansion_ > new_space_.TotalCapacity()) {
+    // Grow the size of new space if there is room to grow, and enough data
+    // has survived scavenge since the last expansion.
     new_space_.Grow();
     survived_since_last_expansion_ = 0;
   }
Index: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index eeb83228610870b1aed5d041ebf2171b65615a5d..20b4955676624ec63b7199176e8ec2a1aeaf4562 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -1195,6 +1195,7 @@ class Heap {

   inline void IncrementYoungSurvivorsCounter(int survived) {
     DCHECK(survived >= 0);
+    survived_last_scavenge_ = survived;
     survived_since_last_expansion_ += survived;
   }

@@ -1506,6 +1507,9 @@ class Heap {
   // scavenge since last new space expansion.
   int survived_since_last_expansion_;

+  // ... and since the last scavenge.
+  int survived_last_scavenge_;
+
   // For keeping track on when to flush RegExp code.
   int sweep_generation_;



--
--
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