Index: src/heap/remembered-set.cc |
diff --git a/src/heap/remembered-set.cc b/src/heap/remembered-set.cc |
index 6e27c288cf69cafae6fb7a0a06f5b23ee2ecad1e..e6a4a5f983bcc3590fe4da0da76fe95fc1adcfe3 100644 |
--- a/src/heap/remembered-set.cc |
+++ b/src/heap/remembered-set.cc |
@@ -39,6 +39,19 @@ void RememberedSet<direction>::ClearInvalidSlots(Heap* heap) { |
}); |
} |
} |
+ if (Heap::ShouldZapGarbage()) { |
+ // Need to filter invalid slots as we overwrite them with zap values in |
+ // during sweeping which runs concurrently with pointer updating. |
+ for (MemoryChunk* chunk : *heap->map_space()) { |
+ SlotSet* slots = GetSlotSet(chunk); |
+ if (slots != nullptr) { |
+ slots->Iterate([heap, chunk](Address addr) { |
+ Object** slot = reinterpret_cast<Object**>(addr); |
+ return IsValidSlot(heap, chunk, slot) ? KEEP_SLOT : REMOVE_SLOT; |
+ }); |
+ } |
+ } |
+ } |
} |
template <PointerDirection direction> |