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

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

Issue 1769273004: Remove V8RecrusionScope, cleanup call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 9 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/V8ScriptRunner.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
index 51bc05d7fd9fc95f72e0411f9ed57381384dd7a5..6f7eae6ecb284953f4b4c380d54843f04c40c701 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp
@@ -29,7 +29,6 @@
#include "bindings/core/v8/ScriptStreamer.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8GCController.h"
-#include "bindings/core/v8/V8RecursionScope.h"
#include "bindings/core/v8/V8ThrowException.h"
#include "core/dom/ExecutionContext.h"
#include "core/fetch/CachedMetadata.h"
@@ -120,6 +119,7 @@ v8::Local<v8::Value> throwStackOverflowExceptionIfNeeded(v8::Isolate* isolate)
// not invoke v8::Function::Call.
return v8::Undefined(isolate);
}
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
V8PerIsolateData::from(isolate)->setIsHandlingRecursionLevelError(true);
v8::Local<v8::Value> result = v8::Function::New(isolate, throwStackOverflowException)->Call(v8::Undefined(isolate), 0, 0);
V8PerIsolateData::from(isolate)->setIsHandlingRecursionLevelError(false);
@@ -400,7 +400,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
TRACE_EVENT1("v8", "v8.run", "fileName", TRACE_STR_COPY(*v8::String::Utf8Value(script->GetUnboundScript()->GetScriptName())));
- if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth)
+ if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth)
return throwStackOverflowExceptionIfNeeded(isolate);
RELEASE_ASSERT(!context->isIteratingOverObservers());
@@ -412,7 +412,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate
throwScriptForbiddenException(isolate);
return v8::MaybeLocal<v8::Value>();
}
- V8RecursionScope recursionScope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks);
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willExecuteScript(context, script->GetUnboundScript()->GetId());
result = script->Run(isolate->GetCurrentContext());
InspectorInstrumentation::didExecuteScript(cookie);
@@ -430,7 +430,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Local<
TRACE_EVENT0("v8", "v8.run");
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
- V8RecursionScope::MicrotaskSuppression recursionScope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext());
crashIfIsolateIsDead(isolate);
return result;
@@ -440,7 +440,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledInternalScript(v8::Isolate*
{
TRACE_EVENT0("v8", "v8.run");
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
- V8RecursionScope::MicrotaskSuppression recursionScope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext());
crashIfIsolateIsDead(isolate);
return result;
@@ -451,7 +451,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f
TRACE_EVENT1("devtools.timeline,v8", "FunctionCall", "data", devToolsTraceEventData(isolate, context, function));
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
- if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth)
+ if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth)
return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(isolate));
RELEASE_ASSERT(!context->isIteratingOverObservers());
@@ -460,7 +460,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f
throwScriptForbiddenException(isolate);
return v8::MaybeLocal<v8::Value>();
}
- V8RecursionScope recursionScope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks);
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willExecuteScript(context, function->ScriptId());
v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext(), receiver, argc, args);
crashIfIsolateIsDead(isolate);
@@ -472,7 +472,7 @@ v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(v8::Local<v8::Fun
{
TRACE_EVENT0("v8", "v8.callFunction");
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
- V8RecursionScope::MicrotaskSuppression recursionScope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext(), receiver, argc, args);
crashIfIsolateIsDead(isolate);
return result;
@@ -483,7 +483,7 @@ v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject(v8::Isolate* isolat
TRACE_EVENT0("v8", "v8.newInstance");
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
- V8RecursionScope::MicrotaskSuppression scope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Object> result = objectTemplate->NewInstance(isolate->GetCurrentContext());
crashIfIsolateIsDead(isolate);
return result;
@@ -494,7 +494,7 @@ v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject(v8::Isolate* isolat
TRACE_EVENT0("v8", "v8.newInstance");
TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
- V8RecursionScope::MicrotaskSuppression scope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::MaybeLocal<v8::Object> result = function->NewInstance(isolate->GetCurrentContext(), argc, argv);
crashIfIsolateIsDead(isolate);
return result;
@@ -508,7 +508,7 @@ v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObjectInDocument(v8::Isola
throwScriptForbiddenException(isolate);
return v8::MaybeLocal<v8::Object>();
}
- V8RecursionScope scope(isolate);
+ v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks);
v8::MaybeLocal<v8::Object> result = function->NewInstance(isolate->GetCurrentContext(), argc, argv);
crashIfIsolateIsDead(isolate);
return result;

Powered by Google App Engine
This is Rietveld 408576698