aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/JSBackend/CallHandlers.h
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-01-20 12:03:00 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-01-20 12:03:00 -0800
commit0dc9f44e4820e977fd086d744c73d4c422cac352 (patch)
treeb3dbb6761b57eae37275ea602ed08e7dbd7854c2 /lib/Target/JSBackend/CallHandlers.h
parent617c45657f6a938b0c65d5107a2d7668e55ff49c (diff)
get first setjmp test passing
Diffstat (limited to 'lib/Target/JSBackend/CallHandlers.h')
-rw-r--r--lib/Target/JSBackend/CallHandlers.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Target/JSBackend/CallHandlers.h b/lib/Target/JSBackend/CallHandlers.h
index 653c77f161..022bf7260b 100644
--- a/lib/Target/JSBackend/CallHandlers.h
+++ b/lib/Target/JSBackend/CallHandlers.h
@@ -143,11 +143,16 @@ DEF_CALL_HANDLER(emscripten_longjmp, {
return CH___default__(CI, "_longjmp");
})
DEF_CALL_HANDLER(emscripten_check_longjmp, {
- return "checkyourself";
+ std::string Threw = getValueAsStr(CI->getOperand(0));
+ std::string Assign = getAssign(getJSName(CI), CI->getType());
+ return "if (((" + Threw + "|0) != 0) & ((threwValue|0) != 0)) { " +
+ Assign + "_testSetjmp(HEAP32[" + Threw + ">>2]|0, _setjmpTable)|0; " +
+ "tempRet0 = threwValue; " +
+ "} else { " + Assign + "-1; }";
})
DEF_CALL_HANDLER(emscripten_get_longjmp_result, {
std::string Threw = getValueAsStr(CI->getOperand(0));
- return getAssign(getJSName(CI), CI->getType()) + "((" + Threw + ") & ((threwValue|0) != 0)) ? " + "_testSetjmp(HEAP32[" + Threw + ">>2]|0, setjmpTable)|0" + " : -1";
+ return getAssign(getJSName(CI), CI->getType()) + "tempRet0";
})
// i64 support