Closed Bug 1262595 Opened 9 years ago Closed 8 years ago

declare js::ConstNullValue as a const value

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: froydnj, Assigned: away)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This change avoids multiple copies of ConstNullValue being generated in every compilation unit that includes RootingAPI.h.
ShowGlobals says that ConstNullValue is our most-duplicated symbol at 104 copies, one for each translation unit that includes RootingAPI.h (and presumably much worse in non-unified builds).
Blocks: 1334254
This patch saves around 800 bytes by bringing us down to a single-digit handful of duplicates, one for each template instantiation of Handle. It seemed like the most bang per buck. If we wanted to drive this all the way down to 1, I guess we could define something in a .cpp, but I didn't think a few more bytes was worth moving the definition far away.
Assignee: nfroyd → dmajor
Attachment #8835134 - Flags: review?(sphink)
Comment on attachment 8835134 [details] [diff] [review] Static in Handle's ctor Review of attachment 8835134 [details] [diff] [review]: ----------------------------------------------------------------- Funky. Definitely ok with this. Just to check -- this will get placed in a read-only section, right? I would prefer if writes through one of these Handles would trigger an immediate crash rather than corrupting a shared "null" value.
Attachment #8835134 - Flags: review?(sphink) → review+
That's definitely a fair concern. I've just checked and indeed these live in .rdata and are marked PAGE_READONLY at runtime.
Pushed by dmajor@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/9930b3b01f8f Reduce duplication of ConstNullValue across compilation units. r=sfink
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: