mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 13:57:32 +00:00

Constructing kComponentsInterfaceShimMap required a static constructor on some compilers, due to a non-constexpr constructor and the necessity of copying non-constexpr things like nsIID. This static constructor is large (several kilobytes of object code on x86-64) and completely unnecessary. To fix this, let's add a constexpr (well, MOZ_CONSTEXPR) constructor to ComponentsInterfaceShimEntry. This change alone doesn't completely solve our problem, because the nsIID member still needs to be copied. But doing that copying is silly: we only use the IID for constructing a ShimInterfaceInfo in ShimInterfaceInfo::MaybeConstruct, and the ShimInterfaceInfo constructor takes a const reference. So let's store a const reference in ComponentsInterfaceShimEntry, too, and make that structure significantly smaller in the process.