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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 class CallInterfaceDescriptorData { | 49 class CallInterfaceDescriptorData { |
50 public: | 50 public: |
51 CallInterfaceDescriptorData() : register_param_count_(-1) {} | 51 CallInterfaceDescriptorData() : register_param_count_(-1) {} |
52 | 52 |
53 // A copy of the passed in registers and param_representations is made | 53 // A copy of the passed in registers and param_representations is made |
54 // and owned by the CallInterfaceDescriptorData. | 54 // and owned by the CallInterfaceDescriptorData. |
55 | 55 |
56 // TODO(mvstanton): Instead of taking parallel arrays register and | 56 // TODO(mvstanton): Instead of taking parallel arrays register and |
57 // param_representations, how about a struct that puts the representation | 57 // param_representations, how about a struct that puts the representation |
58 // and register side by side (eg, RegRep(r1, Representation::Tagged()). | 58 // and register side by side (eg, RegRep(r1, Representation::Tagged()). |
59 // The same should go for the CodeStubInterfaceDescriptor class. | 59 // The same should go for the CodeStubDescriptor class. |
60 void Initialize(int register_parameter_count, Register* registers, | 60 void Initialize(int register_parameter_count, Register* registers, |
61 Representation* param_representations, | 61 Representation* param_representations, |
62 PlatformInterfaceDescriptor* platform_descriptor = NULL); | 62 PlatformInterfaceDescriptor* platform_descriptor = NULL); |
63 | 63 |
64 bool IsInitialized() const { return register_param_count_ >= 0; } | 64 bool IsInitialized() const { return register_param_count_ >= 0; } |
65 | 65 |
66 int register_param_count() const { return register_param_count_; } | 66 int register_param_count() const { return register_param_count_; } |
67 Register register_param(int index) const { return register_params_[index]; } | 67 Register register_param(int index) const { return register_params_[index]; } |
68 Register* register_params() const { return register_params_.get(); } | 68 Register* register_params() const { return register_params_.get(); } |
69 Representation register_param_representation(int index) const { | 69 Representation register_param_representation(int index) const { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 }; | 107 }; |
108 | 108 |
109 | 109 |
110 class CallInterfaceDescriptor { | 110 class CallInterfaceDescriptor { |
111 public: | 111 public: |
112 CallInterfaceDescriptor() : data_(NULL) {} | 112 CallInterfaceDescriptor() : data_(NULL) {} |
113 | 113 |
114 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) | 114 CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key) |
115 : data_(isolate->call_descriptor_data(key)) {} | 115 : data_(isolate->call_descriptor_data(key)) {} |
116 | 116 |
117 bool IsInitialized() const { | |
118 return data() != NULL && data()->IsInitialized(); | |
119 } | |
120 | |
121 int GetEnvironmentLength() const { return data()->register_param_count(); } | 117 int GetEnvironmentLength() const { return data()->register_param_count(); } |
122 | 118 |
123 int GetRegisterParameterCount() const { | 119 int GetRegisterParameterCount() const { |
124 return data()->register_param_count(); | 120 return data()->register_param_count(); |
125 } | 121 } |
126 | 122 |
127 Register GetParameterRegister(int index) const { | 123 Register GetParameterRegister(int index) const { |
128 return data()->register_param(index); | 124 return data()->register_param(index); |
129 } | 125 } |
130 | 126 |
(...skipping 20 matching lines...) Expand all Loading... |
151 return GetParameterRepresentation(index + 1); | 147 return GetParameterRepresentation(index + 1); |
152 } | 148 } |
153 | 149 |
154 // Some platforms have extra information to associate with the descriptor. | 150 // Some platforms have extra information to associate with the descriptor. |
155 PlatformInterfaceDescriptor* platform_specific_descriptor() const { | 151 PlatformInterfaceDescriptor* platform_specific_descriptor() const { |
156 return data()->platform_specific_descriptor(); | 152 return data()->platform_specific_descriptor(); |
157 } | 153 } |
158 | 154 |
159 static const Register ContextRegister(); | 155 static const Register ContextRegister(); |
160 | 156 |
| 157 const char* DebugName(Isolate* isolate); |
| 158 |
161 protected: | 159 protected: |
162 const CallInterfaceDescriptorData* data() const { return data_; } | 160 const CallInterfaceDescriptorData* data() const { return data_; } |
163 | 161 |
164 private: | 162 private: |
165 const CallInterfaceDescriptorData* data_; | 163 const CallInterfaceDescriptorData* data_; |
166 }; | 164 }; |
167 | 165 |
168 | 166 |
169 #define DECLARE_DESCRIPTOR(name) \ | 167 #define DECLARE_DESCRIPTOR(name) \ |
170 explicit name(Isolate* isolate) : CallInterfaceDescriptor(isolate, key()) { \ | 168 explicit name(Isolate* isolate) : CallInterfaceDescriptor(isolate, key()) { \ |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } // namespace v8::internal | 403 } // namespace v8::internal |
406 | 404 |
407 | 405 |
408 #if V8_TARGET_ARCH_ARM64 | 406 #if V8_TARGET_ARCH_ARM64 |
409 #include "src/arm64/interface-descriptors-arm64.h" | 407 #include "src/arm64/interface-descriptors-arm64.h" |
410 #elif V8_TARGET_ARCH_ARM | 408 #elif V8_TARGET_ARCH_ARM |
411 #include "src/arm/interface-descriptors-arm.h" | 409 #include "src/arm/interface-descriptors-arm.h" |
412 #endif | 410 #endif |
413 | 411 |
414 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ | 412 #endif // V8_CALL_INTERFACE_DESCRIPTOR_H_ |
OLD | NEW |