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
R=hpayer@chromium.org
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#25540}
This commit is contained in:
jochen 2014-11-27 02:52:47 -08:00 committed by Commit bot
parent 3adebeaaa8
commit 217c45b106
3 changed files with 20 additions and 5 deletions

View File

@ -537,6 +537,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")

View File

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

View File

@ -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_;