-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 escape analysis on constant expression properties #2509
Conversation
Any idea about this one? $ echo 'var o = { f: function(x){console.log(x)} }; console.log(o.f);' | bin/uglifyjs --toplevel -mc hoist_props,passes=9
var o={f:function(o){console.log(o)}};console.log(o.f); |
|
Okay, how about this? $ echo 'var o = { f: function(x){console.log(x)} }; o.f(o.f);' | bin/uglifyjs --toplevel -mc hoist_props,passes=9
var f={f:function(f){console.log(f)}};f.f(f.f); |
Exact same cause. |
add tests
#2509 (comment) & #2509 (comment) addressed in 9ddb75c |
Good to see you like a challenge. This PR should bake in the fuzzer for a little bit longer than normal I think. |
I'll get this to 100kFuzz, merge, then leave the whole |
|
So no optimization opportunities in the benchmark code. This PR will be useful in scope hoisting bundler code. |
Do you have a representative example that is publicly available on the web? We can expand |
Not really, just Rollup test cases - and Rollup itself - it's self-hosted. Mind you |
Here's a Rollup source file with exports that ought to benefit once imported, scope hoisted and bundled now that arrows will work with https://github.com/rollup/rollup/blob/v0.51.8/src/ast/values.js Once this PR is merged into harmony I can test that hypothesis on the Rollup ES6 distro bundle. |
Unfortunately upon examining the Rollup source code those particular exports are not used in a manner that will benefit from this optimization. |
fixes #2508