Chromium Code Reviews| Index: third_party/WebKit/Source/platform/heap/TraceTraits.h |
| diff --git a/third_party/WebKit/Source/platform/heap/TraceTraits.h b/third_party/WebKit/Source/platform/heap/TraceTraits.h |
| index a56ccf1a0f3d4a5cebfea9e0068a3adaed65eb1d..735d858995e9a29b2e51152eeab42912866b8646 100644 |
| --- a/third_party/WebKit/Source/platform/heap/TraceTraits.h |
| +++ b/third_party/WebKit/Source/platform/heap/TraceTraits.h |
| @@ -47,12 +47,24 @@ class AdjustAndMarkTrait<T, false> { |
| STATIC_ONLY(AdjustAndMarkTrait); |
| public: |
| - static void markWrapper(const WrapperVisitor* visitor, const T* t) { |
| + static void markAndTraceWrapper(const WrapperVisitor* visitor, const T* t) { |
| if (visitor->markWrapperHeader(heapObjectHeader(t))) { |
| visitor->markWrappersInAllWorlds(t); |
| visitor->dispatchTraceWrappers(t); |
| } |
| } |
| + static void markWrapperHeaderOnly(const WrapperVisitor* visitor, const T* t) { |
| + CHECK(!heapObjectHeader(t)->isWrapperHeaderMarked()); |
|
haraken
2016/12/21 01:38:37
Should this be a DCHECK? This code is on a perform
Michael Lippautz
2016/12/21 09:31:08
Initially wanted to have them for the first couple
|
| + visitor->markWrapperHeader(heapObjectHeader(t)); |
| + } |
| + static void traceMarkedWrapper(const WrapperVisitor* visitor, const T* t) { |
| + CHECK(heapObjectHeader(t)->isWrapperHeaderMarked()); |
|
haraken
2016/12/21 01:38:37
Ditto.
Michael Lippautz
2016/12/21 09:31:08
Done.
|
| + // The term *mark* is misleading here as we effectively trace through the |
| + // API boundary, i.e., tell V8 that an object is alive. Actual marking |
| + // will be done in V8. |
| + visitor->markWrappersInAllWorlds(t); |
| + visitor->dispatchTraceWrappers(t); |
| + } |
| static HeapObjectHeader* heapObjectHeader(const T* t) { |
| return HeapObjectHeader::fromPayload(t); |
| } |
| @@ -99,8 +111,14 @@ class AdjustAndMarkTrait<T, true> { |
| STATIC_ONLY(AdjustAndMarkTrait); |
| public: |
| - static void markWrapper(const WrapperVisitor* visitor, const T* t) { |
| - t->adjustAndMarkWrapper(visitor); |
| + static void markAndTraceWrapper(const WrapperVisitor* visitor, const T* t) { |
| + t->adjustAndMarkAndTraceWrapper(visitor); |
| + } |
| + static void markWrapperHeaderOnly(const WrapperVisitor* visitor, const T* t) { |
| + t->adjustAndMarkWrapperHeaderOnly(visitor); |
| + } |
| + static void traceMarkedWrapper(const WrapperVisitor* visitor, const T* t) { |
| + t->adjustAndTraceMarkedWrapper(visitor); |
| } |
| static HeapObjectHeader* heapObjectHeader(const T* t) { |
| return t->adjustAndGetHeapObjectHeader(); |
| @@ -205,11 +223,28 @@ class TraceTrait { |
| static void trace(Visitor*, void* self); |
| static void trace(InlinedGlobalMarkingVisitor, void* self); |
| - static void markWrapper(const WrapperVisitor* visitor, const void* t) { |
| + static void markAndTraceWrapper(const WrapperVisitor* visitor, |
| + const void* t) { |
| + static_assert(CanTraceWrappers<T>::value, |
| + "T should be able to trace wrappers. See " |
| + "dispatchTraceWrappers in WrapperVisitor.h"); |
| + return AdjustAndMarkTrait<T>::markAndTraceWrapper( |
| + visitor, reinterpret_cast<const T*>(t)); |
| + } |
| + static void markWrapperHeaderOnly(const WrapperVisitor* visitor, |
| + const void* t) { |
| + static_assert(CanTraceWrappers<T>::value, |
| + "T should be able to trace wrappers. See " |
| + "dispatchTraceWrappers in WrapperVisitor.h"); |
| + return AdjustAndMarkTrait<T>::markWrapperHeaderOnly( |
| + visitor, reinterpret_cast<const T*>(t)); |
| + } |
| + static void traceMarkedWrapper(const WrapperVisitor* visitor, const void* t) { |
| static_assert(CanTraceWrappers<T>::value, |
| "T should be able to trace wrappers. See " |
| "dispatchTraceWrappers in WrapperVisitor.h"); |
| - AdjustAndMarkTrait<T>::markWrapper(visitor, reinterpret_cast<const T*>(t)); |
| + AdjustAndMarkTrait<T>::traceMarkedWrapper(visitor, |
| + reinterpret_cast<const T*>(t)); |
| } |
| static HeapObjectHeader* heapObjectHeader(const void* t) { |
| static_assert(CanTraceWrappers<T>::value, |