v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate, v8::Local<v8::Script> script, ExecutionContext* context) { ASSERT(!script.IsEmpty()); 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) return throwStackOverflowExceptionIfNeeded(isolate); RELEASE_ASSERT(!context->isIteratingOverObservers()); // Run the script and keep track of the current recursion depth. v8::MaybeLocal<v8::Value> result; { if (ScriptForbiddenScope::isScriptForbidden()) { throwScriptForbiddenException(isolate); return v8::MaybeLocal<v8::Value>(); } V8RecursionScope recursionScope(isolate); result = script->Run(isolate->GetCurrentContext()); } crashIfV8IsDead(); return result; }