| 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" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 CHECK(index >= 0 && index < 4); | 95 CHECK(index >= 0 && index < 4); |
| 96 return parameter_nodes_[index]; | 96 return parameter_nodes_[index]; |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 // The BufferedRawMachineAssemblerTester adds a Store node to the IR graph | 100 // The BufferedRawMachineAssemblerTester adds a Store node to the IR graph |
| 101 // to store the graph's return value in memory. The memory address for the | 101 // to store the graph's return value in memory. The memory address for the |
| 102 // Store node is provided as a parameter. By storing the return value in | 102 // Store node is provided as a parameter. By storing the return value in |
| 103 // memory it is possible to return 64 bit values. | 103 // memory it is possible to return 64 bit values. |
| 104 void Return(Node* input) { | 104 void Return(Node* input) { |
| 105 Store(MachineTypeForC<ReturnType>(), | 105 Store(MachineTypeForC<ReturnType>().representation(), |
| 106 RawMachineAssembler::Parameter(return_parameter_index_), input, | 106 RawMachineAssembler::Parameter(return_parameter_index_), input, |
| 107 kNoWriteBarrier); | 107 kNoWriteBarrier); |
| 108 RawMachineAssembler::Return(Int32Constant(1234)); | 108 RawMachineAssembler::Return(Int32Constant(1234)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 ReturnType Call() { | 111 ReturnType Call() { |
| 112 ReturnType return_value; | 112 ReturnType return_value; |
| 113 test_graph_signature_->VerifyParams(); | 113 test_graph_signature_->VerifyParams(); |
| 114 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&return_value)); | 114 CallHelper<int32_t>::Call(reinterpret_cast<void*>(&return_value)); |
| 115 return return_value; | 115 return return_value; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 if (use_result_buffer) { | 325 if (use_result_buffer) { |
| 326 CHECK_EQ(CHECK_VALUE, T->Call()); | 326 CHECK_EQ(CHECK_VALUE, T->Call()); |
| 327 return result; | 327 return result; |
| 328 } else { | 328 } else { |
| 329 return static_cast<CType>(T->Call()); | 329 return static_cast<CType>(T->Call()); |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 | 332 |
| 333 void AddReturn(Node* val) { | 333 void AddReturn(Node* val) { |
| 334 if (use_result_buffer) { | 334 if (use_result_buffer) { |
| 335 T->Store(rep, T->PointerConstant(&result), T->Int32Constant(0), val, | 335 T->Store(rep.representation(), T->PointerConstant(&result), |
| 336 kNoWriteBarrier); | 336 T->Int32Constant(0), val, kNoWriteBarrier); |
| 337 T->Return(T->Int32Constant(CHECK_VALUE)); | 337 T->Return(T->Int32Constant(CHECK_VALUE)); |
| 338 } else { | 338 } else { |
| 339 T->Return(val); | 339 T->Return(val); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 | 342 |
| 343 template <typename Ci, typename Cj, typename Fn> | 343 template <typename Ci, typename Cj, typename Fn> |
| 344 void Run(const Ci& ci, const Cj& cj, const Fn& fn) { | 344 void Run(const Ci& ci, const Cj& cj, const Fn& fn) { |
| 345 typename Ci::const_iterator i; | 345 typename Ci::const_iterator i; |
| 346 typename Cj::const_iterator j; | 346 typename Cj::const_iterator j; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 } else { | 543 } else { |
| 544 CHECK_EQ(x, y); | 544 CHECK_EQ(x, y); |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 | 547 |
| 548 } // namespace compiler | 548 } // namespace compiler |
| 549 } // namespace internal | 549 } // namespace internal |
| 550 } // namespace v8 | 550 } // namespace v8 |
| 551 | 551 |
| 552 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 552 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
| OLD | NEW |