v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
interface-descriptors-riscv-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_RISCV_INTERFACE_DESCRIPTORS_RISCV_INL_H_
6#define V8_CODEGEN_RISCV_INTERFACE_DESCRIPTORS_RISCV_INL_H_
7
11
12namespace v8 {
13namespace internal {
14
16 auto registers = RegisterArray(a0, a1, a2, a3, a4);
17 static_assert(registers.size() == kMaxBuiltinRegisterParams);
18 return registers;
19}
20
22 auto registers = DoubleRegisterArray(ft1, ft2, ft3, ft4, ft5, ft6, ft7);
23 return registers;
24}
25
31
33 // Padding to have as many double return registers as GP return registers.
35 return registers;
36}
37
38#if DEBUG
39template <typename DerivedDescriptor>
42 RegList allocatable_regs = data->allocatable_registers();
43 if (argc >= 1) DCHECK(allocatable_regs.has(a0));
44 if (argc >= 2) DCHECK(allocatable_regs.has(a1));
45 if (argc >= 3) DCHECK(allocatable_regs.has(a2));
46 if (argc >= 4) DCHECK(allocatable_regs.has(a3));
47 if (argc >= 5) DCHECK(allocatable_regs.has(a4));
48 if (argc >= 6) DCHECK(allocatable_regs.has(a5));
49 if (argc >= 7) DCHECK(allocatable_regs.has(a6));
50 if (argc >= 8) DCHECK(allocatable_regs.has(a7));
51 // Additional arguments are passed on the stack.
52}
53#endif // DEBUG
54
55// static
56constexpr auto WriteBarrierDescriptor::registers() {
57 // TODO(Yuxiang): Remove a7 which is just there for padding.
58 return RegisterArray(a1, a5, a4, a2, a0, a3, kContextRegister, a7);
59}
60
61// static
62constexpr Register LoadDescriptor::ReceiverRegister() { return a1; }
63// static
64constexpr Register LoadDescriptor::NameRegister() { return a2; }
65// static
66constexpr Register LoadDescriptor::SlotRegister() { return a0; }
67
68// static
69constexpr Register LoadWithVectorDescriptor::VectorRegister() { return a3; }
70
71// static
72constexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() {
73 return a1;
74}
75// static
79// static
81
82// static
83constexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() {
84 return a3;
85}
86
87// static
88constexpr Register EnumeratedKeyedLoadBaselineDescriptor::EnumIndexRegister() {
89 return a4;
90}
91
92// static
96
97// static
101
102// static
103constexpr Register KeyedHasICBaselineDescriptor::ReceiverRegister() {
105}
106// static
108// static
110
111// static
112constexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() {
113 return a3;
114}
115
116// static
117constexpr Register
118LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() {
119 return a4;
120}
121
122// static
123constexpr Register StoreDescriptor::ReceiverRegister() { return a1; }
124// static
125constexpr Register StoreDescriptor::NameRegister() { return a2; }
126// static
127constexpr Register StoreDescriptor::ValueRegister() { return a0; }
128// static
129constexpr Register StoreDescriptor::SlotRegister() { return a4; }
130
131// static
132constexpr Register StoreWithVectorDescriptor::VectorRegister() { return a3; }
133
134// static
135constexpr Register DefineKeyedOwnDescriptor::FlagsRegister() { return a5; }
136
137// static
138constexpr Register StoreTransitionDescriptor::MapRegister() { return a5; }
139
140// static
142// static
144
145// static
146constexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
147// static
149
150// static
151constexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() {
152 return a2;
153}
154// static
156
157// static
158// static
160
161#ifdef V8_ENABLE_MAGLEV
162// static
163constexpr Register
164MaglevOptimizeCodeOrTailCallOptimizedCodeSlotDescriptor::FlagsRegister() {
165 return t4;
166}
167// static
170 return a6;
171}
172// static
173constexpr Register
175 return a5;
176}
177#endif // V8_ENABLE_MAGLEV
178
179// static
180constexpr auto TypeofDescriptor::registers() { return RegisterArray(a0); }
181
182// static
184 // a1: target
185 // a0: number of arguments
186 return RegisterArray(a1, a0);
187}
188
189// static
191 // a1 : the source
192 // a0 : the excluded property count
193 return RegisterArray(a1, a0);
194}
195
196// static
197constexpr auto
199 // a1 : the source
200 // a0 : the excluded property count
201 // a2 : the excluded property base
202 return RegisterArray(a1, a0, a2);
203}
204
205// static
206constexpr auto CallVarargsDescriptor::registers() {
207 // a0 : number of arguments (on the stack)
208 // a1 : the target to call
209 // a4 : arguments list length (untagged)
210 // a2 : arguments list (FixedArray)
211 return RegisterArray(a1, a0, a4, a2);
212}
213
214// static
216 // a1: target
217 // a0: number of arguments
218 // a2: start index (to supported rest parameters)
219 return RegisterArray(a1, a0, a2);
220}
221
222// static
224 // a1 : function template info
225 // a0 : number of arguments (on the stack)
226 return RegisterArray(a1, a0);
227}
228
230 // a1 : function template info
231 // a2 : number of arguments (on the stack)
232 // a3 : topmost script-having context
233 return RegisterArray(a1, a2, a3);
234}
235
236// static
238 // a0 : number of arguments (on the stack)
239 // a1 : the target to call
240 // a2 : the object to spread
241 return RegisterArray(a1, a0, a2);
242}
243
244// static
246 // a1 : the target to call
247 // a2 : the arguments list
248 return RegisterArray(a1, a2);
249}
250
251// static
253 // a0 : number of arguments (on the stack)
254 // a1 : the target to call
255 // a3 : the new target
256 // a4 : arguments list length (untagged)
257 // a2 : arguments list (FixedArray)
258 return RegisterArray(a1, a3, a0, a4, a2);
259}
260
261// static
263 // a3: new target
264 // a1: target
265 // a0: number of arguments
266 // a2: start index (to supported rest parameters)
267 return RegisterArray(a1, a3, a0, a2);
268}
269
270// static
272 // a0 : number of arguments (on the stack)
273 // a1 : the target to call
274 // a3 : the new target
275 // a2 : the object to spread
276 return RegisterArray(a1, a3, a0, a2);
277}
278
279// static
281 // a1 : the target to call
282 // a3 : the new target
283 // a2 : the arguments list
284 return RegisterArray(a1, a3, a2);
285}
286
287// static
289 // a3: new target
290 // a1: target
291 // a0: number of arguments
292 return RegisterArray(a1, a3, a0);
293}
294
295// static
296constexpr auto AbortDescriptor::registers() { return RegisterArray(a0); }
297
298// static
300 // a1: left operand
301 // a0: right operand
302 return RegisterArray(a1, a0);
303}
304
305// static
307 // a1: left operand
308 // a0: right operand
309 // a2: feedback slot
310 return RegisterArray(a1, a0, a2);
311}
312
313// static
315 // a1: left operand
316 // a0: right operand
317 return RegisterArray(a1, a0);
318}
319
320// static
322 // a1: left operand
323 // a0: right operand
324 // a2: feedback slot
325 return RegisterArray(a1, a0, a2);
326}
327
328// static
330 // a0: left operand
331 // a1: right operand
332 // a2: feedback slot
333 return RegisterArray(a0, a1, a2);
334}
335
336// static
337constexpr Register
341// static
342constexpr Register
343CallApiCallbackOptimizedDescriptor::ApiFunctionAddressRegister() {
344 return a1;
345}
346// static
347constexpr Register
351// static
352constexpr Register
356
357// static
358constexpr Register
359CallApiCallbackGenericDescriptor::ActualArgumentsCountRegister() {
360 return a2;
361}
362// static
363constexpr Register
367
368// static
370 return RegisterArray(
373}
374
375// static
377 return RegisterArray(a0, // argument count
378 a2, // address of first argument
379 a1); // the target callable to be call
380}
381
382// static
384 return RegisterArray(
385 a0, // argument count
386 a4, // address of the first argument
387 a1, // constructor to call
388 a3, // new target
389 a2); // allocation site feedback if available, undefined otherwise
390}
391
392// static
394 return RegisterArray(a1, // constructor to call
395 a3); // new target
396}
397
398// static
400 return RegisterArray(a0, // the value to pass to the generator
401 a1); // the JSGeneratorObject to resume
402}
403
404// static
406 return RegisterArray(a0, a1);
407}
408
410 // Arbitrarily picked register.
411 return RegisterArray(t0);
412}
413
414} // namespace internal
415} // namespace v8
416
417#endif // V8_CODEGEN_RISCV_INTERFACE_DESCRIPTORS_RISCV_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()
constexpr bool has(RegisterT reg) const
RegListBase< RegisterT > registers
constexpr EmptyDoubleRegisterArray DoubleRegisterArray()
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