| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VisitorImpl_h | 5 #ifndef VisitorImpl_h |
| 6 #define VisitorImpl_h | 6 #define VisitorImpl_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/ThreadState.h" | 9 #include "platform/heap/ThreadState.h" |
| 10 #include "platform/heap/Visitor.h" | 10 #include "platform/heap/Visitor.h" |
| 11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 inline void Visitor::markHeader(HeapObjectHeader* header, | 15 inline void Visitor::markHeader(HeapObjectHeader* header, |
| 16 const void* objectPointer, | 16 const void* objectPointer, |
| 17 TraceCallback callback) { | 17 TraceCallback callback) { |
| 18 DCHECK(header); | 18 DCHECK(header); |
| 19 DCHECK(objectPointer); | 19 DCHECK(objectPointer); |
| 20 | 20 |
| 21 // If you hit this DCHECK, it means that there is a dangling pointer | |
| 22 // from a live thread heap to a dead thread heap. We must eliminate | |
| 23 // the dangling pointer. | |
| 24 // Release builds don't have the DCHECK, but it is OK because | |
| 25 // release builds will crash in the following header->isMarked() | |
| 26 // because all the entries of the orphaned arenas are zapped. | |
| 27 DCHECK(!pageFromObject(objectPointer)->orphaned()); | |
| 28 | |
| 29 if (header->isMarked()) | 21 if (header->isMarked()) |
| 30 return; | 22 return; |
| 31 | 23 |
| 32 DCHECK(ThreadState::current()->isInGC()); | 24 DCHECK(ThreadState::current()->isInGC()); |
| 33 DCHECK(getMarkingMode() != VisitorMarkingMode::WeakProcessing); | 25 DCHECK(getMarkingMode() != VisitorMarkingMode::WeakProcessing); |
| 34 | 26 |
| 35 // A GC should only mark the objects that belong in its heap. | 27 // A GC should only mark the objects that belong in its heap. |
| 36 DCHECK(&pageFromObject(objectPointer)->arena()->getThreadState()->heap() == | 28 DCHECK(&pageFromObject(objectPointer)->arena()->getThreadState()->heap() == |
| 37 &heap()); | 29 &heap()); |
| 38 | 30 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void* callbackData) { | 120 void* callbackData) { |
| 129 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction) | 121 if (getMarkingMode() != VisitorMarkingMode::GlobalMarkingWithCompaction) |
| 130 return; | 122 return; |
| 131 heap().registerMovingObjectCallback( | 123 heap().registerMovingObjectCallback( |
| 132 reinterpret_cast<MovableReference>(backingStore), callback, callbackData); | 124 reinterpret_cast<MovableReference>(backingStore), callback, callbackData); |
| 133 } | 125 } |
| 134 | 126 |
| 135 } // namespace blink | 127 } // namespace blink |
| 136 | 128 |
| 137 #endif | 129 #endif |
| OLD | NEW |