[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}
This commit is contained in:
parent
79d9e18cbe
commit
caf5c5a194
@ -2014,7 +2014,7 @@ void Heap::UnregisterArrayBuffer(JSArrayBuffer* buffer) {
|
|||||||
void Heap::ConfigureInitialOldGenerationSize() {
|
void Heap::ConfigureInitialOldGenerationSize() {
|
||||||
if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) {
|
if (!old_generation_size_configured_ && tracer()->SurvivalEventsRecorded()) {
|
||||||
old_generation_allocation_limit_ =
|
old_generation_allocation_limit_ =
|
||||||
Max(kMinimumOldGenerationAllocationLimit,
|
Max(MinimumAllocationLimitGrowingStep(),
|
||||||
static_cast<intptr_t>(
|
static_cast<intptr_t>(
|
||||||
static_cast<double>(old_generation_allocation_limit_) *
|
static_cast<double>(old_generation_allocation_limit_) *
|
||||||
(tracer()->AverageSurvivalRatio() / 100)));
|
(tracer()->AverageSurvivalRatio() / 100)));
|
||||||
@ -5151,7 +5151,7 @@ intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor,
|
|||||||
CHECK(factor > 1.0);
|
CHECK(factor > 1.0);
|
||||||
CHECK(old_gen_size > 0);
|
CHECK(old_gen_size > 0);
|
||||||
intptr_t limit = static_cast<intptr_t>(old_gen_size * factor);
|
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();
|
limit += new_space_.Capacity();
|
||||||
intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
|
intptr_t halfway_to_the_max = (old_gen_size + max_old_generation_size_) / 2;
|
||||||
return Min(limit, halfway_to_the_max);
|
return Min(limit, halfway_to_the_max);
|
||||||
|
@ -519,9 +519,6 @@ class Heap {
|
|||||||
};
|
};
|
||||||
typedef List<Chunk> Reservation;
|
typedef List<Chunk> Reservation;
|
||||||
|
|
||||||
static const intptr_t kMinimumOldGenerationAllocationLimit =
|
|
||||||
8 * (Page::kPageSize > MB ? Page::kPageSize : MB);
|
|
||||||
|
|
||||||
static const int kInitalOldGenerationLimitFactor = 2;
|
static const int kInitalOldGenerationLimitFactor = 2;
|
||||||
|
|
||||||
#if V8_OS_ANDROID
|
#if V8_OS_ANDROID
|
||||||
@ -1803,6 +1800,15 @@ class Heap {
|
|||||||
void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed,
|
void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed,
|
||||||
double mutator_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. ========================================================
|
// Idle notification. ========================================================
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
// New space must be at max capacity to trigger pretenuring decision.
|
// New space must be at max capacity to trigger pretenuring decision.
|
||||||
// Flags: --allow-natives-syntax --verify-heap --max-semi-space-size=1
|
// Flags: --allow-natives-syntax --verify-heap --max-semi-space-size=1
|
||||||
|
// Flags: --expose-gc
|
||||||
|
|
||||||
var global = []; // Used to keep some objects alive.
|
var global = []; // Used to keep some objects alive.
|
||||||
|
|
||||||
@ -12,6 +13,8 @@ function Ctor() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gc();
|
||||||
|
|
||||||
for (var i = 0; i < 120; i++) {
|
for (var i = 0; i < 120; i++) {
|
||||||
// Make the "a" property long-lived, while everything else is short-lived.
|
// Make the "a" property long-lived, while everything else is short-lived.
|
||||||
global.push(Ctor().a);
|
global.push(Ctor().a);
|
||||||
|
Loading…
Reference in New Issue
Block a user