• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "ecmascript/compiler/call_signature.h"
17 
18 #if defined(__clang__)
19 #pragma clang diagnostic push
20 #pragma clang diagnostic ignored "-Wshadow"
21 #pragma clang diagnostic ignored "-Wunused-parameter"
22 #elif defined(__GNUC__)
23 #pragma GCC diagnostic push
24 #pragma GCC diagnostic ignored "-Wshadow"
25 #pragma GCC diagnostic ignored "-Wunused-parameter"
26 #endif
27 
28 #include "llvm-c/Core.h"
29 #include "llvm/Support/Host.h"
30 
31 #if defined(__clang__)
32 #pragma clang diagnostic pop
33 #elif defined(__GNUC__)
34 #pragma GCC diagnostic pop
35 #endif
36 
37 namespace panda::ecmascript::kungfu {
38 #define BINARY_CALL_SIGNATURE(name)                             \
39     /* 3 : 3 input parameters */                                \
40     CallSignature signature(#name, 0, 3,                        \
41         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); \
42     *callSign = signature;                                      \
43     /* 3 : 3 input parameters */                                \
44     std::array<VariableType, 3> params = {                      \
45         VariableType::NATIVE_POINTER(),                         \
46         VariableType::JS_ANY(),                                 \
47         VariableType::JS_ANY(),                                 \
48     };                                                          \
49     callSign->SetParameters(params.data());                     \
50     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
51 
DEF_CALL_SIGNATURE(Add)52 DEF_CALL_SIGNATURE(Add)
53 {
54     BINARY_CALL_SIGNATURE(Add)
55 }
56 
DEF_CALL_SIGNATURE(Sub)57 DEF_CALL_SIGNATURE(Sub)
58 {
59     BINARY_CALL_SIGNATURE(Sub)
60 }
61 
DEF_CALL_SIGNATURE(Mul)62 DEF_CALL_SIGNATURE(Mul)
63 {
64     BINARY_CALL_SIGNATURE(Mul)
65 }
66 
DEF_CALL_SIGNATURE(Div)67 DEF_CALL_SIGNATURE(Div)
68 {
69     BINARY_CALL_SIGNATURE(Div)
70 }
71 
DEF_CALL_SIGNATURE(Mod)72 DEF_CALL_SIGNATURE(Mod)
73 {
74     BINARY_CALL_SIGNATURE(Mod)
75 }
76 
DEF_CALL_SIGNATURE(Equal)77 DEF_CALL_SIGNATURE(Equal)
78 {
79     BINARY_CALL_SIGNATURE(Equal)
80 }
81 
DEF_CALL_SIGNATURE(NotEqual)82 DEF_CALL_SIGNATURE(NotEqual)
83 {
84     BINARY_CALL_SIGNATURE(NotEqual)
85 }
86 
DEF_CALL_SIGNATURE(StrictEqual)87 DEF_CALL_SIGNATURE(StrictEqual)
88 {
89     BINARY_CALL_SIGNATURE(StrictEqual)
90 }
91 
DEF_CALL_SIGNATURE(StrictNotEqual)92 DEF_CALL_SIGNATURE(StrictNotEqual)
93 {
94     BINARY_CALL_SIGNATURE(StrictNotEqual)
95 }
96 
DEF_CALL_SIGNATURE(Less)97 DEF_CALL_SIGNATURE(Less)
98 {
99     BINARY_CALL_SIGNATURE(Less)
100 }
101 
DEF_CALL_SIGNATURE(LessEq)102 DEF_CALL_SIGNATURE(LessEq)
103 {
104     BINARY_CALL_SIGNATURE(LessEq)
105 }
106 
DEF_CALL_SIGNATURE(Greater)107 DEF_CALL_SIGNATURE(Greater)
108 {
109     BINARY_CALL_SIGNATURE(Greater)
110 }
111 
DEF_CALL_SIGNATURE(GreaterEq)112 DEF_CALL_SIGNATURE(GreaterEq)
113 {
114     BINARY_CALL_SIGNATURE(GreaterEq)
115 }
116 
DEF_CALL_SIGNATURE(Shl)117 DEF_CALL_SIGNATURE(Shl)
118 {
119     BINARY_CALL_SIGNATURE(Shl)
120 }
121 
DEF_CALL_SIGNATURE(Shr)122 DEF_CALL_SIGNATURE(Shr)
123 {
124     BINARY_CALL_SIGNATURE(Shr)
125 }
126 
DEF_CALL_SIGNATURE(Ashr)127 DEF_CALL_SIGNATURE(Ashr)
128 {
129     BINARY_CALL_SIGNATURE(Ashr)
130 }
131 
DEF_CALL_SIGNATURE(And)132 DEF_CALL_SIGNATURE(And)
133 {
134     BINARY_CALL_SIGNATURE(And)
135 }
136 
DEF_CALL_SIGNATURE(Or)137 DEF_CALL_SIGNATURE(Or)
138 {
139     BINARY_CALL_SIGNATURE(Or)
140 }
141 
DEF_CALL_SIGNATURE(Xor)142 DEF_CALL_SIGNATURE(Xor)
143 {
144     BINARY_CALL_SIGNATURE(Xor)
145 }
146 
147 #ifndef NDEBUG
DEF_CALL_SIGNATURE(MulGCTest)148 DEF_CALL_SIGNATURE(MulGCTest)
149 {
150     // 3 : 3 input parameters
151     CallSignature MulGC("MulGCTest", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
152     *callSign = MulGC;
153     // 3 : 3 input parameters
154     std::array<VariableType, 3> params = {
155         VariableType::NATIVE_POINTER(),
156         VariableType::INT64(),
157         VariableType::INT64(),
158     };
159     callSign->SetParameters(params.data());
160     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
161 }
162 #else
DEF_CALL_SIGNATURE(MulGCTest)163 DEF_CALL_SIGNATURE(MulGCTest) {}
164 #endif
165 
166 #define UNARY_CALL_SIGNATURE(name)                              \
167     /* 2 : 2 input parameters */                                \
168     CallSignature signature(#name, 0, 2,                        \
169         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); \
170     *callSign = signature;                                      \
171     /* 2 : 2 input parameters */                                \
172     std::array<VariableType, 2> params = {                      \
173         VariableType::NATIVE_POINTER(),                         \
174         VariableType::JS_ANY(),                                 \
175     };                                                          \
176     callSign->SetParameters(params.data());                     \
177     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
178 
DEF_CALL_SIGNATURE(Inc)179 DEF_CALL_SIGNATURE(Inc)
180 {
181     UNARY_CALL_SIGNATURE(Inc)
182 }
183 
DEF_CALL_SIGNATURE(Dec)184 DEF_CALL_SIGNATURE(Dec)
185 {
186     UNARY_CALL_SIGNATURE(Dec)
187 }
188 
DEF_CALL_SIGNATURE(Neg)189 DEF_CALL_SIGNATURE(Neg)
190 {
191     UNARY_CALL_SIGNATURE(Neg)
192 }
193 
DEF_CALL_SIGNATURE(Not)194 DEF_CALL_SIGNATURE(Not)
195 {
196     UNARY_CALL_SIGNATURE(Not)
197 }
198 
DEF_CALL_SIGNATURE(ToBoolean)199 DEF_CALL_SIGNATURE(ToBoolean)
200 {
201     UNARY_CALL_SIGNATURE(ToBoolean)
202 }
203 
DEF_CALL_SIGNATURE(TypeOf)204 DEF_CALL_SIGNATURE(TypeOf)
205 {
206     // 2 input parameters
207     CallSignature TypeOf("TypeOf", 0, 2, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_POINTER());
208     *callSign = TypeOf;
209     // 2 input parameters
210     std::array<VariableType, 2> params = {
211         VariableType::NATIVE_POINTER(), // glue
212         VariableType::JS_ANY(), // ACC
213     };
214     callSign->SetParameters(params.data());
215     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
216 }
217 
DEF_CALL_SIGNATURE(SetPropertyByName)218 DEF_CALL_SIGNATURE(SetPropertyByName)
219 {
220     // 6 : 6 input parameters
221     CallSignature setPropertyByName("SetPropertyByName", 0, 6, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
222     *callSign = setPropertyByName;
223     // 6 : 6 input parameters
224     std::array<VariableType, 6> params = {
225         VariableType::NATIVE_POINTER(),   // glue
226         VariableType::JS_ANY(),           // receiver
227         VariableType::INT64(),            // key
228         VariableType::JS_ANY(),           // value
229         VariableType::JS_ANY(),           // jsFunc
230         VariableType::INT32(),            // slot id
231     };
232     callSign->SetParameters(params.data());
233     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
234 }
235 
DEF_CALL_SIGNATURE(DeprecatedSetPropertyByName)236 DEF_CALL_SIGNATURE(DeprecatedSetPropertyByName)
237 {
238     // 4 : 4 input parameters
239     CallSignature setPropertyByName("DeprecatedSetPropertyByName", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
240         VariableType::JS_ANY());
241     *callSign = setPropertyByName;
242     // 4 : 4 input parameters
243     std::array<VariableType, 4> params = {
244         VariableType::NATIVE_POINTER(),
245         VariableType::JS_POINTER(),
246         VariableType::JS_POINTER(),
247         VariableType::JS_ANY()
248     };
249     callSign->SetParameters(params.data());
250     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
251 }
252 
DEF_CALL_SIGNATURE(SetPropertyByNameWithOwn)253 DEF_CALL_SIGNATURE(SetPropertyByNameWithOwn)
254 {
255     // 4 : 4 input parameters
256     CallSignature setPropertyByNameWithOwn("SetPropertyByNameWithOwn", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
257         VariableType::JS_ANY());
258     *callSign = setPropertyByNameWithOwn;
259     // 4 : 4 input parameters
260     std::array<VariableType, 4> params = {
261         VariableType::NATIVE_POINTER(),
262         VariableType::JS_POINTER(),
263         VariableType::JS_POINTER(),
264         VariableType::JS_ANY()
265     };
266     callSign->SetParameters(params.data());
267     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
268 }
269 
DEF_CALL_SIGNATURE(SetPropertyByValue)270 DEF_CALL_SIGNATURE(SetPropertyByValue)
271 {
272     // 6 : 6 input parameters
273     CallSignature setPropertyByName("SetPropertyByValue", 0, 6, ArgumentsOrder::DEFAULT_ORDER,
274         VariableType::JS_ANY());
275     *callSign = setPropertyByName;
276     // 6 : 6 input parameters
277     std::array<VariableType, 6> params = {
278         VariableType::NATIVE_POINTER(),    // glue
279         VariableType::JS_POINTER(),        // receiver
280         VariableType::JS_ANY(),            // key
281         VariableType::JS_ANY(),            // value
282         VariableType::JS_ANY(),            // jsFunc
283         VariableType::INT32(),             // slot id
284     };
285     callSign->SetParameters(params.data());
286     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
287 }
288 
DEF_CALL_SIGNATURE(DeprecatedSetPropertyByValue)289 DEF_CALL_SIGNATURE(DeprecatedSetPropertyByValue)
290 {
291     // 4 : 4 input parameters
292     CallSignature setPropertyByName("DeprecatedSetPropertyByValue", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
293         VariableType::JS_ANY());
294     *callSign = setPropertyByName;
295     // 4 : 4 input parameters
296     std::array<VariableType, 4> params = {
297         VariableType::NATIVE_POINTER(),
298         VariableType::JS_POINTER(),
299         VariableType::JS_ANY(),
300         VariableType::JS_ANY()
301     };
302     callSign->SetParameters(params.data());
303     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
304 }
305 
DEF_CALL_SIGNATURE(SetPropertyByValueWithOwn)306 DEF_CALL_SIGNATURE(SetPropertyByValueWithOwn)
307 {
308     // 4 : 4 input parameters
309     CallSignature setPropertyByValueWithOwn("SetPropertyByValueWithOwn", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
310         VariableType::JS_ANY());
311     *callSign = setPropertyByValueWithOwn;
312     // 4 : 4 input parameters
313     std::array<VariableType, 4> params = {
314         VariableType::NATIVE_POINTER(),
315         VariableType::JS_POINTER(),
316         VariableType::JS_ANY(),
317         VariableType::JS_ANY()
318     };
319     callSign->SetParameters(params.data());
320     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
321 }
322 
DEF_CALL_SIGNATURE(GetPropertyByName)323 DEF_CALL_SIGNATURE(GetPropertyByName)
324 {
325     // 5 : 5 input parameters
326     CallSignature getPropertyByName("GetPropertyByName", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
327     *callSign = getPropertyByName;
328     // 5 : 5 input parameters
329     std::array<VariableType, 5> params = {
330         VariableType::NATIVE_POINTER(),   // glue
331         VariableType::JS_ANY(),           // receiver
332         VariableType::INT64(),            // key
333         VariableType::JS_ANY(),           // jsFunc
334         VariableType::INT32(),            // slot id
335     };
336     callSign->SetParameters(params.data());
337     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
338 }
339 
DEF_CALL_SIGNATURE(Instanceof)340 DEF_CALL_SIGNATURE(Instanceof)
341 {
342     // 5 : 5 input parameters
343     CallSignature instanceof("Instanceof", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
344     *callSign = instanceof;
345     // 5 : 5 input parameters
346     std::array<VariableType, 5> params = {
347         VariableType::NATIVE_POINTER(),   // glue
348         VariableType::JS_ANY(),           // object
349         VariableType::JS_ANY(),           // target
350         VariableType::JS_ANY(),           // jsFunc
351         VariableType::INT32(),            // slot id
352     };
353     callSign->SetParameters(params.data());
354     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
355 }
356 
DEF_CALL_SIGNATURE(DeprecatedGetPropertyByName)357 DEF_CALL_SIGNATURE(DeprecatedGetPropertyByName)
358 {
359     // 3 : 3 input parameters
360     CallSignature getPropertyByName("DeprecatedGetPropertyByName", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
361         VariableType::JS_ANY());
362     *callSign = getPropertyByName;
363     // 3 : 3 input parameters
364     std::array<VariableType, 3> params = {
365         VariableType::NATIVE_POINTER(), // glue
366         VariableType::JS_ANY(),         // receiver
367         VariableType::JS_POINTER(),     // key
368     };
369     callSign->SetParameters(params.data());
370     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
371 }
372 
DEF_CALL_SIGNATURE(TryLdGlobalByName)373 DEF_CALL_SIGNATURE(TryLdGlobalByName)
374 {
375     // 4 : 4 input parameters
376     CallSignature signature("TryLdGlobalByName", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
377     *callSign = signature;
378     // 4 : 4 input parameters
379     std::array<VariableType, 4> params = {
380         VariableType::NATIVE_POINTER(),   // glue
381         VariableType::INT64(),            // key
382         VariableType::JS_ANY(),           // jsFunc
383         VariableType::INT32(),            // slot id
384     };
385     callSign->SetParameters(params.data());
386     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
387 }
388 
DEF_CALL_SIGNATURE(TryStGlobalByName)389 DEF_CALL_SIGNATURE(TryStGlobalByName)
390 {
391     // 5 : 5 input parameters
392     CallSignature signature("TryStGlobalByName", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
393     *callSign = signature;
394     // 5 : 5 input parameters
395     std::array<VariableType, 5> params = {
396         VariableType::NATIVE_POINTER(),   // glue
397         VariableType::INT64(),            // key
398         VariableType::JS_ANY(),           // value
399         VariableType::JS_ANY(),           // jsFunc
400         VariableType::INT32(),            // slot id
401     };
402     callSign->SetParameters(params.data());
403     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
404 }
405 
DEF_CALL_SIGNATURE(LdGlobalVar)406 DEF_CALL_SIGNATURE(LdGlobalVar)
407 {
408     // 4 : 4 input parameters
409     CallSignature signature("LdGlobalVar", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
410     *callSign = signature;
411     // 4 : 4 input parameters
412     std::array<VariableType, 4> params = {
413         VariableType::NATIVE_POINTER(),   // glue
414         VariableType::INT64(),            // key
415         VariableType::JS_ANY(),           // jsFunc
416         VariableType::INT32(),            // slot id
417     };
418     callSign->SetParameters(params.data());
419     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
420 }
421 
DEF_CALL_SIGNATURE(StGlobalVar)422 DEF_CALL_SIGNATURE(StGlobalVar)
423 {
424     // 5 : 5 input parameters
425     CallSignature signature("StGlobalVar", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
426     *callSign = signature;
427     // 5 : 5 input parameters
428     std::array<VariableType, 5> params = {
429         VariableType::NATIVE_POINTER(),   // glue
430         VariableType::INT64(),            // string id
431         VariableType::JS_ANY(),           // value
432         VariableType::JS_ANY(),           // jsFunc
433         VariableType::INT32(),            // slot id
434     };
435     callSign->SetParameters(params.data());
436     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
437 }
438 
DEF_CALL_SIGNATURE(GetPropertyByIndex)439 DEF_CALL_SIGNATURE(GetPropertyByIndex)
440 {
441     // 3 : 3 input parameters
442     CallSignature getPropertyByIndex("GetPropertyByIndex", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
443         VariableType::JS_ANY());
444     *callSign = getPropertyByIndex;
445     // 3 : 3 input parameters
446     std::array<VariableType, 3> params = {
447         VariableType::NATIVE_POINTER(), // glue
448         VariableType::JS_ANY(), // receiver
449         VariableType::INT32(), // index
450     };
451     callSign->SetParameters(params.data());
452     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
453 }
454 
DEF_CALL_SIGNATURE(SetPropertyByIndex)455 DEF_CALL_SIGNATURE(SetPropertyByIndex)
456 {
457     // 4 : 4 input parameters
458     CallSignature setPropertyByIndex("SetPropertyByIndex", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
459         VariableType::JS_ANY()); // hole or undefined
460     *callSign = setPropertyByIndex;
461     // 4 : 4 input parameters
462     std::array<VariableType, 4> params = {
463         VariableType::NATIVE_POINTER(),
464         VariableType::JS_POINTER(),
465         VariableType::INT32(),
466         VariableType::JS_ANY()
467     };
468     callSign->SetParameters(params.data());
469     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
470 }
471 
DEF_CALL_SIGNATURE(SetPropertyByIndexWithOwn)472 DEF_CALL_SIGNATURE(SetPropertyByIndexWithOwn)
473 {
474     // 4 : 4 input parameters
475     CallSignature setPropertyByIndexWithOwn("SetPropertyByIndexWithOwn", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
476         VariableType::JS_ANY()); // hole or undefined
477     *callSign = setPropertyByIndexWithOwn;
478     // 4 : 4 input parameters
479     std::array<VariableType, 4> params = {
480         VariableType::NATIVE_POINTER(),
481         VariableType::JS_POINTER(),
482         VariableType::INT32(),
483         VariableType::JS_ANY()
484     };
485     callSign->SetParameters(params.data());
486     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
487 }
488 
DEF_CALL_SIGNATURE(GetPropertyByValue)489 DEF_CALL_SIGNATURE(GetPropertyByValue)
490 {
491     // 5 : 5 input parameters
492     CallSignature getPropertyByValue("GetPropertyByValue", 0, 5, ArgumentsOrder::DEFAULT_ORDER,
493                                       VariableType::JS_ANY());
494     *callSign = getPropertyByValue;
495     // 5 : 5 input parameters
496     std::array<VariableType, 5> params = {
497         VariableType::NATIVE_POINTER(),   // glue
498         VariableType::JS_POINTER(),       // receiver
499         VariableType::JS_ANY(),           // key
500         VariableType::JS_ANY(),           // jsFunc
501         VariableType::INT32(),            // slot id
502     };
503     callSign->SetParameters(params.data());
504     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
505 }
506 
DEF_CALL_SIGNATURE(DeprecatedGetPropertyByValue)507 DEF_CALL_SIGNATURE(DeprecatedGetPropertyByValue)
508 {
509     // 3 : 3 input parameters
510     CallSignature getPropertyByValue("DeprecatedGetPropertyByValue", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
511                                       VariableType::JS_ANY());
512     *callSign = getPropertyByValue;
513     // 3 : 3 input parameters
514     std::array<VariableType, 3> params = {
515         VariableType::NATIVE_POINTER(),
516         VariableType::JS_POINTER(),
517         VariableType::JS_ANY(),
518     };
519     callSign->SetParameters(params.data());
520     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
521 }
522 
DEF_CALL_SIGNATURE(TryLoadICByName)523 DEF_CALL_SIGNATURE(TryLoadICByName)
524 {
525     // 4 : 4 input parameters
526     CallSignature tryLoadICByName("TryLoadICByName", 0, 4,
527         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
528     *callSign = tryLoadICByName;
529     // 4 : 4 input parameters
530     std::array<VariableType, 4> params = {
531         VariableType::NATIVE_POINTER(),
532         VariableType::JS_ANY(),
533         VariableType::JS_ANY(),
534         VariableType::JS_ANY(),
535     };
536     callSign->SetParameters(params.data());
537     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
538 }
539 
DEF_CALL_SIGNATURE(TryLoadICByValue)540 DEF_CALL_SIGNATURE(TryLoadICByValue)
541 {
542     // 5 : 5 input parameters
543     CallSignature tryLoadICByValue("TryLoadICByValue", 0, 5,
544         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
545     *callSign = tryLoadICByValue;
546     // 5 : 5 input parameters
547     std::array<VariableType, 5> params = {
548         VariableType::NATIVE_POINTER(),
549         VariableType::JS_ANY(),
550         VariableType::JS_ANY(),
551         VariableType::JS_ANY(),
552         VariableType::JS_ANY(),
553     };
554     callSign->SetParameters(params.data());
555     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
556 }
557 
DEF_CALL_SIGNATURE(TryStoreICByName)558 DEF_CALL_SIGNATURE(TryStoreICByName)
559 {
560     // 5 : 5 input parameters
561     CallSignature tryStoreICByName("TryStoreICByName", 0, 5,
562         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // undefined or hole
563     *callSign = tryStoreICByName;
564     // 5 : 5 input parameters
565     std::array<VariableType, 5> params = {
566         VariableType::NATIVE_POINTER(),
567         VariableType::JS_POINTER(),
568         VariableType::JS_ANY(),
569         VariableType::JS_ANY(),
570         VariableType::JS_POINTER(),
571     };
572     callSign->SetParameters(params.data());
573     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
574 }
575 
DEF_CALL_SIGNATURE(TryStoreICByValue)576 DEF_CALL_SIGNATURE(TryStoreICByValue)
577 {
578     // 6 : 6 input parameters
579     CallSignature tryStoreICByValue("TryStoreICByValue", 0, 6,
580         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY()); // undefined or hole
581     *callSign = tryStoreICByValue;
582     // 6 : 6 input parameters
583     std::array<VariableType, 6> params = {
584         VariableType::NATIVE_POINTER(),
585         VariableType::JS_POINTER(),
586         VariableType::JS_ANY(),
587         VariableType::JS_ANY(),
588         VariableType::JS_ANY(),
589         VariableType::JS_POINTER(),
590     };
591     callSign->SetParameters(params.data());
592     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
593 }
594 
DEF_CALL_SIGNATURE(SetValueWithBarrier)595 DEF_CALL_SIGNATURE(SetValueWithBarrier)
596 {
597     // 4 : 4 input parameters
598     CallSignature setValueWithBarrier("SetValueWithBarrier", 0, 4, ArgumentsOrder::DEFAULT_ORDER,
599         VariableType::VOID());
600     *callSign = setValueWithBarrier;
601 
602     std::array<VariableType, 4> params = { // 4 : 4 input parameters
603         VariableType::NATIVE_POINTER(),
604         VariableType::JS_POINTER(),
605         VariableType::NATIVE_POINTER(),
606         VariableType::JS_ANY()
607     };
608     callSign->SetParameters(params.data());
609     callSign->SetGCLeafFunction(true);
610     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
611 }
612 
DEF_CALL_SIGNATURE(NewThisObjectChecked)613 DEF_CALL_SIGNATURE(NewThisObjectChecked)
614 {
615     // 2 : 2 input parameters
616     CallSignature signature("NewThisObjectChecked", 0, 2,
617         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
618     *callSign = signature;
619     // 2 : 2 input parameters
620     std::array<VariableType, 2> params = {
621         VariableType::NATIVE_POINTER(),  // glue
622         VariableType::JS_ANY(),          // ctor
623     };
624     callSign->SetParameters(params.data());
625     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
626 }
627 
DEF_CALL_SIGNATURE(ConstructorCheck)628 DEF_CALL_SIGNATURE(ConstructorCheck)
629 {
630     // 4 : 4 input parameters
631     CallSignature signature("ConstructorCheck", 0, 4,
632         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
633     *callSign = signature;
634     // 4 : 4 input parameters
635     std::array<VariableType, 4> params = {
636         VariableType::NATIVE_POINTER(),  // glue
637         VariableType::JS_ANY(),          // ctor
638         VariableType::JS_ANY(),          // result
639         VariableType::JS_ANY(),          // thisObj
640     };
641     callSign->SetParameters(params.data());
642     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
643 }
644 
DEF_CALL_SIGNATURE(CreateEmptyArray)645 DEF_CALL_SIGNATURE(CreateEmptyArray)
646 {
647     // 1 : 1 input parameters
648     CallSignature signature("CreateEmptyArray", 0, 1,
649         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
650     *callSign = signature;
651     // 1 : 1 input parameters
652     std::array<VariableType, 1> params = {
653         VariableType::NATIVE_POINTER(),  // glue
654     };
655     callSign->SetParameters(params.data());
656     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
657 }
658 
DEF_CALL_SIGNATURE(CreateArrayWithBuffer)659 DEF_CALL_SIGNATURE(CreateArrayWithBuffer)
660 {
661     // 3 : 3 input parameters
662     CallSignature signature("CreateArrayWithBuffer", 0, 3,
663         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
664     *callSign = signature;
665     // 3 : 3 input parameters
666     std::array<VariableType, 3> params = {
667         VariableType::NATIVE_POINTER(),  // glue
668         VariableType::INT32(),           // index
669         VariableType::JS_ANY(),          // jsFunc
670     };
671     callSign->SetParameters(params.data());
672     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
673 }
674 
DEF_CALL_SIGNATURE(NewJSObject)675 DEF_CALL_SIGNATURE(NewJSObject)
676 {
677     // 2 : 2 input parameters
678     CallSignature signature("NewJSObject", 0, 2,
679         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
680     *callSign = signature;
681     // 2 : 2 input parameters
682     std::array<VariableType, 2> params = {
683         VariableType::NATIVE_POINTER(),  // glue
684         VariableType::JS_ANY(),          // hclass
685     };
686     callSign->SetParameters(params.data());
687     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
688 }
689 
DEF_CALL_SIGNATURE(NewLexicalEnv)690 DEF_CALL_SIGNATURE(NewLexicalEnv)
691 {
692     // 3 : 3 input parameters
693     CallSignature signature("NewLexicalEnv", 0, 3,
694         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
695     *callSign = signature;
696     // 3 : 3 input parameters
697     std::array<VariableType, 3> params = {
698         VariableType::NATIVE_POINTER(),  // glue
699         VariableType::JS_ANY(),          // parent
700         VariableType::INT32(),           // numArgs
701     };
702     callSign->SetParameters(params.data());
703     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
704 }
705 
DEF_CALL_SIGNATURE(GetUnmapedArgs)706 DEF_CALL_SIGNATURE(GetUnmapedArgs)
707 {
708     // 2 : 2 input parameters
709     CallSignature signature("GetUnmapedArgs", 0, 2,
710         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
711     *callSign = signature;
712     // 2 : 2 input parameters
713     std::array<VariableType, 2> params = {
714         VariableType::NATIVE_POINTER(),  // glue
715         VariableType::INT32(),           // numArgs
716     };
717     callSign->SetParameters(params.data());
718     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
719 }
720 
DEF_CALL_SIGNATURE(GetTaggedArrayPtrTest)721 DEF_CALL_SIGNATURE(GetTaggedArrayPtrTest)
722 {
723     // 2 : 2 input parameters
724     CallSignature getTaggedArrayPtr("GetTaggedArrayPtrTest", 0, 2, ArgumentsOrder::DEFAULT_ORDER,
725                                      VariableType::JS_POINTER());
726     *callSign = getTaggedArrayPtr;
727     // 2 : 2 input parameters
728     std::array<VariableType, 2> params = {
729         VariableType::NATIVE_POINTER(),
730         VariableType::JS_ANY(),
731     };
732     callSign->SetParameters(params.data());
733     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
734 }
735 
DEF_CALL_SIGNATURE(Builtins)736 DEF_CALL_SIGNATURE(Builtins)
737 {
738     // 9 : 9 input parameters
739     CallSignature builtins("Builtins", 0, 9,
740         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
741     *callSign = builtins;
742     std::array<VariableType, 9> params = { // 9 : 9 input parameters
743         VariableType::NATIVE_POINTER(),    // glue
744         VariableType::NATIVE_POINTER(),    // native code
745         VariableType::JS_ANY(),            // func
746         VariableType::JS_ANY(),            // new target
747         VariableType::JS_ANY(),            // this
748         VariableType::NATIVE_POINTER(),    // argc
749         VariableType::JS_ANY(),            // arg0
750         VariableType::JS_ANY(),            // arg1
751         VariableType::JS_ANY(),            // arg2
752     };
753     callSign->SetVariadicArgs(true);
754     callSign->SetParameters(params.data());
755     callSign->SetTargetKind(CallSignature::TargetKind::BUILTINS_STUB);
756     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
757 }
758 
DEF_CALL_SIGNATURE(BuiltinsWithArgv)759 DEF_CALL_SIGNATURE(BuiltinsWithArgv)
760 {
761     // 7 : 7 input parameters
762     CallSignature builtinsWtihArgv("Builtins", 0, 7,
763         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
764     *callSign = builtinsWtihArgv;
765     std::array<VariableType, 7> params = { // 7 : 7 input parameters
766         VariableType::NATIVE_POINTER(),    // glue
767         VariableType::NATIVE_POINTER(),    // nativeCode
768         VariableType::JS_ANY(),            // func
769         VariableType::JS_ANY(),            // new target
770         VariableType::JS_ANY(),            // this
771         VariableType::NATIVE_POINTER(),    // argc
772         VariableType::NATIVE_POINTER(),    // argv
773     };
774     callSign->SetParameters(params.data());
775     callSign->SetTargetKind(CallSignature::TargetKind::BUILTINS_WITH_ARGV_STUB);
776     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
777 }
778 
DEF_CALL_SIGNATURE(BytecodeHandler)779 DEF_CALL_SIGNATURE(BytecodeHandler)
780 {
781     // 7 : 7 input parameters
782     CallSignature bytecodeHandler("BytecodeHandler", 0, 7,
783         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
784     *callSign = bytecodeHandler;
785     // 7 : 7 input parameters
786     std::array<VariableType, 7> params = {
787         VariableType::NATIVE_POINTER(),
788         VariableType::NATIVE_POINTER(),
789         VariableType::NATIVE_POINTER(),
790         VariableType::JS_POINTER(),
791         VariableType::JS_POINTER(),
792         VariableType::JS_ANY(),
793         VariableType::INT32(),
794     };
795     callSign->SetParameters(params.data());
796     callSign->SetTargetKind(CallSignature::TargetKind::BYTECODE_HANDLER);
797     callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
798 }
799 
DEF_CALL_SIGNATURE(BytecodeDebuggerHandler)800 DEF_CALL_SIGNATURE(BytecodeDebuggerHandler)
801 {
802     // 7 : 7 input parameters
803     CallSignature bytecodeHandler("BytecodeDebuggerHandler", 0, 7,
804                                   ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
805     *callSign = bytecodeHandler;
806     // 7 : 7 input parameters
807     std::array<VariableType, 7> params = { VariableType::NATIVE_POINTER(),
808                                            VariableType::NATIVE_POINTER(),
809                                            VariableType::NATIVE_POINTER(),
810                                            VariableType::JS_POINTER(),
811                                            VariableType::JS_POINTER(),
812                                            VariableType::JS_ANY(),
813                                            VariableType::INT32() };
814     callSign->SetParameters(params.data());
815     callSign->SetTargetKind(CallSignature::TargetKind::BYTECODE_DEBUGGER_HANDLER);
816 }
817 
DEF_CALL_SIGNATURE(CallRuntime)818 DEF_CALL_SIGNATURE(CallRuntime)
819 {
820     /* 3 : 3 input parameters */
821     CallSignature runtimeCallTrampoline("CallRuntime", 0, 3,
822         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
823     *callSign = runtimeCallTrampoline;
824     /* 3 : 3 input parameters */
825     std::array<VariableType, 3> params = {
826         VariableType::NATIVE_POINTER(),
827         VariableType::INT64(),
828         VariableType::INT64(),
829     };
830     callSign->SetVariadicArgs(true);
831     callSign->SetParameters(params.data());
832     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
833     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
834 }
835 
DEF_CALL_SIGNATURE(AsmInterpreterEntry)836 DEF_CALL_SIGNATURE(AsmInterpreterEntry)
837 {
838     /* 3 : 3 input parameters */
839     CallSignature asmInterpreterEntry("AsmInterpreterEntry", 0, 3,
840         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
841     *callSign = asmInterpreterEntry;
842     /* 3 : 3 input parameters */
843     std::array<VariableType, 3> params = {
844         VariableType::NATIVE_POINTER(),  // glue
845         VariableType::INT32(),  // argc
846         VariableType::NATIVE_POINTER(),  // argv
847     };
848     callSign->SetParameters(params.data());
849     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
850     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
851 }
852 
DEF_CALL_SIGNATURE(GeneratorReEnterAsmInterp)853 DEF_CALL_SIGNATURE(GeneratorReEnterAsmInterp)
854 {
855     /* 2 : 2 input parameters */
856     CallSignature generatorReEnterAsmInterp("GeneratorReEnterAsmInterp", 0, 2,
857         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
858     *callSign = generatorReEnterAsmInterp;
859     std::array<VariableType, 2> params = { /* 2 : 2 input parameters */
860         VariableType::NATIVE_POINTER(),  // glue
861         VariableType::JS_POINTER(),      // context
862     };
863     callSign->SetParameters(params.data());
864     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
865     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
866 }
867 
DEF_CALL_SIGNATURE(CallRuntimeWithArgv)868 DEF_CALL_SIGNATURE(CallRuntimeWithArgv)
869 {
870     /* 4 : 4 input parameters */
871     CallSignature runtimeCallTrampoline("CallRuntimeWithArgv", 0, 4,
872         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
873     *callSign = runtimeCallTrampoline;
874     std::array<VariableType, 4> params = { /* 4 : 4 input parameters */
875         VariableType::NATIVE_POINTER(), // glue
876         VariableType::INT64(),   // runtimeId
877         VariableType::INT64(),   // argc
878         VariableType::NATIVE_POINTER(), // argv
879     };
880     callSign->SetVariadicArgs(false);
881     callSign->SetParameters(params.data());
882     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_VARARGS);
883     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
884 }
885 
DEF_CALL_SIGNATURE(OptimizedCallAndPushUndefined)886 DEF_CALL_SIGNATURE(OptimizedCallAndPushUndefined)
887 {
888     /* 5 : 5 input parameters */
889     CallSignature optimizedCallAndPushUndefined("OptimizedCallAndPushUndefined", 0, 5,
890         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
891     *callSign = optimizedCallAndPushUndefined;
892     std::array<VariableType, 5> params = { /* 5 : 5 input parameters */
893         VariableType::NATIVE_POINTER(),     // glue
894         VariableType::INT64(),       // actual argC
895         VariableType::JS_ANY(),      // call target
896         VariableType::JS_ANY(),      // new target
897         VariableType::JS_ANY(),      // thisobj
898     };
899     callSign->SetVariadicArgs(true);
900     callSign->SetParameters(params.data());
901     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
902     callSign->SetCallConv(CallSignature::CallConv::WebKitJSCallConv);
903 }
904 
DEF_CALL_SIGNATURE(OptimizedFastCallAndPushUndefined)905 DEF_CALL_SIGNATURE(OptimizedFastCallAndPushUndefined)
906 {
907     /* 5 : 5 input parameters */
908     CallSignature optimizedFastCallAndPushUndefined("OptimizedFastCallAndPushUndefined", 0, 5,
909         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
910     *callSign = optimizedFastCallAndPushUndefined;
911     std::array<VariableType, 5> params = { /* 5 : 5 input parameters */
912         VariableType::NATIVE_POINTER(),     // glue
913         VariableType::INT64(),       // actual argC
914         VariableType::JS_ANY(),      // call target
915         VariableType::JS_ANY(),      // new target
916         VariableType::JS_ANY(),      // thisobj
917     };
918     callSign->SetVariadicArgs(true);
919     callSign->SetParameters(params.data());
920     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
921     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
922 }
923 
DEF_CALL_SIGNATURE(JSCall)924 DEF_CALL_SIGNATURE(JSCall)
925 {
926     // 6 : 6 input parameters
927     CallSignature jSCall("JSCall", 0, 5,
928         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
929     *callSign = jSCall;
930     std::array<VariableType, 5> params = { // 5 : 5 input parameters
931         VariableType::NATIVE_POINTER(),     // glue
932         VariableType::INT64(),       // actual argC
933         VariableType::JS_ANY(),      // call target
934         VariableType::JS_ANY(),      // new target
935         VariableType::JS_ANY(),      // thisobj
936     };
937     callSign->SetVariadicArgs(true);
938     callSign->SetParameters(params.data());
939     callSign->SetCallConv(CallSignature::CallConv::WebKitJSCallConv);
940     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
941 }
942 
DEF_CALL_SIGNATURE(JSOptimizedCall)943 DEF_CALL_SIGNATURE(JSOptimizedCall)
944 {
945     // 6 : 6 input parameters
946     CallSignature jSCall("JSOptimizedCall", 0, 5,
947         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
948     *callSign = jSCall;
949     std::array<VariableType, 5> params = { // 5 : 5 input parameters
950         VariableType::NATIVE_POINTER(),     // glue
951         VariableType::INT64(),       // actual argC
952         VariableType::JS_ANY(),      // call target
953         VariableType::JS_ANY(),      // new target
954         VariableType::JS_ANY(),      // thisobj
955     };
956     callSign->SetVariadicArgs(true);
957     callSign->SetParameters(params.data());
958     callSign->SetCallConv(CallSignature::CallConv::WebKitJSCallConv);
959     callSign->SetTargetKind(CallSignature::TargetKind::OPTIMIZED_STUB);
960 }
961 
DEF_CALL_SIGNATURE(JSOptimizedFastCall)962 DEF_CALL_SIGNATURE(JSOptimizedFastCall)
963 {
964     // 3 : 3 input parameters
965     CallSignature jSCall("JSOptimizedFastCall", 0, 3,
966         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
967     *callSign = jSCall;
968     std::array<VariableType, 3> params = { // 3 : 3 input parameters
969         VariableType::NATIVE_POINTER(),     // glue
970         VariableType::JS_ANY(),      // call target
971         VariableType::JS_ANY(),      // thisobj
972     };
973     callSign->SetVariadicArgs(true);
974     callSign->SetParameters(params.data());
975     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
976     callSign->SetTargetKind(CallSignature::TargetKind::OPTIMIZED_FAST_CALL_STUB);
977 }
978 
DEF_CALL_SIGNATURE(JSCallNew)979 DEF_CALL_SIGNATURE(JSCallNew)
980 {
981     // 6 : 6 input parameters
982     CallSignature jSCallNew("JSCallNew", 0, 5,
983         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
984     *callSign = jSCallNew;
985     std::array<VariableType, 5> params = { // 5 : 5 input parameters
986         VariableType::NATIVE_POINTER(),     // glue
987         VariableType::INT64(),       // actual argC
988         VariableType::JS_ANY(),      // call target
989         VariableType::JS_ANY(),      // new target
990         VariableType::JS_ANY(),      // thisobj
991     };
992     callSign->SetVariadicArgs(true);
993     callSign->SetParameters(params.data());
994     callSign->SetCallConv(CallSignature::CallConv::WebKitJSCallConv);
995     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
996 }
997 
DEF_CALL_SIGNATURE(JSProxyCallInternalWithArgV)998 DEF_CALL_SIGNATURE(JSProxyCallInternalWithArgV)
999 {
1000     // 2 : 2 input parameters
1001     CallSignature jSProxyCallInternalWithArgV("JSProxyCallInternalWithArgV", 0, 2,
1002         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1003     *callSign = jSProxyCallInternalWithArgV;
1004     std::array<VariableType, 2> params = { // 2 : 2 input parameters
1005         VariableType::NATIVE_POINTER(),     // glue
1006         VariableType::JS_ANY(),      // call target
1007     };
1008     callSign->SetParameters(params.data());
1009     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1010     callSign->SetGCLeafFunction(true);
1011     callSign->SetTailCall(true);
1012 }
1013 
DEF_CALL_SIGNATURE(JSFunctionEntry)1014 DEF_CALL_SIGNATURE(JSFunctionEntry)
1015 {
1016     // 5 : 5 input parameters
1017     CallSignature jsCallFunctionEntry("JSFunctionEntry", 0, 5,
1018         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1019     *callSign = jsCallFunctionEntry;
1020     std::array<VariableType, 5> params = {  // 5 : 5 input parameters
1021         VariableType::NATIVE_POINTER(),     // glue
1022         VariableType::INT64(),              // argc
1023         VariableType::NATIVE_POINTER(),     // argv
1024         VariableType::NATIVE_POINTER(),     // prevFp
1025         VariableType::BOOL(),               // isNew
1026     };
1027     callSign->SetParameters(params.data());
1028     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1029     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1030 }
1031 
DEF_CALL_SIGNATURE(OptimizedFastCallEntry)1032 DEF_CALL_SIGNATURE(OptimizedFastCallEntry)
1033 {
1034     // 4 : 4 input parameters
1035     CallSignature optimizedFastCallEntry("OptimizedFastCallEntry", 0, 4,
1036         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1037     *callSign = optimizedFastCallEntry;
1038     std::array<VariableType, 4> params = {  // 4 : 4 input parameters
1039         VariableType::NATIVE_POINTER(),     // glue
1040         VariableType::INT64(),              // argc
1041         VariableType::NATIVE_POINTER(),     // argv
1042         VariableType::NATIVE_POINTER(),     // prevFp
1043     };
1044     callSign->SetParameters(params.data());
1045     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1046     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1047 }
1048 
DEF_CALL_SIGNATURE(ResumeRspAndDispatch)1049 DEF_CALL_SIGNATURE(ResumeRspAndDispatch)
1050 {
1051     // 8 : 8 input parameters
1052     CallSignature resumeRspAndDispatch("ResumeRspAndDispatch", 0, 8,
1053         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1054     *callSign = resumeRspAndDispatch;
1055     std::array<VariableType, 8> params = { // 8 : 8 input parameters
1056         VariableType::NATIVE_POINTER(),
1057         VariableType::NATIVE_POINTER(),
1058         VariableType::NATIVE_POINTER(),
1059         VariableType::JS_POINTER(),
1060         VariableType::JS_POINTER(),
1061         VariableType::JS_ANY(),
1062         VariableType::INT32(),
1063         VariableType::NATIVE_POINTER(),
1064     };
1065     callSign->SetParameters(params.data());
1066     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1067     callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
1068 }
1069 
DEF_CALL_SIGNATURE(ResumeRspAndReturn)1070 DEF_CALL_SIGNATURE(ResumeRspAndReturn)
1071 {
1072     // 3 : 3 input parameters
1073     CallSignature resumeRspAndReturn("ResumeRspAndReturn", 0, 3,
1074         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1075     *callSign = resumeRspAndReturn;
1076     std::array<VariableType, 3> params = { // 3 : 3 input parameters
1077         VariableType::JS_ANY(),
1078         VariableType::NATIVE_POINTER(),
1079         VariableType::NATIVE_POINTER(),
1080     };
1081     callSign->SetParameters(params.data());
1082     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1083     callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
1084 }
1085 
DEF_CALL_SIGNATURE(ResumeCaughtFrameAndDispatch)1086 DEF_CALL_SIGNATURE(ResumeCaughtFrameAndDispatch)
1087 {
1088     // 7 : 7 input parameters
1089     CallSignature resumeCaughtFrameAndDispatch("ResumeCaughtFrameAndDispatch", 0, 7,
1090         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1091     *callSign = resumeCaughtFrameAndDispatch;
1092     // 7 : 7 input parameters
1093     std::array<VariableType, 7> params = {
1094         VariableType::NATIVE_POINTER(),
1095         VariableType::NATIVE_POINTER(),
1096         VariableType::NATIVE_POINTER(),
1097         VariableType::JS_POINTER(),
1098         VariableType::JS_POINTER(),
1099         VariableType::JS_ANY(),
1100         VariableType::INT32(),
1101     };
1102     callSign->SetParameters(params.data());
1103     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1104     callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
1105 }
1106 
DEF_CALL_SIGNATURE(ResumeUncaughtFrameAndReturn)1107 DEF_CALL_SIGNATURE(ResumeUncaughtFrameAndReturn)
1108 {
1109     // 3 : 3 input parameters
1110     CallSignature resumeUncaughtFrameAndReturn("ResumeUncaughtFrameAndReturn", 0, 3,
1111         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1112     *callSign = resumeUncaughtFrameAndReturn;
1113     std::array<VariableType, 3> params = { // 3 : 3 input parameters
1114         VariableType::NATIVE_POINTER(),
1115         VariableType::NATIVE_POINTER(),
1116         VariableType::JS_ANY(),
1117     };
1118     callSign->SetParameters(params.data());
1119     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1120     callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
1121 }
1122 
DEF_CALL_SIGNATURE(StringsAreEquals)1123 DEF_CALL_SIGNATURE(StringsAreEquals)
1124 {
1125     // 2 : 2 input parameters
1126     CallSignature stringsAreEquals("StringsAreEquals", 0, 2,
1127         ArgumentsOrder::DEFAULT_ORDER, VariableType::BOOL());
1128     *callSign = stringsAreEquals;
1129     std::array<VariableType, 2> params = { // 2 : 2 input parameters
1130         VariableType::JS_POINTER(),
1131         VariableType::JS_POINTER(),
1132     };
1133     callSign->SetParameters(params.data());
1134     callSign->SetGCLeafFunction(true);
1135     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1136 }
1137 
DEF_CALL_SIGNATURE(BigIntEquals)1138 DEF_CALL_SIGNATURE(BigIntEquals)
1139 {
1140     // 2 : 2 input parameters
1141     CallSignature bigIntEquals("BigIntEquals", 0, 2,
1142         ArgumentsOrder::DEFAULT_ORDER, VariableType::BOOL());
1143     *callSign = bigIntEquals;
1144     std::array<VariableType, 2> params = { // 2 : 2 input parameters
1145         VariableType::JS_POINTER(),
1146         VariableType::JS_POINTER(),
1147     };
1148     callSign->SetParameters(params.data());
1149     callSign->SetGCLeafFunction(true);
1150     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1151 }
1152 
1153 #define PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE_COMMON(name)                  \
1154     /* 1 : 1 input parameters */                                            \
1155     CallSignature signature(#name, 0, 1,                                    \
1156         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());             \
1157     *callSign = signature;                                                  \
1158     std::array<VariableType, 1> params = { /* 1: 1 input parameters */      \
1159         VariableType::NATIVE_POINTER(),                                     \
1160     };                                                                      \
1161     callSign->SetVariadicArgs(true);                                        \
1162     callSign->SetParameters(params.data());                                 \
1163     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1164 
1165 #define PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(name)                      \
1166     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE_COMMON(name)                   \
1167     callSign->SetCallConv(CallSignature::CallConv::GHCCallConv);
1168 
1169 #define PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_SIGNATURE(name)               \
1170     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE_COMMON(name)                   \
1171     callSign->SetCallConv(CallSignature::CallConv::WebKitJSCallConv);
1172 
1173 #define PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(name)         \
1174     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE_COMMON(name)                   \
1175     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1176 
DEF_CALL_SIGNATURE(PushCallArgsAndDispatchNative)1177 DEF_CALL_SIGNATURE(PushCallArgsAndDispatchNative)
1178 {
1179     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_SIGNATURE(PushCallArgsAndDispatchNative)
1180 }
1181 
DEF_CALL_SIGNATURE(PushCallArg0AndDispatch)1182 DEF_CALL_SIGNATURE(PushCallArg0AndDispatch)
1183 {
1184     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallArg0AndDispatch)
1185 }
1186 
DEF_CALL_SIGNATURE(PushCallArg1AndDispatch)1187 DEF_CALL_SIGNATURE(PushCallArg1AndDispatch)
1188 {
1189     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallArg1AndDispatch)
1190 }
1191 
DEF_CALL_SIGNATURE(PushCallArgs2AndDispatch)1192 DEF_CALL_SIGNATURE(PushCallArgs2AndDispatch)
1193 {
1194     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallArgs2AndDispatch)
1195 }
1196 
DEF_CALL_SIGNATURE(PushCallArgs3AndDispatch)1197 DEF_CALL_SIGNATURE(PushCallArgs3AndDispatch)
1198 {
1199     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallArgs3AndDispatch)
1200 }
1201 
DEF_CALL_SIGNATURE(PushCallThisArg0AndDispatch)1202 DEF_CALL_SIGNATURE(PushCallThisArg0AndDispatch)
1203 {
1204     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallThisArg0AndDispatch)
1205 }
1206 
DEF_CALL_SIGNATURE(PushCallThisArg1AndDispatch)1207 DEF_CALL_SIGNATURE(PushCallThisArg1AndDispatch)
1208 {
1209     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallThisArg1AndDispatch)
1210 }
1211 
DEF_CALL_SIGNATURE(PushCallThisArgs2AndDispatch)1212 DEF_CALL_SIGNATURE(PushCallThisArgs2AndDispatch)
1213 {
1214     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallThisArgs2AndDispatch)
1215 }
1216 
DEF_CALL_SIGNATURE(PushCallThisArgs3AndDispatch)1217 DEF_CALL_SIGNATURE(PushCallThisArgs3AndDispatch)
1218 {
1219     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallThisArgs3AndDispatch)
1220 }
1221 
DEF_CALL_SIGNATURE(PushCallRangeAndDispatchNative)1222 DEF_CALL_SIGNATURE(PushCallRangeAndDispatchNative)
1223 {
1224     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(PushCallRangeAndDispatchNative)
1225 }
1226 
DEF_CALL_SIGNATURE(PushCallNewAndDispatchNative)1227 DEF_CALL_SIGNATURE(PushCallNewAndDispatchNative)
1228 {
1229     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(PushCallNewAndDispatchNative)
1230 }
1231 
DEF_CALL_SIGNATURE(PushCallNewAndDispatch)1232 DEF_CALL_SIGNATURE(PushCallNewAndDispatch)
1233 {
1234     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallNewAndDispatch)
1235 }
1236 
DEF_CALL_SIGNATURE(PushCallRangeAndDispatch)1237 DEF_CALL_SIGNATURE(PushCallRangeAndDispatch)
1238 {
1239     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallRangeAndDispatch)
1240 }
1241 
DEF_CALL_SIGNATURE(PushCallThisRangeAndDispatch)1242 DEF_CALL_SIGNATURE(PushCallThisRangeAndDispatch)
1243 {
1244     PUSH_CALL_ARGS_AND_DISPATCH_SIGNATURE(PushCallThisRangeAndDispatch)
1245 }
1246 
DEF_CALL_SIGNATURE(CallGetter)1247 DEF_CALL_SIGNATURE(CallGetter)
1248 {
1249     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallGetter)
1250 }
1251 
DEF_CALL_SIGNATURE(CallSetter)1252 DEF_CALL_SIGNATURE(CallSetter)
1253 {
1254     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallSetter)
1255 }
1256 
DEF_CALL_SIGNATURE(CallContainersArgs3)1257 DEF_CALL_SIGNATURE(CallContainersArgs3)
1258 {
1259     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallContainersArgs3)
1260 }
1261 
DEF_CALL_SIGNATURE(CallReturnWithArgv)1262 DEF_CALL_SIGNATURE(CallReturnWithArgv)
1263 {
1264     PUSH_CALL_ARGS_AND_DISPATCH_NATIVE_RANGE_SIGNATURE(CallReturnWithArgv)
1265 }
1266 
DEF_CALL_SIGNATURE(JSCallWithArgV)1267 DEF_CALL_SIGNATURE(JSCallWithArgV)
1268 {
1269     // 5 : 5 input parameters
1270     CallSignature jSCallWithArgV("JSCallWithArgV", 0, 5,
1271         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1272     *callSign = jSCallWithArgV;
1273     // 5 : 5 input parameters
1274     std::array<VariableType, 5> params = {
1275         VariableType::NATIVE_POINTER(),   // glue
1276         VariableType::INT64(),            // actualNumArgs
1277         VariableType::JS_ANY(),           // jsfunc
1278         VariableType::JS_ANY(),           // newTarget
1279         VariableType::JS_ANY(),           // this
1280     };
1281     callSign->SetVariadicArgs(true);
1282     callSign->SetParameters(params.data());
1283     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1284     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1285 }
1286 
DEF_CALL_SIGNATURE(JSFastCallWithArgV)1287 DEF_CALL_SIGNATURE(JSFastCallWithArgV)
1288 {
1289     // 4 : 4 input parameters
1290     CallSignature jSFastCallWithArgV("JSFastCallWithArgV", 0, 4,
1291         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1292     *callSign = jSFastCallWithArgV;
1293     // 4 : 4 input parameters
1294     std::array<VariableType, 4> params = {
1295         VariableType::NATIVE_POINTER(),   // glue
1296         VariableType::JS_ANY(),           // jsfunc
1297         VariableType::JS_ANY(),           // this
1298         VariableType::INT64(),            // actualNumArgs
1299     };
1300     callSign->SetVariadicArgs(true);
1301     callSign->SetParameters(params.data());
1302     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1303     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1304 }
1305 
DEF_CALL_SIGNATURE(JSFastCallWithArgVAndPushUndefined)1306 DEF_CALL_SIGNATURE(JSFastCallWithArgVAndPushUndefined)
1307 {
1308     // 4 : 4 input parameters
1309     CallSignature jSCallWithArgV("JSFastCallWithArgVAndPushUndefined", 0, 4,
1310         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1311     *callSign = jSCallWithArgV;
1312     // 4 : 4 input parameters
1313     std::array<VariableType, 4> params = {
1314         VariableType::NATIVE_POINTER(),   // glue
1315         VariableType::JS_ANY(),           // jsfunc
1316         VariableType::JS_ANY(),           // this
1317         VariableType::INT64(),            // actualNumArgs
1318     };
1319     callSign->SetVariadicArgs(true);
1320     callSign->SetParameters(params.data());
1321     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1322     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1323 }
1324 
DEF_CALL_SIGNATURE(JSCallWithArgVAndPushUndefined)1325 DEF_CALL_SIGNATURE(JSCallWithArgVAndPushUndefined)
1326 {
1327     // 5 : 5 input parameters
1328     CallSignature jSCallWithArgVAndPushUndefined("JSCallWithArgVAndPushUndefined", 0, 5,
1329         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1330     *callSign = jSCallWithArgVAndPushUndefined;
1331     // 5 : 5 input parameters
1332     std::array<VariableType, 5> params = {
1333         VariableType::NATIVE_POINTER(),   // glue
1334         VariableType::INT64(),            // actualNumArgs
1335         VariableType::JS_ANY(),           // jsfunc
1336         VariableType::JS_ANY(),           // newTarget
1337         VariableType::JS_ANY(),           // this
1338     };
1339     callSign->SetVariadicArgs(true);
1340     callSign->SetParameters(params.data());
1341     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1342     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1343 }
1344 
DEF_CALL_SIGNATURE(CallOptimized)1345 DEF_CALL_SIGNATURE(CallOptimized)
1346 {
1347     // 5 : 5 input parameters
1348     CallSignature jSCall("CallOptimized", 0, 5,
1349         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1350     *callSign = jSCall;
1351     std::array<VariableType, 5> params = { // 5 : 5 input parameters
1352         VariableType::NATIVE_POINTER(),     // glue
1353         VariableType::INT64(),       // actual argC
1354         VariableType::JS_ANY(),      // call target
1355         VariableType::JS_ANY(),      // new target
1356         VariableType::JS_ANY(),      // thisobj
1357     };
1358     callSign->SetVariadicArgs(true);
1359     callSign->SetParameters(params.data());
1360     callSign->SetCallConv(CallSignature::CallConv::WebKitJSCallConv);
1361     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1362 }
1363 
DEF_CALL_SIGNATURE(DebugPrint)1364 DEF_CALL_SIGNATURE(DebugPrint)
1365 {
1366     // 1 : 1 input parameters
1367     CallSignature debugPrint("DebugPrint", 0, 1,
1368         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1369     *callSign = debugPrint;
1370     // 1 : 1 input parameters
1371     std::array<VariableType, 1> params = {
1372         VariableType::INT32(),
1373     };
1374     callSign->SetVariadicArgs(true);
1375     callSign->SetParameters(params.data());
1376     callSign->SetGCLeafFunction(true);
1377     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1378 }
1379 
DEF_CALL_SIGNATURE(DebugPrintInstruction)1380 DEF_CALL_SIGNATURE(DebugPrintInstruction)
1381 {
1382     // 2 : 2 input parameters
1383     CallSignature debugPrintInstruction("DebugPrintInstruction", 0, 2,
1384         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1385     *callSign = debugPrintInstruction;
1386     // 2 : 2 input parameters
1387     std::array<VariableType, 2> params = {
1388         VariableType::NATIVE_POINTER(),
1389         VariableType::NATIVE_POINTER(),
1390     };
1391     callSign->SetVariadicArgs(true);
1392     callSign->SetParameters(params.data());
1393     callSign->SetGCLeafFunction(true);
1394     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1395 }
1396 
DEF_CALL_SIGNATURE(Comment)1397 DEF_CALL_SIGNATURE(Comment)
1398 {
1399     // 1 : 1 input parameters
1400     CallSignature comment("Comment", 0, 1,
1401         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1402     *callSign = comment;
1403     // 1 : 1 input parameters
1404     std::array<VariableType, 1> params = {
1405         VariableType::NATIVE_POINTER(),
1406     };
1407     callSign->SetParameters(params.data());
1408     callSign->SetGCLeafFunction(true);
1409     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1410 }
1411 
DEF_CALL_SIGNATURE(ProfileCall)1412 DEF_CALL_SIGNATURE(ProfileCall)
1413 {
1414     // 4 : 4 input parameters
1415     CallSignature callProfilerInstruction("ProfileCall", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1416     *callSign = callProfilerInstruction;
1417     // 4 : 4 input parameters
1418     std::array<VariableType, 4> params = {
1419         VariableType::NATIVE_POINTER(),
1420         VariableType::JS_ANY(),
1421         VariableType::JS_ANY(),
1422         VariableType::INT32(),
1423     };
1424     callSign->SetVariadicArgs(true);
1425     callSign->SetParameters(params.data());
1426     callSign->SetGCLeafFunction(true);
1427     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1428 }
1429 
DEF_CALL_SIGNATURE(ProfileDefineClass)1430 DEF_CALL_SIGNATURE(ProfileDefineClass)
1431 {
1432     // 4: 4 input parameters
1433     CallSignature defineProfInstruction(
1434         "ProfileDefineClass", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1435     *callSign = defineProfInstruction;
1436     // 4: 4 input parameters
1437     std::array<VariableType, 4> params = { // 4 : 4 input parameters
1438         VariableType::NATIVE_POINTER(),
1439         VariableType::JS_ANY(),
1440         VariableType::INT32(),
1441         VariableType::JS_ANY(),
1442     };
1443     callSign->SetVariadicArgs(true);
1444     callSign->SetParameters(params.data());
1445     callSign->SetGCLeafFunction(true);
1446     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1447 }
1448 
DEF_CALL_SIGNATURE(ProfileCreateObject)1449 DEF_CALL_SIGNATURE(ProfileCreateObject)
1450 {
1451     // 5: 5 input parameters
1452     CallSignature defineProfInstruction(
1453         "ProfileCreateObject", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1454     *callSign = defineProfInstruction;
1455     // 4: 4 input parameters
1456     std::array<VariableType, 5> params = { // 5 : 5 input parameters
1457         VariableType::NATIVE_POINTER(),
1458         VariableType::JS_ANY(),
1459         VariableType::INT32(),
1460         VariableType::JS_ANY(),
1461         VariableType::INT32(),
1462     };
1463     callSign->SetVariadicArgs(true);
1464     callSign->SetParameters(params.data());
1465     callSign->SetGCLeafFunction(true);
1466     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1467 }
1468 
DEF_CALL_SIGNATURE(ProfileOpType)1469 DEF_CALL_SIGNATURE(ProfileOpType)
1470 {
1471     // 4: 4 input parameters
1472     CallSignature typeProfInstruction("ProfileOpType", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1473     *callSign = typeProfInstruction;
1474     // 4: 4 input parameters
1475     std::array<VariableType, 4> params = { // 4 : 4 input parameters
1476         VariableType::NATIVE_POINTER(),
1477         VariableType::JS_ANY(),
1478         VariableType::INT32(),
1479         VariableType::INT32(),
1480     };
1481     callSign->SetVariadicArgs(true);
1482     callSign->SetParameters(params.data());
1483     callSign->SetGCLeafFunction(true);
1484     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1485 }
1486 
DEF_CALL_SIGNATURE(ProfileObjLayout)1487 DEF_CALL_SIGNATURE(ProfileObjLayout)
1488 {
1489     // 4: 4 input parameters
1490     CallSignature layoutProfInstruction("ProfileObjLayout", 0, 5, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1491     *callSign = layoutProfInstruction;
1492     // 4: 4 input parameters
1493     std::array<VariableType, 5> params = { // 5 : 5 input parameters
1494         VariableType::NATIVE_POINTER(),
1495         VariableType::JS_ANY(),
1496         VariableType::INT32(),
1497         VariableType::JS_ANY(),
1498         VariableType::INT32(),
1499     };
1500     callSign->SetVariadicArgs(true);
1501     callSign->SetParameters(params.data());
1502     callSign->SetGCLeafFunction(true);
1503     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1504 }
1505 
DEF_CALL_SIGNATURE(FatalPrint)1506 DEF_CALL_SIGNATURE(FatalPrint)
1507 {
1508     // 1 : 1 input parameters
1509     CallSignature fatalPrint("FatalPrint", 0, 1,
1510         ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1511     *callSign = fatalPrint;
1512     // 1 : 1 input parameters
1513     std::array<VariableType, 1> params = {
1514         VariableType::INT32(),
1515     };
1516     callSign->SetVariadicArgs(true);
1517     callSign->SetParameters(params.data());
1518     callSign->SetGCLeafFunction(true);
1519     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1520 }
1521 
DEF_CALL_SIGNATURE(GetActualArgvNoGC)1522 DEF_CALL_SIGNATURE(GetActualArgvNoGC)
1523 {
1524     CallSignature index("GetActualArgvNoGC", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::NATIVE_POINTER());
1525     *callSign = index;
1526     std::array<VariableType, 1> params = {
1527         VariableType::NATIVE_POINTER(),
1528     };
1529     callSign->SetParameters(params.data());
1530     callSign->SetGCLeafFunction(true);
1531     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1532 }
1533 
DEF_CALL_SIGNATURE(InsertOldToNewRSet)1534 DEF_CALL_SIGNATURE(InsertOldToNewRSet)
1535 {
1536     // 3 : 3 input parameters
1537     CallSignature index("InsertOldToNewRSet", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1538     *callSign = index;
1539     // 3 : 3 input parameters
1540     std::array<VariableType, 3> params = {
1541         VariableType::NATIVE_POINTER(),
1542         VariableType::JS_POINTER(),
1543         VariableType::NATIVE_POINTER(),
1544     };
1545     callSign->SetParameters(params.data());
1546     callSign->SetGCLeafFunction(true);
1547     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1548 }
1549 
DEF_CALL_SIGNATURE(FloatMod)1550 DEF_CALL_SIGNATURE(FloatMod)
1551 {
1552     // 2 : 2 input parameters
1553     CallSignature index("FloatMod", 0, 2, ArgumentsOrder::DEFAULT_ORDER, VariableType::FLOAT64());
1554     *callSign = index;
1555     // 2 : 2 input parameters
1556     std::array<VariableType, 2> params = {
1557         VariableType::FLOAT64(),
1558         VariableType::FLOAT64(),
1559     };
1560     callSign->SetParameters(params.data());
1561     callSign->SetGCLeafFunction(true);
1562     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1563 }
1564 
DEF_CALL_SIGNATURE(FloatSqrt)1565 DEF_CALL_SIGNATURE(FloatSqrt)
1566 {
1567     // 1 : 1 input parameters
1568     CallSignature index("FloatSqrt", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1569     *callSign = index;
1570     // 1 : 1 input parameters
1571     std::array<VariableType, 1> params = {
1572         VariableType::FLOAT64(),
1573     };
1574     callSign->SetParameters(params.data());
1575     callSign->SetGCLeafFunction(true);
1576     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1577 }
1578 
DEF_CALL_SIGNATURE(FloatCos)1579 DEF_CALL_SIGNATURE(FloatCos)
1580 {
1581     // 1 : 1 input parameters
1582     CallSignature index("FloatCos", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1583     *callSign = index;
1584     // 1 : 1 input parameters
1585     std::array<VariableType, 1> params = {
1586         VariableType::FLOAT64(),
1587     };
1588     callSign->SetParameters(params.data());
1589     callSign->SetGCLeafFunction(true);
1590     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1591 }
1592 
DEF_CALL_SIGNATURE(FloatSin)1593 DEF_CALL_SIGNATURE(FloatSin)
1594 {
1595     // 1 : 1 input parameters
1596     CallSignature index("FloatSin", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1597     *callSign = index;
1598     // 1 : 1 input parameters
1599     std::array<VariableType, 1> params = {
1600         VariableType::FLOAT64(),
1601     };
1602     callSign->SetParameters(params.data());
1603     callSign->SetGCLeafFunction(true);
1604     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1605 }
1606 
DEF_CALL_SIGNATURE(FloatACos)1607 DEF_CALL_SIGNATURE(FloatACos)
1608 {
1609     // 1 : 1 input parameters
1610     CallSignature index("FloatACos", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1611     *callSign = index;
1612     // 1 : 1 input parameters
1613     std::array<VariableType, 1> params = {
1614         VariableType::FLOAT64(),
1615     };
1616     callSign->SetParameters(params.data());
1617     callSign->SetGCLeafFunction(true);
1618     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1619 }
1620 
DEF_CALL_SIGNATURE(FloatATan)1621 DEF_CALL_SIGNATURE(FloatATan)
1622 {
1623     // 1 : 1 input parameters
1624     CallSignature index("FloatATan", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1625     *callSign = index;
1626     // 1 : 1 input parameters
1627     std::array<VariableType, 1> params = {
1628         VariableType::FLOAT64(),
1629     };
1630     callSign->SetParameters(params.data());
1631     callSign->SetGCLeafFunction(true);
1632     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1633 }
1634 
DEF_CALL_SIGNATURE(FloatFloor)1635 DEF_CALL_SIGNATURE(FloatFloor)
1636 {
1637     // 1 : 1 input parameters
1638     CallSignature index("FloatFloor", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1639     *callSign = index;
1640     // 1 : 1 input parameters
1641     std::array<VariableType, 1> params = {
1642         VariableType::FLOAT64(),
1643     };
1644     callSign->SetParameters(params.data());
1645     callSign->SetGCLeafFunction(true);
1646     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1647 }
1648 
DEF_CALL_SIGNATURE(FindElementWithCache)1649 DEF_CALL_SIGNATURE(FindElementWithCache)
1650 {
1651     // 4 : 4 input parameters
1652     CallSignature index("FindElementWithCache", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::INT32());
1653     *callSign = index;
1654     // 4 : 4 input parameters
1655     std::array<VariableType, 4> params = {
1656         VariableType::NATIVE_POINTER(),
1657         VariableType::JS_ANY(),
1658         VariableType::JS_ANY(),
1659         VariableType::INT32(),
1660     };
1661     callSign->SetParameters(params.data());
1662     callSign->SetGCLeafFunction(true);
1663     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1664 }
1665 
DEF_CALL_SIGNATURE(DoubleToInt)1666 DEF_CALL_SIGNATURE(DoubleToInt)
1667 {
1668     // 1 : 1 input parameters
1669     CallSignature index("DoubleToInt", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::INT32());
1670     *callSign = index;
1671     // 1 : 1 input parameters
1672     std::array<VariableType, 1> params = {
1673         VariableType::FLOAT64(),
1674     };
1675     callSign->SetParameters(params.data());
1676     callSign->SetGCLeafFunction(true);
1677     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1678 }
1679 
DEF_CALL_SIGNATURE(MarkingBarrier)1680 DEF_CALL_SIGNATURE(MarkingBarrier)
1681 {
1682     // 4 : 4 input parameters
1683     CallSignature index("MarkingBarrier", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1684     *callSign = index;
1685     // 4 : 4 input parameters
1686     std::array<VariableType, 4> params = {
1687         VariableType::NATIVE_POINTER(),
1688         VariableType::JS_POINTER(),
1689         VariableType::NATIVE_POINTER(),
1690         VariableType::JS_POINTER()
1691     };
1692     callSign->SetParameters(params.data());
1693     callSign->SetGCLeafFunction(true);
1694     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1695 }
1696 
DEF_CALL_SIGNATURE(StoreBarrier)1697 DEF_CALL_SIGNATURE(StoreBarrier)
1698 {
1699     // 4 : 4 input parameters
1700     CallSignature index("StoreBarrier", 0, 4, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1701     *callSign = index;
1702     // 4 : 4 input parameters
1703     std::array<VariableType, 4> params = {
1704         VariableType::NATIVE_POINTER(),
1705         VariableType::JS_POINTER(),
1706         VariableType::NATIVE_POINTER(),
1707         VariableType::JS_POINTER()
1708     };
1709     callSign->SetParameters(params.data());
1710     callSign->SetGCLeafFunction(true);
1711     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1712 }
1713 
DEF_CALL_SIGNATURE(CallArg0)1714 DEF_CALL_SIGNATURE(CallArg0)
1715 {
1716     // 2 : 2 input parameters
1717     CallSignature callArg0("callArg0", 0, 2,
1718         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1719     *callSign = callArg0;
1720     // 2 : 2 input parameters
1721     std::array<VariableType, 2> params = {
1722         VariableType::NATIVE_POINTER(),
1723         VariableType::JS_ANY()
1724     };
1725     callSign->SetParameters(params.data());
1726     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
1727 }
1728 
DEF_CALL_SIGNATURE(CallArg1)1729 DEF_CALL_SIGNATURE(CallArg1)
1730 {
1731     // 3 : 3 input parameters
1732     CallSignature callArg1("callArg1", 0, 3,
1733         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1734     *callSign = callArg1;
1735     // 3 : 3 input parameters
1736     std::array<VariableType, 3> params = {
1737         VariableType::NATIVE_POINTER(),
1738         VariableType::JS_ANY(),
1739         VariableType::JS_ANY()
1740     };
1741     callSign->SetParameters(params.data());
1742     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
1743 }
1744 
DEF_CALL_SIGNATURE(CallArgs2)1745 DEF_CALL_SIGNATURE(CallArgs2)
1746 {
1747     // 4 : 4 input parameters
1748     CallSignature callArgs2("callArgs2", 0, 4,
1749         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1750     *callSign = callArgs2;
1751     // 4 : 4 input parameters
1752     std::array<VariableType, 4> params = {
1753         VariableType::NATIVE_POINTER(),
1754         VariableType::JS_ANY(),
1755         VariableType::JS_ANY(),
1756         VariableType::JS_ANY()
1757     };
1758     callSign->SetParameters(params.data());
1759     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
1760 }
1761 
DEF_CALL_SIGNATURE(CallArgs3)1762 DEF_CALL_SIGNATURE(CallArgs3)
1763 {
1764     // 5 : 5 input parameters
1765     CallSignature callArgs3("callArgs3", 0, 5,
1766         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1767     *callSign = callArgs3;
1768     // 5 : 5 input parameters
1769     std::array<VariableType, 5> params = {
1770         VariableType::NATIVE_POINTER(),
1771         VariableType::JS_ANY(),
1772         VariableType::JS_ANY(),
1773         VariableType::JS_ANY(),
1774         VariableType::JS_ANY()
1775     };
1776     callSign->SetParameters(params.data());
1777     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
1778 }
1779 
DEF_CALL_SIGNATURE(CallThisRange)1780 DEF_CALL_SIGNATURE(CallThisRange)
1781 {
1782     // 3 : 3 input parameters
1783     CallSignature callThisRange("callThisRange", 0, 3,
1784         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1785     *callSign = callThisRange;
1786     // 3 : 3 input parameters
1787     std::array<VariableType, 3> params = {
1788         VariableType::NATIVE_POINTER(),
1789         VariableType::JS_ANY(),
1790         VariableType::JS_ANY()
1791     };
1792     callSign->SetVariadicArgs(true);
1793     callSign->SetParameters(params.data());
1794     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
1795 }
1796 
DEF_CALL_SIGNATURE(CallRange)1797 DEF_CALL_SIGNATURE(CallRange)
1798 {
1799     // 2 : 2 input parameters
1800     CallSignature callRange("callRange", 0, 2,
1801         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1802     *callSign = callRange;
1803     // 2 : 2 input parameters
1804     std::array<VariableType, 2> params = {
1805         VariableType::NATIVE_POINTER(),
1806         VariableType::JS_ANY()
1807     };
1808     callSign->SetVariadicArgs(true);
1809     callSign->SetParameters(params.data());
1810     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB);
1811 }
1812 
DEF_CALL_SIGNATURE(JsProxyCallInternal)1813 DEF_CALL_SIGNATURE(JsProxyCallInternal)
1814 {
1815     // 4 : 4 input parameters
1816     CallSignature proxyCallInternal("JsProxyCallInternal", 0, 4,
1817         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_POINTER());
1818     *callSign = proxyCallInternal;
1819     // 4 : 4 input parameters
1820     std::array<VariableType, 4> params = {
1821         VariableType::NATIVE_POINTER(),    // glue
1822         VariableType::INT64(),      // actual argC
1823         VariableType::JS_POINTER(), // callTarget
1824         VariableType::NATIVE_POINTER(),    // argv
1825     };
1826     callSign->SetVariadicArgs(false);
1827     callSign->SetParameters(params.data());
1828     callSign->SetTailCall(true);
1829     callSign->SetGCLeafFunction(true);
1830     callSign->SetTargetKind(CallSignature::TargetKind::COMMON_STUB);
1831     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1832 }
1833 
DEF_CALL_SIGNATURE(JsBoundCallInternal)1834 DEF_CALL_SIGNATURE(JsBoundCallInternal)
1835 {
1836     // 6 : 6 input parameters
1837     CallSignature boundCallInternal("JsBoundCallInternal", 0, 6,
1838         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_POINTER());
1839     *callSign = boundCallInternal;
1840     // 6 : 6 input parameters
1841     std::array<VariableType, 6> params = {
1842         VariableType::NATIVE_POINTER(),    // glue
1843         VariableType::INT64(),      // actual argC
1844         VariableType::JS_POINTER(), // callTarget
1845         VariableType::NATIVE_POINTER(),    // argv
1846         VariableType::JS_POINTER(), // this
1847         VariableType::JS_POINTER(), // new
1848     };
1849     callSign->SetVariadicArgs(false);
1850     callSign->SetParameters(params.data());
1851     callSign->SetTailCall(true);
1852     callSign->SetGCLeafFunction(true);
1853     callSign->SetTargetKind(CallSignature::TargetKind::COMMON_STUB);
1854     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1855 }
1856 
DEF_CALL_SIGNATURE(CreateArrayFromList)1857 DEF_CALL_SIGNATURE(CreateArrayFromList)
1858 {
1859     // 3 : 3 input parameters
1860     CallSignature createArrayFromList("CreateArrayFromList", 0, 3, ArgumentsOrder::DEFAULT_ORDER,
1861                                      VariableType::JS_POINTER());
1862     *callSign = createArrayFromList;
1863     // 3 : 3 input parameters
1864     std::array<VariableType, 3> params = {
1865         VariableType::NATIVE_POINTER(),
1866         VariableType::INT32(),
1867         VariableType::NATIVE_POINTER(),
1868     };
1869 
1870     callSign->SetParameters(params.data());
1871     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_VARARGS);
1872 }
1873 
DEF_CALL_SIGNATURE(DeoptHandlerAsm)1874 DEF_CALL_SIGNATURE(DeoptHandlerAsm)
1875 {
1876     // 1 : 1 input parameters
1877     CallSignature deoptHandlerAsm("DeoptHandlerAsm", 0, 3,
1878         ArgumentsOrder::DEFAULT_ORDER, VariableType::JS_ANY());
1879     *callSign = deoptHandlerAsm;
1880     std::array<VariableType, 3> params = { // 3 : 3 input parameters
1881         VariableType::NATIVE_POINTER(),     // glue
1882         VariableType::NATIVE_POINTER(),     // deoptType
1883         VariableType::NATIVE_POINTER(),     // depth
1884     };
1885     callSign->SetVariadicArgs(false);
1886     callSign->SetParameters(params.data());
1887     callSign->SetCallConv(CallSignature::CallConv::CCallConv);
1888     callSign->SetTargetKind(CallSignature::TargetKind::DEOPT_STUB);
1889 }
1890 
DEF_CALL_SIGNATURE(TimeClip)1891 DEF_CALL_SIGNATURE(TimeClip)
1892 {
1893     // 1 : 1 input parameters
1894     CallSignature index("TimeClip", 0, 1, ArgumentsOrder::DEFAULT_ORDER, VariableType::FLOAT64());
1895     *callSign = index;
1896     // 1 : 1 input parameters
1897     std::array<VariableType, 1> params = {
1898         VariableType::FLOAT64(),
1899     };
1900     callSign->SetParameters(params.data());
1901     callSign->SetGCLeafFunction(true);
1902     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1903 }
1904 
DEF_CALL_SIGNATURE(SetDateValues)1905 DEF_CALL_SIGNATURE(SetDateValues)
1906 {
1907     // 3 : 3 input parameters
1908     CallSignature index("SetDateValues", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::FLOAT64());
1909     *callSign = index;
1910     // 3 : 3 input parameters
1911     std::array<VariableType, 3> params = {
1912         VariableType::FLOAT64(),
1913         VariableType::FLOAT64(),
1914         VariableType::FLOAT64(),
1915     };
1916     callSign->SetParameters(params.data());
1917     callSign->SetGCLeafFunction(true);
1918     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1919 }
1920 
DEF_CALL_SIGNATURE(StartCallTimer)1921 DEF_CALL_SIGNATURE(StartCallTimer)
1922 {
1923     CallSignature index("StartCallTimer", 0, 3, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1924     *callSign = index;
1925     // 3 : 3 input parameters
1926     std::array<VariableType, 3> params = {
1927         VariableType::NATIVE_POINTER(),
1928         VariableType::JS_ANY(),
1929         VariableType::BOOL()
1930     };
1931     callSign->SetParameters(params.data());
1932     callSign->SetGCLeafFunction(true);
1933     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1934 }
1935 
DEF_CALL_SIGNATURE(EndCallTimer)1936 DEF_CALL_SIGNATURE(EndCallTimer)
1937 {
1938     CallSignature index("EndCallTimer", 0, 2, ArgumentsOrder::DEFAULT_ORDER, VariableType::VOID());
1939     *callSign = index;
1940     // 3 : 3 input parameters
1941     std::array<VariableType, 3> params = {
1942         VariableType::NATIVE_POINTER(),
1943         VariableType::JS_ANY()
1944     };
1945     callSign->SetParameters(params.data());
1946     callSign->SetGCLeafFunction(true);
1947     callSign->SetTargetKind(CallSignature::TargetKind::RUNTIME_STUB_NO_GC);
1948 }
1949 }  // namespace panda::ecmascript::kungfu
1950