mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1385181 - Avoid excess copying when return from HashTable::lookupForAdd(). r=luke
MozReview-Commit-ID: F95DCc1wvkE --HG-- extra : rebase_source : 42edaf41d53e9c7646206cc6ea9c9ce976846eb1
This commit is contained in:
parent
22c17c93c9
commit
fe98b4e219
@ -1772,9 +1772,15 @@ class HashTable : private AllocPolicy
|
||||
if (!EnsureHash<HashPolicy>(l))
|
||||
return AddPtr();
|
||||
HashNumber keyHash = prepareHash(l);
|
||||
Entry& entry = lookup(l, keyHash, sCollisionBit);
|
||||
AddPtr p(entry, *this, keyHash);
|
||||
// Calling constructor in return statement here avoid excess copying
|
||||
// when build with Visual Studio 2015 and 2017, but it triggers a bug in
|
||||
// gcc which is fixed in gcc-6. See bug 1385181.
|
||||
#if MOZ_IS_GCC && __GNUC__ < 6
|
||||
AddPtr p(lookup(l, keyHash, sCollisionBit), *this, keyHash);
|
||||
return p;
|
||||
#else
|
||||
return AddPtr(lookup(l, keyHash, sCollisionBit), *this, keyHash);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
|
Loading…
Reference in New Issue
Block a user