aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-11 21:03:35 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-11 21:03:35 -0700
commitb805225b2a2678be7c401526ef165b1a5670dbd4 (patch)
tree20c128cc1dce57d4bcfe77aefd54cf10e48a1f74
parent162d21d98ac59709e64b9117b2f1d96f588fe636 (diff)
disable registerize when seeing inline js in non-asm mode, as we do not protect it from replacements there; fixes #1614
-rw-r--r--tools/js-optimizer.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js
index c029ab4e..e78f39ef 100644
--- a/tools/js-optimizer.js
+++ b/tools/js-optimizer.js
@@ -1746,6 +1746,7 @@ function registerize(ast) {
// We also mark local variables - i.e., having a var definition
var localVars = {};
var hasSwitch = false; // we cannot optimize variables if there is a switch, unless in asm mode
+ var hasFunction = false;
traverse(fun, function(node, type) {
if (type === 'var') {
node[1].forEach(function(defined) { localVars[defined[0]] = 1 });
@@ -1757,8 +1758,13 @@ function registerize(ast) {
}
} else if (type === 'switch') {
hasSwitch = true;
+ } else if (type === 'function') {
+ hasFunction = true;
}
});
+ if (!asm && hasFunction) {
+ return; // inline assembly, and not asm (where we protect it in normalize/denormalize), so abort registerize pass
+ }
vacuum(fun);
if (extraInfo && extraInfo.globals) {
assert(asm);