| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 DCHECK(slot < 0); | 50 DCHECK(slot < 0); |
| 51 return LinkageLocation(STACK_SLOT, slot); | 51 return LinkageLocation(STACK_SLOT, slot); |
| 52 } | 52 } |
| 53 | 53 |
| 54 static LinkageLocation ForCalleeFrameSlot(int32_t slot) { | 54 static LinkageLocation ForCalleeFrameSlot(int32_t slot) { |
| 55 // TODO(titzer): bailout instead of crashing here. | 55 // TODO(titzer): bailout instead of crashing here. |
| 56 DCHECK(slot >= 0 && slot < LinkageLocation::MAX_STACK_SLOT); | 56 DCHECK(slot >= 0 && slot < LinkageLocation::MAX_STACK_SLOT); |
| 57 return LinkageLocation(STACK_SLOT, slot); | 57 return LinkageLocation(STACK_SLOT, slot); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static LinkageLocation ConvertToTailCallerLocation( |
| 61 LinkageLocation caller_location, int stack_param_delta) { |
| 62 if (!caller_location.IsRegister()) { |
| 63 return LinkageLocation(STACK_SLOT, |
| 64 caller_location.GetLocation() + stack_param_delta); |
| 65 } |
| 66 return caller_location; |
| 67 } |
| 68 |
| 60 private: | 69 private: |
| 61 friend class CallDescriptor; | 70 friend class CallDescriptor; |
| 62 friend class OperandGenerator; | 71 friend class OperandGenerator; |
| 63 | 72 |
| 64 enum LocationType { REGISTER, STACK_SLOT }; | 73 enum LocationType { REGISTER, STACK_SLOT }; |
| 65 | 74 |
| 66 class TypeField : public BitField<LocationType, 0, 1> {}; | 75 class TypeField : public BitField<LocationType, 0, 1> {}; |
| 67 class LocationField : public BitField<int32_t, TypeField::kNext, 31> {}; | 76 class LocationField : public BitField<int32_t, TypeField::kNext, 31> {}; |
| 68 | 77 |
| 69 static const int32_t ANY_REGISTER = -1; | 78 static const int32_t ANY_REGISTER = -1; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 224 |
| 216 // Get the callee-saved FP registers, if any, across this call. | 225 // Get the callee-saved FP registers, if any, across this call. |
| 217 RegList CalleeSavedFPRegisters() const { return callee_saved_fp_registers_; } | 226 RegList CalleeSavedFPRegisters() const { return callee_saved_fp_registers_; } |
| 218 | 227 |
| 219 const char* debug_name() const { return debug_name_; } | 228 const char* debug_name() const { return debug_name_; } |
| 220 | 229 |
| 221 bool UsesOnlyRegisters() const; | 230 bool UsesOnlyRegisters() const; |
| 222 | 231 |
| 223 bool HasSameReturnLocationsAs(const CallDescriptor* other) const; | 232 bool HasSameReturnLocationsAs(const CallDescriptor* other) const; |
| 224 | 233 |
| 225 bool CanTailCall(const Node* call) const; | 234 bool CanTailCall(const Node* call, int* stack_param_delta) const; |
| 226 | 235 |
| 227 private: | 236 private: |
| 228 friend class Linkage; | 237 friend class Linkage; |
| 229 | 238 |
| 230 const Kind kind_; | 239 const Kind kind_; |
| 231 const MachineType target_type_; | 240 const MachineType target_type_; |
| 232 const LinkageLocation target_loc_; | 241 const LinkageLocation target_loc_; |
| 233 const MachineSignature* const machine_sig_; | 242 const MachineSignature* const machine_sig_; |
| 234 const LocationSignature* const location_sig_; | 243 const LocationSignature* const location_sig_; |
| 235 const size_t stack_param_count_; | 244 const size_t stack_param_count_; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 CallDescriptor* const incoming_; | 356 CallDescriptor* const incoming_; |
| 348 | 357 |
| 349 DISALLOW_COPY_AND_ASSIGN(Linkage); | 358 DISALLOW_COPY_AND_ASSIGN(Linkage); |
| 350 }; | 359 }; |
| 351 | 360 |
| 352 } // namespace compiler | 361 } // namespace compiler |
| 353 } // namespace internal | 362 } // namespace internal |
| 354 } // namespace v8 | 363 } // namespace v8 |
| 355 | 364 |
| 356 #endif // V8_COMPILER_LINKAGE_H_ | 365 #endif // V8_COMPILER_LINKAGE_H_ |
| OLD | NEW |