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

Unified Diff: src/heap/mark-compact.cc

Issue 2418773002: [heap] Move slot filtering logic into sweeper. (Closed)
Patch Set: remove prefree mode Created 4 years, 2 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 | src/heap/remembered-set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/mark-compact.cc
diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc
index fde7d8ecf25ca9b0981cbc7b38b6f0e5f255c154..1b343459e8bd013baa3918b92f2c5b6d7e36139a 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -3319,9 +3319,10 @@ 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 || space->identity() == OLD_SPACE ||
- space->identity() == CODE_SPACE || space->identity() == MAP_SPACE);
+ DCHECK(free_list_mode == IGNORE_FREE_LIST || identity == OLD_SPACE ||
+ identity == CODE_SPACE || identity == MAP_SPACE);
DCHECK(!p->IsEvacuationCandidate() && !p->SweepingDone());
// Before we sweep objects on the page, we free dead array buffers which
@@ -3350,6 +3351,8 @@ 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();
@@ -3366,6 +3369,11 @@ int MarkCompactCollector::Sweeper::RawSweep(
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();
int size = object->SizeFromMap(map);
@@ -3381,9 +3389,6 @@ 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()) {
int size = static_cast<int>(p->area_end() - free_start);
if (free_space_mode == ZAP_FREE_SPACE) {
@@ -3397,7 +3402,16 @@ int MarkCompactCollector::Sweeper::RawSweep(
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));
@@ -3813,9 +3827,7 @@ int MarkCompactCollector::Sweeper::ParallelSweepPage(Page* page,
if (identity == NEW_SPACE) {
RawSweep(page, IGNORE_FREE_LIST, free_space_mode);
} else {
- if (identity == OLD_SPACE || identity == MAP_SPACE) {
- RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(heap_, page);
- } else {
+ if (identity == CODE_SPACE) {
RememberedSet<OLD_TO_NEW>::ClearInvalidTypedSlots(heap_, page);
}
max_freed = RawSweep(page, REBUILD_FREE_LIST, free_space_mode);
« no previous file with comments | « no previous file | src/heap/remembered-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698