| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index 37eb00485f7ae463aadeb41b3a5d3a6b4143a70b..c4cb7d4466f1d6211c54599f3a66ca791867db8a 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -738,8 +738,7 @@ void Heap::GarbageCollectionEpilogue() {
|
| new_space_top_after_last_gc_ = new_space()->top();
|
| last_gc_time_ = MonotonicallyIncreasingTimeInMs();
|
|
|
| - ReduceNewSpaceSize(
|
| - tracer()->CurrentAllocationThroughputInBytesPerMillisecond());
|
| + ReduceNewSpaceSize();
|
| }
|
|
|
|
|
| @@ -1436,6 +1435,7 @@ static void VerifyNonPointerSpacePointers(Heap* heap) {
|
|
|
|
|
| void Heap::CheckNewSpaceExpansionCriteria() {
|
| + if (!HasLowYoungGenerationAllocationUtilization()) {
|
| if (FLAG_experimental_new_space_growth_heuristic) {
|
| if (new_space_.TotalCapacity() < new_space_.MaximumCapacity() &&
|
| survived_last_scavenge_ * 100 / new_space_.TotalCapacity() >= 10) {
|
| @@ -1451,6 +1451,7 @@ void Heap::CheckNewSpaceExpansionCriteria() {
|
| new_space_.Grow();
|
| survived_since_last_expansion_ = 0;
|
| }
|
| + }
|
| }
|
|
|
|
|
| @@ -4509,17 +4510,35 @@ void Heap::MakeHeapIterable() {
|
| }
|
|
|
|
|
| -bool Heap::HasLowAllocationRate(size_t allocation_rate) {
|
| +bool Heap::HasLowAllocationRate() {
|
| static const size_t kLowAllocationRate = 1000;
|
| + size_t allocation_rate =
|
| + tracer()->CurrentAllocationThroughputInBytesPerMillisecond();
|
| if (allocation_rate == 0) return false;
|
| return allocation_rate < kLowAllocationRate;
|
| }
|
|
|
|
|
| -void Heap::ReduceNewSpaceSize(size_t allocation_rate) {
|
| - if (!FLAG_predictable && HasLowAllocationRate(allocation_rate)) {
|
| - new_space_.Shrink();
|
| - UncommitFromSpace();
|
| +bool Heap::HasLowYoungGenerationAllocationUtilization() {
|
| + const double low_mutator_utilization = 0.01;
|
| + double allocation_speed = static_cast<double>(
|
| + tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond());
|
| + double scavenging_speed =
|
| + static_cast<double>(tracer()->ScavengeSpeedInBytesPerMillisecond());
|
| + double mutator_utilization =
|
| + allocation_speed / (allocation_speed + scavenging_speed);
|
| + return mutator_utilization < low_mutator_utilization;
|
| +}
|
| +
|
| +
|
| +void Heap::ReduceNewSpaceSize() {
|
| + if (!FLAG_predictable) {
|
| + if (HasLowYoungGenerationAllocationUtilization()) {
|
| + new_space_.Shrink();
|
| + }
|
| + if (HasLowAllocationRate()) {
|
| + UncommitFromSpace();
|
| + }
|
| }
|
| }
|
|
|
| @@ -4576,8 +4595,7 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState() {
|
| heap_state.current_allocation_throughput_in_bytes_per_ms =
|
| tracer()->CurrentAllocationThroughputInBytesPerMillisecond();
|
| intptr_t limit = old_generation_allocation_limit_;
|
| - if (HasLowAllocationRate(
|
| - heap_state.current_allocation_throughput_in_bytes_per_ms)) {
|
| + if (HasLowAllocationRate()) {
|
| limit = idle_old_generation_allocation_limit_;
|
| }
|
| heap_state.can_start_incremental_marking =
|
|
|