aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-03-12 13:00:09 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-03-12 13:00:09 -0700
commitc3ff344fc3e4a87232863a3864e7f10e96a32b10 (patch)
tree8d3f485f860e5f46c1c9eafcfa5ef58166d0b702
parent174c6def2ce5290c62513d411ead97db14ef06ee (diff)
unique ids for aborts for dead functions
-rw-r--r--src/compiler.js2
-rw-r--r--src/jsifier.js2
-rw-r--r--src/utility.js9
3 files changed, 11 insertions, 2 deletions
diff --git a/src/compiler.js b/src/compiler.js
index f461bcf7..bb72c7dd 100644
--- a/src/compiler.js
+++ b/src/compiler.js
@@ -168,7 +168,7 @@ if (SAFE_HEAP >= 2) {
EXPORTED_FUNCTIONS = set(EXPORTED_FUNCTIONS);
EXPORTED_GLOBALS = set(EXPORTED_GLOBALS);
EXCEPTION_CATCHING_WHITELIST = set(EXCEPTION_CATCHING_WHITELIST);
-DEAD_FUNCTIONS = set(DEAD_FUNCTIONS);
+DEAD_FUNCTIONS = numberedSet(DEAD_FUNCTIONS);
RUNTIME_DEBUG = LIBRARY_DEBUG || GL_DEBUG;
diff --git a/src/jsifier.js b/src/jsifier.js
index d36f26ce..3cb5c23e 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1420,7 +1420,7 @@ function JSify(data, functionsOnly, givenFunctions) {
}
if (callIdent in DEAD_FUNCTIONS) {
- var ret = 'abort(7)';
+ var ret = 'abort(' + DEAD_FUNCTIONS[callIdent] + ')';
if (ASM_JS) ret = asmCoercion(ret, returnType);
return ret;
}
diff --git a/src/utility.js b/src/utility.js
index 8db37c61..19444675 100644
--- a/src/utility.js
+++ b/src/utility.js
@@ -267,6 +267,15 @@ function set() {
}
var unset = keys;
+function numberedSet() {
+ var args = typeof arguments[0] === 'object' ? arguments[0] : arguments;
+ var ret = {};
+ for (var i = 0; i < args.length; i++) {
+ ret[args[i]] = i;
+ }
+ return ret;
+}
+
function setSub(x, y) {
var ret = set(keys(x));
for (yy in y) {