| 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_CALL_INTERFACE_DESCRIPTOR_H_ | 5 #ifndef V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ | 6 #define V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 int param_count() const { return function_type_->Arity(); } | 127 int param_count() const { return function_type_->Arity(); } |
| 128 int register_param_count() const { return register_param_count_; } | 128 int register_param_count() const { return register_param_count_; } |
| 129 Register register_param(int index) const { return register_params_[index]; } | 129 Register register_param(int index) const { return register_params_[index]; } |
| 130 Register* register_params() const { return register_params_.get(); } | 130 Register* register_params() const { return register_params_.get(); } |
| 131 Type* param_type(int index) const { return function_type_->Parameter(index); } | 131 Type* param_type(int index) const { return function_type_->Parameter(index); } |
| 132 PlatformInterfaceDescriptor* platform_specific_descriptor() const { | 132 PlatformInterfaceDescriptor* platform_specific_descriptor() const { |
| 133 return platform_specific_descriptor_; | 133 return platform_specific_descriptor_; |
| 134 } | 134 } |
| 135 | 135 |
| 136 FunctionType* function_type() const { return function_type_; } | |
| 137 | |
| 138 private: | 136 private: |
| 139 int register_param_count_; | 137 int register_param_count_; |
| 140 | 138 |
| 141 // The Register params are allocated dynamically by the | 139 // The Register params are allocated dynamically by the |
| 142 // InterfaceDescriptor, and freed on destruction. This is because static | 140 // InterfaceDescriptor, and freed on destruction. This is because static |
| 143 // arrays of Registers cause creation of runtime static initializers | 141 // arrays of Registers cause creation of runtime static initializers |
| 144 // which we don't want. | 142 // which we don't want. |
| 145 std::unique_ptr<Register[]> register_params_; | 143 std::unique_ptr<Register[]> register_params_; |
| 146 | 144 |
| 147 // Specifies types for parameters and return | 145 // Specifies types for parameters and return |
| (...skipping 24 matching lines...) Expand all Loading... |
| 172 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) | 170 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) |
| 173 : data_(isolate->call_descriptor_data(key)) {} | 171 : data_(isolate->call_descriptor_data(key)) {} |
| 174 | 172 |
| 175 int GetParameterCount() const { return data()->param_count(); } | 173 int GetParameterCount() const { return data()->param_count(); } |
| 176 | 174 |
| 177 int GetRegisterParameterCount() const { | 175 int GetRegisterParameterCount() const { |
| 178 return data()->register_param_count(); | 176 return data()->register_param_count(); |
| 179 } | 177 } |
| 180 | 178 |
| 181 int GetStackParameterCount() const { | 179 int GetStackParameterCount() const { |
| 182 return data()->function_type()->Arity() - data()->register_param_count(); | 180 return data()->param_count() - data()->register_param_count(); |
| 183 } | 181 } |
| 184 | 182 |
| 185 Register GetRegisterParameter(int index) const { | 183 Register GetRegisterParameter(int index) const { |
| 186 return data()->register_param(index); | 184 return data()->register_param(index); |
| 187 } | 185 } |
| 188 | 186 |
| 189 Type* GetParameterType(int index) const { | 187 Type* GetParameterType(int index) const { |
| 190 DCHECK(index < data()->param_count()); | 188 DCHECK(index < data()->param_count()); |
| 191 return data()->param_type(index); | 189 return data()->param_type(index); |
| 192 } | 190 } |
| 193 | 191 |
| 194 // Some platforms have extra information to associate with the descriptor. | 192 // Some platforms have extra information to associate with the descriptor. |
| 195 PlatformInterfaceDescriptor* platform_specific_descriptor() const { | 193 PlatformInterfaceDescriptor* platform_specific_descriptor() const { |
| 196 return data()->platform_specific_descriptor(); | 194 return data()->platform_specific_descriptor(); |
| 197 } | 195 } |
| 198 | 196 |
| 199 FunctionType* GetFunctionType() const { return data()->function_type(); } | |
| 200 | |
| 201 static const Register ContextRegister(); | 197 static const Register ContextRegister(); |
| 202 | 198 |
| 203 const char* DebugName(Isolate* isolate) const; | 199 const char* DebugName(Isolate* isolate) const; |
| 204 | 200 |
| 205 static FunctionType* BuildDefaultFunctionType(Isolate* isolate, | 201 static FunctionType* BuildDefaultFunctionType(Isolate* isolate, |
| 206 int parameter_count); | 202 int parameter_count); |
| 207 | 203 |
| 208 protected: | 204 protected: |
| 209 const CallInterfaceDescriptorData* data() const { return data_; } | 205 const CallInterfaceDescriptorData* data() const { return data_; } |
| 210 | 206 |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } // namespace v8 | 923 } // namespace v8 |
| 928 | 924 |
| 929 | 925 |
| 930 #if V8_TARGET_ARCH_ARM64 | 926 #if V8_TARGET_ARCH_ARM64 |
| 931 #include "src/arm64/interface-descriptors-arm64.h" | 927 #include "src/arm64/interface-descriptors-arm64.h" |
| 932 #elif V8_TARGET_ARCH_ARM | 928 #elif V8_TARGET_ARCH_ARM |
| 933 #include "src/arm/interface-descriptors-arm.h" | 929 #include "src/arm/interface-descriptors-arm.h" |
| 934 #endif | 930 #endif |
| 935 | 931 |
| 936 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 932 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| OLD | NEW |