Bug 1483062 - Merge HashTable::wouldBeUnderloaded() into underloaded(). r=luke
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 15 Aug 2018 11:11:13 +1000
changeset 487043 ca2edc3b4c1ab044694e836f3da6963c929bcf35
parent 487042 a3bf3a494b0b7c2817e3f6f3daa9cf4ec7624435
child 487044 da46bfc2c089ad5e79bd9387850adc37240f26cb
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs1483062
milestone63.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 1483062 - Merge HashTable::wouldBeUnderloaded() into underloaded(). r=luke
mfbt/HashTable.h
--- a/mfbt/HashTable.h
+++ b/mfbt/HashTable.h
@@ -1704,27 +1704,25 @@ private:
                   "multiplication below could overflow");
 
     // Note: if capacity() is zero, this will always succeed, which is
     // what we want.
     return mEntryCount + mRemovedCount >=
            capacity() * sMaxAlphaNumerator / sAlphaDenominator;
   }
 
-  // Would the table be underloaded if it had the given capacity and entryCount?
-  static bool wouldBeUnderloaded(uint32_t aCapacity, uint32_t aEntryCount)
+  // True if the current load is equal to or below the minimum.
+  bool underloaded()
   {
     static_assert(sMaxCapacity <= UINT32_MAX / sMinAlphaNumerator,
                   "multiplication below could overflow");
-    return aCapacity > sMinCapacity &&
-           aEntryCount <= aCapacity * sMinAlphaNumerator / sAlphaDenominator;
+    return capacity() > sMinCapacity &&
+           mEntryCount <= capacity() * sMinAlphaNumerator / sAlphaDenominator;
   }
 
-  bool underloaded() { return wouldBeUnderloaded(capacity(), mEntryCount); }
-
   static MOZ_ALWAYS_INLINE bool match(Entry& aEntry, const Lookup& aLookup)
   {
     return HashPolicy::match(HashPolicy::getKey(aEntry.get()), aLookup);
   }
 
   enum LookupReason
   {
     ForNonAdd,