diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/library.js | 4 | ||||
-rw-r--r-- | src/parseTools.js | 2 | ||||
-rw-r--r-- | src/preamble.js | 3 | ||||
-rw-r--r-- | src/runtime.js | 1 |
5 files changed, 10 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 4826e035..8880e3e8 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -584,7 +584,7 @@ function JSify(data) { var ret = '(function() { try { __THREW__ = false; return ' + makeFunctionCall(item.ident, item.params, item.funcData) + ' ' + '} catch(e) { ' - + '__THREW__ = true; ' + + 'if (ABORT) throw e; __THREW__ = true; ' + (EXCEPTION_DEBUG ? 'print("Exception: " + e + " : " + (new Error().stack)); ' : '') + '} })(); if (!__THREW__) { ' + makeBranch(item.toLabel, item.currLabelId) + ' } else { ' + makeBranch(item.unwindLabel, item.currLabelId) + ' }'; diff --git a/src/library.js b/src/library.js index 2dde32d3..896aae38 100644 --- a/src/library.js +++ b/src/library.js @@ -35,6 +35,7 @@ var Library = { __cxa_atexit: 'atexit', abort: function(code) { + ABORT = true; throw 'ABORT: ' + code + ', at ' + (new Error().stack); }, @@ -119,6 +120,7 @@ var Library = { // LLVM specifics __assert_fail: function(condition, file, line) { + ABORT = true; throw 'Assertion failed: ' + Pointer_stringify(condition);//JSON.stringify(arguments)//condition; }, @@ -137,6 +139,7 @@ var Library = { }, __cxa_call_unexpected: function(exception) { + ABORT = true; throw exception; }, @@ -166,6 +169,7 @@ var Library = { }, __cxa_pure_virtual: function() { + ABORT = true; throw 'Pure virtual function called!'; }, diff --git a/src/parseTools.js b/src/parseTools.js index 1ee82394..1e14b1ea 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -433,7 +433,7 @@ function getNativeFieldSize(field, alone) { 'i32': 4, 'i64': 8, 'float': 4, - 'double':8, + 'double':8 }[field]; // XXX 32/64 bit stuff if (!size) { size = 4; // Must be a pointer XXX 32/64 diff --git a/src/preamble.js b/src/preamble.js index 690ddc3c..fae4c714 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -41,10 +41,13 @@ INDENT = ''; START_TIME = Date.now(); #endif +ABORT = false; + function assert(condition, text) { if (!condition) { var text = "Assertion failed: " + text; print(text + ':\n' + (new Error).stack); + ABORT = true; throw "Assertion: " + text; } } diff --git a/src/runtime.js b/src/runtime.js index 3bc78f62..c8c57244 100644 --- a/src/runtime.js +++ b/src/runtime.js @@ -74,6 +74,7 @@ Runtime = { getFunctionIndex: function getFunctionIndex(func) { var key = Runtime.FUNCTION_TABLE.length; FUNCTION_TABLE[key] = func; + FUNCTION_TABLE[key+1] = null; // Need to have keys be even numbers, see |polymorph| test return key; }, |