Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index 1b343459e8bd013baa3918b92f2c5b6d7e36139a..fde7d8ecf25ca9b0981cbc7b38b6f0e5f255c154 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -3319,10 +3319,9 @@ |
Page* p, FreeListRebuildingMode free_list_mode, |
FreeSpaceTreatmentMode free_space_mode) { |
Space* space = p->owner(); |
- AllocationSpace identity = space->identity(); |
DCHECK_NOT_NULL(space); |
- DCHECK(free_list_mode == IGNORE_FREE_LIST || identity == OLD_SPACE || |
- identity == CODE_SPACE || identity == MAP_SPACE); |
+ DCHECK(free_list_mode == IGNORE_FREE_LIST || space->identity() == OLD_SPACE || |
+ space->identity() == CODE_SPACE || space->identity() == MAP_SPACE); |
DCHECK(!p->IsEvacuationCandidate() && !p->SweepingDone()); |
// Before we sweep objects on the page, we free dead array buffers which |
@@ -3351,8 +3350,6 @@ |
LiveObjectIterator<kBlackObjects> it(p); |
HeapObject* object = NULL; |
- bool clear_slots = |
- p->old_to_new_slots() && (identity == OLD_SPACE || identity == MAP_SPACE); |
while ((object = it.Next()) != NULL) { |
DCHECK(Marking::IsBlack(ObjectMarking::MarkBitFrom(object))); |
Address free_end = object->address(); |
@@ -3368,11 +3365,6 @@ |
} else { |
p->heap()->CreateFillerObjectAt(free_start, size, |
ClearRecordedSlots::kNo); |
- } |
- |
- if (clear_slots) { |
- RememberedSet<OLD_TO_NEW>::RemoveRange(p, free_start, free_end, |
- SlotSet::KEEP_EMPTY_BUCKETS); |
} |
} |
Map* map = object->synchronized_map(); |
@@ -3389,6 +3381,9 @@ |
free_start = free_end + size; |
} |
+ // Clear the mark bits of that page and reset live bytes count. |
+ p->ClearLiveness(); |
+ |
if (free_start != p->area_end()) { |
int size = static_cast<int>(p->area_end() - free_start); |
if (free_space_mode == ZAP_FREE_SPACE) { |
@@ -3402,16 +3397,7 @@ |
p->heap()->CreateFillerObjectAt(free_start, size, |
ClearRecordedSlots::kNo); |
} |
- |
- if (clear_slots) { |
- RememberedSet<OLD_TO_NEW>::RemoveRange(p, free_start, p->area_end(), |
- SlotSet::KEEP_EMPTY_BUCKETS); |
- } |
- } |
- |
- // Clear the mark bits of that page and reset live bytes count. |
- p->ClearLiveness(); |
- |
+ } |
p->concurrent_sweeping_state().SetValue(Page::kSweepingDone); |
if (free_list_mode == IGNORE_FREE_LIST) return 0; |
return FreeList::GuaranteedAllocatable(static_cast<int>(max_freed_bytes)); |
@@ -3827,7 +3813,9 @@ |
if (identity == NEW_SPACE) { |
RawSweep(page, IGNORE_FREE_LIST, free_space_mode); |
} else { |
- if (identity == CODE_SPACE) { |
+ if (identity == OLD_SPACE || identity == MAP_SPACE) { |
+ RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(heap_, page); |
+ } else { |
RememberedSet<OLD_TO_NEW>::ClearInvalidTypedSlots(heap_, page); |
} |
max_freed = RawSweep(page, REBUILD_FREE_LIST, free_space_mode); |