aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-16 19:24:26 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-16 19:28:43 -0800
commit749325298aa5328429ee571f50034adaa4a6423d (patch)
tree5cfad392279bef01f1f20837d41cb91d489eb8cd /src/library.js
parent70797b08d802b50c96e79b55b2eb2b13c576971f (diff)
support memory growth in (non-validating) asm.js
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index 1b5e8b20..c1eb2219 100644
--- a/src/library.js
+++ b/src/library.js
@@ -9065,6 +9065,35 @@ LibraryManager.library = {
return cache[fullname] = allocate(intArrayFromString(ret + ''), 'i8', ALLOC_NORMAL);
},
+#if ASM_JS
+#if ALLOW_MEMORY_GROWTH
+ emscripten_replace_memory__asm: true, // this is used inside the asm module
+ emscripten_replace_memory__sig: 'viiiiiiii', // bogus
+ emscripten_replace_memory: function(_HEAP8, _HEAP16, _HEAP32, _HEAPU8, _HEAPU16, _HEAPU32, _HEAPF32, _HEAPF64) {
+ _HEAP8 = _HEAP8; // fake asm coercions
+ _HEAP16 = _HEAP16;
+ _HEAP32 = _HEAP32;
+ _HEAPU8 = _HEAPU8;
+ _HEAPU16 = _HEAPU16;
+ _HEAPU32 = _HEAPU32;
+ _HEAPF32 = _HEAPF32;
+ _HEAPF64 = _HEAPF64;
+ HEAP8 = _HEAP8; // replace the memory views
+ HEAP16 = _HEAP16;
+ HEAP32 = _HEAP32;
+ HEAPU8 = _HEAPU8;
+ HEAPU16 = _HEAPU16;
+ HEAPU32 = _HEAPU32;
+ HEAPF32 = _HEAPF32;
+ HEAPF64 = _HEAPF64;
+ },
+ // this function is inside the asm block, but prevents validation as asm.js
+ // the codebase still benefits from being in the general asm.js shape,
+ // but should not declare itself as validating (which is prevented in ASM_JS == 2).
+ {{{ (assert(ASM_JS === 2), DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push('emscripten_replace_memory'), '') }}}
+#endif
+#endif
+
//============================
// emscripten vector ops
//============================