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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 | 98 |
99 class CallDescriptors { | 99 class CallDescriptors { |
100 public: | 100 public: |
101 enum Key { | 101 enum Key { |
102 #define DEF_ENUM(name) name, | 102 #define DEF_ENUM(name) name, |
103 INTERFACE_DESCRIPTOR_LIST(DEF_ENUM) | 103 INTERFACE_DESCRIPTOR_LIST(DEF_ENUM) |
104 #undef DEF_ENUM | 104 #undef DEF_ENUM |
105 NUMBER_OF_DESCRIPTORS | 105 NUMBER_OF_DESCRIPTORS |
106 }; | 106 }; |
107 | |
108 static void InitializeForIsolate(Isolate* isolate); | |
109 }; | 107 }; |
110 | 108 |
111 | 109 |
112 class CallInterfaceDescriptor { | 110 class CallInterfaceDescriptor { |
113 public: | 111 public: |
114 CallInterfaceDescriptor() : data_(NULL) {} | 112 CallInterfaceDescriptor() : data_(NULL) {} |
115 | 113 |
116 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) | 114 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) |
117 : data_(isolate->call_descriptor_data(key)) {} | 115 : data_(isolate->call_descriptor_data(key)) {} |
118 | 116 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Some platforms have extra information to associate with the descriptor. | 154 // Some platforms have extra information to associate with the descriptor. |
157 PlatformInterfaceDescriptor* platform_specific_descriptor() const { | 155 PlatformInterfaceDescriptor* platform_specific_descriptor() const { |
158 return data()->platform_specific_descriptor(); | 156 return data()->platform_specific_descriptor(); |
159 } | 157 } |
160 | 158 |
161 static const Register ContextRegister(); | 159 static const Register ContextRegister(); |
162 | 160 |
163 protected: | 161 protected: |
164 const CallInterfaceDescriptorData* data() const { return data_; } | 162 const CallInterfaceDescriptorData* data() const { return data_; } |
165 | 163 |
166 static void InitializeData( | |
167 Isolate* isolate, CallDescriptors::Key key, int register_parameter_count, | |
168 Register* registers, Representation* param_representations, | |
169 PlatformInterfaceDescriptor* platform_descriptor = NULL) { | |
170 isolate->call_descriptor_data(key) | |
171 ->Initialize(register_parameter_count, registers, param_representations, | |
172 platform_descriptor); | |
173 } | |
174 | |
175 private: | 164 private: |
176 const CallInterfaceDescriptorData* data_; | 165 const CallInterfaceDescriptorData* data_; |
177 }; | 166 }; |
178 | 167 |
179 | 168 |
180 #define DECLARE_DESCRIPTOR(name) \ | 169 #define DECLARE_DESCRIPTOR(name) \ |
181 explicit name(Isolate* isolate) : CallInterfaceDescriptor(isolate, key()) {} \ | 170 explicit name(Isolate* isolate) : CallInterfaceDescriptor(isolate, key()) { \ |
182 static inline CallDescriptors::Key key(); \ | 171 if (!data()->IsInitialized()) \ |
183 static void Initialize(Isolate* isolate); | 172 Initialize(isolate->call_descriptor_data(key())); \ |
| 173 } \ |
| 174 static inline CallDescriptors::Key key(); \ |
| 175 void Initialize(CallInterfaceDescriptorData* data); |
184 | 176 |
185 | 177 |
186 class LoadDescriptor : public CallInterfaceDescriptor { | 178 class LoadDescriptor : public CallInterfaceDescriptor { |
187 public: | 179 public: |
188 DECLARE_DESCRIPTOR(LoadDescriptor) | 180 DECLARE_DESCRIPTOR(LoadDescriptor) |
189 | 181 |
190 enum ParameterIndices { kReceiverIndex, kNameIndex }; | 182 enum ParameterIndices { kReceiverIndex, kNameIndex }; |
191 static const Register ReceiverRegister(); | 183 static const Register ReceiverRegister(); |
192 static const Register NameRegister(); | 184 static const Register NameRegister(); |
193 }; | 185 }; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } // namespace v8::internal | 405 } // namespace v8::internal |
414 | 406 |
415 | 407 |
416 #if V8_TARGET_ARCH_ARM64 | 408 #if V8_TARGET_ARCH_ARM64 |
417 #include "src/arm64/interface-descriptors-arm64.h" | 409 #include "src/arm64/interface-descriptors-arm64.h" |
418 #elif V8_TARGET_ARCH_ARM | 410 #elif V8_TARGET_ARCH_ARM |
419 #include "src/arm/interface-descriptors-arm.h" | 411 #include "src/arm/interface-descriptors-arm.h" |
420 #endif | 412 #endif |
421 | 413 |
422 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 414 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
OLD | NEW |