aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-18 16:43:00 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-18 16:43:00 -0800
commit425fcf6836b468bb75a77bd547c22c4c45bee43b (patch)
tree5ceb0158af5c7d7c69c06011e44b88f270167a8b /tools/js-optimizer.js
parentd268ea5b93c49a6dafafd5683ef25cdbc955b9c9 (diff)
fix simplyExpressions bug with removing too many |0s
Diffstat (limited to 'tools/js-optimizer.js')
-rw-r--r--tools/js-optimizer.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index d26d902f..69abe23a 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -428,12 +428,13 @@ function simplifyExpressionsPre(ast) {
if (stack[i] == 1) {
// we will replace ourselves with the non-zero side. Recursively process that node.
var result = jsonCompare(node[2], ZERO) ? node[3] : node[2], other;
- // Great, we can eliminate
- rerun = true;
- while (other = process(result, result[0], stack)) {
- result = other;
+ // replace node in-place
+ node.length = result.length;
+ for (var j = 0; j < result.length; j++) {
+ node[j] = result[j];
}
- return result;
+ rerun = true;
+ return process(result, result[0], stack);
} else if (stack[i] == -1) {
break; // Too bad, we can't
} else if (asm) {