Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index 78bafce3d6fc52d9c871eb2286df5e6970ed74f6..b36ebab8fda19317638c07f77626e7fff30c324d 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -3632,34 +3632,37 @@ class PointerUpdateJobTraits { |
| 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); |
| + base::NoBarrierAtomicValue<Object*>* slot = |
| + base::NoBarrierAtomicValue<Object*>::FromAddress(slot_address); |
| + Object* slot_reference = slot->Value(); |
| + if (heap->InFromSpace(slot_reference)) { |
| + HeapObject* heap_object = reinterpret_cast<HeapObject*>(slot_reference); |
| 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(); |
| + slot->SetValue(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)) { |
| + slot_reference = slot->Value(); |
|
Michael Lippautz
2016/10/12 11:36:17
nit: You can manually inline this slot->Value() ca
Hannes Payer (out of office)
2016/10/12 11:38:23
Done.
|
| + if (heap->InToSpace(slot_reference)) { |
| return KEEP_SLOT; |
| } |
| - } else if (heap->InToSpace(*slot)) { |
| + } else if (heap->InToSpace(slot_reference)) { |
| // Slots can point to "to" space if the page has been moved, or if the |
| // slot has been recorded multiple times in the remembered set. Since |
| // there is no forwarding information present we need to check the |
| // markbits to determine liveness. |
| - if (Marking::IsBlack( |
| - ObjectMarking::MarkBitFrom(reinterpret_cast<HeapObject*>(*slot)))) |
| + if (Marking::IsBlack(ObjectMarking::MarkBitFrom( |
| + reinterpret_cast<HeapObject*>(slot_reference)))) |
| return KEEP_SLOT; |
| } else { |
| - DCHECK(!heap->InNewSpace(*slot)); |
| + DCHECK(!heap->InNewSpace(slot_reference)); |
| } |
| return REMOVE_SLOT; |
| } |