Alex Lam S.L
07e4b64f3a
fix AST_Scope.clone() ( #2803 )
...
fixes #2799
2018-01-17 21:33:13 +08:00
Alex Lam S.L
e49416e4aa
fix reduce_vars on AST_Accessor ( #2776 )
...
fixes #2774
2018-01-13 02:46:14 +08:00
Alex Lam S.L
cfe3a98ce5
drop unused assignment based on reduce_vars ( #2709 )
2018-01-04 01:03:33 +08:00
Alex Lam S.L
14778e049b
fix reduce_vars on AST_Defun ( #2708 )
2018-01-03 17:18:38 +08:00
Alex Lam S.L
333792352e
reduce hoisting declarations ( #2687 )
2017-12-31 16:15:00 +08:00
Alex Lam S.L
4832bc5d88
replace single-use recursive functions ( #2659 )
...
fixes #2628
2017-12-26 21:25:35 +08:00
Alex Lam S.L
c07ea17c01
fix escape analysis on AST_PropAccess ( #2636 )
2017-12-24 00:36:46 +08:00
Alex Lam S.L
db902af4c6
fix escape analysis on || and && ( #2600 )
...
fixes #2598
2017-12-15 19:48:14 +08:00
Alex Lam S.L
092d9affb8
fix reduce_vars on do...while ( #2596 )
2017-12-15 16:33:19 +08:00
Alex Lam S.L
8f681b1d17
handle inline of function arguments ( #2590 )
...
fixes #2476
2017-12-15 13:28:30 +08:00
Alex Lam S.L
3f18a61532
fix reduce_vars on single AST_Defun reference across loop ( #2593 )
2017-12-14 18:47:05 +08:00
Alex Lam S.L
02a6ce07eb
improve reduce_vars ( #2592 )
...
- account for hoisting nature of `var`
2017-12-14 15:32:13 +08:00
Alex Lam S.L
ef618332ea
fold cascade functionality into collapse_vars ( #2586 )
2017-12-14 01:20:36 +08:00
Alex Lam S.L
bf000beae7
rename tests ( #2575 )
2017-12-11 00:24:54 +08:00
Alex Lam S.L
74a2f53683
fix escape analysis for AST_Throw ( #2564 )
2017-12-08 02:54:37 +08:00
Alex Lam S.L
e20935c3f2
fix escape analysis for AST_Conditional & AST_Sequence ( #2563 )
...
fixes #2560
2017-12-08 01:50:38 +08:00
Alex Lam S.L
09b320e8a5
convert to number under boolean context ( #2545 )
2017-12-01 12:52:36 +08:00
Alex Lam S.L
b762f2d6f4
improve compression of loop conditions ( #2543 )
2017-12-01 05:52:33 +08:00
Alex Lam S.L
18302bf8e9
backport test from #2526 ( #2534 )
2017-11-29 13:32:00 +08:00
Alex Lam S.L
32def5ebf5
improve synergy between collapse_vars & unused ( #2521 )
2017-11-28 14:02:39 +08:00
Alex Lam S.L
ae28a24c7f
fix cross-scope inlining of AST_Functions ( #2486 )
...
fixes #2485
2017-11-16 10:04:30 +08:00
Alex Lam S.L
cda27b0970
extend reduce_funcs to cover cross-scope substitutions ( #2469 )
...
fixes #2468
2017-11-11 15:30:17 +08:00
Alex Lam S.L
3c74047368
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
2017-11-11 05:59:35 +08:00
Alex Lam S.L
94525d859f
fix object literal tracing in reduce_vars ( #2461 )
2017-11-10 05:47:10 +08:00
Alex Lam S.L
1127a2caf3
fix multiple nested function substitutions ( #2458 )
...
fixes #2449
2017-11-09 23:30:00 +08:00
Alex Lam S.L
4c0b0177b6
preserve function identity in reduce_vars ( #2451 )
...
fixes #2450
2017-11-08 03:28:46 +08:00
Alex Lam S.L
bbedbf4ea0
handle circular function reference gracefully ( #2446 )
...
fixes #2442
2017-11-07 02:37:23 +08:00
Alex Lam S.L
2cfb5aa7da
account for eval & with in reduce_vars ( #2441 )
...
fixes #2440
2017-11-06 16:10:57 +08:00
Alex Lam S.L
6c45101870
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
2017-11-06 14:25:10 +08:00
Alex Lam S.L
5b4b07e9a7
extend function inlining safety checks ( #2430 )
2017-11-05 06:18:45 +08:00
Alex Lam S.L
a8aa28a7a6
consolidate single-use function reduction ( #2427 )
...
fixes #2423
2017-11-05 04:27:01 +08:00
Alex Lam S.L
c8b6f4733d
reduce this within functions ( #2421 )
...
- only replace same-scope usages
- augment `test/ufuzz.js` to test for `this`
fixes #2420
2017-11-04 00:31:37 +08:00
Alex Lam S.L
8428326ea1
enhance properties ( #2412 )
...
- trim array items only if `side_effects`
- extend to non-identifier properties
2017-10-29 04:11:26 +08:00
Alex Lam S.L
74ae16f9f8
fix unsafe reduce_vars on arrays & objects ( #2397 )
2017-10-24 22:10:36 +08:00
Alex Lam S.L
86ea38a259
enhance unsafe evaluate of arrays & objects ( #2394 )
2017-10-24 02:58:30 +08:00
Alex Lam S.L
24aa07855b
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
2017-10-22 20:10:13 +08:00
Alex Lam S.L
011123223b
fix unsafe escape analysis in reduce_vars ( #2387 )
2017-10-22 03:23:31 +08:00
Alex Lam S.L
c927cea632
unsafe fix-ups for #2351 ( #2379 )
2017-10-21 04:08:26 +08:00
Alex Lam S.L
eba0f93bc0
more tests for #2351 ( #2357 )
2017-10-12 02:58:25 +08:00
Alex Lam S.L
b810e2f8da
perform reduce_vars on safe literals ( #2351 )
...
- constant expression
- single reference
- same scope
- not across loop body
2017-10-09 12:25:06 +08:00
Alex Lam S.L
dd71639264
enhance reduce_vars for AST_Accessor ( #2339 )
...
fixes #2336
2017-10-01 03:01:50 +08:00
Alex Lam S.L
1ac25fc032
improve compress granularity through typeofs ( #2201 )
...
fixes #2198
2017-07-05 19:20:33 +08:00
Alex Lam S.L
3d5bc08185
fix reduce_vars on this ( #2145 )
...
fixes #2140
2017-06-23 04:44:57 +08:00
Alex Lam S.L
3493a182b2
implement function inlining ( #2053 )
...
- empty body
- single `AST_Return`
- single `AST_SimpleStatement`
- avoid `/*#__PURE__*/`
Miscellaneous
- enhance single-use function substitution
fixes #281
2017-06-06 05:49:53 +08:00
Alex Lam S.L
540220b91b
fix AST_Function scope invariance ( #2052 )
...
improve function name hack in `run_code()`
2017-06-04 19:27:43 +08:00
Alex Lam S.L
3ca902258c
fix bugs with getter/setter ( #1926 )
...
- `reduce_vars`
- `side_effects`
- property access for object
- `AST_SymbolAccessor` as key names
enhance `test/ufuzz.js`
- add object getter & setter
- property assignment to setter
- avoid infinite recursion in setter
- fix & adjust assignment operators
- 50% `=`
- 25% `+=`
- 2.5% each for the rest
- avoid "Invalid array length"
- fix `console.log()`
- bypass getter
- curb recursive reference
- deprecate `-E`, always report runtime errors
2017-05-14 02:10:34 +08:00
Alex Lam S.L
c391576d52
remove support for const ( #1910 )
...
As this is not part of ES5.
2017-05-12 14:57:41 +08:00
Alex Lam S.L
ac73c5d421
avoid arguments and eval in reduce_vars ( #1924 )
...
fixes #1922
2017-05-12 12:34:55 +08:00
Alex Lam S.L
98cf95e5b5
fix test for #1865 ( #1873 )
2017-05-07 02:56:02 +08:00
Alex Lam S.L
2c7ee956fd
fix unsafe on evaluate of reduce_vars ( #1870 )
...
Determine if variables with non-constant values can escape and be modified.
fixes #1865
2017-05-06 23:18:55 +08:00