RESOLVED FIXED 289134
[JSC] Emit logical op children in condition context when overall result is ignored
https://bugs.webkit.org/show_bug.cgi?id=289134
Summary [JSC] Emit logical op children in condition context when overall result is ig...
David Degazio
Reported 2025-03-04 17:26:25 PST
It's a decently common pattern to use logical operators to sequence expressions conditionally, especially in minified code, i.e. foo !== null && print(foo) It's not uncommon for these expressions to be used in contexts where the results are simply ignored either - while patterns like using || for coalescing rely on returning a specific value, some of these sequences only exist to guard effectful operations, and their return value is discarded via the comma operator or because it's used as an expression statement or something like that. In these cases, we only care about the evaluations of the subexpressions as they pertain to whether we take conditional branches, we don't care about their actual values. So we should generate them in a condition context instead of a value context. This should avoid certain pessimizations (namely killing branch/condition fusion) we currently encounter when compiling these expressions.
Attachments
Radar WebKit Bug Importer
Comment 1 2025-03-04 17:26:34 PST
David Degazio
Comment 2 2025-03-05 17:18:53 PST
EWS
Comment 3 2025-03-06 15:26:21 PST
Committed 291740@main (eeecca442eb0): <https://commits.webkit.org/291740@main> Reviewed commits have been landed. Closing PR #41962 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.