diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-04-09 14:48:25 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-04-09 14:48:41 -0700 |
commit | f0817a3565bae94362b5aef88e0bccc5f35268b6 (patch) | |
tree | d570cbe9139e1b96ac4f5b98cb8c15528d885294 /tools | |
parent | e52c99365d82dd3a51c49302ba4af1115432e3d5 (diff) |
fix outlinings of return double; fixes #2278
Diffstat (limited to 'tools')
-rw-r--r-- | tools/js-optimizer.js | 2 | ||||
-rw-r--r-- | tools/test-js-optimizer-asm-outline1-output.js | 59 | ||||
-rw-r--r-- | tools/test-js-optimizer-asm-outline1.js | 27 |
3 files changed, 87 insertions, 1 deletions
diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index e75ff317..c4585b84 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -4491,7 +4491,7 @@ function outline(ast) { for (var returnType in codeInfo.hasReturnType) { reps.push(makeIf( makeComparison(makeAsmCoercion(['name', 'tempValue'], ASM_INT), '==', ['num', controlFromAsmType(returnType)]), - [['stat', ['return', makeAsmCoercion(['name', 'tempInt'], returnType | 0)]]] + [['stat', ['return', makeAsmCoercion(['name', returnType == ASM_INT ? 'tempInt' : 'tempDouble'], returnType | 0)]]] )); } if (codeInfo.hasBreak) { diff --git a/tools/test-js-optimizer-asm-outline1-output.js b/tools/test-js-optimizer-asm-outline1-output.js index 40c028c6..10fc3714 100644 --- a/tools/test-js-optimizer-asm-outline1-output.js +++ b/tools/test-js-optimizer-asm-outline1-output.js @@ -446,6 +446,32 @@ function stackSet(x1, x2, x3, x4, x5) { HEAP32[sp + 62 >> 2] = 0; stackSet$0(sp); } +function linf(d) { + d = +d; + var sp = 0; + sp = STACKTOP; + STACKTOP = STACKTOP + 160 | 0; + while (1) { + HEAP32[sp + 24 >> 2] = 0; + HEAP32[sp + 28 >> 2] = 0; + linf$1(sp); + HEAPF32[sp + 8 >> 2] = d; + HEAP32[sp + 16 >> 2] = 0; + HEAP32[sp + 20 >> 2] = 0; + linf$0(sp); + tempValue = HEAP32[sp + 16 >> 2] | 0; + tempInt = HEAP32[sp + 20 >> 2] | 0; + tempDouble = +HEAPF32[sp + 20 >> 2]; + HEAP32[sp + 16 >> 2] = 0; + HEAP32[sp + 20 >> 2] = 0; + if ((tempValue | 0) == 7) { + STACKTOP = sp; + return +tempDouble; + } + } + STACKTOP = sp; + return +d; +} function lin$0(sp) { sp = sp | 0; c(14); @@ -955,4 +981,37 @@ function stackSet$1(sp) { c(5); c(6); } +function linf$0(sp) { + sp = sp | 0; + var d = +0; + d = +HEAPF32[sp + 8 >> 2]; + OL : do { + c(16); + c(17); + c(18); + c(19); + c(20); + HEAP32[sp + 16 >> 2] = 7; + HEAPF32[sp + 20 >> 2] = +d; + break OL; + } while (0); +} +function linf$1(sp) { + sp = sp | 0; + c(1); + c(2); + c(3); + c(4); + c(5); + c(6); + c(7); + c(8); + c(9); + c(10); + c(11); + c(12); + c(13); + c(14); + c(15); +} diff --git a/tools/test-js-optimizer-asm-outline1.js b/tools/test-js-optimizer-asm-outline1.js index f640d11d..8dfb1afb 100644 --- a/tools/test-js-optimizer-asm-outline1.js +++ b/tools/test-js-optimizer-asm-outline1.js @@ -384,5 +384,32 @@ function stackSet(x1, x2, x3, x4, x5) { c(12); c(13); } +function linf(d) { + d = +d; + while (1) { + c(1); + c(2); + c(3); + c(4); + c(5); + c(6); + c(7); + c(8); + c(9); + c(10); + c(11); + c(12); + c(13); + c(14); + c(15); + c(16); + c(17); + c(18); + c(19); + c(20); + return +d; + } + return +d; +} // EMSCRIPTEN_GENERATED_FUNCTIONS // EXTRA_INFO: { "sizeToOutline": 30, "allowCostlyOutlines": 1 } |