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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 EXPECT_SIZE(4, WASM_BLOCK(1, WASM_ZERO)); | 125 EXPECT_SIZE(4, WASM_BLOCK(1, WASM_ZERO)); |
126 EXPECT_SIZE(5, WASM_BLOCK(2, WASM_NOP, WASM_ZERO)); | 126 EXPECT_SIZE(5, WASM_BLOCK(2, WASM_NOP, WASM_ZERO)); |
127 EXPECT_SIZE(6, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_ZERO)); | 127 EXPECT_SIZE(6, WASM_BLOCK(3, WASM_NOP, WASM_NOP, WASM_ZERO)); |
128 | 128 |
129 EXPECT_SIZE(4, WASM_LOOP(1, WASM_ZERO)); | 129 EXPECT_SIZE(4, WASM_LOOP(1, WASM_ZERO)); |
130 EXPECT_SIZE(5, WASM_LOOP(2, WASM_NOP, WASM_ZERO)); | 130 EXPECT_SIZE(5, WASM_LOOP(2, WASM_NOP, WASM_ZERO)); |
131 EXPECT_SIZE(6, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_ZERO)); | 131 EXPECT_SIZE(6, WASM_LOOP(3, WASM_NOP, WASM_NOP, WASM_ZERO)); |
132 } | 132 } |
133 | 133 |
134 | 134 TEST_F(WasmMacroGenTest, CallFunction) { |
135 TEST_F(WasmMacroGenTest, FunctionCalls) { | |
136 EXPECT_SIZE(2, WASM_CALL_FUNCTION0(0)); | 135 EXPECT_SIZE(2, WASM_CALL_FUNCTION0(0)); |
137 EXPECT_SIZE(2, WASM_CALL_FUNCTION0(1)); | 136 EXPECT_SIZE(2, WASM_CALL_FUNCTION0(1)); |
138 EXPECT_SIZE(2, WASM_CALL_FUNCTION0(11)); | 137 EXPECT_SIZE(2, WASM_CALL_FUNCTION0(11)); |
139 | 138 |
140 EXPECT_SIZE(4, WASM_CALL_FUNCTION(0, WASM_ZERO)); | 139 EXPECT_SIZE(4, WASM_CALL_FUNCTION(0, WASM_ZERO)); |
141 EXPECT_SIZE(6, WASM_CALL_FUNCTION(1, WASM_ZERO, WASM_ZERO)); | 140 EXPECT_SIZE(6, WASM_CALL_FUNCTION(1, WASM_ZERO, WASM_ZERO)); |
| 141 } |
142 | 142 |
| 143 TEST_F(WasmMacroGenTest, CallImport) { |
| 144 EXPECT_SIZE(2, WASM_CALL_IMPORT0(0)); |
| 145 EXPECT_SIZE(2, WASM_CALL_IMPORT0(1)); |
| 146 EXPECT_SIZE(2, WASM_CALL_IMPORT0(11)); |
| 147 |
| 148 EXPECT_SIZE(4, WASM_CALL_IMPORT(0, WASM_ZERO)); |
| 149 EXPECT_SIZE(6, WASM_CALL_IMPORT(1, WASM_ZERO, WASM_ZERO)); |
| 150 } |
| 151 |
| 152 TEST_F(WasmMacroGenTest, CallIndirect) { |
143 EXPECT_SIZE(4, WASM_CALL_INDIRECT0(0, WASM_ZERO)); | 153 EXPECT_SIZE(4, WASM_CALL_INDIRECT0(0, WASM_ZERO)); |
144 EXPECT_SIZE(4, WASM_CALL_INDIRECT0(1, WASM_ZERO)); | 154 EXPECT_SIZE(4, WASM_CALL_INDIRECT0(1, WASM_ZERO)); |
145 EXPECT_SIZE(4, WASM_CALL_INDIRECT0(11, WASM_ZERO)); | 155 EXPECT_SIZE(4, WASM_CALL_INDIRECT0(11, WASM_ZERO)); |
146 | 156 |
147 EXPECT_SIZE(6, WASM_CALL_INDIRECT(0, WASM_ZERO, WASM_ZERO)); | 157 EXPECT_SIZE(6, WASM_CALL_INDIRECT(0, WASM_ZERO, WASM_ZERO)); |
148 EXPECT_SIZE(8, WASM_CALL_INDIRECT(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)); | 158 EXPECT_SIZE(8, WASM_CALL_INDIRECT(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)); |
149 } | 159 } |
150 | 160 |
151 | 161 |
152 TEST_F(WasmMacroGenTest, Int32Ops) { | 162 TEST_F(WasmMacroGenTest, Int32Ops) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); | 320 EXPECT_SIZE(5, WASM_LOAD_MEM_OFFSET(kMemTypes[i], 11, WASM_ZERO)); |
311 } | 321 } |
312 for (size_t i = 0; i < arraysize(kMemTypes); i++) { | 322 for (size_t i = 0; i < arraysize(kMemTypes); i++) { |
313 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, | 323 EXPECT_SIZE(7, WASM_STORE_MEM_OFFSET(kMemTypes[i], 13, WASM_ZERO, |
314 WASM_GET_LOCAL(0))); | 324 WASM_GET_LOCAL(0))); |
315 } | 325 } |
316 } | 326 } |
317 } // namespace wasm | 327 } // namespace wasm |
318 } // namespace internal | 328 } // namespace internal |
319 } // namespace v8 | 329 } // namespace v8 |
OLD | NEW |