From 2a935b64dde22671644c4712d0f45e8df60f94eb Mon Sep 17 00:00:00 2001
From: Sam Clegg <sbc@chromium.org>
Date: Wed, 30 Sep 2020 17:21:51 -0700
Subject: wasm2js: override incoming memory's grow method (#3185)

This will allow for the completely removal of
`__growWasmMemory` as a followup.  We currently
unconditionally generate this function
in `generateMemoryGrowthFunction`.

See #3180
---
 test/wasm2js/minified-memory.2asm.js.opt | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'test/wasm2js/minified-memory.2asm.js.opt')

diff --git a/test/wasm2js/minified-memory.2asm.js.opt b/test/wasm2js/minified-memory.2asm.js.opt
index 1e79d3202..2a09422ec 100644
--- a/test/wasm2js/minified-memory.2asm.js.opt
+++ b/test/wasm2js/minified-memory.2asm.js.opt
@@ -1,6 +1,8 @@
 
-function asmFunc(global, env, buffer) {
+function asmFunc(global, env) {
  var memory = env.a;
+ var buffer = memory.buffer;
+ memory.grow = __wasm_memory_grow;
  var HEAP8 = new global.Int8Array(buffer);
  var HEAP16 = new global.Int16Array(buffer);
  var HEAP32 = new global.Int32Array(buffer);
@@ -72,8 +74,7 @@ var retasmFunc = asmFunc({
     NaN,
     Infinity
   }, {
-    abort: function() { throw new Error('abort'); }
-  },
-  memasmFunc
-);
+    abort: function() { throw new Error('abort'); },
+    a: { buffer : memasmFunc }
+  });
 export var foo = retasmFunc.foo;
-- 
cgit v1.2.3