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.
7 #if V8_TARGET_ARCH_MIPS
9 #include "src/interface-descriptors.h"
14 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
17 const Register LoadDescriptor::ReceiverRegister() { return a1; }
18 const Register LoadDescriptor::NameRegister() { return a2; }
21 const Register VectorLoadICTrampolineDescriptor::SlotRegister() { return a0; }
24 const Register VectorLoadICDescriptor::VectorRegister() { return a3; }
27 const Register StoreDescriptor::ReceiverRegister() { return a1; }
28 const Register StoreDescriptor::NameRegister() { return a2; }
29 const Register StoreDescriptor::ValueRegister() { return a0; }
32 const Register StoreTransitionDescriptor::MapRegister() { return a3; }
35 const Register ElementTransitionAndStoreDescriptor::MapRegister() { return a3; }
38 const Register InstanceofDescriptor::left() { return a0; }
39 const Register InstanceofDescriptor::right() { return a1; }
42 const Register ArgumentsAccessReadDescriptor::index() { return a1; }
43 const Register ArgumentsAccessReadDescriptor::parameter_count() { return a0; }
46 const Register ApiGetterDescriptor::function_address() { return a2; }
49 const Register MathPowTaggedDescriptor::exponent() { return a2; }
52 const Register MathPowIntegerDescriptor::exponent() {
53 return MathPowTaggedDescriptor::exponent();
57 void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
58 Register registers[] = {cp, a2};
59 data->Initialize(arraysize(registers), registers, NULL);
63 void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
64 Register registers[] = {cp, a1};
65 data->Initialize(arraysize(registers), registers, NULL);
69 void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
70 Register registers[] = {cp, a0};
71 data->Initialize(arraysize(registers), registers, NULL);
75 void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
76 Register registers[] = {cp, a0};
77 data->Initialize(arraysize(registers), registers, NULL);
81 void FastCloneShallowArrayDescriptor::Initialize(
82 CallInterfaceDescriptorData* data) {
83 Register registers[] = {cp, a3, a2, a1};
84 Representation representations[] = {
85 Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
86 Representation::Tagged()};
87 data->Initialize(arraysize(registers), registers, representations);
91 void FastCloneShallowObjectDescriptor::Initialize(
92 CallInterfaceDescriptorData* data) {
93 Register registers[] = {cp, a3, a2, a1, a0};
94 data->Initialize(arraysize(registers), registers, NULL);
98 void CreateAllocationSiteDescriptor::Initialize(
99 CallInterfaceDescriptorData* data) {
100 Register registers[] = {cp, a2, a3};
101 Representation representations[] = {Representation::Tagged(),
102 Representation::Tagged(),
103 Representation::Smi()};
104 data->Initialize(arraysize(registers), registers, representations);
108 void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
109 Register registers[] = {cp, a2, a3, a1};
110 Representation representations[] = {
111 Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
112 Representation::Tagged()};
113 data->Initialize(arraysize(registers), registers, representations);
117 void StoreArrayLiteralElementDescriptor::Initialize(
118 CallInterfaceDescriptorData* data) {
119 Register registers[] = {cp, a3, a0};
120 data->Initialize(arraysize(registers), registers, NULL);
124 void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
125 Register registers[] = {cp, a1};
126 data->Initialize(arraysize(registers), registers, NULL);
130 void CallFunctionWithFeedbackDescriptor::Initialize(
131 CallInterfaceDescriptorData* data) {
132 Register registers[] = {cp, a1, a3};
133 Representation representations[] = {Representation::Tagged(),
134 Representation::Tagged(),
135 Representation::Smi()};
136 data->Initialize(arraysize(registers), registers, representations);
140 void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
141 CallInterfaceDescriptorData* data) {
142 Register registers[] = {cp, a1, a3, a2};
143 Representation representations[] = {
144 Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
145 Representation::Tagged()};
146 data->Initialize(arraysize(registers), registers, representations);
150 void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
151 // a0 : number of arguments
152 // a1 : the function to call
153 // a2 : feedback vector
154 // a3 : (only if a2 is not the megamorphic symbol) slot in feedback
156 // TODO(turbofan): So far we don't gather type feedback and hence skip the
157 // slot parameter, but ArrayConstructStub needs the vector to be undefined.
158 Register registers[] = {cp, a0, a1, a2};
159 data->Initialize(arraysize(registers), registers, NULL);
163 void RegExpConstructResultDescriptor::Initialize(
164 CallInterfaceDescriptorData* data) {
165 Register registers[] = {cp, a2, a1, a0};
166 data->Initialize(arraysize(registers), registers, NULL);
170 void TransitionElementsKindDescriptor::Initialize(
171 CallInterfaceDescriptorData* data) {
172 Register registers[] = {cp, a0, a1};
173 data->Initialize(arraysize(registers), registers, NULL);
177 void AllocateHeapNumberDescriptor::Initialize(
178 CallInterfaceDescriptorData* data) {
181 Register registers[] = {cp};
182 data->Initialize(arraysize(registers), registers, nullptr);
186 void ArrayConstructorConstantArgCountDescriptor::Initialize(
187 CallInterfaceDescriptorData* data) {
190 // a0 -- number of arguments
192 // a2 -- allocation site with elements kind
193 Register registers[] = {cp, a1, a2};
194 data->Initialize(arraysize(registers), registers, NULL);
198 void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
199 // stack param count needs (constructor pointer, and single argument)
200 Register registers[] = {cp, a1, a2, a0};
201 Representation representations[] = {
202 Representation::Tagged(), Representation::Tagged(),
203 Representation::Tagged(), Representation::Integer32()};
204 data->Initialize(arraysize(registers), registers, representations);
208 void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
209 CallInterfaceDescriptorData* data) {
212 // a0 -- number of arguments
213 // a1 -- constructor function
214 Register registers[] = {cp, a1};
215 data->Initialize(arraysize(registers), registers, NULL);
219 void InternalArrayConstructorDescriptor::Initialize(
220 CallInterfaceDescriptorData* data) {
221 // stack param count needs (constructor pointer, and single argument)
222 Register registers[] = {cp, a1, a0};
223 Representation representations[] = {Representation::Tagged(),
224 Representation::Tagged(),
225 Representation::Integer32()};
226 data->Initialize(arraysize(registers), registers, representations);
230 void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
231 Register registers[] = {cp, a1, a0};
232 data->Initialize(arraysize(registers), registers, NULL);
236 void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
237 Register registers[] = {cp, a0};
238 data->Initialize(arraysize(registers), registers, NULL);
242 void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
243 Register registers[] = {cp, a0};
244 data->Initialize(arraysize(registers), registers, NULL);
248 void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
249 Register registers[] = {cp, a1, a0};
250 data->Initialize(arraysize(registers), registers, NULL);
254 void BinaryOpWithAllocationSiteDescriptor::Initialize(
255 CallInterfaceDescriptorData* data) {
256 Register registers[] = {cp, a2, a1, a0};
257 data->Initialize(arraysize(registers), registers, NULL);
261 void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
262 Register registers[] = {cp, a1, a0};
263 data->Initialize(arraysize(registers), registers, NULL);
267 void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
268 Register registers[] = {
272 Representation representations[] = {
273 Representation::Tagged(), // context
274 Representation::Tagged(), // key
276 data->Initialize(arraysize(registers), registers, representations);
280 void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
281 Register registers[] = {
285 Representation representations[] = {
286 Representation::Tagged(), // context
287 Representation::Tagged(), // name
289 data->Initialize(arraysize(registers), registers, representations);
293 void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
294 Register registers[] = {
298 Representation representations[] = {
299 Representation::Tagged(), // context
300 Representation::Tagged(), // receiver
302 data->Initialize(arraysize(registers), registers, representations);
306 void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
307 Register registers[] = {
310 a0, // actual number of arguments
311 a2, // expected number of arguments
313 Representation representations[] = {
314 Representation::Tagged(), // context
315 Representation::Tagged(), // JSFunction
316 Representation::Integer32(), // actual number of arguments
317 Representation::Integer32(), // expected number of arguments
319 data->Initialize(arraysize(registers), registers, representations);
323 void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
324 Register registers[] = {
329 a1, // api_function_address
330 a3, // actual number of arguments
332 Representation representations[] = {
333 Representation::Tagged(), // context
334 Representation::Tagged(), // callee
335 Representation::Tagged(), // call_data
336 Representation::Tagged(), // holder
337 Representation::External(), // api_function_address
338 Representation::Integer32(), // actual number of arguments
340 data->Initialize(arraysize(registers), registers, representations);
344 void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
345 Register registers[] = {
350 a1, // api_function_address
352 Representation representations[] = {
353 Representation::Tagged(), // context
354 Representation::Tagged(), // callee
355 Representation::Tagged(), // call_data
356 Representation::Tagged(), // holder
357 Representation::External(), // api_function_address
359 data->Initialize(arraysize(registers), registers, representations);
362 } // namespace v8::internal
364 #endif // V8_TARGET_ARCH_MIPS