Commit 9d12bf2d authored by mlippautz's avatar mlippautz Committed by Commit bot

[wrapper-tracing] CHECK against isWrapperTracingForbidden instead of isGCForbidden

We only require proper tracing functionality but don't trigger any collection on
the Oilpan heap. Introduce a new getter ThreadState::isWrapperTracingForbidden()
for that purpose.

Drive-by: CHECK on calling v8::Function that we are indeed allowed to trace
wrappers.

BUG=chromium:468240

Review-Url: https://codereview.chromium.org/2532133003
Cr-Commit-Position: refs/heads/master@{#434994}
parent fd8f579e
...@@ -30,7 +30,7 @@ void ScriptWrappableVisitor::TracePrologue() { ...@@ -30,7 +30,7 @@ void ScriptWrappableVisitor::TracePrologue() {
// This CHECK ensures that wrapper tracing is not started from scopes // This CHECK ensures that wrapper tracing is not started from scopes
// that forbid GC execution, e.g., constructors. // that forbid GC execution, e.g., constructors.
CHECK(ThreadState::current()); CHECK(ThreadState::current());
CHECK(!ThreadState::current()->isGCForbidden()); CHECK(!ThreadState::current()->isWrapperTracingForbidden());
performCleanup(); performCleanup();
CHECK(!m_tracingInProgress); CHECK(!m_tracingInProgress);
...@@ -43,13 +43,13 @@ void ScriptWrappableVisitor::TracePrologue() { ...@@ -43,13 +43,13 @@ void ScriptWrappableVisitor::TracePrologue() {
void ScriptWrappableVisitor::EnterFinalPause() { void ScriptWrappableVisitor::EnterFinalPause() {
CHECK(ThreadState::current()); CHECK(ThreadState::current());
CHECK(!ThreadState::current()->isGCForbidden()); CHECK(!ThreadState::current()->isWrapperTracingForbidden());
ActiveScriptWrappable::traceActiveScriptWrappables(m_isolate, this); ActiveScriptWrappable::traceActiveScriptWrappables(m_isolate, this);
} }
void ScriptWrappableVisitor::TraceEpilogue() { void ScriptWrappableVisitor::TraceEpilogue() {
CHECK(ThreadState::current()); CHECK(ThreadState::current());
CHECK(!ThreadState::current()->isGCForbidden()); CHECK(!ThreadState::current()->isWrapperTracingForbidden());
DCHECK(m_markingDeque.isEmpty()); DCHECK(m_markingDeque.isEmpty());
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
ScriptWrappableVisitorVerifier verifier; ScriptWrappableVisitorVerifier verifier;
...@@ -185,7 +185,7 @@ bool ScriptWrappableVisitor::AdvanceTracing( ...@@ -185,7 +185,7 @@ bool ScriptWrappableVisitor::AdvanceTracing(
// perform a GC. This makes sure that TraceTraits and friends find // perform a GC. This makes sure that TraceTraits and friends find
// themselves in a well-defined environment, e.g., properly set up vtables. // themselves in a well-defined environment, e.g., properly set up vtables.
CHECK(ThreadState::current()); CHECK(ThreadState::current());
CHECK(!ThreadState::current()->isGCForbidden()); CHECK(!ThreadState::current()->isWrapperTracingForbidden());
CHECK(m_tracingInProgress); CHECK(m_tracingInProgress);
WTF::AutoReset<bool>(&m_advancingTracing, true); WTF::AutoReset<bool>(&m_advancingTracing, true);
while (actions.force_completion == while (actions.force_completion ==
......
...@@ -629,6 +629,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction( ...@@ -629,6 +629,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(
TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data",
InspectorFunctionCallEvent::data(context, function)); InspectorFunctionCallEvent::data(context, function));
CHECK(!ThreadState::current()->isWrapperTracingForbidden());
v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope microtasksScope(isolate,
v8::MicrotasksScope::kRunMicrotasks); v8::MicrotasksScope::kRunMicrotasks);
PerformanceMonitor::willCallFunction(context); PerformanceMonitor::willCallFunction(context);
...@@ -650,6 +651,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction( ...@@ -650,6 +651,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(
v8::Local<v8::Value> args[], v8::Local<v8::Value> args[],
v8::Isolate* isolate) { v8::Isolate* isolate) {
TRACE_EVENT0("v8", "v8.callFunction"); TRACE_EVENT0("v8", "v8.callFunction");
CHECK(!ThreadState::current()->isWrapperTracingForbidden());
v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope microtasksScope(isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks); v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Value> result = v8::MaybeLocal<v8::Value> result =
......
...@@ -292,6 +292,7 @@ class PLATFORM_EXPORT ThreadState { ...@@ -292,6 +292,7 @@ class PLATFORM_EXPORT ThreadState {
} }
void enterNoAllocationScope() { m_noAllocationCount++; } void enterNoAllocationScope() { m_noAllocationCount++; }
void leaveNoAllocationScope() { m_noAllocationCount--; } void leaveNoAllocationScope() { m_noAllocationCount--; }
bool isWrapperTracingForbidden() { return isMixinInConstruction(); }
bool isGCForbidden() const { bool isGCForbidden() const {
return m_gcForbiddenCount || isMixinInConstruction(); return m_gcForbiddenCount || isMixinInConstruction();
} }
......
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