Commit ff0b6d49 authored by titzer's avatar titzer Committed by Commit bot

[wasm] Remove the explicit count from WASM_BLOCK and WASM_LOOP macros.

R=ahaas@chromium.org, rossberg@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2170773003
Cr-Commit-Position: refs/heads/master@{#37939}
parent 17376b6d
......@@ -65,9 +65,9 @@
#define DEPTH_0 0
#define DEPTH_1 1
#define WASM_BLOCK(count, ...) kExprBlock, __VA_ARGS__, kExprEnd
#define WASM_BLOCK(...) kExprBlock, __VA_ARGS__, kExprEnd
#define WASM_INFINITE_LOOP kExprLoop, kExprBr, ARITY_0, DEPTH_0, kExprEnd
#define WASM_LOOP(count, ...) kExprLoop, __VA_ARGS__, kExprEnd
#define WASM_LOOP(...) kExprLoop, __VA_ARGS__, kExprEnd
#define WASM_IF(cond, tstmt) cond, kExprIf, tstmt, kExprEnd
#define WASM_IF_ELSE(cond, tstmt, fstmt) \
cond, kExprIf, tstmt, kExprElse, fstmt, kExprEnd
......
......@@ -1256,10 +1256,10 @@ WASM_EXEC_TEST(F64ReinterpretI64) {
int64_t* memory = module.AddMemoryElems<int64_t>(8);
WasmRunner<int64_t> r(&module, MachineType::Int64());
BUILD(r, WASM_BLOCK(
2, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO,
WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(0)));
BUILD(r,
WASM_BLOCK(WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO,
WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
int64_t expected = static_cast<int64_t>(*i) * 0x300010001;
......@@ -1320,18 +1320,18 @@ WASM_EXEC_TEST(MemI64_Sum) {
WasmRunner<uint64_t> r(&module, MachineType::Int32());
const byte kSum = r.AllocateLocal(kAstI64);
BUILD(r, WASM_BLOCK(
2, WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
2, WASM_SET_LOCAL(
kSum, WASM_I64_ADD(
WASM_GET_LOCAL(kSum),
BUILD(r,
WASM_BLOCK(
WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
WASM_SET_LOCAL(
kSum, WASM_I64_ADD(WASM_GET_LOCAL(kSum),
WASM_LOAD_MEM(MachineType::Int64(),
WASM_GET_LOCAL(0)))),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))),
WASM_GET_LOCAL(1)));
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))),
WASM_GET_LOCAL(1)));
// Run 4 trials.
for (int i = 0; i < 3; i++) {
......
......@@ -116,7 +116,6 @@ TEST(Run_WasmModule_CheckMemoryIsZero) {
uint16_t localIndex = f->AddLocal(kAstI32);
ExportAsMain(f);
byte code[] = {WASM_BLOCK(
2,
WASM_WHILE(
WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32V_3(kCheckSize)),
WASM_IF_ELSE(
......@@ -140,11 +139,11 @@ TEST(Run_WasmModule_CallMain_recursive) {
uint16_t localIndex = f->AddLocal(kAstI32);
ExportAsMain(f);
byte code[] = {WASM_BLOCK(
2, WASM_SET_LOCAL(localIndex,
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
WASM_SET_LOCAL(localIndex,
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)),
WASM_IF_ELSE(WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I8(5)),
WASM_BLOCK(2, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO,
WASM_INC_LOCAL(localIndex)),
WASM_BLOCK(WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO,
WASM_INC_LOCAL(localIndex)),
WASM_BRV(1, WASM_CALL_FUNCTION0(0))),
WASM_BRV(0, WASM_I8(55))))};
f->EmitCode(code, sizeof(code));
......
......@@ -874,10 +874,9 @@ WASM_EXEC_TEST(BrTable1) {
WASM_EXEC_TEST(BrTable_loop) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r,
B2(WASM_LOOP(1, WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2),
BUILD(r, B2(WASM_LOOP(WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2),
BR_TARGET(1), BR_TARGET(0))),
RET_I8(99)),
RET_I8(99)),
WASM_I8(98));
CHECK_EQ(99, r.Call(0));
CHECK_EQ(98, r.Call(-1));
......@@ -1022,10 +1021,10 @@ WASM_EXEC_TEST(I32ReinterpretF32) {
int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Int32());
BUILD(r, WASM_BLOCK(
2, WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO,
WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))),
WASM_I8(107)));
BUILD(r,
WASM_BLOCK(WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO,
WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))),
WASM_I8(107)));
FOR_INT32_INPUTS(i) {
int32_t expected = *i;
......@@ -1138,20 +1137,20 @@ WASM_EXEC_TEST(Loop_empty) {
WASM_EXEC_TEST(Loop_empty_br1) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, WASM_LOOP(1, WASM_BR(1)), WASM_GET_LOCAL(0));
BUILD(r, WASM_LOOP(WASM_BR(1)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_empty_brif1) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, WASM_LOOP(1, WASM_BR_IF(1, WASM_ZERO)), WASM_GET_LOCAL(0));
BUILD(r, WASM_LOOP(WASM_BR_IF(1, WASM_ZERO)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
}
WASM_EXEC_TEST(Loop_empty_brif2) {
WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(),
MachineType::Uint32());
BUILD(r, WASM_LOOP(1, WASM_BR_IF(1, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
BUILD(r, WASM_LOOP(WASM_BR_IF(1, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
}
......@@ -1194,9 +1193,9 @@ WASM_EXEC_TEST(Block_IfElse_P_return) {
WASM_EXEC_TEST(Block_If_P_assign) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
// { if (p0) p0 = 61; p0; }
BUILD(r, WASM_BLOCK(
2, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))),
WASM_GET_LOCAL(0)));
BUILD(r,
WASM_BLOCK(WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))),
WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
int32_t expected = *i ? 61 : *i;
CHECK_EQ(expected, r.Call(*i));
......@@ -1236,14 +1235,12 @@ WASM_EXEC_TEST(ExprIf_P_fallthru) {
WASM_EXEC_TEST(CountDown) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r,
WASM_BLOCK(
2, WASM_LOOP(
1, WASM_IF(WASM_GET_LOCAL(0),
WASM_BRV(1, WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0),
BUILD(r, WASM_BLOCK(
WASM_LOOP(WASM_IF(
WASM_GET_LOCAL(0),
WASM_BRV(1, WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I8(1)))))),
WASM_GET_LOCAL(0)));
WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(1));
CHECK_EQ(0, r.Call(10));
CHECK_EQ(0, r.Call(100));
......@@ -1251,13 +1248,12 @@ WASM_EXEC_TEST(CountDown) {
WASM_EXEC_TEST(CountDown_fallthru) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r,
WASM_BLOCK(
2, WASM_LOOP(3, WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), WASM_BREAK(1)),
BUILD(r, WASM_BLOCK(
WASM_LOOP(WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), WASM_BREAK(1)),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))),
WASM_CONTINUE(0)),
WASM_GET_LOCAL(0)));
WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(1));
CHECK_EQ(0, r.Call(10));
CHECK_EQ(0, r.Call(100));
......@@ -1265,11 +1261,11 @@ WASM_EXEC_TEST(CountDown_fallthru) {
WASM_EXEC_TEST(WhileCountDown) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, WASM_BLOCK(
2, WASM_WHILE(WASM_GET_LOCAL(0),
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I8(1)))),
WASM_GET_LOCAL(0)));
BUILD(r,
WASM_BLOCK(WASM_WHILE(WASM_GET_LOCAL(0),
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I8(1)))),
WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(1));
CHECK_EQ(0, r.Call(10));
CHECK_EQ(0, r.Call(100));
......@@ -1277,7 +1273,7 @@ WASM_EXEC_TEST(WhileCountDown) {
WASM_EXEC_TEST(Loop_if_break1) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, B2(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
BUILD(r, B2(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
WASM_SET_LOCAL(0, WASM_I8(99))),
WASM_GET_LOCAL(0)));
CHECK_EQ(99, r.Call(0));
......@@ -1288,7 +1284,7 @@ WASM_EXEC_TEST(Loop_if_break1) {
WASM_EXEC_TEST(Loop_if_break2) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, B2(WASM_LOOP(2, WASM_BR_IF(1, WASM_GET_LOCAL(0)),
BUILD(r, B2(WASM_LOOP(WASM_BR_IF(1, WASM_GET_LOCAL(0)),
WASM_SET_LOCAL(0, WASM_I8(99))),
WASM_GET_LOCAL(0)));
CHECK_EQ(99, r.Call(0));
......@@ -1299,7 +1295,7 @@ WASM_EXEC_TEST(Loop_if_break2) {
WASM_EXEC_TEST(Loop_if_break_fallthru) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, B1(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
WASM_SET_LOCAL(0, WASM_I8(93)))),
WASM_GET_LOCAL(0));
CHECK_EQ(93, r.Call(0));
......@@ -1570,18 +1566,18 @@ WASM_EXEC_TEST(MemI32_Sum) {
WasmRunner<uint32_t> r(&module, MachineType::Int32());
const byte kSum = r.AllocateLocal(kAstI32);
BUILD(r, WASM_BLOCK(
2, WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
2, WASM_SET_LOCAL(
kSum, WASM_I32_ADD(
WASM_GET_LOCAL(kSum),
BUILD(r,
WASM_BLOCK(
WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
WASM_SET_LOCAL(
kSum, WASM_I32_ADD(WASM_GET_LOCAL(kSum),
WASM_LOAD_MEM(MachineType::Int32(),
WASM_GET_LOCAL(0)))),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))),
WASM_GET_LOCAL(1)));
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))),
WASM_GET_LOCAL(1)));
// Run 4 trials.
for (int i = 0; i < 3; ++i) {
......@@ -1623,20 +1619,20 @@ WASM_EXEC_TEST(MemF32_Sum) {
WasmRunner<int32_t> r(&module, MachineType::Int32());
const byte kSum = r.AllocateLocal(kAstF32);
BUILD(r, WASM_BLOCK(
3, WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
2, WASM_SET_LOCAL(
kSum, WASM_F32_ADD(
WASM_GET_LOCAL(kSum),
BUILD(r,
WASM_BLOCK(
WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
WASM_SET_LOCAL(
kSum, WASM_F32_ADD(WASM_GET_LOCAL(kSum),
WASM_LOAD_MEM(MachineType::Float32(),
WASM_GET_LOCAL(0)))),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))),
WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO,
WASM_GET_LOCAL(kSum)),
WASM_GET_LOCAL(0)));
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))),
WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO,
WASM_GET_LOCAL(kSum)),
WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(4 * (kSize - 1)));
CHECK_NE(-99.25f, module.ReadMemory(&buffer[0]));
......@@ -1655,21 +1651,19 @@ T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop,
WasmRunner<int32_t> r(&module, MachineType::Int32());
const byte kAccum = r.AllocateLocal(astType);
BUILD(
r,
WASM_BLOCK(
4, WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)),
WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
2, WASM_SET_LOCAL(
kAccum,
WASM_BINOP(binop, WASM_GET_LOCAL(kAccum),
WASM_LOAD_MEM(memType, WASM_GET_LOCAL(0)))),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(sizeof(T)))))),
WASM_STORE_MEM(memType, WASM_ZERO, WASM_GET_LOCAL(kAccum)),
WASM_GET_LOCAL(0)));
BUILD(r, WASM_BLOCK(
WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)),
WASM_WHILE(
WASM_GET_LOCAL(0),
WASM_BLOCK(
WASM_SET_LOCAL(
kAccum, WASM_BINOP(binop, WASM_GET_LOCAL(kAccum),
WASM_LOAD_MEM(
memType, WASM_GET_LOCAL(0)))),
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I8(sizeof(T)))))),
WASM_STORE_MEM(memType, WASM_ZERO, WASM_GET_LOCAL(kAccum)),
WASM_GET_LOCAL(0)));
r.Call(static_cast<int>(sizeof(T) * (size - 1)));
return module.ReadMemory(&memory[0]);
}
......@@ -1695,7 +1689,7 @@ WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) {
WasmRunner<int32_t> r(&module, MachineType::Int32());
// Only build the graph and compile, don't run.
BUILD(r, WASM_LOOP(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)));
BUILD(r, WASM_LOOP(WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)));
}
WASM_EXEC_TEST(Unreachable0a) {
......@@ -1961,7 +1955,6 @@ WASM_EXEC_TEST(MixedGlobals) {
BUILD(
r,
WASM_BLOCK(
9,
WASM_STORE_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int8(), WASM_ZERO)),
WASM_STORE_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint8(), WASM_ZERO)),
WASM_STORE_GLOBAL(3, WASM_LOAD_MEM(MachineType::Int16(), WASM_ZERO)),
......@@ -2130,13 +2123,13 @@ WASM_EXEC_TEST(Call_Float64Sub) {
double* memory = module.AddMemoryElems<double>(16);
WasmRunner<int32_t> r(&module);
BUILD(r, WASM_BLOCK(
2, WASM_STORE_MEM(
MachineType::Float64(), WASM_ZERO,
WASM_F64_SUB(
WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO),
WASM_LOAD_MEM(MachineType::Float64(), WASM_I8(8)))),
WASM_I8(107)));
BUILD(r,
WASM_BLOCK(WASM_STORE_MEM(
MachineType::Float64(), WASM_ZERO,
WASM_F64_SUB(
WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO),
WASM_LOAD_MEM(MachineType::Float64(), WASM_I8(8)))),
WASM_I8(107)));
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
......@@ -2268,8 +2261,8 @@ WASM_EXEC_TEST(AddCall) {
WASM_EXEC_TEST(CountDown_expr) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, WASM_LOOP(
3, WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)),
WASM_BREAKV(1, WASM_GET_LOCAL(0))),
WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)),
WASM_BREAKV(1, WASM_GET_LOCAL(0))),
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))),
WASM_CONTINUE(0)));
CHECK_EQ(0, r.Call(1));
......@@ -2307,8 +2300,8 @@ WASM_EXEC_TEST(ExprBlock2d) {
WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r, WASM_BLOCK(6, WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)),
WASM_BRV(1, WASM_I8(11))),
BUILD(r, WASM_BLOCK(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)),
WASM_BRV(1, WASM_I8(11))),
WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2)),
WASM_BRV(1, WASM_I8(12))),
WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3)),
......@@ -2329,18 +2322,17 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32());
BUILD(r,
WASM_BLOCK(6, WASM_BRV_IF(0, WASM_I8(11),
BUILD(r, WASM_BLOCK(WASM_BRV_IF(0, WASM_I8(11),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1))),
WASM_BRV_IF(0, WASM_I8(12),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2))),
WASM_BRV_IF(0, WASM_I8(13),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3))),
WASM_BRV_IF(0, WASM_I8(14),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4))),
WASM_BRV_IF(0, WASM_I8(15),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5))),
WASM_I8(99)));
WASM_BRV_IF(0, WASM_I8(12),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2))),
WASM_BRV_IF(0, WASM_I8(13),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3))),
WASM_BRV_IF(0, WASM_I8(14),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4))),
WASM_BRV_IF(0, WASM_I8(15),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5))),
WASM_I8(99)));
CHECK_EQ(99, r.Call(0));
CHECK_EQ(11, r.Call(1));
CHECK_EQ(12, r.Call(2));
......@@ -2379,13 +2371,12 @@ WASM_EXEC_TEST(ExprBlock_nested_ifs) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32(),
MachineType::Int32());
BUILD(r, WASM_BLOCK(
1, WASM_IF_ELSE(
WASM_GET_LOCAL(0),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(11)),
WASM_BRV(1, WASM_I8(12))),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(13)),
WASM_BRV(1, WASM_I8(14))))));
BUILD(r, WASM_BLOCK(WASM_IF_ELSE(
WASM_GET_LOCAL(0),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(11)),
WASM_BRV(1, WASM_I8(12))),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(13)),
WASM_BRV(1, WASM_I8(14))))));
CHECK_EQ(11, r.Call(1, 1));
CHECK_EQ(12, r.Call(1, 0));
......@@ -2397,13 +2388,12 @@ WASM_EXEC_TEST(ExprLoop_nested_ifs) {
WasmRunner<int32_t> r(execution_mode, MachineType::Int32(),
MachineType::Int32());
BUILD(r, WASM_LOOP(
1, WASM_IF_ELSE(
WASM_GET_LOCAL(0),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(11)),
WASM_BRV(3, WASM_I8(12))),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(13)),
WASM_BRV(3, WASM_I8(14))))));
BUILD(r, WASM_LOOP(WASM_IF_ELSE(
WASM_GET_LOCAL(0),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(11)),
WASM_BRV(3, WASM_I8(12))),
WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(13)),
WASM_BRV(3, WASM_I8(14))))));
CHECK_EQ(11, r.Call(1, 1));
CHECK_EQ(12, r.Call(1, 0));
......
......@@ -469,12 +469,12 @@ TEST_F(AstDecoderTest, Block5) {
sigs.v_i(), B3(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
EXPECT_VERIFIES_INLINE(sigs.v_i(),
WASM_BLOCK(4, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
WASM_BLOCK(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
EXPECT_VERIFIES_INLINE(
sigs.v_i(),
WASM_BLOCK(5, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
WASM_BLOCK(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
}
......@@ -683,33 +683,33 @@ TEST_F(AstDecoderTest, Loop0) {
}
TEST_F(AstDecoderTest, Loop1) {
static const byte code[] = {WASM_LOOP(1, WASM_SET_LOCAL(0, WASM_ZERO))};
static const byte code[] = {WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO))};
EXPECT_VERIFIES(sigs.v_i(), code);
EXPECT_FAILURE(sigs.v_v(), code);
EXPECT_FAILURE(sigs.f_ff(), code);
}
TEST_F(AstDecoderTest, Loop2) {
EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_LOOP(2, WASM_SET_LOCAL(0, WASM_ZERO),
EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO),
WASM_SET_LOCAL(0, WASM_ZERO)));
}
TEST_F(AstDecoderTest, Loop1_continue) {
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BR(0)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(0)));
}
TEST_F(AstDecoderTest, Loop1_break) {
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BR(1)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(1)));
}
TEST_F(AstDecoderTest, Loop2_continue) {
EXPECT_VERIFIES_INLINE(
sigs.v_i(), WASM_LOOP(2, WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(0)));
EXPECT_VERIFIES_INLINE(sigs.v_i(),
WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(0)));
}
TEST_F(AstDecoderTest, Loop2_break) {
EXPECT_VERIFIES_INLINE(
sigs.v_i(), WASM_LOOP(2, WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(1)));
EXPECT_VERIFIES_INLINE(sigs.v_i(),
WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(1)));
}
TEST_F(AstDecoderTest, ExprLoop0) {
......@@ -718,16 +718,16 @@ TEST_F(AstDecoderTest, ExprLoop0) {
}
TEST_F(AstDecoderTest, ExprLoop1a) {
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(1, WASM_BRV(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BRV(0, WASM_ZERO)));
}
TEST_F(AstDecoderTest, ExprLoop1b) {
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(1, WASM_BRV(1, WASM_ZERO)));
EXPECT_FAILURE_INLINE(sigs.f_ff(), WASM_LOOP(1, WASM_BRV(1, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BRV(1, WASM_ZERO)));
EXPECT_FAILURE_INLINE(sigs.f_ff(), WASM_LOOP(WASM_BRV(1, WASM_ZERO)));
}
TEST_F(AstDecoderTest, ExprLoop2_unreachable) {
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(2, WASM_BR(0), WASM_NOP));
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BR(0), WASM_NOP));
}
TEST_F(AstDecoderTest, ReturnVoid1) {
......@@ -759,8 +759,8 @@ TEST_F(AstDecoderTest, Unreachable1) {
EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprUnreachable, kExprUnreachable);
EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_UNREACHABLE, WASM_ZERO));
EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_BR(0), WASM_ZERO));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(2, WASM_UNREACHABLE, WASM_ZERO));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(2, WASM_BR(0), WASM_ZERO));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_UNREACHABLE, WASM_ZERO));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(0), WASM_ZERO));
}
TEST_F(AstDecoderTest, Unreachable_binop) {
......@@ -914,32 +914,29 @@ TEST_F(AstDecoderTest, MacrosStmt) {
VERIFY(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP));
VERIFY(WASM_NOP);
VERIFY(B1(WASM_NOP));
VERIFY(WASM_LOOP(1, WASM_NOP));
VERIFY(WASM_LOOP(1, WASM_BREAK(0)));
VERIFY(WASM_LOOP(1, WASM_CONTINUE(0)));
VERIFY(WASM_LOOP(WASM_NOP));
VERIFY(WASM_LOOP(WASM_BREAK(0)));
VERIFY(WASM_LOOP(WASM_CONTINUE(0)));
}
TEST_F(AstDecoderTest, MacrosBreak) {
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BREAK(0)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BREAK(0)));
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(1, WASM_BREAKV(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.l_l(),
WASM_LOOP(1, WASM_BREAKV(0, WASM_I64V_1(0))));
EXPECT_VERIFIES_INLINE(sigs.f_ff(),
WASM_LOOP(1, WASM_BREAKV(0, WASM_F32(0.0))));
EXPECT_VERIFIES_INLINE(sigs.d_dd(),
WASM_LOOP(1, WASM_BREAKV(0, WASM_F64(0.0))));
EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BREAKV(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.l_l(), WASM_LOOP(WASM_BREAKV(0, WASM_I64V_1(0))));
EXPECT_VERIFIES_INLINE(sigs.f_ff(), WASM_LOOP(WASM_BREAKV(0, WASM_F32(0.0))));
EXPECT_VERIFIES_INLINE(sigs.d_dd(), WASM_LOOP(WASM_BREAKV(0, WASM_F64(0.0))));
}
TEST_F(AstDecoderTest, MacrosContinue) {
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_CONTINUE(0)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_CONTINUE(0)));
}
TEST_F(AstDecoderTest, MacrosVariadic) {
VERIFY(B2(WASM_NOP, WASM_NOP));
VERIFY(B3(WASM_NOP, WASM_NOP, WASM_NOP));
VERIFY(WASM_LOOP(2, WASM_NOP, WASM_NOP));
VERIFY(WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_NOP));
VERIFY(WASM_LOOP(WASM_NOP, WASM_NOP));
VERIFY(WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP));
}
TEST_F(AstDecoderTest, MacrosNestedBlocks) {
......@@ -1473,21 +1470,19 @@ TEST_F(AstDecoderTest, BreakEnd) {
TEST_F(AstDecoderTest, BreakIfBinop) {
EXPECT_FAILURE_INLINE(
sigs.i_i(),
WASM_BLOCK(
1, WASM_I32_ADD(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO), WASM_ZERO)));
EXPECT_FAILURE_INLINE(
sigs.i_i(),
WASM_BLOCK(
1, WASM_I32_ADD(WASM_ZERO, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))));
sigs.i_i(), WASM_BLOCK(WASM_I32_ADD(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO),
WASM_ZERO)));
EXPECT_FAILURE_INLINE(sigs.i_i(),
WASM_BLOCK(WASM_I32_ADD(
WASM_ZERO, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))));
}
TEST_F(AstDecoderTest, BreakNesting1) {
for (int i = 0; i < 5; i++) {
// (block[2] (loop[2] (if (get p) break[N]) (set p 1)) p)
byte code[] = {WASM_BLOCK(
2, WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(i + 1, WASM_ZERO)),
WASM_SET_LOCAL(0, WASM_I8(1))),
WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(i + 1, WASM_ZERO)),
WASM_SET_LOCAL(0, WASM_I8(1))),
WASM_GET_LOCAL(0))};
if (i < 3) {
EXPECT_VERIFIES(sigs.i_i(), code);
......@@ -1501,7 +1496,7 @@ TEST_F(AstDecoderTest, BreakNesting2) {
AddLocals(kAstI32, 1);
for (int i = 0; i < 5; i++) {
// (block[2] (loop[2] (if 0 break[N]) (set p 1)) (return p)) (11)
byte code[] = {B1(WASM_LOOP(2, WASM_IF(WASM_ZERO, WASM_BREAK(i + 1)),
byte code[] = {B1(WASM_LOOP(WASM_IF(WASM_ZERO, WASM_BREAK(i + 1)),
WASM_SET_LOCAL(0, WASM_I8(1)))),
WASM_I8(11)};
if (i < 2) {
......@@ -1516,7 +1511,7 @@ TEST_F(AstDecoderTest, BreakNesting3) {
for (int i = 0; i < 5; i++) {
// (block[1] (loop[1] (block[1] (if 0 break[N])
byte code[] = {
WASM_BLOCK(1, WASM_LOOP(1, B1(WASM_IF(WASM_ZERO, WASM_BREAK(i + 1)))))};
WASM_BLOCK(WASM_LOOP(B1(WASM_IF(WASM_ZERO, WASM_BREAK(i + 1)))))};
if (i < 3) {
EXPECT_VERIFIES(sigs.v_v(), code);
} else {
......@@ -1597,8 +1592,7 @@ TEST_F(AstDecoderTest, ExprBreak_TypeCheck) {
}
TEST_F(AstDecoderTest, ExprBreak_TypeCheckAll) {
byte code1[] = {WASM_BLOCK(2,
WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))),
byte code1[] = {WASM_BLOCK(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(1))};
byte code2[] = {B2(WASM_IF(WASM_ZERO, WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(1))};
......@@ -1629,7 +1623,7 @@ TEST_F(AstDecoderTest, ExprBr_Unify) {
byte code1[] = {B2(WASM_IF(WASM_ZERO, WASM_BRV(1, WASM_GET_LOCAL(which))),
WASM_GET_LOCAL(which ^ 1))};
byte code2[] = {
WASM_LOOP(2, WASM_IF(WASM_ZERO, WASM_BRV(2, WASM_GET_LOCAL(which))),
WASM_LOOP(WASM_IF(WASM_ZERO, WASM_BRV(2, WASM_GET_LOCAL(which))),
WASM_GET_LOCAL(which ^ 1))};
if (type == kAstI32) {
......@@ -1686,7 +1680,7 @@ TEST_F(AstDecoderTest, ExprBrIf_Unify) {
byte code1[] = {B2(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(which)),
WASM_GET_LOCAL(which ^ 1))};
byte code2[] = {WASM_LOOP(2, WASM_BRV_IF_ZERO(1, WASM_GET_LOCAL(which)),
byte code2[] = {WASM_LOOP(WASM_BRV_IF_ZERO(1, WASM_GET_LOCAL(which)),
WASM_GET_LOCAL(which ^ 1))};
if (type == kAstI32) {
......@@ -1738,8 +1732,7 @@ TEST_F(AstDecoderTest, BrTable2a) {
TEST_F(AstDecoderTest, BrTable2b) {
static byte code[] = {WASM_BLOCK(
1, WASM_BLOCK(
1, WASM_BR_TABLE(WASM_I8(67), 1, BR_TARGET(0), BR_TARGET(1))))};
WASM_BLOCK(WASM_BR_TABLE(WASM_I8(67), 1, BR_TARGET(0), BR_TARGET(1))))};
EXPECT_VERIFIES(sigs.v_v(), code);
}
......@@ -1764,7 +1757,7 @@ TEST_F(AstDecoderTest, BrTable_invalid_br1) {
TEST_F(AstDecoderTest, BrTable_invalid_br2) {
for (int depth = 0; depth < 4; depth++) {
byte code[] = {
WASM_LOOP(1, WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))};
WASM_LOOP(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))};
if (depth <= 1) {
EXPECT_VERIFIES(sigs.v_i(), code);
} else {
......@@ -1779,14 +1772,14 @@ TEST_F(AstDecoderTest, ExprBreakNesting1) {
EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BR_IF(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BRV(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BR(0)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BRV(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(0)));
EXPECT_VERIFIES_INLINE(sigs.v_v(),
WASM_LOOP(1, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO)));
WASM_LOOP(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR_IF(0, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BRV(1, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(1, WASM_BR(1)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BRV(1, WASM_ZERO)));
EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(1)));
}
TEST_F(AstDecoderTest, Select) {
......
......@@ -52,7 +52,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) {
TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
num_locals = 5;
for (int i = 0; i < 5; i++) {
byte code[] = {WASM_LOOP(1, WASM_SET_ZERO(i))};
byte code[] = {WASM_LOOP(WASM_SET_ZERO(i))};
BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) {
CHECK_EQ(j == i, assigned->Contains(j));
......@@ -63,7 +63,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) {
num_locals = 5;
for (int i = 0; i < 5; i++) {
byte code[] = {WASM_LOOP(1, WASM_SET_ZERO(i)), WASM_SET_ZERO(1)};
byte code[] = {WASM_LOOP(WASM_SET_ZERO(i)), WASM_SET_ZERO(1)};
BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) {
CHECK_EQ(j == i, assigned->Contains(j));
......@@ -75,7 +75,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Two) {
num_locals = 5;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
byte code[] = {WASM_LOOP(2, WASM_SET_ZERO(i), WASM_SET_ZERO(j))};
byte code[] = {WASM_LOOP(WASM_SET_ZERO(i), WASM_SET_ZERO(j))};
BitVector* assigned = Analyze(code, code + arraysize(code));
for (int k = 0; k < assigned->length(); k++) {
bool expected = k == i || k == j;
......@@ -89,7 +89,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) {
num_locals = 5;
for (int i = 0; i < 5; i++) {
byte code[] = {WASM_LOOP(
1, WASM_IF_ELSE(WASM_SET_ZERO(0), WASM_SET_ZERO(i), WASM_SET_ZERO(1)))};
WASM_IF_ELSE(WASM_SET_ZERO(0), WASM_SET_ZERO(i), WASM_SET_ZERO(1)))};
BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) {
bool expected = i == j || j == 0 || j == 1;
......@@ -128,7 +128,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) {
TEST_F(WasmLoopAssignmentAnalyzerTest, Break) {
num_locals = 3;
byte code[] = {
WASM_LOOP(1, WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_SET_ZERO(1)))),
WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_SET_ZERO(1)))),
WASM_SET_ZERO(0)};
BitVector* assigned = Analyze(code, code + arraysize(code));
......@@ -141,10 +141,10 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Break) {
TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) {
num_locals = 5;
byte code[] = {
WASM_LOOP(1, WASM_IF(WASM_GET_LOCAL(0),
WASM_BRV(0, WASM_SET_LOCAL(
3, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I8(1)))))),
WASM_LOOP(WASM_IF(
WASM_GET_LOCAL(0),
WASM_BRV(0, WASM_SET_LOCAL(
3, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1)))))),
WASM_GET_LOCAL(0)};
BitVector* assigned = Analyze(code, code + arraysize(code));
......@@ -160,16 +160,15 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) {
const byte kSum = 3;
byte code[] = {WASM_BLOCK(
3,
WASM_WHILE(
WASM_GET_LOCAL(kIter),
WASM_BLOCK(2, WASM_SET_LOCAL(
kSum, WASM_F32_ADD(
WASM_GET_LOCAL(kSum),
WASM_LOAD_MEM(MachineType::Float32(),
WASM_GET_LOCAL(kIter)))),
WASM_SET_LOCAL(kIter, WASM_I32_SUB(WASM_GET_LOCAL(kIter),
WASM_I8(4))))),
WASM_BLOCK(
WASM_SET_LOCAL(
kSum, WASM_F32_ADD(WASM_GET_LOCAL(kSum),
WASM_LOAD_MEM(MachineType::Float32(),
WASM_GET_LOCAL(kIter)))),
WASM_SET_LOCAL(kIter,
WASM_I32_SUB(WASM_GET_LOCAL(kIter), WASM_I8(4))))),
WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)),
WASM_GET_LOCAL(kIter))};
......
......@@ -65,17 +65,17 @@ TEST_F(WasmMacroGenTest, Statements) {
EXPECT_SIZE(3, WASM_BR(0));
EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO));
EXPECT_SIZE(3, WASM_BLOCK(1, WASM_NOP));
EXPECT_SIZE(4, WASM_BLOCK(2, WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_NOP));
EXPECT_SIZE(3, WASM_BLOCK(WASM_NOP));
EXPECT_SIZE(4, WASM_BLOCK(WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_INFINITE_LOOP);
EXPECT_SIZE(3, WASM_LOOP(1, WASM_NOP));
EXPECT_SIZE(4, WASM_LOOP(2, WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_LOOP(1, WASM_BR(0)));
EXPECT_SIZE(7, WASM_LOOP(1, WASM_BR_IF(0, WASM_ZERO)));
EXPECT_SIZE(3, WASM_LOOP(WASM_NOP));
EXPECT_SIZE(4, WASM_LOOP(WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP));
EXPECT_SIZE(5, WASM_LOOP(WASM_BR(0)));
EXPECT_SIZE(7, WASM_LOOP(WASM_BR_IF(0, WASM_ZERO)));
EXPECT_SIZE(2, WASM_RETURN0);
EXPECT_SIZE(4, WASM_RETURN1(WASM_ZERO));
......@@ -113,13 +113,13 @@ TEST_F(WasmMacroGenTest, Expressions) {
EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO));
EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO));
EXPECT_SIZE(4, WASM_BLOCK(1, WASM_ZERO));
EXPECT_SIZE(5, WASM_BLOCK(2, WASM_NOP, WASM_ZERO));
EXPECT_SIZE(6, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_ZERO));
EXPECT_SIZE(4, WASM_BLOCK(WASM_ZERO));
EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_ZERO));
EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_ZERO));
EXPECT_SIZE(4, WASM_LOOP(1, WASM_ZERO));
EXPECT_SIZE(5, WASM_LOOP(2, WASM_NOP, WASM_ZERO));
EXPECT_SIZE(6, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_ZERO));
EXPECT_SIZE(4, WASM_LOOP(WASM_ZERO));
EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_ZERO));
EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_ZERO));
}
TEST_F(WasmMacroGenTest, CallFunction) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment