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

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: Adjust factor 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..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_; }
« 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