| 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_COMPILER_LINKAGE_IMPL_H_ | 5 #ifndef V8_COMPILER_LINKAGE_IMPL_H_ |
| 6 #define V8_COMPILER_LINKAGE_IMPL_H_ | 6 #define V8_COMPILER_LINKAGE_IMPL_H_ |
| 7 | 7 |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/compiler/osr.h" | 9 #include "src/compiler/osr.h" |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 types.Build(), // machine_sig | 131 types.Build(), // machine_sig |
| 132 locations.Build(), // location_sig | 132 locations.Build(), // location_sig |
| 133 js_parameter_count, // js_parameter_count | 133 js_parameter_count, // js_parameter_count |
| 134 properties, // properties | 134 properties, // properties |
| 135 kNoCalleeSaved, // callee-saved | 135 kNoCalleeSaved, // callee-saved |
| 136 flags, // flags | 136 flags, // flags |
| 137 function->name); // debug name | 137 function->name); // debug name |
| 138 } | 138 } |
| 139 | 139 |
| 140 | 140 |
| 141 // TODO(all): Add support for return representations/locations to |
| 142 // CallInterfaceDescriptor. |
| 141 // TODO(turbofan): cache call descriptors for code stub calls. | 143 // TODO(turbofan): cache call descriptors for code stub calls. |
| 142 static CallDescriptor* GetStubCallDescriptor( | 144 static CallDescriptor* GetStubCallDescriptor( |
| 143 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 145 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
| 144 int stack_parameter_count, CallDescriptor::Flags flags, | 146 int stack_parameter_count, CallDescriptor::Flags flags, |
| 145 Operator::Properties properties) { | 147 Operator::Properties properties, MachineType return_type) { |
| 146 const int register_parameter_count = | 148 const int register_parameter_count = |
| 147 descriptor.GetEnvironmentParameterCount(); | 149 descriptor.GetEnvironmentParameterCount(); |
| 148 const int js_parameter_count = | 150 const int js_parameter_count = |
| 149 register_parameter_count + stack_parameter_count; | 151 register_parameter_count + stack_parameter_count; |
| 150 const int context_count = 1; | 152 const int context_count = 1; |
| 151 const size_t return_count = 1; | 153 const size_t return_count = 1; |
| 152 const size_t parameter_count = | 154 const size_t parameter_count = |
| 153 static_cast<size_t>(js_parameter_count + context_count); | 155 static_cast<size_t>(js_parameter_count + context_count); |
| 154 | 156 |
| 155 LocationSignature::Builder locations(zone, return_count, parameter_count); | 157 LocationSignature::Builder locations(zone, return_count, parameter_count); |
| 156 MachineSignature::Builder types(zone, return_count, parameter_count); | 158 MachineSignature::Builder types(zone, return_count, parameter_count); |
| 157 | 159 |
| 158 // Add return location. | 160 // Add return location. |
| 159 AddReturnLocations(&locations); | 161 AddReturnLocations(&locations); |
| 160 types.AddReturn(kMachAnyTagged); | 162 types.AddReturn(return_type); |
| 161 | 163 |
| 162 // Add parameters in registers and on the stack. | 164 // Add parameters in registers and on the stack. |
| 163 for (int i = 0; i < js_parameter_count; i++) { | 165 for (int i = 0; i < js_parameter_count; i++) { |
| 164 if (i < register_parameter_count) { | 166 if (i < register_parameter_count) { |
| 165 // The first parameters go in registers. | 167 // The first parameters go in registers. |
| 166 Register reg = descriptor.GetEnvironmentParameterRegister(i); | 168 Register reg = descriptor.GetEnvironmentParameterRegister(i); |
| 167 Representation rep = | 169 Representation rep = |
| 168 descriptor.GetEnvironmentParameterRepresentation(i); | 170 descriptor.GetEnvironmentParameterRepresentation(i); |
| 169 locations.AddParam(regloc(reg)); | 171 locations.AddParam(regloc(reg)); |
| 170 types.AddParam(reptyp(rep)); | 172 types.AddParam(reptyp(rep)); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 int parameter_index = 1 + index; // skip index 0, which is the target. | 285 int parameter_index = 1 + index; // skip index 0, which is the target. |
| 284 return incoming_->GetInputLocation(parameter_index); | 286 return incoming_->GetInputLocation(parameter_index); |
| 285 } | 287 } |
| 286 } | 288 } |
| 287 | 289 |
| 288 } // namespace compiler | 290 } // namespace compiler |
| 289 } // namespace internal | 291 } // namespace internal |
| 290 } // namespace v8 | 292 } // namespace v8 |
| 291 | 293 |
| 292 #endif // V8_COMPILER_LINKAGE_IMPL_H_ | 294 #endif // V8_COMPILER_LINKAGE_IMPL_H_ |
| OLD | NEW |