Callee guard for self-hosted lambda functions can cause unnecessary guard failures and bailouts/recompiles
Categories
(Core :: JavaScript Engine: JIT, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox120 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
(Whiteboard: [sp3])
Attachments
(2 files)
Bug 1858679 part 1 - Fix perf issue in IRGenerator::emitCalleeGuard for self-hosted lambdas. r?iain!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
In IRGenerator::emitCalleeGuard
, we currently always emit GuardSpecificFunction
for self-hosted builtins. This is the right thing in most cases, but not for self-hosted lambda functions such as the one returned by ArraySortCompare
, because we'll attach a new Baseline IC stub for each clone and this can cause unnecessary bailouts and recompiles.
Assignee | ||
Comment 1•9 months ago
|
||
Below is a simple example where we do 24 Warp compilations (according to IONFLAGS=scripts
). Fixing this reduces it to 14.
function f() {
var a = [];
for (var i = 0; i < 2000; i++) {
a.push({x: i});
}
for (var i = 0; i < 10; i++) {
a.sort((a, b) => a.x - b.x);
}
}
f();
Assignee | ||
Updated•9 months ago
|
Updated•9 months ago
|
Assignee | ||
Comment 2•9 months ago
|
||
We were always emitting GuardSpecificFunction
for self-hosted functions, but this
doesn't work well for self-hosted lambda functions because there we have lambda clones
and we want to guard on the script instead.
Lambdas aren't very common in self-hosted code, but ArraySortCompare
returns a lambda
function and that's where it was causing unnecessary bailouts and recompilations.
Assignee | ||
Comment 3•9 months ago
|
||
The perf comparison below shows some medium-confidence 3-5% improvements on various Speedometer 3 subtests. I'm not sure how accurate this is, but I do expect this to get rid of some bailouts and compilations.
Updated•9 months ago
|
Assignee | ||
Comment 4•9 months ago
|
||
Searchfox suggested the code to handle self-hosted lazy functions is dead and
this is indeed no longer used to clone lazy self-hosted functions.
Depends on D190821
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d3a7286b836d part 1 - Fix perf issue in IRGenerator::emitCalleeGuard for self-hosted lambdas. r=iain https://hg.mozilla.org/integration/autoland/rev/810153993fc0 part 2 - Remove dead code from CloneFunctionReuseScript. r=iain
Comment 6•9 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d3a7286b836d
https://hg.mozilla.org/mozilla-central/rev/810153993fc0
Description
•