| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MarkingVisitorImpl_h | 5 #ifndef MarkingVisitorImpl_h |
| 6 #define MarkingVisitorImpl_h | 6 #define MarkingVisitorImpl_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" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // release builds will crash in the following header->isMarked() | 34 // release builds will crash in the following header->isMarked() |
| 35 // because all the entries of the orphaned heaps are zapped. | 35 // because all the entries of the orphaned heaps are zapped. |
| 36 ASSERT(!pageFromObject(objectPointer)->orphaned()); | 36 ASSERT(!pageFromObject(objectPointer)->orphaned()); |
| 37 | 37 |
| 38 if (header->isMarked()) | 38 if (header->isMarked()) |
| 39 return; | 39 return; |
| 40 | 40 |
| 41 #if ENABLE(ASSERT) | 41 #if ENABLE(ASSERT) |
| 42 toDerived()->checkMarkingAllowed(); | 42 toDerived()->checkMarkingAllowed(); |
| 43 ASSERT(Heap::findPageFromAddress(header)); | 43 ASSERT(Heap::findPageFromAddress(header)); |
| 44 ASSERT(toDerived()->markingMode() != Visitor::WeakProcessing); |
| 44 #endif | 45 #endif |
| 45 header->mark(); | 46 header->mark(); |
| 46 | 47 |
| 47 #if ENABLE(GC_PROFILING) | 48 #if ENABLE(GC_PROFILING) |
| 48 toDerived()->recordObjectGraphEdge(objectPointer); | 49 toDerived()->recordObjectGraphEdge(objectPointer); |
| 49 #endif | 50 #endif |
| 50 | 51 |
| 51 if (callback) | 52 if (callback) |
| 52 Heap::pushTraceCallback(const_cast<void*>(objectPointer), callback); | 53 Heap::pushTraceCallback(const_cast<void*>(objectPointer), callback); |
| 53 } | 54 } |
| 54 | 55 |
| 55 inline void mark(const void* objectPointer, TraceCallback callback) | 56 inline void mark(const void* objectPointer, TraceCallback callback) |
| 56 { | 57 { |
| 57 if (!objectPointer) | 58 if (!objectPointer) |
| 58 return; | 59 return; |
| 59 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); | 60 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); |
| 60 markHeader(header, header->payload(), callback); | 61 markHeader(header, header->payload(), callback); |
| 61 } | 62 } |
| 62 | 63 |
| 63 inline void registerDelayedMarkNoTracing(const void* objectPointer) | 64 inline void registerDelayedMarkNoTracing(const void* objectPointer) |
| 64 { | 65 { |
| 66 ASSERT(toDerived()->markingMode() != Visitor::WeakProcessing); |
| 65 Heap::pushPostMarkingCallback(const_cast<void*>(objectPointer), &markNoT
racingCallback); | 67 Heap::pushPostMarkingCallback(const_cast<void*>(objectPointer), &markNoT
racingCallback); |
| 66 } | 68 } |
| 67 | 69 |
| 68 inline void registerWeakMembers(const void* closure, const void* objectPoint
er, WeakCallback callback) | 70 inline void registerWeakMembers(const void* closure, const void* objectPoint
er, WeakCallback callback) |
| 69 { | 71 { |
| 72 ASSERT(toDerived()->markingMode() != Visitor::WeakProcessing); |
| 70 Heap::pushThreadLocalWeakCallback(const_cast<void*>(closure), const_cast
<void*>(objectPointer), callback); | 73 Heap::pushThreadLocalWeakCallback(const_cast<void*>(closure), const_cast
<void*>(objectPointer), callback); |
| 71 } | 74 } |
| 72 | 75 |
| 73 inline void registerWeakTable(const void* closure, EphemeronCallback iterati
onCallback, EphemeronCallback iterationDoneCallback) | 76 inline void registerWeakTable(const void* closure, EphemeronCallback iterati
onCallback, EphemeronCallback iterationDoneCallback) |
| 74 { | 77 { |
| 78 ASSERT(toDerived()->markingMode() != Visitor::WeakProcessing); |
| 75 Heap::registerWeakTable(const_cast<void*>(closure), iterationCallback, i
terationDoneCallback); | 79 Heap::registerWeakTable(const_cast<void*>(closure), iterationCallback, i
terationDoneCallback); |
| 76 } | 80 } |
| 77 | 81 |
| 78 #if ENABLE(ASSERT) | 82 #if ENABLE(ASSERT) |
| 79 inline bool weakTableRegistered(const void* closure) | 83 inline bool weakTableRegistered(const void* closure) |
| 80 { | 84 { |
| 81 return Heap::weakTableRegistered(closure); | 85 return Heap::weakTableRegistered(closure); |
| 82 } | 86 } |
| 83 #endif | 87 #endif |
| 84 | 88 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 105 } | 109 } |
| 106 | 110 |
| 107 Derived* toDerived() | 111 Derived* toDerived() |
| 108 { | 112 { |
| 109 return static_cast<Derived*>(this); | 113 return static_cast<Derived*>(this); |
| 110 } | 114 } |
| 111 | 115 |
| 112 protected: | 116 protected: |
| 113 inline void registerWeakCellWithCallback(void** cell, WeakCallback callback) | 117 inline void registerWeakCellWithCallback(void** cell, WeakCallback callback) |
| 114 { | 118 { |
| 119 ASSERT(toDerived()->markingMode() != Visitor::WeakProcessing); |
| 115 Heap::pushGlobalWeakCallback(cell, callback); | 120 Heap::pushGlobalWeakCallback(cell, callback); |
| 116 } | 121 } |
| 117 | 122 |
| 118 private: | 123 private: |
| 119 static void markNoTracingCallback(Visitor* visitor, void* object) | 124 static void markNoTracingCallback(Visitor* visitor, void* object) |
| 120 { | 125 { |
| 121 visitor->markNoTracing(object); | 126 visitor->markNoTracing(object); |
| 122 } | 127 } |
| 123 }; | 128 }; |
| 124 | 129 |
| 125 } // namespace blink | 130 } // namespace blink |
| 126 | 131 |
| 127 #endif | 132 #endif |
| OLD | NEW |