Bug 1367219 - Avoid multiple hashtable lookups in DisplayItemData destructor r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Tue, 06 Jun 2017 18:12:17 +0200
changeset 413300 9b935696d41305da89c147173bca277db6f72dab
parent 413299 aa3d11c78ac9a7ee493b595e91bf49f4c77e50bc
child 413301 525fb3e1314b9da3d86c0f68c7bb76301eaae1bb
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1367219
milestone55.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 1367219 - Avoid multiple hashtable lookups in DisplayItemData destructor r=mattwoodrow MozReview-Commit-ID: Jr4yx5A9gWd
layout/painting/FrameLayerBuilder.cpp
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -265,18 +265,23 @@ DisplayItemData::~DisplayItemData()
     nsIFrame* frame = mFrameList[i];
     if (frame == sDestroyedFrame) {
       continue;
     }
     SmallPointerArray<DisplayItemData>& array = frame->DisplayItemData();
     array.RemoveElement(this);
   }
 
-  MOZ_RELEASE_ASSERT(sAliveDisplayItemDatas && sAliveDisplayItemDatas->Contains(this));
-  sAliveDisplayItemDatas->RemoveEntry(this);
+  MOZ_RELEASE_ASSERT(sAliveDisplayItemDatas);
+  nsPtrHashKey<mozilla::DisplayItemData>* entry
+    = sAliveDisplayItemDatas->GetEntry(this);
+  MOZ_RELEASE_ASSERT(entry);
+
+  sAliveDisplayItemDatas->RemoveEntry(entry);
+
   if (sAliveDisplayItemDatas->Count() == 0) {
     delete sAliveDisplayItemDatas;
     sAliveDisplayItemDatas = nullptr;
   }
 }
 
 void
 DisplayItemData::ClearAnimationCompositorState()