Bug 1294013 - Replace JSTrapStatus* with JSTrapStatus&. r=jimb
authorEddy Bruel <ejpbruel@mozilla.com
Mon, 22 Aug 2016 15:52:28 +0200
changeset 310579 67d8be8150aa
parent 310578 e4d567ff5113
child 310580 c09313cf63cf
push id80895
push userejpbruel@mozilla.com
push dateMon, 22 Aug 2016 13:52:42 +0000
treeherdermozilla-inbound@67d8be8150aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1294013
milestone51.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1294013 - Replace JSTrapStatus* with JSTrapStatus&. r=jimb
js/src/vm/Debugger.cpp
js/src/vm/Debugger.h
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1336,17 +1336,17 @@ Debugger::handleUncaughtExceptionHelper(
                 return JSTRAP_ERROR;
             cx->clearPendingException();
 
             RootedValue fval(cx, ObjectValue(*uncaughtExceptionHook));
             RootedValue rv(cx);
             if (js::Call(cx, fval, object, exc, &rv)) {
                 if (vp) {
                     JSTrapStatus status = JSTRAP_CONTINUE;
-                    if (processResumptionValue(ac, frame, thisVForCheck, rv, &status, *vp))
+                    if (processResumptionValue(ac, frame, thisVForCheck, rv, status, *vp))
                         return status;
                 } else {
                     return JSTRAP_CONTINUE;
                 }
             }
         }
 
         if (cx->isExceptionPending()) {
@@ -1470,32 +1470,32 @@ Debugger::receiveCompletionValue(Maybe<A
     resultToCompletion(cx, ok, val, &status, &value);
     ac.reset();
     return wrapDebuggeeValue(cx, &value) &&
            newCompletionValue(cx, status, value, vp);
 }
 
 static bool
 GetStatusProperty(JSContext* cx, HandleObject obj, HandlePropertyName name, JSTrapStatus status,
-                  JSTrapStatus* statusOut, MutableHandleValue vp, int* hits)
+                  JSTrapStatus& statusp, MutableHandleValue vp, int* hits)
 {
     bool found;
     if (!HasProperty(cx, obj, name, &found))
         return false;
     if (found) {
         ++*hits;
-        *statusOut = status;
+        statusp = status;
         if (!GetProperty(cx, obj, obj, name, vp))
             return false;
     }
     return true;
 }
 
 static bool
-ParseResumptionValueAsObject(JSContext* cx, HandleValue rv, JSTrapStatus* statusp,
+ParseResumptionValueAsObject(JSContext* cx, HandleValue rv, JSTrapStatus& statusp,
                              MutableHandleValue vp)
 {
     int hits = 0;
     if (rv.isObject()) {
         RootedObject obj(cx, &rv.toObject());
         if (!GetStatusProperty(cx, obj, cx->names().return_, JSTRAP_RETURN, statusp, vp, &hits))
             return false;
         if (!GetStatusProperty(cx, obj, cx->names().throw_, JSTRAP_THROW, statusp, vp, &hits))
@@ -1505,25 +1505,25 @@ ParseResumptionValueAsObject(JSContext* 
     if (hits != 1) {
         JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_DEBUG_BAD_RESUMPTION);
         return false;
     }
     return true;
 }
 
 static bool
-ParseResumptionValue(JSContext* cx, HandleValue rval, JSTrapStatus* statusp, MutableHandleValue vp)
+ParseResumptionValue(JSContext* cx, HandleValue rval, JSTrapStatus& statusp, MutableHandleValue vp)
 {
     if (rval.isUndefined()) {
-        *statusp = JSTRAP_CONTINUE;
+        statusp = JSTRAP_CONTINUE;
         vp.setUndefined();
         return true;
     }
     if (rval.isNull()) {
-        *statusp = JSTRAP_ERROR;
+        statusp = JSTRAP_ERROR;
         vp.setUndefined();
         return true;
     }
     return ParseResumptionValueAsObject(cx, rval, statusp, vp);
 }
 
 static bool
 CheckResumptionValue(JSContext* cx, AbstractFramePtr frame, const Maybe<HandleValue>& maybeThisv,
@@ -1545,30 +1545,30 @@ CheckResumptionValue(JSContext* cx, Abst
         }
     }
     return true;
 }
 
 bool
 Debugger::processResumptionValue(Maybe<AutoCompartment>& ac, AbstractFramePtr frame,
                                  const Maybe<HandleValue>& maybeThisv, HandleValue rval,
-                                 JSTrapStatus* statusp, MutableHandleValue vp)
+                                 JSTrapStatus& statusp, MutableHandleValue vp)
 {
     JSContext* cx = ac->context()->asJSContext();
 
     if (!ParseResumptionValue(cx, rval, statusp, vp) ||
         !unwrapDebuggeeValue(cx, vp) ||
-        !CheckResumptionValue(cx, frame, maybeThisv, *statusp, vp))
+        !CheckResumptionValue(cx, frame, maybeThisv, statusp, vp))
     {
         return false;
     }
 
     ac.reset();
     if (!cx->compartment()->wrap(cx, vp)) {
-        *statusp = JSTRAP_ERROR;
+        statusp = JSTRAP_ERROR;
         vp.setUndefined();
     }
 
     return true;
 }
 
 JSTrapStatus
 Debugger::parseResumptionValueHelper(Maybe<AutoCompartment>& ac, bool ok, const Value& rv,
@@ -1577,17 +1577,17 @@ Debugger::parseResumptionValueHelper(May
 {
     if (!ok)
         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))
+    if (!processResumptionValue(ac, frame, thisVForCheck, rvRoot, status, &v))
         return handleUncaughtException(ac, vp, true, thisVForCheck, frame);
     vp.set(v);
     return status;
 }
 
 JSTrapStatus
 Debugger::parseResumptionValue(Maybe<AutoCompartment>& ac, bool ok, const Value& rv,
                                AbstractFramePtr frame, jsbytecode* pc, MutableHandleValue vp)
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -562,17 +562,17 @@ class Debugger : private mozilla::Linked
                                       MutableHandleValue vp);
 
     JSTrapStatus parseResumptionValueHelper(mozilla::Maybe<AutoCompartment>& ac, bool ok, const Value& rv,
                                             const mozilla::Maybe<HandleValue>& thisVForCheck, AbstractFramePtr frame,
                                             MutableHandleValue vp);
 
     bool processResumptionValue(mozilla::Maybe<AutoCompartment>& ac, AbstractFramePtr frame,
                                 const mozilla::Maybe<HandleValue>& maybeThis, HandleValue rval,
-                                JSTrapStatus* statusp, MutableHandleValue vp);
+                                JSTrapStatus& statusp, MutableHandleValue vp);
 
     GlobalObject* unwrapDebuggeeArgument(JSContext* cx, const Value& v);
 
     static void traceObject(JSTracer* trc, JSObject* obj);
     void trace(JSTracer* trc);
     static void finalize(FreeOp* fop, JSObject* obj);
     void markCrossCompartmentEdges(JSTracer* tracer);