зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1460674 - part 0a - store the hash table entry size in iterators; r=njn
This change is satisfying insofar as it removes a load from every iteration step over the hashtable, but it doesn't seem to affect our collection benchmarks in any way. The change does not make iterators any larger, as there is padding at the end of the iterator structure on both 32- and 64-bit platforms.
This commit is contained in:
Родитель
5428f49924
Коммит
d98ab29fdb
|
@ -728,6 +728,7 @@ PLDHashTable::Iterator::Iterator(Iterator&& aOther)
|
||||||
, mNexts(aOther.mNexts)
|
, mNexts(aOther.mNexts)
|
||||||
, mNextsLimit(aOther.mNextsLimit)
|
, mNextsLimit(aOther.mNextsLimit)
|
||||||
, mHaveRemoved(aOther.mHaveRemoved)
|
, mHaveRemoved(aOther.mHaveRemoved)
|
||||||
|
, mEntrySize(aOther.mEntrySize)
|
||||||
{
|
{
|
||||||
// No need to change |mChecker| here.
|
// No need to change |mChecker| here.
|
||||||
aOther.mTable = nullptr;
|
aOther.mTable = nullptr;
|
||||||
|
@ -736,6 +737,7 @@ PLDHashTable::Iterator::Iterator(Iterator&& aOther)
|
||||||
aOther.mNexts = 0;
|
aOther.mNexts = 0;
|
||||||
aOther.mNextsLimit = 0;
|
aOther.mNextsLimit = 0;
|
||||||
aOther.mHaveRemoved = false;
|
aOther.mHaveRemoved = false;
|
||||||
|
aOther.mEntrySize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLDHashTable::Iterator::Iterator(PLDHashTable* aTable)
|
PLDHashTable::Iterator::Iterator(PLDHashTable* aTable)
|
||||||
|
@ -745,6 +747,7 @@ PLDHashTable::Iterator::Iterator(PLDHashTable* aTable)
|
||||||
, mNexts(0)
|
, mNexts(0)
|
||||||
, mNextsLimit(mTable->EntryCount())
|
, mNextsLimit(mTable->EntryCount())
|
||||||
, mHaveRemoved(false)
|
, mHaveRemoved(false)
|
||||||
|
, mEntrySize(aTable->mEntrySize)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
mTable->mChecker.StartReadOp();
|
mTable->mChecker.StartReadOp();
|
||||||
|
@ -788,7 +791,7 @@ PLDHashTable::Iterator::IsOnNonLiveEntry() const
|
||||||
MOZ_ALWAYS_INLINE void
|
MOZ_ALWAYS_INLINE void
|
||||||
PLDHashTable::Iterator::MoveToNextEntry()
|
PLDHashTable::Iterator::MoveToNextEntry()
|
||||||
{
|
{
|
||||||
mCurrent += mTable->mEntrySize;
|
mCurrent += mEntrySize;
|
||||||
if (mCurrent == mLimit) {
|
if (mCurrent == mLimit) {
|
||||||
mCurrent = mTable->mEntryStore.Get(); // Wrap-around. Possible due to Chaos Mode.
|
mCurrent = mTable->mEntryStore.Get(); // Wrap-around. Possible due to Chaos Mode.
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,6 +491,7 @@ public:
|
||||||
uint32_t mNextsLimit; // Next() call limit.
|
uint32_t mNextsLimit; // Next() call limit.
|
||||||
|
|
||||||
bool mHaveRemoved; // Have any elements been removed?
|
bool mHaveRemoved; // Have any elements been removed?
|
||||||
|
uint8_t mEntrySize; // Size of entries.
|
||||||
|
|
||||||
bool IsOnNonLiveEntry() const;
|
bool IsOnNonLiveEntry() const;
|
||||||
void MoveToNextEntry();
|
void MoveToNextEntry();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче