Commit caf5c5a1 authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Use smaller minimum allocation limit growing step when optimizing for memory usage.

BUG=chromium:634900

Review-Url: https://codereview.chromium.org/2223493002
Cr-Commit-Position: refs/heads/master@{#38435}
parent 79d9e18c
......@@ -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<intptr_t>(
static_cast<double>(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<intptr_t>(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);
......
......@@ -519,9 +519,6 @@ class Heap {
};
typedef List<Chunk> 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. ========================================================
// ===========================================================================
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment