Bug 1506730 - remove PLDHashTable::Iterator::mStart; r=njn
authorNathan Froyd <froydnj@mozilla.com>
Mon, 19 Nov 2018 09:54:04 -0500
changeset 503515 640b09ec036ea40e164b2193172bf247475d9930
parent 503427 4ef55dde9b9310f0f1060943700a76955b94d688
child 503516 3b2da7e798ead163fc55d463bee46682d65d64ec
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1506730
milestone65.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 1506730 - remove PLDHashTable::Iterator::mStart; r=njn We only use its value in one place, and said value is easily computable from readily available information. This change makes iterators slightly smaller.
xpcom/ds/PLDHashTable.cpp
xpcom/ds/PLDHashTable.h
--- a/xpcom/ds/PLDHashTable.cpp
+++ b/xpcom/ds/PLDHashTable.cpp
@@ -718,36 +718,33 @@ PLDHashTable::ShallowSizeOfExcludingThis
 size_t
 PLDHashTable::ShallowSizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this) + ShallowSizeOfExcludingThis(aMallocSizeOf);
 }
 
 PLDHashTable::Iterator::Iterator(Iterator&& aOther)
   : mTable(aOther.mTable)
-  , mStart(aOther.mStart)
   , mLimit(aOther.mLimit)
   , mCurrent(aOther.mCurrent)
   , mNexts(aOther.mNexts)
   , mNextsLimit(aOther.mNextsLimit)
   , mHaveRemoved(aOther.mHaveRemoved)
 {
   // No need to change |mChecker| here.
   aOther.mTable = nullptr;
-  aOther.mStart = nullptr;
   aOther.mLimit = nullptr;
   aOther.mCurrent = nullptr;
   aOther.mNexts = 0;
   aOther.mNextsLimit = 0;
   aOther.mHaveRemoved = false;
 }
 
 PLDHashTable::Iterator::Iterator(PLDHashTable* aTable)
   : mTable(aTable)
-  , mStart(mTable->mEntryStore.Get())
   , mLimit(mTable->mEntryStore.Get() + mTable->Capacity() * mTable->mEntrySize)
   , mCurrent(mTable->mEntryStore.Get())
   , mNexts(0)
   , mNextsLimit(mTable->EntryCount())
   , mHaveRemoved(false)
 {
 #ifdef DEBUG
   mTable->mChecker.StartReadOp();
@@ -788,17 +785,17 @@ PLDHashTable::Iterator::IsOnNonLiveEntry
   return !EntryIsLive(reinterpret_cast<PLDHashEntryHdr*>(mCurrent));
 }
 
 MOZ_ALWAYS_INLINE void
 PLDHashTable::Iterator::MoveToNextEntry()
 {
   mCurrent += mTable->mEntrySize;
   if (mCurrent == mLimit) {
-    mCurrent = mStart;  // Wrap-around. Possible due to Chaos Mode.
+    mCurrent = mTable->mEntryStore.Get();  // Wrap-around. Possible due to Chaos Mode.
   }
 }
 
 void
 PLDHashTable::Iterator::Next()
 {
   MOZ_ASSERT(!Done());
 
--- a/xpcom/ds/PLDHashTable.h
+++ b/xpcom/ds/PLDHashTable.h
@@ -480,17 +480,16 @@ public:
     // Remove the current entry. Must only be called once per entry, and Get()
     // must not be called on that entry afterwards.
     void Remove();
 
   protected:
     PLDHashTable* mTable;             // Main table pointer.
 
   private:
-    char* mStart;                     // The first entry.
     char* mLimit;                     // One past the last entry.
     char* mCurrent;                   // Pointer to the current entry.
     uint32_t mNexts;                  // Number of Next() calls.
     uint32_t mNextsLimit;             // Next() call limit.
 
     bool mHaveRemoved;                // Have any elements been removed?
 
     bool IsOnNonLiveEntry() const;