• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 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 #ifndef V8_CODEGEN_S390_INTERFACE_DESCRIPTORS_S390_INL_H_
6 #define V8_CODEGEN_S390_INTERFACE_DESCRIPTORS_S390_INL_H_
7 
8 #if V8_TARGET_ARCH_S390
9 
10 #include "src/codegen/interface-descriptors.h"
11 #include "src/execution/frames.h"
12 
13 namespace v8 {
14 namespace internal {
15 
DefaultRegisterArray()16 constexpr auto CallInterfaceDescriptor::DefaultRegisterArray() {
17   auto registers = RegisterArray(r2, r3, r4, r5, r6);
18   STATIC_ASSERT(registers.size() == kMaxBuiltinRegisterParams);
19   return registers;
20 }
21 
22 #if DEBUG
23 template <typename DerivedDescriptor>
24 void StaticCallInterfaceDescriptor<DerivedDescriptor>::
VerifyArgumentRegisterCount(CallInterfaceDescriptorData * data,int argc)25     VerifyArgumentRegisterCount(CallInterfaceDescriptorData* data, int argc) {
26   RegList allocatable_regs = data->allocatable_registers();
27   if (argc >= 1) DCHECK(allocatable_regs.has(r2));
28   if (argc >= 2) DCHECK(allocatable_regs.has(r3));
29   if (argc >= 3) DCHECK(allocatable_regs.has(r4));
30   if (argc >= 4) DCHECK(allocatable_regs.has(r5));
31   if (argc >= 5) DCHECK(allocatable_regs.has(r6));
32   if (argc >= 6) DCHECK(allocatable_regs.has(r7));
33   if (argc >= 7) DCHECK(allocatable_regs.has(r8));
34   if (argc >= 8) DCHECK(allocatable_regs.has(r9));
35   // Additional arguments are passed on the stack.
36 }
37 #endif  // DEBUG
38 
39 // static
registers()40 constexpr auto WriteBarrierDescriptor::registers() {
41   return RegisterArray(r3, r7, r6, r4, r2, r5, kContextRegister);
42 }
43 
44 // static
ReceiverRegister()45 constexpr Register LoadDescriptor::ReceiverRegister() { return r3; }
46 // static
NameRegister()47 constexpr Register LoadDescriptor::NameRegister() { return r4; }
48 // static
SlotRegister()49 constexpr Register LoadDescriptor::SlotRegister() { return r2; }
50 
51 // static
VectorRegister()52 constexpr Register LoadWithVectorDescriptor::VectorRegister() { return r5; }
53 
54 // static
ReceiverRegister()55 constexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() {
56   return r3;
57 }
58 // static
NameRegister()59 constexpr Register KeyedLoadBaselineDescriptor::NameRegister() {
60   return kInterpreterAccumulatorRegister;
61 }
62 // static
SlotRegister()63 constexpr Register KeyedLoadBaselineDescriptor::SlotRegister() { return r4; }
64 
65 // static
VectorRegister()66 constexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() {
67   return r5;
68 }
69 
70 // static
ReceiverRegister()71 constexpr Register KeyedHasICBaselineDescriptor::ReceiverRegister() {
72   return kInterpreterAccumulatorRegister;
73 }
74 // static
NameRegister()75 constexpr Register KeyedHasICBaselineDescriptor::NameRegister() { return r3; }
76 // static
SlotRegister()77 constexpr Register KeyedHasICBaselineDescriptor::SlotRegister() { return r4; }
78 
79 // static
VectorRegister()80 constexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() {
81   return r5;
82 }
83 
84 // static
85 constexpr Register
LookupStartObjectRegister()86 LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() {
87   return r6;
88 }
89 
90 // static
ReceiverRegister()91 constexpr Register StoreDescriptor::ReceiverRegister() { return r3; }
92 // static
NameRegister()93 constexpr Register StoreDescriptor::NameRegister() { return r4; }
94 // static
ValueRegister()95 constexpr Register StoreDescriptor::ValueRegister() { return r2; }
96 // static
SlotRegister()97 constexpr Register StoreDescriptor::SlotRegister() { return r6; }
98 
99 // static
VectorRegister()100 constexpr Register StoreWithVectorDescriptor::VectorRegister() { return r5; }
101 
102 // static
MapRegister()103 constexpr Register StoreTransitionDescriptor::MapRegister() { return r7; }
104 
105 // static
HolderRegister()106 constexpr Register ApiGetterDescriptor::HolderRegister() { return r2; }
107 // static
CallbackRegister()108 constexpr Register ApiGetterDescriptor::CallbackRegister() { return r5; }
109 
110 // static
ObjectRegister()111 constexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return r2; }
112 // static
KeyRegister()113 constexpr Register GrowArrayElementsDescriptor::KeyRegister() { return r5; }
114 
115 // static
ParamsSizeRegister()116 constexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() {
117   // TODO(v8:11421): Implement on this platform.
118   return r5;
119 }
120 // static
WeightRegister()121 constexpr Register BaselineLeaveFrameDescriptor::WeightRegister() {
122   // TODO(v8:11421): Implement on this platform.
123   return r6;
124 }
125 
126 // static
127 // static
ArgumentRegister()128 constexpr Register TypeConversionDescriptor::ArgumentRegister() { return r2; }
129 
130 // static
registers()131 constexpr auto TypeofDescriptor::registers() { return RegisterArray(r2); }
132 
133 // static
registers()134 constexpr auto CallTrampolineDescriptor::registers() {
135   // r2 : number of arguments
136   // r3 : the target to call
137   return RegisterArray(r3, r2);
138 }
139 
140 // static
registers()141 constexpr auto CopyDataPropertiesWithExcludedPropertiesDescriptor::registers() {
142   // r3 : the source
143   // r2 : the excluded property count
144   return RegisterArray(r3, r2);
145 }
146 
147 // static
148 constexpr auto
registers()149 CopyDataPropertiesWithExcludedPropertiesOnStackDescriptor::registers() {
150   // r3 : the source
151   // r2 : the excluded property count
152   // r4 : the excluded property base
153   return RegisterArray(r3, r2, r4);
154 }
155 
156 // static
registers()157 constexpr auto CallVarargsDescriptor::registers() {
158   // r2 : number of arguments (on the stack)
159   // r3 : the target to call
160   // r6 : arguments list length (untagged)
161   // r4 : arguments list (FixedArray)
162   return RegisterArray(r3, r2, r6, r4);
163 }
164 
165 // static
registers()166 constexpr auto CallForwardVarargsDescriptor::registers() {
167   // r2 : number of arguments
168   // r4 : start index (to support rest parameters)
169   // r3 : the target to call
170   return RegisterArray(r3, r2, r4);
171 }
172 
173 // static
registers()174 constexpr auto CallFunctionTemplateDescriptor::registers() {
175   // r3 : function template info
176   // r4 : number of arguments (on the stack)
177   return RegisterArray(r3, r4);
178 }
179 
180 // static
registers()181 constexpr auto CallWithSpreadDescriptor::registers() {
182   // r2: number of arguments (on the stack)
183   // r3 : the target to call
184   // r4 : the object to spread
185   return RegisterArray(r3, r2, r4);
186 }
187 
188 // static
registers()189 constexpr auto CallWithArrayLikeDescriptor::registers() {
190   // r3 : the target to call
191   // r4 : the arguments list
192   return RegisterArray(r3, r4);
193 }
194 
195 // static
registers()196 constexpr auto ConstructVarargsDescriptor::registers() {
197   // r2 : number of arguments (on the stack)
198   // r3 : the target to call
199   // r5 : the new target
200   // r6 : arguments list length (untagged)
201   // r4 : arguments list (FixedArray)
202   return RegisterArray(r3, r5, r2, r6, r4);
203 }
204 
205 // static
registers()206 constexpr auto ConstructForwardVarargsDescriptor::registers() {
207   // r2 : number of arguments
208   // r5 : the new target
209   // r4 : start index (to support rest parameters)
210   // r3 : the target to call
211   return RegisterArray(r3, r5, r2, r4);
212 }
213 
214 // static
registers()215 constexpr auto ConstructWithSpreadDescriptor::registers() {
216   // r2 : number of arguments (on the stack)
217   // r3 : the target to call
218   // r5 : the new target
219   // r4 : the object to spread
220   return RegisterArray(r3, r5, r2, r4);
221 }
222 
223 // static
registers()224 constexpr auto ConstructWithArrayLikeDescriptor::registers() {
225   // r3 : the target to call
226   // r5 : the new target
227   // r4 : the arguments list
228   return RegisterArray(r3, r5, r4);
229 }
230 
231 // static
registers()232 constexpr auto ConstructStubDescriptor::registers() {
233   // r2 : number of arguments
234   // r3 : the target to call
235   // r5 : the new target
236   // r4 : allocation site or undefined
237   return RegisterArray(r3, r5, r2, r4);
238 }
239 
240 // static
registers()241 constexpr auto AbortDescriptor::registers() { return RegisterArray(r3); }
242 
243 // static
registers()244 constexpr auto CompareDescriptor::registers() { return RegisterArray(r3, r2); }
245 
246 // static
registers()247 constexpr auto Compare_BaselineDescriptor::registers() {
248   return RegisterArray(r3, r2, r4);
249 }
250 
251 // static
registers()252 constexpr auto BinaryOpDescriptor::registers() { return RegisterArray(r3, r2); }
253 
254 // static
registers()255 constexpr auto BinaryOp_BaselineDescriptor::registers() {
256   return RegisterArray(r3, r2, r4);
257 }
258 
259 // static
registers()260 constexpr auto BinarySmiOp_BaselineDescriptor::registers() {
261   return RegisterArray(r2, r3, r4);
262 }
263 
264 // static
registers()265 constexpr auto ApiCallbackDescriptor::registers() {
266   return RegisterArray(r3,   // kApiFunctionAddress
267                        r4,   // kArgc
268                        r5,   // kCallData
269                        r2);  // kHolder
270 }
271 
272 // static
registers()273 constexpr auto InterpreterDispatchDescriptor::registers() {
274   return RegisterArray(
275       kInterpreterAccumulatorRegister, kInterpreterBytecodeOffsetRegister,
276       kInterpreterBytecodeArrayRegister, kInterpreterDispatchTableRegister);
277 }
278 
279 // static
registers()280 constexpr auto InterpreterPushArgsThenCallDescriptor::registers() {
281   return RegisterArray(r2,   // argument count
282                        r4,   // address of first argument
283                        r3);  // the target callable to be call
284 }
285 
286 // static
registers()287 constexpr auto InterpreterPushArgsThenConstructDescriptor::registers() {
288   return RegisterArray(
289       r2,   // argument count
290       r6,   // address of the first argument
291       r3,   // constructor to call
292       r5,   // new target
293       r4);  // allocation site feedback if available, undefined otherwise
294 }
295 
296 // static
registers()297 constexpr auto ResumeGeneratorDescriptor::registers() {
298   return RegisterArray(r2,   // the value to pass to the generator
299                        r3);  // the JSGeneratorObject to resume
300 }
301 
302 // static
registers()303 constexpr auto RunMicrotasksEntryDescriptor::registers() {
304   return RegisterArray(r2, r3);
305 }
306 
307 }  // namespace internal
308 }  // namespace v8
309 
310 #endif  // V8_TARGET_ARCH_S390
311 
312 #endif  // V8_CODEGEN_S390_INTERFACE_DESCRIPTORS_S390_INL_H_
313