Bug 1483062 - Rename HashTable::findFreeEntry() as findNonLiveEntry(). r=luke
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 14 Aug 2018 09:36:00 +1000
changeset 487039 f1e1cf1d42ec20c547a46cee30163a0b41fa36f4
parent 487038 e483b91eafbced7dd6636139cea44240a511bb5e
child 487040 43e351bda401e80292efbde947e56d1893b95903
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 - Rename HashTable::findFreeEntry() as findNonLiveEntry(). r=luke Because that's a more accurate description of what it does -- it finds free *and* removed entries.
mfbt/HashTable.h
--- a/mfbt/HashTable.h
+++ b/mfbt/HashTable.h
@@ -1780,18 +1780,18 @@ private:
       if (entry->matchHash(aKeyHash) && match(*entry, aLookup)) {
         return *entry;
       }
     }
   }
 
   // This is a copy of lookup() hardcoded to the assumptions:
   //   1. the lookup is for an add;
-  //   2. the key, whose |keyHash| has been passed is not in the table.
-  Entry& findFreeEntry(HashNumber aKeyHash)
+  //   2. the key, whose |keyHash| has been passed, is not in the table.
+  Entry& findNonLiveEntry(HashNumber aKeyHash)
   {
     MOZ_ASSERT(!(aKeyHash & sCollisionBit));
     MOZ_ASSERT(mTable);
 
     // We assume 'aKeyHash' has already been distributed.
 
     // Compute the primary hash address.
     HashNumber h1 = hash1(aKeyHash);
@@ -1853,17 +1853,17 @@ private:
     mGen++;
     mTable = newTable;
 
     // Copy only live entries, leaving removed ones behind.
     Entry* end = oldTable + oldCapacity;
     for (Entry* src = oldTable; src < end; ++src) {
       if (src->isLive()) {
         HashNumber hn = src->getKeyHash();
-        findFreeEntry(hn).setLive(
+        findNonLiveEntry(hn).setLive(
           hn, std::move(const_cast<typename Entry::NonConstT&>(src->get())));
       }
 
       src->~Entry();
     }
 
     // All entries have been destroyed, no need to destroyTable.
     this->free_(oldTable, oldCapacity);
@@ -1973,17 +1973,17 @@ private:
   // Prefer to use putNewInfallible; this function does not check
   // invariants.
   template<typename... Args>
   void putNewInfallibleInternal(const Lookup& aLookup, Args&&... aArgs)
   {
     MOZ_ASSERT(mTable);
 
     HashNumber keyHash = prepareHash(aLookup);
-    Entry* entry = &findFreeEntry(keyHash);
+    Entry* entry = &findNonLiveEntry(keyHash);
     MOZ_ASSERT(entry);
 
     if (entry->isRemoved()) {
       mRemovedCount--;
       keyHash |= sCollisionBit;
     }
 
     entry->setLive(keyHash, std::forward<Args>(aArgs)...);
@@ -2172,17 +2172,17 @@ public:
       RebuildStatus status = checkOverloaded();
       if (status == RehashFailed) {
         return false;
       }
       if (status == NotOverloaded && !this->checkSimulatedOOM()) {
         return false;
       }
       if (status == Rehashed) {
-        aPtr.mEntry = &findFreeEntry(aPtr.mKeyHash);
+        aPtr.mEntry = &findNonLiveEntry(aPtr.mKeyHash);
       }
     }
 
     aPtr.mEntry->setLive(aPtr.mKeyHash, std::forward<Args>(aArgs)...);
     mEntryCount++;
 #ifdef DEBUG
     mMutationCount++;
     aPtr.mGeneration = generation();