Closed Bug 1178317 Opened 9 years ago Closed 9 years ago

eliminate large static constructor in ShimInterfaceInfo.cpp

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox42 --- fixed

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

It's silly that we have this.  Let's get rid of it.
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.
Attachment #8627230 - Flags: review?(birunthan)
Comment on attachment 8627230 [details] [diff] [review]
eliminate large static constructor from ShimInterfaceInfo.cpp

Review of attachment 8627230 [details] [diff] [review]:
-----------------------------------------------------------------

::: xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ +280,5 @@
>  using namespace mozilla;
>  
>  struct ComponentsInterfaceShimEntry {
> +  MOZ_CONSTEXPR ComponentsInterfaceShimEntry(const char* aName, const nsIID& aIID,
> +                                             const mozilla::dom::NativePropertyHooks* aNativePropHooks)

This is a rather long line, but I guess that doesn't really matter here. Perhaps remove `mozilla::` if you feel like it.
Attachment #8627230 - Flags: review?(birunthan) → review+
https://hg.mozilla.org/mozilla-central/rev/bbda4b92523f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You changed the emacs mode line but not the vim one :(
FYI I didn't change the modelines in this subdir with my script because too many files had 4-space indent or something.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: