Bug 1290337 - Part 4: Replace Value parameter to HandleValue in js shell. r=sfink
authorTooru Fujisawa <arai_a@mac.com>
Sun, 11 Sep 2016 19:22:03 +0900
changeset 316049 f81c58393110bf0a3cf9f6c39262dca1af57cdd0
parent 316048 9796ed81f17a936804ec792c843dadf2c00023df
child 316050 9f0b9ebc2f1fa06820db74823ebe9179f8e627cf
push id30759
push userphilringnalda@gmail.com
push dateSat, 01 Oct 2016 06:25:09 +0000
treeherdermozilla-central@fcc62bbf09ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs1290337
milestone52.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 1290337 - Part 4: Replace Value parameter to HandleValue in js shell. r=sfink
js/src/shell/js.cpp
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -2206,20 +2206,18 @@ AssertEq(JSContext* cx, unsigned argc, V
         }
         return false;
     }
     args.rval().setUndefined();
     return true;
 }
 
 static JSScript*
-ValueToScript(JSContext* cx, Value vArg, JSFunction** funp = nullptr)
-{
-    RootedValue v(cx, vArg);
-
+ValueToScript(JSContext* cx, HandleValue v, JSFunction** funp = nullptr)
+{
     if (v.isString()) {
         // To convert a string to a script, compile it. Parse it as an ES6 Program.
         RootedLinearString linearStr(cx, StringToLinearString(cx, v.toString()));
         if (!linearStr)
             return nullptr;
         size_t len = GetLinearStringLength(linearStr);
         AutoStableStringChars linearChars(cx);
         if (!linearChars.initTwoByte(cx, linearStr))
@@ -2270,17 +2268,17 @@ GetTopScript(JSContext* cx)
 
 static bool
 GetScriptAndPCArgs(JSContext* cx, unsigned argc, Value* argv, MutableHandleScript scriptp,
                    int32_t* ip)
 {
     RootedScript script(cx, GetTopScript(cx));
     *ip = 0;
     if (argc != 0) {
-        Value v = argv[0];
+        RootedValue v(cx, argv[0]);
         unsigned intarg = 0;
         if (v.isObject() &&
             JS_GetClass(&v.toObject()) == Jsvalify(&JSFunction::class_)) {
             script = ValueToScript(cx, v);
             if (!script)
                 return false;
             intarg++;
         }
@@ -6147,17 +6145,17 @@ DefineConsole(JSContext* cx, HandleObjec
 #endif
 
 #undef PROFILING_FUNCTION_COUNT
 #undef CALLGRIND_FUNCTION_COUNT
 #undef VTUNE_FUNCTION_COUNT
 #undef EXTERNAL_FUNCTION_COUNT
 
 static bool
-PrintHelpString(JSContext* cx, Value v)
+PrintHelpString(JSContext* cx, HandleValue v)
 {
     JSString* str = v.toString();
     MOZ_ASSERT(gOutFile->isOpen());
 
     JSLinearString* linear = str->ensureLinear(cx);
     if (!linear)
         return false;