| 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 |
| 11 namespace v8 { | 11 namespace v8 { |
| 12 namespace internal { | 12 namespace internal { |
| 13 | 13 |
| 14 class PlatformInterfaceDescriptor; | 14 class PlatformInterfaceDescriptor; |
| 15 | 15 |
| 16 class InterfaceDescriptor { | 16 class CallInterfaceDescriptor { |
| 17 public: | 17 public: |
| 18 CallInterfaceDescriptor() : register_param_count_(-1) {} |
| 19 |
| 20 // A copy of the passed in registers and param_representations is made |
| 21 // and owned by the CallInterfaceDescriptor. |
| 22 |
| 23 // TODO(mvstanton): Instead of taking parallel arrays register and |
| 24 // param_representations, how about a struct that puts the representation |
| 25 // and register side by side (eg, RegRep(r1, Representation::Tagged()). |
| 26 // The same should go for the CodeStubInterfaceDescriptor class. |
| 27 void Initialize(int register_parameter_count, Register* registers, |
| 28 Representation* param_representations, |
| 29 PlatformInterfaceDescriptor* platform_descriptor = NULL); |
| 30 |
| 18 bool IsInitialized() const { return register_param_count_ >= 0; } | 31 bool IsInitialized() const { return register_param_count_ >= 0; } |
| 19 | 32 |
| 20 int GetEnvironmentLength() const { return register_param_count_; } | 33 int GetEnvironmentLength() const { return register_param_count_; } |
| 21 | 34 |
| 22 int GetRegisterParameterCount() const { return register_param_count_; } | 35 int GetRegisterParameterCount() const { return register_param_count_; } |
| 23 | 36 |
| 24 Register GetParameterRegister(int index) const { | 37 Register GetParameterRegister(int index) const { |
| 25 return register_params_[index]; | 38 return register_params_[index]; |
| 26 } | 39 } |
| 27 | 40 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 48 return GetParameterRepresentation(index + 1); | 61 return GetParameterRepresentation(index + 1); |
| 49 } | 62 } |
| 50 | 63 |
| 51 // Some platforms have extra information to associate with the descriptor. | 64 // Some platforms have extra information to associate with the descriptor. |
| 52 PlatformInterfaceDescriptor* platform_specific_descriptor() const { | 65 PlatformInterfaceDescriptor* platform_specific_descriptor() const { |
| 53 return platform_specific_descriptor_; | 66 return platform_specific_descriptor_; |
| 54 } | 67 } |
| 55 | 68 |
| 56 static const Register ContextRegister(); | 69 static const Register ContextRegister(); |
| 57 | 70 |
| 58 protected: | |
| 59 InterfaceDescriptor(); | |
| 60 virtual ~InterfaceDescriptor() {} | |
| 61 | |
| 62 void Initialize(int register_parameter_count, Register* registers, | |
| 63 Representation* register_param_representations, | |
| 64 PlatformInterfaceDescriptor* platform_descriptor = NULL); | |
| 65 | |
| 66 private: | 71 private: |
| 67 int register_param_count_; | 72 int register_param_count_; |
| 68 | 73 |
| 69 // The Register params are allocated dynamically by the | 74 // The Register params are allocated dynamically by the |
| 70 // InterfaceDescriptor, and freed on destruction. This is because static | 75 // InterfaceDescriptor, and freed on destruction. This is because static |
| 71 // arrays of Registers cause creation of runtime static initializers | 76 // arrays of Registers cause creation of runtime static initializers |
| 72 // which we don't want. | 77 // which we don't want. |
| 73 SmartArrayPointer<Register> register_params_; | 78 SmartArrayPointer<Register> register_params_; |
| 74 // Specifies Representations for the stub's parameter. Points to an array of | 79 // Specifies Representations for the stub's parameter. Points to an array of |
| 75 // Representations of the same length of the numbers of parameters to the | 80 // Representations of the same length of the numbers of parameters to the |
| 76 // stub, or if NULL (the default value), Representation of each parameter | 81 // stub, or if NULL (the default value), Representation of each parameter |
| 77 // assumed to be Tagged(). | 82 // assumed to be Tagged(). |
| 78 SmartArrayPointer<Representation> register_param_representations_; | 83 SmartArrayPointer<Representation> register_param_representations_; |
| 79 | 84 |
| 80 PlatformInterfaceDescriptor* platform_specific_descriptor_; | 85 PlatformInterfaceDescriptor* platform_specific_descriptor_; |
| 81 | 86 |
| 82 DISALLOW_COPY_AND_ASSIGN(InterfaceDescriptor); | 87 DISALLOW_COPY_AND_ASSIGN(CallInterfaceDescriptor); |
| 83 }; | 88 }; |
| 84 | 89 |
| 85 | 90 |
| 86 enum CallDescriptorKey { | 91 enum CallDescriptorKey { |
| 87 LoadICCall, | 92 LoadICCall, |
| 88 StoreICCall, | 93 StoreICCall, |
| 89 ElementTransitionAndStoreCall, | 94 ElementTransitionAndStoreCall, |
| 90 InstanceofCall, | 95 InstanceofCall, |
| 91 VectorLoadICCall, | 96 VectorLoadICCall, |
| 92 FastNewClosureCall, | 97 FastNewClosureCall, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 StringAddCall, | 116 StringAddCall, |
| 112 KeyedCall, | 117 KeyedCall, |
| 113 NamedCall, | 118 NamedCall, |
| 114 CallHandler, | 119 CallHandler, |
| 115 ArgumentAdaptorCall, | 120 ArgumentAdaptorCall, |
| 116 ApiFunctionCall, | 121 ApiFunctionCall, |
| 117 NUMBER_OF_CALL_DESCRIPTORS | 122 NUMBER_OF_CALL_DESCRIPTORS |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 | 125 |
| 121 class CallInterfaceDescriptor : public InterfaceDescriptor { | |
| 122 public: | |
| 123 CallInterfaceDescriptor() {} | |
| 124 | |
| 125 // A copy of the passed in registers and param_representations is made | |
| 126 // and owned by the CallInterfaceDescriptor. | |
| 127 | |
| 128 // TODO(mvstanton): Instead of taking parallel arrays register and | |
| 129 // param_representations, how about a struct that puts the representation | |
| 130 // and register side by side (eg, RegRep(r1, Representation::Tagged()). | |
| 131 // The same should go for the CodeStubInterfaceDescriptor class. | |
| 132 void Initialize(int register_parameter_count, Register* registers, | |
| 133 Representation* param_representations, | |
| 134 PlatformInterfaceDescriptor* platform_descriptor = NULL); | |
| 135 }; | |
| 136 | |
| 137 | |
| 138 class CallDescriptors { | 126 class CallDescriptors { |
| 139 public: | 127 public: |
| 140 static void InitializeForIsolate(Isolate* isolate); | 128 static void InitializeForIsolate(Isolate* isolate); |
| 141 | 129 |
| 142 private: | 130 private: |
| 143 static void InitializeForIsolateAllPlatforms(Isolate* isolate); | 131 static void InitializeForIsolateAllPlatforms(Isolate* isolate); |
| 144 }; | 132 }; |
| 145 } | 133 } |
| 146 } // namespace v8::internal | 134 } // namespace v8::internal |
| 147 | 135 |
| 148 #if V8_TARGET_ARCH_ARM64 | 136 #if V8_TARGET_ARCH_ARM64 |
| 149 #include "src/arm64/interface-descriptors-arm64.h" | 137 #include "src/arm64/interface-descriptors-arm64.h" |
| 150 #elif V8_TARGET_ARCH_ARM | 138 #elif V8_TARGET_ARCH_ARM |
| 151 #include "src/arm/interface-descriptors-arm.h" | 139 #include "src/arm/interface-descriptors-arm.h" |
| 152 #endif | 140 #endif |
| 153 | 141 |
| 154 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 142 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
| OLD | NEW |