Commit 6ec4b29f authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Check TracedReference::IsEmpty concurrently

This CL is dependent on
https://chromium-review.googlesource.com/c/v8/v8/+/2327910/

Bug: 1108537
Change-Id: Ie2121ba8e1460a5979ceeba734ca3a516a63903f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2327672
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: default avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794160}
parent b3f24b84
......@@ -40,6 +40,7 @@ class TraceWrapperV8Reference {
}
bool IsEmpty() const { return handle_.IsEmpty(); }
bool IsEmptySafe() const { return handle_.IsEmptyThreadSafe(); }
void Clear() { handle_.Reset(); }
ALWAYS_INLINE const v8::TracedReference<T>& Get() const { return handle_; }
ALWAYS_INLINE v8::TracedReference<T>& Get() { return handle_; }
......
......@@ -29,6 +29,8 @@ UnifiedHeapMarkingVisitorBase::UnifiedHeapMarkingVisitorBase(
void UnifiedHeapMarkingVisitorBase::VisitImpl(
const TraceWrapperV8Reference<v8::Value>& v8_reference) {
DCHECK(isolate_);
if (v8_reference.IsEmptySafe())
return;
if (task_id_ != WorklistTaskId::MutatorThread) {
// This is a temporary solution. Pushing directly from concurrent threads
// to V8 marking worklist will currently result in data races. This
......@@ -38,8 +40,6 @@ void UnifiedHeapMarkingVisitorBase::VisitImpl(
v8_references_worklist_.Push(&v8_reference);
return;
}
if (v8_reference.Get().IsEmpty())
return;
controller_->RegisterEmbedderReference(
v8_reference.template Cast<v8::Data>().Get());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment