Bug 1385181 - Alter HashTable::lookupForAdd() to remove a redundant copy when return. r=luke
authorTing-Yu Chou <janus926@gmail.com>
Fri, 28 Jul 2017 14:05:40 +0800
changeset 420668 e94dceac80907abd4b579ddc8b7c202bbf461ec7
parent 420667 4615d6279e38afb561b515745291e34203495b58
child 420669 748a817e823e076f483cee7e26e69dcf8a807a4c
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1385181
milestone56.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 1385181 - Alter HashTable::lookupForAdd() to remove a redundant copy when return. r=luke MozReview-Commit-ID: 9XnlC0JXETX
js/public/HashTable.h
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -1767,19 +1767,17 @@ class HashTable : private AllocPolicy
     }
 
     MOZ_ALWAYS_INLINE AddPtr lookupForAdd(const Lookup& l) const
     {
         mozilla::ReentrancyGuard g(*this);
         if (!EnsureHash<HashPolicy>(l))
             return AddPtr();
         HashNumber keyHash = prepareHash(l);
-        Entry& entry = lookup(l, keyHash, sCollisionBit);
-        AddPtr p(entry, *this, keyHash);
-        return p;
+        return AddPtr(lookup(l, keyHash, sCollisionBit), *this, keyHash);
     }
 
     template <typename... Args>
     MOZ_MUST_USE bool add(AddPtr& p, Args&&... args)
     {
         mozilla::ReentrancyGuard g(*this);
         MOZ_ASSERT(table);
         MOZ_ASSERT_IF(p.isValid(), p.table_ == this);