diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-12-06 20:44:21 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-12-07 14:23:24 -0800 |
commit | c51a379ec1cdc254366a0f9eebfea7411a03b1e3 (patch) | |
tree | 590c5e141f909abb00aeab26f8718f0e5ca019b2 | |
parent | f0b6b3d2ad45a81e7d92d7491b38a3cad8a08ef5 (diff) |
forward clearing of __THREW__ to asm
-rwxr-xr-x | emscripten.py | 6 | ||||
-rw-r--r-- | src/jsifier.js | 4 | ||||
-rw-r--r-- | src/library.js | 6 | ||||
-rw-r--r-- | src/preamble.js | 2 |
4 files changed, 13 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py index 753f1c80..64e2bde4 100755 --- a/emscripten.py +++ b/emscripten.py @@ -302,7 +302,7 @@ var i64Math_multiply = function(a, b, c, d) { i64Math.multiply(a, b, c, d) }; var i64Math_divide = function(a, b, c, d, e) { i64Math.divide(a, b, c, d, e) }; var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) }; ''' - asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore'] + ['setTempRet%d' % i for i in range(10)] + asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)] # function tables function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']] function_tables_impls = [] @@ -363,6 +363,10 @@ var asmPre = (function(env, buffer) { top = top|0; STACKTOP = top; } + function setThrew(threw) { + threw = threw|0; + __THREW__ = threw; + } ''' + ''.join([''' var tempRet%d = 0; function setTempRet%d(value) { diff --git a/src/jsifier.js b/src/jsifier.js index f9eb2881..7a241ecb 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1089,11 +1089,11 @@ function JSify(data, functionsOnly, givenFunctions) { // in an assignment var phiSets = calcPhiSets(item); var call_ = makeFunctionCall(item.ident, item.params, item.funcData, item.type); - var ret = '(function() { try { __THREW__ = false; return ' + var ret = '(function() { try { __THREW__ = 0; return ' + call_ + ' ' + '} catch(e) { ' + 'if (typeof e != "number") throw e; ' - + 'if (ABORT) throw e; __THREW__ = true; ' + + 'if (ABORT) throw e; __THREW__ = 1; ' + (EXCEPTION_DEBUG ? 'Module.print("Exception: " + e + ", currently at: " + (new Error().stack)); ' : '') + 'return null } })();'; if (item.assignTo) { diff --git a/src/library.js b/src/library.js index 22eb4b98..f23e87f7 100644 --- a/src/library.js +++ b/src/library.js @@ -4849,7 +4849,11 @@ LibraryManager.library = { return; } // Clear state flag. - __THREW__ = false; +#if ASM_JS + asm.setThrew(0); +#else + __THREW__ = 0; +#endif // Clear type. {{{ makeSetValue('_llvm_eh_exception.buf', QUANTUM_SIZE, '0', 'void*') }}} // Call destructor if one is registered then clear it. diff --git a/src/preamble.js b/src/preamble.js index e7cceb36..ae264a90 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -275,7 +275,7 @@ Module['printProfiling'] = printProfiling; // Runtime essentials //======================================== -var __THREW__ = false; // Used in checking for thrown exceptions. +var __THREW__ = 0; // Used in checking for thrown exceptions. var ABORT = false; |