| 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 EXPECT_EQ(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_I8(122)); |
| 26 EXPECT_SIZE(2, WASM_I8(254)); | 26 EXPECT_SIZE(2, WASM_I8(254)); |
| 27 | 27 |
| 28 EXPECT_SIZE(2, WASM_I32V_1(1)); | 28 EXPECT_SIZE(2, WASM_I32V_1(1)); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |