OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 5 #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 6 #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
7 | 7 |
8 #include "src/compiler/instruction-selector.h" | 8 #include "src/compiler/instruction-selector.h" |
9 #include "src/compiler/pipeline.h" | 9 #include "src/compiler/pipeline.h" |
10 #include "src/compiler/raw-machine-assembler.h" | 10 #include "src/compiler/raw-machine-assembler.h" |
11 #include "src/simulator.h" | 11 #include "src/simulator.h" |
12 #include "test/cctest/compiler/call-tester.h" | 12 #include "test/cctest/compiler/call-tester.h" |
13 | 13 |
14 namespace v8 { | 14 namespace v8 { |
15 namespace internal { | 15 namespace internal { |
16 namespace compiler { | 16 namespace compiler { |
17 | 17 |
18 template <typename ReturnType> | 18 template <typename ReturnType> |
19 class RawMachineAssemblerTester : public HandleAndZoneScope, | 19 class RawMachineAssemblerTester : public HandleAndZoneScope, |
20 public CallHelper<ReturnType>, | 20 public CallHelper<ReturnType>, |
21 public RawMachineAssembler { | 21 public RawMachineAssembler { |
22 public: | 22 public: |
23 RawMachineAssemblerTester(MachineType p0 = kMachNone, | 23 RawMachineAssemblerTester(MachineType p0 = MachineType::None(), |
24 MachineType p1 = kMachNone, | 24 MachineType p1 = MachineType::None(), |
25 MachineType p2 = kMachNone, | 25 MachineType p2 = MachineType::None(), |
26 MachineType p3 = kMachNone, | 26 MachineType p3 = MachineType::None(), |
27 MachineType p4 = kMachNone) | 27 MachineType p4 = MachineType::None()) |
28 : HandleAndZoneScope(), | 28 : HandleAndZoneScope(), |
29 CallHelper<ReturnType>( | 29 CallHelper<ReturnType>( |
30 main_isolate(), | 30 main_isolate(), |
31 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, p1, | 31 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, p1, |
32 p2, p3, p4)), | 32 p2, p3, p4)), |
33 RawMachineAssembler( | 33 RawMachineAssembler( |
34 main_isolate(), new (main_zone()) Graph(main_zone()), | 34 main_isolate(), new (main_zone()) Graph(main_zone()), |
35 Linkage::GetSimplifiedCDescriptor( | 35 Linkage::GetSimplifiedCDescriptor( |
36 main_zone(), | 36 main_zone(), |
37 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, | 37 CSignature::New(main_zone(), MachineTypeForC<ReturnType>(), p0, |
38 p1, p2, p3, p4)), | 38 p1, p2, p3, p4)), |
39 kMachPtr, InstructionSelector::SupportedMachineOperatorFlags()) {} | 39 MachineType::PointerRepresentation(), |
| 40 InstructionSelector::SupportedMachineOperatorFlags()) {} |
40 | 41 |
41 void CheckNumber(double expected, Object* number) { | 42 void CheckNumber(double expected, Object* number) { |
42 CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number)); | 43 CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number)); |
43 } | 44 } |
44 | 45 |
45 void CheckString(const char* expected, Object* string) { | 46 void CheckString(const char* expected, Object* string) { |
46 CHECK( | 47 CHECK( |
47 this->isolate()->factory()->InternalizeUtf8String(expected)->SameValue( | 48 this->isolate()->factory()->InternalizeUtf8String(expected)->SameValue( |
48 string)); | 49 string)); |
49 } | 50 } |
(...skipping 20 matching lines...) Expand all Loading... |
70 | 71 |
71 private: | 72 private: |
72 MaybeHandle<Code> code_; | 73 MaybeHandle<Code> code_; |
73 }; | 74 }; |
74 | 75 |
75 | 76 |
76 template <typename ReturnType> | 77 template <typename ReturnType> |
77 class BufferedRawMachineAssemblerTester | 78 class BufferedRawMachineAssemblerTester |
78 : public RawMachineAssemblerTester<int32_t> { | 79 : public RawMachineAssemblerTester<int32_t> { |
79 public: | 80 public: |
80 BufferedRawMachineAssemblerTester(MachineType p0 = kMachNone, | 81 BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(), |
81 MachineType p1 = kMachNone, | 82 MachineType p1 = MachineType::None(), |
82 MachineType p2 = kMachNone, | 83 MachineType p2 = MachineType::None(), |
83 MachineType p3 = kMachNone) | 84 MachineType p3 = MachineType::None()) |
84 : BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3), | 85 : BufferedRawMachineAssemblerTester(ComputeParameterCount(p0, p1, p2, p3), |
85 p0, p1, p2, p3) {} | 86 p0, p1, p2, p3) {} |
86 | 87 |
87 | 88 |
88 // The BufferedRawMachineAssemblerTester does not pass parameters directly | 89 // The BufferedRawMachineAssemblerTester does not pass parameters directly |
89 // to the constructed IR graph. Instead it passes a pointer to the parameter | 90 // to the constructed IR graph. Instead it passes a pointer to the parameter |
90 // to the IR graph, and adds Load nodes to the IR graph to load the | 91 // to the IR graph, and adds Load nodes to the IR graph to load the |
91 // parameters from memory. Thereby it is possible to pass 64 bit parameters | 92 // parameters from memory. Thereby it is possible to pass 64 bit parameters |
92 // to the IR graph. | 93 // to the IR graph. |
93 Node* Parameter(size_t index) { | 94 Node* Parameter(size_t index) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3), | 153 reinterpret_cast<void*>(&p2), reinterpret_cast<void*>(&p3), |
153 reinterpret_cast<void*>(&return_value)); | 154 reinterpret_cast<void*>(&return_value)); |
154 return return_value; | 155 return return_value; |
155 } | 156 } |
156 | 157 |
157 private: | 158 private: |
158 BufferedRawMachineAssemblerTester(uint32_t return_parameter_index, | 159 BufferedRawMachineAssemblerTester(uint32_t return_parameter_index, |
159 MachineType p0, MachineType p1, | 160 MachineType p0, MachineType p1, |
160 MachineType p2, MachineType p3) | 161 MachineType p2, MachineType p3) |
161 : RawMachineAssemblerTester<int32_t>( | 162 : RawMachineAssemblerTester<int32_t>( |
162 kMachPtr, p0 == kMachNone ? kMachNone : kMachPtr, | 163 MachineType::Pointer(), |
163 p1 == kMachNone ? kMachNone : kMachPtr, | 164 p0 == MachineType::None() ? MachineType::None() |
164 p2 == kMachNone ? kMachNone : kMachPtr, | 165 : MachineType::Pointer(), |
165 p3 == kMachNone ? kMachNone : kMachPtr), | 166 p1 == MachineType::None() ? MachineType::None() |
| 167 : MachineType::Pointer(), |
| 168 p2 == MachineType::None() ? MachineType::None() |
| 169 : MachineType::Pointer(), |
| 170 p3 == MachineType::None() ? MachineType::None() |
| 171 : MachineType::Pointer()), |
166 test_graph_signature_( | 172 test_graph_signature_( |
167 CSignature::New(main_zone(), kMachInt32, p0, p1, p2, p3)), | 173 CSignature::New(main_zone(), MachineType::Int32(), p0, p1, p2, p3)), |
168 return_parameter_index_(return_parameter_index) { | 174 return_parameter_index_(return_parameter_index) { |
169 parameter_nodes_[0] = | 175 parameter_nodes_[0] = p0 == MachineType::None() |
170 p0 == kMachNone ? nullptr : Load(p0, RawMachineAssembler::Parameter(0)); | 176 ? nullptr |
171 parameter_nodes_[1] = | 177 : Load(p0, RawMachineAssembler::Parameter(0)); |
172 p1 == kMachNone ? nullptr : Load(p1, RawMachineAssembler::Parameter(1)); | 178 parameter_nodes_[1] = p1 == MachineType::None() |
173 parameter_nodes_[2] = | 179 ? nullptr |
174 p2 == kMachNone ? nullptr : Load(p2, RawMachineAssembler::Parameter(2)); | 180 : Load(p1, RawMachineAssembler::Parameter(1)); |
175 parameter_nodes_[3] = | 181 parameter_nodes_[2] = p2 == MachineType::None() |
176 p3 == kMachNone ? nullptr : Load(p3, RawMachineAssembler::Parameter(3)); | 182 ? nullptr |
| 183 : Load(p2, RawMachineAssembler::Parameter(2)); |
| 184 parameter_nodes_[3] = p3 == MachineType::None() |
| 185 ? nullptr |
| 186 : Load(p3, RawMachineAssembler::Parameter(3)); |
177 } | 187 } |
178 | 188 |
179 | 189 |
180 static uint32_t ComputeParameterCount(MachineType p0, MachineType p1, | 190 static uint32_t ComputeParameterCount(MachineType p0, MachineType p1, |
181 MachineType p2, MachineType p3) { | 191 MachineType p2, MachineType p3) { |
182 if (p0 == kMachNone) { | 192 if (p0 == MachineType::None()) { |
183 return 0; | 193 return 0; |
184 } | 194 } |
185 if (p1 == kMachNone) { | 195 if (p1 == MachineType::None()) { |
186 return 1; | 196 return 1; |
187 } | 197 } |
188 if (p2 == kMachNone) { | 198 if (p2 == MachineType::None()) { |
189 return 2; | 199 return 2; |
190 } | 200 } |
191 if (p3 == kMachNone) { | 201 if (p3 == MachineType::None()) { |
192 return 3; | 202 return 3; |
193 } | 203 } |
194 return 4; | 204 return 4; |
195 } | 205 } |
196 | 206 |
197 | 207 |
198 CSignature* test_graph_signature_; | 208 CSignature* test_graph_signature_; |
199 Node* parameter_nodes_[4]; | 209 Node* parameter_nodes_[4]; |
200 uint32_t return_parameter_index_; | 210 uint32_t return_parameter_index_; |
201 }; | 211 }; |
202 | 212 |
203 | 213 |
204 template <> | 214 template <> |
205 class BufferedRawMachineAssemblerTester<void> | 215 class BufferedRawMachineAssemblerTester<void> |
206 : public RawMachineAssemblerTester<void> { | 216 : public RawMachineAssemblerTester<void> { |
207 public: | 217 public: |
208 BufferedRawMachineAssemblerTester(MachineType p0 = kMachNone, | 218 BufferedRawMachineAssemblerTester(MachineType p0 = MachineType::None(), |
209 MachineType p1 = kMachNone, | 219 MachineType p1 = MachineType::None(), |
210 MachineType p2 = kMachNone, | 220 MachineType p2 = MachineType::None(), |
211 MachineType p3 = kMachNone) | 221 MachineType p3 = MachineType::None()) |
212 : RawMachineAssemblerTester<void>(p0 == kMachNone ? kMachNone : kMachPtr, | 222 : RawMachineAssemblerTester<void>( |
213 p1 == kMachNone ? kMachNone : kMachPtr, | 223 p0 == MachineType::None() ? MachineType::None() |
214 p2 == kMachNone ? kMachNone : kMachPtr, | 224 : MachineType::Pointer(), |
215 p3 == kMachNone ? kMachNone : kMachPtr), | 225 p1 == MachineType::None() ? MachineType::None() |
| 226 : MachineType::Pointer(), |
| 227 p2 == MachineType::None() ? MachineType::None() |
| 228 : MachineType::Pointer(), |
| 229 p3 == MachineType::None() ? MachineType::None() |
| 230 : MachineType::Pointer()), |
216 test_graph_signature_( | 231 test_graph_signature_( |
217 CSignature::New(RawMachineAssemblerTester<void>::main_zone(), | 232 CSignature::New(RawMachineAssemblerTester<void>::main_zone(), |
218 kMachNone, p0, p1, p2, p3)) { | 233 MachineType::None(), p0, p1, p2, p3)) { |
219 parameter_nodes_[0] = | 234 parameter_nodes_[0] = p0 == MachineType::None() |
220 p0 == kMachNone ? nullptr : Load(p0, RawMachineAssembler::Parameter(0)); | 235 ? nullptr |
221 parameter_nodes_[1] = | 236 : Load(p0, RawMachineAssembler::Parameter(0)); |
222 p1 == kMachNone ? nullptr : Load(p1, RawMachineAssembler::Parameter(1)); | 237 parameter_nodes_[1] = p1 == MachineType::None() |
223 parameter_nodes_[2] = | 238 ? nullptr |
224 p2 == kMachNone ? nullptr : Load(p2, RawMachineAssembler::Parameter(2)); | 239 : Load(p1, RawMachineAssembler::Parameter(1)); |
225 parameter_nodes_[3] = | 240 parameter_nodes_[2] = p2 == MachineType::None() |
226 p3 == kMachNone ? nullptr : Load(p3, RawMachineAssembler::Parameter(3)); | 241 ? nullptr |
| 242 : Load(p2, RawMachineAssembler::Parameter(2)); |
| 243 parameter_nodes_[3] = p3 == MachineType::None() |
| 244 ? nullptr |
| 245 : Load(p3, RawMachineAssembler::Parameter(3)); |
227 } | 246 } |
228 | 247 |
229 | 248 |
230 // The BufferedRawMachineAssemblerTester does not pass parameters directly | 249 // The BufferedRawMachineAssemblerTester does not pass parameters directly |
231 // to the constructed IR graph. Instead it passes a pointer to the parameter | 250 // to the constructed IR graph. Instead it passes a pointer to the parameter |
232 // to the IR graph, and adds Load nodes to the IR graph to load the | 251 // to the IR graph, and adds Load nodes to the IR graph to load the |
233 // parameters from memory. Thereby it is possible to pass 64 bit parameters | 252 // parameters from memory. Thereby it is possible to pass 64 bit parameters |
234 // to the IR graph. | 253 // to the IR graph. |
235 Node* Parameter(size_t index) { | 254 Node* Parameter(size_t index) { |
236 CHECK(index >= 0 && index < 4); | 255 CHECK(index >= 0 && index < 4); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 CSignature* test_graph_signature_; | 295 CSignature* test_graph_signature_; |
277 Node* parameter_nodes_[4]; | 296 Node* parameter_nodes_[4]; |
278 }; | 297 }; |
279 static const bool USE_RESULT_BUFFER = true; | 298 static const bool USE_RESULT_BUFFER = true; |
280 static const bool USE_RETURN_REGISTER = false; | 299 static const bool USE_RETURN_REGISTER = false; |
281 static const int32_t CHECK_VALUE = 0x99BEEDCE; | 300 static const int32_t CHECK_VALUE = 0x99BEEDCE; |
282 | 301 |
283 | 302 |
284 // TODO(titzer): use the C-style calling convention, or any register-based | 303 // TODO(titzer): use the C-style calling convention, or any register-based |
285 // calling convention for binop tests. | 304 // calling convention for binop tests. |
286 template <typename CType, MachineType rep, bool use_result_buffer> | 305 template <typename CType, bool use_result_buffer> |
287 class BinopTester { | 306 class BinopTester { |
288 public: | 307 public: |
289 explicit BinopTester(RawMachineAssemblerTester<int32_t>* tester) | 308 explicit BinopTester(RawMachineAssemblerTester<int32_t>* tester, |
| 309 MachineType rep) |
290 : T(tester), | 310 : T(tester), |
291 param0(T->LoadFromPointer(&p0, rep)), | 311 param0(T->LoadFromPointer(&p0, rep)), |
292 param1(T->LoadFromPointer(&p1, rep)), | 312 param1(T->LoadFromPointer(&p1, rep)), |
| 313 rep(rep), |
293 p0(static_cast<CType>(0)), | 314 p0(static_cast<CType>(0)), |
294 p1(static_cast<CType>(0)), | 315 p1(static_cast<CType>(0)), |
295 result(static_cast<CType>(0)) {} | 316 result(static_cast<CType>(0)) {} |
296 | 317 |
297 RawMachineAssemblerTester<int32_t>* T; | 318 RawMachineAssemblerTester<int32_t>* T; |
298 Node* param0; | 319 Node* param0; |
299 Node* param1; | 320 Node* param1; |
300 | 321 |
301 CType call(CType a0, CType a1) { | 322 CType call(CType a0, CType a1) { |
302 p0 = a0; | 323 p0 = a0; |
(...skipping 21 matching lines...) Expand all Loading... |
324 typename Ci::const_iterator i; | 345 typename Ci::const_iterator i; |
325 typename Cj::const_iterator j; | 346 typename Cj::const_iterator j; |
326 for (i = ci.begin(); i != ci.end(); ++i) { | 347 for (i = ci.begin(); i != ci.end(); ++i) { |
327 for (j = cj.begin(); j != cj.end(); ++j) { | 348 for (j = cj.begin(); j != cj.end(); ++j) { |
328 CHECK_EQ(fn(*i, *j), this->call(*i, *j)); | 349 CHECK_EQ(fn(*i, *j), this->call(*i, *j)); |
329 } | 350 } |
330 } | 351 } |
331 } | 352 } |
332 | 353 |
333 protected: | 354 protected: |
| 355 MachineType rep; |
334 CType p0; | 356 CType p0; |
335 CType p1; | 357 CType p1; |
336 CType result; | 358 CType result; |
337 }; | 359 }; |
338 | 360 |
339 | 361 |
340 // A helper class for testing code sequences that take two int parameters and | 362 // A helper class for testing code sequences that take two int parameters and |
341 // return an int value. | 363 // return an int value. |
342 class Int32BinopTester | 364 class Int32BinopTester : public BinopTester<int32_t, USE_RETURN_REGISTER> { |
343 : public BinopTester<int32_t, kMachInt32, USE_RETURN_REGISTER> { | |
344 public: | 365 public: |
345 explicit Int32BinopTester(RawMachineAssemblerTester<int32_t>* tester) | 366 explicit Int32BinopTester(RawMachineAssemblerTester<int32_t>* tester) |
346 : BinopTester<int32_t, kMachInt32, USE_RETURN_REGISTER>(tester) {} | 367 : BinopTester<int32_t, USE_RETURN_REGISTER>(tester, |
| 368 MachineType::Int32()) {} |
347 }; | 369 }; |
348 | 370 |
349 | 371 |
350 // A helper class for testing code sequences that take two uint parameters and | 372 // A helper class for testing code sequences that take two uint parameters and |
351 // return an uint value. | 373 // return an uint value. |
352 class Uint32BinopTester | 374 class Uint32BinopTester : public BinopTester<uint32_t, USE_RETURN_REGISTER> { |
353 : public BinopTester<uint32_t, kMachUint32, USE_RETURN_REGISTER> { | |
354 public: | 375 public: |
355 explicit Uint32BinopTester(RawMachineAssemblerTester<int32_t>* tester) | 376 explicit Uint32BinopTester(RawMachineAssemblerTester<int32_t>* tester) |
356 : BinopTester<uint32_t, kMachUint32, USE_RETURN_REGISTER>(tester) {} | 377 : BinopTester<uint32_t, USE_RETURN_REGISTER>(tester, |
| 378 MachineType::Uint32()) {} |
357 | 379 |
358 uint32_t call(uint32_t a0, uint32_t a1) { | 380 uint32_t call(uint32_t a0, uint32_t a1) { |
359 p0 = a0; | 381 p0 = a0; |
360 p1 = a1; | 382 p1 = a1; |
361 return static_cast<uint32_t>(T->Call()); | 383 return static_cast<uint32_t>(T->Call()); |
362 } | 384 } |
363 }; | 385 }; |
364 | 386 |
365 | 387 |
366 // A helper class for testing code sequences that take two float parameters and | 388 // A helper class for testing code sequences that take two float parameters and |
367 // return a float value. | 389 // return a float value. |
368 // TODO(titzer): figure out how to return floats correctly on ia32. | 390 // TODO(titzer): figure out how to return floats correctly on ia32. |
369 class Float32BinopTester | 391 class Float32BinopTester : public BinopTester<float, USE_RESULT_BUFFER> { |
370 : public BinopTester<float, kMachFloat32, USE_RESULT_BUFFER> { | |
371 public: | 392 public: |
372 explicit Float32BinopTester(RawMachineAssemblerTester<int32_t>* tester) | 393 explicit Float32BinopTester(RawMachineAssemblerTester<int32_t>* tester) |
373 : BinopTester<float, kMachFloat32, USE_RESULT_BUFFER>(tester) {} | 394 : BinopTester<float, USE_RESULT_BUFFER>(tester, MachineType::Float32()) {} |
374 }; | 395 }; |
375 | 396 |
376 | 397 |
377 // A helper class for testing code sequences that take two double parameters and | 398 // A helper class for testing code sequences that take two double parameters and |
378 // return a double value. | 399 // return a double value. |
379 // TODO(titzer): figure out how to return doubles correctly on ia32. | 400 // TODO(titzer): figure out how to return doubles correctly on ia32. |
380 class Float64BinopTester | 401 class Float64BinopTester : public BinopTester<double, USE_RESULT_BUFFER> { |
381 : public BinopTester<double, kMachFloat64, USE_RESULT_BUFFER> { | |
382 public: | 402 public: |
383 explicit Float64BinopTester(RawMachineAssemblerTester<int32_t>* tester) | 403 explicit Float64BinopTester(RawMachineAssemblerTester<int32_t>* tester) |
384 : BinopTester<double, kMachFloat64, USE_RESULT_BUFFER>(tester) {} | 404 : BinopTester<double, USE_RESULT_BUFFER>(tester, MachineType::Float64()) { |
| 405 } |
385 }; | 406 }; |
386 | 407 |
387 | 408 |
388 // A helper class for testing code sequences that take two pointer parameters | 409 // A helper class for testing code sequences that take two pointer parameters |
389 // and return a pointer value. | 410 // and return a pointer value. |
390 // TODO(titzer): pick word size of pointers based on V8_TARGET. | 411 // TODO(titzer): pick word size of pointers based on V8_TARGET. |
391 template <typename Type> | 412 template <typename Type> |
392 class PointerBinopTester | 413 class PointerBinopTester : public BinopTester<Type*, USE_RETURN_REGISTER> { |
393 : public BinopTester<Type*, kMachPtr, USE_RETURN_REGISTER> { | |
394 public: | 414 public: |
395 explicit PointerBinopTester(RawMachineAssemblerTester<int32_t>* tester) | 415 explicit PointerBinopTester(RawMachineAssemblerTester<int32_t>* tester) |
396 : BinopTester<Type*, kMachPtr, USE_RETURN_REGISTER>(tester) {} | 416 : BinopTester<Type*, USE_RETURN_REGISTER>(tester, |
| 417 MachineType::Pointer()) {} |
397 }; | 418 }; |
398 | 419 |
399 | 420 |
400 // A helper class for testing code sequences that take two tagged parameters and | 421 // A helper class for testing code sequences that take two tagged parameters and |
401 // return a tagged value. | 422 // return a tagged value. |
402 template <typename Type> | 423 template <typename Type> |
403 class TaggedBinopTester | 424 class TaggedBinopTester : public BinopTester<Type*, USE_RETURN_REGISTER> { |
404 : public BinopTester<Type*, kMachAnyTagged, USE_RETURN_REGISTER> { | |
405 public: | 425 public: |
406 explicit TaggedBinopTester(RawMachineAssemblerTester<int32_t>* tester) | 426 explicit TaggedBinopTester(RawMachineAssemblerTester<int32_t>* tester) |
407 : BinopTester<Type*, kMachAnyTagged, USE_RETURN_REGISTER>(tester) {} | 427 : BinopTester<Type*, USE_RETURN_REGISTER>(tester, |
| 428 MachineType::AnyTagged()) {} |
408 }; | 429 }; |
409 | 430 |
410 // A helper class for testing compares. Wraps a machine opcode and provides | 431 // A helper class for testing compares. Wraps a machine opcode and provides |
411 // evaluation routines and the operators. | 432 // evaluation routines and the operators. |
412 class CompareWrapper { | 433 class CompareWrapper { |
413 public: | 434 public: |
414 explicit CompareWrapper(IrOpcode::Value op) : opcode(op) {} | 435 explicit CompareWrapper(IrOpcode::Value op) : opcode(op) {} |
415 | 436 |
416 Node* MakeNode(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) { | 437 Node* MakeNode(RawMachineAssemblerTester<int32_t>* m, Node* a, Node* b) { |
417 return m->AddNode(op(m->machine()), a, b); | 438 return m->AddNode(op(m->machine()), a, b); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 } else { | 543 } else { |
523 CHECK_EQ(x, y); | 544 CHECK_EQ(x, y); |
524 } | 545 } |
525 } | 546 } |
526 | 547 |
527 } // namespace compiler | 548 } // namespace compiler |
528 } // namespace internal | 549 } // namespace internal |
529 } // namespace v8 | 550 } // namespace v8 |
530 | 551 |
531 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 552 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
OLD | NEW |