aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-28 17:31:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-28 17:59:04 -0800
commit529c95fea72ca0161b71f6c7aaa3f9632904b0a7 (patch)
treebb8a461787ab4a65bfe4393d2e4a8e8d42cfd0b3 /src/jsifier.js
parent40f2ae9e943a66cd8a3fa2ef1375fb9d81fcd3bd (diff)
handle invoke that returns i64
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 56e49788..b93cdf9a 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -969,7 +969,16 @@ function JSify(data, functionsOnly, givenFunctions) {
+ 'if (typeof e != "number") throw e; '
+ 'if (ABORT) throw e; __THREW__ = true; '
+ (EXCEPTION_DEBUG ? 'print("Exception: " + e + ", currently at: " + (new Error().stack)); ' : '')
- + 'return null } })(); if (!__THREW__) { ' + getPhiSetsForLabel(phiSets, item.toLabel) + makeBranch(item.toLabel, item.currLabelId)
+ + 'return null } })();';
+ if (item.assignTo) {
+ ret = 'var ' + item.assignTo + ' = ' + ret;
+ if (isIllegalType(item.type)) {
+ assert(item.type == 'i64', 'Can only handle i64 invoke among illegal invokes');
+ ret += 'var ' + item.assignTo + '$0 = ' + item.assignTo + '[0], ' + item.assignTo + '$1 = ' + item.assignTo + '[1];';
+ }
+ item.assignTo = null;
+ }
+ ret += 'if (!__THREW__) { ' + getPhiSetsForLabel(phiSets, item.toLabel) + makeBranch(item.toLabel, item.currLabelId)
+ ' } else { ' + getPhiSetsForLabel(phiSets, item.unwindLabel) + makeBranch(item.unwindLabel, item.currLabelId) + ' }';
return ret;
});