| 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_H_ | 5 #ifndef V8_COMPILER_LINKAGE_H_ |
| 6 #define V8_COMPILER_LINKAGE_H_ | 6 #define V8_COMPILER_LINKAGE_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | 8 #include "src/base/flags.h" |
| 9 #include "src/compiler/frame.h" | 9 #include "src/compiler/frame.h" |
| 10 #include "src/compiler/operator.h" | 10 #include "src/compiler/operator.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 297 |
| 298 // Defines the linkage for a compilation, including the calling conventions | 298 // Defines the linkage for a compilation, including the calling conventions |
| 299 // for incoming parameters and return value(s) as well as the outgoing calling | 299 // for incoming parameters and return value(s) as well as the outgoing calling |
| 300 // convention for any kind of call. Linkage is generally architecture-specific. | 300 // convention for any kind of call. Linkage is generally architecture-specific. |
| 301 // | 301 // |
| 302 // Can be used to translate {arg_index} (i.e. index of the call node input) as | 302 // Can be used to translate {arg_index} (i.e. index of the call node input) as |
| 303 // well as {param_index} (i.e. as stored in parameter nodes) into an operator | 303 // well as {param_index} (i.e. as stored in parameter nodes) into an operator |
| 304 // representing the architecture-specific location. The following call node | 304 // representing the architecture-specific location. The following call node |
| 305 // layouts are supported (where {n} is the number of value inputs): | 305 // layouts are supported (where {n} is the number of value inputs): |
| 306 // | 306 // |
| 307 // #0 #1 #2 #3 [...] #n | 307 // #0 #1 #2 [...] #n |
| 308 // Call[CodeStub] code, arg 1, arg 2, arg 3, [...], context | 308 // Call[CodeStub] code, arg 1, arg 2, [...], context |
| 309 // Call[JSFunction] function, rcvr, arg 1, arg 2, [...], new, #arg, context | 309 // Call[JSFunction] function, rcvr, arg 1, [...], new, #arg, context |
| 310 // Call[Runtime] CEntryStub, arg 1, arg 2, arg 3, [...], fun, #arg, context | 310 // Call[Runtime] CEntryStub, arg 1, arg 2, [...], fun, #arg, context |
| 311 // Call[BytecodeDispatch] address, arg 1, arg 2, [...], context |
| 311 class Linkage : public ZoneObject { | 312 class Linkage : public ZoneObject { |
| 312 public: | 313 public: |
| 313 explicit Linkage(CallDescriptor* incoming) : incoming_(incoming) {} | 314 explicit Linkage(CallDescriptor* incoming) : incoming_(incoming) {} |
| 314 | 315 |
| 315 static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info); | 316 static CallDescriptor* ComputeIncoming(Zone* zone, CompilationInfo* info); |
| 316 | 317 |
| 317 // The call descriptor for this compilation unit describes the locations | 318 // The call descriptor for this compilation unit describes the locations |
| 318 // of incoming parameters and the outgoing return value(s). | 319 // of incoming parameters and the outgoing return value(s). |
| 319 CallDescriptor* GetIncomingDescriptor() const { return incoming_; } | 320 CallDescriptor* GetIncomingDescriptor() const { return incoming_; } |
| 320 static CallDescriptor* GetJSCallDescriptor(Zone* zone, bool is_osr, | 321 static CallDescriptor* GetJSCallDescriptor(Zone* zone, bool is_osr, |
| 321 int parameter_count, | 322 int parameter_count, |
| 322 CallDescriptor::Flags flags); | 323 CallDescriptor::Flags flags); |
| 323 | 324 |
| 324 static CallDescriptor* GetRuntimeCallDescriptor( | 325 static CallDescriptor* GetRuntimeCallDescriptor( |
| 325 Zone* zone, Runtime::FunctionId function, int parameter_count, | 326 Zone* zone, Runtime::FunctionId function, int parameter_count, |
| 326 Operator::Properties properties, CallDescriptor::Flags flags); | 327 Operator::Properties properties, CallDescriptor::Flags flags); |
| 327 | 328 |
| 328 static CallDescriptor* GetStubCallDescriptor( | 329 static CallDescriptor* GetStubCallDescriptor( |
| 329 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, | 330 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
| 330 int stack_parameter_count, CallDescriptor::Flags flags, | 331 int stack_parameter_count, CallDescriptor::Flags flags, |
| 331 Operator::Properties properties = Operator::kNoProperties, | 332 Operator::Properties properties = Operator::kNoProperties, |
| 332 MachineType return_type = MachineType::AnyTagged(), | 333 MachineType return_type = MachineType::AnyTagged(), |
| 333 size_t return_count = 1); | 334 size_t return_count = 1); |
| 334 | 335 |
| 336 static CallDescriptor* GetBytecodeDispatchCallDescriptor( |
| 337 Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor, |
| 338 int stack_parameter_count); |
| 339 |
| 335 // Creates a call descriptor for simplified C calls that is appropriate | 340 // Creates a call descriptor for simplified C calls that is appropriate |
| 336 // for the host platform. This simplified calling convention only supports | 341 // for the host platform. This simplified calling convention only supports |
| 337 // integers and pointers of one word size each, i.e. no floating point, | 342 // integers and pointers of one word size each, i.e. no floating point, |
| 338 // structs, pointers to members, etc. | 343 // structs, pointers to members, etc. |
| 339 static CallDescriptor* GetSimplifiedCDescriptor( | 344 static CallDescriptor* GetSimplifiedCDescriptor( |
| 340 Zone* zone, const MachineSignature* sig, | 345 Zone* zone, const MachineSignature* sig, |
| 341 bool set_initialize_root_flag = false); | 346 bool set_initialize_root_flag = false); |
| 342 | 347 |
| 343 // Get the location of an (incoming) parameter to this function. | 348 // Get the location of an (incoming) parameter to this function. |
| 344 LinkageLocation GetParameterLocation(int index) const { | 349 LinkageLocation GetParameterLocation(int index) const { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 CallDescriptor* const incoming_; | 403 CallDescriptor* const incoming_; |
| 399 | 404 |
| 400 DISALLOW_COPY_AND_ASSIGN(Linkage); | 405 DISALLOW_COPY_AND_ASSIGN(Linkage); |
| 401 }; | 406 }; |
| 402 | 407 |
| 403 } // namespace compiler | 408 } // namespace compiler |
| 404 } // namespace internal | 409 } // namespace internal |
| 405 } // namespace v8 | 410 } // namespace v8 |
| 406 | 411 |
| 407 #endif // V8_COMPILER_LINKAGE_H_ | 412 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |