diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-09-30 17:50:39 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-03 10:53:57 -0700 |
commit | c182633f18453cd5c46459ccdce2280ccc591644 (patch) | |
tree | fb7d23ab9f9eb44639a4da5fe86a5755bf9cda84 /tools | |
parent | 04732d022bfaa3ea08a78886d0d8dec5658fc58d (diff) |
emit final missing returns in compiler itself
Diffstat (limited to 'tools')
-rw-r--r-- | tools/js-optimizer.js | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index 7df92c60..f03c04b8 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -768,32 +768,11 @@ function simplifyExpressions(ast) { }); } - function asmOpts(fun) { - // Add final returns when necessary - var returnType = null; - traverse(fun, function(node, type) { - if (type === 'return' && node[1]) { - returnType = detectAsmCoercion(node[1]); - } - }); - // Add a final return if one is missing. - if (returnType !== null) { - var stats = getStatements(fun); - var last = stats[stats.length-1]; - if (last[0] != 'return') { - var returnValue = ['num', 0]; - if (returnType === ASM_DOUBLE) returnValue = ['unary-prefix', '+', returnValue]; - stats.push(['return', returnValue]); - } - } - } - traverseGeneratedFunctions(ast, function(func) { simplifyIntegerConversions(func); simplifyBitops(func); joinAdditions(func); // simplifyZeroComp(func); TODO: investigate performance - if (asm) asmOpts(func); simplifyNotComps(func); }); } |