aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime.js')
-rw-r--r--src/runtime.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/runtime.js b/src/runtime.js
index e42f90e3..9104c55d 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -403,6 +403,20 @@ var Runtime = {
}
});
}
+
+ var newLength = table.length;
+ jsModule.cleanups.push(function() {
+ if (table.length === newLength) {
+ table.length = from; // nothing added since, just shrink
+ } else {
+ // something was added above us, clear and leak the span
+ for (var i = 0; i < num; i++) {
+ table[from + i] = null;
+ }
+ }
+ while (table.length > 0 && table[table.length-1] === null) table.pop();
+ });
+
// patch js module dynCall_* to use functionTable
sigs.forEach(function(sig) {
jsModule['dynCall_' + sig] = function() {