mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1483062 - Inline and remove HashTable::overRemoved(). r=luke
--HG-- extra : rebase_source : c7dbdbe38bf0f44f27bda7f134bbf0d865149200
This commit is contained in:
parent
eb0a51a708
commit
1c305db7ce
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user