Bug 1526972 - P2: Re-order mItem->CanBeReused()/mItem->HasDeletedFrame(). r=miko
☠☠ backed out by 9f0f38c38ccc ☠ ☠
authorDan Glastonbury <dan.glastonbury@gmail.com>
Mon, 15 Apr 2019 00:23:09 +0000
changeset 469448 54b14df56e6f06c730b57c5d503955b02d6c7963
parent 469447 a59f06022a956d1cc3032f6713d5ec122096c299
child 469449 ddd57e4372286632c4759d84d86cba27b30fc3a2
push id112792
push userncsoregi@mozilla.com
push dateMon, 15 Apr 2019 09:49:11 +0000
treeherdermozilla-inbound@a57f27d3ccd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko
bugs1526972
milestone68.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 1526972 - P2: Re-order mItem->CanBeReused()/mItem->HasDeletedFrame(). r=miko To short-circuit the expensive call with a flag check. Depends on D24459 Differential Revision: https://phabricator.services.mozilla.com/D26135
layout/painting/RetainedDisplayListBuilder.cpp
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -139,17 +139,17 @@ bool RetainedDisplayListBuilder::PreProc
   nsDisplayList saved;
   aList->mOldItems.SetCapacity(aList->Count());
   MOZ_RELEASE_ASSERT(aList->mOldItems.IsEmpty());
   while (nsDisplayItem* item = aList->RemoveBottom()) {
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
     item->SetMergedPreProcessed(false, true);
 #endif
 
-    if (item->HasDeletedFrame() || !item->CanBeReused()) {
+    if (!item->CanBeReused() || item->HasDeletedFrame()) {
       size_t i = aList->mOldItems.Length();
       aList->mOldItems.AppendElement(OldItemInfo(nullptr));
       item->Destroy(&mBuilder);
 
       if (initializeDAG) {
         if (i == 0) {
           aList->mDAG.AddNode(Span<const MergedListIndex>());
         } else {
@@ -286,17 +286,17 @@ void OldItemInfo::Discard(RetainedDispla
   mDirectPredecessors = std::move(aDirectPredecessors);
   if (mItem) {
     mItem->Destroy(aBuilder->Builder());
   }
   mItem = nullptr;
 }
 
 bool OldItemInfo::IsChanged() {
-  return !mItem || mItem->HasDeletedFrame() || !mItem->CanBeReused();
+  return !mItem || !mItem->CanBeReused() || mItem->HasDeletedFrame();
 }
 
 /**
  * A C++ implementation of Markus Stange's merge-dags algorithm.
  * https://github.com/mstange/merge-dags
  *
  * MergeState handles combining a new list of display items into an existing
  * DAG and computes the new DAG in a single pass.