Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: third_party/WebKit/Source/platform/heap/MarkingVisitorImpl.h

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 28 matching lines...) Expand all
39 39
40 if (header->isMarked()) 40 if (header->isMarked())
41 return; 41 return;
42 42
43 ASSERT(ThreadState::current()->isInGC()); 43 ASSERT(ThreadState::current()->isInGC());
44 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); 44 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing);
45 45
46 header->mark(); 46 header->mark();
47 47
48 if (callback) 48 if (callback)
49 Heap::pushTraceCallback(const_cast<void*>(objectPointer), callback); 49 toDerived()->heap().pushTraceCallback(const_cast<void*>(objectPointe r), callback);
50 } 50 }
51 51
52 inline void mark(const void* objectPointer, TraceCallback callback) 52 inline void mark(const void* objectPointer, TraceCallback callback)
53 { 53 {
54 if (!objectPointer) 54 if (!objectPointer)
55 return; 55 return;
56 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer); 56 HeapObjectHeader* header = HeapObjectHeader::fromPayload(objectPointer);
57 markHeader(header, header->payload(), callback); 57 markHeader(header, header->payload(), callback);
58 } 58 }
59 59
60 inline void registerDelayedMarkNoTracing(const void* objectPointer) 60 inline void registerDelayedMarkNoTracing(const void* objectPointer)
61 { 61 {
62 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); 62 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing);
63 Heap::pushPostMarkingCallback(const_cast<void*>(objectPointer), &markNoT racingCallback); 63 toDerived()->heap().pushPostMarkingCallback(const_cast<void*>(objectPoin ter), &markNoTracingCallback);
64 } 64 }
65 65
66 inline void registerWeakMembers(const void* closure, const void* objectPoint er, WeakCallback callback) 66 inline void registerWeakMembers(const void* closure, const void* objectPoint er, WeakCallback callback)
67 { 67 {
68 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); 68 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing);
69 // We don't want to run weak processings when taking a snapshot. 69 // We don't want to run weak processings when taking a snapshot.
70 if (toDerived()->getMarkingMode() == Visitor::SnapshotMarking) 70 if (toDerived()->getMarkingMode() == Visitor::SnapshotMarking)
71 return; 71 return;
72 Heap::pushThreadLocalWeakCallback(const_cast<void*>(closure), const_cast <void*>(objectPointer), callback); 72 toDerived()->heap().pushThreadLocalWeakCallback(const_cast<void*>(closur e), const_cast<void*>(objectPointer), callback);
73 } 73 }
74 74
75 inline void registerWeakTable(const void* closure, EphemeronCallback iterati onCallback, EphemeronCallback iterationDoneCallback) 75 inline void registerWeakTable(const void* closure, EphemeronCallback iterati onCallback, EphemeronCallback iterationDoneCallback)
76 { 76 {
77 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); 77 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing);
78 Heap::registerWeakTable(const_cast<void*>(closure), iterationCallback, i terationDoneCallback); 78 toDerived()->heap().registerWeakTable(const_cast<void*>(closure), iterat ionCallback, iterationDoneCallback);
79 } 79 }
80 80
81 #if ENABLE(ASSERT) 81 #if ENABLE(ASSERT)
82 inline bool weakTableRegistered(const void* closure) 82 inline bool weakTableRegistered(const void* closure)
83 { 83 {
84 return Heap::weakTableRegistered(closure); 84 return toDerived()->heap().weakTableRegistered(closure);
85 } 85 }
86 #endif 86 #endif
87 87
88 inline bool ensureMarked(const void* objectPointer) 88 inline bool ensureMarked(const void* objectPointer)
89 { 89 {
90 if (!objectPointer) 90 if (!objectPointer)
91 return false; 91 return false;
92 if (!toDerived()->shouldMarkObject(objectPointer)) 92 if (!toDerived()->shouldMarkObject(objectPointer))
93 return false; 93 return false;
94 #if ENABLE(ASSERT) 94 #if ENABLE(ASSERT)
(...skipping 17 matching lines...) Expand all
112 return static_cast<Derived*>(this); 112 return static_cast<Derived*>(this);
113 } 113 }
114 114
115 protected: 115 protected:
116 inline void registerWeakCellWithCallback(void** cell, WeakCallback callback) 116 inline void registerWeakCellWithCallback(void** cell, WeakCallback callback)
117 { 117 {
118 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); 118 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing);
119 // We don't want to run weak processings when taking a snapshot. 119 // We don't want to run weak processings when taking a snapshot.
120 if (toDerived()->getMarkingMode() == Visitor::SnapshotMarking) 120 if (toDerived()->getMarkingMode() == Visitor::SnapshotMarking)
121 return; 121 return;
122 Heap::pushGlobalWeakCallback(cell, callback); 122 toDerived()->heap().pushGlobalWeakCallback(cell, callback);
123 } 123 }
124 124
125 private: 125 private:
126 static void markNoTracingCallback(Visitor* visitor, void* object) 126 static void markNoTracingCallback(Visitor* visitor, void* object)
127 { 127 {
128 visitor->markNoTracing(object); 128 visitor->markNoTracing(object);
129 } 129 }
130 }; 130 };
131 131
132 } // namespace blink 132 } // namespace blink
133 133
134 #endif 134 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698