v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
interface-descriptors-x64-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_X64_INTERFACE_DESCRIPTORS_X64_INL_H_
6#define V8_CODEGEN_X64_INTERFACE_DESCRIPTORS_X64_INL_H_
7
8#if V8_TARGET_ARCH_X64
9
11
12namespace v8 {
13namespace internal {
14
16 auto registers = RegisterArray(rax, rbx, rcx, rdx, rdi);
17 static_assert(registers.size() == kMaxBuiltinRegisterParams);
18 return registers;
19}
20
22 auto registers =
23 DoubleRegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6);
24 return registers;
25}
26
28 auto registers =
30 return registers;
31}
32
34 // Padding to have as many double return registers as GP return registers.
36 return registers;
37}
38
39#if DEBUG
40template <typename DerivedDescriptor>
41void StaticCallInterfaceDescriptor<DerivedDescriptor>::
42 VerifyArgumentRegisterCount(CallInterfaceDescriptorData* data,
43 int nof_expected_args) {
44 RegList allocatable_regs = data->allocatable_registers();
45 if (nof_expected_args >= 1) DCHECK(allocatable_regs.has(kCArgRegs[0]));
46 if (nof_expected_args >= 2) DCHECK(allocatable_regs.has(kCArgRegs[1]));
47 if (nof_expected_args >= 3) DCHECK(allocatable_regs.has(kCArgRegs[2]));
48 if (nof_expected_args >= 4) DCHECK(allocatable_regs.has(kCArgRegs[3]));
49 // Additional arguments are passed on the stack.
50}
51#endif // DEBUG
52
53// static
54constexpr auto WriteBarrierDescriptor::registers() {
55#ifdef V8_TARGET_OS_WIN
56 return RegisterArray(rdi, r8, rcx, rax, r9, rdx, rsi);
57#else
58 return RegisterArray(rdi, rbx, rdx, rcx, rax, rsi);
59#endif // V8_TARGET_OS_WIN
60}
61
62#ifdef V8_IS_TSAN
63// static
64constexpr auto TSANStoreDescriptor::registers() {
66}
67
68// static
69constexpr auto TSANLoadDescriptor::registers() {
71}
72#endif // V8_IS_TSAN
73
74// static
75constexpr Register LoadDescriptor::ReceiverRegister() { return rdx; }
76// static
77constexpr Register LoadDescriptor::NameRegister() { return rcx; }
78// static
79constexpr Register LoadDescriptor::SlotRegister() { return rax; }
80
81// static
82constexpr Register LoadWithVectorDescriptor::VectorRegister() { return rbx; }
83
84// static
85constexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() {
86 return rdx;
87}
88// static
91}
92// static
94
95// static
96constexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() {
97 return rbx;
98}
99
100// static
101constexpr Register EnumeratedKeyedLoadBaselineDescriptor::EnumIndexRegister() {
102 return rdi;
103}
104
105// static
107 return r8;
108}
109
110// static
112 return rcx;
113}
114
115// static
116constexpr Register KeyedHasICBaselineDescriptor::ReceiverRegister() {
118}
119// static
121// static
123
124// static
125constexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() {
126 return rbx;
127}
128
129// static
130constexpr Register
131LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() {
132 return rdi;
133}
134
135// static
136constexpr Register StoreDescriptor::ReceiverRegister() { return rdx; }
137// static
138constexpr Register StoreDescriptor::NameRegister() { return rcx; }
139// static
140constexpr Register StoreDescriptor::ValueRegister() { return rax; }
141// static
142constexpr Register StoreDescriptor::SlotRegister() { return rdi; }
143
144// static
145constexpr Register StoreWithVectorDescriptor::VectorRegister() { return rbx; }
146
147// static
148constexpr Register DefineKeyedOwnDescriptor::FlagsRegister() { return r11; }
149
150// static
151constexpr Register StoreTransitionDescriptor::MapRegister() { return r11; }
152
153// static
154constexpr Register ApiGetterDescriptor::HolderRegister() { return rcx; }
155// static
156constexpr Register ApiGetterDescriptor::CallbackRegister() { return rbx; }
157
158// static
159constexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return rax; }
160// static
161constexpr Register GrowArrayElementsDescriptor::KeyRegister() { return rbx; }
162
163// static
164constexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() {
165 return rbx;
166}
167// static
169 return rcx;
170}
171
172// static
173constexpr Register
174MaglevOptimizeCodeOrTailCallOptimizedCodeSlotDescriptor::FlagsRegister() {
175 return r8;
176}
177// static
180 return r9;
181}
182// static
183constexpr Register
185 return r11;
186}
187
188// static
190
191// static
192constexpr auto TypeofDescriptor::registers() { return RegisterArray(rax); }
193
194// static
196 // rax : number of arguments
197 // rdi : the target to call
198 return RegisterArray(rdi, rax);
199}
200// static
202 // rdi : the source
203 // rax : the excluded property count
204 return RegisterArray(rdi, rax);
205}
206
207// static
208constexpr auto
210 // rdi : the source
211 // rax : the excluded property count
212 // rcx : the excluded property base
213 return RegisterArray(rdi, rax, rcx);
214}
215
216// static
217constexpr auto CallVarargsDescriptor::registers() {
218 // rax : number of arguments (on the stack)
219 // rdi : the target to call
220 // rcx : arguments list length (untagged)
221 // rbx : arguments list (FixedArray)
222 return RegisterArray(rdi, rax, rcx, rbx);
223}
224
225// static
227 // rax : number of arguments
228 // rcx : start index (to support rest parameters)
229 // rdi : the target to call
230 return RegisterArray(rdi, rax, rcx);
231}
232
233// static
235 // rdx: the function template info
236 // rcx: number of arguments (on the stack)
237 return RegisterArray(rdx, rcx);
238}
239
240// static
242 // rdx: the function template info
243 // rcx: number of arguments (on the stack)
244 // rdi: topmost script-having context
245 return RegisterArray(rdx, rcx, rdi);
246}
247
248// static
250 // rax : number of arguments (on the stack)
251 // rdi : the target to call
252 // rbx : the object to spread
253 return RegisterArray(rdi, rax, rbx);
254}
255
256// static
258 // rdi : the target to call
259 // rbx : the arguments list
260 return RegisterArray(rdi, rbx);
261}
262
263// static
265 // rax : number of arguments (on the stack)
266 // rdi : the target to call
267 // rdx : the new target
268 // rcx : arguments list length (untagged)
269 // rbx : arguments list (FixedArray)
270 return RegisterArray(rdi, rdx, rax, rcx, rbx);
271}
272
273// static
275 // rax : number of arguments
276 // rdx : the new target
277 // rcx : start index (to support rest parameters)
278 // rdi : the target to call
279 return RegisterArray(rdi, rdx, rax, rcx);
280}
281
282// static
284 // rax : number of arguments (on the stack)
285 // rdi : the target to call
286 // rdx : the new target
287 // rbx : the object to spread
288 return RegisterArray(rdi, rdx, rax, rbx);
289}
290
291// static
293 // rdi : the target to call
294 // rdx : the new target
295 // rbx : the arguments list
296 return RegisterArray(rdi, rdx, rbx);
297}
298
299// static
300constexpr auto ConstructStubDescriptor::registers() {
301 // rax : number of arguments
302 // rdx : the new target
303 // rdi : the target to call
304 return RegisterArray(rdi, rdx, rax);
305}
306
307// static
308constexpr auto AbortDescriptor::registers() { return RegisterArray(rdx); }
309
310// static
311constexpr auto CompareDescriptor::registers() {
312 return RegisterArray(rdx, rax);
313}
314
315// static
316constexpr auto BinaryOpDescriptor::registers() {
317 return RegisterArray(rdx, rax);
318}
319
320// static
322 return RegisterArray(rdx, rax, rbx);
323}
324
325// static
327 return RegisterArray(rdx, rax, rbx);
328}
329
330// static
332 return RegisterArray(rax, rdx, rbx);
333}
334
335// static
336constexpr Register
337CallApiCallbackOptimizedDescriptor::ApiFunctionAddressRegister() {
338 return rdx;
339}
340// static
341constexpr Register
343 return rcx;
344}
345// static
346constexpr Register
348 return rbx;
349}
350
351// static
352constexpr Register
353CallApiCallbackGenericDescriptor::ActualArgumentsCountRegister() {
354 return rcx;
355}
356// static
357constexpr Register
359 return rbx;
360}
361// static
362constexpr Register
364 return rdx;
365}
366
367// static
369 return RegisterArray(
372}
373
374// static
376 return RegisterArray(rax, // argument count
377 rbx, // address of first argument
378 rdi); // the target callable to be call
379}
380
381// static
383 return RegisterArray(
384 rax, // argument count
385 rcx, // address of first argument
386 rdi, // constructor to call
387 rdx, // new target
388 rbx); // allocation site feedback if available, undefined otherwise
389}
390
391// static
393 return RegisterArray(rdi, // constructor to call
394 rdx); // new target
395}
396
397// static
399 return RegisterArray(
400 rax, // the value to pass to the generator
401 rdx); // the JSGeneratorObject / JSAsyncGeneratorObject to resume
402}
403
404// static
406 return RegisterArray(kCArgRegs[0], kCArgRegs[1]);
407}
408
410 // Arbitrarily picked register.
411 return RegisterArray(rdi);
412}
413} // namespace internal
414} // namespace v8
415
416#endif // V8_TARGET_ARCH_X64
417
418#endif // V8_CODEGEN_X64_INTERFACE_DESCRIPTORS_X64_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
constexpr EmptyDoubleRegisterArray DoubleRegisterArray()
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 kInterpreterDispatchTableRegister
constexpr Register r11
constexpr Register kReturnRegister2
constexpr int kMaxBuiltinRegisterParams
constexpr Register kCArgRegs[]
constexpr Register kInterpreterBytecodeOffsetRegister
constexpr Register kInterpreterBytecodeArrayRegister
#define DCHECK(condition)
Definition logging.h:482