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
3 // found in the LICENSE file.
9 #include "src/interface-descriptors.h"
14 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
17 const Register LoadDescriptor::ReceiverRegister() { return r4; }
18 const Register LoadDescriptor::NameRegister() { return r5; }
21 const Register VectorLoadICTrampolineDescriptor::SlotRegister() { return r3; }
24 const Register VectorLoadICDescriptor::VectorRegister() { return r6; }
27 const Register StoreDescriptor::ReceiverRegister() { return r4; }
28 const Register StoreDescriptor::NameRegister() { return r5; }
29 const Register StoreDescriptor::ValueRegister() { return r3; }
32 const Register StoreTransitionDescriptor::MapRegister() { return r6; }
35 const Register ElementTransitionAndStoreDescriptor::MapRegister() { return r6; }
38 const Register InstanceofDescriptor::left() { return r3; }
39 const Register InstanceofDescriptor::right() { return r4; }
42 const Register ArgumentsAccessReadDescriptor::index() { return r4; }
43 const Register ArgumentsAccessReadDescriptor::parameter_count() { return r3; }
46 const Register ApiGetterDescriptor::function_address() { return r5; }
49 const Register MathPowTaggedDescriptor::exponent() { return r5; }
52 const Register MathPowIntegerDescriptor::exponent() {
53 return MathPowTaggedDescriptor::exponent();
57 void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
58 Register registers[] = {cp, r5};
59 data->Initialize(arraysize(registers), registers, NULL);
63 void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
64 Register registers[] = {cp, r4};
65 data->Initialize(arraysize(registers), registers, NULL);
69 void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
70 Register registers[] = {cp, r3};
71 data->Initialize(arraysize(registers), registers, NULL);
75 void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
76 Register registers[] = {cp, r3};
77 data->Initialize(arraysize(registers), registers, NULL);
81 void FastCloneShallowArrayDescriptor::Initialize(
82 CallInterfaceDescriptorData* data) {
83 Register registers[] = {cp, r6, r5, r4};
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, r6, r5, r4, r3};
94 data->Initialize(arraysize(registers), registers, NULL);
98 void CreateAllocationSiteDescriptor::Initialize(
99 CallInterfaceDescriptorData* data) {
100 Register registers[] = {cp, r5, r6};
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, r5, r6, r4};
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, r6, r3};
120 data->Initialize(arraysize(registers), registers, NULL);
124 void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
125 Register registers[] = {cp, r4};
126 data->Initialize(arraysize(registers), registers, NULL);
130 void CallFunctionWithFeedbackDescriptor::Initialize(
131 CallInterfaceDescriptorData* data) {
132 Register registers[] = {cp, r4, r6};
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, r4, r6, r5};
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 // r3 : number of arguments
152 // r4 : the function to call
153 // r5 : feedback vector
154 // r6 : (only if r5 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, r3, r4, r5};
159 data->Initialize(arraysize(registers), registers, NULL);
163 void RegExpConstructResultDescriptor::Initialize(
164 CallInterfaceDescriptorData* data) {
165 Register registers[] = {cp, r5, r4, r3};
166 data->Initialize(arraysize(registers), registers, NULL);
170 void TransitionElementsKindDescriptor::Initialize(
171 CallInterfaceDescriptorData* data) {
172 Register registers[] = {cp, r3, r4};
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 // r3 -- number of arguments
192 // r5 -- allocation site with elements kind
193 Register registers[] = {cp, r4, r5};
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, r4, r5, r3};
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 // r3 -- number of arguments
213 // r4 -- constructor function
214 Register registers[] = {cp, r4};
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, r4, r3};
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, r4, r3};
232 data->Initialize(arraysize(registers), registers, NULL);
236 void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
237 Register registers[] = {cp, r3};
238 data->Initialize(arraysize(registers), registers, NULL);
242 void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
243 Register registers[] = {cp, r3};
244 data->Initialize(arraysize(registers), registers, NULL);
248 void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
249 Register registers[] = {cp, r4, r3};
250 data->Initialize(arraysize(registers), registers, NULL);
254 void BinaryOpWithAllocationSiteDescriptor::Initialize(
255 CallInterfaceDescriptorData* data) {
256 Register registers[] = {cp, r5, r4, r3};
257 data->Initialize(arraysize(registers), registers, NULL);
261 void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
262 Register registers[] = {cp, r4, r3};
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 r3, // actual number of arguments
311 r5, // 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 r4, // api_function_address
330 r6, // 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 r4, // 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_PPC