aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-12 09:30:04 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-12 09:30:04 -0700
commit26f97461214052df80f3310f856670aebcf84d37 (patch)
tree80b5c2ef8db5efc52e1b8a9254c1dc66b91067fd
parentf54d0e6ccbbb702db125d8c9f86190cf37cfee0c (diff)
avoid emitting non-asm code for cxa_find_matching_catch
-rw-r--r--src/jsifier.js2
-rw-r--r--src/library.js2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 2a9dc5bd..82cdced6 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1211,7 +1211,7 @@ function JSify(data, functionsOnly, givenFunctions) {
});
makeFuncLineActor('landingpad', function(item) {
var catchTypeArray = item.catchables.map(finalizeLLVMParameter).join(',');
- var ret = '___cxa_find_matching_catch('+ makeGetValue('_llvm_eh_exception.buf', '0', 'void*') +',' + makeGetValue('_llvm_eh_exception.buf', QUANTUM_SIZE, 'void*') + (catchTypeArray.length > 0 ? ',' + catchTypeArray : '') +')';
+ var ret = asmCoercion('___cxa_find_matching_catch(-1, -1' + (catchTypeArray.length > 0 ? ',' + catchTypeArray : '') +')', 'i32');
if (USE_TYPED_ARRAYS == 2) {
ret = makeVarDef(item.assignTo) + '$0 = ' + ret + '; ' + item.assignTo + '$1 = tempRet0;';
item.assignTo = null;
diff --git a/src/library.js b/src/library.js
index f58c7150..294ab200 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5158,6 +5158,8 @@ LibraryManager.library = {
__cxa_find_matching_catch__deps: ['__cxa_does_inherit', '__cxa_is_number_type'],
__cxa_find_matching_catch: function(thrown, throwntype) {
+ if (thrown == -1) thrown = {{{ makeGetValue('_llvm_eh_exception.buf', '0', 'void*') }}};
+ if (throwntype == -1) throwntype = {{{ makeGetValue('_llvm_eh_exception.buf', QUANTUM_SIZE, 'void*') }}};
var typeArray = Array.prototype.slice.call(arguments, 2);
// If throwntype is a pointer, this means a pointer has been