Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 66b19c8274b5a3a37671f1682b71bb1aa9fccbcc..ba9958b4ae40d53f4ab82274fca772b2b9c64237 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -295,7 +295,8 @@ void MarkCompactCollector::VerifyMarkbitsAreClean(PagedSpace* space) { |
while (it.has_next()) { |
Page* p = it.next(); |
- ASSERT(p->markbits()->IsClean()); |
+ CHECK(p->markbits()->IsClean()); |
+ CHECK_EQ(0, p->LiveBytes()); |
} |
} |
@@ -304,7 +305,8 @@ void MarkCompactCollector::VerifyMarkbitsAreClean(NewSpace* space) { |
while (it.has_next()) { |
NewSpacePage* p = it.next(); |
- ASSERT(p->markbits()->IsClean()); |
+ CHECK(p->markbits()->IsClean()); |
+ CHECK_EQ(0, p->LiveBytes()); |
} |
} |
@@ -402,7 +404,7 @@ bool Marking::TransferMark(Address old_start, Address new_start) { |
} |
-static const char* AllocationSpaceName(AllocationSpace space) { |
+const char* AllocationSpaceName(AllocationSpace space) { |
switch (space) { |
case NEW_SPACE: return "NEW_SPACE"; |
case OLD_POINTER_SPACE: return "OLD_POINTER_SPACE"; |
@@ -2528,9 +2530,10 @@ void MarkCompactCollector::EvacuateNewSpace() { |
MarkBit mark_bit = Marking::MarkBitFrom(object); |
if (mark_bit.Get()) { |
mark_bit.Clear(); |
+ // Don't bother decrementing live bytes count. We'll discard the |
+ // entire page at the end. |
int size = object->Size(); |
survivors_size += size; |
- MemoryChunk::IncrementLiveBytes(object->address(), -size); |
// Aggressively promote young survivors to the old space. |
if (TryPromoteObject(object, size)) { |
@@ -2621,6 +2624,7 @@ void MarkCompactCollector::EvacuateLiveObjectsFromPage(Page* p) { |
// Clear marking bits for current cell. |
cells[cell_index] = 0; |
} |
+ p->ResetLiveBytes(); |
} |
@@ -2819,6 +2823,7 @@ static void SweepPrecisely(PagedSpace* space, |
if (free_start != p->ObjectAreaEnd()) { |
space->Free(free_start, static_cast<int>(p->ObjectAreaEnd() - free_start)); |
} |
+ p->ResetLiveBytes(); |
} |
@@ -3308,6 +3313,7 @@ intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, Page* p) { |
if (cell_index == last_cell_index) { |
freed_bytes += static_cast<int>(space->Free(p->ObjectAreaStart(), |
static_cast<int>(size))); |
+ ASSERT_EQ(0, p->LiveBytes()); |
return freed_bytes; |
} |
// Grow the size of the start-of-page free space a little to get up to the |
@@ -3364,6 +3370,7 @@ intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, Page* p) { |
static_cast<int>(block_address - free_start)); |
} |
+ p->ResetLiveBytes(); |
return freed_bytes; |
} |