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 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 EXPECT_SIZE(9, WASM_F64(1.5)); | 45 EXPECT_SIZE(9, WASM_F64(1.5)); |
46 EXPECT_SIZE(9, WASM_F64(10200.0)); | 46 EXPECT_SIZE(9, WASM_F64(10200.0)); |
47 EXPECT_SIZE(9, WASM_F64(-9818934.0)); | 47 EXPECT_SIZE(9, WASM_F64(-9818934.0)); |
48 } | 48 } |
49 | 49 |
50 TEST_F(WasmMacroGenTest, Statements) { | 50 TEST_F(WasmMacroGenTest, Statements) { |
51 EXPECT_SIZE(1, WASM_NOP); | 51 EXPECT_SIZE(1, WASM_NOP); |
52 | 52 |
53 EXPECT_SIZE(4, WASM_SET_LOCAL(0, WASM_ZERO)); | 53 EXPECT_SIZE(4, WASM_SET_LOCAL(0, WASM_ZERO)); |
54 | 54 |
55 EXPECT_SIZE(4, WASM_STORE_GLOBAL(0, WASM_ZERO)); | 55 EXPECT_SIZE(4, WASM_SET_GLOBAL(0, WASM_ZERO)); |
56 | 56 |
57 EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO)); | 57 EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO)); |
58 | 58 |
59 EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP)); | 59 EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP)); |
60 | 60 |
61 EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); | 61 EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); |
62 | 62 |
63 EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); | 63 EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); |
64 | 64 |
65 EXPECT_SIZE(3, WASM_BR(0)); | 65 EXPECT_SIZE(3, WASM_BR(0)); |
(...skipping 28 matching lines...) Expand all Loading... |
94 | 94 |
95 TEST_F(WasmMacroGenTest, BrTable) { | 95 TEST_F(WasmMacroGenTest, BrTable) { |
96 EXPECT_SIZE(9, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1))); | 96 EXPECT_SIZE(9, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1))); |
97 EXPECT_SIZE(11, WASM_BR_TABLEV(WASM_ZERO, WASM_ZERO, 1, BR_TARGET(1))); | 97 EXPECT_SIZE(11, WASM_BR_TABLEV(WASM_ZERO, WASM_ZERO, 1, BR_TARGET(1))); |
98 } | 98 } |
99 | 99 |
100 TEST_F(WasmMacroGenTest, Expressions) { | 100 TEST_F(WasmMacroGenTest, Expressions) { |
101 EXPECT_SIZE(2, WASM_GET_LOCAL(0)); | 101 EXPECT_SIZE(2, WASM_GET_LOCAL(0)); |
102 EXPECT_SIZE(2, WASM_GET_LOCAL(1)); | 102 EXPECT_SIZE(2, WASM_GET_LOCAL(1)); |
103 EXPECT_SIZE(2, WASM_GET_LOCAL(12)); | 103 EXPECT_SIZE(2, WASM_GET_LOCAL(12)); |
104 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(0)); | 104 EXPECT_SIZE(2, WASM_GET_GLOBAL(0)); |
105 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(1)); | 105 EXPECT_SIZE(2, WASM_GET_GLOBAL(1)); |
106 EXPECT_SIZE(2, WASM_LOAD_GLOBAL(12)); | 106 EXPECT_SIZE(2, WASM_GET_GLOBAL(12)); |
107 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); | 107 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); |
108 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)); | 108 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)); |
109 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)); | 109 EXPECT_SIZE(5, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)); |
110 | 110 |
111 EXPECT_SIZE(3, WASM_NOT(WASM_ZERO)); | 111 EXPECT_SIZE(3, WASM_NOT(WASM_ZERO)); |
112 | 112 |
113 EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO)); | 113 EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO)); |
114 EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); | 114 EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); |
115 | 115 |
116 EXPECT_SIZE(4, WASM_BLOCK(WASM_ZERO)); | 116 EXPECT_SIZE(4, WASM_BLOCK(WASM_ZERO)); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); | 313 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); |
314 } | 314 } |
315 for (size_t i = 0; i < arraysize(kMemTypes); i++) { | 315 for (size_t i = 0; i < arraysize(kMemTypes); i++) { |
316 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, | 316 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, |
317 WASM_GET_LOCAL(0))); | 317 WASM_GET_LOCAL(0))); |
318 } | 318 } |
319 } | 319 } |
320 } // namespace wasm | 320 } // namespace wasm |
321 } // namespace internal | 321 } // namespace internal |
322 } // namespace v8 | 322 } // namespace v8 |
OLD | NEW |