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 "src/assembler.h" | 8 #include "src/assembler.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 | 10 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 void InitializePlatformIndependent(FunctionType* function_type) { | 103 void InitializePlatformIndependent(FunctionType* function_type) { |
104 function_type_ = function_type; | 104 function_type_ = function_type; |
105 } | 105 } |
106 | 106 |
107 // TODO(mvstanton): Instead of taking parallel arrays register and | 107 // TODO(mvstanton): Instead of taking parallel arrays register and |
108 // param_representations, how about a struct that puts the representation | 108 // param_representations, how about a struct that puts the representation |
109 // and register side by side (eg, RegRep(r1, Representation::Tagged()). | 109 // and register side by side (eg, RegRep(r1, Representation::Tagged()). |
110 // The same should go for the CodeStubDescriptor class. | 110 // The same should go for the CodeStubDescriptor class. |
111 void InitializePlatformSpecific( | 111 void InitializePlatformSpecific( |
112 int register_parameter_count, Register* registers, | 112 int register_parameter_count, const Register* registers, |
113 PlatformInterfaceDescriptor* platform_descriptor = NULL); | 113 PlatformInterfaceDescriptor* platform_descriptor = NULL); |
114 | 114 |
115 bool IsInitialized() const { return register_param_count_ >= 0; } | 115 bool IsInitialized() const { return register_param_count_ >= 0; } |
116 | 116 |
117 int param_count() const { return function_type_->Arity(); } | 117 int param_count() const { return function_type_->Arity(); } |
118 int register_param_count() const { return register_param_count_; } | 118 int register_param_count() const { return register_param_count_; } |
119 Register register_param(int index) const { return register_params_[index]; } | 119 Register register_param(int index) const { return register_params_[index]; } |
120 Register* register_params() const { return register_params_.get(); } | 120 Register* register_params() const { return register_params_.get(); } |
121 Type* param_type(int index) const { return function_type_->Parameter(index); } | 121 Type* param_type(int index) const { return function_type_->Parameter(index); } |
122 PlatformInterfaceDescriptor* platform_specific_descriptor() const { | 122 PlatformInterfaceDescriptor* platform_specific_descriptor() const { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (!data()->IsInitialized()) { | 211 if (!data()->IsInitialized()) { |
212 CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key); | 212 CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key); |
213 DCHECK(d == data()); // d should be a modifiable pointer to data(). | 213 DCHECK(d == data()); // d should be a modifiable pointer to data(). |
214 InitializePlatformSpecific(d); | 214 InitializePlatformSpecific(d); |
215 FunctionType* function_type = BuildCallInterfaceDescriptorFunctionType( | 215 FunctionType* function_type = BuildCallInterfaceDescriptorFunctionType( |
216 isolate, d->register_param_count()); | 216 isolate, d->register_param_count()); |
217 d->InitializePlatformIndependent(function_type); | 217 d->InitializePlatformIndependent(function_type); |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
| 221 // Initializes |data| using the platform dependent default set of registers. |
| 222 // It is intended to be used for TurboFan stubs when particular set of |
| 223 // registers does not matter. |
| 224 static void DefaultInitializePlatformSpecific( |
| 225 CallInterfaceDescriptorData* data, int register_parameter_count); |
| 226 |
221 private: | 227 private: |
222 const CallInterfaceDescriptorData* data_; | 228 const CallInterfaceDescriptorData* data_; |
223 }; | 229 }; |
224 | 230 |
225 #define DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ | 231 #define DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ |
226 public: \ | 232 public: \ |
227 explicit name(Isolate* isolate) : base(isolate, key()) { \ | 233 explicit name(Isolate* isolate) : base(isolate, key()) { \ |
228 Initialize(isolate, key()); \ | 234 Initialize(isolate, key()); \ |
229 } \ | 235 } \ |
230 static inline CallDescriptors::Key key(); | 236 static inline CallDescriptors::Key key(); |
231 | 237 |
| 238 #define DECLARE_DEFAULT_DESCRIPTOR(name, base, parameter_count) \ |
| 239 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ |
| 240 protected: \ |
| 241 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \ |
| 242 override { \ |
| 243 DefaultInitializePlatformSpecific(data, parameter_count); \ |
| 244 } \ |
| 245 name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \ |
| 246 \ |
| 247 public: |
| 248 |
232 #define DECLARE_DESCRIPTOR(name, base) \ | 249 #define DECLARE_DESCRIPTOR(name, base) \ |
233 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ | 250 DECLARE_DESCRIPTOR_WITH_BASE(name, base) \ |
234 protected: \ | 251 protected: \ |
235 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \ | 252 void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \ |
236 name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \ | 253 name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \ |
237 \ | 254 \ |
238 public: | 255 public: |
239 | 256 |
240 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ | 257 #define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \ |
241 DECLARE_DESCRIPTOR(name, base) \ | 258 DECLARE_DESCRIPTOR(name, base) \ |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 434 |
418 DECLARE_DESCRIPTOR(TypeConversionDescriptor, CallInterfaceDescriptor) | 435 DECLARE_DESCRIPTOR(TypeConversionDescriptor, CallInterfaceDescriptor) |
419 | 436 |
420 static const Register ArgumentRegister(); | 437 static const Register ArgumentRegister(); |
421 }; | 438 }; |
422 | 439 |
423 class HasPropertyDescriptor final : public CallInterfaceDescriptor { | 440 class HasPropertyDescriptor final : public CallInterfaceDescriptor { |
424 public: | 441 public: |
425 enum ParameterIndices { kKeyIndex, kObjectIndex }; | 442 enum ParameterIndices { kKeyIndex, kObjectIndex }; |
426 | 443 |
427 DECLARE_DESCRIPTOR(HasPropertyDescriptor, CallInterfaceDescriptor) | 444 DECLARE_DEFAULT_DESCRIPTOR(HasPropertyDescriptor, CallInterfaceDescriptor, 2) |
428 | |
429 static const Register KeyRegister(); | |
430 static const Register ObjectRegister(); | |
431 }; | 445 }; |
432 | 446 |
433 class TypeofDescriptor : public CallInterfaceDescriptor { | 447 class TypeofDescriptor : public CallInterfaceDescriptor { |
434 public: | 448 public: |
435 DECLARE_DESCRIPTOR(TypeofDescriptor, CallInterfaceDescriptor) | 449 DECLARE_DESCRIPTOR(TypeofDescriptor, CallInterfaceDescriptor) |
436 }; | 450 }; |
437 | 451 |
438 | 452 |
439 class FastCloneRegExpDescriptor : public CallInterfaceDescriptor { | 453 class FastCloneRegExpDescriptor : public CallInterfaceDescriptor { |
440 public: | 454 public: |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 } // namespace v8 | 857 } // namespace v8 |
844 | 858 |
845 | 859 |
846 #if V8_TARGET_ARCH_ARM64 | 860 #if V8_TARGET_ARCH_ARM64 |
847 #include "src/arm64/interface-descriptors-arm64.h" | 861 #include "src/arm64/interface-descriptors-arm64.h" |
848 #elif V8_TARGET_ARCH_ARM | 862 #elif V8_TARGET_ARCH_ARM |
849 #include "src/arm/interface-descriptors-arm.h" | 863 #include "src/arm/interface-descriptors-arm.h" |
850 #endif | 864 #endif |
851 | 865 |
852 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 866 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
OLD | NEW |