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

Unified Diff: runtime/vm/pages.cc

Issue 10876095: Increase the page space growth rate when there is insufficient free space. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « runtime/vm/pages.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 772806d260ffdcee2a21acd72d5bf70f8c67ee8c..c5ebaa59e7724abc219e8d4a3fd0fa0aed0743f9 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -466,6 +466,7 @@ PageSpaceController::PageSpaceController(int heap_growth_ratio,
: is_enabled_(false),
grow_heap_(heap_growth_rate),
heap_growth_ratio_(heap_growth_ratio),
+ desired_utilization_((100.0 - heap_growth_ratio) / 100.0),
heap_growth_rate_(heap_growth_rate),
garbage_collection_time_ratio_(garbage_collection_time_ratio) {
}
@@ -492,13 +493,14 @@ bool PageSpaceController::CanGrowPageSpace(intptr_t size_in_bytes) {
void PageSpaceController::EvaluateGarbageCollection(
- size_t in_use_before, size_t in_use_after, int64_t start, int64_t end) {
+ intptr_t in_use_before, intptr_t in_use_after, int64_t start, int64_t end) {
ASSERT(in_use_before >= in_use_after);
ASSERT(end >= start);
history_.AddGarbageCollectionTime(start, end);
int collected_garbage_ratio =
static_cast<int>((static_cast<double>(in_use_before - in_use_after) /
- static_cast<double>(in_use_before)) * 100);
+ static_cast<double>(in_use_before))
+ * 100.0);
bool enough_free_space =
(collected_garbage_ratio >= heap_growth_ratio_);
int garbage_collection_time_fraction =
@@ -525,7 +527,16 @@ void PageSpaceController::EvaluateGarbageCollection(
}
OS::PrintErr("\n");
}
- grow_heap_ = heap_growth_rate_;
+ if (!enough_free_space) {
+ intptr_t growth_target = static_cast<intptr_t>(in_use_after /
+ desired_utilization_);
+ intptr_t growth_in_bytes = Utils::RoundUp(growth_target - in_use_after,
+ PageSpace::kPageSize);
+ intptr_t growth_in_pages = growth_in_bytes / PageSpace::kPageSize;
+ grow_heap_ = Utils::Maximum(growth_in_pages, heap_growth_rate_);
+ } else {
+ grow_heap_ = heap_growth_rate_;
+ }
}
}
« no previous file with comments | « runtime/vm/pages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698