Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Unified Diff: test/unittests/wasm/function-body-decoder-unittest.cc

Issue 2595733003: [wasm] Remove non-standard kExprI8Const bytecode (Closed)
Patch Set: Remove regression test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/unittests/wasm/function-body-decoder-unittest.cc
diff --git a/test/unittests/wasm/function-body-decoder-unittest.cc b/test/unittests/wasm/function-body-decoder-unittest.cc
index c55d00513a1eea1ca37115901a1e6a63389a6616..429394d02af68d0b95dee5c4fb614cb7ba4b4711 100644
--- a/test/unittests/wasm/function-body-decoder-unittest.cc
+++ b/test/unittests/wasm/function-body-decoder-unittest.cc
@@ -183,10 +183,10 @@ class FunctionBodyDecoderTest : public TestWithZone {
}
};
-TEST_F(FunctionBodyDecoderTest, Int8Const) {
- byte code[] = {kExprI8Const, 0};
- for (int i = -128; i < 128; i++) {
- code[1] = static_cast<byte>(i);
+TEST_F(FunctionBodyDecoderTest, Int32Const1) {
+ byte code[] = {kExprI32Const, 0};
+ for (int i = -64; i <= 63; i++) {
+ code[1] = static_cast<byte>(i & 0x7F);
EXPECT_VERIFIES_C(i_i, code);
}
}
@@ -203,11 +203,11 @@ TEST_F(FunctionBodyDecoderTest, IncompleteIf1) {
EXPECT_FAILURE_C(i_i, code);
}
-TEST_F(FunctionBodyDecoderTest, Int8Const_fallthru) {
+TEST_F(FunctionBodyDecoderTest, Int32Const_fallthru) {
EXPECT_VERIFIES(i_i, WASM_I32V_1(0));
}
-TEST_F(FunctionBodyDecoderTest, Int8Const_fallthru2) {
+TEST_F(FunctionBodyDecoderTest, Int32Const_fallthru2) {
EXPECT_FAILURE(i_i, WASM_I32V_1(0), WASM_I32V_1(1));
}
@@ -421,8 +421,8 @@ TEST_F(FunctionBodyDecoderTest, TeeLocalN_local) {
for (byte i = 1; i < 8; i++) {
AddLocals(kWasmI32, 1);
for (byte j = 0; j < i; j++) {
- EXPECT_FAILURE(v_v, WASM_TEE_LOCAL(j, WASM_I8(i)));
- EXPECT_VERIFIES(i_i, WASM_TEE_LOCAL(j, WASM_I8(i)));
+ EXPECT_FAILURE(v_v, WASM_TEE_LOCAL(j, WASM_I32V_1(i)));
+ EXPECT_VERIFIES(i_i, WASM_TEE_LOCAL(j, WASM_I32V_1(i)));
}
}
}
@@ -527,12 +527,13 @@ TEST_F(FunctionBodyDecoderTest, Block2b) {
TEST_F(FunctionBodyDecoderTest, Block2_fallthru) {
EXPECT_VERIFIES(
i_i, B2(WASM_SET_LOCAL(0, WASM_ZERO), WASM_SET_LOCAL(0, WASM_ZERO)),
- WASM_I8(23));
+ WASM_I32V_1(23));
}
TEST_F(FunctionBodyDecoderTest, Block3) {
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_ZERO), WASM_I8(11)));
+ EXPECT_VERIFIES(i_i,
+ WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_ZERO), WASM_I32V_1(11)));
}
TEST_F(FunctionBodyDecoderTest, Block5) {
@@ -606,8 +607,8 @@ TEST_F(FunctionBodyDecoderTest, NestedBlock_return) {
}
TEST_F(FunctionBodyDecoderTest, BlockBrBinop) {
- EXPECT_VERIFIES(
- i_i, WASM_I32_AND(WASM_BLOCK_I(WASM_BRV(0, WASM_I8(1))), WASM_I8(2)));
+ EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(1))),
+ WASM_I32V_1(2)));
}
TEST_F(FunctionBodyDecoderTest, If_empty1) {
@@ -635,19 +636,19 @@ TEST_F(FunctionBodyDecoderTest, If_empty_stack) {
}
TEST_F(FunctionBodyDecoderTest, If_incomplete1) {
- byte code[] = {kExprI8Const, 0, kExprIf};
+ byte code[] = {kExprI32Const, 0, kExprIf};
EXPECT_FAILURE_C(v_v, code);
EXPECT_FAILURE_C(i_i, code);
}
TEST_F(FunctionBodyDecoderTest, If_incomplete2) {
- byte code[] = {kExprI8Const, 0, kExprIf, kExprNop};
+ byte code[] = {kExprI32Const, 0, kExprIf, kExprNop};
EXPECT_FAILURE_C(v_v, code);
EXPECT_FAILURE_C(i_i, code);
}
TEST_F(FunctionBodyDecoderTest, If_else_else) {
- byte code[] = {kExprI8Const, 0, WASM_IF_OP, kExprElse, kExprElse, kExprEnd};
+ byte code[] = {kExprI32Const, 0, WASM_IF_OP, kExprElse, kExprElse, kExprEnd};
EXPECT_FAILURE_C(v_v, code);
EXPECT_FAILURE_C(i_i, code);
}
@@ -704,7 +705,7 @@ TEST_F(FunctionBodyDecoderTest, IfElseBreak) {
}
TEST_F(FunctionBodyDecoderTest, Block_else) {
- byte code[] = {kExprI8Const, 0, kExprBlock, kExprElse, kExprEnd};
+ byte code[] = {kExprI32Const, 0, kExprBlock, kExprElse, kExprEnd};
EXPECT_FAILURE_C(v_v, code);
EXPECT_FAILURE_C(i_i, code);
}
@@ -776,7 +777,7 @@ TEST_F(FunctionBodyDecoderTest, IfBlock2b) {
TEST_F(FunctionBodyDecoderTest, IfElseSet) {
EXPECT_VERIFIES(v_i,
WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_I8(1))));
+ WASM_SET_LOCAL(0, WASM_I32V_1(1))));
}
TEST_F(FunctionBodyDecoderTest, Loop0) {
@@ -867,7 +868,6 @@ TEST_F(FunctionBodyDecoderTest, ReturnVoid2) {
}
TEST_F(FunctionBodyDecoderTest, ReturnVoid3) {
- EXPECT_FAILURE(v_v, kExprI8Const, 0);
EXPECT_FAILURE(v_v, kExprI32Const, 0);
EXPECT_FAILURE(v_v, kExprI64Const, 0);
EXPECT_FAILURE(v_v, kExprF32Const, 0, 0, 0, 0);
@@ -897,12 +897,12 @@ TEST_F(FunctionBodyDecoderTest, Unreachable_select) {
}
TEST_F(FunctionBodyDecoderTest, If1) {
- EXPECT_VERIFIES(i_i,
- WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(8)));
EXPECT_VERIFIES(
- i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(
- i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_I8(8)));
+ i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9), WASM_I32V_1(8)));
+ EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9),
+ WASM_GET_LOCAL(0)));
+ EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_I32V_1(8)));
}
TEST_F(FunctionBodyDecoderTest, If_off_end) {
@@ -916,7 +916,7 @@ TEST_F(FunctionBodyDecoderTest, If_off_end) {
TEST_F(FunctionBodyDecoderTest, If_type1) {
// float|double ? 1 : 2
static const byte kCode[] = {
- WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(0), WASM_I8(2))};
+ WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(0), WASM_I32V_1(2))};
EXPECT_VERIFIES_C(i_i, kCode);
EXPECT_FAILURE_C(i_f, kCode);
EXPECT_FAILURE_C(i_d, kCode);
@@ -925,7 +925,7 @@ TEST_F(FunctionBodyDecoderTest, If_type1) {
TEST_F(FunctionBodyDecoderTest, If_type2) {
// 1 ? float|double : 2
static const byte kCode[] = {
- WASM_IF_ELSE_I(WASM_I8(1), WASM_GET_LOCAL(0), WASM_I8(1))};
+ WASM_IF_ELSE_I(WASM_I32V_1(1), WASM_GET_LOCAL(0), WASM_I32V_1(1))};
EXPECT_VERIFIES_C(i_i, kCode);
EXPECT_FAILURE_C(i_f, kCode);
EXPECT_FAILURE_C(i_d, kCode);
@@ -934,7 +934,7 @@ TEST_F(FunctionBodyDecoderTest, If_type2) {
TEST_F(FunctionBodyDecoderTest, If_type3) {
// stmt ? 0 : 1
static const byte kCode[] = {
- WASM_IF_ELSE_I(WASM_NOP, WASM_I8(0), WASM_I8(1))};
+ WASM_IF_ELSE_I(WASM_NOP, WASM_I32V_1(0), WASM_I32V_1(1))};
EXPECT_FAILURE_C(i_i, kCode);
EXPECT_FAILURE_C(i_f, kCode);
EXPECT_FAILURE_C(i_d, kCode);
@@ -943,7 +943,7 @@ TEST_F(FunctionBodyDecoderTest, If_type3) {
TEST_F(FunctionBodyDecoderTest, If_type4) {
// 0 ? stmt : 1
static const byte kCode[] = {
- WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_NOP, WASM_I8(1))};
+ WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_NOP, WASM_I32V_1(1))};
EXPECT_FAILURE_C(i_i, kCode);
EXPECT_FAILURE_C(i_f, kCode);
EXPECT_FAILURE_C(i_d, kCode);
@@ -951,7 +951,8 @@ TEST_F(FunctionBodyDecoderTest, If_type4) {
TEST_F(FunctionBodyDecoderTest, If_type5) {
// 0 ? 1 : stmt
- static const byte kCode[] = {WASM_IF_ELSE_I(WASM_ZERO, WASM_I8(1), WASM_NOP)};
+ static const byte kCode[] = {
+ WASM_IF_ELSE_I(WASM_ZERO, WASM_I32V_1(1), WASM_NOP)};
EXPECT_FAILURE_C(i_i, kCode);
EXPECT_FAILURE_C(i_f, kCode);
EXPECT_FAILURE_C(i_d, kCode);
@@ -1028,8 +1029,8 @@ TEST_F(FunctionBodyDecoderTest, TypeConversions) {
TEST_F(FunctionBodyDecoderTest, MacrosStmt) {
EXPECT_VERIFIES(v_i, WASM_SET_LOCAL(0, WASM_I32V_3(87348)));
- EXPECT_VERIFIES(
- v_i, WASM_STORE_MEM(MachineType::Int32(), WASM_I8(24), WASM_I8(40)));
+ EXPECT_VERIFIES(v_i, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V_1(24),
+ WASM_I32V_1(40)));
EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP));
EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP));
EXPECT_VERIFIES(v_v, WASM_NOP);
@@ -1066,7 +1067,7 @@ TEST_F(FunctionBodyDecoderTest, MultipleReturn) {
FunctionSig sig_iii_v(3, 0, kIntTypes5);
EXPECT_VERIFIES_S(&sig_iii_v,
- WASM_RETURNN(3, WASM_ZERO, WASM_ONE, WASM_I8(44)));
+ WASM_RETURNN(3, WASM_ZERO, WASM_ONE, WASM_I32V_1(44)));
EXPECT_FAILURE_S(&sig_iii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE));
}
@@ -1079,38 +1080,38 @@ TEST_F(FunctionBodyDecoderTest, MultipleReturn_fallthru) {
EXPECT_FAILURE_S(&sig_ii_v, WASM_ZERO);
FunctionSig sig_iii_v(3, 0, kIntTypes5);
- EXPECT_VERIFIES_S(&sig_iii_v, WASM_ZERO, WASM_ONE, WASM_I8(44));
+ EXPECT_VERIFIES_S(&sig_iii_v, WASM_ZERO, WASM_ONE, WASM_I32V_1(44));
EXPECT_FAILURE_S(&sig_iii_v, WASM_ZERO, WASM_ONE);
}
TEST_F(FunctionBodyDecoderTest, MacrosInt32) {
- EXPECT_VERIFIES(i_i, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_I8(12)));
- EXPECT_VERIFIES(i_i, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(13)));
- EXPECT_VERIFIES(i_i, WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_I8(14)));
- EXPECT_VERIFIES(i_i, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I8(15)));
- EXPECT_VERIFIES(i_i, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I8(16)));
- EXPECT_VERIFIES(i_i, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I8(17)));
- EXPECT_VERIFIES(i_i, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_I8(18)));
- EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_GET_LOCAL(0), WASM_I8(19)));
- EXPECT_VERIFIES(i_i, WASM_I32_IOR(WASM_GET_LOCAL(0), WASM_I8(20)));
- EXPECT_VERIFIES(i_i, WASM_I32_XOR(WASM_GET_LOCAL(0), WASM_I8(21)));
- EXPECT_VERIFIES(i_i, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_I8(22)));
- EXPECT_VERIFIES(i_i, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_I8(23)));
- EXPECT_VERIFIES(i_i, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_I8(24)));
- EXPECT_VERIFIES(i_i, WASM_I32_ROR(WASM_GET_LOCAL(0), WASM_I8(24)));
- EXPECT_VERIFIES(i_i, WASM_I32_ROL(WASM_GET_LOCAL(0), WASM_I8(24)));
- EXPECT_VERIFIES(i_i, WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(25)));
- EXPECT_VERIFIES(i_i, WASM_I32_NE(WASM_GET_LOCAL(0), WASM_I8(25)));
-
- EXPECT_VERIFIES(i_i, WASM_I32_LTS(WASM_GET_LOCAL(0), WASM_I8(26)));
- EXPECT_VERIFIES(i_i, WASM_I32_LES(WASM_GET_LOCAL(0), WASM_I8(27)));
- EXPECT_VERIFIES(i_i, WASM_I32_LTU(WASM_GET_LOCAL(0), WASM_I8(28)));
- EXPECT_VERIFIES(i_i, WASM_I32_LEU(WASM_GET_LOCAL(0), WASM_I8(29)));
-
- EXPECT_VERIFIES(i_i, WASM_I32_GTS(WASM_GET_LOCAL(0), WASM_I8(26)));
- EXPECT_VERIFIES(i_i, WASM_I32_GES(WASM_GET_LOCAL(0), WASM_I8(27)));
- EXPECT_VERIFIES(i_i, WASM_I32_GTU(WASM_GET_LOCAL(0), WASM_I8(28)));
- EXPECT_VERIFIES(i_i, WASM_I32_GEU(WASM_GET_LOCAL(0), WASM_I8(29)));
+ EXPECT_VERIFIES(i_i, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_I32V_1(12)));
+ EXPECT_VERIFIES(i_i, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(13)));
+ EXPECT_VERIFIES(i_i, WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_I32V_1(14)));
+ EXPECT_VERIFIES(i_i, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(15)));
+ EXPECT_VERIFIES(i_i, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(16)));
+ EXPECT_VERIFIES(i_i, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(17)));
+ EXPECT_VERIFIES(i_i, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_I32V_1(18)));
+ EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_GET_LOCAL(0), WASM_I32V_1(19)));
+ EXPECT_VERIFIES(i_i, WASM_I32_IOR(WASM_GET_LOCAL(0), WASM_I32V_1(20)));
+ EXPECT_VERIFIES(i_i, WASM_I32_XOR(WASM_GET_LOCAL(0), WASM_I32V_1(21)));
+ EXPECT_VERIFIES(i_i, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_I32V_1(22)));
+ EXPECT_VERIFIES(i_i, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_I32V_1(23)));
+ EXPECT_VERIFIES(i_i, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_I32V_1(24)));
+ EXPECT_VERIFIES(i_i, WASM_I32_ROR(WASM_GET_LOCAL(0), WASM_I32V_1(24)));
+ EXPECT_VERIFIES(i_i, WASM_I32_ROL(WASM_GET_LOCAL(0), WASM_I32V_1(24)));
+ EXPECT_VERIFIES(i_i, WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(25)));
+ EXPECT_VERIFIES(i_i, WASM_I32_NE(WASM_GET_LOCAL(0), WASM_I32V_1(25)));
+
+ EXPECT_VERIFIES(i_i, WASM_I32_LTS(WASM_GET_LOCAL(0), WASM_I32V_1(26)));
+ EXPECT_VERIFIES(i_i, WASM_I32_LES(WASM_GET_LOCAL(0), WASM_I32V_1(27)));
+ EXPECT_VERIFIES(i_i, WASM_I32_LTU(WASM_GET_LOCAL(0), WASM_I32V_1(28)));
+ EXPECT_VERIFIES(i_i, WASM_I32_LEU(WASM_GET_LOCAL(0), WASM_I32V_1(29)));
+
+ EXPECT_VERIFIES(i_i, WASM_I32_GTS(WASM_GET_LOCAL(0), WASM_I32V_1(26)));
+ EXPECT_VERIFIES(i_i, WASM_I32_GES(WASM_GET_LOCAL(0), WASM_I32V_1(27)));
+ EXPECT_VERIFIES(i_i, WASM_I32_GTU(WASM_GET_LOCAL(0), WASM_I32V_1(28)));
+ EXPECT_VERIFIES(i_i, WASM_I32_GEU(WASM_GET_LOCAL(0), WASM_I32V_1(29)));
}
TEST_F(FunctionBodyDecoderTest, MacrosInt64) {
@@ -1170,7 +1171,7 @@ TEST_F(FunctionBodyDecoderTest, MemorySize) {
TEST_F(FunctionBodyDecoderTest, LoadMemOffset) {
for (int offset = 0; offset < 128; offset += 7) {
- byte code[] = {kExprI8Const, 0, kExprI32LoadMem, ZERO_ALIGNMENT,
+ byte code[] = {kExprI32Const, 0, kExprI32LoadMem, ZERO_ALIGNMENT,
static_cast<byte>(offset)};
EXPECT_VERIFIES_C(i_i, code);
}
@@ -1345,8 +1346,9 @@ TEST_F(FunctionBodyDecoderTest, SimpleCalls) {
module_env.AddFunction(sigs.i_ii());
EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION0(0));
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(1, WASM_I8(27)));
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(2, WASM_I8(37), WASM_I8(77)));
+ EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(1, WASM_I32V_1(27)));
+ EXPECT_VERIFIES_S(sig,
+ WASM_CALL_FUNCTION(2, WASM_I32V_1(37), WASM_I32V_2(77)));
}
TEST_F(FunctionBodyDecoderTest, CallsWithTooFewArguments) {
@@ -1382,13 +1384,13 @@ TEST_F(FunctionBodyDecoderTest, CallsWithMismatchedSigs3) {
module_env.AddFunction(sigs.i_f());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I8(17)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I32V_1(17)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I64V_1(27)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F64(37.2)));
module_env.AddFunction(sigs.i_d());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I8(16)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I32V_1(16)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I64V_1(16)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_F32(17.6)));
}
@@ -1448,9 +1450,9 @@ TEST_F(FunctionBodyDecoderTest, SimpleIndirectCalls) {
byte f2 = module_env.AddSignature(sigs.i_ii());
EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT0(f0, WASM_ZERO));
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(22)));
- EXPECT_VERIFIES_S(
- sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I8(32), WASM_I8(72)));
+ EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(22)));
+ EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I32V_1(32),
+ WASM_I32V_2(72)));
}
TEST_F(FunctionBodyDecoderTest, IndirectCallsOutOfBounds) {
@@ -1463,11 +1465,11 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsOutOfBounds) {
module_env.AddSignature(sigs.i_v());
EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I8(22)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I32V_1(22)));
module_env.AddSignature(sigs.i_i());
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I8(27)));
+ EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I32V_1(27)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(2, WASM_ZERO, WASM_I8(27)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(2, WASM_ZERO, WASM_I32V_1(27)));
}
TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs3) {
@@ -1478,17 +1480,17 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs3) {
byte f0 = module_env.AddFunction(sigs.i_f());
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I8(17)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I32V_1(17)));
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I64V_1(27)));
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_F64(37.2)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I8(17)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I32V_1(17)));
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I64V_1(27)));
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_F64(37.2)));
byte f1 = module_env.AddFunction(sigs.i_d());
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(16)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(16)));
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I64V_1(16)));
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_F32(17.6)));
}
@@ -1503,9 +1505,9 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithoutTableCrash) {
byte f2 = module_env.AddSignature(sigs.i_ii());
EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_ZERO));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(22)));
- EXPECT_FAILURE_S(
- sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I8(32), WASM_I8(72)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(22)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I32V_1(32),
+ WASM_I32V_2(72)));
}
TEST_F(FunctionBodyDecoderTest, SimpleImportCalls) {
@@ -1518,8 +1520,9 @@ TEST_F(FunctionBodyDecoderTest, SimpleImportCalls) {
byte f2 = module_env.AddImport(sigs.i_ii());
EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION0(f0));
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(f1, WASM_I8(22)));
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(f2, WASM_I8(32), WASM_I8(72)));
+ EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(f1, WASM_I32V_1(22)));
+ EXPECT_VERIFIES_S(sig,
+ WASM_CALL_FUNCTION(f2, WASM_I32V_1(32), WASM_I32V_2(72)));
}
TEST_F(FunctionBodyDecoderTest, ImportCallsWithMismatchedSigs3) {
@@ -1530,14 +1533,14 @@ TEST_F(FunctionBodyDecoderTest, ImportCallsWithMismatchedSigs3) {
byte f0 = module_env.AddImport(sigs.i_f());
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(f0));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I8(17)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I32V_1(17)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I64V_1(27)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_F64(37.2)));
byte f1 = module_env.AddImport(sigs.i_d());
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(f1));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I8(16)));
+ EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I32V_1(16)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I64V_1(16)));
EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_F32(17.6)));
}
@@ -1799,7 +1802,7 @@ TEST_F(FunctionBodyDecoderTest, BreakNesting1) {
// (block[2] (loop[2] (if (get p) break[N]) (set p 1)) p)
byte code[] = {WASM_BLOCK_I(
WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(i + 1, WASM_ZERO)),
- WASM_SET_LOCAL(0, WASM_I8(1))),
+ WASM_SET_LOCAL(0, WASM_I32V_1(1))),
WASM_ZERO)};
if (i < 3) {
EXPECT_VERIFIES_C(i_i, code);
@@ -1834,16 +1837,16 @@ TEST_F(FunctionBodyDecoderTest, BreakNesting3) {
}
TEST_F(FunctionBodyDecoderTest, BreaksWithMultipleTypes) {
- EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I8(7)), WASM_F32(7.7)));
+ EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I32V_1(7)), WASM_F32(7.7)));
- EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I8(7)),
+ EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I32V_1(7)),
WASM_BRV_IF_ZERO(0, WASM_F32(7.7))));
- EXPECT_FAILURE(
- i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I8(8)), WASM_BRV_IF_ZERO(0, WASM_I8(0)),
- WASM_BRV_IF_ZERO(0, WASM_F32(7.7))));
- EXPECT_FAILURE(i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I8(9)),
+ EXPECT_FAILURE(i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I32V_1(8)),
+ WASM_BRV_IF_ZERO(0, WASM_I32V_1(0)),
+ WASM_BRV_IF_ZERO(0, WASM_F32(7.7))));
+ EXPECT_FAILURE(i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I32V_1(9)),
WASM_BRV_IF_ZERO(0, WASM_F32(7.7)),
- WASM_BRV_IF_ZERO(0, WASM_I8(11))));
+ WASM_BRV_IF_ZERO(0, WASM_I32V_1(11))));
}
TEST_F(FunctionBodyDecoderTest, BreakNesting_6_levels) {
@@ -2039,7 +2042,7 @@ TEST_F(FunctionBodyDecoderTest, BrTable0c) {
}
TEST_F(FunctionBodyDecoderTest, BrTable1a) {
- static byte code[] = {B1(WASM_BR_TABLE(WASM_I8(67), 0, BR_TARGET(0)))};
+ static byte code[] = {B1(WASM_BR_TABLE(WASM_I32V_2(67), 0, BR_TARGET(0)))};
EXPECT_VERIFIES_C(v_v, code);
}
@@ -2053,13 +2056,13 @@ TEST_F(FunctionBodyDecoderTest, BrTable1b) {
TEST_F(FunctionBodyDecoderTest, BrTable2a) {
static byte code[] = {
- B1(WASM_BR_TABLE(WASM_I8(67), 1, BR_TARGET(0), BR_TARGET(0)))};
+ B1(WASM_BR_TABLE(WASM_I32V_2(67), 1, BR_TARGET(0), BR_TARGET(0)))};
EXPECT_VERIFIES_C(v_v, code);
}
TEST_F(FunctionBodyDecoderTest, BrTable2b) {
- static byte code[] = {WASM_BLOCK(
- WASM_BLOCK(WASM_BR_TABLE(WASM_I8(67), 1, BR_TARGET(0), BR_TARGET(1))))};
+ static byte code[] = {WASM_BLOCK(WASM_BLOCK(
+ WASM_BR_TABLE(WASM_I32V_2(67), 1, BR_TARGET(0), BR_TARGET(1))))};
EXPECT_VERIFIES_C(v_v, code);
}
@@ -2341,7 +2344,6 @@ TEST_F(WasmOpcodeLengthTest, Statements) {
}
TEST_F(WasmOpcodeLengthTest, MiscExpressions) {
- EXPECT_LENGTH(2, kExprI8Const);
EXPECT_LENGTH(5, kExprF32Const);
EXPECT_LENGTH(9, kExprF64Const);
EXPECT_LENGTH(2, kExprGetLocal);
@@ -2661,8 +2663,8 @@ class BytecodeIteratorTest : public TestWithZone {};
TEST_F(BytecodeIteratorTest, SimpleForeach) {
byte code[] = {WASM_IF_ELSE(WASM_ZERO, WASM_ZERO, WASM_ZERO)};
BytecodeIterator iter(code, code + sizeof(code));
- WasmOpcode expected[] = {kExprI8Const, kExprIf, kExprI8Const,
- kExprElse, kExprI8Const, kExprEnd};
+ WasmOpcode expected[] = {kExprI32Const, kExprIf, kExprI32Const,
+ kExprElse, kExprI32Const, kExprEnd};
size_t pos = 0;
for (WasmOpcode opcode : iter.opcodes()) {
if (pos >= arraysize(expected)) {
@@ -2715,17 +2717,17 @@ TEST_F(BytecodeIteratorTest, ForeachOffset) {
}
TEST_F(BytecodeIteratorTest, WithLocalDecls) {
- byte code[] = {1, 1, kLocalI32, WASM_I8(9), WASM_I8(11)};
+ byte code[] = {1, 1, kLocalI32, WASM_I32V_1(9), WASM_I32V_1(11)};
BodyLocalDecls decls(zone());
BytecodeIterator iter(code, code + sizeof(code), &decls);
EXPECT_EQ(3u, decls.encoded_size);
EXPECT_EQ(3u, iter.pc_offset());
EXPECT_TRUE(iter.has_next());
- EXPECT_EQ(kExprI8Const, iter.current());
+ EXPECT_EQ(kExprI32Const, iter.current());
iter.next();
EXPECT_TRUE(iter.has_next());
- EXPECT_EQ(kExprI8Const, iter.current());
+ EXPECT_EQ(kExprI32Const, iter.current());
iter.next();
EXPECT_FALSE(iter.has_next());
}

Powered by Google App Engine
This is Rietveld 408576698