diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-10-25 14:12:00 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-10-25 14:12:00 -0700 |
commit | b1eeb1ccda3aa5684699c6f8920085250a7ef023 (patch) | |
tree | d471fbb2913b4085ca237fe199ca8958d15f855f /tools/js-optimizer.js | |
parent | 056d7563e2c65f730f0a369e915fcd486dc7c607 (diff) |
eliminate in if nodes
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r-- | tools/js-optimizer.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index c7fdf10f..047eeac2 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -1363,6 +1363,8 @@ function registerize(ast) { }); } +var ELIMINATION_SAFE_NODES = set('var', 'assign', 'call', 'if'); + function eliminate(ast) { // Find variables that have a single use, and if they can be eliminated, do so traverseGeneratedFunctions(ast, function(func, type) { @@ -1545,7 +1547,7 @@ function eliminate(ast) { type = node[0]; } // Check for things that affect elimination - if (type == 'var' || type == 'assign' || type == 'call') { + if (type in ELIMINATION_SAFE_NODES) { // can we eliminate and/or track? if (!check(node)) continue; // try to eliminate |