@@ -110,12 +110,6 @@ function integrateWasmJS(Module) {
110
110
newView . set ( oldView ) ;
111
111
updateGlobalBuffer ( newBuffer ) ;
112
112
updateGlobalBufferViews ( ) ;
113
- Module [ 'reallocBuffer '] = function ( size ) {
114
- size = Math . ceil ( size / wasmPageSize ) * wasmPageSize ; // round up to wasm page size
115
- var old = Module [ 'buffer' ] ;
116
- exports [ '__growWasmMemory' ] ( size / wasmPageSize ) ; // tiny wasm method that just does grow_memory
117
- return Module [ 'buffer' ] !== old ? Module [ 'buffer' ] : null ; // if it was reallocated, it changed
118
- } ;
119
113
}
120
114
121
115
var WasmTypes = {
@@ -264,6 +258,14 @@ function integrateWasmJS(Module) {
264
258
// We may have a preloaded value in Module.asm, save it
265
259
Module [ 'asmPreload '] = Module [ 'asm' ] ;
266
260
261
+ // Memory growth integration code
262
+ Module [ 'reallocBuffer' ] = function ( size ) {
263
+ size = Math . ceil ( size / wasmPageSize ) * wasmPageSize ; // round up to wasm page size
264
+ var old = Module [ 'buffer' ] ;
265
+ exports [ '__growWasmMemory' ] ( size / wasmPageSize ) ; // tiny wasm method that just does grow_memory
266
+ return Module [ 'buffer' ] !== old ? Module [ 'buffer' ] : null ; // if it was reallocated, it changed
267
+ } ;
268
+
267
269
// Provide an "asm.js function" for the application, called to "link" the asm.js module. We instantiate
268
270
// the wasm module at that time, and it receives imports and provides exports and so forth, the app
269
271
// doesn't need to care that it is wasm or olyfilled wasm or asm.js.
0 commit comments