Bug 1393089 - Part 3: Directly assign result to variable instead of going through another temp variable. r=jandem
authorAndré Bargull <andre.bargull@gmail.com>
Wed, 23 Aug 2017 18:10:47 +0200
changeset 663386 d5a9cdfcffa6953ee0d7827a569ab95f6be18475
parent 663385 0ac55815c6bc3403b942b7adf4c5ef6b9e76a634
child 663387 3e943b6a9520ca0ae4c9b4d7e0fc8965b5537d76
push id79424
push userbmo:tchiovoloni@mozilla.com
push dateTue, 12 Sep 2017 23:17:54 +0000
reviewersjandem
bugs1393089
milestone57.0a1
Bug 1393089 - Part 3: Directly assign result to variable instead of going through another temp variable. r=jandem
js/src/vm/TypedArrayObject.cpp
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -655,23 +655,22 @@ class TypedArrayObjectTemplate : public 
         if (!fitsInline && len > 0) {
             buf = cx->zone()->pod_malloc<uint8_t>(nbytes);
             if (!buf) {
                 ReportOutOfMemory(cx);
                 return nullptr;
             }
 
             memset(buf, 0, nbytes);
-         }
+        }
 
-        RootedObject tmp(cx, NewObjectWithGroup<TypedArrayObject>(cx, group, allocKind, newKind));
-        if (!tmp)
+        TypedArrayObject* obj = NewObjectWithGroup<TypedArrayObject>(cx, group, allocKind, newKind);
+        if (!obj)
             return nullptr;
 
-        TypedArrayObject* obj = &tmp->as<TypedArrayObject>();
         initTypedArraySlots(cx, obj, len);
         initTypedArrayData(cx, obj, len, buf.forget(), allocKind);
 
         return obj;
     }
 
     // ES2018 draft rev 8340bf9a8427ea81bb0d1459471afbcc91d18add
     // 22.2.4.1 TypedArray ( )