aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-28 20:54:23 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-02 17:31:36 -0700
commitcd760b5a3b02fc38a95593ef37e864c5aa096de8 (patch)
treecf8aa7a7462d70bd8fa977c1592e257dbf3dd6a6
parentbac7ec61d402fc2a84a1fb6549df5d806e6dd8b9 (diff)
add final return in non-relooped asm.js output
-rw-r--r--src/jsifier.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 613e7909..c51f2854 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -747,6 +747,14 @@ function JSify(data, functionsOnly, givenFunctions) {
if (func.setjmpTable && !ASM_JS) {
ret += ' } catch(e) { if (!e.longjmp || !(e.id in mySetjmpIds)) throw(e); setjmpTable[setjmpLabels[e.id]](e.value) }';
}
+ if (ASM_JS && func.returnType !== 'void') {
+ // Add a return
+ if (func.returnType in Runtime.FLOAT_TYPES) {
+ ret += ' return +0;\n';
+ } else {
+ ret += ' return 0;\n';
+ }
+ }
} else {
ret += (SHOW_LABELS ? indent + '/* ' + block.entries[0] + ' */' : '') + '\n' + getLabelLines(block.labels[0]);
}