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

Unified Diff: runtime/vm/gc_sweeper.cc

Issue 14190014: - Disassociate old page size from new allocatable size. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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/gc_marker.cc ('k') | runtime/vm/heap.h » ('j') | runtime/vm/heap.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_sweeper.cc
===================================================================
--- runtime/vm/gc_sweeper.cc (revision 22017)
+++ runtime/vm/gc_sweeper.cc (working copy)
@@ -14,33 +14,21 @@
intptr_t GCSweeper::SweepPage(HeapPage* page, FreeList* freelist) {
// Keep track of the discovered live object sizes to be able to finish
// sweeping early. Reset the per page in_use count for the next marking phase.
- intptr_t in_use_swept = 0;
- intptr_t in_use = page->used();
- page->set_used(0);
+ intptr_t in_use = 0;
- // Whole page is empty. Do not enter anything into the freelist.
- if (in_use == 0) {
- return 0;
- }
-
bool is_executable = (page->type() == HeapPage::kExecutable);
- uword current = page->object_start();
+ uword start = page->object_start();
uword end = page->object_end();
+ uword current = start;
while (current < end) {
intptr_t obj_size;
- if (in_use_swept == in_use) {
- // No more marked objects will be found on this page.
- obj_size = end - current;
- freelist->Free(current, obj_size);
- break;
- }
RawObject* raw_obj = RawObject::FromAddr(current);
if (raw_obj->IsMarked()) {
// Found marked object. Clear the mark bit and update swept bytes.
raw_obj->ClearMarkBit();
obj_size = raw_obj->Size();
- in_use_swept += obj_size;
+ in_use += obj_size;
} else {
uword free_end = current + raw_obj->Size();
while (free_end < end) {
@@ -56,12 +44,16 @@
if (is_executable) {
memset(reinterpret_cast<void*>(current), 0xcc, obj_size);
}
- freelist->Free(current, obj_size);
+ if ((current != start) || (free_end != end)) {
+ // Only add to the free list if not covering the whole page.
+ freelist->Free(current, obj_size);
+ }
}
current += obj_size;
}
+ ASSERT(current == end);
- return in_use_swept;
+ return in_use;
}
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | runtime/vm/heap.h » ('j') | runtime/vm/heap.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698