• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 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_S390
6 
7 #include "src/interface-descriptors.h"
8 
9 namespace v8 {
10 namespace internal {
11 
ContextRegister()12 const Register CallInterfaceDescriptor::ContextRegister() { return cp; }
13 
DefaultInitializePlatformSpecific(CallInterfaceDescriptorData * data,int register_parameter_count)14 void CallInterfaceDescriptor::DefaultInitializePlatformSpecific(
15     CallInterfaceDescriptorData* data, int register_parameter_count) {
16   const Register default_stub_registers[] = {r2, r3, r4, r5, r6};
17   CHECK_LE(static_cast<size_t>(register_parameter_count),
18            arraysize(default_stub_registers));
19   data->InitializePlatformSpecific(register_parameter_count,
20                                    default_stub_registers);
21 }
22 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)23 void RecordWriteDescriptor::InitializePlatformSpecific(
24     CallInterfaceDescriptorData* data) {
25   const Register default_stub_registers[] = {r2, r3, r4, r5, r6};
26 
27   data->RestrictAllocatableRegisters(default_stub_registers,
28                                      arraysize(default_stub_registers));
29 
30   CHECK_LE(static_cast<size_t>(kParameterCount),
31            arraysize(default_stub_registers));
32   data->InitializePlatformSpecific(kParameterCount, default_stub_registers);
33 }
34 
ScopeInfoRegister()35 const Register FastNewFunctionContextDescriptor::ScopeInfoRegister() {
36   return r3;
37 }
SlotsRegister()38 const Register FastNewFunctionContextDescriptor::SlotsRegister() { return r2; }
39 
ReceiverRegister()40 const Register LoadDescriptor::ReceiverRegister() { return r3; }
NameRegister()41 const Register LoadDescriptor::NameRegister() { return r4; }
SlotRegister()42 const Register LoadDescriptor::SlotRegister() { return r2; }
43 
VectorRegister()44 const Register LoadWithVectorDescriptor::VectorRegister() { return r5; }
45 
ReceiverRegister()46 const Register StoreDescriptor::ReceiverRegister() { return r3; }
NameRegister()47 const Register StoreDescriptor::NameRegister() { return r4; }
ValueRegister()48 const Register StoreDescriptor::ValueRegister() { return r2; }
SlotRegister()49 const Register StoreDescriptor::SlotRegister() { return r6; }
50 
VectorRegister()51 const Register StoreWithVectorDescriptor::VectorRegister() { return r5; }
52 
SlotRegister()53 const Register StoreTransitionDescriptor::SlotRegister() { return r6; }
VectorRegister()54 const Register StoreTransitionDescriptor::VectorRegister() { return r5; }
MapRegister()55 const Register StoreTransitionDescriptor::MapRegister() { return r7; }
56 
HolderRegister()57 const Register ApiGetterDescriptor::HolderRegister() { return r2; }
CallbackRegister()58 const Register ApiGetterDescriptor::CallbackRegister() { return r5; }
59 
ObjectRegister()60 const Register GrowArrayElementsDescriptor::ObjectRegister() { return r2; }
KeyRegister()61 const Register GrowArrayElementsDescriptor::KeyRegister() { return r5; }
62 
63 // static
ArgumentRegister()64 const Register TypeConversionDescriptor::ArgumentRegister() { return r2; }
65 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)66 void TypeofDescriptor::InitializePlatformSpecific(
67     CallInterfaceDescriptorData* data) {
68   Register registers[] = {r5};
69   data->InitializePlatformSpecific(arraysize(registers), registers);
70 }
71 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)72 void CallFunctionDescriptor::InitializePlatformSpecific(
73     CallInterfaceDescriptorData* data) {
74   Register registers[] = {r3};
75   data->InitializePlatformSpecific(arraysize(registers), registers);
76 }
77 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)78 void CallTrampolineDescriptor::InitializePlatformSpecific(
79     CallInterfaceDescriptorData* data) {
80   // r2 : number of arguments
81   // r3 : the target to call
82   Register registers[] = {r3, r2};
83   data->InitializePlatformSpecific(arraysize(registers), registers);
84 }
85 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)86 void CallVarargsDescriptor::InitializePlatformSpecific(
87     CallInterfaceDescriptorData* data) {
88   // r2 : number of arguments (on the stack, not including receiver)
89   // r3 : the target to call
90   // r4 : arguments list (FixedArray)
91   // r6 : arguments list length (untagged)
92   Register registers[] = {r3, r2, r4, r6};
93   data->InitializePlatformSpecific(arraysize(registers), registers);
94 }
95 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)96 void CallForwardVarargsDescriptor::InitializePlatformSpecific(
97     CallInterfaceDescriptorData* data) {
98   // r2 : number of arguments
99   // r4 : start index (to support rest parameters)
100   // r3 : the target to call
101   Register registers[] = {r3, r2, r4};
102   data->InitializePlatformSpecific(arraysize(registers), registers);
103 }
104 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)105 void CallWithSpreadDescriptor::InitializePlatformSpecific(
106     CallInterfaceDescriptorData* data) {
107   // r2 : number of arguments (on the stack, not including receiver)
108   // r3 : the target to call
109   // r4 : the object to spread
110   Register registers[] = {r3, r2, r4};
111   data->InitializePlatformSpecific(arraysize(registers), registers);
112 }
113 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)114 void CallWithArrayLikeDescriptor::InitializePlatformSpecific(
115     CallInterfaceDescriptorData* data) {
116   // r3 : the target to call
117   // r4 : the arguments list
118   Register registers[] = {r3, r4};
119   data->InitializePlatformSpecific(arraysize(registers), registers);
120 }
121 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)122 void ConstructVarargsDescriptor::InitializePlatformSpecific(
123     CallInterfaceDescriptorData* data) {
124   // r2 : number of arguments (on the stack, not including receiver)
125   // r3 : the target to call
126   // r5 : the new target
127   // r4 : arguments list (FixedArray)
128   // r6 : arguments list length (untagged)
129   Register registers[] = {r3, r5, r2, r4, r6};
130   data->InitializePlatformSpecific(arraysize(registers), registers);
131 }
132 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)133 void ConstructForwardVarargsDescriptor::InitializePlatformSpecific(
134     CallInterfaceDescriptorData* data) {
135   // r2 : number of arguments
136   // r5 : the new target
137   // r4 : start index (to support rest parameters)
138   // r3 : the target to call
139   Register registers[] = {r3, r5, r2, r4};
140   data->InitializePlatformSpecific(arraysize(registers), registers);
141 }
142 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)143 void ConstructWithSpreadDescriptor::InitializePlatformSpecific(
144     CallInterfaceDescriptorData* data) {
145   // r2 : number of arguments (on the stack, not including receiver)
146   // r3 : the target to call
147   // r5 : the new target
148   // r4 : the object to spread
149   Register registers[] = {r3, r5, r2, r4};
150   data->InitializePlatformSpecific(arraysize(registers), registers);
151 }
152 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)153 void ConstructWithArrayLikeDescriptor::InitializePlatformSpecific(
154     CallInterfaceDescriptorData* data) {
155   // r3 : the target to call
156   // r5 : the new target
157   // r4 : the arguments list
158   Register registers[] = {r3, r5, r4};
159   data->InitializePlatformSpecific(arraysize(registers), registers);
160 }
161 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)162 void ConstructStubDescriptor::InitializePlatformSpecific(
163     CallInterfaceDescriptorData* data) {
164   // r2 : number of arguments
165   // r3 : the target to call
166   // r5 : the new target
167   // r4 : allocation site or undefined
168   Register registers[] = {r3, r5, r2, r4};
169   data->InitializePlatformSpecific(arraysize(registers), registers);
170 }
171 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)172 void AbortDescriptor::InitializePlatformSpecific(
173     CallInterfaceDescriptorData* data) {
174   Register registers[] = {r3};
175   data->InitializePlatformSpecific(arraysize(registers), registers);
176 }
177 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)178 void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
179     CallInterfaceDescriptorData* data) {
180   data->InitializePlatformSpecific(0, nullptr);
181 }
182 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)183 void CompareDescriptor::InitializePlatformSpecific(
184     CallInterfaceDescriptorData* data) {
185   Register registers[] = {r3, r2};
186   data->InitializePlatformSpecific(arraysize(registers), registers);
187 }
188 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)189 void BinaryOpDescriptor::InitializePlatformSpecific(
190     CallInterfaceDescriptorData* data) {
191   Register registers[] = {r3, r2};
192   data->InitializePlatformSpecific(arraysize(registers), registers);
193 }
194 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)195 void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
196     CallInterfaceDescriptorData* data) {
197   Register registers[] = {
198       r3,  // JSFunction
199       r5,  // the new target
200       r2,  // actual number of arguments
201       r4,  // expected number of arguments
202   };
203   data->InitializePlatformSpecific(arraysize(registers), registers);
204 }
205 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)206 void ApiCallbackDescriptor::InitializePlatformSpecific(
207     CallInterfaceDescriptorData* data) {
208   Register registers[] = {
209       JavaScriptFrame::context_register(),  // callee context
210       r6,                                   // call_data
211       r4,                                   // holder
212       r3,                                   // api_function_address
213   };
214   data->InitializePlatformSpecific(arraysize(registers), registers);
215 }
216 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)217 void InterpreterDispatchDescriptor::InitializePlatformSpecific(
218     CallInterfaceDescriptorData* data) {
219   Register registers[] = {
220       kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
221       kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister};
222   data->InitializePlatformSpecific(arraysize(registers), registers);
223 }
224 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)225 void InterpreterPushArgsThenCallDescriptor::InitializePlatformSpecific(
226     CallInterfaceDescriptorData* data) {
227   Register registers[] = {
228       r2,  // argument count (not including receiver)
229       r4,  // address of first argument
230       r3   // the target callable to be call
231   };
232   data->InitializePlatformSpecific(arraysize(registers), registers);
233 }
234 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)235 void InterpreterPushArgsThenConstructDescriptor::InitializePlatformSpecific(
236     CallInterfaceDescriptorData* data) {
237   Register registers[] = {
238       r2,  // argument count (not including receiver)
239       r5,  // new target
240       r3,  // constructor to call
241       r4,  // allocation site feedback if available, undefined otherwise
242       r6   // address of the first argument
243   };
244   data->InitializePlatformSpecific(arraysize(registers), registers);
245 }
246 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)247 void ResumeGeneratorDescriptor::InitializePlatformSpecific(
248     CallInterfaceDescriptorData* data) {
249   Register registers[] = {
250       r2,  // the value to pass to the generator
251       r3   // the JSGeneratorObject to resume
252   };
253   data->InitializePlatformSpecific(arraysize(registers), registers);
254 }
255 
InitializePlatformSpecific(CallInterfaceDescriptorData * data)256 void FrameDropperTrampolineDescriptor::InitializePlatformSpecific(
257     CallInterfaceDescriptorData* data) {
258   Register registers[] = {
259       r3,  // loaded new FP
260   };
261   data->InitializePlatformSpecific(arraysize(registers), registers);
262 }
263 
264 }  // namespace internal
265 }  // namespace v8
266 
267 #endif  // V8_TARGET_ARCH_S390
268