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

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

Issue 1642043002: [wasm] Fix decoding failures for tableswitch. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/wasm/ast-decoder-unittest.cc
diff --git a/test/unittests/wasm/ast-decoder-unittest.cc b/test/unittests/wasm/ast-decoder-unittest.cc
index 5538170a7baccf718225a198978f0ed1eaf9058e..f6f29f90bfa8537999911e7fffcc59a3c62406cb 100644
--- a/test/unittests/wasm/ast-decoder-unittest.cc
+++ b/test/unittests/wasm/ast-decoder-unittest.cc
@@ -1798,6 +1798,12 @@ TEST_F(WasmDecoderTest, TableSwitch0c) {
EXPECT_VERIFIES(&env_v_v, code);
}
+TEST_F(WasmDecoderTest, TableSwitch0d) {
+ static byte code[] = {
+ WASM_BLOCK(1, WASM_TABLESWITCH_OP(0, 2, WASM_CASE_BR(0), WASM_CASE_BR(1)),
+ WASM_I8(67))};
+ EXPECT_VERIFIES(&env_v_v, code);
+}
TEST_F(WasmDecoderTest, TableSwitch1) {
static byte code[] = {WASM_TABLESWITCH_OP(1, 1, WASM_CASE(0)),
@@ -1845,27 +1851,25 @@ TEST_F(WasmDecoderTest, TableSwitch1b) {
#endif
-
-TEST_F(WasmDecoderTest, TableSwitch_br) {
- EXPECT_VERIFIES_INLINE(&env_i_i, WASM_TABLESWITCH_OP(0, 1, WASM_CASE_BR(0)),
- WASM_GET_LOCAL(0));
+TEST_F(WasmDecoderTest, TableSwitch_br1) {
for (int depth = 0; depth < 2; depth++) {
- EXPECT_VERIFIES_INLINE(
- &env_i_i, WASM_BLOCK(1, WASM_TABLESWITCH_OP(0, 1, WASM_CASE_BR(depth)),
- WASM_GET_LOCAL(0)));
+ byte code[] = {WASM_BLOCK(1, WASM_TABLESWITCH_OP(0, 1, WASM_CASE_BR(depth)),
+ WASM_GET_LOCAL(0))};
+ EXPECT_VERIFIES(&env_v_i, code);
+ EXPECT_FAILURE(&env_i_i, code);
}
}
TEST_F(WasmDecoderTest, TableSwitch_invalid_br) {
for (int depth = 1; depth < 4; depth++) {
- EXPECT_FAILURE_INLINE(&env_i_i,
+ EXPECT_FAILURE_INLINE(&env_v_i,
WASM_TABLESWITCH_OP(0, 1, WASM_CASE_BR(depth)),
WASM_GET_LOCAL(0));
EXPECT_FAILURE_INLINE(
- &env_i_i,
- WASM_BLOCK(1, WASM_TABLESWITCH_OP(0, 1, WASM_CASE_BR(depth + 1)),
- WASM_GET_LOCAL(0)));
+ &env_v_i,
+ WASM_TABLESWITCH_OP(0, 2, WASM_CASE_BR(depth), WASM_CASE_BR(depth)),
+ WASM_GET_LOCAL(0));
}
}
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698