aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-04-11 21:22:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-04-11 21:22:49 -0700
commitf54d0e6ccbbb702db125d8c9f86190cf37cfee0c (patch)
treeea7801d63b7a18e7bced6d0f5d1804fb1555f062
parent9e7a712c6b6186792f186ed6bd6d6af31d36a434 (diff)
avoid unnecessary array creation in cxa_find_matching_catch calls
-rw-r--r--src/jsifier.js2
-rw-r--r--src/library.js4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index af07539f..2a9dc5bd 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 +'])';
+ 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 : '') +')';
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 80c107a5..f58c7150 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5157,7 +5157,9 @@ LibraryManager.library = {
// We'll do that here, instead, to keep things simpler.
__cxa_find_matching_catch__deps: ['__cxa_does_inherit', '__cxa_is_number_type'],
- __cxa_find_matching_catch: function(thrown, throwntype, typeArray) {
+ __cxa_find_matching_catch: function(thrown, throwntype) {
+ var typeArray = Array.prototype.slice.call(arguments, 2);
+
// If throwntype is a pointer, this means a pointer has been
// thrown. When a pointer is thrown, actually what's thrown
// is a pointer to the pointer. We'll dereference it.