aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
AgeCommit message (Expand)Author
2017-02-21improve keep_fargs & keep_fnames...- utilise in_use_ids instead of unreferenced() - drop_unused now up-to-date for subsequent passes closes #1476 alexlamsl
2017-02-21smarter const replacement taking name length into account...closes #1459 kzc
2017-02-21clean up `negate_iife`...- remove extra tree scanning phase for `negate_iife` - `negate_iife` now only deals with the narrowest form, i.e. IIFE sitting directly under `AST_SimpleStatement` - `booleans`, `conditionals` etc. will now take care the rest via more accurate accounting - `a(); void b();` => `a(); b();` fixes #1288 closes #1451 alexlamsl
2017-02-21improve string concatenation...shuffle associative operations to minimise parentheses and aid other uglification efforts closes #1454 alexlamsl
2017-02-21`-c sequences=N` suboptimal at N expression cutoff...N = 2: a; b; c; d; was: a, b; c; d; now: a, b; c, d; fixes #1455 closes #1457 alexlamsl
2017-02-21tweak do-while loops...- `do{...}while(false)` => `{...}` - clean up `AST_While` logic closes #1452 alexlamsl
2017-02-21fixes & improvements to [].join()...fixes - [a].join() => "" + a - ["a", , "b"].join() => "a,,b" - ["a", null, "b"].join() => "a,,b" - ["a", undefined, "b"].join() => "a,,b" improvements - ["a", "b"].join(null) => "anullb" - ["a", "b"].join(undefined) => "a,b" - [a + "b", c].join("") => a + "b" + c closes #1453 alexlamsl
2017-02-21drop unused: toplevel, assign-only...- assign statement does not count towards variable usage by default - only works with assignments on the same scope level as declaration - can be disabled with `unused` set to "keep_assign" - `toplevel` to drop unused top-level variables and/or functions - `top_retain` to whitelist top-level exceptions closes #1450 alexlamsl
2017-02-21fix stray else in compress with conditionals=false...closes #1449 kzc
2017-02-18enable typeof "undefined" for general use...move out of unsafe, guard corner case with screw_id8 instead closes #1446 alexlamsl
2017-02-18fix crash in unsafe replacement of undefined...remove extraneous call to AST_SymbolRef.reference() closes #1443 alexlamsl
2017-02-18Improve optimizing `function() { if(c){return foo} bar();}`...closes #1437 Anthony Van de Gejuchte
2017-01-26optimise binary operands with evaluate() (#1427)...- 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`Alex Lam S.L
2017-01-26augment evaluate to extract within objects (#1425)...- 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 functionsAlex Lam S.L
2017-01-19add missing LHS cases which global_defs should avoidalexlamsl
2016-11-29Do not overwrite options.comments + cleanupAnthony Van de Gejuchte
2016-10-06Fix (typeof side_effect()) in boolean context...Fixes #1289 with suggestion by @rvanvelzen kzc
2016-10-01Optimize unmodified variablesalexlamsl
2016-09-01Account for side effects in `string + expr` optimizationkzc
2016-08-30implement optimization: (x = 2 * x) ---> (x *= 2)kzc
2016-08-17Fix negate_iife transform to return a correct tree for nested IIFEs...Fix for #1256, partially reverts d854523783b4 Richard van Velzen
2016-07-15Keep const in own scope while compressing...- Fixes #1205 - Fix provided by @kzc Anthony Van de Gejuchte
2016-07-01Change the default sequences limit to 200 to speed up compress....Has little or no impact on minification size in the majority of cases but can speed up rollup builds significantly. This sequences change also has the beneficial side effect of avoiding "stack size exceeded" errors on very large input files. The user is free to alter the sequences limit if they are so inclined. The previous sequences limit was 2000. 20 is often sufficient. kzc
2016-07-01Allow sequences maximum length to be user configurable.kzc
2016-06-30Enable --screw-ie8 by default....catch identifier is mangled correctly for ES5 standards-compliant JS engines by default. Unconditionally use the ie8 if/do-while workaround whether or not --screw-ie8 is enabled. To support non-standard ie8 javascript use: uglifyjs --support-ie8 kzc
2016-06-30Fix spidermonkey AST (ESTree) export and import, Array holes...Fixes: #1156 #1161 Also add test to exercise Uglify after spidermonkey export/import of itself. kzc
2016-06-21Fix conditional expressions of form (x ? -1 : -1)...Fixes #1154, #1153 kzc
2016-06-21Don't replace undefined, NaN and Infinity within with scopekzc
2016-06-15Fix test262 failures related to <, <=, in and instanceof...Fixed-by: @kzc Anthony Van de Gejuchte
2016-06-12Don't drop unused if scope uses with statement...Fix provided by @kzc Anthony Van de Gejuchte
2016-05-27collapse_vars: Do not consider RegExp literals to be constants...Fixes #1100 kzc
2016-05-24Optimize if_return for single if/return cases....Fixes #1089 kzc
2016-05-24Completely allow evaluating -0Richard van Velzen
2016-05-17Never produce -0 when evaluating expressions (like -"")...Fix for #1085. The major case was already there, but more expressions can result in -0. Richard van Velzen
2016-05-15Simplify iife `new` fix...as suggested by @rvanvelzen. Added a test for IIFEs in nested contexts. kzc
2016-05-09Do not apply negate_iife optimization to `new` expressionkzc
2016-04-23Hoist functions when reversing if (x) return; ... vs. if (!x) ......Fixes #1052 Richard van Velzen
2016-04-19Add `passes` compress option. Fix duplicate compress warnings.kzc
2016-04-13Prevent endless recursion when evaluating self-referencing consts...Fix #1041 Richard van Velzen
2016-04-12Actually limit sequence length....Fix #1038 Mihai Bazon
2016-04-11Fix warnings for referenced non-hoisted functions....Fixes #1034 Also added `expect_warnings` functionality to test framework. kzc
2016-04-07Avoid using inherited hasOwnProperty...Fix #1031 Mihai Bazon
2016-04-02Optimize ternaries with boolean consequent or alternative....Fixes #511 kzc
2016-03-28Speedup `unused` compress option for already minified code...Fixes: #321 #917 #1022 kzc
2016-02-22boolean_expression ? true : false --> boolean_expressionkzc
2016-02-21Take operator || precendence into account for AST_If optimization....Fixes #979. kzc
2016-02-17preserve ThisBinding for side_effectsalexlamsl
2016-02-16Don't compress (0, eval)() to eval()Richard van Velzen
2016-02-16Preserve ThisBinding in conditionals & collapse_vars...Fixes #973 alexlamsl
2016-01-29collapse_vars: avoid replacement across AST_Case nodes to be on safe side eve...kzc