1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef TRACE_AFTER_DISPATCH_IMPL_H_
6 #define TRACE_AFTER_DISPATCH_IMPL_H_
8 #include "heap/stubs.h"
12 class X
: public GarbageCollected
<X
> {
14 void trace(Visitor
*) {}
21 class TraceAfterDispatchInlinedBase
22 : public GarbageCollected
<TraceAfterDispatchInlinedBase
> {
24 explicit TraceAfterDispatchInlinedBase(ClassTag tag
) : tag_(tag
) {}
26 void trace(Visitor
* visitor
) { traceImpl(visitor
); }
27 void trace(InlinedGlobalMarkingVisitor visitor
) { traceImpl(visitor
); }
29 void traceAfterDispatch(Visitor
* visitor
) { traceAfterDispatchImpl(visitor
); }
30 void traceAfterDispatch(InlinedGlobalMarkingVisitor visitor
) {
31 traceAfterDispatchImpl(visitor
);
35 template <typename VisitorDispatcher
>
36 void traceImpl(VisitorDispatcher visitor
);
38 template <typename VisitorDispatcher
>
39 void traceAfterDispatchImpl(VisitorDispatcher visitor
) {
40 visitor
->trace(x_base_
);
47 class TraceAfterDispatchInlinedDerived
: public TraceAfterDispatchInlinedBase
{
49 TraceAfterDispatchInlinedDerived() : TraceAfterDispatchInlinedBase(DERIVED
) {}
51 void traceAfterDispatch(Visitor
* visitor
) { traceAfterDispatchImpl(visitor
); }
52 void traceAfterDispatch(InlinedGlobalMarkingVisitor visitor
) {
53 traceAfterDispatchImpl(visitor
);
57 template <typename VisitorDispatcher
>
58 void traceAfterDispatchImpl(VisitorDispatcher visitor
) {
59 visitor
->trace(x_derived_
);
60 TraceAfterDispatchInlinedBase::traceAfterDispatch(visitor
);
66 class TraceAfterDispatchExternBase
67 : public GarbageCollected
<TraceAfterDispatchExternBase
> {
69 explicit TraceAfterDispatchExternBase(ClassTag tag
) : tag_(tag
) {}
71 void trace(Visitor
* visitor
);
72 void trace(InlinedGlobalMarkingVisitor visitor
);
74 void traceAfterDispatch(Visitor
* visitor
);
75 void traceAfterDispatch(InlinedGlobalMarkingVisitor visitor
);
78 template <typename VisitorDispatcher
>
79 void traceImpl(VisitorDispatcher visitor
);
81 template <typename VisitorDispatcher
>
82 void traceAfterDispatchImpl(VisitorDispatcher visitor
);
88 class TraceAfterDispatchExternDerived
: public TraceAfterDispatchExternBase
{
90 TraceAfterDispatchExternDerived() : TraceAfterDispatchExternBase(DERIVED
) {}
92 void traceAfterDispatch(Visitor
* visitor
);
93 void traceAfterDispatch(InlinedGlobalMarkingVisitor visitor
);
96 template <typename VisitorDispatcher
>
97 void traceAfterDispatchImpl(VisitorDispatcher visitor
);
104 #endif // TRACE_AFTER_DISPATCH_IMPL_H_