From 34363bf5aa2b0888469e55496ebe50502a8714ed Mon Sep 17 00:00:00 2001 From: jochen Date: Fri, 21 Nov 2014 04:14:22 -0800 Subject: [PATCH] Introduce a flag to change the new space growth factor A useful value would be 4, so we get 1, 4, 16MB (instead of the default value 2 which leads to 1, 2, 4, 8, 16) BUG=none R=hpayer@chromium.org LOG=n Review URL: https://codereview.chromium.org/753513002 Cr-Commit-Position: refs/heads/master@{#25462} --- src/flag-definitions.h | 1 + src/heap/heap.cc | 4 ++++ src/heap/spaces.cc | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/flag-definitions.h b/src/flag-definitions.h index f329872..25426d6 100644 --- a/src/flag-definitions.h +++ b/src/flag-definitions.h @@ -530,6 +530,7 @@ DEFINE_INT(target_semi_space_size, 0, 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_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") diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 9785be0..1c0ecca 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -5059,6 +5059,10 @@ bool Heap::ConfigureHeap(int max_semi_space_size, int max_old_space_size, target_semispace_size_ = Max(initial_semispace_size_, target_semispace_size_); + if (FLAG_semi_space_growth_factor < 2) { + FLAG_semi_space_growth_factor = 2; + } + // The old generation is paged and needs at least one page for each space. int paged_space_count = LAST_PAGED_SPACE - FIRST_PAGED_SPACE + 1; max_old_generation_size_ = diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc index 51a0ef6..554b717 100644 --- a/src/heap/spaces.cc +++ b/src/heap/spaces.cc @@ -1313,7 +1313,8 @@ void NewSpace::Grow() { // Double the semispace size but only up to maximum capacity. DCHECK(TotalCapacity() < MaximumCapacity()); int new_capacity = - Min(MaximumCapacity(), 2 * static_cast(TotalCapacity())); + Min(MaximumCapacity(), + FLAG_semi_space_growth_factor * static_cast(TotalCapacity())); if (to_space_.GrowTo(new_capacity)) { // Only grow from space if we managed to grow to-space. if (!from_space_.GrowTo(new_capacity)) { -- 2.7.4