]>
Commit | Line | Data |
---|---|---|
6fe7ccc8 | 1 | /* |
ed1e77d3 | 2 | * Copyright (C) 2011, 2015 Apple Inc. All rights reserved. |
6fe7ccc8 A |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted provided that the following conditions | |
6 | * are met: | |
7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | |
12 | * | |
13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | |
14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | |
17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | */ | |
25 | ||
81345200 A |
26 | #ifndef CCallHelpers_h |
27 | #define CCallHelpers_h | |
6fe7ccc8 | 28 | |
81345200 | 29 | #if ENABLE(JIT) |
6fe7ccc8 | 30 | |
81345200 A |
31 | #include "AssemblyHelpers.h" |
32 | #include "GPRInfo.h" | |
6fe7ccc8 | 33 | |
81345200 | 34 | namespace JSC { |
6fe7ccc8 | 35 | |
ed1e77d3 A |
36 | #if CPU(MIPS) || (OS(WINDOWS) && CPU(X86_64)) |
37 | #define POKE_ARGUMENT_OFFSET 4 | |
38 | #else | |
39 | #define POKE_ARGUMENT_OFFSET 0 | |
40 | #endif | |
41 | ||
6fe7ccc8 A |
42 | class CCallHelpers : public AssemblyHelpers { |
43 | public: | |
93a37866 A |
44 | CCallHelpers(VM* vm, CodeBlock* codeBlock = 0) |
45 | : AssemblyHelpers(vm, codeBlock) | |
6fe7ccc8 A |
46 | { |
47 | } | |
ed1e77d3 A |
48 | |
49 | // The most general helper for setting arguments that fit in a GPR, if you can compute each | |
50 | // argument without using any argument registers. You usually want one of the setupArguments*() | |
51 | // methods below instead of this. This thing is most useful if you have *a lot* of arguments. | |
52 | template<typename Functor> | |
53 | void setupArgument(unsigned argumentIndex, const Functor& functor) | |
54 | { | |
55 | unsigned numberOfRegs = GPRInfo::numberOfArgumentRegisters; // Disguise the constant from clang's tautological compare warning. | |
56 | if (argumentIndex < numberOfRegs) { | |
57 | functor(GPRInfo::toArgumentRegister(argumentIndex)); | |
58 | return; | |
59 | } | |
60 | ||
61 | functor(GPRInfo::nonArgGPR0); | |
62 | poke(GPRInfo::nonArgGPR0, POKE_ARGUMENT_OFFSET + argumentIndex - GPRInfo::numberOfArgumentRegisters); | |
63 | } | |
6fe7ccc8 A |
64 | |
65 | // These methods used to sort arguments into the correct registers. | |
66 | // On X86 we use cdecl calling conventions, which pass all arguments on the | |
67 | // stack. On other architectures we may need to sort values into the | |
68 | // correct registers. | |
69 | #if !NUMBER_OF_ARGUMENT_REGISTERS | |
70 | unsigned m_callArgumentOffset; | |
71 | void resetCallArguments() { m_callArgumentOffset = 0; } | |
72 | ||
73 | // These methods are using internally to implement the callOperation methods. | |
74 | void addCallArgument(GPRReg value) | |
75 | { | |
76 | poke(value, m_callArgumentOffset++); | |
77 | } | |
78 | void addCallArgument(TrustedImm32 imm) | |
79 | { | |
80 | poke(imm, m_callArgumentOffset++); | |
81 | } | |
82 | void addCallArgument(TrustedImmPtr pointer) | |
83 | { | |
84 | poke(pointer, m_callArgumentOffset++); | |
85 | } | |
86 | void addCallArgument(FPRReg value) | |
87 | { | |
88 | storeDouble(value, Address(stackPointerRegister, m_callArgumentOffset * sizeof(void*))); | |
89 | m_callArgumentOffset += sizeof(double) / sizeof(void*); | |
90 | } | |
91 | ||
92 | ALWAYS_INLINE void setupArguments(FPRReg arg1) | |
93 | { | |
94 | resetCallArguments(); | |
95 | addCallArgument(arg1); | |
96 | } | |
97 | ||
98 | ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) | |
99 | { | |
100 | resetCallArguments(); | |
101 | addCallArgument(arg1); | |
102 | addCallArgument(arg2); | |
103 | } | |
104 | ||
105 | ALWAYS_INLINE void setupArguments(GPRReg arg1) | |
106 | { | |
107 | resetCallArguments(); | |
108 | addCallArgument(arg1); | |
109 | } | |
110 | ||
111 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2) | |
112 | { | |
113 | resetCallArguments(); | |
114 | addCallArgument(arg1); | |
115 | addCallArgument(arg2); | |
116 | } | |
93a37866 | 117 | |
81345200 A |
118 | ALWAYS_INLINE void setupArguments(TrustedImmPtr arg1, GPRReg arg2) |
119 | { | |
120 | resetCallArguments(); | |
121 | addCallArgument(arg1); | |
122 | addCallArgument(arg2); | |
123 | } | |
124 | ||
125 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, GPRReg arg3) | |
126 | { | |
127 | resetCallArguments(); | |
128 | addCallArgument(arg1); | |
129 | addCallArgument(arg2); | |
130 | addCallArgument(arg3); | |
131 | } | |
132 | ||
133 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImmPtr arg4) | |
134 | { | |
135 | resetCallArguments(); | |
136 | addCallArgument(arg1); | |
137 | addCallArgument(arg2); | |
138 | addCallArgument(arg3); | |
139 | addCallArgument(arg4); | |
140 | } | |
141 | ||
142 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4, GPRReg arg5) | |
143 | { | |
144 | resetCallArguments(); | |
145 | addCallArgument(arg1); | |
146 | addCallArgument(arg2); | |
147 | addCallArgument(arg3); | |
148 | addCallArgument(arg4); | |
149 | addCallArgument(arg5); | |
150 | } | |
151 | ||
152 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4, GPRReg arg5, GPRReg arg6) | |
153 | { | |
154 | resetCallArguments(); | |
155 | addCallArgument(arg1); | |
156 | addCallArgument(arg2); | |
157 | addCallArgument(arg3); | |
158 | addCallArgument(arg4); | |
159 | addCallArgument(arg5); | |
160 | addCallArgument(arg6); | |
161 | } | |
162 | ||
93a37866 A |
163 | ALWAYS_INLINE void setupArguments(TrustedImmPtr arg1) |
164 | { | |
165 | resetCallArguments(); | |
166 | addCallArgument(arg1); | |
167 | } | |
6fe7ccc8 A |
168 | |
169 | ALWAYS_INLINE void setupArgumentsExecState() | |
170 | { | |
171 | resetCallArguments(); | |
172 | addCallArgument(GPRInfo::callFrameRegister); | |
173 | } | |
174 | ||
175 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1) | |
176 | { | |
177 | resetCallArguments(); | |
178 | addCallArgument(GPRInfo::callFrameRegister); | |
179 | addCallArgument(arg1); | |
180 | } | |
181 | ||
182 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1) | |
183 | { | |
184 | resetCallArguments(); | |
185 | addCallArgument(GPRInfo::callFrameRegister); | |
186 | addCallArgument(arg1); | |
187 | } | |
188 | ||
93a37866 A |
189 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1) |
190 | { | |
191 | resetCallArguments(); | |
192 | addCallArgument(GPRInfo::callFrameRegister); | |
193 | addCallArgument(arg1); | |
194 | } | |
195 | ||
6fe7ccc8 A |
196 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2) |
197 | { | |
198 | resetCallArguments(); | |
199 | addCallArgument(GPRInfo::callFrameRegister); | |
200 | addCallArgument(arg1); | |
201 | addCallArgument(arg2); | |
202 | } | |
203 | ||
204 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2) | |
205 | { | |
206 | resetCallArguments(); | |
207 | addCallArgument(GPRInfo::callFrameRegister); | |
208 | addCallArgument(arg1); | |
209 | addCallArgument(arg2); | |
210 | } | |
211 | ||
93a37866 A |
212 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2) |
213 | { | |
214 | resetCallArguments(); | |
215 | addCallArgument(GPRInfo::callFrameRegister); | |
216 | addCallArgument(arg1); | |
217 | addCallArgument(arg2); | |
218 | } | |
219 | ||
220 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2) | |
221 | { | |
222 | resetCallArguments(); | |
223 | addCallArgument(GPRInfo::callFrameRegister); | |
224 | addCallArgument(arg1); | |
225 | addCallArgument(arg2); | |
226 | } | |
227 | ||
228 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2) | |
229 | { | |
230 | resetCallArguments(); | |
231 | addCallArgument(GPRInfo::callFrameRegister); | |
232 | addCallArgument(arg1); | |
233 | addCallArgument(arg2); | |
234 | } | |
235 | ||
6fe7ccc8 A |
236 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2) |
237 | { | |
238 | resetCallArguments(); | |
239 | addCallArgument(GPRInfo::callFrameRegister); | |
240 | addCallArgument(arg1); | |
241 | addCallArgument(arg2); | |
242 | } | |
243 | ||
244 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2) | |
245 | { | |
246 | resetCallArguments(); | |
247 | addCallArgument(GPRInfo::callFrameRegister); | |
248 | addCallArgument(arg1); | |
249 | addCallArgument(arg2); | |
250 | } | |
251 | ||
93a37866 A |
252 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImm32 arg2) |
253 | { | |
254 | resetCallArguments(); | |
255 | addCallArgument(GPRInfo::callFrameRegister); | |
256 | addCallArgument(arg1); | |
257 | addCallArgument(arg2); | |
258 | } | |
259 | ||
81345200 A |
260 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImm32 arg2, TrustedImm32 arg3) |
261 | { | |
262 | resetCallArguments(); | |
263 | addCallArgument(GPRInfo::callFrameRegister); | |
264 | addCallArgument(arg1); | |
265 | addCallArgument(arg2); | |
266 | addCallArgument(arg3); | |
267 | } | |
268 | ||
6fe7ccc8 A |
269 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3) |
270 | { | |
271 | resetCallArguments(); | |
272 | addCallArgument(GPRInfo::callFrameRegister); | |
273 | addCallArgument(arg1); | |
274 | addCallArgument(arg2); | |
275 | addCallArgument(arg3); | |
276 | } | |
277 | ||
81345200 A |
278 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3) |
279 | { | |
280 | resetCallArguments(); | |
281 | addCallArgument(GPRInfo::callFrameRegister); | |
282 | addCallArgument(arg1); | |
283 | addCallArgument(arg2); | |
284 | addCallArgument(arg3); | |
285 | } | |
286 | ||
6fe7ccc8 A |
287 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3) |
288 | { | |
289 | resetCallArguments(); | |
290 | addCallArgument(GPRInfo::callFrameRegister); | |
291 | addCallArgument(arg1); | |
292 | addCallArgument(arg2); | |
293 | addCallArgument(arg3); | |
294 | } | |
295 | ||
93a37866 A |
296 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, GPRReg arg3) |
297 | { | |
298 | resetCallArguments(); | |
299 | addCallArgument(GPRInfo::callFrameRegister); | |
300 | addCallArgument(arg1); | |
301 | addCallArgument(arg2); | |
302 | addCallArgument(arg3); | |
303 | } | |
304 | ||
ed1e77d3 A |
305 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3) |
306 | { | |
307 | resetCallArguments(); | |
308 | addCallArgument(GPRInfo::callFrameRegister); | |
309 | addCallArgument(arg1); | |
310 | addCallArgument(arg2); | |
311 | addCallArgument(arg3); | |
312 | } | |
313 | ||
6fe7ccc8 A |
314 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3) |
315 | { | |
316 | resetCallArguments(); | |
317 | addCallArgument(GPRInfo::callFrameRegister); | |
318 | addCallArgument(arg1); | |
319 | addCallArgument(arg2); | |
320 | addCallArgument(arg3); | |
321 | } | |
322 | ||
ed1e77d3 A |
323 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImm32 arg3) |
324 | { | |
325 | resetCallArguments(); | |
326 | addCallArgument(GPRInfo::callFrameRegister); | |
327 | addCallArgument(arg1); | |
328 | addCallArgument(arg2); | |
329 | addCallArgument(arg3); | |
330 | } | |
331 | ||
332 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3) | |
333 | { | |
334 | resetCallArguments(); | |
335 | addCallArgument(GPRInfo::callFrameRegister); | |
336 | addCallArgument(arg1); | |
337 | addCallArgument(arg2); | |
338 | addCallArgument(arg3); | |
339 | } | |
340 | ||
341 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, TrustedImm32 arg5) | |
342 | { | |
343 | resetCallArguments(); | |
344 | addCallArgument(GPRInfo::callFrameRegister); | |
345 | addCallArgument(arg1); | |
346 | addCallArgument(arg2); | |
347 | addCallArgument(arg3); | |
348 | addCallArgument(arg4); | |
349 | addCallArgument(arg5); | |
350 | } | |
351 | ||
352 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, GPRReg arg5, TrustedImm32 arg6) | |
353 | { | |
354 | resetCallArguments(); | |
355 | addCallArgument(GPRInfo::callFrameRegister); | |
356 | addCallArgument(arg1); | |
357 | addCallArgument(arg2); | |
358 | addCallArgument(arg3); | |
359 | addCallArgument(arg4); | |
360 | addCallArgument(arg5); | |
361 | addCallArgument(arg6); | |
362 | } | |
363 | ||
81345200 A |
364 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3) |
365 | { | |
366 | resetCallArguments(); | |
367 | addCallArgument(GPRInfo::callFrameRegister); | |
368 | addCallArgument(arg1); | |
369 | addCallArgument(arg2); | |
370 | addCallArgument(arg3); | |
371 | } | |
372 | ||
373 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3) | |
374 | { | |
375 | resetCallArguments(); | |
376 | addCallArgument(GPRInfo::callFrameRegister); | |
377 | addCallArgument(arg1); | |
378 | addCallArgument(arg2); | |
379 | addCallArgument(arg3); | |
380 | } | |
381 | ||
382 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImmPtr arg3) | |
383 | { | |
384 | resetCallArguments(); | |
385 | addCallArgument(GPRInfo::callFrameRegister); | |
386 | addCallArgument(arg1); | |
387 | addCallArgument(arg2); | |
388 | addCallArgument(arg3); | |
389 | } | |
390 | ||
391 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, TrustedImm32 arg3) | |
392 | { | |
393 | resetCallArguments(); | |
394 | addCallArgument(GPRInfo::callFrameRegister); | |
395 | addCallArgument(arg1); | |
396 | addCallArgument(arg2); | |
397 | addCallArgument(arg3); | |
398 | } | |
399 | ||
93a37866 A |
400 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, TrustedImmPtr arg3) |
401 | { | |
402 | resetCallArguments(); | |
403 | addCallArgument(GPRInfo::callFrameRegister); | |
404 | addCallArgument(arg1); | |
405 | addCallArgument(arg2); | |
406 | addCallArgument(arg3); | |
407 | } | |
408 | ||
6fe7ccc8 A |
409 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImmPtr arg3) |
410 | { | |
411 | resetCallArguments(); | |
412 | addCallArgument(GPRInfo::callFrameRegister); | |
413 | addCallArgument(arg1); | |
414 | addCallArgument(arg2); | |
415 | addCallArgument(arg3); | |
416 | } | |
417 | ||
93a37866 A |
418 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4) |
419 | { | |
420 | resetCallArguments(); | |
421 | addCallArgument(GPRInfo::callFrameRegister); | |
422 | addCallArgument(arg1); | |
423 | addCallArgument(arg2); | |
424 | addCallArgument(arg3); | |
425 | addCallArgument(arg4); | |
426 | } | |
81345200 A |
427 | |
428 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImm32 arg2, GPRReg arg3, TrustedImmPtr arg4) | |
429 | { | |
430 | resetCallArguments(); | |
431 | addCallArgument(GPRInfo::callFrameRegister); | |
432 | addCallArgument(arg1); | |
433 | addCallArgument(arg2); | |
434 | addCallArgument(arg3); | |
435 | addCallArgument(arg4); | |
436 | } | |
437 | ||
438 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) | |
439 | { | |
440 | resetCallArguments(); | |
441 | addCallArgument(GPRInfo::callFrameRegister); | |
442 | addCallArgument(arg1); | |
443 | addCallArgument(arg2); | |
444 | addCallArgument(arg3); | |
445 | addCallArgument(arg4); | |
446 | } | |
447 | ||
448 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) | |
449 | { | |
450 | resetCallArguments(); | |
451 | addCallArgument(GPRInfo::callFrameRegister); | |
452 | addCallArgument(arg1); | |
453 | addCallArgument(arg2); | |
454 | addCallArgument(arg3); | |
455 | addCallArgument(arg4); | |
456 | addCallArgument(arg5); | |
457 | } | |
93a37866 A |
458 | |
459 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) | |
460 | { | |
461 | resetCallArguments(); | |
462 | addCallArgument(GPRInfo::callFrameRegister); | |
463 | addCallArgument(arg1); | |
464 | addCallArgument(arg2); | |
465 | addCallArgument(arg3); | |
466 | addCallArgument(arg4); | |
467 | addCallArgument(arg5); | |
468 | } | |
469 | ||
ed1e77d3 A |
470 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4) |
471 | { | |
472 | resetCallArguments(); | |
473 | addCallArgument(GPRInfo::callFrameRegister); | |
474 | addCallArgument(arg1); | |
475 | addCallArgument(arg2); | |
476 | addCallArgument(arg3); | |
477 | addCallArgument(arg4); | |
478 | } | |
479 | ||
480 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) | |
481 | { | |
482 | resetCallArguments(); | |
483 | addCallArgument(GPRInfo::callFrameRegister); | |
484 | addCallArgument(arg1); | |
485 | addCallArgument(arg2); | |
486 | addCallArgument(arg3); | |
487 | addCallArgument(arg4); | |
488 | addCallArgument(arg5); | |
489 | } | |
490 | ||
6fe7ccc8 A |
491 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) |
492 | { | |
493 | resetCallArguments(); | |
494 | addCallArgument(GPRInfo::callFrameRegister); | |
495 | addCallArgument(arg1); | |
496 | addCallArgument(arg2); | |
497 | addCallArgument(arg3); | |
498 | addCallArgument(arg4); | |
499 | } | |
500 | ||
93a37866 A |
501 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) |
502 | { | |
503 | resetCallArguments(); | |
504 | addCallArgument(GPRInfo::callFrameRegister); | |
505 | addCallArgument(arg1); | |
506 | addCallArgument(arg2); | |
507 | addCallArgument(arg3); | |
508 | addCallArgument(arg4); | |
509 | } | |
510 | ||
ed1e77d3 A |
511 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, GPRReg arg5) |
512 | { | |
513 | resetCallArguments(); | |
514 | addCallArgument(GPRInfo::callFrameRegister); | |
515 | addCallArgument(arg1); | |
516 | addCallArgument(arg2); | |
517 | addCallArgument(arg3); | |
518 | addCallArgument(arg4); | |
519 | addCallArgument(arg5); | |
520 | } | |
521 | ||
93a37866 A |
522 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3) |
523 | { | |
524 | resetCallArguments(); | |
525 | addCallArgument(GPRInfo::callFrameRegister); | |
526 | addCallArgument(arg1); | |
527 | addCallArgument(arg2); | |
528 | addCallArgument(arg3); | |
529 | } | |
530 | ||
6fe7ccc8 A |
531 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) |
532 | { | |
533 | resetCallArguments(); | |
534 | addCallArgument(GPRInfo::callFrameRegister); | |
535 | addCallArgument(arg1); | |
536 | addCallArgument(arg2); | |
537 | addCallArgument(arg3); | |
538 | addCallArgument(arg4); | |
539 | } | |
540 | ||
541 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4) | |
542 | { | |
543 | resetCallArguments(); | |
544 | addCallArgument(GPRInfo::callFrameRegister); | |
545 | addCallArgument(arg1); | |
546 | addCallArgument(arg2); | |
547 | addCallArgument(arg3); | |
548 | addCallArgument(arg4); | |
549 | } | |
550 | ||
81345200 A |
551 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4) |
552 | { | |
553 | resetCallArguments(); | |
554 | addCallArgument(GPRInfo::callFrameRegister); | |
555 | addCallArgument(arg1); | |
556 | addCallArgument(arg2); | |
557 | addCallArgument(arg3); | |
558 | addCallArgument(arg4); | |
559 | } | |
560 | ||
6fe7ccc8 A |
561 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, GPRReg arg3, GPRReg arg4) |
562 | { | |
563 | resetCallArguments(); | |
564 | addCallArgument(GPRInfo::callFrameRegister); | |
565 | addCallArgument(arg1); | |
566 | addCallArgument(arg2); | |
567 | addCallArgument(arg3); | |
568 | addCallArgument(arg4); | |
569 | } | |
570 | ||
81345200 A |
571 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) |
572 | { | |
573 | resetCallArguments(); | |
574 | addCallArgument(GPRInfo::callFrameRegister); | |
575 | addCallArgument(arg1); | |
576 | addCallArgument(arg2); | |
577 | addCallArgument(arg3); | |
578 | addCallArgument(arg4); | |
579 | } | |
580 | ||
ed1e77d3 A |
581 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) |
582 | { | |
583 | resetCallArguments(); | |
584 | addCallArgument(GPRInfo::callFrameRegister); | |
585 | addCallArgument(arg1); | |
586 | addCallArgument(arg2); | |
587 | addCallArgument(arg3); | |
588 | addCallArgument(arg4); | |
589 | addCallArgument(arg5); | |
590 | } | |
591 | ||
81345200 A |
592 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5) |
593 | { | |
594 | resetCallArguments(); | |
595 | addCallArgument(GPRInfo::callFrameRegister); | |
596 | addCallArgument(arg1); | |
597 | addCallArgument(arg2); | |
598 | addCallArgument(arg3); | |
599 | addCallArgument(arg4); | |
600 | addCallArgument(arg5); | |
601 | } | |
602 | ||
603 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, TrustedImmPtr arg6) | |
604 | { | |
605 | resetCallArguments(); | |
606 | addCallArgument(GPRInfo::callFrameRegister); | |
607 | addCallArgument(arg1); | |
608 | addCallArgument(arg2); | |
609 | addCallArgument(arg3); | |
610 | addCallArgument(arg4); | |
611 | addCallArgument(arg5); | |
612 | addCallArgument(arg6); | |
613 | } | |
614 | ||
615 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5, TrustedImmPtr arg6) | |
616 | { | |
617 | resetCallArguments(); | |
618 | addCallArgument(GPRInfo::callFrameRegister); | |
619 | addCallArgument(arg1); | |
620 | addCallArgument(arg2); | |
621 | addCallArgument(arg3); | |
622 | addCallArgument(arg4); | |
623 | addCallArgument(arg5); | |
624 | addCallArgument(arg6); | |
625 | } | |
626 | ||
627 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) | |
628 | { | |
629 | resetCallArguments(); | |
630 | addCallArgument(GPRInfo::callFrameRegister); | |
631 | addCallArgument(arg1); | |
632 | addCallArgument(arg2); | |
633 | addCallArgument(arg3); | |
634 | addCallArgument(arg4); | |
635 | } | |
636 | ||
637 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) | |
638 | { | |
639 | resetCallArguments(); | |
640 | addCallArgument(GPRInfo::callFrameRegister); | |
641 | addCallArgument(arg1); | |
642 | addCallArgument(arg2); | |
643 | addCallArgument(arg3); | |
644 | addCallArgument(arg4); | |
645 | } | |
646 | ||
647 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4) | |
648 | { | |
649 | resetCallArguments(); | |
650 | addCallArgument(GPRInfo::callFrameRegister); | |
651 | addCallArgument(arg1); | |
652 | addCallArgument(arg2); | |
653 | addCallArgument(arg3); | |
654 | addCallArgument(arg4); | |
655 | } | |
656 | ||
6fe7ccc8 A |
657 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) |
658 | { | |
659 | resetCallArguments(); | |
660 | addCallArgument(GPRInfo::callFrameRegister); | |
661 | addCallArgument(arg1); | |
662 | addCallArgument(arg2); | |
663 | addCallArgument(arg3); | |
664 | addCallArgument(arg4); | |
665 | addCallArgument(arg5); | |
666 | } | |
93a37866 | 667 | |
81345200 A |
668 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) |
669 | { | |
670 | resetCallArguments(); | |
671 | addCallArgument(GPRInfo::callFrameRegister); | |
672 | addCallArgument(arg1); | |
673 | addCallArgument(arg2); | |
674 | addCallArgument(arg3); | |
675 | addCallArgument(arg4); | |
676 | addCallArgument(arg5); | |
677 | } | |
678 | ||
679 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) | |
680 | { | |
681 | resetCallArguments(); | |
682 | addCallArgument(GPRInfo::callFrameRegister); | |
683 | addCallArgument(arg1); | |
684 | addCallArgument(arg2); | |
685 | addCallArgument(arg3); | |
686 | addCallArgument(arg4); | |
687 | addCallArgument(arg5); | |
688 | } | |
689 | ||
690 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5) | |
691 | { | |
692 | resetCallArguments(); | |
693 | addCallArgument(GPRInfo::callFrameRegister); | |
694 | addCallArgument(arg1); | |
695 | addCallArgument(arg2); | |
696 | addCallArgument(arg3); | |
697 | addCallArgument(arg4); | |
698 | addCallArgument(arg5); | |
699 | } | |
700 | ||
701 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) | |
702 | { | |
703 | resetCallArguments(); | |
704 | addCallArgument(GPRInfo::callFrameRegister); | |
705 | addCallArgument(arg1); | |
706 | addCallArgument(arg2); | |
707 | addCallArgument(arg3); | |
708 | addCallArgument(arg4); | |
709 | addCallArgument(arg5); | |
710 | } | |
711 | ||
712 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6) | |
713 | { | |
714 | resetCallArguments(); | |
715 | addCallArgument(GPRInfo::callFrameRegister); | |
716 | addCallArgument(arg1); | |
717 | addCallArgument(arg2); | |
718 | addCallArgument(arg3); | |
719 | addCallArgument(arg4); | |
720 | addCallArgument(arg5); | |
721 | addCallArgument(arg6); | |
722 | } | |
723 | ||
724 | ||
725 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, TrustedImm32 arg6) | |
726 | { | |
727 | resetCallArguments(); | |
728 | addCallArgument(GPRInfo::callFrameRegister); | |
729 | addCallArgument(arg1); | |
730 | addCallArgument(arg2); | |
731 | addCallArgument(arg3); | |
732 | addCallArgument(arg4); | |
733 | addCallArgument(arg5); | |
734 | addCallArgument(arg6); | |
735 | } | |
736 | ||
ed1e77d3 A |
737 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6, TrustedImmPtr arg7) |
738 | { | |
739 | resetCallArguments(); | |
740 | addCallArgument(GPRInfo::callFrameRegister); | |
741 | addCallArgument(arg1); | |
742 | addCallArgument(arg2); | |
743 | addCallArgument(arg3); | |
744 | addCallArgument(arg4); | |
745 | addCallArgument(arg5); | |
746 | addCallArgument(arg6); | |
747 | addCallArgument(arg7); | |
748 | } | |
749 | ||
93a37866 A |
750 | ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) |
751 | { | |
752 | resetCallArguments(); | |
753 | addCallArgument(GPRInfo::callFrameRegister); | |
754 | addCallArgument(arg1); | |
755 | addCallArgument(arg2); | |
756 | } | |
757 | ||
758 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) | |
759 | { | |
760 | resetCallArguments(); | |
761 | addCallArgument(GPRInfo::callFrameRegister); | |
762 | addCallArgument(arg1); | |
763 | addCallArgument(arg2); | |
764 | addCallArgument(arg3); | |
765 | } | |
6fe7ccc8 A |
766 | #endif // !NUMBER_OF_ARGUMENT_REGISTERS |
767 | // These methods are suitable for any calling convention that provides for | |
768 | // at least 4 argument registers, e.g. X86_64, ARMv7. | |
769 | #if NUMBER_OF_ARGUMENT_REGISTERS >= 4 | |
770 | template<GPRReg destA, GPRReg destB> | |
81345200 | 771 | void setupTwoStubArgsGPR(GPRReg srcA, GPRReg srcB) |
6fe7ccc8 A |
772 | { |
773 | // Assuming that srcA != srcB, there are 7 interesting states the registers may be in: | |
774 | // (1) both are already in arg regs, the right way around. | |
775 | // (2) both are already in arg regs, the wrong way around. | |
776 | // (3) neither are currently in arg registers. | |
777 | // (4) srcA in in its correct reg. | |
778 | // (5) srcA in in the incorrect reg. | |
779 | // (6) srcB in in its correct reg. | |
780 | // (7) srcB in in the incorrect reg. | |
781 | // | |
782 | // The trivial approach is to simply emit two moves, to put srcA in place then srcB in | |
783 | // place (the MacroAssembler will omit redundant moves). This apporach will be safe in | |
784 | // cases 1, 3, 4, 5, 6, and in cases where srcA==srcB. The two problem cases are 2 | |
785 | // (requires a swap) and 7 (must move srcB first, to avoid trampling.) | |
786 | ||
787 | if (srcB != destA) { | |
788 | // Handle the easy cases - two simple moves. | |
789 | move(srcA, destA); | |
790 | move(srcB, destB); | |
791 | } else if (srcA != destB) { | |
792 | // Handle the non-swap case - just put srcB in place first. | |
793 | move(srcB, destB); | |
794 | move(srcA, destA); | |
795 | } else | |
796 | swap(destA, destB); | |
797 | } | |
81345200 A |
798 | |
799 | template<GPRReg destA, GPRReg destB, GPRReg destC> | |
800 | void setupThreeStubArgsGPR(GPRReg srcA, GPRReg srcB, GPRReg srcC) | |
801 | { | |
802 | // If neither of srcB/srcC are in our way, then we can move srcA into place. | |
803 | // Then we can use setupTwoStubArgs to fix srcB/srcC. | |
804 | if (srcB != destA && srcC != destA) { | |
805 | move(srcA, destA); | |
806 | setupTwoStubArgsGPR<destB, destC>(srcB, srcC); | |
807 | return; | |
808 | } | |
809 | ||
810 | // If neither of srcA/srcC are in our way, then we can move srcB into place. | |
811 | // Then we can use setupTwoStubArgs to fix srcA/srcC. | |
812 | if (srcA != destB && srcC != destB) { | |
813 | move(srcB, destB); | |
814 | setupTwoStubArgsGPR<destA, destC>(srcA, srcC); | |
815 | return; | |
816 | } | |
817 | ||
818 | // If neither of srcA/srcB are in our way, then we can move srcC into place. | |
819 | // Then we can use setupTwoStubArgs to fix srcA/srcB. | |
820 | if (srcA != destC && srcB != destC) { | |
821 | move(srcC, destC); | |
822 | setupTwoStubArgsGPR<destA, destB>(srcA, srcB); | |
823 | return; | |
824 | } | |
825 | ||
826 | // If we get here, we haven't been able to move any of srcA/srcB/srcC. | |
827 | // Since all three are blocked, then all three must already be in the argument register. | |
828 | // But are they in the right ones? | |
829 | ||
830 | // First, ensure srcA is in place. | |
831 | if (srcA != destA) { | |
832 | swap(srcA, destA); | |
833 | ||
834 | // If srcA wasn't in argumentGPR1, one of srcB/srcC must be. | |
835 | ASSERT(srcB == destA || srcC == destA); | |
836 | // If srcB was in argumentGPR1 it no longer is (due to the swap). | |
837 | // Otherwise srcC must have been. Mark him as moved. | |
838 | if (srcB == destA) | |
839 | srcB = srcA; | |
840 | else | |
841 | srcC = srcA; | |
842 | } | |
843 | ||
844 | // Either srcB & srcC need swapping, or we're all done. | |
845 | ASSERT((srcB == destB || srcC == destC) | |
846 | || (srcB == destC || srcC == destB)); | |
847 | ||
848 | if (srcB != destB) | |
849 | swap(destB, destC); | |
850 | } | |
851 | ||
93a37866 | 852 | #if CPU(X86_64) || CPU(ARM64) |
6fe7ccc8 | 853 | template<FPRReg destA, FPRReg destB> |
81345200 | 854 | void setupTwoStubArgsFPR(FPRReg srcA, FPRReg srcB) |
6fe7ccc8 A |
855 | { |
856 | // Assuming that srcA != srcB, there are 7 interesting states the registers may be in: | |
857 | // (1) both are already in arg regs, the right way around. | |
858 | // (2) both are already in arg regs, the wrong way around. | |
859 | // (3) neither are currently in arg registers. | |
860 | // (4) srcA in in its correct reg. | |
861 | // (5) srcA in in the incorrect reg. | |
862 | // (6) srcB in in its correct reg. | |
863 | // (7) srcB in in the incorrect reg. | |
864 | // | |
865 | // The trivial approach is to simply emit two moves, to put srcA in place then srcB in | |
866 | // place (the MacroAssembler will omit redundant moves). This apporach will be safe in | |
867 | // cases 1, 3, 4, 5, 6, and in cases where srcA==srcB. The two problem cases are 2 | |
868 | // (requires a swap) and 7 (must move srcB first, to avoid trampling.) | |
869 | ||
870 | if (srcB != destA) { | |
871 | // Handle the easy cases - two simple moves. | |
872 | moveDouble(srcA, destA); | |
873 | moveDouble(srcB, destB); | |
874 | return; | |
875 | } | |
876 | ||
877 | if (srcA != destB) { | |
878 | // Handle the non-swap case - just put srcB in place first. | |
879 | moveDouble(srcB, destB); | |
880 | moveDouble(srcA, destA); | |
881 | return; | |
882 | } | |
883 | ||
884 | ASSERT(srcB == destA && srcA == destB); | |
885 | // Need to swap; pick a temporary register. | |
886 | FPRReg temp; | |
887 | if (destA != FPRInfo::argumentFPR3 && destA != FPRInfo::argumentFPR3) | |
888 | temp = FPRInfo::argumentFPR3; | |
889 | else if (destA != FPRInfo::argumentFPR2 && destA != FPRInfo::argumentFPR2) | |
890 | temp = FPRInfo::argumentFPR2; | |
891 | else { | |
892 | ASSERT(destA != FPRInfo::argumentFPR1 && destA != FPRInfo::argumentFPR1); | |
893 | temp = FPRInfo::argumentFPR1; | |
894 | } | |
895 | moveDouble(destA, temp); | |
896 | moveDouble(destB, destA); | |
897 | moveDouble(temp, destB); | |
898 | } | |
899 | #endif | |
900 | void setupStubArguments(GPRReg arg1, GPRReg arg2) | |
901 | { | |
81345200 | 902 | setupTwoStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2); |
6fe7ccc8 | 903 | } |
81345200 | 904 | |
6fe7ccc8 A |
905 | void setupStubArguments(GPRReg arg1, GPRReg arg2, GPRReg arg3) |
906 | { | |
81345200 | 907 | setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg1, arg2, arg3); |
6fe7ccc8 A |
908 | } |
909 | ||
93a37866 | 910 | #if CPU(X86_64) || CPU(ARM64) |
6fe7ccc8 A |
911 | ALWAYS_INLINE void setupArguments(FPRReg arg1) |
912 | { | |
913 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
914 | } | |
915 | ||
916 | ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) | |
917 | { | |
81345200 | 918 | setupTwoStubArgsFPR<FPRInfo::argumentFPR0, FPRInfo::argumentFPR1>(arg1, arg2); |
6fe7ccc8 | 919 | } |
93a37866 A |
920 | |
921 | ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) | |
922 | { | |
81345200 A |
923 | #if OS(WINDOWS) && CPU(X86_64) |
924 | // On Windows, arguments map to designated registers based on the argument positions, even when there are interlaced scalar and floating point arguments. | |
925 | // See http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx | |
926 | moveDouble(arg1, FPRInfo::argumentFPR1); | |
927 | move(arg2, GPRInfo::argumentGPR2); | |
928 | #else | |
93a37866 A |
929 | moveDouble(arg1, FPRInfo::argumentFPR0); |
930 | move(arg2, GPRInfo::argumentGPR1); | |
81345200 | 931 | #endif |
93a37866 A |
932 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); |
933 | } | |
934 | ||
935 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) | |
936 | { | |
81345200 A |
937 | #if OS(WINDOWS) && CPU(X86_64) |
938 | // On Windows, arguments map to designated registers based on the argument positions, even when there are interlaced scalar and floating point arguments. | |
939 | // See http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx | |
940 | moveDouble(arg3, FPRInfo::argumentFPR3); | |
941 | #else | |
93a37866 | 942 | moveDouble(arg3, FPRInfo::argumentFPR0); |
81345200 | 943 | #endif |
93a37866 A |
944 | setupStubArguments(arg1, arg2); |
945 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
946 | } | |
947 | #elif CPU(ARM) | |
948 | #if CPU(ARM_HARDFP) | |
949 | ALWAYS_INLINE void setupArguments(FPRReg arg1) | |
950 | { | |
951 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
952 | } | |
953 | ||
954 | ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) | |
955 | { | |
956 | if (arg2 != FPRInfo::argumentFPR0) { | |
957 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
958 | moveDouble(arg2, FPRInfo::argumentFPR1); | |
959 | } else if (arg1 != FPRInfo::argumentFPR1) { | |
960 | moveDouble(arg2, FPRInfo::argumentFPR1); | |
961 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
962 | } else { | |
963 | // Swap arg1, arg2. | |
964 | moveDouble(FPRInfo::argumentFPR0, ARMRegisters::d2); | |
965 | moveDouble(FPRInfo::argumentFPR1, FPRInfo::argumentFPR0); | |
966 | moveDouble(ARMRegisters::d2, FPRInfo::argumentFPR1); | |
967 | } | |
968 | } | |
969 | ||
970 | ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) | |
971 | { | |
972 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
973 | move(arg2, GPRInfo::argumentGPR1); | |
974 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
975 | } | |
976 | ||
977 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) | |
978 | { | |
979 | moveDouble(arg3, FPRInfo::argumentFPR0); | |
980 | setupStubArguments(arg1, arg2); | |
981 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
982 | } | |
81345200 A |
983 | |
984 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32, FPRReg arg2, GPRReg arg3) | |
985 | { | |
986 | moveDouble(arg2, FPRInfo::argumentFPR0); | |
987 | move(arg3, GPRInfo::argumentGPR1); | |
988 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
989 | } | |
990 | ||
991 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32, FPRReg arg4) | |
992 | { | |
993 | moveDouble(arg4, FPRInfo::argumentFPR0); | |
994 | setupStubArguments(arg1, arg2); | |
995 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
996 | } | |
997 | ||
6fe7ccc8 A |
998 | #else |
999 | ALWAYS_INLINE void setupArguments(FPRReg arg1) | |
1000 | { | |
1001 | assembler().vmov(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, arg1); | |
1002 | } | |
1003 | ||
1004 | ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) | |
1005 | { | |
1006 | assembler().vmov(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, arg1); | |
1007 | assembler().vmov(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3, arg2); | |
1008 | } | |
93a37866 A |
1009 | |
1010 | ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) | |
1011 | { | |
1012 | move(arg2, GPRInfo::argumentGPR3); | |
1013 | assembler().vmov(GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, arg1); | |
1014 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1015 | } | |
1016 | ||
1017 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) | |
1018 | { | |
1019 | setupStubArguments(arg1, arg2); | |
1020 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1021 | assembler().vmov(GPRInfo::argumentGPR3, GPRInfo::nonArgGPR0, arg3); | |
1022 | poke(GPRInfo::nonArgGPR0); | |
1023 | } | |
81345200 A |
1024 | |
1025 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, FPRReg arg2, GPRReg arg3) | |
1026 | { | |
1027 | poke(arg3, POKE_ARGUMENT_OFFSET); | |
1028 | move(arg1, GPRInfo::argumentGPR1); | |
1029 | assembler().vmov(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3, arg2); | |
1030 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1031 | } | |
1032 | ||
1033 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, FPRReg arg4) | |
1034 | { | |
1035 | setupStubArguments(arg1, arg2); | |
1036 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1037 | move(arg3, GPRInfo::argumentGPR3); | |
1038 | assembler().vmov(GPRInfo::nonArgGPR0, GPRInfo::nonArgGPR1, arg4); | |
1039 | poke(GPRInfo::nonArgGPR0, POKE_ARGUMENT_OFFSET); | |
1040 | poke(GPRInfo::nonArgGPR1, POKE_ARGUMENT_OFFSET + 1); | |
1041 | } | |
1042 | #endif // CPU(ARM_HARDFP) | |
1043 | #elif CPU(MIPS) | |
1044 | ALWAYS_INLINE void setupArguments(FPRReg arg1) | |
1045 | { | |
1046 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
1047 | } | |
1048 | ||
1049 | ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) | |
1050 | { | |
1051 | if (arg2 != FPRInfo::argumentFPR0) { | |
1052 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
1053 | moveDouble(arg2, FPRInfo::argumentFPR1); | |
1054 | } else if (arg1 != FPRInfo::argumentFPR1) { | |
1055 | moveDouble(arg2, FPRInfo::argumentFPR1); | |
1056 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
1057 | } else { | |
1058 | // Swap arg1, arg2. | |
1059 | swapDouble(FPRInfo::argumentFPR0, FPRInfo::argumentFPR1); | |
1060 | } | |
1061 | } | |
1062 | ||
1063 | ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) | |
1064 | { | |
1065 | assembler().vmov(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3, arg1); | |
1066 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1067 | poke(arg2, 4); | |
1068 | } | |
1069 | ||
1070 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) | |
1071 | { | |
1072 | setupStubArguments(arg1, arg2); | |
1073 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1074 | poke(arg3, 4); | |
1075 | } | |
1076 | ||
1077 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, FPRReg arg2, GPRReg arg3) | |
1078 | { | |
1079 | setupArgumentsWithExecState(arg2, arg3); | |
1080 | } | |
1081 | ||
1082 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, FPRReg arg4) | |
1083 | { | |
1084 | setupArgumentsWithExecState(arg1, arg2, arg4); | |
1085 | } | |
1086 | #elif CPU(SH4) | |
93a37866 A |
1087 | ALWAYS_INLINE void setupArguments(FPRReg arg1) |
1088 | { | |
1089 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
1090 | } | |
1091 | ||
1092 | ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) | |
1093 | { | |
1094 | if (arg2 != FPRInfo::argumentFPR0) { | |
1095 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
1096 | moveDouble(arg2, FPRInfo::argumentFPR1); | |
1097 | } else if (arg1 != FPRInfo::argumentFPR1) { | |
1098 | moveDouble(arg2, FPRInfo::argumentFPR1); | |
1099 | moveDouble(arg1, FPRInfo::argumentFPR0); | |
81345200 | 1100 | } else |
93a37866 | 1101 | swapDouble(FPRInfo::argumentFPR0, FPRInfo::argumentFPR1); |
93a37866 A |
1102 | } |
1103 | ||
1104 | ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) | |
1105 | { | |
81345200 A |
1106 | moveDouble(arg1, FPRInfo::argumentFPR0); |
1107 | move(arg2, GPRInfo::argumentGPR1); | |
93a37866 | 1108 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); |
93a37866 A |
1109 | } |
1110 | ||
1111 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) | |
1112 | { | |
81345200 | 1113 | moveDouble(arg3, FPRInfo::argumentFPR0); |
93a37866 A |
1114 | setupStubArguments(arg1, arg2); |
1115 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
93a37866 A |
1116 | } |
1117 | #else | |
81345200 | 1118 | #error "JIT not supported on this platform." |
6fe7ccc8 A |
1119 | #endif |
1120 | ||
1121 | ALWAYS_INLINE void setupArguments(GPRReg arg1) | |
1122 | { | |
1123 | move(arg1, GPRInfo::argumentGPR0); | |
1124 | } | |
1125 | ||
81345200 A |
1126 | ALWAYS_INLINE void setupArguments(TrustedImmPtr arg1, GPRReg arg2) |
1127 | { | |
1128 | move(arg2, GPRInfo::argumentGPR1); | |
1129 | move(arg1, GPRInfo::argumentGPR0); | |
1130 | } | |
1131 | ||
6fe7ccc8 A |
1132 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2) |
1133 | { | |
81345200 A |
1134 | setupTwoStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1>(arg1, arg2); |
1135 | } | |
1136 | ||
1137 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, GPRReg arg3) | |
1138 | { | |
1139 | setupThreeStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2, arg3); | |
1140 | } | |
1141 | ||
1142 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImmPtr arg4) | |
1143 | { | |
1144 | setupTwoStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1>(arg1, arg2); | |
1145 | move(arg3, GPRInfo::argumentGPR2); | |
1146 | move(arg4, GPRInfo::argumentGPR3); | |
6fe7ccc8 | 1147 | } |
93a37866 | 1148 | |
81345200 A |
1149 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) |
1150 | { | |
1151 | setupThreeStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, GPRInfo::argumentGPR2>(arg1, arg2, arg3); | |
1152 | move(arg4, GPRInfo::argumentGPR3); | |
1153 | } | |
1154 | ||
1155 | ALWAYS_INLINE void setupArguments(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImmPtr arg4) | |
1156 | { | |
1157 | setupTwoStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR2>(arg1, arg3); | |
1158 | move(arg2, GPRInfo::argumentGPR1); | |
1159 | move(arg4, GPRInfo::argumentGPR3); | |
1160 | } | |
1161 | ||
1162 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4, GPRReg arg5, GPRReg arg6) | |
1163 | { | |
1164 | poke(arg6, POKE_ARGUMENT_OFFSET + 1); | |
1165 | poke(arg5, POKE_ARGUMENT_OFFSET); | |
1166 | setupTwoStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1>(arg1, arg2); | |
1167 | move(arg3, GPRInfo::argumentGPR2); | |
1168 | move(arg4, GPRInfo::argumentGPR3); | |
1169 | } | |
1170 | ||
93a37866 A |
1171 | ALWAYS_INLINE void setupArguments(TrustedImmPtr arg1) |
1172 | { | |
1173 | move(arg1, GPRInfo::argumentGPR0); | |
1174 | } | |
6fe7ccc8 A |
1175 | |
1176 | ALWAYS_INLINE void setupArgumentsExecState() | |
1177 | { | |
1178 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1179 | } | |
1180 | ||
1181 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1) | |
1182 | { | |
1183 | move(arg1, GPRInfo::argumentGPR1); | |
1184 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1185 | } | |
1186 | ||
1187 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1) | |
1188 | { | |
1189 | move(arg1, GPRInfo::argumentGPR1); | |
1190 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1191 | } | |
1192 | ||
93a37866 A |
1193 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1) |
1194 | { | |
1195 | move(arg1, GPRInfo::argumentGPR1); | |
1196 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1197 | } | |
1198 | ||
81345200 A |
1199 | #if OS(WINDOWS) && CPU(X86_64) |
1200 | ALWAYS_INLINE void setupArgumentsWithExecStateForCallWithSlowPathReturnType(TrustedImm32 arg1) | |
1201 | { | |
1202 | move(arg1, GPRInfo::argumentGPR2); | |
1203 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); | |
1204 | } | |
1205 | #endif | |
1206 | ||
6fe7ccc8 A |
1207 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2) |
1208 | { | |
1209 | setupStubArguments(arg1, arg2); | |
1210 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1211 | } | |
1212 | ||
1213 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2) | |
1214 | { | |
1215 | move(arg1, GPRInfo::argumentGPR1); | |
1216 | move(arg2, GPRInfo::argumentGPR2); | |
1217 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1218 | } | |
93a37866 A |
1219 | #if CPU(X86_64) || CPU(ARM64) |
1220 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm64 arg2) | |
1221 | { | |
1222 | move(arg1, GPRInfo::argumentGPR1); | |
1223 | move(arg2, GPRInfo::argumentGPR2); | |
1224 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1225 | } | |
1226 | ||
1227 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm64 arg1, GPRReg arg2) | |
1228 | { | |
1229 | move(arg2, GPRInfo::argumentGPR2); // Move this first, so setting arg1 does not trample! | |
1230 | move(arg1, GPRInfo::argumentGPR1); | |
1231 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1232 | } | |
1233 | #endif | |
1234 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2) | |
1235 | { | |
1236 | move(arg1, GPRInfo::argumentGPR1); | |
1237 | move(arg2, GPRInfo::argumentGPR2); | |
1238 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1239 | } | |
6fe7ccc8 A |
1240 | |
1241 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, ImmPtr arg2) | |
1242 | { | |
1243 | move(arg1, GPRInfo::argumentGPR1); | |
1244 | move(arg2, GPRInfo::argumentGPR2); | |
1245 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1246 | } | |
1247 | ||
1248 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2) | |
1249 | { | |
1250 | move(arg2, GPRInfo::argumentGPR2); // Move this first, so setting arg1 does not trample! | |
1251 | move(arg1, GPRInfo::argumentGPR1); | |
1252 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1253 | } | |
1254 | ||
93a37866 A |
1255 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2) |
1256 | { | |
1257 | move(arg2, GPRInfo::argumentGPR2); // Move this first, so setting arg1 does not trample! | |
1258 | move(arg1, GPRInfo::argumentGPR1); | |
1259 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1260 | } | |
1261 | ||
6fe7ccc8 A |
1262 | ALWAYS_INLINE void setupArgumentsWithExecState(ImmPtr arg1, GPRReg arg2) |
1263 | { | |
1264 | move(arg2, GPRInfo::argumentGPR2); // Move this first, so setting arg1 does not trample! | |
1265 | move(arg1, GPRInfo::argumentGPR1); | |
1266 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1267 | } | |
1268 | ||
1269 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2) | |
1270 | { | |
1271 | move(arg1, GPRInfo::argumentGPR1); | |
1272 | move(arg2, GPRInfo::argumentGPR2); | |
1273 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1274 | } | |
1275 | ||
1276 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2) | |
1277 | { | |
1278 | move(arg1, GPRInfo::argumentGPR1); | |
1279 | move(arg2, GPRInfo::argumentGPR2); | |
1280 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1281 | } | |
1282 | ||
93a37866 A |
1283 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImm32 arg2) |
1284 | { | |
1285 | move(arg1, GPRInfo::argumentGPR1); | |
1286 | move(arg2, GPRInfo::argumentGPR2); | |
1287 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1288 | } | |
1289 | ||
81345200 A |
1290 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImm32 arg2, TrustedImm32 arg3) |
1291 | { | |
1292 | move(arg1, GPRInfo::argumentGPR1); | |
1293 | move(arg2, GPRInfo::argumentGPR2); | |
1294 | move(arg3, GPRInfo::argumentGPR3); | |
1295 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1296 | } | |
1297 | ||
6fe7ccc8 A |
1298 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3) |
1299 | { | |
1300 | setupStubArguments(arg1, arg2, arg3); | |
1301 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1302 | } | |
1303 | ||
1304 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3) | |
1305 | { | |
1306 | setupStubArguments(arg1, arg2); | |
1307 | move(arg3, GPRInfo::argumentGPR3); | |
1308 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1309 | } | |
1310 | ||
93a37866 A |
1311 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, GPRReg arg3) |
1312 | { | |
81345200 A |
1313 | setupTwoStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR3>(arg1, arg3); |
1314 | move(arg2, GPRInfo::argumentGPR2); | |
1315 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1316 | } | |
1317 | ||
1318 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3) | |
1319 | { | |
1320 | setupTwoStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR3>(arg1, arg3); | |
93a37866 A |
1321 | move(arg2, GPRInfo::argumentGPR2); |
1322 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1323 | } | |
1324 | ||
6fe7ccc8 A |
1325 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImmPtr arg3) |
1326 | { | |
1327 | move(arg1, GPRInfo::argumentGPR1); | |
1328 | move(arg2, GPRInfo::argumentGPR2); | |
1329 | move(arg3, GPRInfo::argumentGPR3); | |
1330 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1331 | } | |
1332 | ||
93a37866 A |
1333 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3) |
1334 | { | |
1335 | move(arg1, GPRInfo::argumentGPR1); | |
1336 | move(arg2, GPRInfo::argumentGPR2); | |
1337 | move(arg3, GPRInfo::argumentGPR3); | |
1338 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1339 | } | |
81345200 A |
1340 | |
1341 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImm32 arg2, TrustedImm32 arg3) | |
1342 | { | |
1343 | move(arg1, GPRInfo::argumentGPR1); | |
1344 | move(arg2, GPRInfo::argumentGPR2); | |
1345 | move(arg3, GPRInfo::argumentGPR3); | |
1346 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1347 | } | |
93a37866 | 1348 | |
6fe7ccc8 A |
1349 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImmPtr arg3) |
1350 | { | |
1351 | move(arg1, GPRInfo::argumentGPR1); | |
1352 | move(arg2, GPRInfo::argumentGPR2); | |
1353 | move(arg3, GPRInfo::argumentGPR3); | |
1354 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1355 | } | |
1356 | ||
1357 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3) | |
1358 | { | |
1359 | setupStubArguments(arg1, arg2); | |
1360 | move(arg3, GPRInfo::argumentGPR3); | |
1361 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1362 | } | |
1363 | ||
1364 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, GPRReg arg3) | |
93a37866 A |
1365 | { |
1366 | move(arg3, GPRInfo::argumentGPR3); | |
1367 | move(arg1, GPRInfo::argumentGPR1); | |
1368 | move(arg2, GPRInfo::argumentGPR2); | |
1369 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1370 | } | |
1371 | ||
ed1e77d3 A |
1372 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, GPRReg arg3) |
1373 | { | |
1374 | move(arg3, GPRInfo::argumentGPR3); | |
1375 | move(arg1, GPRInfo::argumentGPR1); | |
1376 | move(arg2, GPRInfo::argumentGPR2); | |
1377 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1378 | } | |
1379 | ||
93a37866 A |
1380 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3) |
1381 | { | |
1382 | move(arg3, GPRInfo::argumentGPR3); | |
1383 | move(arg1, GPRInfo::argumentGPR1); | |
1384 | move(arg2, GPRInfo::argumentGPR2); | |
1385 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1386 | } | |
1387 | ||
ed1e77d3 A |
1388 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, TrustedImm32 arg3) |
1389 | { | |
1390 | move(arg3, GPRInfo::argumentGPR3); | |
1391 | move(arg1, GPRInfo::argumentGPR1); | |
1392 | move(arg2, GPRInfo::argumentGPR2); | |
1393 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1394 | } | |
1395 | ||
93a37866 A |
1396 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3) |
1397 | { | |
1398 | move(arg2, GPRInfo::argumentGPR2); | |
1399 | move(arg1, GPRInfo::argumentGPR1); | |
1400 | move(arg3, GPRInfo::argumentGPR3); | |
1401 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1402 | } | |
1403 | ||
1404 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3) | |
1405 | { | |
81345200 A |
1406 | setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3); |
1407 | move(arg1, GPRInfo::argumentGPR1); | |
1408 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1409 | } | |
1410 | ||
1411 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3) | |
1412 | { | |
1413 | setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3); | |
1414 | move(arg1, GPRInfo::argumentGPR1); | |
1415 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1416 | } | |
1417 | ||
1418 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3) | |
1419 | { | |
1420 | move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1. | |
1421 | move(arg1, GPRInfo::argumentGPR1); | |
1422 | move(arg3, GPRInfo::argumentGPR3); | |
1423 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1424 | } | |
1425 | ||
1426 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImmPtr arg3) | |
1427 | { | |
1428 | move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1. | |
1429 | move(arg1, GPRInfo::argumentGPR1); | |
1430 | move(arg3, GPRInfo::argumentGPR3); | |
1431 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1432 | } | |
1433 | ||
1434 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, TrustedImm32 arg3) | |
1435 | { | |
93a37866 | 1436 | move(arg1, GPRInfo::argumentGPR1); |
81345200 A |
1437 | move(arg2, GPRInfo::argumentGPR2); |
1438 | move(arg3, GPRInfo::argumentGPR3); | |
93a37866 A |
1439 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); |
1440 | } | |
1441 | ||
1442 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, TrustedImmPtr arg3) | |
1443 | { | |
1444 | move(arg1, GPRInfo::argumentGPR1); | |
1445 | move(arg2, GPRInfo::argumentGPR2); | |
1446 | move(arg3, GPRInfo::argumentGPR3); | |
1447 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1448 | } | |
1449 | ||
1450 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3) | |
6fe7ccc8 A |
1451 | { |
1452 | move(arg1, GPRInfo::argumentGPR1); | |
1453 | move(arg2, GPRInfo::argumentGPR2); | |
1454 | move(arg3, GPRInfo::argumentGPR3); | |
1455 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1456 | } | |
1457 | ||
1458 | #endif // NUMBER_OF_ARGUMENT_REGISTERS >= 4 | |
1459 | // These methods are suitable for any calling convention that provides for | |
1460 | // exactly 4 argument registers, e.g. ARMv7. | |
1461 | #if NUMBER_OF_ARGUMENT_REGISTERS == 4 | |
93a37866 | 1462 | |
6fe7ccc8 A |
1463 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) |
1464 | { | |
93a37866 A |
1465 | poke(arg4, POKE_ARGUMENT_OFFSET); |
1466 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1467 | } | |
1468 | ||
1469 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) | |
1470 | { | |
1471 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1472 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1473 | } | |
1474 | ||
ed1e77d3 A |
1475 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, GPRReg arg5) |
1476 | { | |
1477 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1478 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1479 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1480 | } | |
1481 | ||
1482 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) | |
1483 | { | |
1484 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1485 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1486 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1487 | } | |
1488 | ||
81345200 A |
1489 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4) |
1490 | { | |
1491 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1492 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1493 | } | |
1494 | ||
93a37866 A |
1495 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4) |
1496 | { | |
1497 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1498 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1499 | } | |
1500 | ||
81345200 A |
1501 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) |
1502 | { | |
1503 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1504 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1505 | } | |
1506 | ||
1507 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) | |
1508 | { | |
1509 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1510 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1511 | } | |
1512 | ||
ed1e77d3 A |
1513 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4) |
1514 | { | |
1515 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1516 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1517 | } | |
1518 | ||
81345200 A |
1519 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) |
1520 | { | |
1521 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1522 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1523 | } | |
1524 | ||
ed1e77d3 A |
1525 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) |
1526 | { | |
1527 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1528 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1529 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1530 | } | |
1531 | ||
1532 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5, TrustedImm32 arg6) | |
1533 | { | |
1534 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1535 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1536 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1537 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1538 | } | |
1539 | ||
1540 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) | |
1541 | { | |
1542 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1543 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1544 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1545 | } | |
1546 | ||
81345200 A |
1547 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImmPtr arg5) |
1548 | { | |
1549 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1550 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1551 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1552 | } | |
1553 | ||
93a37866 A |
1554 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) |
1555 | { | |
1556 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1557 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
6fe7ccc8 A |
1558 | setupArgumentsWithExecState(arg1, arg2, arg3); |
1559 | } | |
1560 | ||
1561 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4) | |
1562 | { | |
93a37866 | 1563 | poke(arg4, POKE_ARGUMENT_OFFSET); |
6fe7ccc8 A |
1564 | setupArgumentsWithExecState(arg1, arg2, arg3); |
1565 | } | |
1566 | ||
81345200 A |
1567 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4, TrustedImm32 arg5) |
1568 | { | |
1569 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1570 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1571 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1572 | } | |
1573 | ||
6fe7ccc8 A |
1574 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, GPRReg arg3, GPRReg arg4) |
1575 | { | |
93a37866 | 1576 | poke(arg4, POKE_ARGUMENT_OFFSET); |
6fe7ccc8 A |
1577 | setupArgumentsWithExecState(arg1, arg2, arg3); |
1578 | } | |
1579 | ||
1580 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) | |
1581 | { | |
93a37866 | 1582 | poke(arg4, POKE_ARGUMENT_OFFSET); |
6fe7ccc8 A |
1583 | setupArgumentsWithExecState(arg1, arg2, arg3); |
1584 | } | |
1585 | ||
1586 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) | |
1587 | { | |
93a37866 A |
1588 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); |
1589 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
6fe7ccc8 A |
1590 | setupArgumentsWithExecState(arg1, arg2, arg3); |
1591 | } | |
93a37866 | 1592 | |
81345200 A |
1593 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) |
1594 | { | |
1595 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1596 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1597 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1598 | } | |
1599 | ||
93a37866 A |
1600 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4) |
1601 | { | |
1602 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1603 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1604 | } | |
1605 | ||
1606 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) | |
1607 | { | |
1608 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1609 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1610 | } | |
1611 | ||
1612 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) | |
1613 | { | |
1614 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1615 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1616 | } | |
1617 | ||
1618 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4) | |
1619 | { | |
1620 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1621 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1622 | } | |
1623 | ||
81345200 A |
1624 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) |
1625 | { | |
1626 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1627 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1628 | } | |
1629 | ||
1630 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImmPtr arg4) | |
1631 | { | |
1632 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1633 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1634 | } | |
1635 | ||
ed1e77d3 A |
1636 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4) |
1637 | { | |
1638 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1639 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1640 | } | |
1641 | ||
93a37866 A |
1642 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) |
1643 | { | |
1644 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1645 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1646 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1647 | } | |
1648 | ||
1649 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, TrustedImm32 arg5) | |
1650 | { | |
1651 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1652 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1653 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1654 | } | |
1655 | ||
1656 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) | |
1657 | { | |
1658 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1659 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1660 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1661 | } | |
1662 | ||
1663 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) | |
1664 | { | |
1665 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1666 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1667 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1668 | } | |
1669 | ||
81345200 A |
1670 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) |
1671 | { | |
1672 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1673 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1674 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1675 | } | |
1676 | ||
ed1e77d3 A |
1677 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4) |
1678 | { | |
1679 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1680 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1681 | } | |
1682 | ||
1683 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5) | |
1684 | { | |
1685 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1686 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1687 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1688 | } | |
1689 | ||
1690 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) | |
1691 | { | |
1692 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1693 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1694 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1695 | } | |
1696 | ||
93a37866 A |
1697 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImm32 arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5) |
1698 | { | |
1699 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1700 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1701 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1702 | } | |
1703 | ||
ed1e77d3 A |
1704 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) |
1705 | { | |
1706 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1707 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1708 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1709 | } | |
1710 | ||
93a37866 A |
1711 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5) |
1712 | { | |
1713 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1714 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1715 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1716 | } | |
1717 | ||
81345200 A |
1718 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, GPRReg arg4, TrustedImm32 arg5) |
1719 | { | |
1720 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1721 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1722 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1723 | } | |
1724 | ||
1725 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6) | |
1726 | { | |
1727 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1728 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1729 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1730 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1731 | } | |
1732 | ||
1733 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, TrustedImm32 arg6) | |
1734 | { | |
1735 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1736 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1737 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1738 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1739 | } | |
1740 | ||
1741 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5, TrustedImm32 arg6) | |
1742 | { | |
1743 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1744 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1745 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1746 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1747 | } | |
1748 | ||
ed1e77d3 A |
1749 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6, TrustedImmPtr arg7) |
1750 | { | |
1751 | poke(arg7, POKE_ARGUMENT_OFFSET + 3); | |
1752 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1753 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1754 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1755 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1756 | } | |
1757 | ||
81345200 A |
1758 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, GPRReg arg4, GPRReg arg5) |
1759 | { | |
1760 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1761 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1762 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1763 | } | |
1764 | ||
1765 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, TrustedImm32 arg5, TrustedImmPtr arg6) | |
1766 | { | |
1767 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1768 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1769 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1770 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1771 | } | |
1772 | ||
1773 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, TrustedImmPtr arg6) | |
1774 | { | |
1775 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1776 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1777 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1778 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1779 | } | |
1780 | ||
1781 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, TrustedImm32 arg5, TrustedImmPtr arg6) | |
1782 | { | |
1783 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1784 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1785 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1786 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1787 | } | |
1788 | ||
1789 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, TrustedImm32 arg6) | |
1790 | { | |
1791 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1792 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1793 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1794 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1795 | } | |
1796 | ||
1797 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, GPRReg arg5, GPRReg arg6) | |
1798 | { | |
1799 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1800 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1801 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1802 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1803 | } | |
1804 | ||
ed1e77d3 A |
1805 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, GPRReg arg5, TrustedImm32 arg6) |
1806 | { | |
1807 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1808 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1809 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1810 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1811 | } | |
1812 | ||
1813 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, TrustedImmPtr arg6) | |
1814 | { | |
1815 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1816 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1817 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1818 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1819 | } | |
1820 | ||
81345200 A |
1821 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6, GPRReg arg7) |
1822 | { | |
1823 | poke(arg7, POKE_ARGUMENT_OFFSET + 3); | |
1824 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1825 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1826 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1827 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1828 | } | |
1829 | ||
1830 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6, GPRReg arg7) | |
1831 | { | |
1832 | poke(arg7, POKE_ARGUMENT_OFFSET + 3); | |
1833 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1834 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1835 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1836 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1837 | } | |
1838 | ||
ed1e77d3 A |
1839 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, GPRReg arg4, GPRReg arg5, GPRReg arg6, GPRReg arg7, TrustedImmPtr arg8) |
1840 | { | |
1841 | poke(arg8, POKE_ARGUMENT_OFFSET + 4); | |
1842 | poke(arg7, POKE_ARGUMENT_OFFSET + 3); | |
1843 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1844 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1845 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1846 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1847 | } | |
1848 | ||
81345200 A |
1849 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5, GPRReg arg6, GPRReg arg7) |
1850 | { | |
1851 | poke(arg7, POKE_ARGUMENT_OFFSET + 3); | |
1852 | poke(arg6, POKE_ARGUMENT_OFFSET + 2); | |
1853 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1854 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1855 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1856 | } | |
1857 | ||
1858 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4, GPRReg arg5) | |
1859 | { | |
1860 | poke(arg5, POKE_ARGUMENT_OFFSET); | |
1861 | setupTwoStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1>(arg1, arg2); | |
1862 | move(arg3, GPRInfo::argumentGPR2); | |
1863 | move(arg4, GPRInfo::argumentGPR3); | |
1864 | } | |
ed1e77d3 A |
1865 | |
1866 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, TrustedImm32 arg5) | |
1867 | { | |
1868 | poke(arg5, POKE_ARGUMENT_OFFSET + 1); | |
1869 | poke(arg4, POKE_ARGUMENT_OFFSET); | |
1870 | setupArgumentsWithExecState(arg1, arg2, arg3); | |
1871 | } | |
6fe7ccc8 A |
1872 | #endif // NUMBER_OF_ARGUMENT_REGISTERS == 4 |
1873 | ||
93a37866 | 1874 | #if NUMBER_OF_ARGUMENT_REGISTERS >= 5 |
81345200 A |
1875 | void setupStubArguments134(GPRReg arg1, GPRReg arg3, GPRReg arg4) |
1876 | { | |
1877 | setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR3, GPRInfo::argumentGPR4>(arg1, arg3, arg4); | |
1878 | } | |
1879 | ||
ed1e77d3 A |
1880 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) |
1881 | { | |
1882 | setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg1, arg2, arg3); | |
1883 | move(arg4, GPRInfo::argumentGPR4); | |
1884 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1885 | } | |
1886 | ||
93a37866 A |
1887 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, TrustedImm32 arg3, GPRReg arg4) |
1888 | { | |
81345200 | 1889 | setupTwoStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR4>(arg1, arg4); |
93a37866 A |
1890 | move(arg2, GPRInfo::argumentGPR2); |
1891 | move(arg3, GPRInfo::argumentGPR3); | |
1892 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1893 | } | |
81345200 A |
1894 | |
1895 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4) | |
1896 | { | |
1897 | setupStubArguments134(arg1, arg3, arg4); | |
1898 | move(arg2, GPRInfo::argumentGPR2); | |
1899 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1900 | } | |
1901 | ||
1902 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImmPtr arg4) | |
1903 | { | |
1904 | setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3); | |
1905 | move(arg1, GPRInfo::argumentGPR1); | |
1906 | move(arg4, GPRInfo::argumentGPR4); | |
1907 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1908 | } | |
1909 | ||
ed1e77d3 A |
1910 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, TrustedImm32 arg3, TrustedImm32 arg4) |
1911 | { | |
1912 | move(arg2, GPRInfo::argumentGPR2); // In case arg2 is argumentGPR1. | |
1913 | move(arg1, GPRInfo::argumentGPR1); | |
1914 | move(arg3, GPRInfo::argumentGPR3); | |
1915 | move(arg4, GPRInfo::argumentGPR4); | |
1916 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1917 | } | |
1918 | ||
1919 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, TrustedImmPtr arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) | |
1920 | { | |
1921 | move(arg3, GPRInfo::argumentGPR3); | |
1922 | move(arg1, GPRInfo::argumentGPR1); | |
1923 | move(arg2, GPRInfo::argumentGPR2); | |
1924 | move(arg4, GPRInfo::argumentGPR4); | |
1925 | move(arg5, GPRInfo::argumentGPR5); | |
1926 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1927 | } | |
1928 | ||
1929 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImm32 arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4, TrustedImm32 arg5) | |
1930 | { | |
1931 | setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR4>(arg2, arg4); | |
1932 | move(arg1, GPRInfo::argumentGPR1); | |
1933 | move(arg3, GPRInfo::argumentGPR3); | |
1934 | move(arg5, GPRInfo::argumentGPR5); | |
1935 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1936 | } | |
1937 | ||
1938 | ALWAYS_INLINE void setupArgumentsWithExecState(TrustedImmPtr arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4, TrustedImm32 arg5) | |
1939 | { | |
1940 | setupTwoStubArgsGPR<GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg2, arg3); | |
1941 | move(arg1, GPRInfo::argumentGPR1); | |
1942 | move(arg4, GPRInfo::argumentGPR4); | |
1943 | move(arg5, GPRInfo::argumentGPR5); | |
1944 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1945 | } | |
1946 | ||
81345200 A |
1947 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, GPRReg arg3, TrustedImm32 arg4) |
1948 | { | |
1949 | setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg1, arg2, arg3); | |
1950 | move(arg4, GPRInfo::argumentGPR4); | |
1951 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1952 | } | |
1953 | ||
ed1e77d3 A |
1954 | ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, TrustedImm32 arg3, GPRReg arg4) |
1955 | { | |
1956 | setupThreeStubArgsGPR<GPRInfo::argumentGPR1, GPRInfo::argumentGPR2, GPRInfo::argumentGPR4>(arg1, arg2, arg4); | |
1957 | move(arg3, GPRInfo::argumentGPR3); | |
1958 | move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); | |
1959 | } | |
1960 | ||
81345200 A |
1961 | ALWAYS_INLINE void setupArguments(GPRReg arg1, TrustedImmPtr arg2, GPRReg arg3, GPRReg arg4, TrustedImmPtr arg5) |
1962 | { | |
1963 | setupThreeStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR2, GPRInfo::argumentGPR3>(arg1, arg3, arg4); | |
1964 | move(arg2, GPRInfo::argumentGPR1); | |
1965 | move(arg5, GPRInfo::argumentGPR4); | |
1966 | } | |
1967 | ||
1968 | ALWAYS_INLINE void setupArguments(GPRReg arg1, GPRReg arg2, TrustedImmPtr arg3, TrustedImm32 arg4, GPRReg arg5) | |
1969 | { | |
1970 | setupThreeStubArgsGPR<GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, GPRInfo::argumentGPR4>(arg1, arg2, arg5); | |
1971 | move(arg3, GPRInfo::argumentGPR2); | |
1972 | move(arg4, GPRInfo::argumentGPR3); | |
1973 | } | |
93a37866 | 1974 | #endif |
ed1e77d3 A |
1975 | |
1976 | void setupArguments(JSValueRegs arg1) | |
1977 | { | |
1978 | #if USE(JSVALUE64) | |
1979 | setupArguments(arg1.gpr()); | |
1980 | #else | |
1981 | setupArguments(arg1.payloadGPR(), arg1.tagGPR()); | |
1982 | #endif | |
1983 | } | |
93a37866 | 1984 | |
6fe7ccc8 A |
1985 | void setupResults(GPRReg destA, GPRReg destB) |
1986 | { | |
1987 | GPRReg srcA = GPRInfo::returnValueGPR; | |
1988 | GPRReg srcB = GPRInfo::returnValueGPR2; | |
1989 | ||
81345200 A |
1990 | if (destA == InvalidGPRReg) |
1991 | move(srcB, destB); | |
1992 | else if (destB == InvalidGPRReg) | |
1993 | move(srcA, destA); | |
1994 | else if (srcB != destA) { | |
6fe7ccc8 A |
1995 | // Handle the easy cases - two simple moves. |
1996 | move(srcA, destA); | |
1997 | move(srcB, destB); | |
1998 | } else if (srcA != destB) { | |
1999 | // Handle the non-swap case - just put srcB in place first. | |
2000 | move(srcB, destB); | |
2001 | move(srcA, destA); | |
2002 | } else | |
2003 | swap(destA, destB); | |
2004 | } | |
81345200 A |
2005 | |
2006 | void setupResults(JSValueRegs regs) | |
2007 | { | |
2008 | #if USE(JSVALUE64) | |
2009 | move(GPRInfo::returnValueGPR, regs.gpr()); | |
2010 | #else | |
2011 | setupResults(regs.payloadGPR(), regs.tagGPR()); | |
2012 | #endif | |
2013 | } | |
2014 | ||
2015 | void jumpToExceptionHandler() | |
2016 | { | |
2017 | // genericUnwind() leaves the handler CallFrame* in vm->callFrameForThrow, | |
ed1e77d3 | 2018 | // the topVMEntryFrame for the handler in vm->vmEntryFrameForThrow, |
81345200 A |
2019 | // and the address of the handler in vm->targetMachinePCForThrow. |
2020 | loadPtr(&vm()->targetMachinePCForThrow, GPRInfo::regT1); | |
2021 | jump(GPRInfo::regT1); | |
2022 | } | |
6fe7ccc8 A |
2023 | }; |
2024 | ||
81345200 | 2025 | } // namespace JSC |
6fe7ccc8 | 2026 | |
81345200 | 2027 | #endif // ENABLE(JIT) |
6fe7ccc8 | 2028 | |
81345200 | 2029 | #endif // CCallHelpers_h |
6fe7ccc8 | 2030 |