Bug 1393089 - Part 5: Remove no longer used variable and avoid one unnecessary rooting. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 28 Aug 2017 16:26:19 +0200
changeset 663388 4cc7890ba6e3dcad8304e8f9019111cac06de002
parent 663387 3e943b6a9520ca0ae4c9b4d7e0fc8965b5537d76
child 663389 4acbcf36de474be12c30a07a913236d8041d5319
push id79424
push userbmo:tchiovoloni@mozilla.com
push dateTue, 12 Sep 2017 23:17:54 +0000
reviewersjandem
bugs1393089
milestone57.0a1
Bug 1393089 - Part 5: Remove no longer used variable and avoid one unnecessary rooting. r=jandem
js/src/vm/TypedArrayObject.cpp
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -694,17 +694,16 @@ class TypedArrayObjectTemplate : public 
         return true;
     }
 
   private:
     static JSObject*
     create(JSContext* cx, const CallArgs& args)
     {
         MOZ_ASSERT(args.isConstructing());
-        RootedObject newTarget(cx, &args.newTarget().toObject());
 
         // 22.2.4.1 TypedArray ( )
         // 22.2.4.2 TypedArray ( length )
         if (args.length() == 0 || !args[0].isObject()) {
             // 22.2.4.2, step 3.
             uint64_t len;
             if (!ToIndex(cx, args.get(0), JSMSG_BAD_ARRAY_LENGTH, &len))
                 return nullptr;
@@ -1294,17 +1293,17 @@ TypedArrayObjectTemplate<T>::fromObject(
 
     bool optimized = false;
     if (!IsOptimizableInit(cx, other, &optimized))
         return nullptr;
 
     // Fast path when iterable is a packed array using the default iterator.
     if (optimized) {
         // Step 6.a (We don't need to call IterableToList for the fast path).
-        RootedArrayObject array(cx, &other->as<ArrayObject>());
+        HandleArrayObject array = other.as<ArrayObject>();
 
         // Step 6.b.
         uint32_t len = array->getDenseInitializedLength();
 
         // Step 6.c.
         Rooted<ArrayBufferObject*> buffer(cx);
         if (!maybeCreateArrayBuffer(cx, len, BYTES_PER_ELEMENT, nullptr, &buffer))
             return nullptr;