OLD | NEW |
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 USE(code); \ |
18 EXPECT_EQ(static_cast<size_t>(size), sizeof(code)); \ | 19 EXPECT_EQ(static_cast<size_t>(size), sizeof(code)); \ |
19 } while (false) | 20 } while (false) |
20 | 21 |
21 TEST_F(WasmMacroGenTest, Constants) { | 22 TEST_F(WasmMacroGenTest, Constants) { |
22 EXPECT_SIZE(2, WASM_ONE); | 23 EXPECT_SIZE(2, WASM_ONE); |
23 EXPECT_SIZE(2, WASM_ZERO); | 24 EXPECT_SIZE(2, WASM_ZERO); |
24 | 25 |
25 EXPECT_SIZE(2, WASM_I32V_1(-22)); | 26 EXPECT_SIZE(2, WASM_I32V_1(-22)); |
26 EXPECT_SIZE(2, WASM_I32V_1(54)); | 27 EXPECT_SIZE(2, WASM_I32V_1(54)); |
27 | 28 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); | 305 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); |
305 } | 306 } |
306 for (size_t i = 0; i < arraysize(kMemTypes); i++) { | 307 for (size_t i = 0; i < arraysize(kMemTypes); i++) { |
307 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, | 308 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, |
308 WASM_GET_LOCAL(0))); | 309 WASM_GET_LOCAL(0))); |
309 } | 310 } |
310 } | 311 } |
311 } // namespace wasm | 312 } // namespace wasm |
312 } // namespace internal | 313 } // namespace internal |
313 } // namespace v8 | 314 } // namespace v8 |
OLD | NEW |