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

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

Issue 2646093003: [wasm] Unreachability fix for br_table. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "test/unittests/test-utils.h" 5 #include "test/unittests/test-utils.h"
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "test/common/wasm/test-signatures.h" 9 #include "test/common/wasm/test-signatures.h"
10 10
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2126 byte code[] = { 2126 byte code[] = {
2127 WASM_LOOP(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))}; 2127 WASM_LOOP(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))};
2128 if (depth < 2) { 2128 if (depth < 2) {
2129 EXPECT_VERIFIES_C(v_i, code); 2129 EXPECT_VERIFIES_C(v_i, code);
2130 } else { 2130 } else {
2131 EXPECT_FAILURE_C(v_i, code); 2131 EXPECT_FAILURE_C(v_i, code);
2132 } 2132 }
2133 } 2133 }
2134 } 2134 }
2135 2135
2136 TEST_F(FunctionBodyDecoderTest, BrUnreachable) {
2137 static byte code[] = {WASM_GET_LOCAL(0), kExprBrTable, 0,
2138 BR_TARGET(0), kExprSetLocal, 0};
2139 EXPECT_VERIFIES_C(v_i, code);
2140 }
2141
2136 TEST_F(FunctionBodyDecoderTest, Brv1) { 2142 TEST_F(FunctionBodyDecoderTest, Brv1) {
2137 EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV(0, WASM_ZERO))); 2143 EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV(0, WASM_ZERO)));
2138 EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_LOOP(WASM_BRV(2, WASM_ZERO)))); 2144 EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_LOOP(WASM_BRV(2, WASM_ZERO))));
2139 } 2145 }
2140 2146
2141 TEST_F(FunctionBodyDecoderTest, Brv1_type) { 2147 TEST_F(FunctionBodyDecoderTest, Brv1_type) {
2142 EXPECT_VERIFIES(i_ii, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); 2148 EXPECT_VERIFIES(i_ii, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
2143 EXPECT_VERIFIES(l_ll, WASM_BLOCK_L(WASM_BRV(0, WASM_GET_LOCAL(0)))); 2149 EXPECT_VERIFIES(l_ll, WASM_BLOCK_L(WASM_BRV(0, WASM_GET_LOCAL(0))));
2144 EXPECT_VERIFIES(f_ff, WASM_BLOCK_F(WASM_BRV(0, WASM_GET_LOCAL(0)))); 2150 EXPECT_VERIFIES(f_ff, WASM_BLOCK_F(WASM_BRV(0, WASM_GET_LOCAL(0))));
2145 EXPECT_VERIFIES(d_dd, WASM_BLOCK_D(WASM_BRV(0, WASM_GET_LOCAL(0)))); 2151 EXPECT_VERIFIES(d_dd, WASM_BLOCK_D(WASM_BRV(0, WASM_GET_LOCAL(0))));
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 iter.next(); 2771 iter.next();
2766 EXPECT_TRUE(iter.has_next()); 2772 EXPECT_TRUE(iter.has_next());
2767 EXPECT_EQ(kExprI32Const, iter.current()); 2773 EXPECT_EQ(kExprI32Const, iter.current());
2768 iter.next(); 2774 iter.next();
2769 EXPECT_FALSE(iter.has_next()); 2775 EXPECT_FALSE(iter.has_next());
2770 } 2776 }
2771 2777
2772 } // namespace wasm 2778 } // namespace wasm
2773 } // namespace internal 2779 } // namespace internal
2774 } // namespace v8 2780 } // namespace v8
OLDNEW
« src/wasm/function-body-decoder.cc ('K') | « src/wasm/function-body-decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698