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