diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-08 17:32:50 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-08 17:32:50 -0800 |
commit | 96f22dfe5820deb27a7428f22a5703a6a676b7f9 (patch) | |
tree | ff930ec022cdf8bb87a0ad31312b1c038f7d7b43 | |
parent | 8a7a96a56bcb63d19c03c0c93c662c9493c3c77f (diff) |
allow -O2 to also call registerize, but without minification of globals that we do in asm.js
-rw-r--r-- | tools/js-optimizer.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 7b774dee..60414228 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -1399,7 +1399,7 @@ function denormalizeAsm(func, data) { // Very simple 'registerization', coalescing of variables into a smaller number, // as part of minification. Globals-level minification began in a previous pass, -// we receive minifierInfo which tells us how to rename globals. +// we receive minifierInfo which tells us how to rename globals. (Only in asm.js.) // // We do not optimize when there are switches, so this pass only makes sense with // relooping. @@ -1407,16 +1407,16 @@ function denormalizeAsm(func, data) { // we still need the eliminator? Closure? And in what order? Perhaps just // closure simple? function registerize(ast) { - assert(minifierInfo); - traverseGeneratedFunctions(ast, function(fun) { - // First, fix globals. Note that we know/assume that locals cannot shadow globals. - traverse(fun, function(node, type) { - if (type == 'name') { - var minified = minifierInfo.globals[node[1]]; - if (minified) node[1] = minified; - } - }); + if (minifierInfo) { + // First, fix globals. Note that we know/assume that locals cannot shadow globals. + traverse(fun, function(node, type) { + if (type == 'name') { + var minified = minifierInfo.globals[node[1]]; + if (minified) node[1] = minified; + } + }); + } if (asm) var asmData = normalizeAsm(fun); // Add parameters as a first (fake) var (with assignment), so they get taken into consideration var params = {}; // note: params are special, they can never share a register between them (see later) |