v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
interface-descriptors-arm-inl.h
Go to the documentation of this file.
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_ARM_INTERFACE_DESCRIPTORS_ARM_INL_H_
6#define V8_CODEGEN_ARM_INTERFACE_DESCRIPTORS_ARM_INL_H_
7
8#if V8_TARGET_ARCH_ARM
9
12
13namespace v8 {
14namespace internal {
15
17 auto registers = RegisterArray(r0, r1, r2, r3, r4);
18 static_assert(registers.size() == kMaxBuiltinRegisterParams);
19 return registers;
20}
21
23 // Construct the std::array explicitly here because on arm, the registers d0,
24 // d1, ... are not of type DoubleRegister but only support implicit casting to
25 // DoubleRegister. For template resolution, however, implicit casting is not
26 // sufficient.
27 std::array<DoubleRegister, 7> registers{d0, d1, d2, d3, d4, d5, d6};
28 return registers;
29}
30
32 auto registers =
34 return registers;
35}
36
38 // Construct the std::array explicitly here because on arm, the registers d0,
39 // d1, ... are not of type DoubleRegister but only support implicit casting to
40 // DoubleRegister. For template resolution, however, implicit casting is not
41 // sufficient.
42 // Padding to have as many double return registers as GP return registers.
43 std::array<DoubleRegister, 3> registers{kFPReturnRegister0, no_dreg, no_dreg};
44 return registers;
45}
46
47#if DEBUG
48template <typename DerivedDescriptor>
49void StaticCallInterfaceDescriptor<DerivedDescriptor>::
50 VerifyArgumentRegisterCount(CallInterfaceDescriptorData* data, int argc) {
51 RegList allocatable_regs = data->allocatable_registers();
52 if (argc >= 1) DCHECK(allocatable_regs.has(r0));
53 if (argc >= 2) DCHECK(allocatable_regs.has(r1));
54 if (argc >= 3) DCHECK(allocatable_regs.has(r2));
55 if (argc >= 4) DCHECK(allocatable_regs.has(r3));
56 if (argc >= 5) DCHECK(allocatable_regs.has(r4));
57 if (argc >= 6) DCHECK(allocatable_regs.has(r5));
58 if (argc >= 7) DCHECK(allocatable_regs.has(r6));
59 if (argc >= 8) DCHECK(allocatable_regs.has(r7));
60 // Additional arguments are passed on the stack.
61}
62#endif // DEBUG
63
64// static
65constexpr auto WriteBarrierDescriptor::registers() {
66 return RegisterArray(r1, r5, r4, r2, r0, r3, kContextRegister);
67}
68
69// static
70constexpr Register LoadDescriptor::ReceiverRegister() { return r1; }
71// static
72constexpr Register LoadDescriptor::NameRegister() { return r2; }
73// static
74constexpr Register LoadDescriptor::SlotRegister() { return r0; }
75
76// static
77constexpr Register LoadWithVectorDescriptor::VectorRegister() { return r3; }
78
79// static
80constexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() {
81 return r1;
82}
83// static
86}
87// static
89
90// static
91constexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() {
92 return r3;
93}
94
95// static
96constexpr Register EnumeratedKeyedLoadBaselineDescriptor::EnumIndexRegister() {
97 return r4;
98}
99
100// static
102 return r5;
103}
104
105// static
107 return r2;
108}
109
110// static
111constexpr Register KeyedHasICBaselineDescriptor::ReceiverRegister() {
113}
114// static
116// static
118
119// static
120constexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() {
121 return r3;
122}
123
124// static
125constexpr Register
126LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() {
127 return r4;
128}
129
130// static
131constexpr Register StoreDescriptor::ReceiverRegister() { return r1; }
132// static
133constexpr Register StoreDescriptor::NameRegister() { return r2; }
134// static
135constexpr Register StoreDescriptor::ValueRegister() { return r0; }
136// static
137constexpr Register StoreDescriptor::SlotRegister() { return r4; }
138
139// static
140constexpr Register StoreWithVectorDescriptor::VectorRegister() { return r3; }
141
142// static
143constexpr Register DefineKeyedOwnDescriptor::FlagsRegister() { return r5; }
144
145// static
146constexpr Register StoreTransitionDescriptor::MapRegister() { return r5; }
147
148// static
149constexpr Register ApiGetterDescriptor::HolderRegister() { return r0; }
150// static
151constexpr Register ApiGetterDescriptor::CallbackRegister() { return r3; }
152
153// static
154constexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return r0; }
155// static
156constexpr Register GrowArrayElementsDescriptor::KeyRegister() { return r3; }
157
158// static
159constexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() {
160 return r3;
161}
162// static
164
165// static
166// static
168
169// static
170constexpr auto TypeofDescriptor::registers() { return RegisterArray(r0); }
171
172// static
173constexpr Register
174MaglevOptimizeCodeOrTailCallOptimizedCodeSlotDescriptor::FlagsRegister() {
175 return r2;
176}
177// static
180 return r5;
181}
182// static
183constexpr Register
185 return r4;
186}
187
188// static
190 // r0 : number of arguments
191 // r1 : the target to call
192 return RegisterArray(r1, r0);
193}
194
195// static
197 // r0 : the source
198 // r1 : the excluded property count
199 return RegisterArray(r1, r0);
200}
201
202// static
203constexpr auto
205 // r0 : the source
206 // r1 : the excluded property count
207 // r2 : the excluded property base
208 return RegisterArray(r1, r0, r2);
209}
210
211// static
212constexpr auto CallVarargsDescriptor::registers() {
213 // r0 : number of arguments (on the stack)
214 // r1 : the target to call
215 // r4 : arguments list length (untagged)
216 // r2 : arguments list (FixedArray)
217 return RegisterArray(r1, r0, r4, r2);
218}
219
220// static
222 // r0 : number of arguments
223 // r2 : start index (to support rest parameters)
224 // r1 : the target to call
225 return RegisterArray(r1, r0, r2);
226}
227
228// static
230 // r1 : function template info
231 // r2 : number of arguments (on the stack)
232 return RegisterArray(r1, r2);
233}
234
235// static
237 // r1 : function template info
238 // r2 : number of arguments (on the stack)
239 // r3 : topmost script-having context
240 return RegisterArray(r1, r2, r3);
241}
242
243// static
245 // r0 : number of arguments (on the stack)
246 // r1 : the target to call
247 // r2 : the object to spread
248 return RegisterArray(r1, r0, r2);
249}
250
251// static
253 // r1 : the target to call
254 // r2 : the arguments list
255 return RegisterArray(r1, r2);
256}
257
258// static
260 // r0 : number of arguments (on the stack)
261 // r1 : the target to call
262 // r3 : the new target
263 // r4 : arguments list length (untagged)
264 // r2 : arguments list (FixedArray)
265 return RegisterArray(r1, r3, r0, r4, r2);
266}
267
268// static
270 // r0 : number of arguments
271 // r3 : the new target
272 // r2 : start index (to support rest parameters)
273 // r1 : the target to call
274 return RegisterArray(r1, r3, r0, r2);
275}
276
277// static
279 // r0 : number of arguments (on the stack)
280 // r1 : the target to call
281 // r3 : the new target
282 // r2 : the object to spread
283 return RegisterArray(r1, r3, r0, r2);
284}
285
286// static
288 // r1 : the target to call
289 // r3 : the new target
290 // r2 : the arguments list
291 return RegisterArray(r1, r3, r2);
292}
293
294// static
295constexpr auto ConstructStubDescriptor::registers() {
296 // r0 : number of arguments
297 // r1 : the target to call
298 // r3 : the new target
299 return RegisterArray(r1, r3, r0);
300}
301
302// static
303constexpr auto AbortDescriptor::registers() { return RegisterArray(r1); }
304
305// static
306constexpr auto CompareDescriptor::registers() { return RegisterArray(r1, r0); }
307
308// static
310 // r1: left operand
311 // r0: right operand
312 // r2: feedback slot
313 return RegisterArray(r1, r0, r2);
314}
315
316// static
317constexpr auto BinaryOpDescriptor::registers() { return RegisterArray(r1, r0); }
318
319// static
321 // r1: left operand
322 // r0: right operand
323 // r2: feedback slot
324 return RegisterArray(r1, r0, r2);
325}
326
327// static
329 // r0: left operand
330 // r1: right operand
331 // r2: feedback slot
332 return RegisterArray(r0, r1, r2);
333}
334
335// static
336constexpr Register
337CallApiCallbackOptimizedDescriptor::ApiFunctionAddressRegister() {
338 return r1;
339}
340// static
341constexpr Register
343 return r2;
344}
345// static
346constexpr Register
348 return r3;
349}
350
351// static
352constexpr Register
353CallApiCallbackGenericDescriptor::ActualArgumentsCountRegister() {
354 return r2;
355}
356// static
357constexpr Register
359 return r1;
360}
361// static
362constexpr Register
364 return r3;
365}
366
367// static
369 return RegisterArray(
372}
373
374// static
376 return RegisterArray(r0, // argument count
377 r2, // address of first argument
378 r1); // the target callable to be call
379}
380
381// static
383 return RegisterArray(
384 r0, // argument count
385 r4, // address of the first argument
386 r1, // constructor to call
387 r3, // new target
388 r2); // allocation site feedback if available, undefined otherwise
389}
390
391// static
393 return RegisterArray(r1, // constructor to call
394 r3); // new target
395}
396
397// static
399 return RegisterArray(r0, // the value to pass to the generator
400 r1); // the JSGeneratorObject to resume
401}
402
403// static
405 return RegisterArray(r0, r1);
406}
407
409 // Arbitrarily picked register.
410 return RegisterArray(r8);
411}
412} // namespace internal
413} // namespace v8
414
415#endif // V8_TARGET_ARCH_ARM
416
417#endif // V8_CODEGEN_ARM_INTERFACE_DESCRIPTORS_ARM_INL_H_
static DEFINE_PARAMETERS_VARARGS(kActualArgumentsCount, kTopmostScriptHavingContext, kFunctionTemplateInfo) DEFINE_PARAMETER_TYPES(MachineType constexpr Register TopmostScriptHavingContextRegister()
static DEFINE_PARAMETERS_VARARGS(kApiFunctionAddress, kActualArgumentsCount, kFunctionTemplateInfo) DEFINE_PARAMETER_TYPES(MachineType constexpr Register ActualArgumentsCountRegister()
RegListBase< RegisterT > registers
uint32_t WasmInterpreterRuntime int64_t r0
RegListBase< Register > RegList
Definition reglist-arm.h:14
constexpr DwVfpRegister no_dreg
constexpr EmptyRegisterArray RegisterArray()
constexpr Register kInterpreterAccumulatorRegister
constexpr DoubleRegister kFPReturnRegister0
constexpr Register kReturnRegister1
constexpr Register kReturnRegister0
constexpr Register kContextRegister
constexpr Register kInterpreterDispatchTableRegister
constexpr Register kReturnRegister2
constexpr int kMaxBuiltinRegisterParams
constexpr Register kInterpreterBytecodeOffsetRegister
constexpr Register kInterpreterBytecodeArrayRegister
#define DCHECK(condition)
Definition logging.h:482