Closed Bug 1801851 Opened 1 year ago Closed 1 year ago

Use ValueUsage::IgnoreValue in short-circuit and void expressions

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
109 Branch
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.

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.

All callers are explicitly passing a ValueUsage argument, so we don't need
the default parameter anymore.

Depends on D162714

void expressions don't use their value, so we can trivially use IgnoreValue.

Depends on D162715

Blocks: sm-frontend
Severity: -- → N/A
Priority: -- → P1
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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: