Closed Bug 1632561 Opened 4 years ago Closed 4 years ago

[IonMonkey] The __proto__ getter is not inlinable, while Object.getPrototypeOf is

Categories

(Core :: JavaScript Engine: JIT, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: tcampbell, Assigned: anba)

References

Details

Attachments

(1 file)

(Reported by @pygy on the #perf matrix channel)

Hello, are there folks here interested in discussing the intricacies of JS perf? Specifically, >the fact that x.__proto__ is almost twice as slow as Object.getPrototypeOf(x) in a >polymorphic scenario (where the Object.prototype.__proto__ getter ends up being hit, no >matter what)?
x is either a POJO or a DOM node with 50/50 probability
Either SpiderMonkey is unable to infer that the same getter ends up being hit, no matter >what, or the getter has some incredible overhead.

Profile: https://perfht.ml/2xJ2tdh

It looks like we are able to inline Object.getPrototypeOf fully in Ion via [1], while for the __proto__ case we always call the C++ getter.

[1] https://searchfox.org/mozilla-central/rev/41c3ea3ee8eab9ce7b82932257cb80b703cbba67/js/src/jit/MCallOptimize.cpp#2014

We don't support mixing self-hosted and native accessors in JSPropertySpec,
therefore we need to move the setter into self-hosted code, too, even though
we only need to have the getter self-hosted to be able to inline it.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Pushed by nerli@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/65bec75f5f10
Self-host Object.prototype.__proto__ accessors. r=tcampbell
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: