Index: src/heap/incremental-marking.cc |
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc |
index ac6786729e32298a26f4717c339d20da9aae8e01..a7ac6b2be75fbbda6880ec9251aa0a443d718fe4 100644 |
--- a/src/heap/incremental-marking.cc |
+++ b/src/heap/incremental-marking.cc |
@@ -795,8 +795,14 @@ void IncrementalMarking::UpdateMarkingDequeAfterScavenge() { |
HeapObject* obj = array[current]; |
DCHECK(obj->IsHeapObject()); |
current = ((current + 1) & mask); |
- if (heap_->InNewSpace(obj)) { |
+ // Only pointers to from space have to be updated. |
+ if (heap_->InFromSpace(obj)) { |
MapWord map_word = obj->map_word(); |
+ // There may be objects on the marking deque that do not exist anymore, |
+ // e.g. left trimmed objects or objects from the root set (frames). |
+ // If these object are dead at scavenging time, their marking deque |
+ // entries will not point to forwarding addresses. Hence, we can discard |
+ // them. |
if (map_word.IsForwardingAddress()) { |
HeapObject* dest = map_word.ToForwardingAddress(); |
array[new_top] = dest; |