Optimize JSOp::Lambda in Baseline
Categories
(Core :: JavaScript Engine: JIT, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox135 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(3 files)
js::Lambda
will be the most-called VMFunction
on Speedometer 3 after bug 1935632. Baseline IC code is likely responsible for most of these calls.
This is a very common operation (arrow functions likely contributed) that should be fast in Baseline too. The simplest option is probably to implement this with an IC similar to what we do for the NewObject
and NewArray
ops.
Updated•2 months ago
|
Assignee | ||
Comment 1•2 months ago
|
||
A Baseline IC for JSOp::Lambda
gets rid of pretty much all of these VM calls. For the micro-benchmark below I get:
--no-ion before: 268 ms
--no-ion after: 94 ms
no flags: 55 ms
function f() {
var res;
var t = new Date;
for (var i = 0; i < 10_000_000; i++) {
res = x => x + 1;
}
print(new Date - t);
return res;
}
f();
Assignee | ||
Comment 2•2 months ago
|
||
The code for LLambda
already relied on this because it copies the flags from
the canonical function to the new function.
Assignee | ||
Comment 3•2 months ago
|
||
Assignee | ||
Comment 4•2 months ago
|
||
This is similar to the NewObject
and NewArray
IC stubs. We allocate a new
function object in JIT code and copy the shape and most slots from the canonical
function.
js::Lambda
is one of our hottest VMFunction
s on Speedometer 3 and this gets
rid of most of these calls. On Baseline-only micro-benchmarks this is almost 3x faster.
Assignee | ||
Comment 5•2 months ago
|
||
This improves JetStream's date-format-tofte test by about 8%. This test has a function that uses eval
(so no Ion) and this function has a number of inner functions that we now clone more efficiently.
Speedometer 3 shows some medium/high confidence 1-2% improvements on various subtests on Windows 11. Pretty nice for a change like this.
Updated•2 months ago
|
https://hg.mozilla.org/mozilla-central/rev/3ebb07224094
https://hg.mozilla.org/mozilla-central/rev/21a62d3a0144
https://hg.mozilla.org/mozilla-central/rev/1dbbfc3b5ee2
Comment 8•2 months ago
|
||
11% improvement on Jetstream2-date-format-tofte-SP
Description
•