Consider inlining cross-realm native calls in IonBuilder
Categories
(Core :: JavaScript Engine: JIT, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
We don't inline cross-realm scripted/native calls in IonBuilder, but there are many natives we could easily inline cross-realm (the obvious ones are the typedArray.length getter, Math functions, etc).
Assignee | ||
Comment 1•5 years ago
|
||
Note to self: the realm check in IonBuilder::createThis is also a bit too pessimistic, many of the cases there are perfectly fine with a cross-realm function.
Assignee | ||
Comment 2•5 years ago
|
||
As a start we should probably add the "abort if cross-realm" check to the inlining code for each native function, instead of checking it globally, and then we can incrementally remove the checks from the safe ones.
Assignee | ||
Comment 3•5 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #2)
As a start we should probably add the "abort if cross-realm" check to the inlining code for each native function, instead of checking it globally, and then we can incrementally remove the checks from the safe ones.
This isn't trivial because there's no reliable way to get the target realm from the callInfo passed to all the IonBuilder::inlineFoo methods. One option is to add a |Realm* targetRealm| argument to all of them. That might be nice anyway to remind people of the cross-realm case.
This will be pretty tedious to do but we should just get it over with now that we're fixing cross-realm issues.
Assignee | ||
Comment 4•5 years ago
|
||
This adds the basic infrastructure and uses it for some Math natives and the
Array constructor.
Assignee | ||
Comment 5•5 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #3)
This isn't trivial because there's no reliable way to get the target realm from the callInfo passed to all the IonBuilder::inlineFoo methods. One option is to add a |Realm* targetRealm| argument to all of them. That might be nice anyway to remind people of the cross-realm case.
I ended up implementing a less verbose option: I added a CanInlineCrossRealm function that's just a big switch-stament returning false for most natives. It's even more explicit and makes it easy to incrementally whitelist things in the future.
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/deb3594da5b1 Allow inlining some cross-realm native calls in IonBuilder. r=anba
Comment 7•5 years ago
|
||
bugherder |
Description
•