Commit d5419bb6 authored by ulan's avatar ulan Committed by Commit bot

Take into account freed global handles for heap growing.

This partially brings back the heuristic from v8 4.44.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#29947}
parent bc49e1e1
......@@ -1327,7 +1327,8 @@ bool Heap::PerformGarbageCollection(
// Register the amount of external allocated memory.
amount_of_external_allocated_memory_at_last_global_gc_ =
amount_of_external_allocated_memory_;
SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed);
SetOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed,
freed_global_handles);
} else if (HasLowYoungGenerationAllocationRate() &&
old_generation_size_configured_) {
DampenOldGenerationAllocationLimit(old_gen_size, gc_speed, mutator_speed);
......@@ -5655,7 +5656,11 @@ intptr_t Heap::CalculateOldGenerationAllocationLimit(double factor,
void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
double gc_speed,
double mutator_speed) {
double mutator_speed,
int freed_global_handles) {
const int kFreedGlobalHandlesThreshold = 700;
const double kMaxHeapGrowingFactorForManyFreedGlobalHandles = 1.3;
double factor = HeapGrowingFactor(gc_speed, mutator_speed);
if (FLAG_trace_gc_verbose) {
......@@ -5673,6 +5678,10 @@ void Heap::SetOldGenerationAllocationLimit(intptr_t old_gen_size,
factor = Min(factor, kMaxHeapGrowingFactorMemoryConstrained);
}
if (freed_global_handles >= kFreedGlobalHandlesThreshold) {
factor = Min(factor, kMaxHeapGrowingFactorForManyFreedGlobalHandles);
}
if (FLAG_stress_compaction ||
mark_compact_collector()->reduce_memory_footprint_) {
factor = kMinHeapGrowingFactor;
......
......@@ -1179,7 +1179,8 @@ class Heap {
// Sets the allocation limit to trigger the next full garbage collection.
void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double gc_speed,
double mutator_speed);
double mutator_speed,
int freed_global_handles);
// Decrease the allocation limit if the new limit based on the given
// parameters is lower than the current limit.
......
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