| 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_C_SIGNATURE_H_ | 5 #ifndef V8_COMPILER_C_SIGNATURE_H_ |
| 6 #define V8_COMPILER_C_SIGNATURE_H_ | 6 #define V8_COMPILER_C_SIGNATURE_H_ |
| 7 | 7 |
| 8 #include "src/machine-type.h" | 8 #include "src/machine-type.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 class CSignatureOf : public CSignature { | 108 class CSignatureOf : public CSignature { |
| 109 protected: | 109 protected: |
| 110 MachineType storage_[1 + kParamCount]; | 110 MachineType storage_[1 + kParamCount]; |
| 111 | 111 |
| 112 CSignatureOf() | 112 CSignatureOf() |
| 113 : CSignature(MachineTypeForC<Ret>() != kMachNone ? 1 : 0, kParamCount, | 113 : CSignature(MachineTypeForC<Ret>() != kMachNone ? 1 : 0, kParamCount, |
| 114 reinterpret_cast<MachineType*>(&storage_)) { | 114 reinterpret_cast<MachineType*>(&storage_)) { |
| 115 if (return_count_ == 1) storage_[0] = MachineTypeForC<Ret>(); | 115 if (return_count_ == 1) storage_[0] = MachineTypeForC<Ret>(); |
| 116 } | 116 } |
| 117 void Set(int index, MachineType type) { | 117 void Set(int index, MachineType type) { |
| 118 DCHECK(index >= 0 && index < kParamCount); | 118 CHECK_LE(0, index); |
| 119 CHECK_LT(index, kParamCount); |
| 119 reps_[return_count_ + index] = type; | 120 reps_[return_count_ + index] = type; |
| 120 } | 121 } |
| 121 }; | 122 }; |
| 122 | 123 |
| 123 // Helper classes for instantiating Signature objects to be callable from C. | 124 // Helper classes for instantiating Signature objects to be callable from C. |
| 124 template <typename Ret> | 125 template <typename Ret> |
| 125 class CSignature0 : public CSignatureOf<Ret, 0> { | 126 class CSignature0 : public CSignatureOf<Ret, 0> { |
| 126 public: | 127 public: |
| 127 CSignature0() : CSignatureOf<Ret, 0>() {} | 128 CSignature0() : CSignatureOf<Ret, 0>() {} |
| 128 }; | 129 }; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 157 typedef CSignature2<int32_t, int32_t, int32_t> CSignature_i_ii; | 158 typedef CSignature2<int32_t, int32_t, int32_t> CSignature_i_ii; |
| 158 typedef CSignature2<uint32_t, uint32_t, uint32_t> CSignature_u_uu; | 159 typedef CSignature2<uint32_t, uint32_t, uint32_t> CSignature_u_uu; |
| 159 typedef CSignature2<float, float, float> CSignature_f_ff; | 160 typedef CSignature2<float, float, float> CSignature_f_ff; |
| 160 typedef CSignature2<double, double, double> CSignature_d_dd; | 161 typedef CSignature2<double, double, double> CSignature_d_dd; |
| 161 typedef CSignature2<Object*, Object*, Object*> CSignature_o_oo; | 162 typedef CSignature2<Object*, Object*, Object*> CSignature_o_oo; |
| 162 } // namespace compiler | 163 } // namespace compiler |
| 163 } // namespace internal | 164 } // namespace internal |
| 164 } // namespace v8 | 165 } // namespace v8 |
| 165 | 166 |
| 166 #endif // V8_COMPILER_C_SIGNATURE_H_ | 167 #endif // V8_COMPILER_C_SIGNATURE_H_ |
| OLD | NEW |