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/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
10 #include "src/compiler/frame.h" | 10 #include "src/compiler/frame.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 kSupportsTailCalls = 1u << 2, | 180 kSupportsTailCalls = 1u << 2, |
181 kCanUseRoots = 1u << 3, | 181 kCanUseRoots = 1u << 3, |
182 // (arm64 only) native stack should be used for arguments. | 182 // (arm64 only) native stack should be used for arguments. |
183 kUseNativeStack = 1u << 4, | 183 kUseNativeStack = 1u << 4, |
184 // (arm64 only) call instruction has to restore JSSP or CSP. | 184 // (arm64 only) call instruction has to restore JSSP or CSP. |
185 kRestoreJSSP = 1u << 5, | 185 kRestoreJSSP = 1u << 5, |
186 kRestoreCSP = 1u << 6, | 186 kRestoreCSP = 1u << 6, |
187 // Causes the code generator to initialize the root register. | 187 // Causes the code generator to initialize the root register. |
188 kInitializeRootRegister = 1u << 7, | 188 kInitializeRootRegister = 1u << 7, |
189 // Does not ever try to allocate space on our heap. | 189 // Does not ever try to allocate space on our heap. |
190 kNoAllocate = 1u << 8 | 190 kNoAllocate = 1u << 8, |
| 191 // Push argument count as part of function prologue. |
| 192 kPushArgumentCount = 1u << 9 |
191 }; | 193 }; |
192 typedef base::Flags<Flag> Flags; | 194 typedef base::Flags<Flag> Flags; |
193 | 195 |
194 CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, | 196 CallDescriptor(Kind kind, MachineType target_type, LinkageLocation target_loc, |
195 LocationSignature* location_sig, size_t stack_param_count, | 197 LocationSignature* location_sig, size_t stack_param_count, |
196 Operator::Properties properties, | 198 Operator::Properties properties, |
197 RegList callee_saved_registers, | 199 RegList callee_saved_registers, |
198 RegList callee_saved_fp_registers, Flags flags, | 200 RegList callee_saved_fp_registers, Flags flags, |
199 const char* debug_name = "") | 201 const char* debug_name = "") |
200 : kind_(kind), | 202 : kind_(kind), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // TODO(titzer): this should input the framestate input too. | 244 // TODO(titzer): this should input the framestate input too. |
243 size_t InputCount() const { return 1 + location_sig_->parameter_count(); } | 245 size_t InputCount() const { return 1 + location_sig_->parameter_count(); } |
244 | 246 |
245 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } | 247 size_t FrameStateCount() const { return NeedsFrameState() ? 1 : 0; } |
246 | 248 |
247 Flags flags() const { return flags_; } | 249 Flags flags() const { return flags_; } |
248 | 250 |
249 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } | 251 bool NeedsFrameState() const { return flags() & kNeedsFrameState; } |
250 bool SupportsTailCalls() const { return flags() & kSupportsTailCalls; } | 252 bool SupportsTailCalls() const { return flags() & kSupportsTailCalls; } |
251 bool UseNativeStack() const { return flags() & kUseNativeStack; } | 253 bool UseNativeStack() const { return flags() & kUseNativeStack; } |
| 254 bool PushArgumentCount() const { return flags() & kPushArgumentCount; } |
252 bool InitializeRootRegister() const { | 255 bool InitializeRootRegister() const { |
253 return flags() & kInitializeRootRegister; | 256 return flags() & kInitializeRootRegister; |
254 } | 257 } |
255 | 258 |
256 LinkageLocation GetReturnLocation(size_t index) const { | 259 LinkageLocation GetReturnLocation(size_t index) const { |
257 return location_sig_->GetReturn(index); | 260 return location_sig_->GetReturn(index); |
258 } | 261 } |
259 | 262 |
260 LinkageLocation GetInputLocation(size_t index) const { | 263 LinkageLocation GetInputLocation(size_t index) const { |
261 if (index == 0) return target_loc_; | 264 if (index == 0) return target_loc_; |
(...skipping 27 matching lines...) Expand all Loading... |
289 const char* debug_name() const { return debug_name_; } | 292 const char* debug_name() const { return debug_name_; } |
290 | 293 |
291 bool UsesOnlyRegisters() const; | 294 bool UsesOnlyRegisters() const; |
292 | 295 |
293 bool HasSameReturnLocationsAs(const CallDescriptor* other) const; | 296 bool HasSameReturnLocationsAs(const CallDescriptor* other) const; |
294 | 297 |
295 int GetStackParameterDelta(const CallDescriptor* tail_caller = nullptr) const; | 298 int GetStackParameterDelta(const CallDescriptor* tail_caller = nullptr) const; |
296 | 299 |
297 bool CanTailCall(const Node* call) const; | 300 bool CanTailCall(const Node* call) const; |
298 | 301 |
| 302 int CalculateFixedFrameSize() const; |
| 303 |
299 private: | 304 private: |
300 friend class Linkage; | 305 friend class Linkage; |
301 | 306 |
302 const Kind kind_; | 307 const Kind kind_; |
303 const MachineType target_type_; | 308 const MachineType target_type_; |
304 const LinkageLocation target_loc_; | 309 const LinkageLocation target_loc_; |
305 const LocationSignature* const location_sig_; | 310 const LocationSignature* const location_sig_; |
306 const size_t stack_param_count_; | 311 const size_t stack_param_count_; |
307 const Operator::Properties properties_; | 312 const Operator::Properties properties_; |
308 const RegList callee_saved_registers_; | 313 const RegList callee_saved_registers_; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 CallDescriptor* const incoming_; | 441 CallDescriptor* const incoming_; |
437 | 442 |
438 DISALLOW_COPY_AND_ASSIGN(Linkage); | 443 DISALLOW_COPY_AND_ASSIGN(Linkage); |
439 }; | 444 }; |
440 | 445 |
441 } // namespace compiler | 446 } // namespace compiler |
442 } // namespace internal | 447 } // namespace internal |
443 } // namespace v8 | 448 } // namespace v8 |
444 | 449 |
445 #endif // V8_COMPILER_LINKAGE_H_ | 450 #endif // V8_COMPILER_LINKAGE_H_ |
OLD | NEW |