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

Unified Diff: runtime/vm/pages.cc

Issue 187113003: Track external allocated memory for weak persistent handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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') | runtime/vm/scavenger.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/pages.cc
===================================================================
--- runtime/vm/pages.cc (revision 33396)
+++ runtime/vm/pages.cc (working copy)
@@ -126,6 +126,7 @@
max_capacity_in_words_(max_capacity_in_words),
capacity_in_words_(0),
used_in_words_(0),
+ external_in_words_(0),
sweeping_(false),
page_space_controller_(FLAG_heap_growth_space_ratio,
FLAG_heap_growth_rate,
@@ -272,6 +273,18 @@
}
+void PageSpace::AllocateExternal(intptr_t size) {
+ intptr_t size_in_words = size >> kWordSizeLog2;
+ external_in_words_ += size_in_words;
+}
+
+
+void PageSpace::FreeExternal(intptr_t size) {
+ intptr_t size_in_words = size >> kWordSizeLog2;
+ external_in_words_ -= size_in_words;
+}
+
+
bool PageSpace::Contains(uword addr) const {
HeapPage* page = pages_;
while (page != NULL) {
@@ -473,6 +486,9 @@
}
}
+ // Save old value before GCMarker visits the weak persistent handles.
+ intptr_t external_before_in_words = external_in_words_;
+
// Mark all reachable old-gen objects.
bool collect_code = FLAG_collect_code && ShouldCollectCode();
GCMarker marker(heap_);
@@ -546,10 +562,11 @@
int64_t end = OS::GetCurrentTimeMicros();
- // Record signals for growth control.
- page_space_controller_.EvaluateGarbageCollection(used_before_in_words,
- used_in_words,
- start, end);
+ // Record signals for growth control. Include size of external allocations.
+ page_space_controller_.EvaluateGarbageCollection(
+ used_before_in_words + external_before_in_words,
+ used_in_words + external_in_words_,
+ start, end);
heap_->RecordTime(kMarkObjects, mid1 - start);
heap_->RecordTime(kResetFreeLists, mid2 - mid1);
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698