aboutsummaryrefslogtreecommitdiff
path: root/src/shell_sharedlib.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-06 18:34:38 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-06 18:34:38 -0700
commit38890204ed1f5f8dd34cced7c42fc9cf42dccab5 (patch)
tree0b6d76adc047a0c81c9e0caf0dbbae93c5461948 /src/shell_sharedlib.js
parentb5b49215d4a40566380a769f47a9c1cce74a28b0 (diff)
parentfce749a7066e51d57967889fab0600c285885b4b (diff)
Merge branch 'incoming'
Diffstat (limited to 'src/shell_sharedlib.js')
-rw-r--r--src/shell_sharedlib.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/shell_sharedlib.js b/src/shell_sharedlib.js
index 1d34c73e..c070c617 100644
--- a/src/shell_sharedlib.js
+++ b/src/shell_sharedlib.js
@@ -1,8 +1,24 @@
// Capture the output of this into a variable, if you want
-(function(FUNCTION_TABLE_OFFSET, globalScope) {
+(function(FUNCTION_TABLE_OFFSET, parentModule) {
var Module = {};
var args = [];
Module.arguments = [];
+ Module.print = parentModule.print;
+ Module.printErr = parentModule.printErr;
+
+ Module.cleanups = [];
+
+#if ASM_JS
+ var H_BASE = 0;
+ // Each module has its own stack
+ var STACKTOP = parentModule['_malloc'](TOTAL_STACK);
+ assert(STACKTOP % 8 == 0);
+ var STACK_MAX = STACKTOP + TOTAL_STACK;
+ Module.cleanups.push(function() {
+ parentModule['_free'](STACKTOP); // XXX ensure exported
+ parentModule['_free'](H_BASE);
+ });
+#endif
{{BODY}}
@@ -10,3 +26,4 @@
return Module;
});
+