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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 // TODO(all): Add support for return representations/locations to | 139 // TODO(all): Add support for return representations/locations to |
140 // CallInterfaceDescriptor. | 140 // CallInterfaceDescriptor. |
141 // TODO(turbofan): cache call descriptors for code stub calls. | 141 // TODO(turbofan): cache call descriptors for code stub calls. |
142 static CallDescriptor* GetStubCallDescriptor( | 142 static CallDescriptor* GetStubCallDescriptor( |
143 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 143 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
144 int stack_parameter_count, CallDescriptor::Flags flags, | 144 int stack_parameter_count, CallDescriptor::Flags flags, |
145 Operator::Properties properties, MachineType return_type) { | 145 Operator::Properties properties, MachineType return_type) { |
146 const int register_parameter_count = | 146 const int register_parameter_count = descriptor.GetRegisterParameterCount(); |
147 descriptor.GetEnvironmentParameterCount(); | |
148 const int js_parameter_count = | 147 const int js_parameter_count = |
149 register_parameter_count + stack_parameter_count; | 148 register_parameter_count + stack_parameter_count; |
150 const int context_count = 1; | 149 const int context_count = 1; |
151 const size_t return_count = 1; | 150 const size_t return_count = 1; |
152 const size_t parameter_count = | 151 const size_t parameter_count = |
153 static_cast<size_t>(js_parameter_count + context_count); | 152 static_cast<size_t>(js_parameter_count + context_count); |
154 | 153 |
155 LocationSignature::Builder locations(zone, return_count, parameter_count); | 154 LocationSignature::Builder locations(zone, return_count, parameter_count); |
156 MachineSignature::Builder types(zone, return_count, parameter_count); | 155 MachineSignature::Builder types(zone, return_count, parameter_count); |
157 | 156 |
158 // Add return location. | 157 // Add return location. |
159 AddReturnLocations(&locations); | 158 AddReturnLocations(&locations); |
160 types.AddReturn(return_type); | 159 types.AddReturn(return_type); |
161 | 160 |
162 // Add parameters in registers and on the stack. | 161 // Add parameters in registers and on the stack. |
163 for (int i = 0; i < js_parameter_count; i++) { | 162 for (int i = 0; i < js_parameter_count; i++) { |
164 if (i < register_parameter_count) { | 163 if (i < register_parameter_count) { |
165 // The first parameters go in registers. | 164 // The first parameters go in registers. |
166 Register reg = descriptor.GetEnvironmentParameterRegister(i); | 165 Register reg = descriptor.GetRegisterParameter(i); |
167 Representation rep = | 166 Representation rep = |
168 RepresentationFromType(descriptor.GetEnvironmentParameterType(i)); | 167 RepresentationFromType(descriptor.GetParameterType(i)); |
169 locations.AddParam(regloc(reg)); | 168 locations.AddParam(regloc(reg)); |
170 types.AddParam(reptyp(rep)); | 169 types.AddParam(reptyp(rep)); |
171 } else { | 170 } else { |
172 // The rest of the parameters go on the stack. | 171 // The rest of the parameters go on the stack. |
173 int stack_slot = i - register_parameter_count - stack_parameter_count; | 172 int stack_slot = i - register_parameter_count - stack_parameter_count; |
174 locations.AddParam(stackloc(stack_slot)); | 173 locations.AddParam(stackloc(stack_slot)); |
175 types.AddParam(kMachAnyTagged); | 174 types.AddParam(kMachAnyTagged); |
176 } | 175 } |
177 } | 176 } |
178 // Add context. | 177 // Add context. |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 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. |
287 return incoming_->GetInputLocation(parameter_index); | 286 return incoming_->GetInputLocation(parameter_index); |
288 } | 287 } |
289 } | 288 } |
290 | 289 |
291 } // namespace compiler | 290 } // namespace compiler |
292 } // namespace internal | 291 } // namespace internal |
293 } // namespace v8 | 292 } // namespace v8 |
294 | 293 |
295 #endif // V8_COMPILER_LINKAGE_IMPL_H_ | 294 #endif // V8_COMPILER_LINKAGE_IMPL_H_ |
OLD | NEW |