aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-27 11:11:53 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-06-27 11:11:53 -0700
commit91920dc8cbbfe3a055489a3f26b70d4119f6061d (patch)
treeb1265dc8b05c1dc3d3a214c71a04de23999fd6a7
parent6fe62c15394b2656393771b110f7b93f4db2c80b (diff)
do not collapse & inside a FUNCTION_TABLE call, we need the mask
-rw-r--r--tools/js-optimizer.js2
-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, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index 151e573a..4829fec8 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -584,6 +584,8 @@ function simplifyExpressionsPre(ast) {
node[3] = value[2];
}
}
+ } else if (type == 'sub' && node[1][0] == 'name' && /^FUNCTION_TABLE.*/.exec(node[1][1])) {
+ return null; // do not traverse subchildren here, we should not collapse 55 & 126. TODO: optimize this into a nonvirtual call (also because we lose some other opts here)!
}
});
diff --git a/tools/test-js-optimizer-asm-pre-output.js b/tools/test-js-optimizer-asm-pre-output.js
index 2cd8d407..301a2ec8 100644
--- a/tools/test-js-optimizer-asm-pre-output.js
+++ b/tools/test-js-optimizer-asm-pre-output.js
@@ -19,6 +19,7 @@ function a() {
f(g() | 0 & -1);
f((g() | 0) >> 2);
$56 = _fcntl() | 0 | 1;
+ FUNCTION_TABLE_ii[55 & 127]() | 0;
}
function b($this, $__n) {
$this = $this | 0;
diff --git a/tools/test-js-optimizer-asm-pre.js b/tools/test-js-optimizer-asm-pre.js
index ca7d2894..c7c92124 100644
--- a/tools/test-js-optimizer-asm-pre.js
+++ b/tools/test-js-optimizer-asm-pre.js
@@ -20,6 +20,7 @@ function a() {
f(g() | 0 & -1);
f((g() | 0) >> 2);
$56 = (_fcntl() | 0) | 1;
+ FUNCTION_TABLE_ii[55 & 127]() | 0;
}
function b($this, $__n) {
$this = $this | 0;