Index: src/heap/mark-compact.cc |
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
index d2ee53dd4451ec8ee490478755845522507c3a7f..da5fe3501a05353143db03a1ccd2b433368f0631 100644 |
--- a/src/heap/mark-compact.cc |
+++ b/src/heap/mark-compact.cc |
@@ -3320,10 +3320,9 @@ int MarkCompactCollector::Sweeper::RawSweep( |
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 |
@@ -3352,8 +3351,6 @@ int MarkCompactCollector::Sweeper::RawSweep( |
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(); |
@@ -3371,11 +3368,6 @@ int MarkCompactCollector::Sweeper::RawSweep( |
p->heap()->CreateFillerObjectAt(free_start, static_cast<int>(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(); |
int size = object->SizeFromMap(map); |
@@ -3391,6 +3383,9 @@ int MarkCompactCollector::Sweeper::RawSweep( |
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()) { |
CHECK_GT(p->area_end(), free_start); |
size_t size = static_cast<size_t>(p->area_end() - free_start); |
@@ -3405,16 +3400,7 @@ int MarkCompactCollector::Sweeper::RawSweep( |
p->heap()->CreateFillerObjectAt(free_start, static_cast<int>(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)); |
@@ -3830,7 +3816,9 @@ int MarkCompactCollector::Sweeper::ParallelSweepPage(Page* page, |
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); |