v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
interface-descriptors-ia32-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_IA32_INTERFACE_DESCRIPTORS_IA32_INL_H_
6#define V8_CODEGEN_IA32_INTERFACE_DESCRIPTORS_IA32_INL_H_
7
8#if V8_TARGET_ARCH_IA32
9
11
12namespace v8 {
13namespace internal {
14
16 auto registers = RegisterArray(eax, ecx, edx, edi);
17 static_assert(registers.size() == kMaxBuiltinRegisterParams);
18 return registers;
19}
20
22 // xmm7 isn't allocatable.
23 auto registers =
24 DoubleRegisterArray(xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6);
25 return registers;
26}
27
29 auto registers =
31 return registers;
32}
33
35 // Padding to have as many double return registers as GP return registers.
37 return registers;
38}
39
40#if DEBUG
41template <typename DerivedDescriptor>
42void StaticCallInterfaceDescriptor<DerivedDescriptor>::
43 VerifyArgumentRegisterCount(CallInterfaceDescriptorData* data,
44 int nof_expected_args) {
45 RegList allocatable_regs = data->allocatable_registers();
46 if (nof_expected_args >= 1) DCHECK(allocatable_regs.has(esi));
47 if (nof_expected_args >= 2) DCHECK(allocatable_regs.has(edi));
48 // Additional arguments are passed on the stack.
49}
50#endif // DEBUG
51
52// static
53constexpr auto WriteBarrierDescriptor::registers() {
54 return RegisterArray(edi, ecx, edx, esi, kReturnRegister0);
55}
56
57// static
58constexpr Register LoadDescriptor::ReceiverRegister() { return edx; }
59// static
60constexpr Register LoadDescriptor::NameRegister() { return ecx; }
61// static
62constexpr Register LoadDescriptor::SlotRegister() { return eax; }
63
64// static
65constexpr Register LoadWithVectorDescriptor::VectorRegister() { return no_reg; }
66
67// static
68constexpr Register KeyedLoadBaselineDescriptor::ReceiverRegister() {
69 return edx;
70}
71// static
74}
75// static
77
78// static
79constexpr Register KeyedLoadWithVectorDescriptor::VectorRegister() {
80 return no_reg;
81}
82
83// static
84constexpr Register EnumeratedKeyedLoadBaselineDescriptor::EnumIndexRegister() {
85 return ecx;
86}
87
88// static
90 return no_reg;
91}
92
93// static
95 return no_reg;
96}
97
98// static
99constexpr Register KeyedHasICBaselineDescriptor::ReceiverRegister() {
101}
102// static
104// static
106
107// static
108constexpr Register KeyedHasICWithVectorDescriptor::VectorRegister() {
109 return no_reg;
110}
111
112// static
113constexpr Register
114LoadWithReceiverAndVectorDescriptor::LookupStartObjectRegister() {
115 return edi;
116}
117
118// static
119constexpr Register StoreDescriptor::ReceiverRegister() { return edx; }
120// static
121constexpr Register StoreDescriptor::NameRegister() { return ecx; }
122// static
123constexpr Register StoreDescriptor::ValueRegister() { return no_reg; }
124// static
125constexpr Register StoreDescriptor::SlotRegister() { return no_reg; }
126
127// static
128constexpr Register StoreWithVectorDescriptor::VectorRegister() {
129 return no_reg;
130}
131
132// static
133constexpr Register DefineKeyedOwnDescriptor::FlagsRegister() { return no_reg; }
134
135// static
136constexpr Register StoreTransitionDescriptor::MapRegister() { return edi; }
137
138// static
139constexpr Register ApiGetterDescriptor::HolderRegister() { return ecx; }
140// static
141constexpr Register ApiGetterDescriptor::CallbackRegister() { return eax; }
142
143// static
144constexpr Register GrowArrayElementsDescriptor::ObjectRegister() { return eax; }
145// static
146constexpr Register GrowArrayElementsDescriptor::KeyRegister() { return ecx; }
147
148// static
149constexpr Register BaselineLeaveFrameDescriptor::ParamsSizeRegister() {
150 return esi;
151}
152// static
154 return edi;
155}
156
157// static
159
160// static
161constexpr auto TypeofDescriptor::registers() { return RegisterArray(eax); }
162
163// static
165 // eax : number of arguments
166 // edi : the target to call
167 return RegisterArray(edi, eax);
168}
169
170// static
172 // edi : the source
173 // eax : the excluded property count
174 return RegisterArray(edi, eax);
175}
176
177// static
178constexpr auto
180 // edi : the source
181 // eax : the excluded property count
182 // ecx : the excluded property base
183 return RegisterArray(edi, eax, ecx);
184}
185
186// static
187constexpr auto CallVarargsDescriptor::registers() {
188 // eax : number of arguments (on the stack)
189 // edi : the target to call
190 // ecx : arguments list length (untagged)
191 // On the stack : arguments list (FixedArray)
192 return RegisterArray(edi, eax, ecx);
193}
194
195// static
197 // eax : number of arguments
198 // ecx : start index (to support rest parameters)
199 // edi : the target to call
200 return RegisterArray(edi, eax, ecx);
201}
202
203// static
205 // edx : function template info
206 // ecx : number of arguments (on the stack)
207 return RegisterArray(edx, ecx);
208}
209
210// static
212 // edx: the function template info
213 // ecx: number of arguments (on the stack)
214 // edi: topmost script-having context
215 return RegisterArray(edx, ecx, edi);
216}
217
218// static
220 // eax : number of arguments (on the stack)
221 // edi : the target to call
222 // ecx : the object to spread
223 return RegisterArray(edi, eax, ecx);
224}
225
226// static
228 // edi : the target to call
229 // edx : the arguments list
230 return RegisterArray(edi, edx);
231}
232
233// static
235 // eax : number of arguments (on the stack)
236 // edi : the target to call
237 // edx : the new target
238 // ecx : arguments list length (untagged)
239 // On the stack : arguments list (FixedArray)
240 return RegisterArray(edi, edx, eax, ecx);
241}
242
243// static
245 // eax : number of arguments
246 // edx : the new target
247 // ecx : start index (to support rest parameters)
248 // edi : the target to call
249 return RegisterArray(edi, edx, eax, ecx);
250}
251
252// static
254 // eax : number of arguments (on the stack)
255 // edi : the target to call
256 // edx : the new target
257 // ecx : the object to spread
258 return RegisterArray(edi, edx, eax, ecx);
259}
260
261// static
263 // edi : the target to call
264 // edx : the new target
265 // ecx : the arguments list
266 return RegisterArray(edi, edx, ecx);
267}
268
269// static
270constexpr auto ConstructStubDescriptor::registers() {
271 // eax : number of arguments
272 // edx : the new target
273 // edi : the target to call
274 return RegisterArray(edi, edx, eax);
275}
276
277// static
278constexpr auto AbortDescriptor::registers() { return RegisterArray(edx); }
279
280// static
281constexpr auto CompareDescriptor::registers() {
282 return RegisterArray(edx, eax);
283}
284
285// static
287 return RegisterArray(edx, eax, ecx);
288}
289
290// static
291constexpr auto BinaryOpDescriptor::registers() {
292 return RegisterArray(edx, eax);
293}
294
295// static
297 return RegisterArray(edx, eax, ecx);
298}
299
300// static
302 return RegisterArray(eax, edx, ecx);
303}
304
305// static
306constexpr Register
307CallApiCallbackOptimizedDescriptor::ApiFunctionAddressRegister() {
308 return eax;
309}
310// static
311constexpr Register
313 return ecx;
314}
315// static
316constexpr Register
318 return edx;
319}
320
321// static
322constexpr Register
323CallApiCallbackGenericDescriptor::ActualArgumentsCountRegister() {
324 return ecx;
325}
326// static
327constexpr Register
329 return eax;
330}
331// static
332constexpr Register
334 return edx;
335}
336
337// static
339 return RegisterArray(
342}
343
344// static
346 return RegisterArray(eax, // argument count
347 ecx, // address of first argument
348 edi); // the target callable to be call
349}
350
351// static
353 return RegisterArray(eax, // argument count
354 ecx); // address of first argument
355}
356
357// static
359 return RegisterArray(edi, // the constructor
360 edx); // the new target
361}
362
363// static
365 return RegisterArray(eax, // the value to pass to the generator
366 edx); // the JSGeneratorObject to resume
367}
368
369// static
371 return RegisterArray();
372}
373
375 // Arbitrarily picked register.
376 return RegisterArray(edi);
377}
378} // namespace internal
379} // namespace v8
380
381#endif // V8_TARGET_ARCH_IA32
382
383#endif // V8_CODEGEN_IA32_INTERFACE_DESCRIPTORS_IA32_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 Register no_reg
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 kReturnRegister2
constexpr int kMaxBuiltinRegisterParams
constexpr Register kInterpreterBytecodeOffsetRegister
constexpr Register kInterpreterBytecodeArrayRegister
#define DCHECK(condition)
Definition logging.h:482