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 arenas are zapped. | 35 // because all the entries of the orphaned arenas 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 ASSERT(ThreadState::current()->isInGC()); | 41 ASSERT(ThreadState::current()->isInGC()); |
42 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); | 42 ASSERT(toDerived()->getMarkingMode() != Visitor::WeakProcessing); |
43 | 43 |
| 44 // A GC should only mark the objects that belong in its heap. |
| 45 DCHECK(&pageFromObject(objectPointer)->arena()->getThreadState()->heap()
== &toDerived()->heap()); |
| 46 |
44 header->mark(); | 47 header->mark(); |
45 | 48 |
46 if (callback) | 49 if (callback) |
47 toDerived()->heap().pushTraceCallback(const_cast<void*>(objectPointe
r), callback); | 50 toDerived()->heap().pushTraceCallback(const_cast<void*>(objectPointe
r), callback); |
48 } | 51 } |
49 | 52 |
50 inline void mark(const void* objectPointer, TraceCallback callback) | 53 inline void mark(const void* objectPointer, TraceCallback callback) |
51 { | 54 { |
52 if (!objectPointer) | 55 if (!objectPointer) |
53 return; | 56 return; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 private: | 126 private: |
124 static void markNoTracingCallback(Visitor* visitor, void* object) | 127 static void markNoTracingCallback(Visitor* visitor, void* object) |
125 { | 128 { |
126 visitor->markNoTracing(object); | 129 visitor->markNoTracing(object); |
127 } | 130 } |
128 }; | 131 }; |
129 | 132 |
130 } // namespace blink | 133 } // namespace blink |
131 | 134 |
132 #endif | 135 #endif |
OLD | NEW |