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

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

Issue 2748103002: [wrapper-tracing] Redesign dispatching on non-inheriting cases (Closed)
Patch Set: Addressed comment Created 3 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 2015 The Chromium Authors. All rights reserved. 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 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 TraceTraits_h 5 #ifndef TraceTraits_h
6 #define TraceTraits_h 6 #define TraceTraits_h
7 7
8 #include "platform/heap/GCInfo.h" 8 #include "platform/heap/GCInfo.h"
9 #include "platform/heap/Heap.h" 9 #include "platform/heap/Heap.h"
10 #include "platform/heap/StackFrameDepth.h" 10 #include "platform/heap/StackFrameDepth.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 static void traceMarkedWrapper(const WrapperVisitor*, const void*); 197 static void traceMarkedWrapper(const WrapperVisitor*, const void*);
198 static HeapObjectHeader* heapObjectHeader(const void*); 198 static HeapObjectHeader* heapObjectHeader(const void*);
199 199
200 template <typename VisitorDispatcher> 200 template <typename VisitorDispatcher>
201 static void mark(VisitorDispatcher visitor, const T* t) { 201 static void mark(VisitorDispatcher visitor, const T* t) {
202 AdjustAndMarkTrait<T>::mark(visitor, t); 202 AdjustAndMarkTrait<T>::mark(visitor, t);
203 } 203 }
204 204
205 private: 205 private:
206 static const T* ToWrapperTracingType(const void* t) { 206 static const T* ToWrapperTracingType(const void* t) {
207 static_assert(CanTraceWrappers<T>::value,
208 "T should be able to trace wrappers. See "
209 "dispatchTraceWrappers in WrapperVisitor.h");
210 static_assert(!NeedsAdjustAndMark<T>::value, 207 static_assert(!NeedsAdjustAndMark<T>::value,
211 "wrapper tracing is not supported within mixins"); 208 "wrapper tracing is not supported within mixins");
212 #if DCHECK_IS_ON() 209 #if DCHECK_IS_ON()
213 DCHECK(HeapObjectHeader::fromPayload(t)->checkHeader()); 210 DCHECK(HeapObjectHeader::fromPayload(t)->checkHeader());
214 #endif 211 #endif
215 return reinterpret_cast<const T*>(t); 212 return reinterpret_cast<const T*>(t);
216 } 213 }
217 }; 214 };
218 215
219 template <typename T> 216 template <typename T>
(...skipping 14 matching lines...) Expand all
234 } 231 }
235 232
236 template <typename T> 233 template <typename T>
237 void TraceTrait<T>::traceMarkedWrapper(const WrapperVisitor* visitor, 234 void TraceTrait<T>::traceMarkedWrapper(const WrapperVisitor* visitor,
238 const void* t) { 235 const void* t) {
239 const T* traceable = ToWrapperTracingType(t); 236 const T* traceable = ToWrapperTracingType(t);
240 DCHECK(heapObjectHeader(t)->isWrapperHeaderMarked()); 237 DCHECK(heapObjectHeader(t)->isWrapperHeaderMarked());
241 // The term *mark* is misleading here as we effectively trace through the 238 // The term *mark* is misleading here as we effectively trace through the
242 // API boundary, i.e., tell V8 that an object is alive. Actual marking 239 // API boundary, i.e., tell V8 that an object is alive. Actual marking
243 // will be done in V8. 240 // will be done in V8.
244 traceable->markAndDispatchTraceWrappers(visitor); 241 visitor->dispatchTraceWrappers(traceable);
242 visitor->markWrappersInAllWorlds(traceable);
245 } 243 }
246 244
247 template <typename T> 245 template <typename T>
248 HeapObjectHeader* TraceTrait<T>::heapObjectHeader(const void* t) { 246 HeapObjectHeader* TraceTrait<T>::heapObjectHeader(const void* t) {
249 return HeapObjectHeader::fromPayload(ToWrapperTracingType(t)); 247 return HeapObjectHeader::fromPayload(ToWrapperTracingType(t));
250 } 248 }
251 249
252 template <typename T, typename Traits> 250 template <typename T, typename Traits>
253 struct TraceTrait<HeapVectorBacking<T, Traits>> { 251 struct TraceTrait<HeapVectorBacking<T, Traits>> {
254 STATIC_ONLY(TraceTrait); 252 STATIC_ONLY(TraceTrait);
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 // since iterating over the hash table backing will find the whole 781 // since iterating over the hash table backing will find the whole
784 // chain. 782 // chain.
785 visitor->markNoTracing(node); 783 visitor->markNoTracing(node);
786 return false; 784 return false;
787 } 785 }
788 }; 786 };
789 787
790 } // namespace WTF 788 } // namespace WTF
791 789
792 #endif 790 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/GarbageCollected.h ('k') | third_party/WebKit/Source/platform/heap/WrapperVisitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698