From f87f2c4d281df9983dffb8af28963d3dc38a1529 Mon Sep 17 00:00:00 2001 From: Jason Orendorff Date: Tue, 8 Apr 2014 12:35:18 -0500 Subject: [PATCH] Bug 990787, part 7 - Propagate OOM from probes::EnterScript; make probes::ExitScript return void, as it can't fail. r=jandem. --HG-- extra : rebase_source : 31e7a5643a5831c2fe1dae63f9d80c3f78df43fa --- js/src/vm/Interpreter.cpp | 6 +++++- js/src/vm/Probes-inl.h | 12 ++++-------- js/src/vm/Probes.h | 2 +- js/src/vm/Stack.cpp | 12 ++++-------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp index e28251804985..e5bcdd3d56b1 100644 --- a/js/src/vm/Interpreter.cpp +++ b/js/src/vm/Interpreter.cpp @@ -1510,7 +1510,11 @@ Interpret(JSContext *cx, RunState &state) if (!activation.entryFrame()->prologue(cx)) goto error; } else { - probes::EnterScript(cx, script, script->functionNonDelazifying(), activation.entryFrame()); + if (!probes::EnterScript(cx, script, script->functionNonDelazifying(), + activation.entryFrame())) + { + goto error; + } } if (MOZ_UNLIKELY(cx->compartment()->debugMode())) { JSTrapStatus status = ScriptDebugPrologue(cx, activation.entryFrame(), REGS.pc); diff --git a/js/src/vm/Probes-inl.h b/js/src/vm/Probes-inl.h index 2737b4533331..c828a37bb9af 100644 --- a/js/src/vm/Probes-inl.h +++ b/js/src/vm/Probes-inl.h @@ -43,7 +43,6 @@ inline bool probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, InterpreterFrame *fp) { - bool ok = true; #ifdef INCLUDE_MOZILLA_DTRACE if (JAVASCRIPT_FUNCTION_ENTRY_ENABLED()) DTraceEnterJSFun(cx, maybeFun, script); @@ -54,19 +53,18 @@ probes::EnterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, JSRuntime *rt = cx->runtime(); if (rt->spsProfiler.enabled()) { - rt->spsProfiler.enter(script, maybeFun); + if (!rt->spsProfiler.enter(script, maybeFun)) + return false; JS_ASSERT_IF(!fp->isGeneratorFrame(), !fp->hasPushedSPSFrame()); fp->setPushedSPSFrame(); } - return ok; + return true; } -inline bool +inline void probes::ExitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, bool popSPSFrame) { - bool ok = true; - #ifdef INCLUDE_MOZILLA_DTRACE if (JAVASCRIPT_FUNCTION_RETURN_ENABLED()) DTraceExitJSFun(cx, maybeFun, script); @@ -77,8 +75,6 @@ probes::ExitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, bool p if (popSPSFrame) cx->runtime()->spsProfiler.exit(script, maybeFun); - - return ok; } inline bool diff --git a/js/src/vm/Probes.h b/js/src/vm/Probes.h index 3c717bc78067..dbe2cb3dd135 100644 --- a/js/src/vm/Probes.h +++ b/js/src/vm/Probes.h @@ -69,7 +69,7 @@ bool WantNativeAddressInfo(JSContext *); bool EnterScript(JSContext *, JSScript *, JSFunction *, InterpreterFrame *); /* About to leave a JS function */ -bool ExitScript(JSContext *, JSScript *, JSFunction *, bool popSPSFrame); +void ExitScript(JSContext *, JSScript *, JSFunction *, bool popSPSFrame); /* Executing a script */ bool StartExecution(JSScript *script); diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index b234829b6d59..118694ac5f87 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -239,14 +239,11 @@ InterpreterFrame::prologue(JSContext *cx) pushOnScopeChain(*callobj); flags_ |= HAS_CALL_OBJ; } - probes::EnterScript(cx, script, nullptr, this); - return true; + return probes::EnterScript(cx, script, nullptr, this); } - if (isGlobalFrame()) { - probes::EnterScript(cx, script, nullptr, this); - return true; - } + if (isGlobalFrame()) + return probes::EnterScript(cx, script, nullptr, this); JS_ASSERT(isNonEvalFunctionFrame()); AssertDynamicScopeMatchesStaticScope(cx, script, scopeChain()); @@ -263,8 +260,7 @@ InterpreterFrame::prologue(JSContext *cx) functionThis() = ObjectValue(*obj); } - probes::EnterScript(cx, script, script->functionNonDelazifying(), this); - return true; + return probes::EnterScript(cx, script, script->functionNonDelazifying(), this); } void