UglifyJS.git
6 years agofix `reduce_vars` on `do...while` (#2596)
Alex Lam S.L [Fri, 15 Dec 2017 08:33:19 +0000 (16:33 +0800)]
fix `reduce_vars` on `do...while` (#2596)

6 years agohandle `inline` of function arguments (#2590)
Alex Lam S.L [Fri, 15 Dec 2017 05:28:30 +0000 (13:28 +0800)]
handle `inline` of function arguments (#2590)

fixes #2476

6 years agoinline single-use `function` across loop (#2594)
Alex Lam S.L [Thu, 14 Dec 2017 11:24:54 +0000 (19:24 +0800)]
inline single-use `function` across loop (#2594)

6 years agofix `reduce_vars` on single `AST_Defun` reference across loop (#2593)
Alex Lam S.L [Thu, 14 Dec 2017 10:47:05 +0000 (18:47 +0800)]
fix `reduce_vars` on single `AST_Defun` reference across loop (#2593)

6 years agoimprove `reduce_vars` (#2592)
Alex Lam S.L [Thu, 14 Dec 2017 07:32:13 +0000 (15:32 +0800)]
improve `reduce_vars` (#2592)

- account for hoisting nature of `var`

6 years agoimprove `collapse_vars` (#2591)
Alex Lam S.L [Thu, 14 Dec 2017 07:31:35 +0000 (15:31 +0800)]
improve `collapse_vars` (#2591)

- handle single-use assignments other than `AST_VarDef`
- scan `AST_Call` for candidates

6 years agoimprove `dead_code` tests (#2589)
kzc [Thu, 14 Dec 2017 04:12:06 +0000 (23:12 -0500)]
improve `dead_code` tests (#2589)

for #2588

6 years agofix `dead_code` on `return`/`throw` within `try` (#2588)
Alex Lam S.L [Wed, 13 Dec 2017 20:38:21 +0000 (04:38 +0800)]
fix `dead_code` on `return`/`throw` within `try` (#2588)

6 years agodrop local assign-only variable in `return` (#2587)
Alex Lam S.L [Wed, 13 Dec 2017 18:59:59 +0000 (02:59 +0800)]
drop local assign-only variable in `return` (#2587)

6 years agofold `cascade` functionality into `collapse_vars` (#2586)
Alex Lam S.L [Wed, 13 Dec 2017 17:20:36 +0000 (01:20 +0800)]
fold `cascade` functionality into `collapse_vars` (#2586)

6 years agorecover lost opportunities from #2574 (#2584)
Alex Lam S.L [Wed, 13 Dec 2017 10:20:53 +0000 (18:20 +0800)]
recover lost opportunities from #2574 (#2584)

6 years agoimprove `collapse_vars` on side-effect-free replacements (#2583)
Alex Lam S.L [Tue, 12 Dec 2017 20:52:54 +0000 (04:52 +0800)]
improve `collapse_vars` on side-effect-free replacements (#2583)

6 years agominor clean-up for IIFE (#2582)
Alex Lam S.L [Tue, 12 Dec 2017 17:27:26 +0000 (01:27 +0800)]
minor clean-up for IIFE (#2582)

- faster exact type match
- aggressively convert to `!`

6 years agoavoid `Function.prototype` pollution by `test/sandbox.js` (#2581)
Alex Lam S.L [Mon, 11 Dec 2017 21:02:01 +0000 (05:02 +0800)]
avoid `Function.prototype` pollution by `test/sandbox.js` (#2581)

6 years agofix `AST_VarDef.may_throw()` (#2580)
Alex Lam S.L [Mon, 11 Dec 2017 19:30:25 +0000 (03:30 +0800)]
fix `AST_VarDef.may_throw()` (#2580)

6 years agofix `collapse_vars` on `switch` (#2578)
Alex Lam S.L [Mon, 11 Dec 2017 10:11:09 +0000 (18:11 +0800)]
fix `collapse_vars` on `switch` (#2578)

6 years agoremove unused code (#2579)
Alex Lam S.L [Mon, 11 Dec 2017 09:39:08 +0000 (17:39 +0800)]
remove unused code (#2579)

fixes #2577

6 years agoescape consecutive unpaired surrogates (#2576)
Alex Lam S.L [Sun, 10 Dec 2017 17:15:44 +0000 (01:15 +0800)]
escape consecutive unpaired surrogates (#2576)

fixes #2569

6 years agorename tests (#2575)
Alex Lam S.L [Sun, 10 Dec 2017 16:24:54 +0000 (00:24 +0800)]
rename tests (#2575)

6 years agohandle exceptional flow correctly in `collapse_vars` (#2574)
Alex Lam S.L [Sun, 10 Dec 2017 16:16:02 +0000 (00:16 +0800)]
handle exceptional flow correctly in `collapse_vars` (#2574)

fixes #2571

6 years agov3.2.2
Alex Lam S.L [Sun, 10 Dec 2017 05:46:17 +0000 (13:46 +0800)]
v3.2.2

6 years agoimprove `unused` on assign-only symbols (#2568)
Alex Lam S.L [Fri, 8 Dec 2017 22:19:29 +0000 (06:19 +0800)]
improve `unused` on assign-only symbols (#2568)

6 years agofix escape analysis for `AST_Throw` (#2564)
Alex Lam S.L [Thu, 7 Dec 2017 18:54:37 +0000 (02:54 +0800)]
fix escape analysis for `AST_Throw` (#2564)

6 years agofix escape analysis for `AST_Conditional` & `AST_Sequence` (#2563)
Alex Lam S.L [Thu, 7 Dec 2017 17:50:38 +0000 (01:50 +0800)]
fix escape analysis for `AST_Conditional` & `AST_Sequence` (#2563)

fixes #2560

6 years agoaccount for side-effects in conditional call inversion (#2562)
Alex Lam S.L [Thu, 7 Dec 2017 17:15:31 +0000 (01:15 +0800)]
account for side-effects in conditional call inversion (#2562)

fixes #2560

6 years agoeliminate noop calls more aggressively (#2559)
Alex Lam S.L [Wed, 6 Dec 2017 17:22:08 +0000 (01:22 +0800)]
eliminate noop calls more aggressively (#2559)

6 years agoimprove `if_return` (#2558)
Alex Lam S.L [Wed, 6 Dec 2017 17:01:52 +0000 (01:01 +0800)]
improve `if_return` (#2558)

`return void x()` => `x()`

6 years agov3.2.1
Alex Lam S.L [Sun, 3 Dec 2017 03:39:51 +0000 (11:39 +0800)]
v3.2.1

6 years agofix `dead_code` on `for` (#2552)
Alex Lam S.L [Sat, 2 Dec 2017 07:46:05 +0000 (15:46 +0800)]
fix `dead_code` on `for` (#2552)

6 years agomore tests for #2535 (#2551)
Alex Lam S.L [Fri, 1 Dec 2017 18:26:56 +0000 (02:26 +0800)]
more tests for #2535 (#2551)

6 years agoimprove `evaluate` on `typeof` (#2550)
Alex Lam S.L [Fri, 1 Dec 2017 18:18:33 +0000 (02:18 +0800)]
improve `evaluate` on `typeof` (#2550)

- gated through `typeofs`

6 years agoimprove boolean compression (#2548)
Alex Lam S.L [Fri, 1 Dec 2017 14:41:35 +0000 (22:41 +0800)]
improve boolean compression (#2548)

fixes #2535

6 years agoimprove switch case compression (#2547)
Alex Lam S.L [Fri, 1 Dec 2017 06:32:00 +0000 (14:32 +0800)]
improve switch case compression (#2547)

6 years agoimprove `AST_For.init` & `AST_Switch.expression` compression (#2546)
Alex Lam S.L [Fri, 1 Dec 2017 04:53:59 +0000 (12:53 +0800)]
improve `AST_For.init` & `AST_Switch.expression` compression (#2546)

6 years agoconvert to number under boolean context (#2545)
Alex Lam S.L [Fri, 1 Dec 2017 04:52:36 +0000 (12:52 +0800)]
convert to number under boolean context (#2545)

6 years agoimprove compression of `if` conditions (#2544)
Alex Lam S.L [Thu, 30 Nov 2017 22:18:31 +0000 (06:18 +0800)]
improve compression of `if` conditions (#2544)

6 years agoimprove compression of loop conditions (#2543)
Alex Lam S.L [Thu, 30 Nov 2017 21:52:33 +0000 (05:52 +0800)]
improve compression of loop conditions (#2543)

6 years agoimprove code reuse (#2542)
Alex Lam S.L [Thu, 30 Nov 2017 19:40:46 +0000 (03:40 +0800)]
improve code reuse (#2542)

6 years agofix corner case in call binding (#2541)
Alex Lam S.L [Thu, 30 Nov 2017 19:18:20 +0000 (03:18 +0800)]
fix corner case in call binding (#2541)

6 years agobackport test from #2526 (#2534)
Alex Lam S.L [Wed, 29 Nov 2017 05:32:00 +0000 (13:32 +0800)]
backport test from #2526 (#2534)

6 years agofix `inline` on nested substitutions (#2533)
Alex Lam S.L [Wed, 29 Nov 2017 05:31:41 +0000 (13:31 +0800)]
fix `inline` on nested substitutions (#2533)

fixes #2531

6 years agofix nested `hoist_props` substitution (#2523)
Alex Lam S.L [Tue, 28 Nov 2017 06:39:00 +0000 (14:39 +0800)]
fix nested `hoist_props` substitution (#2523)

fixes #2519

6 years agoimprove synergy between `collapse_vars` & `unused` (#2521)
Alex Lam S.L [Tue, 28 Nov 2017 06:02:39 +0000 (14:02 +0800)]
improve synergy between `collapse_vars` & `unused` (#2521)

6 years agodrop assignment in `AST_VarDef.value` (#2522)
Alex Lam S.L [Tue, 28 Nov 2017 05:08:40 +0000 (13:08 +0800)]
drop assignment in `AST_VarDef.value` (#2522)

fixes #2516

6 years agov3.2.0
Alex Lam S.L [Sat, 25 Nov 2017 20:08:35 +0000 (04:08 +0800)]
v3.2.0

6 years agofix argument/atom collision by `properties` (#2514)
Alex Lam S.L [Sat, 25 Nov 2017 14:52:46 +0000 (22:52 +0800)]
fix argument/atom collision by `properties` (#2514)

fixes #2513

6 years agofix wording and formatting (#2512)
Alex Lam S.L [Sat, 25 Nov 2017 11:07:46 +0000 (19:07 +0800)]
fix wording and formatting (#2512)

6 years agoextend escape analysis on constant expression properties (#2509)
Alex Lam S.L [Fri, 24 Nov 2017 06:07:39 +0000 (14:07 +0800)]
extend escape analysis on constant expression properties (#2509)

fixes #2508

6 years agofix argument/atom collision by `collapse_vars` (#2507)
Alex Lam S.L [Thu, 23 Nov 2017 23:26:22 +0000 (07:26 +0800)]
fix argument/atom collision by `collapse_vars` (#2507)

fixes #2506

6 years agomake `AST_Lambda.contains_this()` less magical (#2505)
Alex Lam S.L [Thu, 23 Nov 2017 23:03:37 +0000 (07:03 +0800)]
make `AST_Lambda.contains_this()` less magical (#2505)

6 years agoeliminate invalid state caching in `collapse_vars` (#2502)
Alex Lam S.L [Thu, 23 Nov 2017 20:12:37 +0000 (04:12 +0800)]
eliminate invalid state caching in `collapse_vars` (#2502)

fixes #2497

6 years agofix `rename` (#2501)
Alex Lam S.L [Thu, 23 Nov 2017 19:05:43 +0000 (03:05 +0800)]
fix `rename` (#2501)

- suppress spurious `rename` from `commander`
- handle `AST_SymbolCatch` correctly

6 years agoexpand symbol space to improve compression (#2460)
Alex Lam S.L [Sun, 19 Nov 2017 11:29:51 +0000 (19:29 +0800)]
expand symbol space to improve compression (#2460)

- give globally distinct names to distinct variables
- improve ability to compress cross-scoped
- introduce `options.rename` to `minify()`
- default `true` if both `compress` & `mangle`

6 years agoenable `hoist_props` by default (#2492)
Alex Lam S.L [Sun, 19 Nov 2017 06:56:23 +0000 (14:56 +0800)]
enable `hoist_props` by default (#2492)

6 years agov3.1.10
Alex Lam S.L [Sat, 18 Nov 2017 15:56:33 +0000 (23:56 +0800)]
v3.1.10

6 years agodocument the `webkit` output option (#2490)
kzc [Fri, 17 Nov 2017 05:46:49 +0000 (00:46 -0500)]
document the `webkit` output option (#2490)

- workaround for WebKit bugs
- PhantomJS users should enable this output option

closes #2489

6 years agofix cross-scope inlining of `AST_Function`s (#2486)
Alex Lam S.L [Thu, 16 Nov 2017 02:04:30 +0000 (10:04 +0800)]
fix cross-scope inlining of `AST_Function`s (#2486)

fixes #2485

6 years agominor consolidations (#2484)
Alex Lam S.L [Wed, 15 Nov 2017 20:37:37 +0000 (04:37 +0800)]
minor consolidations (#2484)

- unique symbol generation
- `unsafe` on `AST_Call`

6 years agoUpdate ISSUE_TEMPLATE.md (#2481)
kzc [Tue, 14 Nov 2017 22:00:51 +0000 (17:00 -0500)]
Update ISSUE_TEMPLATE.md (#2481)

6 years agoupdate documentation for `reduce_funcs` (#2478)
kzc [Tue, 14 Nov 2017 08:03:25 +0000 (03:03 -0500)]
update documentation for `reduce_funcs` (#2478)

6 years agofix replacement logic in `collapse_vars` (#2475)
Alex Lam S.L [Sun, 12 Nov 2017 23:37:42 +0000 (07:37 +0800)]
fix replacement logic in `collapse_vars` (#2475)

6 years agofix `top_retain` on `hoist_props` (#2474)
Alex Lam S.L [Sun, 12 Nov 2017 16:59:41 +0000 (00:59 +0800)]
fix `top_retain` on `hoist_props` (#2474)

fixes #2473

6 years agoallow symbol replacement on multiple occurrences (#2472)
Alex Lam S.L [Sun, 12 Nov 2017 14:31:47 +0000 (22:31 +0800)]
allow symbol replacement on multiple occurrences (#2472)

- all-or-nothing replacement
- avoid unmangleable names

fixes #2436

6 years agov3.1.9
Alex Lam S.L [Sat, 11 Nov 2017 07:31:13 +0000 (15:31 +0800)]
v3.1.9

6 years agoextend `reduce_funcs` to cover cross-scope substitutions (#2469)
Alex Lam S.L [Sat, 11 Nov 2017 07:30:17 +0000 (15:30 +0800)]
extend `reduce_funcs` to cover cross-scope substitutions (#2469)

fixes #2468

6 years agoimplement compress option `reduce_funcs` (#2466)
Alex Lam S.L [Fri, 10 Nov 2017 21:59:35 +0000 (05:59 +0800)]
implement compress option `reduce_funcs` (#2466)

- inline single-use function declarations as expressions when permissible
- depend on `reduce_vars`
- enabled by default
- disable for speed critical code

fixes #2464

6 years agofix object literal tracing in `reduce_vars` (#2461)
Alex Lam S.L [Thu, 9 Nov 2017 21:47:10 +0000 (05:47 +0800)]
fix object literal tracing in `reduce_vars` (#2461)

6 years agofix multiple nested function substitutions (#2458)
Alex Lam S.L [Thu, 9 Nov 2017 15:30:00 +0000 (23:30 +0800)]
fix multiple nested function substitutions (#2458)

fixes #2449

6 years agoremove hack in `collapse_vars` (#2457)
Alex Lam S.L [Thu, 9 Nov 2017 12:00:58 +0000 (20:00 +0800)]
remove hack in `collapse_vars` (#2457)

fixes #2456

6 years agopreserve function identity in `reduce_vars` (#2451)
Alex Lam S.L [Tue, 7 Nov 2017 19:28:46 +0000 (03:28 +0800)]
preserve function identity in `reduce_vars` (#2451)

fixes #2450

6 years agov3.1.8
Alex Lam S.L [Mon, 6 Nov 2017 19:55:16 +0000 (03:55 +0800)]
v3.1.8

6 years agohandle circular `function` reference gracefully (#2446)
Alex Lam S.L [Mon, 6 Nov 2017 18:37:23 +0000 (02:37 +0800)]
handle circular `function` reference gracefully (#2446)

fixes #2442

6 years agoaccount for `eval` & `with` in `reduce_vars` (#2441)
Alex Lam S.L [Mon, 6 Nov 2017 08:10:57 +0000 (16:10 +0800)]
account for `eval` & `with` in `reduce_vars` (#2441)

fixes #2440

6 years agoconsolidate & enhance `unused` (#2439)
Alex Lam S.L [Mon, 6 Nov 2017 06:25:10 +0000 (14:25 +0800)]
consolidate & enhance `unused` (#2439)

- defer declaration removal in `collapse_vars`
- account for `AST_SymbolFunarg` in deduplication
- private accounting for `collapse_vars`
- avoid issues with identity reference due to deep cloning

fixes #2437

6 years agoinline single-use functions that are not constant expressions (#2434)
Alex Lam S.L [Sun, 5 Nov 2017 14:14:11 +0000 (22:14 +0800)]
inline single-use functions that are not constant expressions (#2434)

fixes #2428

6 years agov3.1.7
Alex Lam S.L [Sun, 5 Nov 2017 07:03:19 +0000 (15:03 +0800)]
v3.1.7

6 years agotweak #2424 (#2432)
Alex Lam S.L [Sun, 5 Nov 2017 04:49:14 +0000 (12:49 +0800)]
tweak #2424 (#2432)

6 years agoextend function inlining safety checks (#2430)
Alex Lam S.L [Sat, 4 Nov 2017 22:18:45 +0000 (06:18 +0800)]
extend function inlining safety checks (#2430)

6 years agoconsolidate single-use `function` reduction (#2427)
Alex Lam S.L [Sat, 4 Nov 2017 20:27:01 +0000 (04:27 +0800)]
consolidate single-use `function` reduction (#2427)

fixes #2423

6 years agomaintain call argument order in `collapse_vars` (#2426)
Alex Lam S.L [Sat, 4 Nov 2017 16:00:18 +0000 (00:00 +0800)]
maintain call argument order in `collapse_vars` (#2426)

fixes #2425

6 years agoimprove variations on call arguments for `ufuzz` (#2424)
Alex Lam S.L [Sat, 4 Nov 2017 08:29:42 +0000 (16:29 +0800)]
improve variations on call arguments for `ufuzz` (#2424)

6 years agoreduce `this` within functions (#2421)
Alex Lam S.L [Fri, 3 Nov 2017 16:31:37 +0000 (00:31 +0800)]
reduce `this` within functions (#2421)

- only replace same-scope usages
- augment `test/ufuzz.js` to test for `this`

fixes #2420

6 years agocompress `new` `function` containing `this` (#2417)
Alex Lam S.L [Mon, 30 Oct 2017 15:19:27 +0000 (23:19 +0800)]
compress `new` `function` containing `this` (#2417)

6 years agov3.1.6
Alex Lam S.L [Sun, 29 Oct 2017 04:38:10 +0000 (12:38 +0800)]
v3.1.6

6 years agoenhance `properties` (#2412)
Alex Lam S.L [Sat, 28 Oct 2017 20:11:26 +0000 (04:11 +0800)]
enhance `properties` (#2412)

- trim array items only if `side_effects`
- extend to non-identifier properties

6 years agoremove dead code (#2405)
Alex Lam S.L [Fri, 27 Oct 2017 06:28:09 +0000 (14:28 +0800)]
remove dead code (#2405)

6 years agofix `reduce_vars` on `AST_Array.length` (#2404)
Alex Lam S.L [Thu, 26 Oct 2017 18:33:37 +0000 (02:33 +0800)]
fix `reduce_vars` on `AST_Array.length` (#2404)

6 years agocompress self comparisons (#2398)
Alex Lam S.L [Wed, 25 Oct 2017 17:16:12 +0000 (01:16 +0800)]
compress self comparisons (#2398)

6 years agodocument compress option `hoist_props` (#2399)
kzc [Wed, 25 Oct 2017 06:03:43 +0000 (02:03 -0400)]
document compress option `hoist_props` (#2399)

6 years agoimplement `hoist_props` (#2396)
Alex Lam S.L [Tue, 24 Oct 2017 19:38:11 +0000 (03:38 +0800)]
implement `hoist_props` (#2396)

fixes #2377

6 years agofix `unsafe` `reduce_vars` on arrays & objects (#2397)
Alex Lam S.L [Tue, 24 Oct 2017 14:10:36 +0000 (22:10 +0800)]
fix `unsafe` `reduce_vars` on arrays & objects (#2397)

6 years agodocs: Fix spelling and style (#2395)
Tom MacWright [Mon, 23 Oct 2017 20:53:56 +0000 (13:53 -0700)]
docs: Fix spelling and style (#2395)

6 years agoenhance `unsafe` `evaluate` of arrays & objects (#2394)
Alex Lam S.L [Mon, 23 Oct 2017 18:58:30 +0000 (02:58 +0800)]
enhance `unsafe` `evaluate` of arrays & objects (#2394)

6 years agodeduplicate declarations regardless of `toplevel` (#2393)
Alex Lam S.L [Sun, 22 Oct 2017 17:00:50 +0000 (01:00 +0800)]
deduplicate declarations regardless of `toplevel` (#2393)

6 years agosafer `properties` transform (#2391)
Alex Lam S.L [Sun, 22 Oct 2017 12:10:13 +0000 (20:10 +0800)]
safer `properties` transform (#2391)

`{ a: x, b: y }.a` => `[ x, y ][0]`
- `x` cannot be function containing `this`

`[ x, y, z ][1]` => `(x, z, y)`
- only if `z` is side-effect-free

6 years agofix `unsafe` expansion of object literals (#2390)
Alex Lam S.L [Sun, 22 Oct 2017 07:00:36 +0000 (15:00 +0800)]
fix `unsafe` expansion of object literals (#2390)

6 years agofix `unsafe` evaluation of `AST_Sub` (#2389)
Alex Lam S.L [Sun, 22 Oct 2017 05:14:15 +0000 (13:14 +0800)]
fix `unsafe` evaluation of `AST_Sub` (#2389)

6 years agofix `unsafe` evaluation of objects (#2388)
Alex Lam S.L [Sat, 21 Oct 2017 20:19:40 +0000 (04:19 +0800)]
fix `unsafe` evaluation of objects (#2388)

6 years agofix `unsafe` escape analysis in `reduce_vars` (#2387)
Alex Lam S.L [Sat, 21 Oct 2017 19:23:31 +0000 (03:23 +0800)]
fix `unsafe` escape analysis in `reduce_vars` (#2387)

6 years agov3.1.5
Alex Lam S.L [Sat, 21 Oct 2017 16:27:26 +0000 (00:27 +0800)]
v3.1.5