Bug 1480361 - Tweak handling of removed entries in HashTable::lookup(). r=luke

There are two improvements here.

- When we're just doing a lookup (i.e. aCollisionBit==0), we don't need to
  do any special handling of removed entries. (Inlining means that the removed
  entry code is entirely removed for lookups.)

- When we're doing an insertion (i.e. aCollisionBit==sCollisionBit), we now
  stop adding collision markings once we find a removed entry, because they're
  unnecessary after that point.

This change brings the code in alignment with PLDHashTable::SearchTable().

--HG--
extra : rebase_source : 8d6e3a88ac24d0e71a2576997face3bea971c71f
This commit is contained in:
Nicholas Nethercote 2018-08-03 10:03:31 +10:00
parent 74298abd28
commit 7cb8d52236

View File

@ -1766,12 +1766,10 @@ private:
Entry* firstRemoved = nullptr;
while (true) {
if (MOZ_UNLIKELY(entry->isRemoved())) {
if (!firstRemoved) {
if (aCollisionBit == sCollisionBit && !firstRemoved) {
if (MOZ_UNLIKELY(entry->isRemoved())) {
firstRemoved = entry;
}
} else {
if (aCollisionBit == sCollisionBit) {
} else {
entry->setCollision();
}
}