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

Unified Diff: third_party/WebKit/Source/platform/heap/TraceTraits.h

Issue 2585433003: [wrapper-tracing] Reduce marking overhead: Tri-color marking without 3 colors (Closed)
Patch Set: Fix test case Created 4 years 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 side-by-side diff with in-line comments
Download patch
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..8e37a659d6842f1450fe451b000e9c67d208f1c9 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 markWrapperNoTracing(const WrapperVisitor* visitor, const T* t) {
+ DCHECK(!heapObjectHeader(t)->isWrapperHeaderMarked());
+ visitor->markWrapperHeader(heapObjectHeader(t));
+ }
+ static void traceMarkedWrapper(const WrapperVisitor* visitor, const T* t) {
+ DCHECK(heapObjectHeader(t)->isWrapperHeaderMarked());
+ // 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 markWrapperNoTracing(const WrapperVisitor* visitor, const T* t) {
+ t->adjustAndMarkWrapperNoTracing(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");
+ AdjustAndMarkTrait<T>::markAndTraceWrapper(visitor,
+ reinterpret_cast<const T*>(t));
+ }
+ static void markWrapperNoTracing(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>::markWrapperNoTracing(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,
« 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