Bug 839313: Replace JSVAL_VOID and similar constants with their JS::MumbleValue() equivalents. r=waldo
authorJim Blandy <jimb@mozilla.com>
Tue, 26 Feb 2013 11:48:43 -0800
changeset 123050 4c8b199ed597e46d62c812f4c68e4ae97e9aee15
parent 123049 13ccc41033ec691658a2f08d88589b73c63a3ddb
child 123051 e150e804f9029ee1d10b4d6b936551d7531282d4
push id23637
push userjblandy@mozilla.com
push dateTue, 26 Feb 2013 19:49:11 +0000
treeherdermozilla-inbound@2b8d0b73600e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs839313
milestone22.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 839313: Replace JSVAL_VOID and similar constants with their JS::MumbleValue() equivalents. r=waldo
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -667,17 +667,17 @@ Version(JSContext *cx, unsigned argc, js
     }
     return true;
 }
 
 static JSBool
 RevertVersion(JSContext *cx, unsigned argc, jsval *vp)
 {
     js_RevertVersion(cx);
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 Options(JSContext *cx, unsigned argc, jsval *vp)
 {
     uint32_t optset, flag;
     JSString *str;
@@ -747,17 +747,17 @@ Load(JSContext *cx, unsigned argc, jsval
         opts.setUTF8(true).setCompileAndGo(true).setNoScriptRval(true);
         if ((compileOnly && !Compile(cx, thisobj, opts, filename.ptr())) ||
             !Evaluate(cx, thisobj, opts, filename.ptr(), NULL))
         {
             return false;
         }
     }
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 class AutoNewContext
 {
   private:
     JSContext *oldcx;
     JSContext *newcx;
@@ -1147,17 +1147,17 @@ ReadLine(JSContext *cx, unsigned argc, j
             return false;
         }
 
         buf = tmp;
     }
 
     /* Treat the empty string specially. */
     if (buflength == 0) {
-        *vp = feof(from) ? JSVAL_NULL : JS_GetEmptyStringValue(cx);
+        *vp = feof(from) ? NullValue() : JS_GetEmptyStringValue(cx);
         JS_free(cx, buf);
         return true;
     }
 
     /* Shrink the buffer to the real size. */
     tmp = (char *) JS_realloc(cx, buf, buflength);
     if (!tmp) {
         JS_free(cx, buf);
@@ -1194,17 +1194,17 @@ PutStr(JSContext *cx, unsigned argc, jsv
         bytes = JSStringToUTF8(cx, str);
         if (!bytes)
             return false;
         fputs(bytes, gOutFile);
         JS_free(cx, bytes);
         fflush(gOutFile);
     }
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 Now(JSContext *cx, unsigned argc, jsval *vp)
 {
     double now = PRMJ_Now() / double(PRMJ_USEC_PER_MSEC);
     JS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(now));
@@ -1232,17 +1232,17 @@ PrintInternal(JSContext *cx, unsigned ar
         TraceLog(TraceLogging::defaultLogger(), bytes);
 #endif
         JS_free(cx, bytes);
     }
 
     fputc('\n', file);
     fflush(file);
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 Print(JSContext *cx, unsigned argc, jsval *vp)
 {
     return PrintInternal(cx, argc, vp, gOutFile);
 }
@@ -1307,17 +1307,17 @@ AssertEq(JSContext *cx, unsigned argc, j
             JSAutoByteString bytes2(cx, JSVAL_TO_STRING(argv[2]));
             if (!bytes2)
                 return false;
             JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_ASSERT_EQ_FAILED_MSG,
                                  actual, expected, bytes2.ptr());
         }
         return false;
     }
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static UnrootedScript
 ValueToScript(JSContext *cx, jsval v, JSFunction **funp = NULL)
 {
     RootedFunction fun(cx, JS_ValueToFunction(cx, v));
     if (!fun)
@@ -1348,17 +1348,17 @@ SetDebug(JSContext *cx, unsigned argc, j
      * Debug mode can only be set when there is no JS code executing on the
      * stack. Unfortunately, that currently means that this call will fail
      * unless debug mode is already set to what you're trying to set it to.
      * In the future, this restriction may be lifted.
      */
 
     bool ok = !!JS_SetDebugMode(cx, JSVAL_TO_BOOLEAN(argv[0]));
     if (ok)
-        JS_SET_RVAL(cx, vp, JSVAL_TRUE);
+        JS_SET_RVAL(cx, vp, BooleanValue(true));
     return ok;
 }
 
 static UnrootedScript
 GetTopScript(JSContext *cx)
 {
     RootedScript script(cx);
     JS_DescribeScriptedCaller(cx, script.address(), NULL);
@@ -1446,30 +1446,30 @@ Trap(JSContext *cx, unsigned argc, jsval
         return false;
     argv[argc] = STRING_TO_JSVAL(str);
     if (!GetScriptAndPCArgs(cx, argc, argv, &script, &i))
         return false;
     if (uint32_t(i) >= script->length) {
         JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_TRAP_USAGE);
         return false;
     }
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return JS_SetTrap(cx, script, script->code + i, TrapHandler, STRING_TO_JSVAL(str));
 }
 
 static JSBool
 Untrap(JSContext *cx, unsigned argc, jsval *vp)
 {
     RootedScript script(cx);
     int32_t i;
 
     if (!GetScriptAndPCArgs(cx, argc, JS_ARGV(cx, vp), &script, &i))
         return false;
     JS_ClearTrap(cx, script, script->code + i, NULL, NULL);
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSTrapStatus
 DebuggerAndThrowHandler(JSContext *cx, RawScript script, jsbytecode *pc, jsval *rval,
                         void *closure)
 {
     return TrapHandler(cx, script, pc, rval, STRING_TO_JSVAL((JSString *)closure));
@@ -1485,17 +1485,17 @@ SetDebuggerHandler(JSContext *cx, unsign
         return false;
     }
 
     str = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]);
     if (!str)
         return false;
 
     JS_SetDebuggerHandler(cx->runtime, DebuggerAndThrowHandler, str);
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 SetThrowHook(JSContext *cx, unsigned argc, jsval *vp)
 {
     JSString *str;
     if (argc == 0) {
@@ -1504,17 +1504,17 @@ SetThrowHook(JSContext *cx, unsigned arg
         return false;
     }
 
     str = JS_ValueToString(cx, JS_ARGV(cx, vp)[0]);
     if (!str)
         return false;
 
     JS_SetThrowHook(cx->runtime, DebuggerAndThrowHandler, str);
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 LineToPC(JSContext *cx, unsigned argc, jsval *vp)
 {
     RootedScript script(cx);
     int32_t lineArg = 0;
@@ -1864,30 +1864,30 @@ Disassemble(JSContext *cx, unsigned argc
 {
     Sprinter sprinter(cx);
     if (!sprinter.init())
         return false;
     if (!DisassembleToSprinter(cx, argc, vp, &sprinter))
         return false;
 
     fprintf(stdout, "%s\n", sprinter.string());
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 DisassFile(JSContext *cx, unsigned argc, jsval *vp)
 {
     /* Support extra options at the start, just like Dissassemble. */
     DisassembleOptionParser p(argc, JS_ARGV(cx, vp));
     if (!p.parse(cx))
         return false;
 
     if (!p.argc) {
-        JS_SET_RVAL(cx, vp, JSVAL_VOID);
+        JS_SET_RVAL(cx, vp, UndefinedValue());
         return true;
     }
 
     RootedObject thisobj(cx, JS_THIS_OBJECT(cx, vp));
     if (!thisobj)
         return false;
 
     JSString *str = JS_ValueToString(cx, p.argv[0]);
@@ -1911,17 +1911,17 @@ DisassFile(JSContext *cx, unsigned argc,
     if (!sprinter.init())
         return false;
     bool ok = DisassembleScript(cx, script, NULL, p.lines, p.recursive, &sprinter);
     if (ok)
         fprintf(stdout, "%s\n", sprinter.string());
     if (!ok)
         return false;
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 DisassWithSrc(JSContext *cx, unsigned argc, jsval *vp)
 {
 #define LINE_BUF_LEN 512
     unsigned i, len, line1, line2, bupline;
@@ -2005,17 +2005,17 @@ DisassWithSrc(JSContext *cx, unsigned ar
                 goto bail;
             }
             pc += len;
         }
 
       bail:
         fclose(file);
     }
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return ok;
 #undef LINE_BUF_LEN
 }
 
 static JSBool
 DumpHeap(JSContext *cx, unsigned argc, jsval *vp)
 {
     jsval v;
@@ -2108,17 +2108,17 @@ DumpHeap(JSContext *cx, unsigned argc, j
     ok = JS_DumpHeap(JS_GetRuntime(cx), dumpFile, startThing, startTraceKind, thingToFind,
                      maxDepth, thingToIgnore);
     if (dumpFile != stdout)
         fclose(dumpFile);
     if (!ok) {
         JS_ReportOutOfMemory(cx);
         return false;
     }
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 
   not_traceable_arg:
     JS_ReportError(cx, "argument '%s' is not null or a heap-allocated thing",
                    badTraceArg);
     return false;
 }
 
@@ -2126,50 +2126,50 @@ static JSBool
 DumpObject(JSContext *cx, unsigned argc, jsval *vp)
 {
     RootedObject arg0(cx);
     if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "o", arg0.address()))
         return false;
 
     js_DumpObject(arg0);
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 #endif /* DEBUG */
 
 static JSBool
 BuildDate(JSContext *cx, unsigned argc, jsval *vp)
 {
     char version[20] = "\n";
 #if JS_VERSION < 150
     sprintf(version, " for version %d\n", JS_VERSION);
 #endif
     fprintf(gOutFile, "built on %s at %s%s", __DATE__, __TIME__, version);
-    *vp = JSVAL_VOID;
+    *vp = UndefinedValue();
     return true;
 }
 
 static JSBool
 Intern(JSContext *cx, unsigned argc, jsval *vp)
 {
-    JSString *str = JS_ValueToString(cx, argc == 0 ? JSVAL_VOID : vp[2]);
+    JSString *str = JS_ValueToString(cx, argc == 0 ? UndefinedValue() : vp[2]);
     if (!str)
         return false;
 
     size_t length;
     const jschar *chars = JS_GetStringCharsAndLength(cx, str, &length);
     if (!chars)
         return false;
 
     if (!JS_InternUCStringN(cx, chars, length))
         return false;
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 Clone(JSContext *cx, unsigned argc, jsval *vp)
 {
     RootedObject parent(cx);
     RootedObject funobj(cx);
@@ -2225,20 +2225,20 @@ static JSBool
 GetPDA(JSContext *cx, unsigned argc, jsval *vp)
 {
     RootedObject vobj(cx);
     bool ok;
     JSPropertyDescArray pda;
     JSPropertyDesc *pd;
     jsval v;
 
-    if (!JS_ValueToObject(cx, argc == 0 ? JSVAL_VOID : vp[2], vobj.address()))
+    if (!JS_ValueToObject(cx, argc == 0 ? UndefinedValue() : vp[2], vobj.address()))
         return false;
     if (!vobj) {
-        *vp = JSVAL_VOID;
+        *vp = UndefinedValue();
         return true;
     }
 
     RootedObject aobj(cx, JS_NewArrayObject(cx, 0, NULL));
     if (!aobj)
         return false;
     *vp = OBJECT_TO_JSVAL(aobj);
 
@@ -2272,29 +2272,29 @@ GetPDA(JSContext *cx, unsigned argc, jsv
     return ok;
 }
 
 static JSBool
 GetSLX(JSContext *cx, unsigned argc, jsval *vp)
 {
     RootedScript script(cx);
 
-    script = ValueToScript(cx, argc == 0 ? JSVAL_VOID : vp[2]);
+    script = ValueToScript(cx, argc == 0 ? UndefinedValue() : vp[2]);
     if (!script)
         return false;
     *vp = INT_TO_JSVAL(js_GetScriptLineExtent(script));
     return true;
 }
 
 static JSBool
 ToInt32(JSContext *cx, unsigned argc, jsval *vp)
 {
     int32_t i;
 
-    if (!JS_ValueToInt32(cx, argc == 0 ? JSVAL_VOID : vp[2], &i))
+    if (!JS_ValueToInt32(cx, argc == 0 ? UndefinedValue() : vp[2], &i))
         return false;
     *vp = JS_NumberValue(i);
     return true;
 }
 
 static JSBool
 ThrowError(JSContext *cx, unsigned argc, jsval *vp)
 {
@@ -2657,17 +2657,17 @@ Sleep_fn(JSContext *cx, unsigned argc, j
 {
     int64_t t_ticks;
 
     if (argc == 0) {
         t_ticks = 0;
     } else {
         double t_secs;
 
-        if (!JS_ValueToNumber(cx, argc == 0 ? JSVAL_VOID : vp[2], &t_secs))
+        if (!JS_ValueToNumber(cx, argc == 0 ? UndefinedValue() : vp[2], &t_secs))
             return false;
 
         /* NB: The next condition also filter out NaNs. */
         if (!(t_secs <= MAX_TIMEOUT_INTERVAL)) {
             JS_ReportError(cx, "Excessive sleep interval");
             return false;
         }
         t_ticks = (t_secs <= 0.0)
@@ -2931,17 +2931,17 @@ Timeout(JSContext *cx, unsigned argc, js
         RootedValue value(cx, JS_ARGV(cx, vp)[1]);
         if (!value.isObject() || !value.toObject().isFunction()) {
             JS_ReportError(cx, "Second argument must be a timeout function");
             return false;
         }
         gTimeoutFunc = value;
     }
 
-    *vp = JSVAL_VOID;
+    *vp = UndefinedValue();
     return SetTimeoutValue(cx, t);
 }
 
 static JSBool
 Elapsed(JSContext *cx, unsigned argc, jsval *vp)
 {
     if (argc == 0) {
         double d = 0.0;
@@ -3050,17 +3050,17 @@ Compile(JSContext *cx, unsigned argc, js
     RootedObject global(cx, JS_GetGlobalForScopeChain(cx));
     JSString *scriptContents = JSVAL_TO_STRING(arg0);
     unsigned oldopts = JS_GetOptions(cx);
     JS_SetOptions(cx, oldopts | JSOPTION_COMPILE_N_GO | JSOPTION_NO_SCRIPT_RVAL);
     bool ok = JS_CompileUCScript(cx, global, JS_GetStringCharsZ(cx, scriptContents),
                                  JS_GetStringLength(scriptContents), "<string>", 1);
     JS_SetOptions(cx, oldopts);
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return ok;
 }
 
 static JSBool
 Parse(JSContext *cx, unsigned argc, jsval *vp)
 {
     using namespace js::frontend;
 
@@ -3300,17 +3300,17 @@ ThisFilename(JSContext *cx, unsigned arg
         return false;
     args.rval().setString(filename);
     return true;
 }
 
 static JSBool
 Wrap(JSContext *cx, unsigned argc, jsval *vp)
 {
-    jsval v = argc > 0 ? JS_ARGV(cx, vp)[0] : JSVAL_VOID;
+    jsval v = argc > 0 ? JS_ARGV(cx, vp)[0] : UndefinedValue();
     if (JSVAL_IS_PRIMITIVE(v)) {
         JS_SET_RVAL(cx, vp, v);
         return true;
     }
 
     RootedObject obj(cx, JSVAL_TO_OBJECT(v));
     RootedObject proto(cx);
     if (!JSObject::getProto(cx, obj, &proto))
@@ -3322,17 +3322,17 @@ Wrap(JSContext *cx, unsigned argc, jsval
 
     JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(wrapped));
     return true;
 }
 
 static JSBool
 WrapWithProto(JSContext *cx, unsigned argc, jsval *vp)
 {
-    Value obj = JSVAL_VOID, proto = JSVAL_VOID;
+    Value obj = UndefinedValue(), proto = UndefinedValue();
     if (argc == 2) {
         obj = JS_ARGV(cx, vp)[0];
         proto = JS_ARGV(cx, vp)[1];
     }
     if (!obj.isObject() || !proto.isObjectOrNull()) {
         JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_INVALID_ARGS,
                              "wrapWithProto");
         return false;
@@ -3346,20 +3346,20 @@ WrapWithProto(JSContext *cx, unsigned ar
 
     JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(wrapped));
     return true;
 }
 
 static JSBool
 Serialize(JSContext *cx, unsigned argc, jsval *vp)
 {
-    jsval v = argc > 0 ? JS_ARGV(cx, vp)[0] : JSVAL_VOID;
+    jsval v = argc > 0 ? JS_ARGV(cx, vp)[0] : UndefinedValue();
     uint64_t *datap;
     size_t nbytes;
-    if (!JS_WriteStructuredClone(cx, v, &datap, &nbytes, NULL, NULL, JSVAL_VOID))
+    if (!JS_WriteStructuredClone(cx, v, &datap, &nbytes, NULL, NULL, UndefinedValue()))
         return false;
 
     JSObject *array = JS_NewUint8Array(cx, nbytes);
     if (!array) {
         JS_free(cx, datap);
         return false;
     }
     JS_ASSERT((uintptr_t(TypedArray::viewData(array)) & 7) == 0);
@@ -3368,17 +3368,17 @@ Serialize(JSContext *cx, unsigned argc, 
     JS_ClearStructuredClone(datap, nbytes);
     JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(array));
     return true;
 }
 
 static JSBool
 Deserialize(JSContext *cx, unsigned argc, jsval *vp)
 {
-    Rooted<jsval> v(cx, argc > 0 ? JS_ARGV(cx, vp)[0] : JSVAL_VOID);
+    Rooted<jsval> v(cx, argc > 0 ? JS_ARGV(cx, vp)[0] : UndefinedValue());
     JSObject *obj;
     if (JSVAL_IS_PRIMITIVE(v) || !(obj = JSVAL_TO_OBJECT(v))->isTypedArray()) {
         JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_INVALID_ARGS, "deserialize");
         return false;
     }
     if ((TypedArray::byteLength(obj) & 7) != 0) {
         JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_INVALID_ARGS, "deserialize");
         return false;
@@ -3443,17 +3443,17 @@ EnableStackWalkingAssertion(JSContext *c
                              "enableStackWalkingAssertion");
         return false;
     }
 
 #ifdef DEBUG
     cx->stackIterAssertionEnabled = JSVAL_TO_BOOLEAN(JS_ARGV(cx, vp)[0]);
 #endif
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 static JSBool
 RelaxRootChecks(JSContext *cx, unsigned argc, jsval *vp)
 {
     if (argc > 0) {
         JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_INVALID_ARGS,
@@ -3926,17 +3926,17 @@ Help(JSContext *cx, unsigned argc, jsval
                 return false;
             }
             obj = JSVAL_TO_OBJECT(argv[i]);
             if (!PrintHelp(cx, obj))
                 return false;
         }
     }
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
     return true;
 }
 
 /*
  * Define a JS object called "it".  Give it class operations that printf why
  * they're being called for tutorial purposes.
  */
 enum its_tinyid {
@@ -4073,17 +4073,17 @@ its_enumerate(JSContext *cx, HandleObjec
             return false;
 
         if (!JSID_IS_VOID(*idp))
             break;
         /* Fall through. */
 
       case JSENUMERATE_DESTROY:
         /* Allow our iterator object to be GC'd. */
-        *statep = JSVAL_NULL;
+        *statep = NullValue();
         break;
     }
 
     return true;
 }
 
 static JSBool
 its_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
@@ -4127,19 +4127,19 @@ static JSClass its_class = {
     its_convert,      its_finalize
 };
 
 static JSBool
 its_getter(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp)
 {
     if (JS_GetClass(obj) == &its_class) {
         jsval *val = (jsval *) JS_GetPrivate(obj);
-        vp.set(val ? *val : JSVAL_VOID);
+        vp.set(val ? *val : UndefinedValue());
     } else {
-        vp.set(JSVAL_VOID);
+        vp.set(UndefinedValue());
     }
 
     return true;
 }
 
 static JSBool
 its_setter(JSContext *cx, HandleObject obj, HandleId id, JSBool strict, MutableHandleValue vp)
 {
@@ -4173,19 +4173,19 @@ static JSBool
 its_get_customNative(JSContext *cx, unsigned argc, jsval *vp)
 {
     JSObject *obj = JS_THIS_OBJECT(cx, vp);
     if (!obj)
         return false;
 
     if (JS_GetClass(obj) == &its_class) {
         jsval *val = (jsval *) JS_GetPrivate(obj);
-        *vp = val ? *val : JSVAL_VOID;
+        *vp = val ? *val : UndefinedValue();
     } else {
-        *vp = JSVAL_VOID;
+        *vp = UndefinedValue();
     }
 
     return true;
 }
 
 static JSBool
 its_set_customNative(JSContext *cx, unsigned argc, jsval *vp)
 {
@@ -4257,17 +4257,17 @@ Exec(JSContext *cx, unsigned argc, jsval
     JSFunction *fun;
     const char *name, **nargv;
     unsigned i, nargc;
     JSString *str;
     bool ok;
     pid_t pid;
     int status;
 
-    JS_SET_RVAL(cx, vp, JSVAL_VOID);
+    JS_SET_RVAL(cx, vp, UndefinedValue());
 
     fun = JS_ValueToFunction(cx, vp[0]);
     if (!fun)
         return false;
     if (!fun->atom)
         return true;
 
     nargc = 1 + argc;
@@ -4623,17 +4623,17 @@ static JSClass *GetDomClass() {
 static JSBool
 dom_genericGetter(JSContext *cx, unsigned argc, JS::Value *vp)
 {
     js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     if (JS_GetClass(obj) != &dom_class) {
-        *vp = JSVAL_VOID;
+        *vp = UndefinedValue();
         return true;
     }
 
     JS::Value val = js::GetReservedSlot(obj, DOM_OBJECT_SLOT);
 
     const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
     MOZ_ASSERT(info->type == JSJitInfo::Getter);
     JSJitPropertyOp getter = info->op;
@@ -4645,41 +4645,41 @@ dom_genericSetter(JSContext* cx, unsigne
 {
     js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     JS_ASSERT(argc == 1);
 
     if (JS_GetClass(obj) != &dom_class) {
-        *vp = JSVAL_VOID;
+        *vp = UndefinedValue();
         return true;
     }
 
     JS::Value* argv = JS_ARGV(cx, vp);
     JS::Value val = js::GetReservedSlot(obj, DOM_OBJECT_SLOT);
 
     const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
     MOZ_ASSERT(info->type == JSJitInfo::Setter);
     JSJitPropertyOp setter = info->op;
     if (!setter(cx, obj, val.toPrivate(), argv))
         return false;
-    *vp = JSVAL_VOID;
+    *vp = UndefinedValue();
     return true;
 }
 
 static JSBool
 dom_genericMethod(JSContext* cx, unsigned argc, JS::Value *vp)
 {
     js::RootedObject obj(cx, JS_THIS_OBJECT(cx, vp));
     if (!obj)
         return false;
 
     if (JS_GetClass(obj) != &dom_class) {
-        *vp = JSVAL_VOID;
+        *vp = UndefinedValue();
         return true;
     }
 
     JS::Value val = js::GetReservedSlot(obj, DOM_OBJECT_SLOT);
 
     const JSJitInfo *info = FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));
     MOZ_ASSERT(info->type == JSJitInfo::Method);
     JSJitMethodOp method = (JSJitMethodOp)info->op;
@@ -4814,20 +4814,20 @@ NewGlobalObject(JSContext *cx)
             return NULL;
 
         RootedObject it(cx, JS_DefineObject(cx, glob, "it", &its_class, NULL, 0));
         if (!it)
             return NULL;
         if (!JS_DefineProperties(cx, it, its_props))
             return NULL;
 
-        if (!JS_DefineProperty(cx, glob, "custom", JSVAL_VOID, its_getter,
+        if (!JS_DefineProperty(cx, glob, "custom", UndefinedValue(), its_getter,
                                its_setter, 0))
             return NULL;
-        if (!JS_DefineProperty(cx, glob, "customRdOnly", JSVAL_VOID, its_getter,
+        if (!JS_DefineProperty(cx, glob, "customRdOnly", UndefinedValue(), its_getter,
                                its_setter, JSPROP_READONLY))
             return NULL;
 
         /* Initialize FakeDOMObject. */
         static js::DOMCallbacks DOMcallbacks = {
             InstanceClassHasProtoAtDepth
         };
         SetDOMCallbacks(cx->runtime, &DOMcallbacks);
@@ -5293,17 +5293,17 @@ main(int argc, char **argv, char **envp)
     if (op.getBoolOption('O'))
         OOM_printAllocationCount = true;
 #endif
 
     /* Use the same parameters as the browser in xpcjsruntime.cpp. */
     rt = JS_NewRuntime(32L * 1024L * 1024L, JS_USE_HELPER_THREADS);
     if (!rt)
         return 1;
-    gTimeoutFunc = JSVAL_NULL;
+    gTimeoutFunc = NullValue();
     if (!JS_AddNamedValueRootRT(rt, &gTimeoutFunc, "gTimeoutFunc"))
         return 1;
 
     JS_SetGCParameter(rt, JSGC_MAX_BYTES, 0xffffffff);
 #ifdef JSGC_GENERATIONAL
     JS_SetGCParameter(rt, JSGC_ENABLE_GENERATIONAL, op.getBoolOption("ggc"));
 #endif