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

Side by Side Diff: test/unittests/wasm/wasm-macro-gen-unittest.cc

Issue 2595733003: [wasm] Remove non-standard kExprI8Const bytecode (Closed)
Patch Set: Remove regression test 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/wasm/wasm-macro-gen.h" 7 #include "src/wasm/wasm-macro-gen.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace wasm { 11 namespace wasm {
12 12
13 class WasmMacroGenTest : public TestWithZone {}; 13 class WasmMacroGenTest : public TestWithZone {};
14 14
15 #define EXPECT_SIZE(size, ...) \ 15 #define EXPECT_SIZE(size, ...) \
16 do { \ 16 do { \
17 byte code[] = {__VA_ARGS__}; \ 17 byte code[] = {__VA_ARGS__}; \
18 EXPECT_EQ(static_cast<size_t>(size), sizeof(code)); \ 18 EXPECT_EQ(static_cast<size_t>(size), sizeof(code)); \
19 } while (false) 19 } while (false)
20 20
21 TEST_F(WasmMacroGenTest, Constants) { 21 TEST_F(WasmMacroGenTest, Constants) {
22 EXPECT_SIZE(2, WASM_ONE); 22 EXPECT_SIZE(2, WASM_ONE);
23 EXPECT_SIZE(2, WASM_ZERO); 23 EXPECT_SIZE(2, WASM_ZERO);
24 24
25 EXPECT_SIZE(2, WASM_I8(122)); 25 EXPECT_SIZE(2, WASM_I32V_1(-22));
26 EXPECT_SIZE(2, WASM_I8(254)); 26 EXPECT_SIZE(2, WASM_I32V_1(54));
27 27
28 EXPECT_SIZE(2, WASM_I32V_1(1)); 28 EXPECT_SIZE(2, WASM_I32V_1(1));
29 EXPECT_SIZE(3, WASM_I32V_2(200)); 29 EXPECT_SIZE(3, WASM_I32V_2(200));
30 EXPECT_SIZE(4, WASM_I32V_3(10000)); 30 EXPECT_SIZE(4, WASM_I32V_3(10000));
31 EXPECT_SIZE(5, WASM_I32V_4(-9828934)); 31 EXPECT_SIZE(5, WASM_I32V_4(-9828934));
32 EXPECT_SIZE(6, WASM_I32V_5(-1119828934)); 32 EXPECT_SIZE(6, WASM_I32V_5(-1119828934));
33 33
34 EXPECT_SIZE(2, WASM_I64V_1(1)); 34 EXPECT_SIZE(2, WASM_I64V_1(1));
35 EXPECT_SIZE(3, WASM_I64V_2(300)); 35 EXPECT_SIZE(3, WASM_I64V_2(300));
36 EXPECT_SIZE(4, WASM_I64V_3(10000)); 36 EXPECT_SIZE(4, WASM_I64V_3(10000));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 EXPECT_SIZE(5, WASM_LOOP(WASM_BR(0))); 77 EXPECT_SIZE(5, WASM_LOOP(WASM_BR(0)));
78 EXPECT_SIZE(7, WASM_LOOP(WASM_BR_IF(0, WASM_ZERO))); 78 EXPECT_SIZE(7, WASM_LOOP(WASM_BR_IF(0, WASM_ZERO)));
79 79
80 EXPECT_SIZE(1, WASM_RETURN0); 80 EXPECT_SIZE(1, WASM_RETURN0);
81 EXPECT_SIZE(3, WASM_RETURN1(WASM_ZERO)); 81 EXPECT_SIZE(3, WASM_RETURN1(WASM_ZERO));
82 82
83 EXPECT_SIZE(1, WASM_UNREACHABLE); 83 EXPECT_SIZE(1, WASM_UNREACHABLE);
84 } 84 }
85 85
86 TEST_F(WasmMacroGenTest, MacroStatements) { 86 TEST_F(WasmMacroGenTest, MacroStatements) {
87 EXPECT_SIZE(11, WASM_WHILE(WASM_I8(0), WASM_NOP)); 87 EXPECT_SIZE(11, WASM_WHILE(WASM_ZERO, WASM_NOP));
88 EXPECT_SIZE(7, WASM_INC_LOCAL(0)); 88 EXPECT_SIZE(7, WASM_INC_LOCAL(0));
89 EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3)); 89 EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3));
90 90
91 EXPECT_SIZE(2, WASM_CONTINUE(0)); 91 EXPECT_SIZE(2, WASM_CONTINUE(0));
92 } 92 }
93 93
94 TEST_F(WasmMacroGenTest, BrTable) { 94 TEST_F(WasmMacroGenTest, BrTable) {
95 EXPECT_SIZE(5, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(0))); 95 EXPECT_SIZE(5, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(0)));
96 EXPECT_SIZE(6, WASM_BR_TABLE(WASM_ZERO, 2, BR_TARGET(0), BR_TARGET(0))); 96 EXPECT_SIZE(6, WASM_BR_TABLE(WASM_ZERO, 2, BR_TARGET(0), BR_TARGET(0)));
97 } 97 }
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); 303 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO));
304 } 304 }
305 for (size_t i = 0; i < arraysize(kMemTypes); i++) { 305 for (size_t i = 0; i < arraysize(kMemTypes); i++) {
306 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, 306 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO,
307 WASM_GET_LOCAL(0))); 307 WASM_GET_LOCAL(0)));
308 } 308 }
309 } 309 }
310 } // namespace wasm 310 } // namespace wasm
311 } // namespace internal 311 } // namespace internal
312 } // namespace v8 312 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698