diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-11 21:33:56 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-09-11 21:33:56 -0700 |
commit | e48b5037b663126693bbe3031d40b80ca0de6706 (patch) | |
tree | 6196f2764f84528150cc921eb1bf9a454031d75f | |
parent | f937b0464b18aa98e46ef6cd37e973f468906e88 (diff) |
abort registerize at the proper early time when we need to
-rw-r--r-- | tools/js-optimizer.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index e78f39ef..e567ebff 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -1728,6 +1728,15 @@ function getStackBumpSize(ast) { function registerize(ast) { traverseGeneratedFunctions(ast, function(fun) { if (asm) var asmData = normalizeAsm(fun); + if (!asm) { + var hasFunction = false; + traverse(fun, function(node, type) { + if (type === 'function') hasFunction = true; + }); + if (hasFunction) { + return; // inline assembly, and not asm (where we protect it in normalize/denormalize), so abort registerize pass + } + } // Add parameters as a first (fake) var (with assignment), so they get taken into consideration var params = {}; // note: params are special, they can never share a register between them (see later) if (fun[2] && fun[2].length) { @@ -1746,7 +1755,6 @@ 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 }); @@ -1758,13 +1766,8 @@ 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); |