Chromium Code Reviews| Index: src/heap/heap.cc | 
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc | 
| index 5a10a5cd210ac4da9700d1a746410fc787f93c6c..ac8ceef4101da5b65a65a9667dd08657833b1a62 100644 | 
| --- a/src/heap/heap.cc | 
| +++ b/src/heap/heap.cc | 
| @@ -4565,8 +4565,16 @@ void Heap::MakeHeapIterable() { | 
| } | 
| -void Heap::ReduceNewSpaceSize(GCIdleTimeAction action) { | 
| - if (action.reduce_memory && | 
| +bool Heap::HasLowAllocationRate(GCIdleTimeHandler::HeapState heap_state) { | 
| + static const size_t kLowAllocationRate = 1000; | 
| + return heap_state.current_new_space_allocation_throughput_in_bytes_per_ms < | 
| 
 
ulan
2015/05/21 15:21:25
check for heap_state.current_new_space_allocation_
 
Hannes Payer (out of office)
2015/05/21 17:17:03
Good point! Done.
 
 | 
| + kLowAllocationRate; | 
| +} | 
| + | 
| + | 
| +void Heap::ReduceNewSpaceSize(GCIdleTimeAction action, | 
| + GCIdleTimeHandler::HeapState heap_state) { | 
| + if (HasLowAllocationRate(heap_state) && | 
| (action.type == DO_SCAVENGE || action.type == DO_FULL_GC || | 
| (action.type == DO_INCREMENTAL_MARKING && | 
| incremental_marking()->IsStopped()))) { | 
| @@ -4635,6 +4643,8 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState(bool reduce_memory) { | 
| heap_state.new_space_capacity = new_space_.Capacity(); | 
| heap_state.new_space_allocation_throughput_in_bytes_per_ms = | 
| tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond(); | 
| + heap_state.current_new_space_allocation_throughput_in_bytes_per_ms = | 
| + tracer()->CurrentNewSpaceAllocationThroughputInBytesPerMillisecond(); | 
| return heap_state; | 
| } | 
| @@ -4697,7 +4707,7 @@ bool Heap::PerformIdleTimeAction(GCIdleTimeAction action, | 
| break; | 
| } | 
| - ReduceNewSpaceSize(action); | 
| + ReduceNewSpaceSize(action, heap_state); | 
| return result; | 
| } |