Chromium Code Reviews| Index: src/heap/heap.h |
| diff --git a/src/heap/heap.h b/src/heap/heap.h |
| index b42f7b8efc073a49256e4518dba42350fc7437a4..83e73fc8481c0944b129f8e42be9442fdef411b1 100644 |
| --- a/src/heap/heap.h |
| +++ b/src/heap/heap.h |
| @@ -1158,14 +1158,41 @@ 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; |
| + |
| + bool NextGCLikelyToFreeMore(int freed_handles, int fragmentation_percent) { |
| + return freed_handles > 0 || |
| + fragmentation_percent >= kLowFragmentationPercent; |
| + } |
| + |
| // 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* total_committed) { |
| + 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(); |
| + } |
| + *total_committed = committed; |
| + return 100 - static_cast<int>(100.0 * live / committed); |
|
Hannes Payer (out of office)
2015/06/03 06:32:57
committed should never be 0 in current v8, but can
|
| + } |
| // Indicates whether inline bump-pointer allocation has been disabled. |
| bool inline_allocation_disabled() { return inline_allocation_disabled_; } |