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

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

Issue 1994933002: [heap] Get rid of the wrapper in remembered-set.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/heap.cc ('k') | 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 d410797bdf7b71fae2b8c54464c7d2048784963b..113518da02e71c6286ad5d120435a61bc2240bb4 100644
--- a/src/heap/mark-compact.cc
+++ b/src/heap/mark-compact.cc
@@ -3666,8 +3666,9 @@ class PointerUpdateJobTraits {
private:
static void UpdateUntypedPointers(Heap* heap, MemoryChunk* chunk) {
if (direction == OLD_TO_NEW) {
- RememberedSet<OLD_TO_NEW>::IterateWithWrapper(heap, chunk,
- UpdateOldToNewSlot);
+ RememberedSet<OLD_TO_NEW>::Iterate(chunk, [heap, chunk](Address slot) {
+ return CheckAndUpdateOldToNewSlot(heap, slot);
+ });
} else {
RememberedSet<OLD_TO_OLD>::Iterate(chunk, [](Address slot) {
return UpdateSlot(reinterpret_cast<Object**>(slot));
@@ -3685,14 +3686,30 @@ class PointerUpdateJobTraits {
}
}
- static void UpdateOldToNewSlot(HeapObject** address, HeapObject* object) {
- MapWord map_word = object->map_word();
- // There could still be stale pointers in large object space, map space,
- // and old space for pages that have been promoted.
- if (map_word.IsForwardingAddress()) {
- // Update the corresponding slot.
- *address = map_word.ToForwardingAddress();
+ static SlotCallbackResult CheckAndUpdateOldToNewSlot(Heap* heap,
+ Address slot_address) {
+ Object** slot = reinterpret_cast<Object**>(slot_address);
+ if (heap->InFromSpace(*slot)) {
+ HeapObject* heap_object = reinterpret_cast<HeapObject*>(*slot);
+ DCHECK(heap_object->IsHeapObject());
+ MapWord map_word = heap_object->map_word();
+ // There could still be stale pointers in large object space, map space,
+ // and old space for pages that have been promoted.
+ if (map_word.IsForwardingAddress()) {
+ // Update the corresponding slot.
+ *slot = map_word.ToForwardingAddress();
+ }
+ // If the object was in from space before and is after executing the
+ // callback in to space, the object is still live.
+ // Unfortunately, we do not know about the slot. It could be in a
+ // just freed free space object.
+ if (heap->InToSpace(*slot)) {
+ return KEEP_SLOT;
+ }
+ } else {
+ DCHECK(!heap->InNewSpace(*slot));
}
+ return REMOVE_SLOT;
}
};
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/remembered-set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698