1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
9 #include "src/interface-descriptors.h"
14 const Register CallInterfaceDescriptor::ContextRegister() { return esi; }
17 const Register LoadDescriptor::ReceiverRegister() { return edx; }
18 const Register LoadDescriptor::NameRegister() { return ecx; }
21 const Register VectorLoadICTrampolineDescriptor::SlotRegister() { return eax; }
24 const Register VectorLoadICDescriptor::VectorRegister() { return ebx; }
27 const Register StoreDescriptor::ReceiverRegister() { return edx; }
28 const Register StoreDescriptor::NameRegister() { return ecx; }
29 const Register StoreDescriptor::ValueRegister() { return eax; }
32 const Register StoreTransitionDescriptor::MapRegister() { return ebx; }
35 const Register ElementTransitionAndStoreDescriptor::MapRegister() {
40 const Register InstanceofDescriptor::left() { return eax; }
41 const Register InstanceofDescriptor::right() { return edx; }
44 const Register ArgumentsAccessReadDescriptor::index() { return edx; }
45 const Register ArgumentsAccessReadDescriptor::parameter_count() { return eax; }
48 const Register ApiGetterDescriptor::function_address() { return edx; }
51 const Register MathPowTaggedDescriptor::exponent() { return eax; }
54 const Register MathPowIntegerDescriptor::exponent() {
55 return MathPowTaggedDescriptor::exponent();
59 void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
60 Register registers[] = {esi, ebx};
61 data->Initialize(arraysize(registers), registers, NULL);
65 void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
66 Register registers[] = {esi, edi};
67 data->Initialize(arraysize(registers), registers, NULL);
71 void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
72 // ToNumberStub invokes a function, and therefore needs a context.
73 Register registers[] = {esi, eax};
74 data->Initialize(arraysize(registers), registers, NULL);
78 void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
79 Register registers[] = {esi, eax};
80 data->Initialize(arraysize(registers), registers, NULL);
84 void FastCloneShallowArrayDescriptor::Initialize(
85 CallInterfaceDescriptorData* data) {
86 Register registers[] = {esi, eax, ebx, ecx};
87 Representation representations[] = {
88 Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
89 Representation::Tagged()};
90 data->Initialize(arraysize(registers), registers, representations);
94 void FastCloneShallowObjectDescriptor::Initialize(
95 CallInterfaceDescriptorData* data) {
96 Register registers[] = {esi, eax, ebx, ecx, edx};
97 data->Initialize(arraysize(registers), registers, NULL);
101 void CreateAllocationSiteDescriptor::Initialize(
102 CallInterfaceDescriptorData* data) {
103 Register registers[] = {esi, ebx, edx};
104 Representation representations[] = {Representation::Tagged(),
105 Representation::Tagged(),
106 Representation::Smi()};
107 data->Initialize(arraysize(registers), registers, representations);
111 void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
112 Register registers[] = {esi, ebx, edx, edi};
113 Representation representations[] = {
114 Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
115 Representation::Tagged()};
116 data->Initialize(arraysize(registers), registers, representations);
120 void StoreArrayLiteralElementDescriptor::Initialize(
121 CallInterfaceDescriptorData* data) {
122 Register registers[] = {esi, ecx, eax};
123 data->Initialize(arraysize(registers), registers, NULL);
127 void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
128 Register registers[] = {esi, edi};
129 data->Initialize(arraysize(registers), registers, NULL);
133 void CallFunctionWithFeedbackDescriptor::Initialize(
134 CallInterfaceDescriptorData* data) {
135 Register registers[] = {esi, edi, edx};
136 Representation representations[] = {Representation::Tagged(),
137 Representation::Tagged(),
138 Representation::Smi()};
139 data->Initialize(arraysize(registers), registers, representations);
143 void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
144 CallInterfaceDescriptorData* data) {
145 Register registers[] = {esi, edi, edx, ebx};
146 Representation representations[] = {
147 Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
148 Representation::Tagged()};
149 data->Initialize(arraysize(registers), registers, representations);
153 void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
154 // eax : number of arguments
155 // ebx : feedback vector
156 // edx : (only if ebx is not the megamorphic symbol) slot in feedback
158 // edi : constructor function
159 // TODO(turbofan): So far we don't gather type feedback and hence skip the
160 // slot parameter, but ArrayConstructStub needs the vector to be undefined.
161 Register registers[] = {esi, eax, edi, ebx};
162 data->Initialize(arraysize(registers), registers, NULL);
166 void RegExpConstructResultDescriptor::Initialize(
167 CallInterfaceDescriptorData* data) {
168 Register registers[] = {esi, ecx, ebx, eax};
169 data->Initialize(arraysize(registers), registers, NULL);
173 void TransitionElementsKindDescriptor::Initialize(
174 CallInterfaceDescriptorData* data) {
175 Register registers[] = {esi, eax, ebx};
176 data->Initialize(arraysize(registers), registers, NULL);
180 void AllocateHeapNumberDescriptor::Initialize(
181 CallInterfaceDescriptorData* data) {
184 Register registers[] = {esi};
185 data->Initialize(arraysize(registers), registers, nullptr);
189 void ArrayConstructorConstantArgCountDescriptor::Initialize(
190 CallInterfaceDescriptorData* data) {
192 // eax -- number of arguments
194 // ebx -- allocation site with elements kind
195 Register registers[] = {esi, edi, ebx};
196 data->Initialize(arraysize(registers), registers, NULL);
200 void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
201 // stack param count needs (constructor pointer, and single argument)
202 Register registers[] = {esi, edi, ebx, eax};
203 Representation representations[] = {
204 Representation::Tagged(), Representation::Tagged(),
205 Representation::Tagged(), Representation::Integer32()};
206 data->Initialize(arraysize(registers), registers, representations);
210 void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
211 CallInterfaceDescriptorData* data) {
213 // eax -- number of arguments
215 Register registers[] = {esi, edi};
216 data->Initialize(arraysize(registers), registers, NULL);
220 void InternalArrayConstructorDescriptor::Initialize(
221 CallInterfaceDescriptorData* data) {
222 // stack param count needs (constructor pointer, and single argument)
223 Register registers[] = {esi, edi, eax};
224 Representation representations[] = {Representation::Tagged(),
225 Representation::Tagged(),
226 Representation::Integer32()};
227 data->Initialize(arraysize(registers), registers, representations);
231 void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
232 Register registers[] = {esi, eax};
233 data->Initialize(arraysize(registers), registers, NULL);
237 void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
238 Register registers[] = {esi, eax};
239 data->Initialize(arraysize(registers), registers, NULL);
243 void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
244 Register registers[] = {esi, edx, eax};
245 data->Initialize(arraysize(registers), registers, NULL);
249 void BinaryOpWithAllocationSiteDescriptor::Initialize(
250 CallInterfaceDescriptorData* data) {
251 Register registers[] = {esi, ecx, edx, eax};
252 data->Initialize(arraysize(registers), registers, NULL);
256 void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
257 Register registers[] = {esi, edx, eax};
258 data->Initialize(arraysize(registers), registers, NULL);
262 void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
263 Register registers[] = {
267 Representation representations[] = {
268 Representation::Tagged(), // context
269 Representation::Tagged(), // key
271 data->Initialize(arraysize(registers), registers, representations);
275 void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
276 Register registers[] = {
280 Representation representations[] = {
281 Representation::Tagged(), // context
282 Representation::Tagged(), // name
284 data->Initialize(arraysize(registers), registers, representations);
288 void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
289 Register registers[] = {
293 Representation representations[] = {
294 Representation::Tagged(), // context
295 Representation::Tagged(), // receiver
297 data->Initialize(arraysize(registers), registers, representations);
301 void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
302 Register registers[] = {
305 eax, // actual number of arguments
306 ebx, // expected number of arguments
308 Representation representations[] = {
309 Representation::Tagged(), // context
310 Representation::Tagged(), // JSFunction
311 Representation::Integer32(), // actual number of arguments
312 Representation::Integer32(), // expected number of arguments
314 data->Initialize(arraysize(registers), registers, representations);
318 void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
319 Register registers[] = {
324 edx, // api_function_address
325 eax, // actual number of arguments
327 Representation representations[] = {
328 Representation::Tagged(), // context
329 Representation::Tagged(), // callee
330 Representation::Tagged(), // call_data
331 Representation::Tagged(), // holder
332 Representation::External(), // api_function_address
333 Representation::Integer32(), // actual number of arguments
335 data->Initialize(arraysize(registers), registers, representations);
339 void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
340 Register registers[] = {
345 edx, // api_function_address
347 Representation representations[] = {
348 Representation::Tagged(), // context
349 Representation::Tagged(), // callee
350 Representation::Tagged(), // call_data
351 Representation::Tagged(), // holder
352 Representation::External(), // api_function_address
354 data->Initialize(arraysize(registers), registers, representations);
357 } // namespace v8::internal
359 #endif // V8_TARGET_ARCH_X87