| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Heap::registerWeakTable(const_cast<void*>(closure), iterationCallback, i
terationDoneCallback); | 75 Heap::registerWeakTable(const_cast<void*>(closure), iterationCallback, i
terationDoneCallback); |
| 76 } | 76 } |
| 77 | 77 |
| 78 #if ENABLE(ASSERT) | 78 #if ENABLE(ASSERT) |
| 79 inline bool weakTableRegistered(const void* closure) | 79 inline bool weakTableRegistered(const void* closure) |
| 80 { | 80 { |
| 81 return Heap::weakTableRegistered(closure); | 81 return Heap::weakTableRegistered(closure); |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 inline bool isMarked(const void* objectPointer) | |
| 86 { | |
| 87 return HeapObjectHeader::fromPayload(objectPointer)->isMarked(); | |
| 88 } | |
| 89 | |
| 90 inline bool ensureMarked(const void* objectPointer) | 85 inline bool ensureMarked(const void* objectPointer) |
| 91 { | 86 { |
| 92 if (!objectPointer) | 87 if (!objectPointer) |
| 93 return false; | 88 return false; |
| 94 if (!toDerived()->shouldMarkObject(objectPointer)) | 89 if (!toDerived()->shouldMarkObject(objectPointer)) |
| 95 return false; | 90 return false; |
| 96 #if ENABLE(ASSERT) | 91 #if ENABLE(ASSERT) |
| 97 if (isMarked(objectPointer)) | 92 if (HeapObjectHeader::fromPayload(objectPointer)->isMarked()) |
| 98 return false; | 93 return false; |
| 99 | 94 |
| 100 toDerived()->markNoTracing(objectPointer); | 95 toDerived()->markNoTracing(objectPointer); |
| 101 #else | 96 #else |
| 102 // Inline what the above markNoTracing() call expands to, | 97 // Inline what the above markNoTracing() call expands to, |
| 103 // so as to make sure that we do get all the benefits. | 98 // so as to make sure that we do get all the benefits. |
| 104 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); | 99 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); |
| 105 if (header->isMarked()) | 100 if (header->isMarked()) |
| 106 return false; | 101 return false; |
| 107 header->mark(); | 102 header->mark(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 123 private: | 118 private: |
| 124 static void markNoTracingCallback(Visitor* visitor, void* object) | 119 static void markNoTracingCallback(Visitor* visitor, void* object) |
| 125 { | 120 { |
| 126 visitor->markNoTracing(object); | 121 visitor->markNoTracing(object); |
| 127 } | 122 } |
| 128 }; | 123 }; |
| 129 | 124 |
| 130 } // namespace blink | 125 } // namespace blink |
| 131 | 126 |
| 132 #endif | 127 #endif |
| OLD | NEW |