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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // The BufferedRawMachineAssemblerTester does not pass parameters directly | 89 // The BufferedRawMachineAssemblerTester does not pass parameters directly |
90 // 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 |
91 // 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 |
92 // 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 |
93 // to the IR graph. | 93 // to the IR graph. |
94 Node* Parameter(size_t index) { | 94 Node* Parameter(size_t index) { |
95 CHECK(index < 4); | 95 CHECK(index < 4); |
96 return parameter_nodes_[index]; | 96 return parameter_nodes_[index]; |
97 } | 97 } |
98 | 98 |
| 99 |
99 // The BufferedRawMachineAssemblerTester adds a Store node to the IR graph | 100 // The BufferedRawMachineAssemblerTester adds a Store node to the IR graph |
100 // 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 |
101 // 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 |
102 // memory it is possible to return 64 bit values. | 103 // memory it is possible to return 64 bit values. |
103 void Return(Node* input) { | 104 void Return(Node* input) { |
104 Store(MachineTypeForC<ReturnType>().representation(), | 105 Store(MachineTypeForC<ReturnType>().representation(), |
105 RawMachineAssembler::Parameter(return_parameter_index_), input, | 106 RawMachineAssembler::Parameter(return_parameter_index_), input, |
106 kNoWriteBarrier); | 107 kNoWriteBarrier); |
107 RawMachineAssembler::Return(Int32Constant(1234)); | 108 RawMachineAssembler::Return(Int32Constant(1234)); |
108 } | 109 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 ? nullptr | 238 ? nullptr |
238 : Load(p1, RawMachineAssembler::Parameter(1)); | 239 : Load(p1, RawMachineAssembler::Parameter(1)); |
239 parameter_nodes_[2] = p2 == MachineType::None() | 240 parameter_nodes_[2] = p2 == MachineType::None() |
240 ? nullptr | 241 ? nullptr |
241 : Load(p2, RawMachineAssembler::Parameter(2)); | 242 : Load(p2, RawMachineAssembler::Parameter(2)); |
242 parameter_nodes_[3] = p3 == MachineType::None() | 243 parameter_nodes_[3] = p3 == MachineType::None() |
243 ? nullptr | 244 ? nullptr |
244 : Load(p3, RawMachineAssembler::Parameter(3)); | 245 : Load(p3, RawMachineAssembler::Parameter(3)); |
245 } | 246 } |
246 | 247 |
| 248 |
247 // The BufferedRawMachineAssemblerTester does not pass parameters directly | 249 // The BufferedRawMachineAssemblerTester does not pass parameters directly |
248 // 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 |
249 // 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 |
250 // 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 |
251 // to the IR graph. | 253 // to the IR graph. |
252 Node* Parameter(size_t index) { | 254 Node* Parameter(size_t index) { |
253 CHECK(index >= 0 && index < 4); | 255 CHECK(index >= 0 && index < 4); |
254 return parameter_nodes_[index]; | 256 return parameter_nodes_[index]; |
255 } | 257 } |
256 | 258 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } else { | 553 } else { |
552 CHECK_EQ(x, y); | 554 CHECK_EQ(x, y); |
553 } | 555 } |
554 } | 556 } |
555 | 557 |
556 } // namespace compiler | 558 } // namespace compiler |
557 } // namespace internal | 559 } // namespace internal |
558 } // namespace v8 | 560 } // namespace v8 |
559 | 561 |
560 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ | 562 #endif // V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ |
OLD | NEW |