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 429835 d5a9cdfcffa6953ee0d7827a569ab95f6be18475
parent 429834 0ac55815c6bc3403b942b7adf4c5ef6b9e76a634
child 429836 3e943b6a9520ca0ae4c9b4d7e0fc8965b5537d76
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1393089
milestone57.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 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 ( )