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

Unified Diff: src/heap/remembered-set.cc

Issue 1735523002: Reland "Replace slots buffer with remembered set. (patchset #14 id:250001 of https://codereview.chr… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more int->size_t Created 4 years, 10 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 | « src/heap/remembered-set.h ('k') | src/heap/slot-set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/remembered-set.cc
diff --git a/src/heap/remembered-set.cc b/src/heap/remembered-set.cc
index d9d59142737ef85c429355cd52029b30b2b5005d..f41318c312fbb1be2ba2ad369c4ed77b252280e1 100644
--- a/src/heap/remembered-set.cc
+++ b/src/heap/remembered-set.cc
@@ -24,8 +24,7 @@ void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) {
if (slots != nullptr) {
slots->Iterate([heap](Address addr) {
Object** slot = reinterpret_cast<Object**>(addr);
- return IsValidSlot(heap, slot) ? SlotSet::KEEP_SLOT
- : SlotSet::REMOVE_SLOT;
+ return IsValidSlot(heap, slot) ? KEEP_SLOT : REMOVE_SLOT;
});
}
}
@@ -33,17 +32,24 @@ void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) {
template <PointerDirection direction>
void RememberedSet<direction>::VerifyValidSlots(Heap* heap) {
- STATIC_ASSERT(direction == OLD_TO_NEW);
Iterate(heap, [heap](Address addr) {
- Object** slot = reinterpret_cast<Object**>(addr);
- Object* object = *slot;
- if (Page::FromAddress(addr)->owner() != nullptr &&
- Page::FromAddress(addr)->owner()->identity() == OLD_SPACE) {
- CHECK(IsValidSlot(heap, slot));
- heap->mark_compact_collector()->VerifyIsSlotInLiveObject(
- reinterpret_cast<Address>(slot), HeapObject::cast(object));
+ HeapObject* obj =
+ heap->mark_compact_collector()->FindBlackObjectBySlotSlow(addr);
+ if (obj == nullptr) {
+ // The slot is in dead object.
+ MemoryChunk* chunk = MemoryChunk::FromAnyPointerAddress(heap, addr);
+ AllocationSpace owner = chunk->owner()->identity();
+ // The old to old remembered set should not have dead slots.
+ CHECK_NE(direction, OLD_TO_OLD);
+ // The old to new remembered set is allowed to have slots in dead
+ // objects only in map and large object space because these spaces cannot
+ // have raw untaged pointers.
+ CHECK(owner == MAP_SPACE || owner == LO_SPACE);
+ } else {
+ int offset = static_cast<int>(addr - obj->address());
+ CHECK(obj->IsValidSlot(offset));
}
- return SlotSet::KEEP_SLOT;
+ return KEEP_SLOT;
});
}
@@ -64,6 +70,7 @@ bool RememberedSet<direction>::IsValidSlot(Heap* heap, Object** slot) {
template void RememberedSet<OLD_TO_NEW>::ClearInvalidSlots(Heap* heap);
template void RememberedSet<OLD_TO_NEW>::VerifyValidSlots(Heap* heap);
+template void RememberedSet<OLD_TO_OLD>::VerifyValidSlots(Heap* heap);
} // namespace internal
} // namespace v8
« no previous file with comments | « src/heap/remembered-set.h ('k') | src/heap/slot-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698