| 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_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 5 #ifndef V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
| 6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 6 #define V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 // Create a simple call descriptor for testing. | 131 // Create a simple call descriptor for testing. |
| 132 CallDescriptor* MakeSimpleCallDescriptor(Zone* zone, | 132 CallDescriptor* MakeSimpleCallDescriptor(Zone* zone, |
| 133 MachineSignature* msig) { | 133 MachineSignature* msig) { |
| 134 LocationSignature::Builder locations(zone, msig->return_count(), | 134 LocationSignature::Builder locations(zone, msig->return_count(), |
| 135 msig->parameter_count()); | 135 msig->parameter_count()); |
| 136 | 136 |
| 137 // Add return location(s). | 137 // Add return location(s). |
| 138 const int return_count = static_cast<int>(msig->return_count()); | 138 const int return_count = static_cast<int>(msig->return_count()); |
| 139 for (int i = 0; i < return_count; i++) { | 139 for (int i = 0; i < return_count; i++) { |
| 140 locations.AddReturn(LinkageLocation::ForCallerFrameSlot(-1 - i)); | 140 locations.AddReturn( |
| 141 LinkageLocation::ForCallerFrameSlot(-1 - i, msig->GetReturn(i))); |
| 141 } | 142 } |
| 142 | 143 |
| 143 // Just put all parameters on the stack. | 144 // Just put all parameters on the stack. |
| 144 const int parameter_count = static_cast<int>(msig->parameter_count()); | 145 const int parameter_count = static_cast<int>(msig->parameter_count()); |
| 145 for (int i = 0; i < parameter_count; i++) { | 146 for (int i = 0; i < parameter_count; i++) { |
| 146 locations.AddParam(LinkageLocation::ForCallerFrameSlot(-1 - i)); | 147 locations.AddParam( |
| 148 LinkageLocation::ForCallerFrameSlot(-1 - i, msig->GetParam(i))); |
| 147 } | 149 } |
| 148 | 150 |
| 149 const RegList kCalleeSaveRegisters = 0; | 151 const RegList kCalleeSaveRegisters = 0; |
| 150 const RegList kCalleeSaveFPRegisters = 0; | 152 const RegList kCalleeSaveFPRegisters = 0; |
| 151 | 153 |
| 152 MachineType target_type = MachineType::Pointer(); | 154 MachineType target_type = MachineType::Pointer(); |
| 153 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); | 155 LinkageLocation target_loc = LinkageLocation::ForAnyRegister(); |
| 154 return new (zone) CallDescriptor( // -- | 156 return new (zone) CallDescriptor( // -- |
| 155 CallDescriptor::kCallAddress, // kind | 157 CallDescriptor::kCallAddress, // kind |
| 156 target_type, // target MachineType | 158 target_type, // target MachineType |
| 157 target_loc, // target location | 159 target_loc, // target location |
| 158 msig, // machine_sig | |
| 159 locations.Build(), // location_sig | 160 locations.Build(), // location_sig |
| 160 0, // stack_parameter_count | 161 0, // stack_parameter_count |
| 161 Operator::kNoProperties, // properties | 162 Operator::kNoProperties, // properties |
| 162 kCalleeSaveRegisters, // callee-saved registers | 163 kCalleeSaveRegisters, // callee-saved registers |
| 163 kCalleeSaveFPRegisters, // callee-saved fp regs | 164 kCalleeSaveFPRegisters, // callee-saved fp regs |
| 164 CallDescriptor::kNoFlags, // flags | 165 CallDescriptor::kNoFlags, // flags |
| 165 "iselect-test-call"); | 166 "iselect-test-call"); |
| 166 } | 167 } |
| 167 }; | 168 }; |
| 168 | 169 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 template <typename T> | 291 template <typename T> |
| 291 class InstructionSelectorTestWithParam | 292 class InstructionSelectorTestWithParam |
| 292 : public InstructionSelectorTest, | 293 : public InstructionSelectorTest, |
| 293 public ::testing::WithParamInterface<T> {}; | 294 public ::testing::WithParamInterface<T> {}; |
| 294 | 295 |
| 295 } // namespace compiler | 296 } // namespace compiler |
| 296 } // namespace internal | 297 } // namespace internal |
| 297 } // namespace v8 | 298 } // namespace v8 |
| 298 | 299 |
| 299 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ | 300 #endif // V8_UNITTESTS_COMPILER_INSTRUCTION_SELECTOR_UNITTEST_H_ |
| OLD | NEW |