1/*
2 * Copyright (c) 2024 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#ifndef ECMASCRIPT_RUNTIME_STUB_LIST_H
17#define ECMASCRIPT_RUNTIME_STUB_LIST_H
18
19#include "ecmascript/stubs/test_runtime_stubs.h"
20
21namespace panda::ecmascript {
22
23#define RUNTIME_ASM_STUB_LIST(V)             \
24    JS_CALL_TRAMPOLINE_LIST(V)               \
25    FAST_CALL_TRAMPOLINE_LIST(V)             \
26    ASM_INTERPRETER_TRAMPOLINE_LIST(V)       \
27    BASELINE_TRAMPOLINE_LIST(V)
28
29#define ASM_INTERPRETER_TRAMPOLINE_LIST(V)   \
30    V(AsmInterpreterEntry)                   \
31    V(GeneratorReEnterAsmInterp)             \
32    V(PushCallArgsAndDispatchNative)         \
33    V(PushCallArg0AndDispatch)               \
34    V(PushCallArg1AndDispatch)               \
35    V(PushCallArgs2AndDispatch)              \
36    V(PushCallArgs3AndDispatch)              \
37    V(PushCallThisArg0AndDispatch)           \
38    V(PushCallThisArg1AndDispatch)           \
39    V(PushCallThisArgs2AndDispatch)          \
40    V(PushCallThisArgs3AndDispatch)          \
41    V(PushCallRangeAndDispatch)              \
42    V(PushCallNewAndDispatch)                \
43    V(PushSuperCallAndDispatch)              \
44    V(PushCallNewAndDispatchNative)          \
45    V(PushNewTargetAndDispatchNative)        \
46    V(PushCallRangeAndDispatchNative)        \
47    V(PushCallThisRangeAndDispatch)          \
48    V(ResumeRspAndDispatch)                  \
49    V(ResumeRspAndReturn)                    \
50    V(ResumeRspAndReturnBaseline)            \
51    V(ResumeCaughtFrameAndDispatch)          \
52    V(ResumeUncaughtFrameAndReturn)          \
53    V(ResumeRspAndRollback)                  \
54    V(CallSetter)                            \
55    V(CallGetter)                            \
56    V(CallContainersArgs2)                   \
57    V(CallContainersArgs3)                   \
58    V(CallReturnWithArgv)                    \
59    V(ASMFastWriteBarrier)                   \
60    V(ASMWriteBarrierWithEden)
61
62#define BASELINE_TRAMPOLINE_LIST(V)                   \
63    V(CallArg0AndCheckToBaseline)                     \
64    V(CallArg1AndCheckToBaseline)                     \
65    V(CallArgs2AndCheckToBaseline)                    \
66    V(CallArgs3AndCheckToBaseline)                    \
67    V(CallThisArg0AndCheckToBaseline)                 \
68    V(CallThisArg1AndCheckToBaseline)                 \
69    V(CallThisArgs2AndCheckToBaseline)                \
70    V(CallThisArgs3AndCheckToBaseline)                \
71    V(CallRangeAndCheckToBaseline)                    \
72    V(CallNewAndCheckToBaseline)                      \
73    V(SuperCallAndCheckToBaseline)                    \
74    V(CallThisRangeAndCheckToBaseline)                \
75    V(CallArg0AndDispatchFromBaseline)                \
76    V(CallArg1AndDispatchFromBaseline)                \
77    V(CallArgs2AndDispatchFromBaseline)               \
78    V(CallArgs3AndDispatchFromBaseline)               \
79    V(CallThisArg0AndDispatchFromBaseline)            \
80    V(CallThisArg1AndDispatchFromBaseline)            \
81    V(CallThisArgs2AndDispatchFromBaseline)           \
82    V(CallThisArgs3AndDispatchFromBaseline)           \
83    V(CallRangeAndDispatchFromBaseline)               \
84    V(CallNewAndDispatchFromBaseline)                 \
85    V(SuperCallAndDispatchFromBaseline)               \
86    V(CallThisRangeAndDispatchFromBaseline)           \
87    V(CallArg0AndCheckToBaselineFromBaseline)         \
88    V(CallArg1AndCheckToBaselineFromBaseline)         \
89    V(CallArgs2AndCheckToBaselineFromBaseline)        \
90    V(CallArgs3AndCheckToBaselineFromBaseline)        \
91    V(CallThisArg0AndCheckToBaselineFromBaseline)     \
92    V(CallThisArg1AndCheckToBaselineFromBaseline)     \
93    V(CallThisArgs2AndCheckToBaselineFromBaseline)    \
94    V(CallThisArgs3AndCheckToBaselineFromBaseline)    \
95    V(CallRangeAndCheckToBaselineFromBaseline)        \
96    V(CallNewAndCheckToBaselineFromBaseline)          \
97    V(SuperCallAndCheckToBaselineFromBaseline)        \
98    V(CallThisRangeAndCheckToBaselineFromBaseline)    \
99    V(GetBaselineBuiltinFp)
100
101#define JS_CALL_TRAMPOLINE_LIST(V)           \
102    V(CallRuntime)                           \
103    V(CallRuntimeWithArgv)                   \
104    V(JSFunctionEntry)                       \
105    V(JSCall)                                \
106    V(JSCallWithArgV)                        \
107    V(JSCallWithArgVAndPushArgv)             \
108    V(JSProxyCallInternalWithArgV)           \
109    V(SuperCallWithArgV)                     \
110    V(OptimizedCallAndPushArgv)              \
111    V(DeoptHandlerAsm)                       \
112    V(JSCallNew)                             \
113    V(CallOptimized)                         \
114    V(AOTCallToAsmInterBridge)               \
115    V(FastCallToAsmInterBridge)
116
117#define FAST_CALL_TRAMPOLINE_LIST(V)         \
118    V(OptimizedFastCallEntry)                \
119    V(OptimizedFastCallAndPushArgv)          \
120    V(JSFastCallWithArgV)                    \
121    V(JSFastCallWithArgVAndPushArgv)
122
123
124#define RUNTIME_STUB_WITHOUT_GC_LIST(V)        \
125    V(Dump)                                    \
126    V(DebugDump)                               \
127    V(DumpWithHint)                            \
128    V(DebugDumpWithHint)                       \
129    V(DebugPrint)                              \
130    V(DebugPrintCustom)                        \
131    V(DebugPrintInstruction)                   \
132    V(DebugOsrEntry)                           \
133    V(Comment)                                 \
134    V(FatalPrint)                              \
135    V(FatalPrintCustom)                        \
136    V(GetActualArgvNoGC)                       \
137    V(InsertOldToNewRSet)                      \
138    V(InsertLocalToShareRSet)                  \
139    V(InsertNewToEdenRSet)                     \
140    V(SetBitAtomic)                            \
141    V(MarkingBarrier)                          \
142    V(MarkingBarrierWithEden)                  \
143    V(SharedGCMarkingBarrier)                  \
144    V(StoreBarrier)                            \
145    V(DoubleToInt)                             \
146    V(DoubleToLength)                          \
147    V(FloatMod)                                \
148    V(FloatAcos)                               \
149    V(FloatAcosh)                              \
150    V(FloatAsin)                               \
151    V(FloatAsinh)                              \
152    V(FloatAtan)                               \
153    V(FloatAtan2)                              \
154    V(FloatAtanh)                              \
155    V(FloatCos)                                \
156    V(FloatCosh)                               \
157    V(FloatSin)                                \
158    V(FloatSinh)                               \
159    V(FloatTan)                                \
160    V(FloatTanh)                               \
161    V(FloatTrunc)                              \
162    V(FloatLog)                                \
163    V(FloatLog2)                               \
164    V(FloatLog10)                              \
165    V(FloatLog1p)                              \
166    V(FloatExp)                                \
167    V(FloatExpm1)                              \
168    V(FloatCbrt)                               \
169    V(FloatFloor)                              \
170    V(FloatPow)                                \
171    V(FloatCeil)                               \
172    V(CallDateNow)                             \
173    V(NumberIsFinite)                          \
174    V(FindElementWithCache)                    \
175    V(UpdateFieldType)                         \
176    V(CreateArrayFromList)                     \
177    V(StringsAreEquals)                        \
178    V(BigIntEquals)                            \
179    V(TimeClip)                                \
180    V(SetDateValues)                           \
181    V(StartCallTimer)                          \
182    V(EndCallTimer)                            \
183    V(BigIntSameValueZero)                     \
184    V(JSHClassFindProtoTransitions)            \
185    V(NumberHelperStringToDouble)              \
186    V(GetStringToListCacheArray)               \
187    V(FastArraySort)                           \
188    V(FastArraySortString)                     \
189    V(StringToNumber)                          \
190    V(StringGetStart)                          \
191    V(StringGetEnd)                            \
192    V(ArrayTrim)                               \
193    V(CopyTypedArrayBuffer)                    \
194    V(IsFastRegExp)
195
196#define RUNTIME_STUB_WITH_GC_LIST(V)            \
197    V(AddElementInternal)                       \
198    V(HeapAlloc)                                \
199    V(AllocateInYoung)                          \
200    V(AllocateInOld)                            \
201    V(AllocateInSOld)                           \
202    V(AllocateInSNonMovable)                    \
203    V(TypedArraySpeciesCreate)                  \
204    V(CallInternalGetter)                       \
205    V(CallInternalSetter)                       \
206    V(CallGetPrototype)                         \
207    V(RegularJSObjDeletePrototype)              \
208    V(CallJSObjDeletePrototype)                 \
209    V(ToPropertyKey)                            \
210    V(ToPropertyKeyValue)                       \
211    V(ToPropertyKeyWritable)                    \
212    V(ToPropertyKeyEnumerable)                  \
213    V(ToPropertyKeyConfigurable)                \
214    V(NewJSPrimitiveRef)                        \
215    V(ThrowTypeError)                           \
216    V(MismatchError)                            \
217    V(GetHash32)                                \
218    V(ComputeHashcode)                          \
219    V(NewInternalString)                        \
220    V(NewTaggedArray)                           \
221    V(NewCOWTaggedArray)                        \
222    V(NewMutantTaggedArray)                     \
223    V(NewCOWMutantTaggedArray)                  \
224    V(CopyArray)                                \
225    V(NumberToString)                           \
226    V(IntToString)                              \
227    V(RTSubstitution)                           \
228    V(NameDictPutIfAbsent)                      \
229    V(NameDictionaryGetAllEnumKeys)             \
230    V(NumberDictionaryGetAllEnumKeys)           \
231    V(PropertiesSetValue)                       \
232    V(JSArrayReduceUnStable)                    \
233    V(JSArrayFilterUnStable)                    \
234    V(JSArrayMapUnStable)                       \
235    V(CheckAndCopyArray)                        \
236    V(NewEcmaHClass)                            \
237    V(UpdateLayOutAndAddTransition)             \
238    V(CopyAndUpdateObjLayout)                   \
239    V(UpdateHClassForElementsKind)              \
240    V(RuntimeDump)                              \
241    V(ForceGC)                                  \
242    V(NoticeThroughChainAndRefreshUser)         \
243    V(JumpToCInterpreter)                       \
244    V(StGlobalRecord)                           \
245    V(SetFunctionNameNoPrefix)                  \
246    V(StOwnByValueWithNameSet)                  \
247    V(StOwnByName)                              \
248    V(StOwnByNameWithNameSet)                   \
249    V(SuspendGenerator)                         \
250    V(UpFrame)                                  \
251    V(Neg)                                      \
252    V(Not)                                      \
253    V(Inc)                                      \
254    V(Dec)                                      \
255    V(Shl2)                                     \
256    V(Shr2)                                     \
257    V(Ashr2)                                    \
258    V(Or2)                                      \
259    V(Xor2)                                     \
260    V(And2)                                     \
261    V(Exp)                                      \
262    V(IsIn)                                     \
263    V(InstanceOf)                               \
264    V(CreateGeneratorObj)                       \
265    V(ThrowConstAssignment)                     \
266    V(GetTemplateObject)                        \
267    V(CreateStringIterator)                     \
268    V(NewJSArrayIterator)                       \
269    V(NewJSTypedArrayIterator)                  \
270    V(MapIteratorNext)                          \
271    V(SetIteratorNext)                          \
272    V(StringIteratorNext)                       \
273    V(ArrayIteratorNext)                        \
274    V(IteratorReturn)                           \
275    V(GetNextPropName)                          \
276    V(GetNextPropNameSlowpath)                  \
277    V(ThrowIfNotObject)                         \
278    V(IterNext)                                 \
279    V(CloseIterator)                            \
280    V(SuperCallSpread)                          \
281    V(OptSuperCallSpread)                       \
282    V(GetCallSpreadArgs)                        \
283    V(DelObjProp)                               \
284    V(NewObjApply)                              \
285    V(CreateIterResultObj)                      \
286    V(AsyncFunctionAwaitUncaught)               \
287    V(AsyncFunctionResolveOrReject)             \
288    V(ThrowUndefinedIfHole)                     \
289    V(CopyDataProperties)                       \
290    V(StArraySpread)                            \
291    V(GetIteratorNext)                          \
292    V(SetObjectWithProto)                       \
293    V(LoadICByValue)                            \
294    V(StoreICByValue)                           \
295    V(StoreOwnICByValue)                        \
296    V(StOwnByValue)                             \
297    V(LdSuperByValue)                           \
298    V(StSuperByValue)                           \
299    V(LdObjByIndex)                             \
300    V(StObjByIndex)                             \
301    V(StOwnByIndex)                             \
302    V(CreateClassWithBuffer)                    \
303    V(CreateSharedClass)                        \
304    V(LdSendableClass)                          \
305    V(SetClassConstructorLength)                \
306    V(LoadICByName)                             \
307    V(StoreICByName)                            \
308    V(UpdateHotnessCounter)                     \
309    V(CheckSafePoint)                           \
310    V(PGODump)                                  \
311    V(PGOPreDump)                               \
312    V(JitCompile)                               \
313    V(CountInterpExecFuncs)                     \
314    V(BaselineJitCompile)                       \
315    V(UpdateHotnessCounterWithProf)             \
316    V(GetModuleNamespaceByIndex)                \
317    V(GetModuleNamespaceByIndexOnJSFunc)        \
318    V(GetModuleNamespace)                       \
319    V(StModuleVarByIndex)                       \
320    V(StModuleVarByIndexOnJSFunc)               \
321    V(StModuleVar)                              \
322    V(LdLocalModuleVarByIndex)                  \
323    V(LdLocalModuleVarByIndexWithModule)        \
324    V(LdExternalModuleVarByIndex)               \
325    V(LdExternalModuleVarByIndexWithModule)     \
326    V(LdSendableExternalModuleVarByIndex)       \
327    V(LdLazyExternalModuleVarByIndex)           \
328    V(LdLazySendableExternalModuleVarByIndex)   \
329    V(LdLocalModuleVarByIndexOnJSFunc)          \
330    V(LdExternalModuleVarByIndexOnJSFunc)       \
331    V(LdModuleVar)                              \
332    V(Throw)                                    \
333    V(GetPropIterator)                          \
334    V(GetPropIteratorSlowpath)                  \
335    V(PrimitiveStringCreate)                    \
336    V(AsyncFunctionEnter)                       \
337    V(GetIterator)                              \
338    V(GetAsyncIterator)                         \
339    V(SetGeneratorState)                        \
340    V(ThrowThrowNotExists)                      \
341    V(ThrowPatternNonCoercible)                 \
342    V(ThrowDeleteSuperProperty)                 \
343    V(Eq)                                       \
344    V(TryLdGlobalICByName)                      \
345    V(LoadMiss)                                 \
346    V(StoreMiss)                                \
347    V(TryUpdateGlobalRecord)                    \
348    V(ThrowReferenceError)                      \
349    V(StGlobalVar)                              \
350    V(LdGlobalICVar)                            \
351    V(ToIndex)                                  \
352    V(NewJSObjectByConstructor)                 \
353    V(CloneHclass)                              \
354    V(AllocateTypedArrayBuffer)                 \
355    V(ToNumber)                                 \
356    V(ToBoolean)                                \
357    V(NotEq)                                    \
358    V(Less)                                     \
359    V(LessEq)                                   \
360    V(Greater)                                  \
361    V(GreaterEq)                                \
362    V(Add2)                                     \
363    V(Sub2)                                     \
364    V(Mul2)                                     \
365    V(Div2)                                     \
366    V(Mod2)                                     \
367    V(CreateEmptyObject)                        \
368    V(CreateEmptyArray)                         \
369    V(GetSymbolFunction)                        \
370    V(GetUnmapedArgs)                           \
371    V(CopyRestArgs)                             \
372    V(CreateArrayWithBuffer)                    \
373    V(CreateObjectWithBuffer)                   \
374    V(NewThisObject)                            \
375    V(NewObjRange)                              \
376    V(DefineFunc)                               \
377    V(CreateRegExpWithLiteral)                  \
378    V(ThrowIfSuperNotCorrectCall)               \
379    V(CreateObjectHavingMethod)                 \
380    V(CreateObjectWithExcludedKeys)             \
381    V(DefineMethod)                             \
382    V(SetPatchModule)                           \
383    V(ThrowSetterIsUndefinedException)          \
384    V(ThrowNotCallableException)                \
385    V(ThrowCallConstructorException)            \
386    V(ThrowNonConstructorException)             \
387    V(ThrowStackOverflowException)              \
388    V(ThrowDerivedMustReturnException)          \
389    V(CallSpread)                               \
390    V(DefineGetterSetterByValue)                \
391    V(SuperCall)                                \
392    V(OptSuperCall)                             \
393    V(LdBigInt)                                 \
394    V(ToNumeric)                                \
395    V(ToNumericConvertBigInt)                   \
396    V(CallBigIntAsIntN)                         \
397    V(CallBigIntAsUintN)                        \
398    V(DynamicImport)                            \
399    V(CreateAsyncGeneratorObj)                  \
400    V(AsyncGeneratorResolve)                    \
401    V(AsyncGeneratorReject)                     \
402    V(NewLexicalEnvWithName)                    \
403    V(NewSendableEnv)                           \
404    V(OptGetUnmapedArgs)                        \
405    V(OptCopyRestArgs)                          \
406    V(NotifyBytecodePcChanged)                  \
407    V(NotifyDebuggerStatement)                  \
408    V(MethodEntry)                              \
409    V(MethodExit)                               \
410    V(OptNewLexicalEnvWithName)                 \
411    V(OptSuspendGenerator)                      \
412    V(OptAsyncGeneratorResolve)                 \
413    V(OptCreateObjectWithExcludedKeys)          \
414    V(OptNewObjRange)                           \
415    V(GetTypeArrayPropertyByIndex)              \
416    V(SetTypeArrayPropertyByIndex)              \
417    V(FastCopyElementToArray)                   \
418    V(GetPropertyByName)                        \
419    V(JSObjectGetMethod)                        \
420    V(DebugAOTPrint)                            \
421    V(ProfileOptimizedCode)                     \
422    V(ProfileTypedOp)                           \
423    V(VerifyVTableLoading)                      \
424    V(VerifyVTableStoring)                      \
425    V(GetMethodFromCache)                       \
426    V(GetArrayLiteralFromCache)                 \
427    V(GetObjectLiteralFromCache)                \
428    V(GetStringFromCache)                       \
429    V(OptLdSuperByValue)                        \
430    V(OptStSuperByValue)                        \
431    V(BigIntEqual)                              \
432    V(StringEqual)                              \
433    V(StringIndexOf)                            \
434    V(LdPatchVar)                               \
435    V(StPatchVar)                               \
436    V(DeoptHandler)                             \
437    V(ContainerRBTreeForEach)                   \
438    V(InsertStringToTable)                      \
439    V(SlowFlattenString)                        \
440    V(NotifyConcurrentResult)                   \
441    V(DefineField)                              \
442    V(CreatePrivateProperty)                    \
443    V(DefinePrivateProperty)                    \
444    V(LdPrivateProperty)                        \
445    V(StPrivateProperty)                        \
446    V(TestIn)                                   \
447    V(UpdateAOTHClass)                          \
448    V(AotInlineTrace)                           \
449    V(AotInlineBuiltinTrace)                    \
450    V(LocaleCompare)                            \
451    V(ArraySort)                                \
452    V(FastStringify)                            \
453    V(ObjectSlowAssign)                         \
454    V(GetLinkedHash)                            \
455    V(LinkedHashMapComputeCapacity)             \
456    V(LinkedHashSetComputeCapacity)             \
457    V(JSObjectGrowElementsCapacity)             \
458    V(HClassCloneWithAddProto)                  \
459    V(LocaleCompareWithGc)                      \
460    V(ParseInt)                                 \
461    V(LocaleCompareCacheable)                   \
462    V(ArrayForEachContinue)                     \
463    V(NumberDictionaryPut)                      \
464    V(ThrowRangeError)                          \
465    V(InitializeGeneratorFunction)              \
466    V(FunctionDefineOwnProperty)                \
467    V(DefineOwnProperty)                        \
468    V(AOTEnableProtoChangeMarker)               \
469    V(HasProperty)                              \
470    V(DumpObject)                               \
471    V(TryGetInternString)                       \
472    V(BigIntConstructor)                        \
473    V(ObjectPrototypeHasOwnProperty)            \
474    V(ReflectHas)                               \
475    V(ReflectConstruct)                         \
476    V(ReflectApply)                             \
477    V(FunctionPrototypeApply)                   \
478    V(FunctionPrototypeBind)                    \
479    V(FunctionPrototypeCall)                    \
480    V(SetPrototypeTransition)                   \
481    V(GetSharedModule)                          \
482    V(SuperCallForwardAllArgs)                  \
483    V(OptSuperCallForwardAllArgs)               \
484    V(GetCollationValueFromIcuCollator)         \
485    V(DecodeURIComponent)                       \
486    V(GetAllFlagsInternal)
487
488
489#define RUNTIME_STUB_LIST(V)                     \
490    RUNTIME_ASM_STUB_LIST(V)                     \
491    RUNTIME_STUB_WITHOUT_GC_LIST(V)              \
492    RUNTIME_STUB_WITH_GC_LIST(V)                 \
493    TEST_RUNTIME_STUB_GC_LIST(V)
494
495}  // namespace panda::ecmascript
496#endif // ECMASCRIPT_RUNTIME_STUB_LIST_H
497