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

Unified Diff: runtime/vm/gc_sweeper.cc

Issue 2993383002: [vm] Compute per-HeapPage usage during sweeping. (Closed)
Patch Set: Created 3 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 | « no previous file | runtime/vm/pages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_sweeper.cc
diff --git a/runtime/vm/gc_sweeper.cc b/runtime/vm/gc_sweeper.cc
index cb1d34a583160914ac65e84183199ae3e643244d..4150e9b453d2669e67bf562c9d0ea8fa87cdc4cc 100644
--- a/runtime/vm/gc_sweeper.cc
+++ b/runtime/vm/gc_sweeper.cc
@@ -22,7 +22,7 @@ bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) {
}
// Keep track whether this page is still in use.
- bool in_use = false;
+ intptr_t used_in_bytes = 0;
bool is_executable = (page->type() == HeapPage::kExecutable);
uword start = page->object_start();
@@ -36,7 +36,7 @@ bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) {
// Found marked object. Clear the mark bit and update swept bytes.
raw_obj->ClearMarkBit();
obj_size = raw_obj->Size();
- in_use = true;
+ used_in_bytes += obj_size;
} else {
uword free_end = current + raw_obj->Size();
while (free_end < end) {
@@ -69,7 +69,8 @@ bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) {
}
ASSERT(current == end);
- return in_use;
+ page->set_used_in_bytes(used_in_bytes);
+ return used_in_bytes != 0; // In use.
}
intptr_t GCSweeper::SweepLargePage(HeapPage* page) {
« no previous file with comments | « no previous file | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698