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