aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-01-08 16:50:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-01-08 16:50:37 -0800
commitc31a515ee32a2aef2194e09e3f977c6961fce410 (patch)
tree99d6a144c1d3c2f6b3adc998de0734af1d2298c5
parent78dbafb289e222550abda6b53e7099352a599804 (diff)
improve |0 removal in asm mode a little
-rw-r--r--tools/js-optimizer.js3
-rw-r--r--tools/test-js-optimizer-asm-pre-output.js1
-rw-r--r--tools/test-js-optimizer-asm-pre.js1
3 files changed, 4 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 7fe8d99f..a8753e6f 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -425,7 +425,6 @@ function simplifyExpressionsPre(ast, asm) {
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;
- if (asm && result[0] == 'sub') break; // we must keep a coercion right on top of a heap access in asm mode
// Great, we can eliminate
rerun = true;
while (other = process(result, result[0], stack)) {
@@ -434,6 +433,8 @@ function simplifyExpressionsPre(ast, asm) {
return result;
} else if (stack[i] == -1) {
break; // Too bad, we can't
+ } else if (asm) {
+ break; // we must keep a coercion right on top of a heap access in asm mode
}
}
stack.push(1); // From here on up, no need for this kind of correction, it's done at the top
diff --git a/tools/test-js-optimizer-asm-pre-output.js b/tools/test-js-optimizer-asm-pre-output.js
index 10212470..6d380567 100644
--- a/tools/test-js-optimizer-asm-pre-output.js
+++ b/tools/test-js-optimizer-asm-pre-output.js
@@ -1,4 +1,5 @@
function a() {
f((HEAPU8[10202] | 0) + 5 | 0);
+ f(HEAPU8[10202] | 0);
}
diff --git a/tools/test-js-optimizer-asm-pre.js b/tools/test-js-optimizer-asm-pre.js
index 8d33a6a2..71969cc3 100644
--- a/tools/test-js-optimizer-asm-pre.js
+++ b/tools/test-js-optimizer-asm-pre.js
@@ -1,4 +1,5 @@
function a() {
f((HEAPU8[10202] | 0) + 5 | 0);
+ f((HEAPU8[10202] | 0) | 0);
}
// EMSCRIPTEN_GENERATED_FUNCTIONS: ["a"]