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

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

Issue 2646093003: [wasm] Unreachability fix for br_table. (Closed)
Patch Set: [wasm] Unreachability fix for br_table. 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
« no previous file with comments | « src/wasm/function-body-decoder.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/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 196e2357c5e18ce48a0360d414ea7bd4ae5ba40b..14a74f7b22721a41d8f8a58fb7755505cefee68a 100644
--- a/test/unittests/wasm/function-body-decoder-unittest.cc
+++ b/test/unittests/wasm/function-body-decoder-unittest.cc
@@ -2133,6 +2133,12 @@ TEST_F(FunctionBodyDecoderTest, BrTable_invalid_br2) {
}
}
+TEST_F(FunctionBodyDecoderTest, BrUnreachable) {
+ static byte code[] = {WASM_GET_LOCAL(0), kExprBrTable, 0,
+ BR_TARGET(0), kExprSetLocal, 0};
+ EXPECT_VERIFIES_C(v_i, code);
+}
+
TEST_F(FunctionBodyDecoderTest, Brv1) {
EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV(0, WASM_ZERO)));
EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_LOOP(WASM_BRV(2, WASM_ZERO))));
@@ -2225,6 +2231,12 @@ TEST_F(FunctionBodyDecoderTest, Throw) {
EXPECT_FAILURE(l_l, WASM_GET_LOCAL(0), kExprThrow, WASM_I64V(0));
}
+TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
+ // TODO(titzer): unreachable code after throw should validate.
+ // FLAG_wasm_eh_prototype = true;
+ // EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), kExprThrow, kExprSetLocal, 0);
+}
+
#define WASM_TRY_OP kExprTry, kLocalVoid
#define WASM_CATCH(local) kExprCatch, static_cast<byte>(local)
« no previous file with comments | « src/wasm/function-body-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698