Bug 289134
Summary: | [JSC] Emit logical op children in condition context when overall result is ignored | ||
---|---|---|---|
Product: | WebKit | Reporter: | David Degazio <d_degazio> |
Component: | JavaScriptCore | Assignee: | David Degazio <d_degazio> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
David Degazio
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/146174665>
David Degazio
Pull request: https://github.com/WebKit/WebKit/pull/41962
EWS
Committed 291740@main (eeecca442eb0): <https://commits.webkit.org/291740@main>
Reviewed commits have been landed. Closing PR #41962 and removing active labels.