Bug 1466464 - rename grow_memory and current_memory. r=bbouvier
authorLars T Hansen <lhansen@mozilla.com>
Thu, 14 Feb 2019 18:05:17 +0100
changeset 459746 412fb2a5ae54cebfbcfe8ab7a4cd544c3bfad9e5
parent 459745 ac7e1f872d25d9c9e74b0bc2d3b5c26e7cd5daeb
child 459747 c7065bf19f4a08ceedf8a19c98366b019ff9844f
push id35571
push usercsabou@mozilla.com
push dateMon, 18 Feb 2019 15:52:47 +0000
treeherdermozilla-central@0e9d5fd6ff74 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1466464
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466464 - rename grow_memory and current_memory. r=bbouvier Rename the uses of current_memory and grow_memory in wasm text content as memory.size and memory.grow, since these are canonical. Rename GrowMemory as MemoryGrow and CurrentMemory as MemorySize everywhere in C++ source code, in honor of their new .wat names -- consistency is good. I chose "Memory" over "Mem" because I like the longer name better, and I think we should rename uses of "Mem" as "Memory" (but not in this patch). Also handle some similar cases, like the growMemory_i32 and currentMemory_i32 Instance methods. Note a couple of changes in cranelift. I did not remove support for the old .wat names yet, I figure we can do that some other year, if ever. Differential Revision: https://phabricator.services.mozilla.com/D19816
js/src/jit-test/tests/wasm/baseline-abs-addr-opt.js
js/src/jit-test/tests/wasm/bench/wasm_box2d.js
js/src/jit-test/tests/wasm/big-resize.js
js/src/jit-test/tests/wasm/gc/anyref.js
js/src/jit-test/tests/wasm/import-export.js
js/src/jit-test/tests/wasm/memory-cloning.js
js/src/jit-test/tests/wasm/memory-sharing.js
js/src/jit-test/tests/wasm/profiling.js
js/src/jit-test/tests/wasm/regress/bug1300546.js
js/src/jit-test/tests/wasm/regress/current-memory-tls.js
js/src/jit-test/tests/wasm/resizing.js
js/src/jit-test/tests/wasm/tables.js
js/src/jit-test/tests/wasm/validate.js
js/src/wasm/WasmAST.h
js/src/wasm/WasmBaselineCompile.cpp
js/src/wasm/WasmBuiltins.cpp
js/src/wasm/WasmConstants.h
js/src/wasm/WasmCraneliftCompile.cpp
js/src/wasm/WasmFrameIter.cpp
js/src/wasm/WasmInstance.cpp
js/src/wasm/WasmInstance.h
js/src/wasm/WasmIonCompile.cpp
js/src/wasm/WasmOpIter.cpp
js/src/wasm/WasmOpIter.h
js/src/wasm/WasmTextToBinary.cpp
js/src/wasm/WasmTypes.h
js/src/wasm/WasmValidate.cpp
js/src/wasm/cranelift/baldrapi.h
js/src/wasm/cranelift/src/wasm2clif.rs
--- a/js/src/jit-test/tests/wasm/baseline-abs-addr-opt.js
+++ b/js/src/jit-test/tests/wasm/baseline-abs-addr-opt.js
@@ -22,17 +22,17 @@ function gen(base, offset) {
 // Memory is two pages but minimum memory is one page, so accesses across
 // the end of the first page should succeed.
 
 function gen2(base, offset) {
   return wasmEvalText(`(module
 			(memory 1)
 			(data (i32.const 65528) "aaaaaaaa")
 			(func (result i32)
-			 (drop (grow_memory (i32.const 1)))
+			 (drop (memory.grow (i32.const 1)))
 			 (i32.store (i32.const 65536) (i32.const 0x61616161))
 			 (i32.store (i32.const 65540) (i32.const 0x61616161))
 			 (i32.store (i32.const 80000) (i32.const 0x61616161))
 			 (i32.store (i32.const 120000) (i32.const 0x61616161))
 			 (i32.load offset=${offset} (i32.const ${base})))
 			(export "f" 0))`).exports["f"];
 }
 
--- a/js/src/jit-test/tests/wasm/bench/wasm_box2d.js
+++ b/js/src/jit-test/tests/wasm/bench/wasm_box2d.js
@@ -1536,17 +1536,17 @@ function integrateWasmJS(Module) {
           return Module['buffer'] = Module['wasmMemory'].buffer;
         } else {
           return null;
         }
       } catch(e) {
         return null;
       }
     } else {
-      exports['__growWasmMemory']((size - oldSize) / wasmPageSize); // tiny wasm method that just does grow_memory
+      exports['__growWasmMemory']((size - oldSize) / wasmPageSize); // tiny wasm method that just does memory.grow
       // in interpreter, we replace Module.buffer if we allocate
       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.
--- a/js/src/jit-test/tests/wasm/big-resize.js
+++ b/js/src/jit-test/tests/wasm/big-resize.js
@@ -1,8 +1,8 @@
 wasmFullPass(`(module
     (memory 1 32768)
     (func $test (result i32)
-        (if (i32.eq (grow_memory (i32.const 16384)) (i32.const -1)) (return (i32.const 42)))
+        (if (i32.eq (memory.grow (i32.const 16384)) (i32.const -1)) (return (i32.const 42)))
         (i32.store (i32.const 1073807356) (i32.const 42))
         (i32.load (i32.const 1073807356)))
     (export "run" $test)
 )`, 42);
--- a/js/src/jit-test/tests/wasm/gc/anyref.js
+++ b/js/src/jit-test/tests/wasm/gc/anyref.js
@@ -155,19 +155,19 @@ assertEq(ref.calories, baguette.calories
 
 // Make sure grow-memory isn't blocked by the lack of gc.
 (function() {
     assertEq(wasmEvalText(`(module
     (gc_feature_opt_in 2)
     (memory 0 64)
     (func (export "f") (param anyref) (result i32)
         i32.const 10
-        grow_memory
+        memory.grow
         drop
-        current_memory
+        memory.size
     )
 )`).exports.f({}), 10);
 })();
 
 // More interesting use cases about control flow joins.
 
 function assertJoin(body) {
     let val = { i: -1 };
--- a/js/src/jit-test/tests/wasm/import-export.js
+++ b/js/src/jit-test/tests/wasm/import-export.js
@@ -725,43 +725,43 @@ assertEq(e.call(), 1090);
     assertErrorMessage(() => i.missTwo(1337), Error, "a FFI to believe in");
 })();
 
 (function testCrossRealmImport() {
     var g = newGlobal({sameCompartmentAs: this});
     g.evaluate("function f1() { assertCorrectRealm(); return 123; }");
     g.mem = new Memory({initial:8});
 
-    // The current_memory builtin asserts cx->realm matches instance->realm so
+    // The memory.size builtin asserts cx->realm matches instance->realm so
     // we call it here.
     var i1 = new Instance(new Module(wasmTextToBinary(`
         (module
             (import $imp1 "a" "f1" (result i32))
             (import $imp2 "a" "f2" (result i32))
             (import "a" "m" (memory 1))
             (func $test (result i32)
                 (i32.add
                     (i32.add
-                        (i32.add (current_memory) (call $imp1))
-                        (current_memory))
+                        (i32.add (memory.size) (call $imp1))
+                        (memory.size))
                     (call $imp2)))
             (export "impstub" $imp1)
             (export "test" $test))
     `)), {a:{m:g.mem, f1:g.f1, f2:g.Math.abs}});
 
     for (var i = 0; i < 20; i++) {
         assertEq(i1.exports.impstub(), 123);
         assertEq(i1.exports.test(), 139);
     }
 
     // Inter-module/inter-realm wasm => wasm calls.
     var src = `
         (module
             (import $imp "a" "othertest" (result i32))
             (import "a" "m" (memory 1))
-            (func (result i32) (i32.add (call $imp) (current_memory)))
+            (func (result i32) (i32.add (call $imp) (memory.size)))
             (export "test" 1))
     `;
     g.i1 = i1;
     g.evaluate("i2 = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`" + src + "`)), {a:{m:mem,othertest:i1.exports.test}})");
     for (var i = 0; i < 20; i++)
         assertEq(g.i2.exports.test(), 147);
 })();
--- a/js/src/jit-test/tests/wasm/memory-cloning.js
+++ b/js/src/jit-test/tests/wasm/memory-cloning.js
@@ -50,17 +50,17 @@
 			      {"": {memory: mem2}}).exports.l;
 
     // initially mem2 cannot be accessed at index
     assertErrorMessage(access, WebAssembly.RuntimeError, /out of bounds/);
 
     // then we grow mem1
     wasmEvalText(`(module
 		   (memory (import "" "memory") 2 4 shared)
-		   (func (export "g") (drop (grow_memory (i32.const 1)))))`,
+		   (func (export "g") (drop (memory.grow (i32.const 1)))))`,
 		 {"": {memory: mem1}}).exports.g();
 
     // after growing mem1, mem2 can be accessed at index
     assertEq(access(), 0);
 }
 
 // Should not be possible to transfer a shared memory
 
--- a/js/src/jit-test/tests/wasm/memory-sharing.js
+++ b/js/src/jit-test/tests/wasm/memory-sharing.js
@@ -124,35 +124,35 @@ const WASMPAGE = 65536;
     // max > declared max
     let mem5 = new WebAssembly.Memory({initial: 2, maximum: 8, shared: true});
     assertErrorMessage(() => new WebAssembly.Instance(mod, {"": {memory: mem5}}),
 		       WebAssembly.LinkError,
 		       /imported Memory with incompatible maximum size/);
 }
 
 
-// basic current_memory and grow_memory operation, with bounds checking near the
+// basic memory.size and memory.grow operation, with bounds checking near the
 // valid/invalid boundary
 
 {
     let text = `(module
 		 (memory (export "memory") 2 4 shared)
-		 (func (export "c") (result i32) current_memory)
-		 (func (export "g") (result i32) (grow_memory (i32.const 1)))
+		 (func (export "c") (result i32) memory.size)
+		 (func (export "g") (result i32) (memory.grow (i32.const 1)))
 		 (func (export "l") (param i32) (result i32) (i32.load (get_local 0)))
 		 (func (export "s") (param i32) (param i32) (i32.store (get_local 0) (get_local 1))))`;
     let mod = new WebAssembly.Module(wasmTextToBinary(text));
     let ins = new WebAssembly.Instance(mod);
     let exp = ins.exports;
     let mem = exp.memory;
 
     let b1 = mem.buffer;
     assertEq(exp.c(), 2);
     assertEq(b1.byteLength, WASMPAGE*2);
-    assertEq(mem.buffer === b1, true);   // current_memory does not affect buffer
+    assertEq(mem.buffer === b1, true);   // memory.size does not affect buffer
     exp.s(WASMPAGE*2-4, 0x12345678)	 // access near end
     assertEq(exp.l(WASMPAGE*2-4), 0x12345678);
     assertErrorMessage(() => exp.l(WASMPAGE*2), // beyond current end (but below max)
 		       WebAssembly.RuntimeError,
 		       /index out of bounds/);
     assertEq(exp.g(), 2);
     assertEq(b1.byteLength, WASMPAGE*2); // growing does not affect existing buffer length
     let b2 = mem.buffer;
--- a/js/src/jit-test/tests/wasm/profiling.js
+++ b/js/src/jit-test/tests/wasm/profiling.js
@@ -83,37 +83,37 @@ if (getBuildConfiguration()["arm-simulat
             )
         )`,
         this,
         ["", ">", "0,>", "<,0,>", `i64.${op},0,>`, "<,0,>", "0,>", ">", ""],
         );
     }
 }
 
