[Pkg-javascript-commits] [uglifyjs] 272/491: implement compress option `reduce_funcs` (#2466)
Jonas Smedegaard
dr at jones.dk
Wed Feb 14 19:51:43 UTC 2018
This is an automated email from the git hooks/post-receive script.
js pushed a commit to annotated tag debian/3.3.10-1
in repository uglifyjs.
commit 3c740473686178c242f66d3ad330e1b047335b5f
Author: Alex Lam S.L <alexlamsl at gmail.com>
Date: Sat Nov 11 05:59:35 2017 +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
---
README.md | 5 +
lib/compress.js | 2 +
test/compress/arrays.js | 4 +
test/compress/collapse_vars.js | 42 +++++---
test/compress/comparing.js | 1 +
test/compress/dead-code.js | 2 +
test/compress/drop-unused.js | 5 +
test/compress/evaluate.js | 11 +++
test/compress/functions.js | 8 ++
test/compress/hoist_props.js | 14 +++
test/compress/issue-1041.js | 2 +
test/compress/issue-1609.js | 2 +
test/compress/issue-1656.js | 1 +
test/compress/issue-1673.js | 5 +
test/compress/issue-1787.js | 1 +
test/compress/issue-1833.js | 4 +
test/compress/issue-281.js | 5 +
test/compress/properties.js | 3 +
test/compress/pure_getters.js | 12 +++
test/compress/reduce_vars.js | 215 +++++++++++++++++++++++++++++++++++++++++
test/compress/screw-ie8.js | 1 +
test/compress/switch.js | 1 +
22 files changed, 335 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
index 0d1e236..22831b1 100644
--- a/README.md
+++ b/README.md
@@ -689,6 +689,11 @@ If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.u
Specify `"strict"` to treat `foo.bar` as side-effect-free only when
`foo` is certain to not throw, i.e. not `null` or `undefined`.
+- `reduce_funcs` (default: `true`) -- Allows single-use functions
+ to be inlined as function expressions when permissible.
+ Enabled by default. Option depends on `reduce_vars` being enabled.
+ For speed critical code this option should be disabled.
+
- `reduce_vars` (default: `true`) -- Improve optimization on variables assigned with and
used as constant values.
diff --git a/lib/compress.js b/lib/compress.js
index 24c5be2..2b38ed4 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -75,6 +75,7 @@ function Compressor(options, false_by_default) {
properties : !false_by_default,
pure_getters : !false_by_default && "strict",
pure_funcs : null,
+ reduce_funcs : !false_by_default,
reduce_vars : !false_by_default,
sequences : !false_by_default,
side_effects : !false_by_default,
@@ -4255,6 +4256,7 @@ merge(Compressor.prototype, {
var fixed = self.fixed_value();
if (fixed instanceof AST_Defun) {
d.fixed = fixed = make_node(AST_Function, fixed, fixed);
+ if (!compressor.option("reduce_funcs")) d.single_use = false;
}
if (d.single_use && fixed instanceof AST_Function) {
if (d.escaped && d.scope !== self.scope || recursive_ref(compressor, d)) {
diff --git a/test/compress/arrays.js b/test/compress/arrays.js
index 2740090..68f08f7 100644
--- a/test/compress/arrays.js
+++ b/test/compress/arrays.js
@@ -129,6 +129,7 @@ constant_join_3: {
for_loop: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
unused: true,
@@ -185,6 +186,7 @@ for_loop: {
index: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -203,6 +205,7 @@ index: {
length: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -221,6 +224,7 @@ length: {
index_length: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 3448971..d98dca9 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -2,7 +2,8 @@ collapse_vars_side_effects_1: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1() {
@@ -150,7 +151,8 @@ collapse_vars_issue_721: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
define(["require", "exports", 'handlebars'], function (require, exports, hb) {
@@ -216,7 +218,8 @@ collapse_vars_properties: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1(obj) {
@@ -243,7 +246,8 @@ collapse_vars_if: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1() {
@@ -293,7 +297,8 @@ collapse_vars_while: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:false, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1(y) {
@@ -712,7 +717,8 @@ collapse_vars_misc1: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f0(o, a, h) {
@@ -789,7 +795,8 @@ collapse_vars_repeated: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1() {
@@ -831,7 +838,8 @@ collapse_vars_closures: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function constant_vars_can_be_replaced_in_any_scope() {
@@ -921,7 +929,8 @@ collapse_vars_try: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1() {
@@ -1118,7 +1127,8 @@ collapse_vars_constants: {
options = {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
- keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true, reduce_vars:true
+ keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
+ reduce_funcs: true, reduce_vars:true
}
input: {
function f1(x) {
@@ -1156,7 +1166,7 @@ collapse_vars_arguments: {
collapse_vars:true, sequences:true, properties:true, dead_code:true, conditionals:true,
comparisons:true, evaluate:true, booleans:true, loops:true, unused:true, hoist_funs:true,
keep_fargs:true, if_return:true, join_vars:true, cascade:true, side_effects:true,
- toplevel:true, reduce_vars:true
+ toplevel:true, reduce_funcs: true, reduce_vars:true
}
input: {
var outer = function() {
@@ -1280,6 +1290,7 @@ collapse_vars_regexp: {
hoist_funs: true,
keep_fargs: true,
loops: false,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -1355,6 +1366,7 @@ issue_1562: {
options = {
collapse_vars: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -1611,6 +1623,7 @@ var_side_effects_3: {
reduce_vars_assign: {
options = {
collapse_vars: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1633,6 +1646,7 @@ reduce_vars_assign: {
iife_1: {
options = {
collapse_vars: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -1653,6 +1667,7 @@ iife_1: {
iife_2: {
options = {
collapse_vars: true,
+ reduce_funcs: false,
reduce_vars: false,
toplevel: true,
unused: false,
@@ -2105,6 +2120,7 @@ unused_orig: {
options = {
collapse_vars: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2143,6 +2159,7 @@ issue_315: {
collapse_vars: true,
evaluate: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
unused: true,
@@ -2369,6 +2386,7 @@ duplicate_argname: {
issue_2298: {
options = {
collapse_vars: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2734,6 +2752,7 @@ issue_2364_5: {
evaluate: true,
pure_getters: true,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3037,6 +3056,7 @@ issue_2437: {
inline: true,
join_vars: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
sequences: true,
diff --git a/test/compress/comparing.js b/test/compress/comparing.js
index 11804cb..e374b58 100644
--- a/test/compress/comparing.js
+++ b/test/compress/comparing.js
@@ -96,6 +96,7 @@ self_comparison_1: {
self_comparison_2: {
options = {
comparisons: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
}
diff --git a/test/compress/dead-code.js b/test/compress/dead-code.js
index e763056..9e7f489 100644
--- a/test/compress/dead-code.js
+++ b/test/compress/dead-code.js
@@ -292,6 +292,7 @@ global_timeout_and_interval_symbols: {
issue_2233_2: {
options = {
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unsafe: true,
@@ -323,6 +324,7 @@ issue_2233_2: {
issue_2233_3: {
options = {
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index ebb0b8f..33241d6 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -673,6 +673,7 @@ issue_1539: {
vardef_value: {
options = {
keep_fnames: false,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -734,6 +735,7 @@ assign_chain: {
issue_1583: {
options = {
keep_fargs: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1080,6 +1082,7 @@ var_catch_toplevel: {
options = {
conditionals: true,
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -1114,6 +1117,7 @@ issue_2105_1: {
collapse_vars: true,
inline: true,
passes: 3,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -1156,6 +1160,7 @@ issue_2105_2: {
passes: 3,
properties: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unsafe: true,
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 64728c0..04b15a8 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -251,6 +251,7 @@ unsafe_constant: {
unsafe_object: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -279,6 +280,7 @@ unsafe_object: {
unsafe_object_nested: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -307,6 +309,7 @@ unsafe_object_nested: {
unsafe_object_complex: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -335,6 +338,7 @@ unsafe_object_complex: {
unsafe_object_repeated: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -363,6 +367,7 @@ unsafe_object_repeated: {
unsafe_object_accessor: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
}
@@ -663,6 +668,7 @@ call_args: {
options = {
evaluate: true,
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
}
@@ -686,6 +692,7 @@ call_args_drop_param: {
evaluate: true,
inline: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -1016,6 +1023,7 @@ Infinity_NaN_undefined_LHS: {
issue_1964_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe_regexp: false,
unused: true,
@@ -1045,6 +1053,7 @@ issue_1964_1: {
issue_1964_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe_regexp: true,
unused: true,
@@ -1201,6 +1210,7 @@ issue_2231_2: {
self_comparison_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -1221,6 +1231,7 @@ self_comparison_2: {
evaluate: true,
hoist_props: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
diff --git a/test/compress/functions.js b/test/compress/functions.js
index c5aab17..3e5562a 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -19,6 +19,7 @@ iifes_returning_constants_keep_fargs_true: {
booleans : true,
if_return : true,
join_vars : true,
+ reduce_funcs : true,
reduce_vars : true,
cascade : true,
inline : true,
@@ -55,6 +56,7 @@ iifes_returning_constants_keep_fargs_false: {
booleans : true,
if_return : true,
join_vars : true,
+ reduce_funcs : true,
reduce_vars : true,
cascade : true,
inline : true,
@@ -101,6 +103,7 @@ issue_1841_1: {
options = {
keep_fargs: false,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -127,6 +130,7 @@ issue_1841_2: {
options = {
keep_fargs: false,
pure_getters: false,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -154,6 +158,7 @@ function_returning_constant_literal: {
inline: true,
passes: 2,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -305,6 +310,7 @@ issue_2084: {
evaluate: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -340,6 +346,7 @@ issue_2084: {
issue_2097: {
options = {
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -515,6 +522,7 @@ issue_2428: {
inline: true,
passes: 3,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
diff --git a/test/compress/hoist_props.js b/test/compress/hoist_props.js
index ccfc76f..1fa321c 100644
--- a/test/compress/hoist_props.js
+++ b/test/compress/hoist_props.js
@@ -3,6 +3,7 @@ issue_2377_1: {
evaluate: true,
inline: true,
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -35,6 +36,7 @@ issue_2377_2: {
inline: true,
hoist_props: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -66,6 +68,7 @@ issue_2377_3: {
inline: true,
hoist_props: true,
passes: 3,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -92,6 +95,7 @@ issue_2377_3: {
direct_access_1: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -120,6 +124,7 @@ direct_access_1: {
direct_access_2: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -143,6 +148,7 @@ direct_access_2: {
direct_access_3: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -163,6 +169,7 @@ direct_access_3: {
single_use: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -187,6 +194,7 @@ single_use: {
name_collision_1: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
}
@@ -224,6 +232,7 @@ name_collision_1: {
name_collision_2: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
}
@@ -257,6 +266,7 @@ name_collision_2: {
name_collision_3: {
options = {
hoist_props: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
}
@@ -293,6 +303,7 @@ contains_this_1: {
hoist_props: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -318,6 +329,7 @@ contains_this_2: {
hoist_props: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -345,6 +357,7 @@ contains_this_3: {
hoist_props: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -376,6 +389,7 @@ new_this: {
hoist_props: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
diff --git a/test/compress/issue-1041.js b/test/compress/issue-1041.js
index cc35140..b17bce8 100644
--- a/test/compress/issue-1041.js
+++ b/test/compress/issue-1041.js
@@ -1,6 +1,7 @@
const_pragma: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
};
@@ -16,6 +17,7 @@ const_pragma: {
not_const: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
};
diff --git a/test/compress/issue-1609.js b/test/compress/issue-1609.js
index dffa54a..d8e8226 100644
--- a/test/compress/issue-1609.js
+++ b/test/compress/issue-1609.js
@@ -2,6 +2,7 @@ chained_evaluation_1: {
options = {
collapse_vars: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -28,6 +29,7 @@ chained_evaluation_2: {
options = {
collapse_vars: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
diff --git a/test/compress/issue-1656.js b/test/compress/issue-1656.js
index c4c8f86..3971cea 100644
--- a/test/compress/issue-1656.js
+++ b/test/compress/issue-1656.js
@@ -15,6 +15,7 @@ f7: {
negate_iife: true,
passes: 3,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
diff --git a/test/compress/issue-1673.js b/test/compress/issue-1673.js
index 081b0e5..88e1fa8 100644
--- a/test/compress/issue-1673.js
+++ b/test/compress/issue-1673.js
@@ -1,5 +1,6 @@
side_effects_catch: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -34,6 +35,7 @@ side_effects_catch: {
side_effects_else: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -62,6 +64,7 @@ side_effects_else: {
side_effects_finally: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -98,6 +101,7 @@ side_effects_finally: {
side_effects_label: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -130,6 +134,7 @@ side_effects_label: {
side_effects_switch: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
diff --git a/test/compress/issue-1787.js b/test/compress/issue-1787.js
index 2b5372b..fcef614 100644
--- a/test/compress/issue-1787.js
+++ b/test/compress/issue-1787.js
@@ -2,6 +2,7 @@ unary_prefix: {
options = {
evaluate: true,
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
diff --git a/test/compress/issue-1833.js b/test/compress/issue-1833.js
index e46dd04..4ffa9d5 100644
--- a/test/compress/issue-1833.js
+++ b/test/compress/issue-1833.js
@@ -1,6 +1,7 @@
iife_for: {
options = {
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -26,6 +27,7 @@ iife_for: {
iife_for_in: {
options = {
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -51,6 +53,7 @@ iife_for_in: {
iife_do: {
options = {
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -80,6 +83,7 @@ iife_do: {
iife_while: {
options = {
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
diff --git a/test/compress/issue-281.js b/test/compress/issue-281.js
index 65871a8..6a93136 100644
--- a/test/compress/issue-281.js
+++ b/test/compress/issue-281.js
@@ -3,6 +3,7 @@ collapse_vars_constants: {
collapse_vars: true,
evaluate: true,
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -240,6 +241,7 @@ negate_iife_issue_1073: {
evaluate: true,
inline: true,
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
unused: true,
@@ -267,6 +269,7 @@ issue_1288_side_effects: {
evaluate: true,
inline: true,
negate_iife: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -299,6 +302,7 @@ inner_var_for_in_1: {
options = {
evaluate: true,
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -330,6 +334,7 @@ issue_1595_3: {
evaluate: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
diff --git a/test/compress/properties.js b/test/compress/properties.js
index ab20252..f2e5932 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -833,6 +833,7 @@ lhs_prop_2: {
evaluate: true,
inline: true,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -879,6 +880,7 @@ prop_side_effects_1: {
evaluate: true,
inline: true,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -915,6 +917,7 @@ prop_side_effects_2: {
inline: true,
passes: 2,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js
index 22441d9..5c16b2c 100644
--- a/test/compress/pure_getters.js
+++ b/test/compress/pure_getters.js
@@ -1,6 +1,7 @@
strict: {
options = {
pure_getters: "strict",
+ reduce_funcs: false,
reduce_vars: false,
side_effects: true,
toplevel: true,
@@ -30,6 +31,7 @@ strict: {
strict_reduce_vars: {
options = {
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -58,6 +60,7 @@ strict_reduce_vars: {
unsafe: {
options = {
pure_getters: true,
+ reduce_funcs: false,
reduce_vars: false,
side_effects: true,
toplevel: true,
@@ -84,6 +87,7 @@ unsafe: {
unsafe_reduce_vars: {
options = {
pure_getters: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -185,6 +189,7 @@ issue_2110_1: {
pure_getters: "strict",
sequences: true,
side_effects: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -215,6 +220,7 @@ issue_2110_2: {
options = {
collapse_vars: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -247,6 +253,7 @@ set_immutable_1: {
collapse_vars: true,
evaluate: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -270,6 +277,7 @@ set_immutable_2: {
cascade: true,
conditionals: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -293,6 +301,7 @@ set_immutable_3: {
collapse_vars: true,
evaluate: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -318,6 +327,7 @@ set_immutable_4: {
cascade: true,
conditionals: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -343,6 +353,7 @@ set_mutable_1: {
collapse_vars: true,
evaluate: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -367,6 +378,7 @@ set_mutable_2: {
cascade: true,
conditionals: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index e84ac6c..76ed460 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -6,6 +6,7 @@ reduce_vars: {
global_defs : {
C : 0
},
+ reduce_funcs : true,
reduce_vars : true,
toplevel : true,
unused : true
@@ -64,6 +65,7 @@ modified: {
options = {
conditionals : true,
evaluate : true,
+ reduce_funcs : true,
reduce_vars : true,
unused : true,
}
@@ -171,6 +173,7 @@ modified: {
unsafe_evaluate: {
options = {
evaluate : true,
+ reduce_funcs : true,
reduce_vars : true,
side_effects : true,
unsafe : true,
@@ -214,6 +217,7 @@ unsafe_evaluate: {
unsafe_evaluate_side_effect_free_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
unused: true,
@@ -237,6 +241,7 @@ unsafe_evaluate_side_effect_free_2: {
evaluate: true,
passes: 2,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
unused: true,
@@ -253,6 +258,7 @@ unsafe_evaluate_side_effect_free_2: {
unsafe_evaluate_escaped: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
unused: true,
@@ -273,6 +279,7 @@ unsafe_evaluate_escaped: {
unsafe_evaluate_modified: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
unused: true,
@@ -305,6 +312,7 @@ unsafe_evaluate_modified: {
unsafe_evaluate_unknown: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
unused: true,
@@ -325,6 +333,7 @@ unsafe_evaluate_unknown: {
unsafe_evaluate_object_1: {
options = {
evaluate : true,
+ reduce_funcs : true,
reduce_vars : true,
unsafe : true
}
@@ -365,6 +374,7 @@ unsafe_evaluate_object_1: {
unsafe_evaluate_object_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -401,6 +411,7 @@ unsafe_evaluate_object_2: {
unsafe_evaluate_object_3: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -441,6 +452,7 @@ unsafe_evaluate_object_3: {
unsafe_evaluate_array_1: {
options = {
evaluate : true,
+ reduce_funcs : true,
reduce_vars : true,
unsafe : true
}
@@ -489,6 +501,7 @@ unsafe_evaluate_array_1: {
unsafe_evaluate_array_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -525,6 +538,7 @@ unsafe_evaluate_array_2: {
unsafe_evaluate_array_3: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -555,6 +569,7 @@ unsafe_evaluate_array_3: {
unsafe_evaluate_array_4: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -585,6 +600,7 @@ unsafe_evaluate_array_4: {
unsafe_evaluate_array_5: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -615,6 +631,7 @@ unsafe_evaluate_array_5: {
unsafe_evaluate_equality_1: {
options = {
evaluate : true,
+ reduce_funcs : true,
reduce_vars : true,
unsafe : true,
unused : true
@@ -647,6 +664,7 @@ unsafe_evaluate_equality_2: {
collapse_vars: true,
evaluate : true,
passes : 2,
+ reduce_funcs : true,
reduce_vars : true,
unsafe : true,
unused : true
@@ -683,6 +701,7 @@ passes: {
conditionals: true,
evaluate: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -714,6 +733,7 @@ passes: {
iife: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -734,6 +754,7 @@ iife: {
iife_new: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -754,6 +775,7 @@ iife_new: {
multi_def_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -779,6 +801,7 @@ multi_def_1: {
multi_def_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -808,6 +831,7 @@ multi_def_2: {
multi_def_3: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -835,6 +859,7 @@ multi_def_3: {
use_before_var: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -854,6 +879,7 @@ use_before_var: {
inner_var_if: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -877,6 +903,7 @@ inner_var_if: {
inner_var_label: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -902,6 +929,7 @@ inner_var_label: {
inner_var_for_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -931,6 +959,7 @@ inner_var_for_1: {
inner_var_for_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -954,6 +983,7 @@ inner_var_for_2: {
inner_var_for_in_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -985,6 +1015,7 @@ inner_var_for_in_1: {
inner_var_for_in_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1004,6 +1035,7 @@ inner_var_for_in_2: {
inner_var_catch: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1031,6 +1063,7 @@ inner_var_catch: {
issue_1533_1: {
options = {
collapse_vars: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1052,6 +1085,7 @@ issue_1533_1: {
issue_1533_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1075,6 +1109,7 @@ issue_1533_2: {
toplevel_on: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:true,
unused: true,
@@ -1092,6 +1127,7 @@ toplevel_on: {
toplevel_off: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:false,
unused: true,
@@ -1111,6 +1147,7 @@ toplevel_on_loops_1: {
options = {
evaluate: true,
loops: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:true,
unused: true,
@@ -1140,6 +1177,7 @@ toplevel_off_loops_1: {
options = {
evaluate: true,
loops: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:false,
unused: true,
@@ -1169,6 +1207,7 @@ toplevel_on_loops_2: {
options = {
evaluate: true,
loops: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:true,
unused: true,
@@ -1194,6 +1233,7 @@ toplevel_off_loops_2: {
options = {
evaluate: true,
loops: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:false,
unused: true,
@@ -1222,6 +1262,7 @@ toplevel_on_loops_3: {
options = {
evaluate: true,
loops: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:true,
unused: true,
@@ -1239,6 +1280,7 @@ toplevel_off_loops_3: {
options = {
evaluate: true,
loops: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel:false,
unused: true,
@@ -1256,6 +1298,7 @@ toplevel_off_loops_3: {
defun_reference: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1292,6 +1335,7 @@ defun_reference: {
defun_inline_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1320,6 +1364,7 @@ defun_inline_1: {
defun_inline_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1351,6 +1396,7 @@ defun_inline_3: {
evaluate: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -1373,6 +1419,7 @@ defun_inline_3: {
defun_call: {
options = {
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1400,6 +1447,7 @@ defun_call: {
defun_redefine: {
options = {
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1433,6 +1481,7 @@ defun_redefine: {
func_inline: {
options = {
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1460,6 +1509,7 @@ func_inline: {
func_modified: {
options = {
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1487,6 +1537,7 @@ func_modified: {
defun_label: {
options = {
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1516,6 +1567,7 @@ defun_label: {
double_reference: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1538,6 +1590,7 @@ double_reference: {
iife_arguments_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1560,6 +1613,7 @@ iife_arguments_1: {
iife_arguments_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1583,6 +1637,7 @@ iife_arguments_2: {
iife_eval_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1605,6 +1660,7 @@ iife_eval_1: {
iife_eval_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1629,6 +1685,7 @@ iife_eval_2: {
iife_func_side_effects: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1679,6 +1736,7 @@ iife_func_side_effects: {
issue_1595_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1697,6 +1755,7 @@ issue_1595_1: {
issue_1595_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1716,6 +1775,7 @@ issue_1595_3: {
options = {
evaluate: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1734,6 +1794,7 @@ issue_1595_3: {
issue_1595_4: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -1756,6 +1817,7 @@ issue_1606: {
options = {
evaluate: true,
hoist_vars: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -1782,6 +1844,7 @@ issue_1670_1: {
conditionals: true,
evaluate: true,
dead_code: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
switches: true,
@@ -1815,6 +1878,7 @@ issue_1670_2: {
evaluate: true,
dead_code: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
switches: true,
@@ -1846,6 +1910,7 @@ issue_1670_3: {
conditionals: true,
evaluate: true,
dead_code: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
switches: true,
@@ -1879,6 +1944,7 @@ issue_1670_4: {
evaluate: true,
dead_code: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
switches: true,
@@ -1909,6 +1975,7 @@ issue_1670_5: {
dead_code: true,
evaluate: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
switches: true,
@@ -1939,6 +2006,7 @@ issue_1670_6: {
dead_code: true,
evaluate: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
switches: true,
@@ -1973,6 +2041,7 @@ issue_1670_6: {
unary_delete: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2001,6 +2070,7 @@ redefine_arguments_1: {
options = {
evaluate: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2041,6 +2111,7 @@ redefine_arguments_2: {
evaluate: true,
inline: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -2079,6 +2150,7 @@ redefine_arguments_3: {
inline: true,
keep_fargs: false,
passes: 3,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -2115,6 +2187,7 @@ redefine_farg_1: {
options = {
evaluate: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2154,6 +2227,7 @@ redefine_farg_2: {
evaluate: true,
inline: true,
keep_fargs: false,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -2192,6 +2266,7 @@ redefine_farg_3: {
inline: true,
keep_fargs: false,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2222,6 +2297,7 @@ redefine_farg_3: {
delay_def: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2254,6 +2330,7 @@ booleans: {
options = {
booleans: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -2284,6 +2361,7 @@ booleans: {
side_effects_assign: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2303,6 +2381,7 @@ side_effects_assign: {
pure_getters_1: {
options = {
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -2325,6 +2404,7 @@ pure_getters_1: {
pure_getters_2: {
options = {
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2341,6 +2421,7 @@ pure_getters_2: {
pure_getters_3: {
options = {
pure_getters: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2357,6 +2438,7 @@ catch_var: {
options = {
booleans: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -2381,6 +2463,7 @@ catch_var: {
var_assign_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2404,6 +2487,7 @@ var_assign_1: {
var_assign_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2426,6 +2510,7 @@ var_assign_2: {
var_assign_3: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2450,6 +2535,7 @@ var_assign_3: {
var_assign_4: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2472,6 +2558,7 @@ var_assign_4: {
var_assign_5: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
@@ -2501,6 +2588,7 @@ var_assign_5: {
var_assign_6: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2522,6 +2610,7 @@ var_assign_6: {
immutable: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2542,6 +2631,7 @@ immutable: {
issue_1814_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2568,6 +2658,7 @@ issue_1814_1: {
issue_1814_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2594,6 +2685,7 @@ issue_1814_2: {
try_abort: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2625,6 +2717,7 @@ try_abort: {
boolean_binary_assign: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2648,6 +2741,7 @@ boolean_binary_assign: {
cond_assign: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2671,6 +2765,7 @@ cond_assign: {
iife_assign: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2701,6 +2796,7 @@ iife_assign: {
issue_1850_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: false,
unused: true,
@@ -2724,6 +2820,7 @@ issue_1850_1: {
issue_1850_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: "funcs",
unused: true,
@@ -2746,6 +2843,7 @@ issue_1850_2: {
issue_1850_3: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: "vars",
unused: true,
@@ -2769,6 +2867,7 @@ issue_1850_3: {
issue_1850_4: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2792,6 +2891,7 @@ issue_1850_4: {
issue_1865: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unsafe: true,
}
@@ -2821,6 +2921,7 @@ issue_1865: {
issue_1922_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2842,6 +2943,7 @@ issue_1922_1: {
issue_1922_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -2865,6 +2967,7 @@ issue_1922_2: {
accessor_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
}
@@ -2895,6 +2998,7 @@ accessor_2: {
options = {
collapse_vars: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2920,6 +3024,7 @@ accessor_2: {
for_in_prop: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
}
input: {
@@ -2947,6 +3052,7 @@ obj_var_1: {
options = {
evaluate: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -2976,6 +3082,7 @@ obj_var_2: {
inline: true,
passes: 2,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3002,6 +3109,7 @@ obj_arg_1: {
evaluate: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3033,6 +3141,7 @@ obj_arg_2: {
inline: true,
passes: 2,
properties: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3060,6 +3169,7 @@ func_arg_1: {
evaluate: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3084,6 +3194,7 @@ func_arg_2: {
evaluate: true,
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3105,6 +3216,7 @@ func_arg_2: {
regex_loop: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3133,6 +3245,7 @@ regex_loop: {
obj_for_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3151,6 +3264,7 @@ obj_for_1: {
obj_for_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3170,6 +3284,7 @@ obj_for_2: {
array_forin_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3192,6 +3307,7 @@ array_forin_1: {
array_forin_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3214,6 +3330,7 @@ array_forin_2: {
const_expr_1: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -3241,6 +3358,7 @@ const_expr_1: {
const_expr_2: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unsafe: true,
@@ -3277,6 +3395,7 @@ escaped_prop_1: {
evaluate: true,
inline: true,
pure_getters: "strict",
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3302,6 +3421,7 @@ escaped_prop_1: {
escaped_prop_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3336,6 +3456,7 @@ escaped_prop_2: {
issue_2420_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3378,6 +3499,7 @@ issue_2420_1: {
issue_2420_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3420,6 +3542,7 @@ issue_2420_2: {
issue_2423_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3444,6 +3567,7 @@ issue_2423_1: {
issue_2423_2: {
options = {
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3467,6 +3591,7 @@ issue_2423_2: {
issue_2423_3: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3485,6 +3610,7 @@ issue_2423_3: {
issue_2423_4: {
options = {
inline: true,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3505,6 +3631,7 @@ issue_2423_5: {
options = {
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3543,6 +3670,7 @@ issue_2423_6: {
options = {
inline: true,
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
side_effects: true,
toplevel: true,
@@ -3583,6 +3711,7 @@ issue_2423_6: {
issue_2440_eval_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3613,6 +3742,7 @@ issue_2440_eval_1: {
issue_2440_eval_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3643,6 +3773,7 @@ issue_2440_eval_2: {
issue_2440_with_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3669,6 +3800,7 @@ issue_2440_with_1: {
issue_2440_with_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3695,6 +3827,7 @@ issue_2440_with_2: {
issue_2442: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3709,6 +3842,7 @@ issue_2442: {
recursive_inlining_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3729,6 +3863,7 @@ recursive_inlining_1: {
recursive_inlining_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3751,6 +3886,7 @@ recursive_inlining_2: {
recursive_inlining_3: {
options = {
passes: 2,
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3788,6 +3924,7 @@ recursive_inlining_3: {
recursive_inlining_4: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3834,6 +3971,7 @@ recursive_inlining_4: {
recursive_inlining_5: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3887,6 +4025,7 @@ recursive_inlining_5: {
issue_2450_1: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3910,6 +4049,7 @@ issue_2450_1: {
issue_2450_2: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3932,6 +4072,7 @@ issue_2450_2: {
issue_2450_3: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
unused: true,
}
@@ -3962,6 +4103,7 @@ issue_2450_3: {
issue_2450_4: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -3995,6 +4137,7 @@ issue_2450_4: {
issue_2450_5: {
options = {
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -4030,6 +4173,7 @@ issue_2450_5: {
issue_2449: {
options = {
passes: 10,
+ reduce_funcs: true,
reduce_vars: true,
toplevel: true,
unused: true,
@@ -4061,3 +4205,74 @@ issue_2449: {
}
expect_stdout: "PASS"
}
+
+perf_1: {
+ options = {
+ passes: 10,
+ reduce_funcs: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function foo(x, y, z) {
+ return x < y ? x * y + z : x * z - y;
+ }
+ function indirect_foo(x, y, z) {
+ return foo(x, y, z);
+ }
+ var sum = 0;
+ for (var i = 0; i < 100; ++i) {
+ sum += indirect_foo(i, i+1, i*3);
+ }
+ console.log(sum);
+ }
+ expect: {
+ function indirect_foo(x, y, z) {
+ return function(x, y, z) {
+ return x < y ? x * y + z : x * z - y;
+ }(x, y, z);
+ }
+ var sum = 0;
+ for (var i = 0; i < 100; ++i)
+ sum += indirect_foo(i, i + 1, 3 * i);
+ console.log(sum);
+ }
+ expect_stdout: "348150"
+}
+
+perf_2: {
+ options = {
+ passes: 10,
+ reduce_funcs: false,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ function foo(x, y, z) {
+ return x < y ? x * y + z : x * z - y;
+ }
+ function indirect_foo(x, y, z) {
+ return foo(x, y, z);
+ }
+ var sum = 0;
+ for (var i = 0; i < 100; ++i) {
+ sum += indirect_foo(i, i+1, i*3);
+ }
+ console.log(sum);
+ }
+ expect: {
+ function foo(x, y, z) {
+ return x < y ? x * y + z : x * z - y;
+ }
+ function indirect_foo(x, y, z) {
+ return foo(x, y, z);
+ }
+ var sum = 0;
+ for (var i = 0; i < 100; ++i)
+ sum += indirect_foo(i, i + 1, 3 * i);
+ console.log(sum);
+ }
+ expect_stdout: "348150"
+}
diff --git a/test/compress/screw-ie8.js b/test/compress/screw-ie8.js
index 66559b0..82152b7 100644
--- a/test/compress/screw-ie8.js
+++ b/test/compress/screw-ie8.js
@@ -187,6 +187,7 @@ dont_screw_try_catch_undefined: {
reduce_vars: {
options = {
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
ie8: true,
unused: true,
diff --git a/test/compress/switch.js b/test/compress/switch.js
index 03c1e00..7f57a87 100644
--- a/test/compress/switch.js
+++ b/test/compress/switch.js
@@ -714,6 +714,7 @@ issue_1705_2: {
options = {
dead_code: true,
evaluate: true,
+ reduce_funcs: true,
reduce_vars: true,
sequences: true,
side_effects: true,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/uglifyjs.git
More information about the Pkg-javascript-commits
mailing list