summaryrefslogtreecommitdiff
path: root/test/binaryen.js/expressions.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/binaryen.js/expressions.js')
-rw-r--r--test/binaryen.js/expressions.js42
1 files changed, 27 insertions, 15 deletions
diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js
index 40d4194fd..71846f3c6 100644
--- a/test/binaryen.js/expressions.js
+++ b/test/binaryen.js/expressions.js
@@ -476,7 +476,7 @@ console.log("# GlobalSet");
console.log("# MemorySize");
(function testMemorySize() {
const module = new binaryen.Module();
-
+ module.setMemory(1, 1, null);
var type = binaryen.i32;
const theMemorySize = binaryen.MemorySize(module.memory.size());
assert(theMemorySize instanceof binaryen.MemorySize);
@@ -492,7 +492,7 @@ console.log("# MemorySize");
assert(
theMemorySize.toText()
==
- "(memory.size)\n"
+ "(memory.size $0)\n"
);
module.dispose();
@@ -501,6 +501,7 @@ console.log("# MemorySize");
console.log("# MemoryGrow");
(function testMemoryGrow() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var type = binaryen.i32;
var delta = module.i32.const(1);
@@ -521,7 +522,7 @@ console.log("# MemoryGrow");
assert(
theMemoryGrow.toText()
==
- "(memory.grow\n (i32.const 2)\n)\n"
+ "(memory.grow $0\n (i32.const 2)\n)\n"
);
module.dispose();
@@ -530,6 +531,7 @@ console.log("# MemoryGrow");
console.log("# Load");
(function testLoad() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var offset = 16;
var align = 2;
@@ -566,7 +568,7 @@ console.log("# Load");
assert(
theLoad.toText()
==
- "(i64.atomic.load offset=32 align=4\n (i32.const 128)\n)\n"
+ "(i64.atomic.load $0 offset=32 align=4\n (i32.const 128)\n)\n"
);
module.dispose();
@@ -575,6 +577,7 @@ console.log("# Load");
console.log("# Store");
(function testStore() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var offset = 16;
var align = 2;
@@ -615,7 +618,7 @@ console.log("# Store");
assert(
theStore.toText()
==
- "(i64.atomic.store offset=32 align=4\n (i32.const 128)\n (i32.const 2)\n)\n"
+ "(i64.atomic.store $0 offset=32 align=4\n (i32.const 128)\n (i32.const 2)\n)\n"
);
module.dispose();
@@ -822,6 +825,7 @@ console.log("# Return");
console.log("# AtomicRMW");
(function testAtomicRMW() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var op = binaryen.Operations.AtomicRMWAdd;
var offset = 8;
@@ -855,7 +859,7 @@ console.log("# AtomicRMW");
assert(
theAtomicRMW.toText()
==
- "(i64.atomic.rmw16.sub_u offset=16\n (i32.const 4)\n (i64.const 5)\n)\n"
+ "(i64.atomic.rmw16.sub_u $0 offset=16\n (i32.const 4)\n (i64.const 5)\n)\n"
);
module.dispose();
@@ -864,6 +868,7 @@ console.log("# AtomicRMW");
console.log("# AtomicCmpxchg");
(function testAtomicCmpxchg() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var offset = 8;
var ptr = module.i32.const(2);
@@ -897,7 +902,7 @@ console.log("# AtomicCmpxchg");
assert(
theAtomicCmpxchg.toText()
==
- "(i64.atomic.rmw16.cmpxchg_u offset=16\n (i32.const 5)\n (i64.const 6)\n (i64.const 7)\n)\n"
+ "(i64.atomic.rmw16.cmpxchg_u $0 offset=16\n (i32.const 5)\n (i64.const 6)\n (i64.const 7)\n)\n"
);
module.dispose();
@@ -906,6 +911,7 @@ console.log("# AtomicCmpxchg");
console.log("# AtomicWait");
(function testAtomicWait() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var ptr = module.i32.const(2);
var expected = module.i32.const(3);
@@ -935,7 +941,7 @@ console.log("# AtomicWait");
assert(
theAtomicWait.toText()
==
- "(memory.atomic.wait64\n (i32.const 5)\n (i32.const 6)\n (i64.const 7)\n)\n"
+ "(memory.atomic.wait64 $0\n (i32.const 5)\n (i32.const 6)\n (i64.const 7)\n)\n"
);
module.dispose();
@@ -944,6 +950,7 @@ console.log("# AtomicWait");
console.log("# AtomicNotify");
(function testAtomicNotify() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var ptr = module.i32.const(1);
var notifyCount = module.i32.const(2);
@@ -966,7 +973,7 @@ console.log("# AtomicNotify");
assert(
theAtomicNotify.toText()
==
- "(memory.atomic.notify\n (i32.const 3)\n (i32.const 4)\n)\n"
+ "(memory.atomic.notify $0\n (i32.const 3)\n (i32.const 4)\n)\n"
);
module.dispose();
@@ -1172,6 +1179,7 @@ console.log("# SIMDShift");
console.log("# SIMDLoad");
(function testSIMDLoad() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var op = binaryen.Operations.Load8x8SVec128;
var offset = 16;
@@ -1201,7 +1209,7 @@ console.log("# SIMDLoad");
assert(
theSIMDLoad.toText()
==
- "(v128.load8_splat offset=32 align=4\n (i32.const 2)\n)\n"
+ "(v128.load8_splat $0 offset=32 align=4\n (i32.const 2)\n)\n"
);
module.dispose();
@@ -1210,6 +1218,7 @@ console.log("# SIMDLoad");
console.log("# SIMDLoadStoreLane");
(function testSIMDLoadStoreLane() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var op = binaryen.Operations.Load8LaneVec128;
var offset = 16;
@@ -1249,7 +1258,7 @@ console.log("# SIMDLoadStoreLane");
assert(
theSIMDLoadStoreLane.toText()
==
- "(v128.load16_lane offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n"
+ "(v128.load16_lane $0 offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n"
);
theSIMDLoadStoreLane.op = op = binaryen.Operations.Store16LaneVec128;
@@ -1263,7 +1272,7 @@ console.log("# SIMDLoadStoreLane");
assert(
theSIMDLoadStoreLane.toText()
==
- "(v128.store16_lane offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n"
+ "(v128.store16_lane $0 offset=32 2\n (i32.const 2)\n (v128.const i32x4 0x01010101 0x01010101 0x01010101 0x01010101)\n)\n"
);
module.dispose();
@@ -1272,6 +1281,7 @@ console.log("# SIMDLoadStoreLane");
console.log("# MemoryInit");
(function testMemoryInit() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var segment = 1;
var dest = module.i32.const(2);
@@ -1302,7 +1312,7 @@ console.log("# MemoryInit");
assert(
theMemoryInit.toText()
==
- "(memory.init 5\n (i32.const 6)\n (i32.const 7)\n (i32.const 8)\n)\n"
+ "(memory.init $0 5\n (i32.const 6)\n (i32.const 7)\n (i32.const 8)\n)\n"
);
module.dispose();
@@ -1338,6 +1348,7 @@ console.log("# DataDrop");
console.log("# MemoryCopy");
(function testMemoryCopy() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var dest = module.i32.const(1);
var source = module.i32.const(2);
@@ -1364,7 +1375,7 @@ console.log("# MemoryCopy");
assert(
theMemoryCopy.toText()
==
- "(memory.copy\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n"
+ "(memory.copy $0 $0\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n"
);
module.dispose();
@@ -1373,6 +1384,7 @@ console.log("# MemoryCopy");
console.log("# MemoryFill");
(function testMemoryFill() {
const module = new binaryen.Module();
+ module.setMemory(1, 1, null);
var dest = module.i32.const(1);
var value = module.i32.const(2);
@@ -1399,7 +1411,7 @@ console.log("# MemoryFill");
assert(
theMemoryFill.toText()
==
- "(memory.fill\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n"
+ "(memory.fill $0\n (i32.const 4)\n (i32.const 5)\n (i32.const 6)\n)\n"
);
module.dispose();