Closed Bug 1594267 Opened 5 years ago Closed 5 years ago

Make OutOfLinePoisoner::poison be MOZ_NEVER_INLINE

Categories

(Core :: MFBT, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: away, Assigned: away)

Details

Attachments

(1 file)

randomascii-inspired alternate title: "Add 17 bytes to save 412k"

The DOMString result; local variable that appears in 1500+ generated DOM bindings has a Maybe<nsAutoString> mString; member, which contains 64 char16_t's of inline storage in addition to the control fields. At the end of every DOM call, the destructor of the DOMString calls the destructor of the Maybe, which poisons its value.

Despite our template magic to switch between an InlinePoisoner and an OutOfLinePoisoner, our optimizing compiler ever-so-helpfully inlines the code anyway, and it's huge:

  697 00000001`81d3a793 488b05161d8703  mov     rax,qword ptr [xul!_imp_gMozillaPoisonValue (00000001`855ac4b0)]
  697 00000001`81d3a79a 488b00          mov     rax,qword ptr [rax]
  697 00000001`81d3a79d 4889442428      mov     qword ptr [rsp+28h],rax
  697 00000001`81d3a7a2 4889442430      mov     qword ptr [rsp+30h],rax
  697 00000001`81d3a7a7 4889442438      mov     qword ptr [rsp+38h],rax
  697 00000001`81d3a7ac 4889442440      mov     qword ptr [rsp+40h],rax
  697 00000001`81d3a7b1 4889442448      mov     qword ptr [rsp+48h],rax
  697 00000001`81d3a7b6 4889442450      mov     qword ptr [rsp+50h],rax
  697 00000001`81d3a7bb 4889442458      mov     qword ptr [rsp+58h],rax
  697 00000001`81d3a7c0 4889442460      mov     qword ptr [rsp+60h],rax
  697 00000001`81d3a7c5 4889442468      mov     qword ptr [rsp+68h],rax
  697 00000001`81d3a7ca 4889442470      mov     qword ptr [rsp+70h],rax
  697 00000001`81d3a7cf 4889442478      mov     qword ptr [rsp+78h],rax
  697 00000001`81d3a7d4 4889842480000000 mov     qword ptr [rsp+80h],rax
  697 00000001`81d3a7dc 4889842488000000 mov     qword ptr [rsp+88h],rax
  697 00000001`81d3a7e4 4889842490000000 mov     qword ptr [rsp+90h],rax
  697 00000001`81d3a7ec 4889842498000000 mov     qword ptr [rsp+98h],rax
  697 00000001`81d3a7f4 48898424a0000000 mov     qword ptr [rsp+0A0h],rax
  697 00000001`81d3a7fc 48898424a8000000 mov     qword ptr [rsp+0A8h],rax
  697 00000001`81d3a804 48898424b0000000 mov     qword ptr [rsp+0B0h],rax
  697 00000001`81d3a80c 48898424b8000000 mov     qword ptr [rsp+0B8h],rax

Forcing the compiler to do the poisoning out-of-line reduces the size of xul.dll by 412k on Win64 PGO nightlies.

Pushed by dmajor@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c12be2522c46
Make OutOfLinePoisoner::poison be MOZ_NEVER_INLINE r=froydnj
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
Assignee: nobody → dmajor
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: