Commit daec0299 authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

Remove TLS lookup in ScriptWrappableVisitor::WriteBarrier

ScriptWrappableVisitor knows when wrapper tracing is in progress, so
when an isolate is provided we can look it up from the visitor directly
without trying to access the current ThreadState.

Bug: 
Change-Id: I79ab86ee7ff3774748ba9295b2604de53eaf8db4
Reviewed-on: https://chromium-review.googlesource.com/699067
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506833}
parent 60105251
......@@ -228,27 +228,18 @@ void ScriptWrappableVisitor::MarkWrappersInAllWorlds(
void ScriptWrappableVisitor::WriteBarrier(
v8::Isolate* isolate,
const TraceWrapperV8Reference<v8::Value>* dst_object) {
ScriptWrappableVisitor* visitor = CurrentVisitor(isolate);
if (!dst_object || dst_object->IsEmpty() ||
!ThreadState::Current()->WrapperTracingInProgress()) {
!visitor->WrapperTracingInProgress()) {
return;
}
// Conservatively assume that the source object containing |dst_object| is
// marked.
CurrentVisitor(isolate)->MarkWrapper(
visitor->MarkWrapper(
&(const_cast<TraceWrapperV8Reference<v8::Value>*>(dst_object)->Get()));
}
void ScriptWrappableVisitor::WriteBarrier(
v8::Isolate* isolate,
const v8::Persistent<v8::Object>* dst_object) {
if (!dst_object || dst_object->IsEmpty() ||
!ThreadState::Current()->WrapperTracingInProgress()) {
return;
}
CurrentVisitor(isolate)->MarkWrapper(&(dst_object->As<v8::Value>()));
}
void ScriptWrappableVisitor::TraceWrappers(
const TraceWrapperV8Reference<v8::Value>& traced_wrapper) const {
MarkWrapper(
......
......@@ -109,6 +109,8 @@ class PLATFORM_EXPORT ScriptWrappableVisitor : public v8::EmbedderHeapTracer {
public:
static ScriptWrappableVisitor* CurrentVisitor(v8::Isolate*);
bool WrapperTracingInProgress() const { return tracing_in_progress_; }
// Replace all dead objects in the marking deque with nullptr after Oilpan
// garbage collection.
static void InvalidateDeadObjectsInMarkingDeque(v8::Isolate*);
......@@ -154,7 +156,15 @@ class PLATFORM_EXPORT ScriptWrappableVisitor : public v8::EmbedderHeapTracer {
// TODO(mlippautz): Remove once ScriptWrappable is converted to
// TraceWrapperV8Reference.
static void WriteBarrier(v8::Isolate*, const v8::Persistent<v8::Object>*);
static void WriteBarrier(v8::Isolate* isolate,
const v8::Persistent<v8::Object>* dst_object) {
ScriptWrappableVisitor* visitor = CurrentVisitor(isolate);
if (!dst_object || dst_object->IsEmpty() ||
!visitor->WrapperTracingInProgress()) {
return;
}
visitor->MarkWrapper(&(dst_object->As<v8::Value>()));
}
ScriptWrappableVisitor(v8::Isolate* isolate) : isolate_(isolate){};
virtual ~ScriptWrappableVisitor();
......
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