Commit 26fcd830 authored by mlippautz's avatar mlippautz Committed by Commit bot

[heap] Clean up stale store buffer entries for aborted pages.

Fix the missed store buffer entries for live objects on aborted pages. Marking
the page as scan_on_scavenge takes care of rebuilding the entries. Note that
this requires an additional case in the rebuilding logic as we cannot iterate an
aborted pages using the object layout, but rather have to use mark bits for
this.

BUG=chromium:524425, chromium:564498
LOG=N

Review URL: https://codereview.chromium.org/1497883003

Cr-Commit-Position: refs/heads/master@{#32610}
parent b12db257
...@@ -3292,8 +3292,13 @@ void MarkCompactCollector::EvacuatePagesInParallel() { ...@@ -3292,8 +3292,13 @@ void MarkCompactCollector::EvacuatePagesInParallel() {
// happens upon moving (which we potentially didn't do). // happens upon moving (which we potentially didn't do).
// - Leave the page in the list of pages of a space since we could not // - Leave the page in the list of pages of a space since we could not
// fully evacuate it. // fully evacuate it.
// - Mark them for rescanning for store buffer entries as we otherwise
// might have stale store buffer entries that become "valid" again
// after reusing the memory. Note that all existing store buffer
// entries of such pages are filtered before rescanning.
DCHECK(p->IsEvacuationCandidate()); DCHECK(p->IsEvacuationCandidate());
p->SetFlag(Page::COMPACTION_WAS_ABORTED); p->SetFlag(Page::COMPACTION_WAS_ABORTED);
p->set_scan_on_scavenge(true);
abandoned_pages++; abandoned_pages++;
break; break;
case MemoryChunk::kCompactingFinalize: case MemoryChunk::kCompactingFinalize:
...@@ -3705,9 +3710,6 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() { ...@@ -3705,9 +3710,6 @@ void MarkCompactCollector::EvacuateNewSpaceAndCandidates() {
// First pass on aborted pages, fixing up all live objects. // First pass on aborted pages, fixing up all live objects.
if (p->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) { if (p->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) {
// Clearing the evacuation candidate flag here has the effect of
// stopping recording of slots for it in the following pointer
// update phases.
p->ClearEvacuationCandidate(); p->ClearEvacuationCandidate();
VisitLiveObjects(p, &updating_visitor); VisitLiveObjects(p, &updating_visitor);
} }
......
...@@ -797,6 +797,7 @@ class MarkCompactCollector { ...@@ -797,6 +797,7 @@ class MarkCompactCollector {
base::Semaphore pending_compaction_tasks_semaphore_; base::Semaphore pending_compaction_tasks_semaphore_;
friend class Heap; friend class Heap;
friend class StoreBuffer;
}; };
......
...@@ -490,13 +490,22 @@ void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback) { ...@@ -490,13 +490,22 @@ void StoreBuffer::IteratePointersToNewSpace(ObjectSlotCallback slot_callback) {
} }
} }
} else { } else {
heap_->mark_compact_collector()->SweepOrWaitUntilSweepingCompleted( if (page->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) {
page); // Aborted pages require iterating using mark bits because they
HeapObjectIterator iterator(page); // don't have an iterable object layout before sweeping (which can
for (HeapObject* heap_object = iterator.Next(); heap_object != NULL; // only happen later). Note that we can never reach an
heap_object = iterator.Next()) { // aborted page through the scavenger.
// We iterate over objects that contain new space pointers only. DCHECK_EQ(heap_->gc_state(), Heap::MARK_COMPACT);
heap_object->IterateBody(&visitor); heap_->mark_compact_collector()->VisitLiveObjects(page, &visitor);
} else {
heap_->mark_compact_collector()
->SweepOrWaitUntilSweepingCompleted(page);
HeapObjectIterator iterator(page);
for (HeapObject* heap_object = iterator.Next();
heap_object != nullptr; heap_object = iterator.Next()) {
// We iterate over objects that contain new space pointers only.
heap_object->IterateBody(&visitor);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment