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/machine-type.h" | 10 #include "src/compiler/machine-type.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 56 }; |
57 | 57 |
58 typedef Signature<LinkageLocation> LocationSignature; | 58 typedef Signature<LinkageLocation> LocationSignature; |
59 | 59 |
60 // Describes a call to various parts of the compiler. Every call has the notion | 60 // Describes a call to various parts of the compiler. Every call has the notion |
61 // of a "target", which is the first input to the call. | 61 // of a "target", which is the first input to the call. |
62 class CallDescriptor final : public ZoneObject { | 62 class CallDescriptor final : public ZoneObject { |
63 public: | 63 public: |
64 // Describes the kind of this call, which determines the target. | 64 // Describes the kind of this call, which determines the target. |
65 enum Kind { | 65 enum Kind { |
66 kCallCodeObject, // target is a Code object | 66 kCallCodeObject, // target is a Code object |
67 kCallJSFunction, // target is a JSFunction object | 67 kCallJSFunction, // target is a JSFunction object |
68 kCallAddress // target is a machine pointer | 68 kCallAddress, // target is a machine pointer |
| 69 kInterpreterDispatch // target is an interpreter bytecode handler |
69 }; | 70 }; |
70 | 71 |
71 enum Flag { | 72 enum Flag { |
72 kNoFlags = 0u, | 73 kNoFlags = 0u, |
73 kNeedsFrameState = 1u << 0, | 74 kNeedsFrameState = 1u << 0, |
74 kPatchableCallSite = 1u << 1, | 75 kPatchableCallSite = 1u << 1, |
75 kNeedsNopAfterCall = 1u << 2, | 76 kNeedsNopAfterCall = 1u << 2, |
76 kHasExceptionHandler = 1u << 3, | 77 kHasExceptionHandler = 1u << 3, |
77 kHasLocalCatchHandler = 1u << 4, | 78 kHasLocalCatchHandler = 1u << 4, |
78 kSupportsTailCalls = 1u << 5, | 79 kSupportsTailCalls = 1u << 5, |
(...skipping 25 matching lines...) Expand all Loading... |
104 | 105 |
105 // Returns the kind of this call. | 106 // Returns the kind of this call. |
106 Kind kind() const { return kind_; } | 107 Kind kind() const { return kind_; } |
107 | 108 |
108 // Returns {true} if this descriptor is a call to a C function. | 109 // Returns {true} if this descriptor is a call to a C function. |
109 bool IsCFunctionCall() const { return kind_ == kCallAddress; } | 110 bool IsCFunctionCall() const { return kind_ == kCallAddress; } |
110 | 111 |
111 // Returns {true} if this descriptor is a call to a JSFunction. | 112 // Returns {true} if this descriptor is a call to a JSFunction. |
112 bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } | 113 bool IsJSFunctionCall() const { return kind_ == kCallJSFunction; } |
113 | 114 |
| 115 bool IsInterpreterDispatch() const { return kind_ == kInterpreterDispatch; } |
| 116 |
114 // The number of return values from this call. | 117 // The number of return values from this call. |
115 size_t ReturnCount() const { return machine_sig_->return_count(); } | 118 size_t ReturnCount() const { return machine_sig_->return_count(); } |
116 | 119 |
117 // The number of C parameters to this call. | 120 // The number of C parameters to this call. |
118 size_t CParameterCount() const { return machine_sig_->parameter_count(); } | 121 size_t CParameterCount() const { return machine_sig_->parameter_count(); } |
119 | 122 |
120 // The number of JavaScript parameters to this call, including the receiver | 123 // The number of JavaScript parameters to this call, including the receiver |
121 // object. | 124 // object. |
122 size_t JSParameterCount() const { return js_param_count_; } | 125 size_t JSParameterCount() const { return js_param_count_; } |
123 | 126 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Operator::Properties properties = Operator::kNoProperties, | 231 Operator::Properties properties = Operator::kNoProperties, |
229 MachineType return_type = kMachAnyTagged); | 232 MachineType return_type = kMachAnyTagged); |
230 | 233 |
231 // Creates a call descriptor for simplified C calls that is appropriate | 234 // Creates a call descriptor for simplified C calls that is appropriate |
232 // for the host platform. This simplified calling convention only supports | 235 // for the host platform. This simplified calling convention only supports |
233 // integers and pointers of one word size each, i.e. no floating point, | 236 // integers and pointers of one word size each, i.e. no floating point, |
234 // structs, pointers to members, etc. | 237 // structs, pointers to members, etc. |
235 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone, | 238 static CallDescriptor* GetSimplifiedCDescriptor(Zone* zone, |
236 const MachineSignature* sig); | 239 const MachineSignature* sig); |
237 | 240 |
| 241 // Creates a call descriptor for interpreter handler code stubs. These are not |
| 242 // intended to be called directly but are instead dispatched to by the |
| 243 // interpreter. |
| 244 static CallDescriptor* GetInterpreterDispatchDescriptor( |
| 245 Zone* zone, const MachineSignature* sig); |
| 246 |
238 // Get the location of an (incoming) parameter to this function. | 247 // Get the location of an (incoming) parameter to this function. |
239 LinkageLocation GetParameterLocation(int index) const { | 248 LinkageLocation GetParameterLocation(int index) const { |
240 return incoming_->GetInputLocation(index + 1); // + 1 to skip target. | 249 return incoming_->GetInputLocation(index + 1); // + 1 to skip target. |
241 } | 250 } |
242 | 251 |
243 // Get the machine type of an (incoming) parameter to this function. | 252 // Get the machine type of an (incoming) parameter to this function. |
244 MachineType GetParameterType(int index) const { | 253 MachineType GetParameterType(int index) const { |
245 return incoming_->GetInputType(index + 1); // + 1 to skip target. | 254 return incoming_->GetInputType(index + 1); // + 1 to skip target. |
246 } | 255 } |
247 | 256 |
(...skipping 27 matching lines...) Expand all Loading... |
275 CallDescriptor* const incoming_; | 284 CallDescriptor* const incoming_; |
276 | 285 |
277 DISALLOW_COPY_AND_ASSIGN(Linkage); | 286 DISALLOW_COPY_AND_ASSIGN(Linkage); |
278 }; | 287 }; |
279 | 288 |
280 } // namespace compiler | 289 } // namespace compiler |
281 } // namespace internal | 290 } // namespace internal |
282 } // namespace v8 | 291 } // namespace v8 |
283 | 292 |
284 #endif // V8_COMPILER_LINKAGE_H_ | 293 #endif // V8_COMPILER_LINKAGE_H_ |
OLD | NEW |