From f9b93d730faf44d438117b6d27a65d2cb8641cb3 Mon Sep 17 00:00:00 2001 From: Iris Hsiao Date: Wed, 17 Aug 2016 21:07:28 +0800 Subject: [PATCH] Bug 1294013 - [jsdbg2] Disentangle parsing and checking of resumption values Part 2. r=jimb CLOSED TREE --- js/src/vm/Debugger.cpp | 18 ++++++++---------- js/src/vm/Debugger.h | 7 +++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index b07ed9854ce2..7c9599df7a77 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -1573,25 +1573,24 @@ Debugger::processResumptionValue(Maybe& ac, AbstractFramePtr fr JSTrapStatus Debugger::parseResumptionValueHelper(Maybe& ac, bool ok, const Value& rv, const Maybe& thisVForCheck, AbstractFramePtr frame, - MutableHandleValue vp, bool callHook) + MutableHandleValue vp) { if (!ok) - return handleUncaughtException(ac, vp, callHook, thisVForCheck, frame); + return handleUncaughtException(ac, vp, true, thisVForCheck, frame); JSContext* cx = ac->context()->asJSContext(); RootedValue rvRoot(cx, rv); JSTrapStatus status = JSTRAP_CONTINUE; RootedValue v(cx); if (!processResumptionValue(ac, frame, thisVForCheck, rvRoot, &status, &v)) - return handleUncaughtException(ac, vp, callHook, thisVForCheck, frame); + return handleUncaughtException(ac, vp, true, thisVForCheck, frame); vp.set(v); return status; } JSTrapStatus Debugger::parseResumptionValue(Maybe& ac, bool ok, const Value& rv, - AbstractFramePtr frame, jsbytecode* pc, MutableHandleValue vp, - bool callHook) + AbstractFramePtr frame, jsbytecode* pc, MutableHandleValue vp) { JSContext* cx = ac->context()->asJSContext(); RootedValue rootThis(cx); @@ -1609,13 +1608,12 @@ Debugger::parseResumptionValue(Maybe& ac, bool ok, const Value& MOZ_ASSERT_IF(rootThis.isMagic(), rootThis.isMagic(JS_UNINITIALIZED_LEXICAL)); thisArg.emplace(HandleValue(rootThis)); } - return parseResumptionValueHelper(ac, ok, rv, thisArg, frame, vp, callHook); + return parseResumptionValueHelper(ac, ok, rv, thisArg, frame, vp); } JSTrapStatus Debugger::parseResumptionValue(Maybe& ac, bool ok, const Value& rv, - const Value& thisV, AbstractFramePtr frame, MutableHandleValue vp, - bool callHook) + const Value& thisV, AbstractFramePtr frame, MutableHandleValue vp) { JSContext* cx = ac->context()->asJSContext(); RootedValue rootThis(cx, thisV); @@ -1623,7 +1621,7 @@ Debugger::parseResumptionValue(Maybe& ac, bool ok, const Value& if (frame.debuggerNeedsCheckPrimitiveReturn()) thisArg.emplace(rootThis); - return parseResumptionValueHelper(ac, ok, rv, thisArg, frame, vp, callHook); + return parseResumptionValueHelper(ac, ok, rv, thisArg, frame, vp); } static bool @@ -1908,7 +1906,7 @@ Debugger::onTrap(JSContext* cx, MutableHandleValue vp) Rooted handler(cx, bp->handler); bool ok = CallMethodIfPresent(cx, handler, "hit", 1, scriptFrame.address(), &rv); JSTrapStatus st = dbg->parseResumptionValue(ac, ok, rv, iter.abstractFramePtr(), - iter.pc(), vp, true); + iter.pc(), vp); if (st != JSTRAP_CONTINUE) return st; diff --git a/js/src/vm/Debugger.h b/js/src/vm/Debugger.h index 1329e66e2546..d2087a6c2c1e 100644 --- a/js/src/vm/Debugger.h +++ b/js/src/vm/Debugger.h @@ -548,8 +548,7 @@ class Debugger : private mozilla::LinkedListElement * return handleUncaughtException(ac, vp, callHook). */ JSTrapStatus parseResumptionValue(mozilla::Maybe& ac, bool OK, const Value& rv, - AbstractFramePtr frame, jsbytecode* pc, MutableHandleValue vp, - bool callHook = true); + AbstractFramePtr frame, jsbytecode* pc, MutableHandleValue vp); /* * When we run the onEnterFrame hook, the |this| slot hasn't been fully @@ -560,11 +559,11 @@ class Debugger : private mozilla::LinkedListElement */ JSTrapStatus parseResumptionValue(mozilla::Maybe& ac, bool OK, const Value& rv, const Value& thisVForCheck, AbstractFramePtr frame, - MutableHandleValue vp, bool callHook = true); + MutableHandleValue vp); JSTrapStatus parseResumptionValueHelper(mozilla::Maybe& ac, bool ok, const Value& rv, const mozilla::Maybe& thisVForCheck, AbstractFramePtr frame, - MutableHandleValue vp, bool callHook); + MutableHandleValue vp); bool processResumptionValue(mozilla::Maybe& ac, AbstractFramePtr frame, const mozilla::Maybe& maybeThis, HandleValue rval,