diff options
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/preamble.js b/src/preamble.js index 5bb904d5..0b9288c4 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -333,13 +333,8 @@ Module['printXULProfiling'] = printXULProfiling; // Runtime essentials //======================================== -var __globalConstructor__ = function globalConstructor() { -}; - var __THREW__ = false; // Used in checking for thrown exceptions. -var __ATEXIT__ = []; - var ABORT = false; var undef = 0; @@ -648,17 +643,26 @@ STACK_MAX = STACK_ROOT + TOTAL_STACK; STATICTOP = alignMemoryPage(STACK_MAX); -function __shutdownRuntime__() { - while(__ATEXIT__.length > 0) { - var atexit = __ATEXIT__.pop(); - var func = atexit.func; +function callRuntimeCallbacks(callbacks) { + while(callbacks.length > 0) { + var callback = callbacks.pop(); + var func = callback.func; if (typeof func === 'number') { func = FUNCTION_TABLE[func]; } - func(atexit.arg === undefined ? null : atexit.arg); + func(callback.arg === undefined ? null : callback.arg); } +} + +var __ATINIT__ = []; // functions called during startup +var __ATEXIT__ = []; // functions called during shutdown + +function initRuntime() { + callRuntimeCallbacks(__ATINIT__); +} - // allow browser to GC, set heaps to null? +function exitRuntime() { + callRuntimeCallbacks(__ATEXIT__); // Print summary of correction activity CorrectionsMonitor.print(); |