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

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

Issue 2615653002: [wrapper-tracing] Enhance verifier output (Closed)
Patch Set: Add NEVER_INLINE Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 WrapperVisitor_h 5 #ifndef WrapperVisitor_h
6 #define WrapperVisitor_h 6 #define WrapperVisitor_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "wtf/Allocator.h" 9 #include "wtf/Allocator.h"
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #define DEFINE_INLINE_TRACE_WRAPPERS() DECLARE_TRACE_WRAPPERS() 84 #define DEFINE_INLINE_TRACE_WRAPPERS() DECLARE_TRACE_WRAPPERS()
85 #define DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() DECLARE_VIRTUAL_TRACE_WRAPPERS() 85 #define DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() DECLARE_VIRTUAL_TRACE_WRAPPERS()
86 86
87 // ########################################################################### 87 // ###########################################################################
88 // TODO(hlopko): Get rid of virtual calls using CRTP 88 // TODO(hlopko): Get rid of virtual calls using CRTP
89 class PLATFORM_EXPORT WrapperVisitor { 89 class PLATFORM_EXPORT WrapperVisitor {
90 USING_FAST_MALLOC(WrapperVisitor); 90 USING_FAST_MALLOC(WrapperVisitor);
91 91
92 public: 92 public:
93 template <typename T> 93 template <typename T>
94 static NEVER_INLINE void missedWriteBarrier() {
95 NOTREACHED();
96 }
97
98 template <typename T>
94 void traceWrappers(const T* traceable) const { 99 void traceWrappers(const T* traceable) const {
95 static_assert(sizeof(T), "T must be fully defined"); 100 static_assert(sizeof(T), "T must be fully defined");
96 static_assert(CanTraceWrappers<T>::value, 101 static_assert(CanTraceWrappers<T>::value,
97 "T should be able to trace wrappers. See " 102 "T should be able to trace wrappers. See "
98 "dispatchTraceWrappers in WrapperVisitor.h"); 103 "dispatchTraceWrappers in WrapperVisitor.h");
99 104
100 if (!traceable) { 105 if (!traceable) {
101 return; 106 return;
102 } 107 }
103 108
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 virtual void markWrappersInAllWorlds(const ScriptWrappable*) const = 0; 162 virtual void markWrappersInAllWorlds(const ScriptWrappable*) const = 0;
158 163
159 void markWrappersInAllWorlds(const void*) const { 164 void markWrappersInAllWorlds(const void*) const {
160 // Empty handler used for WRAPPER_VISITOR_SPECIAL_CLASSES. These types 165 // Empty handler used for WRAPPER_VISITOR_SPECIAL_CLASSES. These types
161 // don't require marking wrappers in all worlds, so just nop on those. 166 // don't require marking wrappers in all worlds, so just nop on those.
162 } 167 }
163 168
164 template <typename T> 169 template <typename T>
165 void markAndPushToMarkingDeque(const T* traceable) const { 170 void markAndPushToMarkingDeque(const T* traceable) const {
166 if (pushToMarkingDeque(TraceTrait<T>::traceMarkedWrapper, 171 if (pushToMarkingDeque(TraceTrait<T>::traceMarkedWrapper,
167 TraceTrait<T>::heapObjectHeader, traceable)) { 172 TraceTrait<T>::heapObjectHeader,
173 WrapperVisitor::missedWriteBarrier<T>, traceable)) {
168 TraceTrait<T>::markWrapperNoTracing(this, traceable); 174 TraceTrait<T>::markWrapperNoTracing(this, traceable);
169 } 175 }
170 } 176 }
171 177
172 protected: 178 protected:
173 // Returns true if pushing to the marking deque was successful. 179 // Returns true if pushing to the marking deque was successful.
174 virtual bool pushToMarkingDeque( 180 virtual bool pushToMarkingDeque(
175 void (*traceWrappersCallback)(const WrapperVisitor*, const void*), 181 void (*traceWrappersCallback)(const WrapperVisitor*, const void*),
176 HeapObjectHeader* (*heapObjectHeaderCallback)(const void*), 182 HeapObjectHeader* (*heapObjectHeaderCallback)(const void*),
183 void (*missedWriteBarrierCallback)(void),
177 const void*) const = 0; 184 const void*) const = 0;
178 }; 185 };
179 186
180 #define SPECIALIZE_WRAPPER_TRACING_MARK_TRAIT(ClassName) \ 187 #define SPECIALIZE_WRAPPER_TRACING_MARK_TRAIT(ClassName) \
181 template <> \ 188 template <> \
182 class CanTraceWrappers<ClassName, false> { \ 189 class CanTraceWrappers<ClassName, false> { \
183 public: \ 190 public: \
184 static const bool value = true; \ 191 static const bool value = true; \
185 }; 192 };
186 193
187 WRAPPER_VISITOR_SPECIAL_CLASSES(SPECIALIZE_WRAPPER_TRACING_MARK_TRAIT) 194 WRAPPER_VISITOR_SPECIAL_CLASSES(SPECIALIZE_WRAPPER_TRACING_MARK_TRAIT)
188 195
189 #undef SPECIALIZE_WRAPPER_TRACING_MARK_TRAIT 196 #undef SPECIALIZE_WRAPPER_TRACING_MARK_TRAIT
190 197
191 } // namespace blink 198 } // namespace blink
192 199
193 #endif // WrapperVisitor_h 200 #endif // WrapperVisitor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698