Closed Bug 1357680 Opened 8 years ago Closed 8 years ago

Babel class inheritance code confuses TI and Ion inlining

Categories

(Core :: JavaScript Engine: JIT, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla55
Performance Impact high
Tracking Status
firefox55 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 2 open bugs)

Details

(Keywords: perf)

Attachments

(3 files)

Ember's Glimmer VM is transpiled with Babel. For derived classes, Babel uses setPrototypeOf on the constructor function. This pattern confuses TI and hence we don't inline some trivial base constructors and end up with megamorphic property accesses on the Ember benchmark in bug 1352486. I have patches to fix this and some related issues with proto mutation,
Ion is currently unable to inline functions with unknown properties, because we need to add a type constraint to trigger invalidation of compilations that inlined the script when the callees stack types change. This patch replaces this constraint with a Vector of RecompileInfo entries (compilations that inlined this script) on TypeScript, so we can invalidate them on type changes.
Attachment #8859509 - Flags: review?(bhackett1024)
Blocks: jsperf
Keywords: perf
Priority: -- → P1
Attachment #8859509 - Flags: review?(bhackett1024) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/7a446a56598f part 1 - Track Ion-inlined scripts explicitly so we can inline functions with unknown properties. r=bhackett
Keywords: leave-open
Flags: needinfo?(jdemooij)
Ugh a js_free must be js_delete, I had that change at some point but must have dropped it.
Backout by ihsiao@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/3ccc9c855766 Backed out changeset 7a446a56598f for leak issue
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/954eeda43262 part 1 - Track Ion-inlined scripts explicitly so we can inline functions with unknown properties. r=bhackett
Relanded and stuck.
Flags: needinfo?(jdemooij)
This patch is also unlikely to improve anything but it's another incremental step.
Attachment #8860903 - Flags: review?(bhackett1024)
Attachment #8860903 - Flags: review?(bhackett1024) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/c35f0ad34397 part 2 - Remove unnecessary setNewGroupUnknown call in SetClassAndProto. r=bhackett
Attached patch Part 3 - TI changes (deleted) — Splinter Review
This patch makes 2 changes: (1) When we mutate the prototype of a native object, instead of marking the new group as having unknown properties, we propagate the property types from the object to the new group. (2) When we mutate the prototype of a scripted function, we create a new group and propagate the canonical JSFunction to it. On the Ember benchmark we can inline more functions now and I hope these changes will make us more robust in a lot of other cases that involve proto mutation.
Attachment #8863358 - Flags: review?(bhackett1024)
Comment on attachment 8863358 [details] [diff] [review] Part 3 - TI changes Brian has no internet access for a while but reviewed this over email.
Attachment #8863358 - Flags: review?(bhackett1024) → review+
Pushed by jandemooij@gmail.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/b6315d186b4b part 3 - Don't mark the new group as having unknown properties when changing an object's proto. r=bhackett
Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
This will affect speedometer with updated Ember. marking [qf:p1] for tracking high impact improvements.
Whiteboard: [qf:p1]
Performance Impact: --- → P1
Whiteboard: [qf:p1]
No longer depends on: 1395919
Regressions: 1395919
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: