Bug 1443252 - Make nsGlobalWindowInner/Outer final to reduce build times. r=mystor
authorTom Ritter <tom@mozilla.com>
Fri, 02 Mar 2018 09:30:03 -0600
changeset 461643 c6e5bda8eb7352bf350d4182e70491bf89ab5a82
parent 461642 dd94760baaf5c65f57a32bd56f64f085ff9b0034
child 461644 cfe4f208baacf94a25c1b3ed9dd8e2bd5a3a620c
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmystor
bugs1443252, 1332680
milestone60.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 1443252 - Make nsGlobalWindowInner/Outer final to reduce build times. r=mystor In Bug 1332680 we got a list of classes and methods we could mark 'final', as suggested by an LTO build of gcc. One of the items on that list was nsGlobalWindowInner and nsGlobalWindowOuter, with quite a lot of virtual calls: > dom/base/nsGlobalWindowInner.h:206:7: warning: Declaring type 'struct nsGlobalWindowInner' final would enable devirtualization of 483 calls > dom/base/nsGlobalWindowOuter.h:164:7: warning: Declaring type 'struct nsGlobalWindowOuter' final would enable devirtualization of 143 calls After trying it out, we saw a modest improvement to a single Talos tes (displaylist mutate got 4-8.5% better). That's not the interesting thing though. For Linux and OSX (and some flavors of Android) build times were reduced by half across the board. They're a bit variable of course, but 30-70% improvements are shown by Talos. Windows and other flavors of Android show 10-15% improvements. MozReview-Commit-ID: GlEGBt2JOTt
dom/base/nsGlobalWindowInner.h
dom/base/nsGlobalWindowOuter.h
--- a/dom/base/nsGlobalWindowInner.h
+++ b/dom/base/nsGlobalWindowInner.h
@@ -199,28 +199,29 @@ ImplCycleCollectionTraverse(nsCycleColle
 // windows still in memory for any given outer window. This list is needed to
 // ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means
 // that the window itself is always in the list, and an outer window's list will
 // also contain all inner window objects that are still in memory (and in
 // reality all inner window object's lists also contain its outer and all other
 // inner windows belonging to the same outer window, but that's an unimportant
 // side effect of inheriting PRCList).
 
-class nsGlobalWindowInner : public mozilla::dom::EventTarget,
-                            public nsPIDOMWindowInner,
-                            private nsIDOMWindow,
-                            // NOTE: This interface is private, as it's only
-                            // implemented on chrome windows.
-                            private nsIDOMChromeWindow,
-                            public nsIScriptGlobalObject,
-                            public nsIScriptObjectPrincipal,
-                            public nsSupportsWeakReference,
-                            public nsIInterfaceRequestor,
-                            public PRCListStr,
-                            public nsAPostRefreshObserver
+class nsGlobalWindowInner final
+  : public mozilla::dom::EventTarget
+  , public nsPIDOMWindowInner
+  , private nsIDOMWindow
+  // NOTE: This interface is private, as it's only
+  // implemented on chrome windows.
+  , private nsIDOMChromeWindow
+  , public nsIScriptGlobalObject
+  , public nsIScriptObjectPrincipal
+  , public nsSupportsWeakReference
+  , public nsIInterfaceRequestor
+  , public PRCListStr
+  , public nsAPostRefreshObserver
 {
 public:
   typedef mozilla::TimeStamp TimeStamp;
   typedef mozilla::TimeDuration TimeDuration;
 
   typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowInner*> InnerWindowByIdTable;
 
   static void
--- a/dom/base/nsGlobalWindowOuter.h
+++ b/dom/base/nsGlobalWindowOuter.h
@@ -156,27 +156,28 @@ extern const js::Class OuterWindowProxyC
 // windows still in memory for any given outer window. This list is needed to
 // ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means
 // that the window itself is always in the list, and an outer window's list will
 // also contain all inner window objects that are still in memory (and in
 // reality all inner window object's lists also contain its outer and all other
 // inner windows belonging to the same outer window, but that's an unimportant
 // side effect of inheriting PRCList).
 
-class nsGlobalWindowOuter : public mozilla::dom::EventTarget,
-                            public nsPIDOMWindowOuter,
-                            private nsIDOMWindow,
-                            // NOTE: This interface is private, as it's only
-                            // implemented on chrome windows.
-                            private nsIDOMChromeWindow,
-                            public nsIScriptGlobalObject,
-                            public nsIScriptObjectPrincipal,
-                            public nsSupportsWeakReference,
-                            public nsIInterfaceRequestor,
-                            public PRCListStr
+class nsGlobalWindowOuter final
+  : public mozilla::dom::EventTarget
+  , public nsPIDOMWindowOuter
+  , private nsIDOMWindow
+    // NOTE: This interface is private, as it's only
+    // implemented on chrome windows.
+  , private nsIDOMChromeWindow
+  , public nsIScriptGlobalObject
+  , public nsIScriptObjectPrincipal
+  , public nsSupportsWeakReference
+  , public nsIInterfaceRequestor
+  , public PRCListStr
 {
 public:
   typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowOuter*> OuterWindowByIdTable;
 
   static void
   AssertIsOnMainThread()
 #ifdef DEBUG
   ;