Use ValueUsage::IgnoreValue in short-circuit and void expressions
Categories
(Core :: JavaScript Engine, enhancement, P1)
Tracking
()
Tracking | Status | |
---|---|---|
firefox109 | --- | fixed |
People
(Reporter: anba, Assigned: anba)
References
(Blocks 1 open bug)
Details
Attachments
(3 files)
This allows to use JSOp::CallIgnoresRv
for code like c && f()
, which is common in minified code.
Assignee | ||
Comment 1•1 year ago
|
||
Pass ValueUsage
to the last expression in a short-circuit expression sequence
to allow emitting CallIgnoresRv
in minified code.
Minifiers often rewrite this code:
if (c) f();
Into the equivalent expression:
c && f();
The last expression's value is never used, so we can optimise it to use
JSOp::CallIgnoresRv
instead of JSOp::Call
.
Assignee | ||
Comment 2•1 year ago
|
||
All callers are explicitly passing a ValueUsage
argument, so we don't need
the default parameter anymore.
Depends on D162714
Assignee | ||
Comment 3•1 year ago
|
||
void
expressions don't use their value, so we can trivially use IgnoreValue
.
Depends on D162715
Updated•1 year ago
|
Pushed by andre.bargull@gmail.com: https://hg.mozilla.org/integration/autoland/rev/cc76bba0db29 Part 1: Pass ValueUsage to short-circuit expressions. r=arai https://hg.mozilla.org/integration/autoland/rev/b0321dddbda0 Part 2: Remove unnecessary ValueUsage default parameters. r=arai https://hg.mozilla.org/integration/autoland/rev/240da2ef1c8f Part 3: Use IgnoreValue for void expressions. r=arai
Comment 5•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/cc76bba0db29
https://hg.mozilla.org/mozilla-central/rev/b0321dddbda0
https://hg.mozilla.org/mozilla-central/rev/240da2ef1c8f
Description
•