aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-08-26 14:22:21 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-03 14:41:29 -0700
commit3b07ce3ad9e9975b8c09b98d53c3df53363a9134 (patch)
tree3851511ec66c4f350d23932fccbb2d47e247080c
parentb283401f76378abe71f6ff14b0dda7f10c35c723 (diff)
forward parent Module to side module
-rw-r--r--src/jsifier.js1
-rw-r--r--src/library.js3
-rw-r--r--src/shell_sharedlib.js2
3 files changed, 4 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 0818f128..7e58d61d 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1664,6 +1664,7 @@ function JSify(data, functionsOnly, givenFunctions) {
print('STATIC_BASE = ' + Runtime.GLOBAL_BASE + ';\n');
print('STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n');
} else {
+ print('var H_BASE = parentModule["_malloc"](' + Runtime.alignMemory(Variables.nextIndexedOffset) + ');\n');
print('// STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n'); // comment as metadata only
}
}
diff --git a/src/library.js b/src/library.js
index b0035f21..3e244c67 100644
--- a/src/library.js
+++ b/src/library.js
@@ -5050,7 +5050,8 @@ LibraryManager.library = {
try {
var lib_module = eval(lib_data)(
#if ASM_JS
- asm.maxFunctionIndex
+ asm.maxFunctionIndex,
+ Module
#else
{{{ Functions.getTable('x') }}}.length
#endif
diff --git a/src/shell_sharedlib.js b/src/shell_sharedlib.js
index 1d34c73e..505c3d7b 100644
--- a/src/shell_sharedlib.js
+++ b/src/shell_sharedlib.js
@@ -1,5 +1,5 @@
// 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 = [];