| 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" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 inline void Visitor::markHeaderNoTracing(HeapObjectHeader* header) { | 49 inline void Visitor::markHeaderNoTracing(HeapObjectHeader* header) { |
| 50 markHeader(header, header->payload(), reinterpret_cast<TraceCallback>(0)); | 50 markHeader(header, header->payload(), reinterpret_cast<TraceCallback>(0)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 inline void Visitor::registerDelayedMarkNoTracing(const void* objectPointer) { | 53 inline void Visitor::registerDelayedMarkNoTracing(const void* objectPointer) { |
| 54 DCHECK(getMarkingMode() != WeakProcessing); | 54 DCHECK(getMarkingMode() != WeakProcessing); |
| 55 heap().pushPostMarkingCallback(const_cast<void*>(objectPointer), | 55 heap().pushPostMarkingCallback(const_cast<void*>(objectPointer), |
| 56 &markNoTracingCallback); | 56 &markNoTracingCallback); |
| 57 } | 57 } |
| 58 | 58 |
| 59 inline void Visitor::registerWeakMembers(const void* closure, | |
| 60 const void* objectPointer, | |
| 61 WeakCallback callback) { | |
| 62 DCHECK(getMarkingMode() != WeakProcessing); | |
| 63 // We don't want to run weak processings when taking a snapshot. | |
| 64 if (getMarkingMode() == SnapshotMarking) | |
| 65 return; | |
| 66 heap().pushThreadLocalWeakCallback( | |
| 67 const_cast<void*>(closure), const_cast<void*>(objectPointer), callback); | |
| 68 } | |
| 69 | |
| 70 inline void Visitor::registerWeakTable( | 59 inline void Visitor::registerWeakTable( |
| 71 const void* closure, | 60 const void* closure, |
| 72 EphemeronCallback iterationCallback, | 61 EphemeronCallback iterationCallback, |
| 73 EphemeronCallback iterationDoneCallback) { | 62 EphemeronCallback iterationDoneCallback) { |
| 74 DCHECK(getMarkingMode() != WeakProcessing); | 63 DCHECK(getMarkingMode() != WeakProcessing); |
| 75 heap().registerWeakTable(const_cast<void*>(closure), iterationCallback, | 64 heap().registerWeakTable(const_cast<void*>(closure), iterationCallback, |
| 76 iterationDoneCallback); | 65 iterationDoneCallback); |
| 77 } | 66 } |
| 78 | 67 |
| 79 #if DCHECK_IS_ON() | 68 #if DCHECK_IS_ON() |
| (...skipping 12 matching lines...) Expand all Loading... |
| 92 #if DCHECK_IS_ON() | 81 #if DCHECK_IS_ON() |
| 93 markNoTracing(objectPointer); | 82 markNoTracing(objectPointer); |
| 94 #else | 83 #else |
| 95 // Inline what the above markNoTracing() call expands to, | 84 // Inline what the above markNoTracing() call expands to, |
| 96 // so as to make sure that we do get all the benefits (asserts excepted.) | 85 // so as to make sure that we do get all the benefits (asserts excepted.) |
| 97 header->mark(); | 86 header->mark(); |
| 98 #endif | 87 #endif |
| 99 return true; | 88 return true; |
| 100 } | 89 } |
| 101 | 90 |
| 102 inline void Visitor::registerWeakCellWithCallback(void** cell, | 91 inline void Visitor::registerWeakCallback(void* closure, |
| 103 WeakCallback callback) { | 92 WeakCallback callback) { |
| 104 DCHECK(getMarkingMode() != WeakProcessing); | 93 DCHECK(getMarkingMode() != WeakProcessing); |
| 105 // We don't want to run weak processings when taking a snapshot. | 94 // We don't want to run weak processings when taking a snapshot. |
| 106 if (getMarkingMode() == SnapshotMarking) | 95 if (getMarkingMode() == SnapshotMarking) |
| 107 return; | 96 return; |
| 108 heap().pushGlobalWeakCallback(cell, callback); | 97 heap().pushWeakCallback(closure, callback); |
| 109 } | 98 } |
| 110 | 99 |
| 111 inline void Visitor::registerBackingStoreReference(void* slot) { | 100 inline void Visitor::registerBackingStoreReference(void* slot) { |
| 112 if (getMarkingMode() != GlobalMarkingWithCompaction) | 101 if (getMarkingMode() != GlobalMarkingWithCompaction) |
| 113 return; | 102 return; |
| 114 heap().registerMovingObjectReference( | 103 heap().registerMovingObjectReference( |
| 115 reinterpret_cast<MovableReference*>(slot)); | 104 reinterpret_cast<MovableReference*>(slot)); |
| 116 } | 105 } |
| 117 | 106 |
| 118 inline void Visitor::registerBackingStoreCallback(void* backingStore, | 107 inline void Visitor::registerBackingStoreCallback(void* backingStore, |
| 119 MovingObjectCallback callback, | 108 MovingObjectCallback callback, |
| 120 void* callbackData) { | 109 void* callbackData) { |
| 121 if (getMarkingMode() != GlobalMarkingWithCompaction) | 110 if (getMarkingMode() != GlobalMarkingWithCompaction) |
| 122 return; | 111 return; |
| 123 heap().registerMovingObjectCallback( | 112 heap().registerMovingObjectCallback( |
| 124 reinterpret_cast<MovableReference>(backingStore), callback, callbackData); | 113 reinterpret_cast<MovableReference>(backingStore), callback, callbackData); |
| 125 } | 114 } |
| 126 | 115 |
| 127 } // namespace blink | 116 } // namespace blink |
| 128 | 117 |
| 129 #endif | 118 #endif |
| OLD | NEW |