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

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

Issue 2084933002: Implement wrapper tracing verifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 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 fce3cedc2836ce15975b167acff4181530fc9202..22dd37dc56c87d828816dfe3ea992da9667e1adc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
@@ -23,6 +23,7 @@ template<typename T> class Member;
class WrapperMarkingData {
public:
friend class ScriptWrappableVisitor;
+
WrapperMarkingData(
void (*traceWrappersCallback)(const WrapperVisitor*, const void*),
HeapObjectHeader* (*heapObjectHeaderCallback)(const void*),
@@ -43,6 +44,15 @@ public:
}
}
+ /**
+ * Returns true when object was marked. Ignores (returns true) invalidated
+ * objects.
+ */
+ inline bool isWrapperHeaderMarked()
+ {
+ return !m_object || heapObjectHeader()->isWrapperHeaderMarked();
+ }
+
private:
inline bool shouldBeInvalidated()
{
@@ -117,6 +127,13 @@ public:
traceWrappersCallback,
heapObjectHeaderCallback,
object));
+ if (RuntimeEnabledFeatures::traceWrappablesVerifierEnabled()
+ && !m_advancingTracing) {
+ m_verifierDeque.append(WrapperMarkingData(
+ traceWrappersCallback,
+ heapObjectHeaderCallback,
+ object));
+ }
}
bool markWrapperHeader(HeapObjectHeader*) const;
@@ -127,7 +144,17 @@ public:
void markWrappersInAllWorlds(const ScriptWrappable*) const override;
void markWrappersInAllWorlds(const void*) const override {}
private:
+ /**
+ * Is wrapper tracing currently in progres? True if TracePrologue has been
haraken 2016/06/22 15:43:12 progress
Marcel Hlopko 2016/06/23 09:09:13 Done.
+ * called, and TraceEpilogue has not yet been called.
+ */
bool m_tracingInProgress = false;
+ /**
+ * Is AdvanceTracing currently running? If not, we know that all calls of
+ * pushToMarkingDeque are from V8 or new wrapper associations. And this
+ * information is used by the verifier feature.
+ */
+ bool m_advancingTracing = false;
void performCleanup();
/**
* Collection of objects we need to trace from. We assume it is safe to hold
@@ -138,6 +165,18 @@ private:
*/
mutable WTF::Deque<WrapperMarkingData> m_markingDeque;
/**
+ * Collection of objects we started tracing from. We assume it is safe to hold
+ * on to the raw pointers because:
+ * * oilpan object cannot move
+ * * oilpan gc will call invalidateDeadObjectsInMarkingDeque to delete
+ * all obsolete objects
+ *
+ * These objects are used when TraceWrappablesVerifier feature is enabled to
+ * verify that all objects reachable in the atomic pause were marked
+ * incrementally. If not, there is one or multiple write barriers missing.
+ */
+ mutable WTF::Deque<WrapperMarkingData> m_verifierDeque;
+ /**
* Collection of headers we need to unmark after the tracing finished. We
* assume it is safe to hold on to the headers because:
* * oilpan objects cannot move

Powered by Google App Engine
This is Rietveld 408576698