Bug 845478 - Part 5: Use JS::CallArgs instead of `vp` in js/src/. r=evilpie
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 24 Mar 2014 08:49:44 -0400
changeset 175001 0ebc8c3099efb453856b4953f6b1e723e429a3da
parent 175000 595c8c60d6766fe8999945f8784d2c0ce2734b62
child 175002 58e088726ab7a925a8c7025d467a8e546dfddbc9
push id41406
push userryanvm@gmail.com
push dateMon, 24 Mar 2014 12:49:49 +0000
treeherdermozilla-inbound@a43111585107 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersevilpie
bugs845478
milestone31.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 845478 - Part 5: Use JS::CallArgs instead of `vp` in js/src/. r=evilpie
js/src/builtin/Intl.cpp
js/src/builtin/Object.cpp
js/src/builtin/TestingFunctions.cpp
js/src/jsapi-tests/testSlowScript.cpp
js/src/jsapi.cpp
js/src/jsdate.cpp
js/src/jsfun.cpp
js/src/json.cpp
js/src/jsproxy.cpp
js/src/jsweakmap.cpp
js/src/vm/Debugger.cpp
--- a/js/src/builtin/Intl.cpp
+++ b/js/src/builtin/Intl.cpp
@@ -558,17 +558,18 @@ static const Class CollatorClass = {
     JS_ConvertStub,
     collator_finalize
 };
 
 #if JS_HAS_TOSOURCE
 static bool
 collator_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
-    vp->setString(cx->names().Collator);
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setString(cx->names().Collator);
     return true;
 }
 #endif
 
 static const JSFunctionSpec collator_static_methods[] = {
     JS_SELF_HOSTED_FN("supportedLocalesOf", "Intl_Collator_supportedLocalesOf", 1, 0),
     JS_FS_END
 };
@@ -1044,17 +1045,18 @@ static const Class NumberFormatClass = {
     JS_ConvertStub,
     numberFormat_finalize
 };
 
 #if JS_HAS_TOSOURCE
 static bool
 numberFormat_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
-    vp->setString(cx->names().NumberFormat);
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setString(cx->names().NumberFormat);
     return true;
 }
 #endif
 
 static const JSFunctionSpec numberFormat_static_methods[] = {
     JS_SELF_HOSTED_FN("supportedLocalesOf", "Intl_NumberFormat_supportedLocalesOf", 1, 0),
     JS_FS_END
 };
@@ -1502,17 +1504,18 @@ static const Class DateTimeFormatClass =
     JS_ConvertStub,
     dateTimeFormat_finalize
 };
 
 #if JS_HAS_TOSOURCE
 static bool
 dateTimeFormat_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
-    vp->setString(cx->names().DateTimeFormat);
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setString(cx->names().DateTimeFormat);
     return true;
 }
 #endif
 
 static const JSFunctionSpec dateTimeFormat_static_methods[] = {
     JS_SELF_HOSTED_FN("supportedLocalesOf", "Intl_DateTimeFormat_supportedLocalesOf", 1, 0),
     JS_FS_END
 };
@@ -1985,17 +1988,18 @@ const Class js::IntlClass = {
     JS_ResolveStub,
     JS_ConvertStub
 };
 
 #if JS_HAS_TOSOURCE
 static bool
 intl_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
-    vp->setString(cx->names().Intl);
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setString(cx->names().Intl);
     return true;
 }
 #endif
 
 static const JSFunctionSpec intl_static_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,  intl_toSource,        0, 0),
 #endif
