diff --git a/src/heap/heap.cc b/src/heap/heap.cc index ccabee72c2..0d753e2227 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -2014,7 +2014,7 @@ void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) { void Heap::ConfigureInitialOldGenerationSize() { if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) { old_generation_allocation_limit_ = - Max(kMinimumOldGenerationAllocationLimit, + Max(MinimumAllocationLimitGrowingStep(), static_cast( static_cast(old_generation_allocation_limit_) * (tracer()->AverageSurvivalRatio() / 100))); @@ -5151,7 +5151,7 @@ intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor, CHECK(factor > 1.0); CHECK(old_gen_size > 0); intptr_t limit = static_cast(old_gen_size * factor); - limit = Max(limit, old_gen_size + kMinimumOldGenerationAllocationLimit); + limit = Max(limit, old_gen_size + MinimumAllocationLimitGrowingStep()); limit += new_space_.Capacity(); intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2; return Min(limit, halfway_to_the_max); diff --git a/src/heap/heap.h b/src/heap/heap.h index f39b893933..e15c1f37e7 100644 --- a/src/heap/heap.h +++ b/src/heap/heap.h @@ -519,9 +519,6 @@ class Heap { }; typedef List Reservation; - static const intptr_t kMinimumOldGenerationAllocationLimit = - 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); - static const int kInitalOldGenerationLimitFactor = 2; #if V8_OS_ANDROID @@ -1803,6 +1800,15 @@ class Heap { void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed, double mutator_speed); + intptr_t MinimumAllocationLimitGrowingStep() { + const double kRegularAllocationLimitGrowingStep = 8; + const double kLowMemoryAllocationLimitGrowingStep = 2; + intptr_t limit = (Page::kPageSize > MB ? Page::kPageSize : MB); + return limit * (ShouldOptimizeForMemoryUsage() + ? kLowMemoryAllocationLimitGrowingStep + : kRegularAllocationLimitGrowingStep); + } + // =========================================================================== // Idle notification. ======================================================== // =========================================================================== diff --git a/test/mjsunit/regress/regress-crbug-500497.js b/test/mjsunit/regress/regress-crbug-500497.js index 9117440c2c..356e4e6942 100644 --- a/test/mjsunit/regress/regress-crbug-500497.js +++ b/test/mjsunit/regress/regress-crbug-500497.js @@ -4,6 +4,7 @@ // New space must be at max capacity to trigger pretenuring decision. // Flags: --allow-natives-syntax --verify-heap --max-semi-space-size=1 +// Flags: --expose-gc var global = []; // Used to keep some objects alive. @@ -12,6 +13,8 @@ function Ctor() { return result; } +gc(); + for (var i = 0; i < 120; i++) { // Make the "a" property long-lived, while everything else is short-lived. global.push(Ctor().a);