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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 enum Flag { | 118 enum Flag { |
119 kNoFlags = 0u, | 119 kNoFlags = 0u, |
120 kNeedsFrameState = 1u << 0, | 120 kNeedsFrameState = 1u << 0, |
121 kPatchableCallSite = 1u << 1, | 121 kPatchableCallSite = 1u << 1, |
122 kNeedsNopAfterCall = 1u << 2, | 122 kNeedsNopAfterCall = 1u << 2, |
123 kHasExceptionHandler = 1u << 3, | 123 kHasExceptionHandler = 1u << 3, |
124 kHasLocalCatchHandler = 1u << 4, | 124 kHasLocalCatchHandler = 1u << 4, |
125 kSupportsTailCalls = 1u << 5, | 125 kSupportsTailCalls = 1u << 5, |
126 kCanUseRoots = 1u << 6, | 126 kCanUseRoots = 1u << 6, |
| 127 kHasVarArgs = 1u << 7, |
127 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall | 128 kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall |
128 }; | 129 }; |
129 typedef base::Flags<Flag> Flags; | 130 typedef base::Flags<Flag> Flags; |
130 | 131 |
131 CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, | 132 CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, |
132 const MachineSignature* machine_sig, | 133 const MachineSignature* machine_sig, |
133 LocationSignature* location_sig, size_t stack_param_count, | 134 LocationSignature* location_sig, size_t stack_param_count, |
134 Operator::Properties properties, | 135 Operator::Properties properties, |
135 RegList callee_saved_registers, | 136 RegList callee_saved_registers, |
136 RegList callee_saved_fp_registers, Flags flags, | 137 RegList callee_saved_fp_registers, Flags flags, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 return stack_param_count_; | 175 return stack_param_count_; |
175 } | 176 } |
176 | 177 |
177 // The total number of inputs to this call, which includes the target, | 178 // The total number of inputs to this call, which includes the target, |
178 // receiver, context, etc. | 179 // receiver, context, etc. |
179 // TODO(titzer): this should input the framestate input too. | 180 // TODO(titzer): this should input the framestate input too. |
180 size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } | 181 size_t InputCount() const { return 1 + machine_sig_->parameter_count(); } |
181 | 182 |
182 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } | 183 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } |
183 | 184 |
| 185 size_t VarArgsInputCount() const { return HasVarArgs() ? 2 : 0; } |
| 186 |
184 Flags flags() const { return flags_; } | 187 Flags flags() const { return flags_; } |
185 | 188 |
186 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } | 189 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } |
187 bool SupportsTailCalls() const { return flags() & kSupportsTailCalls; } | 190 bool SupportsTailCalls() const { return flags() & kSupportsTailCalls; } |
| 191 bool HasVarArgs() const { return flags() & kHasVarArgs; } |
188 | 192 |
189 LinkageLocation GetReturnLocation(size_t index) const { | 193 LinkageLocation GetReturnLocation(size_t index) const { |
190 return location_sig_->GetReturn(index); | 194 return location_sig_->GetReturn(index); |
191 } | 195 } |
192 | 196 |
193 LinkageLocation GetInputLocation(size_t index) const { | 197 LinkageLocation GetInputLocation(size_t index) const { |
194 if (index == 0) return target_loc_; | 198 if (index == 0) return target_loc_; |
195 return location_sig_->GetParam(index - 1); | 199 return location_sig_->GetParam(index - 1); |
196 } | 200 } |
197 | 201 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 CallDescriptor* const incoming_; | 345 CallDescriptor* const incoming_; |
342 | 346 |
343 DISALLOW_COPY_AND_ASSIGN(Linkage); | 347 DISALLOW_COPY_AND_ASSIGN(Linkage); |
344 }; | 348 }; |
345 | 349 |
346 } // namespace compiler | 350 } // namespace compiler |
347 } // namespace internal | 351 } // namespace internal |
348 } // namespace v8 | 352 } // namespace v8 |
349 | 353 |
350 #endif // V8_COMPILER_LINKAGE_H_ | 354 #endif // V8_COMPILER_LINKAGE_H_ |
OLD | NEW |