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
This commit is contained in:
Tom Ritter 2018-03-02 09:30:03 -06:00
Родитель 3114bcb097
Коммит 3c7ad292ee
2 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -204,18 +204,19 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
// 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;

Просмотреть файл

@ -161,17 +161,18 @@ extern const js::Class OuterWindowProxyClass;
// 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;