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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h

Issue 2585433003: [wrapper-tracing] Reduce marking overhead: Tri-color marking without 3 colors (Closed)
Patch Set: Addressed comments 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/bindings/core/v8/ScriptWrappableVisitor.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
index 4387453a1a95c286f4861558a09be8e9fc4ce926..31e9252b4433d0f0f5044c1d930cb9d86fbf716c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
@@ -126,12 +126,23 @@ class CORE_EXPORT ScriptWrappableVisitor : public v8::EmbedderHeapTracer,
// objects or if we are outside of object construction.
if (!IsGarbageCollectedMixin<T>::value ||
!threadState->isMixinInConstruction()) {
+ // If the wrapper is already marked we can bail out here.
if (TraceTrait<T>::heapObjectHeader(dstObject)->isWrapperHeaderMarked())
return;
+ // Otherwise, eagerly mark the wrapper header and put the object on the
+ // marking deque for further processing.
+ WrapperVisitor* const visitor = currentVisitor(threadState->isolate());
+ TraceTrait<T>::markWrapperHeaderOnly(visitor, dstObject);
+ visitor->pushToMarkingDeque(TraceTrait<T>::traceMarkedWrapper,
+ TraceTrait<T>::heapObjectHeader, dstObject);
+ return;
}
+ // We cannot eagerly mark the wrapper header because of mixin
+ // construction. Delay further processing until AdvanceMarking, which has to
+ // be in a non-construction state. This path may result in duplicates.
currentVisitor(threadState->isolate())
- ->pushToMarkingDeque(TraceTrait<T>::markWrapper,
+ ->pushToMarkingDeque(TraceTrait<T>::markAndTraceWrapper,
haraken 2016/12/21 01:38:37 I don't have any strong opinion about the naming,
Michael Lippautz 2016/12/21 09:31:08 I realize I am diverging a bit with oilpan, but I'
TraceTrait<T>::heapObjectHeader, dstObject);
}

Powered by Google App Engine
This is Rietveld 408576698