summaryrefslogtreecommitdiff
path: root/src/js/wasm.js-post.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/wasm.js-post.js')
-rw-r--r--src/js/wasm.js-post.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/js/wasm.js-post.js b/src/js/wasm.js-post.js
index 5a1de4c9e..05c648ed0 100644
--- a/src/js/wasm.js-post.js
+++ b/src/js/wasm.js-post.js
@@ -110,12 +110,6 @@ function integrateWasmJS(Module) {
newView.set(oldView);
updateGlobalBuffer(newBuffer);
updateGlobalBufferViews();
- Module['reallocBuffer'] = function(size) {
- size = Math.ceil(size / wasmPageSize) * wasmPageSize; // round up to wasm page size
- var old = Module['buffer'];
- exports['__growWasmMemory'](size / wasmPageSize); // tiny wasm method that just does grow_memory
- return Module['buffer'] !== old ? Module['buffer'] : null; // if it was reallocated, it changed
- };
}
var WasmTypes = {
@@ -264,6 +258,14 @@ function integrateWasmJS(Module) {
// We may have a preloaded value in Module.asm, save it
Module['asmPreload'] = Module['asm'];
+ // Memory growth integration code
+ Module['reallocBuffer'] = function(size) {
+ size = Math.ceil(size / wasmPageSize) * wasmPageSize; // round up to wasm page size
+ var old = Module['buffer'];
+ exports['__growWasmMemory'](size / wasmPageSize); // tiny wasm method that just does grow_memory
+ return Module['buffer'] !== old ? Module['buffer'] : null; // if it was reallocated, it changed
+ };
+
// Provide an "asm.js function" for the application, called to "link" the asm.js module. We instantiate
// the wasm module at that time, and it receives imports and provides exports and so forth, the app
// doesn't need to care that it is wasm or olyfilled wasm or asm.js.