-// current_memory is a callout.
+// memory.size is a callout.
 test(`(module
     (memory 1)
     (func (export "") (result i32)
-         current_memory
+         memory.size
     )
 )`,
 this,
-["", ">", "0,>", "<,0,>", "current_memory,0,>", "<,0,>", "0,>", ">", ""],
+["", ">", "0,>", "<,0,>", "memory.size,0,>", "<,0,>", "0,>", ">", ""],
 );
 
-// grow_memory is a callout.
+// memory.grow is a callout.
 test(`(module
     (memory 1)
     (func (export "") (result i32)
          i32.const 1
-         grow_memory
+         memory.grow
     )
 )`,
 this,
-["", ">", "0,>", "<,0,>", "grow_memory,0,>", "<,0,>", "0,>", ">", ""],
+["", ">", "0,>", "<,0,>", "memory.grow,0,>", "<,0,>", "0,>", ">", ""],
 );
 
 // A few math builtins.
 for (let type of ['f32', 'f64']) {
     for (let func of ['ceil', 'floor', 'nearest', 'trunc']) {
         test(`(module
             (func (export "") (param ${type}) (result ${type})
                 get_local 0
--- a/js/src/jit-test/tests/wasm/regress/bug1300546.js
+++ b/js/src/jit-test/tests/wasm/regress/bug1300546.js
@@ -1,23 +1,23 @@
 try {
     wasmEvalText(`
     (module
       (type $type0 (func))
       (func $func0
           (nop)
           (f64.load offset=59 align=1 (i32.const 0))
-          (current_memory)
-          (current_memory)
-          (current_memory)
-          (current_memory)
-          (current_memory)
-          (current_memory)
-          (current_memory)
-          (current_memory)
+          (memory.size)
+          (memory.size)
+          (memory.size)
+          (memory.size)
+          (memory.size)
+          (memory.size)
+          (memory.size)
+          (memory.size)
           (i64.rem_s (i64.const 17) (i64.xor (i64.const 17) (i64.xor (i64.const 17) (i64.xor (i64.xor (i64.const 17) (i64.const 17)) (i64.xor (i64.const 17) (i64.const 17))))))
 
          (i64.rem_s
           (i64.const 17)
           (i64.xor
             (i64.rem_s (i64.const 17) (i64.const 17))
             (i64.xor (i64.rem_s (i64.const 17) (i64.const 17)) (i64.xor (i64.const 17) (i64.const 17)))))
       )
--- a/js/src/jit-test/tests/wasm/regress/current-memory-tls.js
+++ b/js/src/jit-test/tests/wasm/regress/current-memory-tls.js
@@ -1,27 +1,27 @@
 // Bug 1341650:
-// - when compiled with Ion, pass the TLS register to current_memory;
+// - when compiled with Ion, pass the TLS register to memory.size;
 // - when compiled with Baseline, don't clobber the last stack slot when
-// calling into current_memory/grow_memory;
+// calling into memory.size/memory.grow;
 
 // This toy module starts with an empty memory, then tries to set values at different
 // indexes, automatically growing memory when that would trigger an out of
 // bounds access, for the exact right amount of pages. Note it's not made for
 // efficiency, but optimizing it doesn't trigger the bugs mentioned above.
 
 let i = new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`
 (module
     (memory $mem (export "mem") 0 65535)
 
-    (func (export "cur_mem") (result i32) (current_memory))
+    (func (export "cur_mem") (result i32) (memory.size))
 
     (func $maybeGrow (param $i i32) (local $smem i32)
-     ;; get current_memory in number of bytes, not pages.
-     current_memory
+     ;; get memory.size in number of bytes, not pages.
+     memory.size
      i64.extend_u/i32
      i64.const 65536
      i64.mul
 
      ;; get the last byte index accessed by an int32 access.
      get_local $i
      i32.const 3
      i32.add
@@ -34,28 +34,28 @@ let i = new WebAssembly.Instance(new Web
          ;; get the floor of the accessed *page* index.
          get_local $i
          i64.extend_u/i32
          i64.const 65536
          i64.div_u
 
          ;; subtract to that the size of the current memory in pages;
          ;; that's the amount of pages we want to grow, minus one.
-         current_memory
+         memory.size
          i64.extend_u/i32
 
          i64.sub
 
          ;; add 1 to that amount.
          i64.const 1
          i64.add
 
          ;; get back to i32 and grow memory.
          i32.wrap/i64
-         grow_memory
+         memory.grow
          drop
      end
     )
 
     (func (export "set") (param $i i32) (param $v i32)
      get_local $i
      call $maybeGrow
      get_local $i
--- a/js/src/jit-test/tests/wasm/resizing.js
+++ b/js/src/jit-test/tests/wasm/resizing.js
@@ -11,31 +11,31 @@ const RuntimeError = WebAssembly.Runtime
 // Test for stale heap pointers after resize
 
 // Grow directly from builtin call:
 wasmFullPass(`(module
     (memory 1)
     (func $test (result i32)
         (i32.store (i32.const 0) (i32.const 1))
         (i32.store (i32.const 65532) (i32.const 10))
-        (drop (grow_memory (i32.const 99)))
+        (drop (memory.grow (i32.const 99)))
         (i32.store (i32.const 6553596) (i32.const 100))
         (i32.add
             (i32.load (i32.const 0))
             (i32.add
                 (i32.load (i32.const 65532))
                 (i32.load (i32.const 6553596)))))
     (export "run" $test)
 )`, 111);
 
 // Grow during import call:
 var exports = wasmEvalText(`(module
     (import $imp "" "imp")
     (memory 1)
-    (func $grow (drop (grow_memory (i32.const 99))))
+    (func $grow (drop (memory.grow (i32.const 99))))
     (export "grow" $grow)
     (func $test (result i32)
         (i32.store (i32.const 0) (i32.const 1))
         (i32.store (i32.const 65532) (i32.const 10))
         (call $imp)
         (i32.store (i32.const 6553596) (i32.const 100))
         (i32.add
             (i32.load (i32.const 0))
@@ -52,17 +52,17 @@ for (var i = 0; i < 10; i++)
 
 // Grow during call_indirect:
 var mem = new Memory({initial:1});
 var tbl = new Table({initial:1, element:"anyfunc"});
 var exports1 = wasmEvalText(`(module
     (import "" "mem" (memory 1))
     (func $grow
         (i32.store (i32.const 65532) (i32.const 10))
-        (drop (grow_memory (i32.const 99)))
+        (drop (memory.grow (i32.const 99)))
         (i32.store (i32.const 6553596) (i32.const 100)))
     (export "grow" $grow)
 )`, {"":{mem}}).exports;
 var exports2 = wasmEvalText(`(module
     (import "" "tbl" (table 1 anyfunc))
     (import "" "mem" (memory 1))
     (type $v2v (func))
     (func $test (result i32)
@@ -79,19 +79,19 @@ tbl.set(0, exports1.grow);
 assertEq(exports2.test(), 111);
 
 // Test for coherent length/contents
 
 var mem = new Memory({initial:1});
 new Int32Array(mem.buffer)[0] = 42;
 var mod = new Module(wasmTextToBinary(`(module
     (import "" "mem" (memory 1))
-    (func $gm (param i32) (result i32) (grow_memory (get_local 0)))
+    (func $gm (param i32) (result i32) (memory.grow (get_local 0)))
     (export "grow_memory" $gm)
-    (func $cm (result i32) (current_memory))
+    (func $cm (result i32) (memory.size))
     (export "current_memory" $cm)
     (func $ld (param i32) (result i32) (i32.load (get_local 0)))
     (export "load" $ld)
     (func $st (param i32) (param i32) (i32.store (get_local 0) (get_local 1)))
     (export "store" $st)
 )`));
 var exp1 = new Instance(mod, {"":{mem}}).exports;
 var exp2 = new Instance(mod, {"":{mem}}).exports;
--- a/js/src/jit-test/tests/wasm/tables.js
+++ b/js/src/jit-test/tests/wasm/tables.js
@@ -200,35 +200,35 @@ assertErrorMessage(() => call(7), Runtim
 var tbl = wasmEvalText(`(module (table (export "tbl") anyfunc (elem $f)) (func $f))`).exports.tbl;
 tbl.get(0).foo = 42;
 gc();
 assertEq(tbl.get(0).foo, 42);
 
 (function testCrossRealmCall() {
     var g = newGlobal({sameCompartmentAs: this});
 
-    // The current_memory builtin asserts cx->realm matches instance->realm so
+    // The memory.size builtin asserts cx->realm matches instance->realm so
     // we call it here.
     var src = `
         (module
             (import "a" "t" (table 3 anyfunc))
             (import "a" "m" (memory 1))
-            (func $f (result i32) (i32.add (i32.const 3) (current_memory)))
+            (func $f (result i32) (i32.add (i32.const 3) (memory.size)))
             (elem (i32.const 0) $f))
     `;
     g.mem = new Memory({initial:4});
     g.tbl = new Table({initial:3, element:"anyfunc"});
     var i1 = g.evaluate("new WebAssembly.Instance(new WebAssembly.Module(wasmTextToBinary(`" + src + "`)), {a:{t:tbl,m:mem}})");
 
     var call = new Instance(new Module(wasmTextToBinary(`
         (module
             (import "a" "t" (table 3 anyfunc))
             (import "a" "m" (memory 1))
             (type $v2i (func (result i32)))
-            (func $call (param $i i32) (result i32) (i32.add (call_indirect $v2i (get_local $i)) (current_memory)))
+            (func $call (param $i i32) (result i32) (i32.add (call_indirect $v2i (get_local $i)) (memory.size)))
             (export "call" $call))
     `)), {a:{t:g.tbl,m:g.mem}}).exports.call;
 
     for (var i = 0; i < 10; i++)
         assertEq(call(0), 11);
 })();
 
 
--- a/js/src/jit-test/tests/wasm/validate.js
+++ b/js/src/jit-test/tests/wasm/validate.js
@@ -14,10 +14,10 @@ assertErrorMessage(() => validate(Symbol
 assertErrorMessage(() => validate({ valueOf: () => new ArrayBuffer(65536) }), Error, argError);
 
 assertEq(validate(wasmTextToBinary(`(module)`)), true);
 
 assertEq(validate(wasmTextToBinary(`(module (export "run" 0))`)), false);
 assertEq(validate(wasmTextToBinary(`(module (func) (export "run" 0))`)), true);
 
 // Feature-testing proof-of-concept.
-assertEq(validate(wasmTextToBinary(`(module (memory 1) (func (result i32) (current_memory)))`)), true);
-assertEq(validate(wasmTextToBinary(`(module (memory 1) (func (result i32) (grow_memory (i32.const 42))))`)), true);
+assertEq(validate(wasmTextToBinary(`(module (memory 1) (func (result i32) (memory.size)))`)), true);
+assertEq(validate(wasmTextToBinary(`(module (memory 1) (func (result i32) (memory.grow (i32.const 42))))`)), true);
--- a/js/src/wasm/WasmAST.h
+++ b/js/src/wasm/WasmAST.h
@@ -391,49 +391,51 @@ enum class AstExprKind {
   Block,
   Branch,
   BranchTable,
   Call,
   CallIndirect,
   ComparisonOperator,
   Const,
   ConversionOperator,
-  CurrentMemory,
+#ifdef ENABLE_WASM_BULKMEM_OPS
+  DataOrElemDrop,
+#endif
   Drop,
   ExtraConversionOperator,
   First,
   GetGlobal,
   GetLocal,
-  GrowMemory,
   If,
   Load,
 #ifdef ENABLE_WASM_BULKMEM_OPS
+  MemFill,
   MemOrTableCopy,
-  DataOrElemDrop,
-  MemFill,
   MemOrTableInit,
 #endif
+  MemoryGrow,
+  MemorySize,
+  Nop,
+  Pop,
+  RefNull,
+  Return,
+  SetGlobal,
+  SetLocal,
+#ifdef ENABLE_WASM_GC
+  StructNew,
+  StructGet,
+  StructSet,
+  StructNarrow,
+#endif
 #ifdef ENABLE_WASM_GENERALIZED_TABLES
   TableGet,
   TableGrow,
   TableSet,
   TableSize,
 #endif
-#ifdef ENABLE_WASM_GC
-  StructNew,
-  StructGet,
-  StructSet,
-  StructNarrow,
-#endif
-  Nop,
-  Pop,
-  RefNull,
-  Return,
-  SetGlobal,
-  SetLocal,
   TeeLocal,
   Store,
   TernaryOperator,
   UnaryOperator,
   Unreachable,
   Wait,
   Wake
 };
@@ -1043,28 +1045,28 @@ class AstStructNarrow : public AstExpr {
         outputStruct_(outputStruct),
         ptr_(ptr) {}
   AstValType& inputStruct() { return inputStruct_; }
   AstValType& outputStruct() { return outputStruct_; }
   AstExpr& ptr() const { return *ptr_; }
 };
 #endif
 
-class AstCurrentMemory final : public AstExpr {
+class AstMemorySize final : public AstExpr {
  public:
-  static const AstExprKind Kind = AstExprKind::CurrentMemory;
-  explicit AstCurrentMemory() : AstExpr(Kind, ExprType::I32) {}
+  static const AstExprKind Kind = AstExprKind::MemorySize;
+  explicit AstMemorySize() : AstExpr(Kind, ExprType::I32) {}
 };
 
-class AstGrowMemory final : public AstExpr {
+class AstMemoryGrow final : public AstExpr {
   AstExpr* operand_;
 
  public:
-  static const AstExprKind Kind = AstExprKind::GrowMemory;
-  explicit AstGrowMemory(AstExpr* operand)
+  static const AstExprKind Kind = AstExprKind::MemoryGrow;
+  explicit AstMemoryGrow(AstExpr* operand)
       : AstExpr(Kind, ExprType::I32), operand_(operand) {}
 
   AstExpr* operand() const { return operand_; }
 };
 
 class AstBranchTable : public AstExpr {
   AstExpr& index_;
   AstRef default_;
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -6875,18 +6875,18 @@ class BaseCompiler final : public BaseCo
 #endif
   void emitReinterpretI32AsF32();
   void emitReinterpretI64AsF64();
   void emitRound(RoundingMode roundingMode, ValType operandType);
   MOZ_MUST_USE bool emitInstanceCall(uint32_t lineOrBytecode,
                                      const MIRTypeVector& sig, ExprType retType,
                                      SymbolicAddress builtin,
                                      bool pushReturnedValue = true);
-  MOZ_MUST_USE bool emitGrowMemory();
-  MOZ_MUST_USE bool emitCurrentMemory();
+  MOZ_MUST_USE bool emitMemoryGrow();
+  MOZ_MUST_USE bool emitMemorySize();
 
   MOZ_MUST_USE bool emitRefNull();
   void emitRefIsNull();
 
   MOZ_MUST_USE bool emitAtomicCmpXchg(ValType type, Scalar::Type viewType);
   MOZ_MUST_USE bool emitAtomicLoad(ValType type, Scalar::Type viewType);
   MOZ_MUST_USE bool emitAtomicRMW(ValType type, Scalar::Type viewType,
                                   AtomicOp op);
@@ -9829,45 +9829,45 @@ bool BaseCompiler::emitInstanceCall(uint
 
   if (pushReturnedValue) {
     MOZ_ASSERT(retType != ExprType::Void);
     pushReturnValueOfCall(baselineCall, retType);
   }
   return true;
 }
 
-bool BaseCompiler::emitGrowMemory() {
+bool BaseCompiler::emitMemoryGrow() {
   uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
 
   Nothing arg;
-  if (!iter_.readGrowMemory(&arg)) {
+  if (!iter_.readMemoryGrow(&arg)) {
     return false;
   }
 
   if (deadCode_) {
     return true;
   }
 
   return emitInstanceCall(lineOrBytecode, SigPI_, ExprType::I32,
-                          SymbolicAddress::GrowMemory);
-}
-
-bool BaseCompiler::emitCurrentMemory() {
+                          SymbolicAddress::MemoryGrow);
+}
+
+bool BaseCompiler::emitMemorySize() {
   uint32_t lineOrBytecode = readCallSiteLineOrBytecode();
 
-  if (!iter_.readCurrentMemory()) {
+  if (!iter_.readMemorySize()) {
     return false;
   }
 
   if (deadCode_) {
     return true;
   }
 
   return emitInstanceCall(lineOrBytecode, SigP_, ExprType::I32,
-                          SymbolicAddress::CurrentMemory);
+                          SymbolicAddress::MemorySize);
 }
 
 bool BaseCompiler::emitRefNull() {
   if (!iter_.readRefNull()) {
     return false;
   }
 
   if (deadCode_) {
@@ -11486,20 +11486,20 @@ bool BaseCompiler::emitBody() {
       case uint16_t(Op::I64Extend16S):
         CHECK_NEXT(
             emitConversion(emitExtendI64_16, ValType::I64, ValType::I64));
       case uint16_t(Op::I64Extend32S):
         CHECK_NEXT(
             emitConversion(emitExtendI64_32, ValType::I64, ValType::I64));
 
       // Memory Related
-      case uint16_t(Op::GrowMemory):
-        CHECK_NEXT(emitGrowMemory());
-      case uint16_t(Op::CurrentMemory):
-        CHECK_NEXT(emitCurrentMemory());
+      case uint16_t(Op::MemoryGrow):
+        CHECK_NEXT(emitMemoryGrow());
+      case uint16_t(Op::MemorySize):
+        CHECK_NEXT(emitMemorySize());
 
 #ifdef ENABLE_WASM_GC
       case uint16_t(Op::RefEq):
         if (!env_.gcTypesEnabled()) {
           return iter_.unrecognizedOpcode(&op);
         }
         CHECK_NEXT(
             emitComparison(emitCompareRef, ValType::AnyRef, Assembler::Equal));
--- a/js/src/wasm/WasmBuiltins.cpp
+++ b/js/src/wasm/WasmBuiltins.cpp
@@ -616,22 +616,22 @@ void* wasm::AddressOf(SymbolicAddress im
       *abiType = Args_Double_Double;
       return FuncCast<double(double)>(fdlibm::log, *abiType);
     case SymbolicAddress::PowD:
       *abiType = Args_Double_DoubleDouble;
       return FuncCast(ecmaPow, *abiType);
     case SymbolicAddress::ATan2D:
       *abiType = Args_Double_DoubleDouble;
       return FuncCast(ecmaAtan2, *abiType);
-    case SymbolicAddress::GrowMemory:
+    case SymbolicAddress::MemoryGrow:
       *abiType = Args_General2;
-      return FuncCast(Instance::growMemory_i32, *abiType);
-    case SymbolicAddress::CurrentMemory:
+      return FuncCast(Instance::memoryGrow_i32, *abiType);
+    case SymbolicAddress::MemorySize:
       *abiType = Args_General1;
-      return FuncCast(Instance::currentMemory_i32, *abiType);
+      return FuncCast(Instance::memorySize_i32, *abiType);
     case SymbolicAddress::WaitI32:
       *abiType = Args_Int_GeneralGeneralGeneralInt64;
       return FuncCast(Instance::wait_i32, *abiType);
     case SymbolicAddress::WaitI64:
       *abiType = Args_Int_GeneralGeneralInt64Int64;
       return FuncCast(Instance::wait_i64, *abiType);
     case SymbolicAddress::Wake:
       *abiType = Args_General3;
@@ -762,18 +762,18 @@ bool wasm::NeedsBuiltinThunk(SymbolicAdd
     case SymbolicAddress::TruncD:
     case SymbolicAddress::TruncF:
     case SymbolicAddress::NearbyIntD:
     case SymbolicAddress::NearbyIntF:
     case SymbolicAddress::ExpD:
     case SymbolicAddress::LogD:
     case SymbolicAddress::PowD:
     case SymbolicAddress::ATan2D:
-    case SymbolicAddress::GrowMemory:
-    case SymbolicAddress::CurrentMemory:
+    case SymbolicAddress::MemoryGrow:
+    case SymbolicAddress::MemorySize:
     case SymbolicAddress::WaitI32:
     case SymbolicAddress::WaitI64:
     case SymbolicAddress::Wake:
     case SymbolicAddress::CoerceInPlace_JitEntry:
     case SymbolicAddress::ReportInt64JSCall:
     case SymbolicAddress::MemCopy:
     case SymbolicAddress::DataDrop:
     case SymbolicAddress::MemFill:
--- a/js/src/wasm/WasmConstants.h
+++ b/js/src/wasm/WasmConstants.h
@@ -192,18 +192,18 @@ enum class Op {
   I64Store = 0x37,
   F32Store = 0x38,
   F64Store = 0x39,
   I32Store8 = 0x3a,
   I32Store16 = 0x3b,
   I64Store8 = 0x3c,
   I64Store16 = 0x3d,
   I64Store32 = 0x3e,
-  CurrentMemory = 0x3f,
-  GrowMemory = 0x40,
+  MemorySize = 0x3f,
+  MemoryGrow = 0x40,
 
   // Constants
   I32Const = 0x41,
   I64Const = 0x42,
   F32Const = 0x43,
   F64Const = 0x44,
 
   // Comparison operators
--- a/js/src/wasm/WasmCraneliftCompile.cpp
+++ b/js/src/wasm/WasmCraneliftCompile.cpp
@@ -35,20 +35,20 @@ bool wasm::CraneliftCanCompile() {
   return true;
 #else
   return false;
 #endif
 }
 
 static inline SymbolicAddress ToSymbolicAddress(BD_SymbolicAddress bd) {
   switch (bd) {
-    case BD_SymbolicAddress::GrowMemory:
-      return SymbolicAddress::GrowMemory;
-    case BD_SymbolicAddress::CurrentMemory:
-      return SymbolicAddress::CurrentMemory;
+    case BD_SymbolicAddress::MemoryGrow:
+      return SymbolicAddress::MemoryGrow;
+    case BD_SymbolicAddress::MemorySize:
+      return SymbolicAddress::MemorySize;
     case BD_SymbolicAddress::FloorF32:
       return SymbolicAddress::FloorF;
     case BD_SymbolicAddress::FloorF64:
       return SymbolicAddress::FloorD;
     case BD_SymbolicAddress::CeilF32:
       return SymbolicAddress::CeilF;
     case BD_SymbolicAddress::CeilF64:
       return SymbolicAddress::CeilD;
--- a/js/src/wasm/WasmFrameIter.cpp
+++ b/js/src/wasm/WasmFrameIter.cpp
@@ -1328,20 +1328,20 @@ static const char* ThunkedNativeToDescri
     case SymbolicAddress::ExpD:
       return "call to asm.js native f64 Math.exp";
     case SymbolicAddress::LogD:
       return "call to asm.js native f64 Math.log";
     case SymbolicAddress::PowD:
       return "call to asm.js native f64 Math.pow";
     case SymbolicAddress::ATan2D:
       return "call to asm.js native f64 Math.atan2";
-    case SymbolicAddress::GrowMemory:
-      return "call to native grow_memory (in wasm)";
-    case SymbolicAddress::CurrentMemory:
-      return "call to native current_memory (in wasm)";
+    case SymbolicAddress::MemoryGrow:
+      return "call to native memory.grow (in wasm)";
+    case SymbolicAddress::MemorySize:
+      return "call to native memory.size (in wasm)";
     case SymbolicAddress::WaitI32:
       return "call to native i32.wait (in wasm)";
     case SymbolicAddress::WaitI64:
       return "call to native i64.wait (in wasm)";
     case SymbolicAddress::Wake:
       return "call to native wake (in wasm)";
     case SymbolicAddress::CoerceInPlace_JitEntry:
       return "out-of-line coercion for jit entry arguments (in wasm)";
--- a/js/src/wasm/WasmInstance.cpp
+++ b/js/src/wasm/WasmInstance.cpp
@@ -307,33 +307,33 @@ Instance::callImport_anyref(Instance* in
   if (!BoxAnyRef(cx, rval, &result)) {
     return false;
   }
   *(void**)argv = result.get().forCompiledCode();
   return true;
 }
 
 /* static */ uint32_t /* infallible */
-Instance::growMemory_i32(Instance* instance, uint32_t delta) {
+Instance::memoryGrow_i32(Instance* instance, uint32_t delta) {
   MOZ_ASSERT(!instance->isAsmJS());
 
   JSContext* cx = TlsContext.get();
   RootedWasmMemoryObject memory(cx, instance->memory_);
 
   uint32_t ret = WasmMemoryObject::grow(memory, delta, cx);
 
   // If there has been a moving grow, this Instance should have been notified.
   MOZ_RELEASE_ASSERT(instance->tlsData()->memoryBase ==
                      instance->memory_->buffer().dataPointerEither());
 
   return ret;
 }
 
 /* static */ uint32_t /* infallible */
-Instance::currentMemory_i32(Instance* instance) {
+Instance::memorySize_i32(Instance* instance) {
   // This invariant must hold when running Wasm code. Assert it here so we can
   // write tests for cross-realm calls.
   MOZ_ASSERT(TlsContext.get()->realm() == instance->realm());
 
   uint32_t byteLength = instance->memory()->volatileMemoryLength();
   MOZ_ASSERT(byteLength % wasm::PageSize == 0);
   return byteLength / wasm::PageSize;
 }
--- a/js/src/wasm/WasmInstance.h
+++ b/js/src/wasm/WasmInstance.h
@@ -178,18 +178,18 @@ class Instance {
 
  public:
   // Functions to be called directly from wasm code.
   static int32_t callImport_void(Instance*, int32_t, int32_t, uint64_t*);
   static int32_t callImport_i32(Instance*, int32_t, int32_t, uint64_t*);
   static int32_t callImport_i64(Instance*, int32_t, int32_t, uint64_t*);
   static int32_t callImport_f64(Instance*, int32_t, int32_t, uint64_t*);
   static int32_t callImport_anyref(Instance*, int32_t, int32_t, uint64_t*);
-  static uint32_t growMemory_i32(Instance* instance, uint32_t delta);
-  static uint32_t currentMemory_i32(Instance* instance);
+  static uint32_t memoryGrow_i32(Instance* instance, uint32_t delta);
+  static uint32_t memorySize_i32(Instance* instance);
   static int32_t wait_i32(Instance* instance, uint32_t byteOffset,
                           int32_t value, int64_t timeout);
   static int32_t wait_i64(Instance* instance, uint32_t byteOffset,
                           int64_t value, int64_t timeout);
   static int32_t wake(Instance* instance, uint32_t byteOffset, int32_t count);
   static int32_t memCopy(Instance* instance, uint32_t destByteOffset,
                          uint32_t srcByteOffset, uint32_t len);
   static int32_t dataDrop(Instance* instance, uint32_t segIndex);
--- a/js/src/wasm/WasmIonCompile.cpp
+++ b/js/src/wasm/WasmIonCompile.cpp
@@ -2538,62 +2538,62 @@ static bool EmitBinaryMathBuiltinCall(Fu
   if (!f.builtinCall(callee, lineOrBytecode, call, operandType, &def)) {
     return false;
   }
 
   f.iter().setResult(def);
   return true;
 }
 
-static bool EmitGrowMemory(FunctionCompiler& f) {
+static bool EmitMemoryGrow(FunctionCompiler& f) {
   uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode();
 
   CallCompileState args;
   if (!f.passInstance(&args)) {
     return false;
   }
 
   MDefinition* delta;
-  if (!f.iter().readGrowMemory(&delta)) {
+  if (!f.iter().readMemoryGrow(&delta)) {
     return false;
   }
 
   if (!f.passArg(delta, ValType::I32, &args)) {
     return false;
   }
 
   f.finishCall(&args);
 
   MDefinition* ret;
-  if (!f.builtinInstanceMethodCall(SymbolicAddress::GrowMemory, lineOrBytecode,
+  if (!f.builtinInstanceMethodCall(SymbolicAddress::MemoryGrow, lineOrBytecode,
                                    args, ValType::I32, &ret)) {
     return false;
   }
 
   f.iter().setResult(ret);
   return true;
 }
 
-static bool EmitCurrentMemory(FunctionCompiler& f) {
+static bool EmitMemorySize(FunctionCompiler& f) {
   uint32_t lineOrBytecode = f.readCallSiteLineOrBytecode();
 
   CallCompileState args;
 
-  if (!f.iter().readCurrentMemory()) {
+  if (!f.iter().readMemorySize()) {
     return false;
   }
 
   if (!f.passInstance(&args)) {
     return false;
   }
 
   f.finishCall(&args);
 
   MDefinition* ret;
-  if (!f.builtinInstanceMethodCall(SymbolicAddress::CurrentMemory,
+  if (!f.builtinInstanceMethodCall(SymbolicAddress::MemorySize,
                                    lineOrBytecode, args, ValType::I32, &ret)) {
     return false;
   }
 
   f.iter().setResult(ret);
   return true;
 }
 
@@ -3208,20 +3208,20 @@ static bool EmitBodyExprs(FunctionCompil
       case uint16_t(Op::I32Store16):
         CHECK(EmitStore(f, ValType::I32, Scalar::Int16));
       case uint16_t(Op::I64Store8):
         CHECK(EmitStore(f, ValType::I64, Scalar::Int8));
       case uint16_t(Op::I64Store16):
         CHECK(EmitStore(f, ValType::I64, Scalar::Int16));
       case uint16_t(Op::I64Store32):
         CHECK(EmitStore(f, ValType::I64, Scalar::Int32));
-      case uint16_t(Op::CurrentMemory):
-        CHECK(EmitCurrentMemory(f));
-      case uint16_t(Op::GrowMemory):
-        CHECK(EmitGrowMemory(f));
+      case uint16_t(Op::MemorySize):
+        CHECK(EmitMemorySize(f));
+      case uint16_t(Op::MemoryGrow):
+        CHECK(EmitMemoryGrow(f));
 
       // Constants
       case uint16_t(Op::I32Const):
         CHECK(EmitI32Const(f));
       case uint16_t(Op::I64Const):
         CHECK(EmitI64Const(f));
       case uint16_t(Op::F32Const):
         CHECK(EmitF32Const(f));
--- a/js/src/wasm/WasmOpIter.cpp
+++ b/js/src/wasm/WasmOpIter.cpp
@@ -261,20 +261,20 @@ OpKind wasm::Classify(OpBytes op) {
       // Accept Limit, for use in decoding the end of a function after the body.
       return OpKind::Return;
     case Op::If:
       return OpKind::If;
     case Op::Else:
       return OpKind::Else;
     case Op::End:
       return OpKind::End;
-    case Op::CurrentMemory:
-      return OpKind::CurrentMemory;
-    case Op::GrowMemory:
-      return OpKind::GrowMemory;
+    case Op::MemorySize:
+      return OpKind::MemorySize;
+    case Op::MemoryGrow:
+      return OpKind::MemoryGrow;
     case Op::RefNull:
       WASM_REF_OP(OpKind::RefNull);
     case Op::RefIsNull:
       WASM_REF_OP(OpKind::Conversion);
     case Op::RefEq:
       WASM_GC_OP(OpKind::Comparison);
     case Op::MiscPrefix: {
       switch (MiscOp(op.b1)) {
--- a/js/src/wasm/WasmOpIter.h
+++ b/js/src/wasm/WasmOpIter.h
@@ -126,18 +126,18 @@ enum class OpKind {
   Nop,
   Unary,
   Binary,
   Comparison,
   Conversion,
   Load,
   Store,
   TeeStore,
-  CurrentMemory,
-  GrowMemory,
+  MemorySize,
+  MemoryGrow,
   Select,
   GetLocal,
   SetLocal,
   TeeLocal,
   GetGlobal,
   SetGlobal,
   TeeGlobal,
   Call,
@@ -411,18 +411,18 @@ class MOZ_STACK_CLASS OpIter : private P
   MOZ_MUST_USE bool readLoad(ValType resultType, uint32_t byteSize,
                              LinearMemoryAddress<Value>* addr);
   MOZ_MUST_USE bool readStore(ValType resultType, uint32_t byteSize,
                               LinearMemoryAddress<Value>* addr, Value* value);
   MOZ_MUST_USE bool readTeeStore(ValType resultType, uint32_t byteSize,
                                  LinearMemoryAddress<Value>* addr,
                                  Value* value);
   MOZ_MUST_USE bool readNop();
-  MOZ_MUST_USE bool readCurrentMemory();
-  MOZ_MUST_USE bool readGrowMemory(Value* input);
+  MOZ_MUST_USE bool readMemorySize();
+  MOZ_MUST_USE bool readMemoryGrow(Value* input);
   MOZ_MUST_USE bool readSelect(StackType* type, Value* trueValue,
                                Value* falseValue, Value* condition);
   MOZ_MUST_USE bool readGetLocal(const ValTypeVector& locals, uint32_t* id);
   MOZ_MUST_USE bool readSetLocal(const ValTypeVector& locals, uint32_t* id,
                                  Value* value);
   MOZ_MUST_USE bool readTeeLocal(const ValTypeVector& locals, uint32_t* id,
                                  Value* value);
   MOZ_MUST_USE bool readGetGlobal(uint32_t* id);
@@ -1287,18 +1287,18 @@ inline bool OpIter<Policy>::readTeeStore
 template <typename Policy>
 inline bool OpIter<Policy>::readNop() {
   MOZ_ASSERT(Classify(op_) == OpKind::Nop);
 
   return true;
 }
 
 template <typename Policy>
-inline bool OpIter<Policy>::readCurrentMemory() {
-  MOZ_ASSERT(Classify(op_) == OpKind::CurrentMemory);
+inline bool OpIter<Policy>::readMemorySize() {
+  MOZ_ASSERT(Classify(op_) == OpKind::MemorySize);
 
   if (!env_.usesMemory()) {
     return fail("can't touch memory without memory");
   }
 
   uint8_t flags;
   if (!readFixedU8(&flags)) {
     return false;
@@ -1307,18 +1307,18 @@ inline bool OpIter<Policy>::readCurrentM
   if (flags != uint8_t(MemoryTableFlags::Default)) {
     return fail("unexpected flags");
   }
 
   return push(ValType::I32);
 }
 
 template <typename Policy>
-inline bool OpIter<Policy>::readGrowMemory(Value* input) {
-  MOZ_ASSERT(Classify(op_) == OpKind::GrowMemory);
+inline bool OpIter<Policy>::readMemoryGrow(Value* input) {
+  MOZ_ASSERT(Classify(op_) == OpKind::MemoryGrow);
 
   if (!env_.usesMemory()) {
     return fail("can't touch memory without memory");
   }
 
   uint8_t flags;
   if (!readFixedU8(&flags)) {
     return false;
--- a/js/src/wasm/WasmTextToBinary.cpp
+++ b/js/src/wasm/WasmTextToBinary.cpp
@@ -69,20 +69,20 @@ class WasmToken {
     BrIf,
     BrTable,
     Call,
     CallIndirect,
     CloseParen,
     ComparisonOpcode,
     Const,
     ConversionOpcode,
-    CurrentMemory,
     Data,
 #ifdef ENABLE_WASM_BULKMEM_OPS
     DataCount,
+    DataDrop,
 #endif
     Drop,
     Elem,
     Else,
     End,
     EndOfFile,
     Equal,
     Error,
@@ -92,31 +92,31 @@ class WasmToken {
     Float,
     Func,
 #ifdef ENABLE_WASM_REFTYPES
     GcFeatureOptIn,
 #endif
     GetGlobal,
     GetLocal,
     Global,
-    GrowMemory,
     If,
     Import,
     Index,
     Memory,
     NegativeZero,
     Load,
     Local,
     Loop,
 #ifdef ENABLE_WASM_BULKMEM_OPS
     MemCopy,
-    DataDrop,
     MemFill,
     MemInit,
 #endif
+    MemoryGrow,
+    MemorySize,
     Module,
     Mutable,
     Name,
 #ifdef ENABLE_WASM_GC
     StructNew,
     StructGet,
     StructSet,
     StructNarrow,
@@ -305,45 +305,49 @@ class WasmToken {
       case BrIf:
       case BrTable:
       case Call:
       case CallIndirect:
       case ComparisonOpcode:
       case Const:
       case ConversionOpcode:
       case ExtraConversionOpcode:
-      case CurrentMemory:
+#ifdef ENABLE_WASM_BULKMEM_OPS
+      case DataDrop:
+#endif
       case Drop:
+#ifdef ENABLE_WASM_BULKMEM_OPS
+      case ElemDrop:
+#endif
       case GetGlobal:
       case GetLocal:
-      case GrowMemory:
       case If:
       case Load:
       case Loop:
 #ifdef ENABLE_WASM_BULKMEM_OPS
       case MemCopy:
-      case DataDrop:
       case MemFill:
       case MemInit:
 #endif
+      case MemoryGrow:
+      case MemorySize:
 #ifdef ENABLE_WASM_GC
       case StructNew:
       case StructGet:
       case StructSet:
       case StructNarrow:
 #endif
       case Nop:
       case RefNull:
       case Return:
       case SetGlobal:
       case SetLocal:
       case Store:
 #ifdef ENABLE_WASM_BULKMEM_OPS
       case TableCopy:
-      case ElemDrop:
       case TableInit:
 #endif
 #ifdef ENABLE_WASM_GENERALIZED_TABLES
       case TableGet:
       case TableGrow:
       case TableSet:
       case TableSize:
 #endif
@@ -979,17 +983,17 @@ WasmToken WasmTokenStream::next() {
     case 'c':
       if (consume(u"call")) {
         if (consume(u"_indirect")) {
           return WasmToken(WasmToken::CallIndirect, begin, cur_);
         }
         return WasmToken(WasmToken::Call, begin, cur_);
       }
       if (consume(u"current_memory")) {
-        return WasmToken(WasmToken::CurrentMemory, begin, cur_);
+        return WasmToken(WasmToken::MemorySize, begin, cur_);
       }
       break;
 
     case 'd':
       if (consume(u"data")) {
 #ifdef ENABLE_WASM_BULKMEM_OPS
         if (consume(u"count")) {
           return WasmToken(WasmToken::DataCount, begin, cur_);
@@ -1337,17 +1341,17 @@ WasmToken WasmTokenStream::next() {
       }
       if (consume(u"get_local")) {
         return WasmToken(WasmToken::GetLocal, begin, cur_);
       }
       if (consume(u"global")) {
         return WasmToken(WasmToken::Global, begin, cur_);
       }
       if (consume(u"grow_memory")) {
-        return WasmToken(WasmToken::GrowMemory, begin, cur_);
+        return WasmToken(WasmToken::MemoryGrow, begin, cur_);
       }
       break;
 
     case 'i':
       if (consume(u"i32")) {
         if (!consume(u".")) {
           return WasmToken(WasmToken::ValueType, ValType::I32, begin, cur_);
         }
@@ -2121,20 +2125,20 @@ WasmToken WasmTokenStream::next() {
         if (consume(u"fill")) {
           return WasmToken(WasmToken::MemFill, begin, cur_);
         }
         if (consume(u"init")) {
           return WasmToken(WasmToken::MemInit, begin, cur_);
         }
 #endif
         if (consume(u"grow")) {
-          return WasmToken(WasmToken::GrowMemory, begin, cur_);
+          return WasmToken(WasmToken::MemoryGrow, begin, cur_);
         }
         if (consume(u"size")) {
-          return WasmToken(WasmToken::CurrentMemory, begin, cur_);
+          return WasmToken(WasmToken::MemorySize, begin, cur_);
         }
         break;
       }
       if (consume(u"module")) {
         return WasmToken(WasmToken::Module, begin, cur_);
       }
       if (consume(u"memory")) {
         return WasmToken(WasmToken::Memory, begin, cur_);
@@ -3617,23 +3621,23 @@ static AstBranchTable* ParseBranchTable(
         return nullptr;
       }
     }
   }
 
   return new (c.lifo) AstBranchTable(*index, def, std::move(table), value);
 }
 
-static AstGrowMemory* ParseGrowMemory(WasmParseContext& c, bool inParens) {
+static AstMemoryGrow* ParseMemoryGrow(WasmParseContext& c, bool inParens) {
   AstExpr* operand = ParseExpr(c, inParens);
   if (!operand) {
     return nullptr;
   }
 
-  return new (c.lifo) AstGrowMemory(operand);
+  return new (c.lifo) AstMemoryGrow(operand);
 }
 
 #ifdef ENABLE_WASM_BULKMEM_OPS
 static AstMemOrTableCopy* ParseMemOrTableCopy(WasmParseContext& c,
                                               bool inParens, bool isMem) {
   // (table.copy dest-table dest src-table src len)
   // (table.copy dest src len)
   // (memory.copy dest src len)
@@ -3992,20 +3996,20 @@ static AstExpr* ParseExprBody(WasmParseC
     case WasmToken::TeeLocal:
       return ParseTeeLocal(c, inParens);
     case WasmToken::TernaryOpcode:
       return ParseTernaryOperator(c, token.op(), inParens);
     case WasmToken::UnaryOpcode:
       return ParseUnaryOperator(c, token.op(), inParens);
     case WasmToken::Nop:
       return new (c.lifo) AstNop();
-    case WasmToken::CurrentMemory:
-      return new (c.lifo) AstCurrentMemory();
-    case WasmToken::GrowMemory:
-      return ParseGrowMemory(c, inParens);
+    case WasmToken::MemorySize:
+      return new (c.lifo) AstMemorySize();
+    case WasmToken::MemoryGrow:
+      return ParseMemoryGrow(c, inParens);
 #ifdef ENABLE_WASM_BULKMEM_OPS
     case WasmToken::MemCopy:
       return ParseMemOrTableCopy(c, inParens, /*isMem=*/true);
     case WasmToken::DataDrop:
       return ParseDataOrElemDrop(c, /*isData=*/true);
     case WasmToken::MemFill:
       return ParseMemFill(c, inParens);
     case WasmToken::MemInit:
@@ -5485,17 +5489,17 @@ static bool ResolveTeeLocal(Resolver& r,
 
   return true;
 }
 
 static bool ResolveUnaryOperator(Resolver& r, AstUnaryOperator& b) {
   return ResolveExpr(r, *b.operand());
 }
 
-static bool ResolveGrowMemory(Resolver& r, AstGrowMemory& gm) {
+static bool ResolveMemoryGrow(Resolver& r, AstMemoryGrow& gm) {
   return ResolveExpr(r, *gm.operand());
 }
 
 static bool ResolveBinaryOperator(Resolver& r, AstBinaryOperator& b) {
   return ResolveExpr(r, *b.lhs()) && ResolveExpr(r, *b.rhs());
 }
 
 static bool ResolveTernaryOperator(Resolver& r, AstTernaryOperator& b) {
@@ -5692,17 +5696,17 @@ static bool ResolveStructNarrow(Resolver
 
 static bool ResolveRefNull(Resolver& r, AstRefNull& s) { return true; }
 
 static bool ResolveExpr(Resolver& r, AstExpr& expr) {
   switch (expr.kind()) {
     case AstExprKind::Nop:
     case AstExprKind::Pop:
     case AstExprKind::Unreachable:
-    case AstExprKind::CurrentMemory:
+    case AstExprKind::MemorySize:
       return true;
     case AstExprKind::RefNull:
       return ResolveRefNull(r, expr.as<AstRefNull>());
     case AstExprKind::Drop:
       return ResolveDropOperator(r, expr.as<AstDrop>());
     case AstExprKind::BinaryOperator:
       return ResolveBinaryOperator(r, expr.as<AstBinaryOperator>());
     case AstExprKind::Block:
@@ -5743,18 +5747,18 @@ static bool ResolveExpr(Resolver& r, Ast
     case AstExprKind::BranchTable:
       return ResolveBranchTable(r, expr.as<AstBranchTable>());
     case AstExprKind::TeeLocal:
       return ResolveTeeLocal(r, expr.as<AstTeeLocal>());
     case AstExprKind::TernaryOperator:
       return ResolveTernaryOperator(r, expr.as<AstTernaryOperator>());
     case AstExprKind::UnaryOperator:
       return ResolveUnaryOperator(r, expr.as<AstUnaryOperator>());
-    case AstExprKind::GrowMemory:
-      return ResolveGrowMemory(r, expr.as<AstGrowMemory>());
+    case AstExprKind::MemoryGrow:
+      return ResolveMemoryGrow(r, expr.as<AstMemoryGrow>());
     case AstExprKind::AtomicCmpXchg:
       return ResolveAtomicCmpXchg(r, expr.as<AstAtomicCmpXchg>());
     case AstExprKind::AtomicLoad:
       return ResolveAtomicLoad(r, expr.as<AstAtomicLoad>());
     case AstExprKind::AtomicRMW:
       return ResolveAtomicRMW(r, expr.as<AstAtomicRMW>());
     case AstExprKind::AtomicStore:
       return ResolveAtomicStore(r, expr.as<AstAtomicStore>());
@@ -6303,34 +6307,34 @@ static bool EncodeBranchTable(Encoder& e
 
   if (!e.writeVarU32(bt.def().index())) {
     return false;
   }
 
   return true;
 }
 
-static bool EncodeCurrentMemory(Encoder& e, AstCurrentMemory& cm) {
-  if (!e.writeOp(Op::CurrentMemory)) {
+static bool EncodeMemorySize(Encoder& e, AstMemorySize& cm) {
+  if (!e.writeOp(Op::MemorySize)) {
     return false;
   }
 
   if (!e.writeVarU32(uint32_t(MemoryTableFlags::Default))) {
     return false;
   }
 
   return true;
 }
 
-static bool EncodeGrowMemory(Encoder& e, AstGrowMemory& gm) {
+static bool EncodeMemoryGrow(Encoder& e, AstMemoryGrow& gm) {
   if (!EncodeExpr(e, *gm.operand())) {
     return false;
   }
 
-  if (!e.writeOp(Op::GrowMemory)) {
+  if (!e.writeOp(Op::MemoryGrow)) {
     return false;
   }
 
   if (!e.writeVarU32(uint32_t(MemoryTableFlags::Default))) {
     return false;
   }
 
   return true;
@@ -6545,20 +6549,20 @@ static bool EncodeExpr(Encoder& e, AstEx
     case AstExprKind::Store:
       return EncodeStore(e, expr.as<AstStore>());
     case AstExprKind::BranchTable:
       return EncodeBranchTable(e, expr.as<AstBranchTable>());
     case AstExprKind::TernaryOperator:
       return EncodeTernaryOperator(e, expr.as<AstTernaryOperator>());
     case AstExprKind::UnaryOperator:
       return EncodeUnaryOperator(e, expr.as<AstUnaryOperator>());
-    case AstExprKind::CurrentMemory:
-      return EncodeCurrentMemory(e, expr.as<AstCurrentMemory>());
-    case AstExprKind::GrowMemory:
-      return EncodeGrowMemory(e, expr.as<AstGrowMemory>());
+    case AstExprKind::MemorySize:
+      return EncodeMemorySize(e, expr.as<AstMemorySize>());
+    case AstExprKind::MemoryGrow:
+      return EncodeMemoryGrow(e, expr.as<AstMemoryGrow>());
     case AstExprKind::AtomicCmpXchg:
       return EncodeAtomicCmpXchg(e, expr.as<AstAtomicCmpXchg>());
     case AstExprKind::AtomicLoad:
       return EncodeAtomicLoad(e, expr.as<AstAtomicLoad>());
     case AstExprKind::AtomicRMW:
       return EncodeAtomicRMW(e, expr.as<AstAtomicRMW>());
     case AstExprKind::AtomicStore:
       return EncodeAtomicStore(e, expr.as<AstAtomicStore>());
--- a/js/src/wasm/WasmTypes.h
+++ b/js/src/wasm/WasmTypes.h
@@ -2043,18 +2043,18 @@ enum class SymbolicAddress {
   TruncateDoubleToInt64,
   TruncateDoubleToUint64,
   SaturatingTruncateDoubleToInt64,
   SaturatingTruncateDoubleToUint64,
   Uint64ToFloat32,
   Uint64ToDouble,
   Int64ToFloat32,
   Int64ToDouble,
-  GrowMemory,
-  CurrentMemory,
+  MemoryGrow,
+  MemorySize,
   WaitI32,
   WaitI64,
   Wake,
   MemCopy,
   DataDrop,
   MemFill,
   MemInit,
   TableCopy,
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -775,20 +775,20 @@ static bool DecodeFunctionBodyExprs(cons
       case uint16_t(Op::F32Store): {
         LinearMemoryAddress<Nothing> addr;
         CHECK(iter.readStore(ValType::F32, 4, &addr, &nothing));
       }
       case uint16_t(Op::F64Store): {
         LinearMemoryAddress<Nothing> addr;
         CHECK(iter.readStore(ValType::F64, 8, &addr, &nothing));
       }
-      case uint16_t(Op::GrowMemory):
-        CHECK(iter.readGrowMemory(&nothing));
-      case uint16_t(Op::CurrentMemory):
-        CHECK(iter.readCurrentMemory());
+      case uint16_t(Op::MemoryGrow):
+        CHECK(iter.readMemoryGrow(&nothing));
+      case uint16_t(Op::MemorySize):
+        CHECK(iter.readMemorySize());
       case uint16_t(Op::Br): {
         uint32_t unusedDepth;
         ExprType unusedType;
         CHECK(iter.readBr(&unusedDepth, &unusedType, &nothing));
       }
       case uint16_t(Op::BrIf): {
         uint32_t unusedDepth;
         ExprType unusedType;
--- a/js/src/wasm/cranelift/baldrapi.h
+++ b/js/src/wasm/cranelift/baldrapi.h
@@ -155,18 +155,18 @@ struct BD_ValType {
   uint32_t packed;
 };
 
 // A subset of the wasm SymbolicAddress enum.
 // XXX this is not quite maintenable, because the number of values in this
 // enum is hardcoded in wasm2clif.rs.
 
 enum class BD_SymbolicAddress {
-  GrowMemory,
-  CurrentMemory,
+  MemoryGrow,
+  MemorySize,
   FloorF32,
   FloorF64,
   CeilF32,
   CeilF64,
   NearestF32,
   NearestF64,
   TruncF32,
   TruncF64,
--- a/js/src/wasm/cranelift/src/wasm2clif.rs
+++ b/js/src/wasm/cranelift/src/wasm2clif.rs
@@ -685,32 +685,32 @@ impl<'a, 'b, 'c> FuncEnvironment for Tra
 
     fn translate_memory_grow(
         &mut self,
         mut pos: FuncCursor,
         _index: MemoryIndex,
         _heap: ir::Heap,
         val: ir::Value,
     ) -> WasmResult<ir::Value> {
-        // We emit a call to `uint32_t growMemory_i32(Instance* instance, uint32_t delta)` via a
+        // We emit a call to `uint32_t memoryGrow_i32(Instance* instance, uint32_t delta)` via a
         // stub.
         let (fnref, sigref) =
-            self.symbolic_funcref(pos.func, bd::SymbolicAddress::GrowMemory, || {
+            self.symbolic_funcref(pos.func, bd::SymbolicAddress::MemoryGrow, || {
                 let mut sig = ir::Signature::new(CallConv::Baldrdash);
                 sig.params.push(ir::AbiParam::new(native_pointer_type()));
                 sig.params.push(ir::AbiParam::new(ir::types::I32).uext());
                 sig.params.push(ir::AbiParam::special(
                     native_pointer_type(),
                     ir::ArgumentPurpose::VMContext,
                 ));
                 sig.returns.push(ir::AbiParam::new(ir::types::I32).uext());
                 sig
             });
 
-        // Get the instance pointer needed by `growMemory_i32`.
+        // Get the instance pointer needed by `memoryGrow_i32`.
         let instance = self.load_instance(&mut pos);
         let vmctx = pos
             .func
             .special_param(ir::ArgumentPurpose::VMContext)
             .expect("Missing vmctx arg");
         // We must use `func_addr` for symbolic references since the stubs can be far away, and the
         // C++ `SymbolicAccess` linker expects it.
         let addr = pos.ins().func_addr(native_pointer_type(), fnref);
@@ -722,30 +722,30 @@ impl<'a, 'b, 'c> FuncEnvironment for Tra
     }
 
     fn translate_memory_size(
         &mut self,
         mut pos: FuncCursor,
         _index: MemoryIndex,
         _heap: ir::Heap,
     ) -> WasmResult<ir::Value> {
-        // We emit a call to `uint32_t currentMemory_i32(Instance* instance)` via a stub.
+        // We emit a call to `uint32_t memorySize_i32(Instance* instance)` via a stub.
         let (fnref, sigref) =
-            self.symbolic_funcref(pos.func, bd::SymbolicAddress::CurrentMemory, || {
+            self.symbolic_funcref(pos.func, bd::SymbolicAddress::MemorySize, || {
                 let mut sig = ir::Signature::new(CallConv::Baldrdash);
                 sig.params.push(ir::AbiParam::new(native_pointer_type()));
                 sig.params.push(ir::AbiParam::special(
                     native_pointer_type(),
                     ir::ArgumentPurpose::VMContext,
                 ));
                 sig.returns.push(ir::AbiParam::new(ir::types::I32).uext());
                 sig
             });
 
-        // Get the instance pointer needed by `currentMemory_i32`.
+        // Get the instance pointer needed by `memorySize_i32`.
         let instance = self.load_instance(&mut pos);
         let vmctx = pos
             .func
             .special_param(ir::ArgumentPurpose::VMContext)
             .expect("Missing vmctx arg");
         let addr = pos.ins().func_addr(native_pointer_type(), fnref);
         let call = pos.ins().call_indirect(sigref, addr, &[instance, vmctx]);
         self.switch_to_wasm_tls_realm(&mut pos);