• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #if V8_TARGET_ARCH_MIPS
6 
7 #include "src/interface-descriptors.h"
8 
9 namespace v8 {
10 namespace internal {
11 
ContextRegister()12 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
13 
14 
ReceiverRegister()15 const Register LoadDescriptor::ReceiverRegister() { return a1; }
NameRegister()16 const Register LoadDescriptor::NameRegister() { return a2; }
SlotRegister()17 const Register LoadDescriptor::SlotRegister() { return a0; }
18 
19 
VectorRegister()20 const Register LoadWithVectorDescriptor::VectorRegister() { return a3; }
21 
22 
ReceiverRegister()23 const Register StoreDescriptor::ReceiverRegister() { return a1; }
NameRegister()24 const Register StoreDescriptor::NameRegister() { return a2; }
ValueRegister()25 const Register StoreDescriptor::ValueRegister() { return a0; }
26 
27 
SlotRegister()28 const Register VectorStoreICTrampolineDescriptor::SlotRegister() { return t0; }
29 
30 
VectorRegister()31 const Register VectorStoreICDescriptor::VectorRegister() { return a3; }
32 
33 
SlotRegister()34 const Register VectorStoreTransitionDescriptor::SlotRegister() { return t0; }
VectorRegister()35 const Register VectorStoreTransitionDescriptor::VectorRegister() { return a3; }
MapRegister()36 const Register VectorStoreTransitionDescriptor::MapRegister() { return t1; }
37 
38 
MapRegister()39 const Register StoreTransitionDescriptor::MapRegister() { return a3; }
40 
41 
SlotRegister()42 const Register LoadGlobalViaContextDescriptor::SlotRegister() { return a2; }
43 
44 
SlotRegister()45 const Register StoreGlobalViaContextDescriptor::SlotRegister() { return a2; }
ValueRegister()46 const Register StoreGlobalViaContextDescriptor::ValueRegister() { return a0; }
47 
48 
LeftRegister()49 const Register InstanceOfDescriptor::LeftRegister() { return a1; }
RightRegister()50 const Register InstanceOfDescriptor::RightRegister() { return a0; }
51 
52 
LeftRegister()53 const Register StringCompareDescriptor::LeftRegister() { return a1; }
RightRegister()54 const Register StringCompareDescriptor::RightRegister() { return a0; }
55 
56 
index()57 const Register ArgumentsAccessReadDescriptor::index() { return a1; }
parameter_count()58 const Register ArgumentsAccessReadDescriptor::parameter_count() { return a0; }
59 
60 
function()61 const Register ArgumentsAccessNewDescriptor::function() { return a1; }
parameter_count()62 const Register ArgumentsAccessNewDescriptor::parameter_count() { return a2; }
parameter_pointer()63 const Register ArgumentsAccessNewDescriptor::parameter_pointer() { return a3; }
64 
65 
parameter_count()66 const Register RestParamAccessDescriptor::parameter_count() { return a2; }
parameter_pointer()67 const Register RestParamAccessDescriptor::parameter_pointer() { return a3; }
rest_parameter_index()68 const Register RestParamAccessDescriptor::rest_parameter_index() { return a1; }
69 
70 
function_address()71 const Register ApiGetterDescriptor::function_address() { return a2; }
72 
73 
exponent()74 const Register MathPowTaggedDescriptor::exponent() { return a2; }
75 
76 
exponent()77 const Register MathPowIntegerDescriptor::exponent() {
78   return MathPowTaggedDescriptor::exponent();
79 }
80 
81 
ObjectRegister()82 const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
KeyRegister()83 const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }
84 
85 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)86 void FastNewClosureDescriptor::InitializePlatformSpecific(
87     CallInterfaceDescriptorData* data) {
88   Register registers[] = {a2};
89   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
90 }
91 
92 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)93 void FastNewContextDescriptor::InitializePlatformSpecific(
94     CallInterfaceDescriptorData* data) {
95   Register registers[] = {a1};
96   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
97 }
98 
99 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)100 void ToNumberDescriptor::InitializePlatformSpecific(
101     CallInterfaceDescriptorData* data) {
102   Register registers[] = {a0};
103   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
104 }
105 
106 
107 // static
ReceiverRegister()108 const Register ToLengthDescriptor::ReceiverRegister() { return a0; }
109 
110 
111 // static
ReceiverRegister()112 const Register ToStringDescriptor::ReceiverRegister() { return a0; }
113 
114 
115 // static
ReceiverRegister()116 const Register ToObjectDescriptor::ReceiverRegister() { return a0; }
117 
118 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)119 void NumberToStringDescriptor::InitializePlatformSpecific(
120     CallInterfaceDescriptorData* data) {
121   Register registers[] = {a0};
122   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
123 }
124 
125 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)126 void TypeofDescriptor::InitializePlatformSpecific(
127     CallInterfaceDescriptorData* data) {
128   Register registers[] = {a3};
129   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
130 }
131 
132 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)133 void FastCloneRegExpDescriptor::InitializePlatformSpecific(
134     CallInterfaceDescriptorData* data) {
135   Register registers[] = {a3, a2, a1, a0};
136   data->InitializePlatformSpecific(arraysize(registers), registers);
137 }
138 
139 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)140 void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
141     CallInterfaceDescriptorData* data) {
142   Register registers[] = {a3, a2, a1};
143   data->InitializePlatformSpecific(arraysize(registers), registers);
144 }
145 
146 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)147 void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
148     CallInterfaceDescriptorData* data) {
149   Register registers[] = {a3, a2, a1, a0};
150   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
151 }
152 
153 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)154 void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
155     CallInterfaceDescriptorData* data) {
156   Register registers[] = {a2, a3};
157   data->InitializePlatformSpecific(arraysize(registers), registers);
158 }
159 
160 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)161 void CreateWeakCellDescriptor::InitializePlatformSpecific(
162     CallInterfaceDescriptorData* data) {
163   Register registers[] = {a2, a3, a1};
164   data->InitializePlatformSpecific(arraysize(registers), registers);
165 }
166 
167 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)168 void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
169     CallInterfaceDescriptorData* data) {
170   Register registers[] = {a3, a0};
171   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
172 }
173 
174 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)175 void CallFunctionDescriptor::InitializePlatformSpecific(
176     CallInterfaceDescriptorData* data) {
177   Register registers[] = {a1};
178   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
179 }
180 
181 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)182 void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
183     CallInterfaceDescriptorData* data) {
184   Register registers[] = {a1, a3};
185   data->InitializePlatformSpecific(arraysize(registers), registers);
186 }
187 
188 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)189 void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
190     CallInterfaceDescriptorData* data) {
191   Register registers[] = {a1, a3, a2};
192   data->InitializePlatformSpecific(arraysize(registers), registers);
193 }
194 
195 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)196 void CallConstructDescriptor::InitializePlatformSpecific(
197     CallInterfaceDescriptorData* data) {
198   // a0 : number of arguments
199   // a1 : the function to call
200   // a2 : feedback vector
201   // a3 : slot in feedback vector (Smi, for RecordCallTarget)
202   // t0 : new target (for IsSuperConstructorCall)
203   // TODO(turbofan): So far we don't gather type feedback and hence skip the
204   // slot parameter, but ArrayConstructStub needs the vector to be undefined.
205   Register registers[] = {a0, a1, t0, a2};
206   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
207 }
208 
209 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)210 void CallTrampolineDescriptor::InitializePlatformSpecific(
211     CallInterfaceDescriptorData* data) {
212   // a1: target
213   // a0: number of arguments
214   Register registers[] = {a1, a0};
215   data->InitializePlatformSpecific(arraysize(registers), registers);
216 }
217 
218 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)219 void ConstructStubDescriptor::InitializePlatformSpecific(
220     CallInterfaceDescriptorData* data) {
221   // a1: target
222   // a3: new target
223   // a0: number of arguments
224   // a2: allocation site or undefined
225   Register registers[] = {a1, a3, a0, a2};
226   data->InitializePlatformSpecific(arraysize(registers), registers);
227 }
228 
229 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)230 void ConstructTrampolineDescriptor::InitializePlatformSpecific(
231     CallInterfaceDescriptorData* data) {
232   // a1: target
233   // a3: new target
234   // a0: number of arguments
235   Register registers[] = {a1, a3, a0};
236   data->InitializePlatformSpecific(arraysize(registers), registers);
237 }
238 
239 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)240 void RegExpConstructResultDescriptor::InitializePlatformSpecific(
241     CallInterfaceDescriptorData* data) {
242   Register registers[] = {a2, a1, a0};
243   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
244 }
245 
246 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)247 void TransitionElementsKindDescriptor::InitializePlatformSpecific(
248     CallInterfaceDescriptorData* data) {
249   Register registers[] = {a0, a1};
250   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
251 }
252 
253 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)254 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
255     CallInterfaceDescriptorData* data) {
256   // register state
257   data->InitializePlatformSpecific(0, nullptr, nullptr);
258 }
259 
260 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)261 void AllocateInNewSpaceDescriptor::InitializePlatformSpecific(
262     CallInterfaceDescriptorData* data) {
263   Register registers[] = {a0};
264   data->InitializePlatformSpecific(arraysize(registers), registers);
265 }
266 
267 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)268 void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
269     CallInterfaceDescriptorData* data) {
270   // register state
271   // a0 -- number of arguments
272   // a1 -- function
273   // a2 -- allocation site with elements kind
274   Register registers[] = {a1, a2};
275   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
276 }
277 
278 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)279 void ArrayConstructorDescriptor::InitializePlatformSpecific(
280     CallInterfaceDescriptorData* data) {
281   // stack param count needs (constructor pointer, and single argument)
282   Register registers[] = {a1, a2, a0};
283   data->InitializePlatformSpecific(arraysize(registers), registers);
284 }
285 
286 
287 void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData * data)288     InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
289   // register state
290   // a0 -- number of arguments
291   // a1 -- constructor function
292   Register registers[] = {a1};
293   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
294 }
295 
296 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)297 void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
298     CallInterfaceDescriptorData* data) {
299   // stack param count needs (constructor pointer, and single argument)
300   Register registers[] = {a1, a0};
301   data->InitializePlatformSpecific(arraysize(registers), registers);
302 }
303 
304 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)305 void CompareDescriptor::InitializePlatformSpecific(
306     CallInterfaceDescriptorData* data) {
307   Register registers[] = {a1, a0};
308   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
309 }
310 
311 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)312 void CompareNilDescriptor::InitializePlatformSpecific(
313     CallInterfaceDescriptorData* data) {
314   Register registers[] = {a0};
315   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
316 }
317 
318 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)319 void ToBooleanDescriptor::InitializePlatformSpecific(
320     CallInterfaceDescriptorData* data) {
321   Register registers[] = {a0};
322   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
323 }
324 
325 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)326 void BinaryOpDescriptor::InitializePlatformSpecific(
327     CallInterfaceDescriptorData* data) {
328   Register registers[] = {a1, a0};
329   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
330 }
331 
332 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)333 void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
334     CallInterfaceDescriptorData* data) {
335   Register registers[] = {a2, a1, a0};
336   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
337 }
338 
339 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)340 void StringAddDescriptor::InitializePlatformSpecific(
341     CallInterfaceDescriptorData* data) {
342   Register registers[] = {a1, a0};
343   data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
344 }
345 
346 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)347 void KeyedDescriptor::InitializePlatformSpecific(
348     CallInterfaceDescriptorData* data) {
349   Register registers[] = {
350       a2,  // key
351   };
352   data->InitializePlatformSpecific(arraysize(registers), registers);
353 }
354 
355 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)356 void NamedDescriptor::InitializePlatformSpecific(
357     CallInterfaceDescriptorData* data) {
358   Register registers[] = {
359       a2,  // name
360   };
361   data->InitializePlatformSpecific(arraysize(registers), registers);
362 }
363 
364 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)365 void CallHandlerDescriptor::InitializePlatformSpecific(
366     CallInterfaceDescriptorData* data) {
367   Register registers[] = {
368       a0,  // receiver
369   };
370   data->InitializePlatformSpecific(arraysize(registers), registers);
371 }
372 
373 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)374 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
375     CallInterfaceDescriptorData* data) {
376   Register registers[] = {
377       a1,  // JSFunction
378       a3,  // the new target
379       a0,  // actual number of arguments
380       a2,  // expected number of arguments
381   };
382   data->InitializePlatformSpecific(arraysize(registers), registers);
383 }
384 
385 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)386 void ApiFunctionDescriptor::InitializePlatformSpecific(
387     CallInterfaceDescriptorData* data) {
388   Register registers[] = {
389       a0,  // callee
390       t0,  // call_data
391       a2,  // holder
392       a1,  // api_function_address
393       a3,  // actual number of arguments
394   };
395   data->InitializePlatformSpecific(arraysize(registers), registers);
396 }
397 
398 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)399 void ApiAccessorDescriptor::InitializePlatformSpecific(
400     CallInterfaceDescriptorData* data) {
401   Register registers[] = {
402       a0,  // callee
403       t0,  // call_data
404       a2,  // holder
405       a1,  // api_function_address
406   };
407   data->InitializePlatformSpecific(arraysize(registers), registers);
408 }
409 
410 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)411 void InterpreterPushArgsAndCallDescriptor::InitializePlatformSpecific(
412     CallInterfaceDescriptorData* data) {
413   Register registers[] = {
414       a0,  // argument count (not including receiver)
415       a2,  // address of first argument
416       a1   // the target callable to be call
417   };
418   data->InitializePlatformSpecific(arraysize(registers), registers);
419 }
420 
421 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)422 void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
423     CallInterfaceDescriptorData* data) {
424   Register registers[] = {
425       a0,  // argument count (not including receiver)
426       a3,  // new target
427       a1,  // constructor to call
428       a2   // address of the first argument
429   };
430   data->InitializePlatformSpecific(arraysize(registers), registers);
431 }
432 
433 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)434 void InterpreterCEntryDescriptor::InitializePlatformSpecific(
435     CallInterfaceDescriptorData* data) {
436   Register registers[] = {
437       a0,  // argument count (argc)
438       a2,  // address of first argument (argv)
439       a1   // the runtime function to call
440   };
441   data->InitializePlatformSpecific(arraysize(registers), registers);
442 }
443 
444 }  // namespace internal
445 }  // namespace v8
446 
447 #endif  // V8_TARGET_ARCH_MIPS
448