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

Unified Diff: test/cctest/wasm/test-run-wasm.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 | « src/wasm/ast-decoder.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm.cc
diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
index 2df1516bcb138ee491e06fbbc1c5a34dde986caf..39812637f4af9a5e3fe2a75fffb0b95722ae4898 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -1002,6 +1002,34 @@ TEST(Run_Wasm_BrIf_strict) {
FOR_INT32_INPUTS(i) { CHECK_EQ(99, r.Call(*i)); }
}
+TEST(Run_Wasm_TableSwitch0a) {
+ WasmRunner<int32_t> r(MachineType::Int32());
+ BUILD(r, WASM_BLOCK(2, WASM_TABLESWITCH_OP(0, 1, WASM_CASE_BR(0)),
+ WASM_TABLESWITCH_BODY0(WASM_GET_LOCAL(0)), WASM_I8(91)));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); }
+}
+
+TEST(Run_Wasm_TableSwitch0b) {
+ WasmRunner<int32_t> r(MachineType::Int32());
+ BUILD(r, WASM_BLOCK(
+ 2, WASM_TABLESWITCH_OP(0, 2, WASM_CASE_BR(0), WASM_CASE_BR(0)),
+ WASM_TABLESWITCH_BODY0(WASM_GET_LOCAL(0)), WASM_I8(92)));
+ FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); }
+}
+
+TEST(Run_Wasm_TableSwitch0c) {
+ WasmRunner<int32_t> r(MachineType::Int32());
+ BUILD(r,
+ WASM_BLOCK(2, WASM_BLOCK(2, WASM_TABLESWITCH_OP(0, 2, WASM_CASE_BR(0),
+ WASM_CASE_BR(1)),
+ WASM_TABLESWITCH_BODY0(WASM_GET_LOCAL(0)),
+ WASM_RETURN(WASM_I8(76))),
+ WASM_I8(77)));
+ FOR_INT32_INPUTS(i) {
+ int32_t expected = *i == 0 ? 76 : 77;
+ CHECK_EQ(expected, r.Call(*i));
+ }
+}
TEST(Run_Wasm_TableSwitch1) {
WasmRunner<int32_t> r(MachineType::Int32());
« no previous file with comments | « src/wasm/ast-decoder.cc ('k') | test/unittests/wasm/ast-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698