| 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 InlinedGlobalMarkingVisitor_h | 5 #ifndef InlinedGlobalMarkingVisitor_h |
| 6 #define InlinedGlobalMarkingVisitor_h | 6 #define InlinedGlobalMarkingVisitor_h |
| 7 | 7 |
| 8 #include "platform/heap/MarkingVisitorImpl.h" | 8 #include "platform/heap/MarkingVisitorImpl.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 class InlinedGlobalMarkingVisitor final : public VisitorHelper<InlinedGlobalMark
ingVisitor>, public MarkingVisitorImpl<InlinedGlobalMarkingVisitor> { | 12 class InlinedGlobalMarkingVisitor final : public VisitorHelper<InlinedGlobalMark
ingVisitor>, public MarkingVisitorImpl<InlinedGlobalMarkingVisitor> { |
| 13 public: | 13 public: |
| 14 friend class VisitorHelper<InlinedGlobalMarkingVisitor>; | 14 friend class VisitorHelper<InlinedGlobalMarkingVisitor>; |
| 15 using Helper = VisitorHelper<InlinedGlobalMarkingVisitor>; | 15 using Helper = VisitorHelper<InlinedGlobalMarkingVisitor>; |
| 16 friend class MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; | 16 friend class MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; |
| 17 using Impl = MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; | 17 using Impl = MarkingVisitorImpl<InlinedGlobalMarkingVisitor>; |
| 18 | 18 |
| 19 explicit InlinedGlobalMarkingVisitor(Visitor* visitor) | 19 explicit InlinedGlobalMarkingVisitor(Visitor* visitor) |
| 20 : m_visitor(visitor) | 20 : m_visitor(visitor) |
| 21 { | 21 { |
| 22 ASSERT(visitor->isGlobalMarkingVisitor()); | 22 ASSERT(visitor->markingMode() == Visitor::GlobalMarking); |
| 23 } | 23 } |
| 24 | 24 |
| 25 // Hack to unify interface to visitor->trace(). | 25 // Hack to unify interface to visitor->trace(). |
| 26 // Without this hack, we need to use visitor.trace() for | 26 // Without this hack, we need to use visitor.trace() for |
| 27 // trace(InlinedGlobalMarkingVisitor) and visitor->trace() for trace(Visitor
*). | 27 // trace(InlinedGlobalMarkingVisitor) and visitor->trace() for trace(Visitor
*). |
| 28 InlinedGlobalMarkingVisitor* operator->() { return this; } | 28 InlinedGlobalMarkingVisitor* operator->() { return this; } |
| 29 | 29 |
| 30 using Impl::mark; | 30 using Impl::mark; |
| 31 using Impl::ensureMarked; | 31 using Impl::ensureMarked; |
| 32 using Impl::registerDelayedMarkNoTracing; | 32 using Impl::registerDelayedMarkNoTracing; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 51 Visitor* getUninlined() { return m_visitor; } | 51 Visitor* getUninlined() { return m_visitor; } |
| 52 protected: | 52 protected: |
| 53 // Methods to be called from MarkingVisitorImpl. | 53 // Methods to be called from MarkingVisitorImpl. |
| 54 | 54 |
| 55 inline bool shouldMarkObject(const void*) | 55 inline bool shouldMarkObject(const void*) |
| 56 { | 56 { |
| 57 // As this is global marking visitor, we need to mark all objects. | 57 // As this is global marking visitor, we need to mark all objects. |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 inline Visitor::MarkingMode markingMode() const |
| 62 { |
| 63 return m_visitor->markingMode(); |
| 64 } |
| 65 |
| 61 #if ENABLE(GC_PROFILING) | 66 #if ENABLE(GC_PROFILING) |
| 62 inline void recordObjectGraphEdge(const void* objectPointer) | 67 inline void recordObjectGraphEdge(const void* objectPointer) |
| 63 { | 68 { |
| 64 m_visitor->recordObjectGraphEdge(objectPointer); | 69 m_visitor->recordObjectGraphEdge(objectPointer); |
| 65 } | 70 } |
| 66 #endif | 71 #endif |
| 67 | 72 |
| 68 private: | 73 private: |
| 69 static InlinedGlobalMarkingVisitor fromHelper(Helper* helper) | 74 static InlinedGlobalMarkingVisitor fromHelper(Helper* helper) |
| 70 { | 75 { |
| 71 return *static_cast<InlinedGlobalMarkingVisitor*>(helper); | 76 return *static_cast<InlinedGlobalMarkingVisitor*>(helper); |
| 72 } | 77 } |
| 73 | 78 |
| 74 #if ENABLE(ASSERT) | 79 #if ENABLE(ASSERT) |
| 75 inline void checkMarkingAllowed() { m_visitor->checkMarkingAllowed(); } | 80 inline void checkMarkingAllowed() { m_visitor->checkMarkingAllowed(); } |
| 76 #endif | 81 #endif |
| 77 | 82 |
| 78 Visitor* m_visitor; | 83 Visitor* m_visitor; |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 inline void GarbageCollectedMixin::trace(InlinedGlobalMarkingVisitor) | 86 inline void GarbageCollectedMixin::trace(InlinedGlobalMarkingVisitor) |
| 82 { | 87 { |
| 83 } | 88 } |
| 84 | 89 |
| 85 } // namespace blink | 90 } // namespace blink |
| 86 | 91 |
| 87 #endif | 92 #endif |
| OLD | NEW |