| 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_MACHINE_TYPE_H_ | 5 #ifndef V8_COMPILER_MACHINE_TYPE_H_ |
| 6 #define V8_COMPILER_MACHINE_TYPE_H_ | 6 #define V8_COMPILER_MACHINE_TYPE_H_ |
| 7 | 7 |
| 8 #include "src/globals.h" | 8 #include "src/globals.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 case kRepFloat64: | 101 case kRepFloat64: |
| 102 return 8; | 102 return 8; |
| 103 case kRepTagged: | 103 case kRepTagged: |
| 104 return kPointerSize; | 104 return kPointerSize; |
| 105 default: | 105 default: |
| 106 UNREACHABLE(); | 106 UNREACHABLE(); |
| 107 return kPointerSize; | 107 return kPointerSize; |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Describes the inputs and outputs of a function or call in terms of machine |
| 112 // types. |
| 113 class MachineSignature { |
| 114 public: |
| 115 MachineSignature(uint8_t return_count, uint16_t param_count, |
| 116 MachineType* reps) |
| 117 : return_count_(return_count), param_count_(param_count), reps_(reps) {} |
| 118 |
| 119 int GetReturnCount() const { return return_count_; } |
| 120 int GetParamCount() const { return param_count_; } |
| 121 |
| 122 MachineType GetParameterType(int index) const { |
| 123 DCHECK(index >= 0 && index < param_count_); |
| 124 return reps_[return_count_ + index]; |
| 125 } |
| 126 |
| 127 MachineType GetReturnType(int index = 0) const { |
| 128 DCHECK(index >= 0 && index < return_count_); |
| 129 return reps_[index]; |
| 130 } |
| 131 |
| 132 protected: |
| 133 uint8_t return_count_; |
| 134 uint16_t param_count_; |
| 135 MachineType* reps_; |
| 136 }; |
| 111 } // namespace compiler | 137 } // namespace compiler |
| 112 } // namespace internal | 138 } // namespace internal |
| 113 } // namespace v8 | 139 } // namespace v8 |
| 114 | 140 |
| 115 #endif // V8_COMPILER_MACHINE_TYPE_H_ | 141 #endif // V8_COMPILER_MACHINE_TYPE_H_ |
| OLD | NEW |