Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: src/compiler/linkage-impl.h

Issue 1266603002: [turbofan] Factor C call descriptor building into compiler/c-linkage.cc. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/mips/linkage-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 types.Build(), // machine_sig 190 types.Build(), // machine_sig
191 locations.Build(), // location_sig 191 locations.Build(), // location_sig
192 js_parameter_count, // js_parameter_count 192 js_parameter_count, // js_parameter_count
193 properties, // properties 193 properties, // properties
194 kNoCalleeSaved, // callee-saved registers 194 kNoCalleeSaved, // callee-saved registers
195 kNoCalleeSaved, // callee-saved fp 195 kNoCalleeSaved, // callee-saved fp
196 flags, // flags 196 flags, // flags
197 descriptor.DebugName(isolate)); 197 descriptor.DebugName(isolate));
198 } 198 }
199 199
200 static CallDescriptor* GetSimplifiedCDescriptor(
201 Zone* zone, const MachineSignature* msig) {
202 LocationSignature::Builder locations(zone, msig->return_count(),
203 msig->parameter_count());
204 // Add return location(s).
205 AddReturnLocations(&locations);
206
207 // Add register and/or stack parameter(s).
208 const int parameter_count = static_cast<int>(msig->parameter_count());
209 int stack_offset = LinkageTraits::CStackBackingStoreLength();
210 for (int i = 0; i < parameter_count; i++) {
211 if (i < LinkageTraits::CRegisterParametersLength()) {
212 locations.AddParam(regloc(LinkageTraits::CRegisterParameter(i)));
213 } else {
214 locations.AddParam(stackloc(-1 - stack_offset));
215 stack_offset++;
216 }
217 }
218
219 // The target for C calls is always an address (i.e. machine pointer).
220 MachineType target_type = kMachPtr;
221 LinkageLocation target_loc = LinkageLocation::AnyRegister();
222 return new (zone) CallDescriptor( // --
223 CallDescriptor::kCallAddress, // kind
224 target_type, // target MachineType
225 target_loc, // target location
226 msig, // machine_sig
227 locations.Build(), // location_sig
228 0, // js_parameter_count
229 Operator::kNoProperties, // properties
230 LinkageTraits::CCalleeSaveRegisters(), // callee-saved registers
231 LinkageTraits::CCalleeSaveFPRegisters(), // callee-saved fp regs
232 CallDescriptor::kNoFlags, // flags
233 "c-call");
234 }
235
236 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone) { 200 static CallDescriptor* GetInterpreterDispatchDescriptor(Zone* zone) {
237 MachineSignature::Builder types(zone, 0, 2); 201 MachineSignature::Builder types(zone, 0, 2);
238 LocationSignature::Builder locations(zone, 0, 2); 202 LocationSignature::Builder locations(zone, 0, 2);
239 203
240 // Add registers for fixed parameters passed via interpreter dispatch. 204 // Add registers for fixed parameters passed via interpreter dispatch.
241 STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeParameter); 205 STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeParameter);
242 types.AddParam(kMachPtr); 206 types.AddParam(kMachPtr);
243 locations.AddParam(regloc(LinkageTraits::InterpreterBytecodePointerReg())); 207 locations.AddParam(regloc(LinkageTraits::InterpreterBytecodePointerReg()));
244 208
245 STATIC_ASSERT(1 == Linkage::kInterpreterDispatchTableParameter); 209 STATIC_ASSERT(1 == Linkage::kInterpreterDispatchTableParameter);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 int parameter_index = 1 + index; // skip index 0, which is the target. 286 int parameter_index = 1 + index; // skip index 0, which is the target.
323 return incoming_->GetInputLocation(parameter_index); 287 return incoming_->GetInputLocation(parameter_index);
324 } 288 }
325 } 289 }
326 290
327 } // namespace compiler 291 } // namespace compiler
328 } // namespace internal 292 } // namespace internal
329 } // namespace v8 293 } // namespace v8
330 294
331 #endif // V8_COMPILER_LINKAGE_IMPL_H_ 295 #endif // V8_COMPILER_LINKAGE_IMPL_H_
OLDNEW
« no previous file with comments | « src/compiler/linkage.cc ('k') | src/compiler/mips/linkage-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698