--- a/js/src/builtin/Object.cpp
+++ b/js/src/builtin/Object.cpp
@@ -68,17 +68,17 @@ obj_propertyIsEnumerable(JSContext *cx, 
 
     /* Step 4. */
     if (!prop) {
         args.rval().setBoolean(false);
         return true;
     }
 
     if (pobj != obj) {
-        vp->setBoolean(false);
+        args.rval().setBoolean(false);
         return true;
     }
 
     /* Step 5. */
     unsigned attrs;
     if (!JSObject::getGenericAttributes(cx, pobj, id, &attrs))
         return false;
 
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -34,16 +34,17 @@ using mozilla::ArrayLength;
 
 // If fuzzingSafe is set, remove functionality that could cause problems with
 // fuzzers. Set this via the environment variable MOZ_FUZZING_SAFE.
 static bool fuzzingSafe = false;
 
 static bool
 GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
 {
+    CallArgs args = CallArgsFromVp(argc, vp);
     RootedObject info(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
     if (!info)
         return false;
     RootedValue value(cx);
 
 #ifdef JSGC_ROOT_ANALYSIS
     value = BooleanValue(true);
 #else
@@ -191,34 +192,34 @@ GetBuildConfiguration(JSContext *cx, uns
 #ifdef ENABLE_BINARYDATA
     value = BooleanValue(true);
 #else
     value = BooleanValue(false);
 #endif
     if (!JS_SetProperty(cx, info, "binary-data", value))
         return false;
 
-    *vp = ObjectValue(*info);
+    args.rval().setObject(*info);
     return true;
 }
 
 static bool
 GC(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     /*
      * If the first argument is 'compartment', we collect any compartments
      * previously scheduled for GC via schedulegc. If the first argument is an
      * object, we collect the object's compartment (and any other compartments
      * scheduled for GC). Otherwise, we collect all compartments.
      */
     bool compartment = false;
     if (args.length() == 1) {
-        Value arg = vp[2];
+        Value arg = args[0];
         if (arg.isString()) {
             if (!JS_StringEqualsAscii(cx, arg.toString(), "compartment", &compartment))
                 return false;
         } else if (arg.isObject()) {
             PrepareZoneForGC(UncheckedUnwrap(&arg.toObject())->zone());
             compartment = true;
         }
     }
@@ -236,17 +237,17 @@ GC(JSContext *cx, unsigned argc, jsval *
     char buf[256] = { '\0' };
 #ifndef JS_MORE_DETERMINISTIC
     JS_snprintf(buf, sizeof(buf), "before %lu, after %lu\n",
                 (unsigned long)preBytes, (unsigned long)cx->runtime()->gcBytes);
 #endif
     JSString *str = JS_NewStringCopyZ(cx, buf);
     if (!str)
         return false;
-    *vp = STRING_TO_JSVAL(str);
+    args.rval().setString(str);
     return true;
 }
 
 static bool
 MinorGC(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 #ifdef JSGC_GENERATIONAL
@@ -407,17 +408,17 @@ InternalConst(JSContext *cx, unsigned ar
     JSString *str = ToString(cx, args[0]);
     if (!str)
         return false;
     JSFlatString *flat = JS_FlattenString(cx, str);
     if (!flat)
         return false;
 
     if (JS_FlatStringEqualsAscii(flat, "INCREMENTAL_MARK_STACK_BASE_CAPACITY")) {
-        vp[0] = UINT_TO_JSVAL(js::INCREMENTAL_MARK_STACK_BASE_CAPACITY);
+        args.rval().setNumber(uint32_t(js::INCREMENTAL_MARK_STACK_BASE_CAPACITY));
     } else {
         JS_ReportError(cx, "unknown const name");
         return false;
     }
     return true;
 }
 
 static bool
@@ -428,17 +429,17 @@ GCPreserveCode(JSContext *cx, unsigned a
     if (args.length() != 0) {
         RootedObject callee(cx, &args.callee());
         ReportUsageError(cx, callee, "Wrong number of arguments");
         return false;
     }
 
     cx->runtime()->alwaysPreserveCode = true;
 
-    *vp = JSVAL_VOID;
+    args.rval().setUndefined();
     return true;
 }
 
 #ifdef JS_GC_ZEAL
 static bool
 GCZeal(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -529,17 +530,17 @@ VerifyPostBarriers(JSContext *cx, unsign
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length()) {
         RootedObject callee(cx, &args.callee());
         ReportUsageError(cx, callee, "Too many arguments");
         return false;
     }
     gc::VerifyBarriers(cx->runtime(), gc::PostBarrierVerifier);
-    *vp = JSVAL_VOID;
+    args.rval().setUndefined();
     return true;
 }
 
 static bool
 GCState(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
@@ -558,17 +559,17 @@ GCState(JSContext *cx, unsigned argc, js
     else if (globalState == gc::SWEEP)
         state = "sweep";
     else
         MOZ_ASSUME_UNREACHABLE("Unobserveable global GC state");
 
     JSString *str = JS_NewStringCopyZ(cx, state);
     if (!str)
         return false;
-    *vp = StringValue(str);
+    args.rval().setString(str);
     return true;
 }
 
 static bool
 DeterministicGC(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
@@ -825,17 +826,17 @@ CountHeap(JSContext *cx, unsigned argc, 
         countTracer.recycleList = node->next;
         js_free(node);
     }
     if (!countTracer.ok) {
         JS_ReportOutOfMemory(cx);
         return false;
     }
 
-    *vp = JS_NumberValue((double) counter);
+    args.rval().setNumber(double(counter));
     return true;
 }
 
 #ifdef DEBUG
 static bool
 OOMAfterAllocations(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -871,32 +872,34 @@ static const JSClass FinalizeCounterClas
     JS_ResolveStub,
     JS_ConvertStub,
     finalize_counter_finalize
 };
 
 static bool
 MakeFinalizeObserver(JSContext *cx, unsigned argc, jsval *vp)
 {
+    CallArgs args = CallArgsFromVp(argc, vp);
     RootedObject scope(cx, JS::CurrentGlobalOrNull(cx));
     if (!scope)
         return false;
 
     JSObject *obj = JS_NewObjectWithGivenProto(cx, &FinalizeCounterClass, JS::NullPtr(), scope);
     if (!obj)
         return false;
 
-    *vp = OBJECT_TO_JSVAL(obj);
+    args.rval().setObject(*obj);
     return true;
 }
 
 static bool
 FinalizeCount(JSContext *cx, unsigned argc, jsval *vp)
 {
-    *vp = INT_TO_JSVAL(finalizeCount);
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setInt32(finalizeCount);
     return true;
 }
 
 static bool
 DumpHeapComplete(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
@@ -1011,17 +1014,17 @@ DisplayName(JSContext *cx, unsigned argc
     if (!args.get(0).isObject() || !args[0].toObject().is<JSFunction>()) {
         RootedObject arg(cx, &args.callee());
         ReportUsageError(cx, arg, "Must have one function argument");
         return false;
     }
 
     JSFunction *fun = &args[0].toObject().as<JSFunction>();
     JSString *str = fun->displayAtom();
-    vp->setString(str == nullptr ? cx->runtime()->emptyString : str);
+    args.rval().setString(str ? str : cx->runtime()->emptyString);
     return true;
 }
 
 bool
 js::testingFunc_inParallelSection(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
@@ -1180,33 +1183,34 @@ SetJitCompilerOption(JSContext *cx, unsi
 
     args.rval().setUndefined();
     return true;
 }
 
 static bool
 GetJitCompilerOptions(JSContext *cx, unsigned argc, jsval *vp)
 {
+    CallArgs args = CallArgsFromVp(argc, vp);
     RootedObject info(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
     if (!info)
         return false;
 
     RootedValue value(cx);
 
 #define JIT_COMPILER_MATCH(key, string)                                \
     opt = JSJITCOMPILER_ ## key;                                       \
     value.setInt32(JS_GetGlobalJitCompilerOption(cx->runtime(), opt)); \
     if (!JS_SetProperty(cx, info, string, value))                      \
         return false;
 
     JSJitCompilerOption opt = JSJITCOMPILER_NOT_AN_OPTION;
     JIT_COMPILER_OPTIONS(JIT_COMPILER_MATCH);
 #undef JIT_COMPILER_MATCH
 
-    *vp = ObjectValue(*info);
+    args.rval().setObject(*info);
 
     return true;
 }
 
 static bool
 SetIonCheckGraphCoherency(JSContext *cx, unsigned argc, jsval *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
--- a/js/src/jsapi-tests/testSlowScript.cpp
+++ b/js/src/jsapi-tests/testSlowScript.cpp
@@ -10,19 +10,20 @@ InterruptCallback(JSContext *cx)
     return false;
 }
 
 static unsigned sRemain;
 
 static bool
 RequestInterruptCallback(JSContext *cx, unsigned argc, jsval *vp)
 {
+    JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
     if (!sRemain--)
         JS_RequestInterruptCallback(JS_GetRuntime(cx));
-    *vp = JSVAL_VOID;
+    args.rval().setUndefined();
     return true;
 }
 
 BEGIN_TEST(testSlowScript)
 {
     JS_SetInterruptCallback(cx, InterruptCallback);
     JS_DefineFunction(cx, global, "requestInterruptCallback", RequestInterruptCallback, 0, 0);
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -3972,17 +3972,17 @@ JS_BindCallable(JSContext *cx, HandleObj
 }
 
 static bool
 js_generic_native_method_dispatcher(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     const JSFunctionSpec *fs = (JSFunctionSpec *)
-        vp->toObject().as<JSFunction>().getExtendedSlot(0).toPrivate();
+        args.callee().as<JSFunction>().getExtendedSlot(0).toPrivate();
     JS_ASSERT((fs->flags & JSFUN_GENERIC_NATIVE) != 0);
 
     if (argc < 1) {
         js_ReportMissingArg(cx, args.calleev(), 0);
         return false;
     }
 
     /*
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -1180,49 +1180,50 @@ syntax:
     return false;
 }
 
 static bool
 date_parse(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() == 0) {
-        vp->setNaN();
+        args.rval().setNaN();
         return true;
     }
 
     JSString *str = ToString<CanGC>(cx, args[0]);
     if (!str)
         return false;
 
     JSLinearString *linearStr = str->ensureLinear(cx);
     if (!linearStr)
         return false;
 
     double result;
     if (!date_parseString(linearStr, &result, &cx->runtime()->dateTimeInfo)) {
-        vp->setNaN();
+        args.rval().setNaN();
         return true;
     }
 
     result = TimeClip(result);
-    vp->setNumber(result);
+    args.rval().setNumber(result);
     return true;
 }
 
 static inline double
 NowAsMillis()
 {
     return (double) (PRMJ_Now() / PRMJ_USEC_PER_MSEC);
 }
 
 static bool
 date_now(JSContext *cx, unsigned argc, Value *vp)
 {
-    vp->setDouble(NowAsMillis());
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setDouble(NowAsMillis());
     return true;
 }
 
 void
 DateObject::setUTCTime(double t, Value *vp)
 {
     for (size_t ind = COMPONENTS_START_SLOT; ind < RESERVED_SLOTS; ind++)
         setReservedSlot(ind, UndefinedValue());
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -1277,26 +1277,26 @@ js::CallOrConstructBoundFunction(JSConte
     invokeArgs.setCallee(ObjectValue(*target));
 
     if (!constructing)
         invokeArgs.setThis(boundThis);
 
     if (constructing ? !InvokeConstructor(cx, invokeArgs) : !Invoke(cx, invokeArgs))
         return false;
 
-    *vp = invokeArgs.rval();
+    args.rval().set(invokeArgs.rval());
     return true;
 }
 
 static bool
 fun_isGenerator(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     JSFunction *fun;
-    if (!IsFunctionObject(vp[1], &fun)) {
+    if (!IsFunctionObject(args.thisv(), &fun)) {
         args.rval().setBoolean(false);
         return true;
     }
 
     args.rval().setBoolean(fun->isGenerator());
     return true;
 }
 
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -787,17 +787,18 @@ js::ParseJSONWithReviver(JSContext *cx, 
         return Revive(cx, reviver, vp);
     return true;
 }
 
 #if JS_HAS_TOSOURCE
 static bool
 json_toSource(JSContext *cx, unsigned argc, Value *vp)
 {
-    vp->setString(cx->names().JSON);
+    CallArgs args = CallArgsFromVp(argc, vp);
+    args.rval().setString(cx->names().JSON);
     return true;
 }
 #endif
 
 /* ES5 15.12.2. */
 static bool
 json_parse(JSContext *cx, unsigned argc, Value *vp)
 {
@@ -823,36 +824,34 @@ json_parse(JSContext *cx, unsigned argc,
                                 flat->length(), reviver, args.rval());
 }
 
 /* ES5 15.12.3. */
 bool
 json_stringify(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
-    RootedObject replacer(cx, (argc >= 2 && vp[3].isObject())
-                              ? &vp[3].toObject()
-                              : nullptr);
-    RootedValue value(cx, (argc >= 1) ? vp[2] : UndefinedValue());
-    RootedValue space(cx, (argc >= 3) ? vp[4] : UndefinedValue());
+    RootedObject replacer(cx, args.get(1).isObject() ? &args[1].toObject() : nullptr);
+    RootedValue value(cx, args.get(0));
+    RootedValue space(cx, args.get(2));
 
     StringBuffer sb(cx);
     if (!js_Stringify(cx, &value, replacer, space, sb))
         return false;
 
     // XXX This can never happen to nsJSON.cpp, but the JSON object
     // needs to support returning undefined. So this is a little awkward
     // for the API, because we want to support streaming writers.
     if (!sb.empty()) {
         JSString *str = sb.finishString();
         if (!str)
             return false;
-        vp->setString(str);
+        args.rval().setString(str);
     } else {
-        vp->setUndefined();
+        args.rval().setUndefined();
     }
 
     return true;
 }
 
 static const JSFunctionSpec json_static_methods[] = {
 #if JS_HAS_TOSOURCE
     JS_FN(js_toSource_str,  json_toSource,      0, 0),
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -3124,48 +3124,49 @@ proxy(JSContext *cx, unsigned argc, jsva
     options.selectDefaultClass(target->isCallable());
     ProxyObject *proxy =
         ProxyObject::New(cx, &ScriptedDirectProxyHandler::singleton,
                          priv, TaggedProto(TaggedProto::LazyProto), cx->global(),
                          options);
     if (!proxy)
         return false;
     proxy->setExtra(0, ObjectOrNullValue(handler));
-    vp->setObject(*proxy);
+    args.rval().setObject(*proxy);
     return true;
 }
 
 static bool
 proxy_create(JSContext *cx, unsigned argc, Value *vp)
 {
-    if (argc < 1) {
+    CallArgs args = CallArgsFromVp(argc, vp);
+    if (args.length() < 1) {
         JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED,
                              "create", "0", "s");
         return false;
     }
-    JSObject *handler = NonNullObject(cx, vp[2]);
+    JSObject *handler = NonNullObject(cx, args[0]);
     if (!handler)
         return false;
     JSObject *proto, *parent = nullptr;
-    if (argc > 1 && vp[3].isObject()) {
-        proto = &vp[3].toObject();
+    if (args.get(1).isObject()) {
+        proto = &args[1].toObject();
         parent = proto->getParent();
     } else {
-        JS_ASSERT(IsFunctionObject(vp[0]));
+        JS_ASSERT(IsFunctionObject(&args.callee()));
         proto = nullptr;
     }
     if (!parent)
-        parent = vp[0].toObject().getParent();
+        parent = args.callee().getParent();
     RootedValue priv(cx, ObjectValue(*handler));
     JSObject *proxy = NewProxyObject(cx, &ScriptedIndirectProxyHandler::singleton,
                                      priv, proto, parent);
     if (!proxy)
         return false;
 
-    vp->setObject(*proxy);
+    args.rval().setObject(*proxy);
     return true;
 }
 
 static bool
 proxy_createFunction(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     if (args.length() < 2) {
@@ -3209,17 +3210,17 @@ proxy_createFunction(JSContext *cx, unsi
     options.selectDefaultClass(true);
     JSObject *proxy =
         ProxyObject::New(cx, &ScriptedIndirectProxyHandler::singleton,
                          priv, TaggedProto(proto), parent, options);
     if (!proxy)
         return false;
     proxy->as<ProxyObject>().setExtra(0, ObjectValue(*ccHolder));
 
-    vp->setObject(*proxy);
+    args.rval().setObject(*proxy);
     return true;
 }
 
 JS_FRIEND_API(JSObject *)
 js_InitProxyClass(JSContext *cx, HandleObject obj)
 {
     static const JSFunctionSpec static_methods[] = {
         JS_FN("create",         proxy_create,          2, 0),
--- a/js/src/jsweakmap.cpp
+++ b/js/src/jsweakmap.cpp
@@ -397,21 +397,22 @@ WeakMap_finalize(FreeOp *fop, JSObject *
         fop->delete_(map);
 #endif
     }
 }
 
 static bool
 WeakMap_construct(JSContext *cx, unsigned argc, Value *vp)
 {
+    CallArgs args = CallArgsFromVp(argc, vp);
     JSObject *obj = NewBuiltinClassInstance(cx, &WeakMapObject::class_);
     if (!obj)
         return false;
 
-    vp->setObject(*obj);
+    args.rval().setObject(*obj);
     return true;
 }
 
 const Class WeakMapObject::class_ = {
     "WeakMap",
     JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
     JSCLASS_HAS_CACHED_PROTO(JSProto_WeakMap),
     JS_PropertyStub,         /* addProperty */
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -5473,17 +5473,17 @@ DebuggerObject_evalInGlobalWithBindings(
 }
 
 static bool
 DebuggerObject_unwrap(JSContext *cx, unsigned argc, Value *vp)
 {
     THIS_DEBUGOBJECT_OWNER_REFERENT(cx, argc, vp, "unwrap", args, dbg, referent);
     JSObject *unwrapped = UnwrapOneChecked(referent);
     if (!unwrapped) {
-        vp->setNull();
+        args.rval().setNull();
         return true;
     }
 
     args.rval().setObject(*unwrapped);
     if (!dbg->wrapDebuggeeValue(cx, args.rval()))
         return false;
     return true;
 }