Chromium Code Reviews| Index: src/heap/heap.h |
| diff --git a/src/heap/heap.h b/src/heap/heap.h |
| index b42f7b8efc073a49256e4518dba42350fc7437a4..3cd07a9f529ae334574fcd462e7ed6737d243b11 100644 |
| --- a/src/heap/heap.h |
| +++ b/src/heap/heap.h |
| @@ -1158,14 +1158,38 @@ class Heap { |
| static const int kTraceRingBufferSize = 512; |
| + // These constant are used in HeapGrowingFactor() and to estimate if |
| + // the next GC is likely to free more memory. |
| + static const int kLowFragmentationPercent = 40; |
| + static const int kHighFragmentationPercent = 80; |
| + |
| // Calculates the allocation limit based on a given growing factor and a |
| // given old generation size. |
| intptr_t CalculateOldGenerationAllocationLimit(double factor, |
| intptr_t old_gen_size); |
| // Sets the allocation limit to trigger the next full garbage collection. |
| - void SetOldGenerationAllocationLimit(intptr_t old_gen_size, |
| - size_t current_allocation_throughput); |
| + void SetOldGenerationAllocationLimit(intptr_t old_gen_size, double factor); |
| + |
| + // Calculates the factor for old generation allocation limit. |
| + double HeapGrowingFactor(int freed_global_handles, |
| + size_t allocation_throughput, |
| + int fragmentation_percent); |
| + |
| + // Percentage of free space in old generation space that have compaction |
| + // enabled. |
| + int FragmentationOfCompactedSpacesInPercent() { |
| + size_t live = old_space_->SizeOfObjects(); |
| + size_t committed = old_space_->CommittedMemory(); |
| + if (FLAG_compact_code_space && FLAG_incremental_code_compaction) { |
| + live += code_space_->SizeOfObjects(); |
| + committed += code_space_->CommittedMemory(); |
| + } |
| + // Allow slack of one page for each space. |
|
Hannes Payer (out of office)
2015/06/02 08:23:00
I think this function should only return the real
ulan
2015/06/02 12:27:05
Done.
|
| + const size_t kSlack = 2 * Page::kPageSize; |
| + if (live + kSlack >= committed || FLAG_never_compact) return 0; |
| + return 100 - static_cast<int>(100.0 * live / committed); |
| + } |
| // Indicates whether inline bump-pointer allocation has been disabled. |
| bool inline_allocation_disabled() { return inline_allocation_disabled_; } |