Bug 1524435 - Stop using JSRope::new_<NoGC> when allocating test ropes r=jonco
authorSteve Fink <sfink@mozilla.com>
Thu, 07 Mar 2019 00:27:57 +0000
changeset 520676 248ccbf196f4bf728bef039871a899cca81f9d7f
parent 520675 ad613d1154eb910dbceeac5dff7585a1ce8d0c52
child 520677 99b3207cda021ab6c393dac4533321284772afbd
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1524435
milestone67.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 1524435 - Stop using JSRope::new_<NoGC> when allocating test ropes r=jonco Differential Revision: https://phabricator.services.mozilla.com/D22033
js/src/builtin/TestingFunctions.cpp
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -1652,27 +1652,26 @@ static bool NewRope(JSContext* cx, unsig
     if (!JS_GetProperty(cx, options, "nursery", &v)) {
       return false;
     }
     if (!v.isUndefined() && !ToBoolean(v)) {
       heap = js::gc::TenuredHeap;
     }
   }
 
-  JSString* left = args[0].toString();
-  JSString* right = args[1].toString();
+  RootedString left(cx, args[0].toString());
+  RootedString right(cx, args[1].toString());
   size_t length = JS_GetStringLength(left) + JS_GetStringLength(right);
   if (length > JSString::MAX_LENGTH) {
     JS_ReportErrorASCII(cx, "rope length exceeds maximum string length");
     return false;
   }
 
-  Rooted<JSRope*> str(cx, JSRope::new_<NoGC>(cx, left, right, length, heap));
+  Rooted<JSRope*> str(cx, JSRope::new_<CanGC>(cx, left, right, length, heap));
   if (!str) {
-    JS_ReportOutOfMemory(cx);
     return false;
   }
 
   args.rval().setString(str);
   return true;
 }
 
 static bool IsRope(JSContext* cx, unsigned argc, Value* vp) {