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

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

Issue 2474693002: [wrapper-tracing] Support for incrementally tracing ScopedPersistent (Closed)
Patch Set: Created 4 years, 1 month 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.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
index 82a6d73e9c431cc7d6bf916e06120677e6f05d3a..e2692fa0fe0846c3e6580205c20d91b7be467678 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.cpp
@@ -6,6 +6,7 @@
#include "bindings/core/v8/ActiveScriptWrappable.h"
#include "bindings/core/v8/DOMWrapperWorld.h"
+#include "bindings/core/v8/ScopedPersistent.h"
#include "bindings/core/v8/ScriptWrappableVisitorVerifier.h"
#include "bindings/core/v8/V8AbstractEventListener.h"
#include "bindings/core/v8/WrapperTypeInfo.h"
@@ -211,16 +212,33 @@ void ScriptWrappableVisitor::markWrappersInAllWorlds(
const_cast<ScriptWrappable*>(scriptWrappable), this, m_reporter);
}
-void ScriptWrappableVisitor::traceWrappers(
- const ScopedPersistent<v8::Value>* scopedPersistent) const {
- markWrapper(
- &(const_cast<ScopedPersistent<v8::Value>*>(scopedPersistent)->get()));
+void ScriptWrappableVisitor::writeBarrier(
+ const void* srcObject,
+ const TraceWrapperScopedPersistent<v8::Value>* dstObject) {
+ if (!RuntimeEnabledFeatures::traceWrappablesEnabled()) {
+ return;
+ }
+ if (!srcObject || !dstObject) {
Marcel Hlopko 2016/11/02 16:44:51 || !dstObject->handle? Or dcheck in TraceWrapperS
Michael Lippautz 2016/11/02 17:07:55 Done, here, since we have the full type definition
+ return;
+ }
+ // We only require a write barrier if |srcObject| is already marked. Note
+ // that this implicitly disabled the write barrier when wrapper tracing
Marcel Hlopko 2016/11/02 16:44:51 ...this *is* implicitly...
Michael Lippautz 2016/11/02 17:07:55 Rewrote as ... this implicitly disables the write
+ // is not active as object will not be marked in this case.
+ if (!HeapObjectHeader::fromPayload(srcObject)->isWrapperHeaderMarked()) {
+ return;
+ }
+
+ currentVisitor(ThreadState::current()->isolate())
+ ->markWrapper(
+ &(const_cast<TraceWrapperScopedPersistent<v8::Value>*>(dstObject)
+ ->get()));
}
void ScriptWrappableVisitor::traceWrappers(
- const ScopedPersistent<v8::Object>* scopedPersistent) const {
+ const TraceWrapperScopedPersistent<v8::Value>* tracedPersistent) const {
markWrapper(
- &(const_cast<ScopedPersistent<v8::Object>*>(scopedPersistent)->get()));
+ &(const_cast<TraceWrapperScopedPersistent<v8::Value>*>(tracedPersistent)
+ ->get()));
}
void ScriptWrappableVisitor::markWrapper(
@@ -229,11 +247,11 @@ void ScriptWrappableVisitor::markWrapper(
handle->RegisterExternalReference(m_reporter);
}
-void ScriptWrappableVisitor::markWrapper(
- const v8::PersistentBase<v8::Object>* handle) const {
- DCHECK(m_reporter);
- handle->RegisterExternalReference(m_reporter);
-}
+// void ScriptWrappableVisitor::markWrapper(
+// const v8::PersistentBase<v8::Object>* handle) const {
+// DCHECK(m_reporter);
Marcel Hlopko 2016/11/02 16:44:51 delete commented out code?
Michael Lippautz 2016/11/02 17:07:55 Already gone.
+// handle->RegisterExternalReference(m_reporter);
+// }
void ScriptWrappableVisitor::dispatchTraceWrappers(
const TraceWrapperBase* wrapperBase) const {

Powered by Google App Engine
This is Rietveld 408576698