aboutsummaryrefslogtreecommitdiff
path: root/tools/js-optimizer.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/js-optimizer.js')
-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);