Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: src/heap/heap.h

Issue 1161603006: Take into account freed global handles and fragmentation when computing heap growing factor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_; }
« no previous file with comments | « no previous file | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698