Index: test/unittests/wasm/wasm-macro-gen-unittest.cc |
diff --git a/test/unittests/wasm/wasm-macro-gen-unittest.cc b/test/unittests/wasm/wasm-macro-gen-unittest.cc |
index 0399835d010ad0f0fc56631b2eea09a7db4f53f5..2b782f5dc7e7b8b7468ad65a2e94edcbb425a694 100644 |
--- a/test/unittests/wasm/wasm-macro-gen-unittest.cc |
+++ b/test/unittests/wasm/wasm-macro-gen-unittest.cc |
@@ -56,44 +56,45 @@ |
EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO)); |
- EXPECT_SIZE(6, WASM_IF(WASM_ZERO, WASM_NOP)); |
- |
- EXPECT_SIZE(8, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); |
+ EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP)); |
+ |
+ EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); |
EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); |
- EXPECT_SIZE(2, WASM_BR(0)); |
- EXPECT_SIZE(4, WASM_BR_IF(0, WASM_ZERO)); |
- |
- EXPECT_SIZE(4, WASM_BLOCK(WASM_NOP)); |
- EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_NOP)); |
- EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_NOP)); |
+ EXPECT_SIZE(3, WASM_BR(0)); |
+ EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO)); |
+ |
+ 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(4, WASM_LOOP(WASM_NOP)); |
- EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_NOP)); |
- EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)); |
+ 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(1, WASM_RETURN0); |
- EXPECT_SIZE(3, WASM_RETURN1(WASM_ZERO)); |
+ EXPECT_SIZE(2, WASM_RETURN0); |
+ EXPECT_SIZE(4, WASM_RETURN1(WASM_ZERO)); |
EXPECT_SIZE(1, WASM_UNREACHABLE); |
} |
TEST_F(WasmMacroGenTest, MacroStatements) { |
- EXPECT_SIZE(11, WASM_WHILE(WASM_I8(0), WASM_NOP)); |
+ EXPECT_SIZE(10, WASM_WHILE(WASM_I8(0), WASM_NOP)); |
EXPECT_SIZE(7, WASM_INC_LOCAL(0)); |
EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3)); |
- EXPECT_SIZE(2, WASM_CONTINUE(0)); |
+ EXPECT_SIZE(3, WASM_BREAK(0)); |
+ EXPECT_SIZE(3, WASM_CONTINUE(0)); |
} |
TEST_F(WasmMacroGenTest, BrTable) { |
- EXPECT_SIZE(5, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(0))); |
- EXPECT_SIZE(6, WASM_BR_TABLE(WASM_ZERO, 2, BR_TARGET(0), BR_TARGET(0))); |
+ EXPECT_SIZE(9, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1))); |
+ EXPECT_SIZE(11, WASM_BR_TABLEV(WASM_ZERO, WASM_ZERO, 1, BR_TARGET(1))); |
} |
TEST_F(WasmMacroGenTest, Expressions) { |
@@ -109,34 +110,43 @@ |
EXPECT_SIZE(3, WASM_NOT(WASM_ZERO)); |
- EXPECT_SIZE(4, WASM_BRV(1, WASM_ZERO)); |
- EXPECT_SIZE(6, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); |
- |
- EXPECT_SIZE(5, WASM_BLOCK(WASM_ZERO)); |
- EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_ZERO)); |
- EXPECT_SIZE(7, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_ZERO)); |
- |
- EXPECT_SIZE(5, WASM_LOOP(WASM_ZERO)); |
- EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_ZERO)); |
- EXPECT_SIZE(7, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_ZERO)); |
+ EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO)); |
+ EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, 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(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) { |
- EXPECT_SIZE(2, WASM_CALL_FUNCTION0(0)); |
- EXPECT_SIZE(2, WASM_CALL_FUNCTION0(1)); |
- EXPECT_SIZE(2, WASM_CALL_FUNCTION0(11)); |
- |
- EXPECT_SIZE(4, WASM_CALL_FUNCTION(0, WASM_ZERO)); |
- EXPECT_SIZE(6, WASM_CALL_FUNCTION(1, WASM_ZERO, WASM_ZERO)); |
+ EXPECT_SIZE(3, WASM_CALL_FUNCTION0(0)); |
+ EXPECT_SIZE(3, WASM_CALL_FUNCTION0(1)); |
+ EXPECT_SIZE(3, WASM_CALL_FUNCTION0(11)); |
+ |
+ EXPECT_SIZE(5, WASM_CALL_FUNCTION1(0, WASM_ZERO)); |
+ EXPECT_SIZE(7, WASM_CALL_FUNCTION2(1, WASM_ZERO, WASM_ZERO)); |
+} |
+ |
+TEST_F(WasmMacroGenTest, CallImport) { |
+ EXPECT_SIZE(3, WASM_CALL_IMPORT0(0)); |
+ EXPECT_SIZE(3, WASM_CALL_IMPORT0(1)); |
+ EXPECT_SIZE(3, WASM_CALL_IMPORT0(11)); |
+ |
+ EXPECT_SIZE(5, WASM_CALL_IMPORT1(0, WASM_ZERO)); |
+ EXPECT_SIZE(7, WASM_CALL_IMPORT2(1, WASM_ZERO, WASM_ZERO)); |
} |
TEST_F(WasmMacroGenTest, CallIndirect) { |
- EXPECT_SIZE(4, WASM_CALL_INDIRECT0(0, WASM_ZERO)); |
- EXPECT_SIZE(4, WASM_CALL_INDIRECT0(1, WASM_ZERO)); |
- EXPECT_SIZE(4, WASM_CALL_INDIRECT0(11, WASM_ZERO)); |
- |
- EXPECT_SIZE(6, WASM_CALL_INDIRECT1(0, WASM_ZERO, WASM_ZERO)); |
- EXPECT_SIZE(8, WASM_CALL_INDIRECT2(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)); |
+ EXPECT_SIZE(5, WASM_CALL_INDIRECT0(0, WASM_ZERO)); |
+ EXPECT_SIZE(5, WASM_CALL_INDIRECT0(1, WASM_ZERO)); |
+ EXPECT_SIZE(5, WASM_CALL_INDIRECT0(11, WASM_ZERO)); |
+ |
+ EXPECT_SIZE(7, WASM_CALL_INDIRECT1(0, WASM_ZERO, WASM_ZERO)); |
+ EXPECT_SIZE(9, WASM_CALL_INDIRECT2(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)); |
} |
TEST_F(WasmMacroGenTest, Int32Ops) { |