Emit bytecode to copy aliased arguments to the call object
Categories
(Core :: JavaScript Engine, task, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox113 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
(Whiteboard: [sp3])
Attachments
(4 files)
When we create a call object in the interpreter/Baseline, we loop over the script's argument bindings to see which ones we have to copy to the call object. It's more efficient to have the frontend emit bytecode to do this work. This will also make it easier to inline the object allocation itself in Baseline in the future.
I have a patch stack that improves the micro-benchmark below from 82 ms to 55 ms with --no-ion
.
function foo(a, b, c) {
if (a) {
return () => b + c;
}
return null;
}
function f() {
var t = new Date;
for (var i = 0; i < 1_000_000; i++) {
foo(false, 11, 22);
}
print(new Date - t);
}
f();
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
This is similar to what we do for BindingIter
and ParserBindingIter
.
Assignee | ||
Comment 2•2 years ago
|
||
This will be used in the next patch to copy arguments to the call object in the prologue.
Depends on D174577
Assignee | ||
Comment 3•2 years ago
|
||
Emit bytecode in the prologue to initialize the slots for closed-over arguments, instead
of doing this at runtime.
This is faster in the interpreter and Baseline because we no longer have to look
at the scope's bindings each time we allocate a call object. It also makes it easier
to optimize the CallObject
allocation later.
Depends on D174578
Assignee | ||
Comment 4•2 years ago
|
||
The previous patch removed some MIR instructions from WarpBuilder::buildCallObject
,
because storing aliased arguments to the call object now happens with bytecode
instructions. Unfortunately that means we lost some optimizations baked into
buildCallObject
to elide GC barriers.
This patch adds an optimization pass to optimize the MIR instructions we generate for
the new bytecode sequence in a similar way to what we did manually in buildCallObject
.
In the future we could use this to optimize other allocation instructions as well.
Depends on D174579
Updated•2 years ago
|
Comment 6•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/74799e55594a
https://hg.mozilla.org/mozilla-central/rev/ab307229ef84
https://hg.mozilla.org/mozilla-central/rev/f49c4de7f846
https://hg.mozilla.org/mozilla-central/rev/ee6468bab0dd
Updated•1 year ago
|
Description
•