New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extend fuzzy RHS folding #3006
extend fuzzy RHS folding #3006
Conversation
Will this de-opt some code if the Or can this form:
get to this form:
with or without |
I have yet to observe lost opportunities like that with the samples I'm testing, but theoretically Shouldn't be too hard to make it happen in a separate PR. |
Optimal code for this transform is dependent on the order of optimizations. Does default minify show an improvement generally? |
For if (isArray(objValue)) {
newValue = objValue;
}
else if (isArrayLikeObject(objValue)) {
newValue = copyArray(objValue);
}
else if (isBuff) {
isCommon = false;
newValue = cloneBuffer(srcValue, true);
}
else if (isTyped) {
isCommon = false;
newValue = cloneTypedArray(srcValue, true);
}
else {
newValue = [];
} whereby the folding of |
That would be a good test for this PR. |
- `a = []; if (1) x();` => `if (a = []) x();`
05f9e81
to
069081d
Compare
Done in https://github.com/mishoo/UglifyJS2/pull/3006/files#diff-37dcf1d17b8a2b3c980e12edef17fdc8R5036 |
a = []; if (1) x();
➡️if (a = []) x();