Bug 1483062 - Inline and remove HashTable::overRemoved(). r=luke

--HG--
extra : rebase_source : c7dbdbe38bf0f44f27bda7f134bbf0d865149200
This commit is contained in:
Nicholas Nethercote 2018-08-15 11:10:56 +10:00
parent eb0a51a708
commit 1c305db7ce

View File

@ -1870,15 +1870,6 @@ private:
return Rehashed;
}
bool overRemoved()
{
// Succeed if a quarter or more of all entries are removed. Note that this
// always succeeds if capacity() == 0 (i.e. entry storage has not been
// allocated), which is what we want, because it means changeTableSize()
// will allocate the requested capacity rather than doubling it.
return mRemovedCount >= (capacity() >> 2);
}
RebuildStatus rehashIfOverloaded(
FailureBehavior aReportFailure = ReportFailure)
{
@ -1886,9 +1877,12 @@ private:
return NotOverloaded;
}
uint32_t newCapacity = overRemoved()
? rawCapacity()
: rawCapacity() * 2;
// Succeed if a quarter or more of all entries are removed. Note that this
// always succeeds if capacity() == 0 (i.e. entry storage has not been
// allocated), which is what we want, because it means changeTableSize()
// will allocate the requested capacity rather than doubling it.
bool manyRemoved = mRemovedCount >= (capacity() >> 2);
uint32_t newCapacity = manyRemoved ? rawCapacity() : rawCapacity() * 2;
return changeTableSize(newCapacity, aReportFailure);
}