aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
AgeCommit message (Collapse)Author
2017-06-06implement function inlining (#2053)Alex Lam S.L
- empty body - single `AST_Return` - single `AST_SimpleStatement` - avoid `/*#__PURE__*/` Miscellaneous - enhance single-use function substitution fixes #281
2017-06-04fix `AST_Function` scope invariance (#2052)Alex Lam S.L
improve function name hack in `run_code()`
2017-05-14fix bugs with getter/setter (#1926)Alex Lam S.L
- `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-12remove support for `const` (#1910)Alex Lam S.L
As this is not part of ES5.
2017-05-12avoid `arguments` and `eval` in `reduce_vars` (#1924)Alex Lam S.L
fixes #1922
2017-05-07fix test for #1865 (#1873)Alex Lam S.L
2017-05-06fix `unsafe` on `evaluate` of `reduce_vars` (#1870)Alex Lam S.L
Determine if variables with non-constant values can escape and be modified. fixes #1865
2017-04-30enforce `toplevel` on other compress options (#1855)Alex Lam S.L
Respect "funcs" and "vars" properly. fixes #1850
2017-04-20improve `unused` (#1832)Alex Lam S.L
- extract leading value with side-effects out of `var` statement - reduce scanning of `AST_Definitions` from 3 passes to just once
2017-04-18support safe reassignments in `reduce_vars` (#1823)Alex Lam S.L
`var a=1;a=2;x(a)` => `x(2)` fix pre-existing issues - reference counting on assignment - walking of anonymous functions - chained assignment
2017-04-18fix `reduce_vars` on conditionals (#1822)Alex Lam S.L
2017-04-17fix `reduce_vars` on boolean binary expressions (#1819)Alex Lam S.L
Side effects of `&&` and `||` have not mattered until #1814, which takes assignment expressions into account.
2017-04-17compress duplicated variable definitions (#1817)Alex Lam S.L
These are surprisingly common, as people reuse the same variable name within loops or switch branches.
2017-04-17fix `reduce_vars` within try-block (#1818)Alex Lam S.L
Possible partial execution due to exceptions.
2017-04-17enhance `reduce_vars` (#1814)Alex Lam S.L
- allow immediate assignment after declaration of variable - relax modification rule for immutable value - fix order of visit for TreeWalker - remove extraneous code
2017-04-16fix variable substitution (#1816)Alex Lam S.L
- let `collapse_vars` take care of value containing any symbols - improve overhead accounting
2017-04-07introduce "strict" to `pure_getters` (#1795)Alex Lam S.L
2017-04-07fix `reduce_vars` on catch variable (#1794)Alex Lam S.L
Improved catch handling in `figure_out_scope()` means special case treatment of IE8 is no longer valid in `reset_opt_flags()`. Also fixed recursive assignment in variable definition.
2017-04-07fix incorrect context in variable substitution (#1791)Alex Lam S.L
`AST_Node.optimize()` is context-aware, so don't cache its results to be used elsewhere. Also fixed a few cases of AST corruption and beef up safety of `pure_getters`.
2017-04-02fix corner cases in switch and undefined (#1762)Alex Lam S.L
- fix side effects in switch condition for singular blocks - fix `undefined` confusion with local variable - gate `OPT(AST_Switch)` with `switches` fixes #1758 fixes #1759
2017-03-27handle overlapped variable definitions (#1691)Alex Lam S.L
Process variable definitions with or without assigned values against: - `arguments` - named function arguments - multiple definitions within same scope Essentially demote variable declarations with no value assignments. Also fixed invalid use of `AST_VarDef` over `arguments` - should use a member of `AST_SymbolDeclaration` instead.
2017-03-26fix `delete` related issues in `collapse_vars` and `reduce_vars` (#1689)Alex Lam S.L
2017-03-25fix `reduce_vars` on `AST_Switch` (#1671)Alex Lam S.L
Take conditional nature of switch branches into account. fixes #1670
2017-03-19make `expect_stdout` work on Node.js 0.12 (#1623)Alex Lam S.L
That particular version of Node.js has messed up error messages, so provide a version-specific workaround. Also fixed an formatting issue which would cause `expect_stdout` to fail if error message contains excerpts of input. Apply `expect_stdout` to more applicable tests.
2017-03-16fix `hoist_vars` on `reduce_vars` (#1607)Alex Lam S.L
`hoist_vars` converts variable declarations into plain assignments, which then confuses `reduce_vars` fixes #1606
2017-03-11disallow parameter substitution for named IIFEs (#1596)Alex Lam S.L
Self-referenced function has non-fixed values assigned to its parameters. Let `unused` & `!keep_fnames` do the scanning, then apply `reduce_vars` only to unnamed functions. fixes #1595
2017-03-09fix & improve function argument compression (#1584)Alex Lam S.L
- one-use function call => IIFE should take `eval()` & `arguments` into account - if unused parameter cannot be eliminated, replace it with `0` fixes #1583
2017-03-08fix function name eliminiation (#1576)Alex Lam S.L
Function expression can be assigned to a variable and be given a name. Ensure function name is the reduced variable before clearing it out. fixes #1573 fixes #1575
2017-03-07fix deep cloning of labels (#1565)Alex Lam S.L
`AST_Label.references` get `.initialize()` to `[]` every time after `.clone()` So walk down the tree to pick up the cloned `AST_LoopControl` pieces and put it back together.
2017-03-07transform function calls to IIFEs (#1560)Alex Lam S.L
- expose function body to call sites for potential optimisations - suppress substitution of variable used within `AST_Defun`
2017-03-07avoid substitution of global variables (#1557)Alex Lam S.L
- unless `toplevel` is enabled - global `const` works as before
2017-03-05handle variable declaration within catch blocks (#1546)Alex Lam S.L
accounts for IE8- scoping
2017-03-03properly cover all cases of for-in loop variables (#1536)Alex Lam S.L
2017-03-03fix reference marking in for-in loops (#1535)Alex Lam S.L
fixes #1533
2017-03-02fix corner cases in `reduce_vars` (#1524)Alex Lam S.L
Avoid variable substitution in the following cases: - use of variable before declaration - declaration within conditional code blocks - declaration within loop body fixes #1518 fixes #1525
2017-02-26consolidate `evaluate` & `reduce_vars` (#1505)Alex Lam S.L
- improve marking efficiency - apply smarter `const` replacement to `var` fixes #1501
2017-02-21improve reduce_vars and fix a bugalexlamsl
- update modified flag between compress() passes - support IIFE arguments - fix corner case with multiple definitions closes #1473
2017-01-26optimise binary operands with evaluate() (#1427)Alex Lam S.L
- remove call to evaluate() in is_constant() and let nested optimize() does its job instead - reject RegExp in is_constant() and remove special case logic under collapse_vars - operands to conditionals optimisation are now always evaluate()-ed - throw error in constant_value() instead of returning undefined to catch possible bugs, similar to make_node_from_constant() - optimise binary boolean operators under `evaluate` instead of `conditionals`
2017-01-26augment evaluate to extract within objects (#1425)Alex Lam S.L
- gated by `unsafe` - replaces previous optimisation specific to String.length - "123"[0] => 1 - [1, 2, 3][0] => 1 - [1, 2, 3].length => 3 - does not apply to objects with overridden prototype functions
2016-10-01Optimize unmodified variablesalexlamsl