aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-11 10:06:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-11 10:06:29 -0800
commiteb8172ed7872c99b6438c4ab0fa9f83372fc44b0 (patch)
treee5892c4adcb4c3a64a258bc406e002972dfe0a33
parenteed2f8149d04b0fc991d3893f59a00f7f30442f0 (diff)
minify in asm var definitions that denormalizeAsm generates, to handle Math.fround calls
-rw-r--r--tools/js-optimizer.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index d2bfcd91..0371b3a3 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -2059,6 +2059,25 @@ function registerize(ast) {
}
}
denormalizeAsm(fun, finalAsmData);
+ if (extraInfo && extraInfo.globals) {
+ // minify in asm var definitions, that denormalizeAsm just generated
+ var stats = fun[3];
+ for (var i = fun[2].length; i < stats.length; i++) {
+ var line = stats[i];
+ if (line[0] !== 'var') break;
+ var pairs = line[1];
+ for (var j = 0; j < pairs.length; j++) {
+ var value = pairs[j][1];
+ if (value && value[0] === 'call' && value[1][0] === 'name') {
+ var name = value[1][1];
+ var minified = extraInfo.globals[name];
+ if (minified) {
+ value[1][1] = minified;
+ }
+ }
+ }
+ }
+ }
}
});
}