• 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 #ifndef ECMASCRIPT_RUNTIME_CALL_ID_H
17 #define ECMASCRIPT_RUNTIME_CALL_ID_H
18 
19 #include "ecmascript/base/config.h"
20 #include "ecmascript/vmstat/runtime_stat.h"
21 
22 namespace panda::ecmascript {
23 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
24 #define INTERPRETER_CALLER_LIST(V)  \
25     V(RunInternal)                  \
26     V(Ldnan)                        \
27     V(Ldinfinity)                   \
28     V(Ldglobalthis)                 \
29     V(Ldundefined)                  \
30     V(Ldboolean)                    \
31     V(Ldnumber)                     \
32     V(Ldstring)                     \
33     V(Ldbigint)                     \
34     V(Ldnull)                       \
35     V(Ldsymbol)                     \
36     V(Ldfunction)                   \
37     V(Ldglobal)                     \
38     V(Ldtrue)                       \
39     V(Ldfalse)                      \
40     V(Tonumber)                     \
41     V(Toboolean)                    \
42     V(Add2Dyn)                      \
43     V(Sub2Dyn)                      \
44     V(Mul2Dyn)                      \
45     V(Div2Dyn)                      \
46     V(Mod2Dyn)                      \
47     V(EqDyn)                        \
48     V(NotEqDyn)                     \
49     V(LessDyn)                      \
50     V(LessEqDyn)                    \
51     V(GreaterDyn)                   \
52     V(GreaterEqDyn)                 \
53     V(StrictNotEqDyn)               \
54     V(StrictEqDyn)                  \
55     V(Shl2Dyn)                      \
56     V(Shr2Dyn)                      \
57     V(Ashr2Dyn)                     \
58     V(And2Dyn)                      \
59     V(Or2Dyn)                       \
60     V(Xor2Dyn)                      \
61     V(NegDyn)                       \
62     V(NotDyn)                       \
63     V(IncDyn)                       \
64     V(DecDyn)                       \
65     V(ExpDyn)                       \
66     V(ThrowDyn)                     \
67     V(LdObjByIndexDyn)              \
68     V(StObjByIndexDyn)              \
69     V(LdObjByNameDyn)               \
70     V(StObjByNameDyn)               \
71     V(LdObjByValueDyn)              \
72     V(StObjByValueDyn)              \
73     V(StOwnByNameDyn)               \
74     V(StOwnByIdDyn)                 \
75     V(StOwnByValueDyn)              \
76     V(Trygetobjprop)                \
77     V(Delobjprop)                   \
78     V(Defineglobalvar)              \
79     V(Definelocalvar)               \
80     V(Definefuncexpr)               \
81     V(DefinefuncDyn)                \
82     V(DefineNCFuncDyn)              \
83     V(NewobjDynrange)               \
84     V(RefeqDyn)                     \
85     V(TypeofDyn)                    \
86     V(LdnewobjrangeDyn)             \
87     V(IsInDyn)                      \
88     V(InstanceofDyn)                \
89     V(NewobjspreadDyn)              \
90     V(CallArg0Dyn)                  \
91     V(CallArg1Dyn)                  \
92     V(CallArg2Dyn)                  \
93     V(CallArg3Dyn)                  \
94     V(CallThisRangeDyn)             \
95     V(CallRangeDyn)                 \
96     V(CallSpreadDyn)                \
97     V(NewlexenvDyn)                 \
98     V(NewlexenvwithNameDyn)         \
99     V(StlexvarDyn)                  \
100     V(LdlexvarDyn)                  \
101     V(LdlexenvDyn)                  \
102     V(GetPropIterator)              \
103     V(CreateIterResultObj)          \
104     V(DefineGeneratorFunc)          \
105     V(SuspendGenerator)             \
106     V(ResumeGenerator)              \
107     V(GetResumeMode)                \
108     V(CreateGeneratorObj)           \
109     V(DefineAsyncFunc)              \
110     V(DefineGetterSetterByValue)    \
111     V(AsyncFunctionEnter)           \
112     V(AsyncFunctionAwaitUncaught)   \
113     V(AsyncFunctionResolveOrReject) \
114     V(ThrowUndefined)               \
115     V(ThrowConstAssignment)         \
116     V(ThrowUndefinedIfHole)         \
117     V(Copyrestargs)                 \
118     V(Trystobjprop)                 \
119     V(GetTemplateObject)            \
120     V(GetIterator)                  \
121     V(ThrowIfNotObject)             \
122     V(ThrowThrowNotExists)          \
123     V(CreateObjectWithExcludedKeys) \
124     V(ThrowPatternNonCoercible)     \
125     V(IterNext)                     \
126     V(CloseIterator)                \
127     V(StArraySpread)                \
128     V(GetCallSpreadArgs)            \
129     V(TryLoadICByName)              \
130     V(LoadICByName)                 \
131     V(GetPropertyByName)            \
132     V(TryLoadICByValue)             \
133     V(LoadICByValue)                \
134     V(TryStoreICByName)             \
135     V(StoreICByName)                \
136     V(TryStoreICByValue)            \
137     V(StoreICByValue)               \
138     V(NotifyInlineCache)            \
139     V(LoadGlobalICByName)           \
140     V(StoreGlobalICByName)          \
141     V(StoreICWithHandler)           \
142     V(StorePrototype)               \
143     V(StoreWithTransition)          \
144     V(StoreField)                   \
145     V(StoreGlobal)                  \
146     V(LoadPrototype)                \
147     V(LoadICWithHandler)            \
148     V(StoreElement)                 \
149     V(CallGetter)                   \
150     V(CallSetter)                   \
151     V(AddPropertyByName)            \
152     V(AddPropertyByIndex)           \
153     V(GetPropertyByIndex)           \
154     V(GetPropertyByValue)           \
155     V(SetPropertyByIndex)           \
156     V(SetPropertyByValue)           \
157     V(FastTypeOf)                   \
158     V(FastSetPropertyByIndex)       \
159     V(FastSetPropertyByValue)       \
160     V(FastGetPropertyByName)        \
161     V(FastGetPropertyByValue)       \
162     V(FastGetPropertyByIndex)       \
163     V(NewLexicalEnvDyn)             \
164     V(SetElement)                   \
165     V(SetGlobalOwnProperty)         \
166     V(SetOwnPropertyByName)         \
167     V(SetOwnElement)                \
168     V(FastSetProperty)              \
169     V(FastGetProperty)              \
170     V(FindOwnProperty)              \
171     V(HasOwnProperty)               \
172     V(ExecuteNative)                \
173     V(Execute)                      \
174     V(ToJSTaggedValueWithInt32)     \
175     V(ToJSTaggedValueWithUint32)    \
176     V(ThrowIfSuperNotCorrectCall)   \
177     V(CreateEmptyArray)             \
178     V(CreateEmptyObject)            \
179     V(CreateObjectWithBuffer)       \
180     V(CreateObjectHavingMethod)     \
181     V(SetObjectWithProto)           \
182     V(ImportModule)                 \
183     V(StModuleVar)                  \
184     V(CopyModule)                   \
185     V(LdModvarByName)               \
186     V(CreateRegExpWithLiteral)      \
187     V(CreateArrayWithBuffer)        \
188     V(GetNextPropName)              \
189     V(CopyDataProperties)           \
190     V(GetUnmapedArgs)               \
191     V(TryStGlobalByName)            \
192     V(LdGlobalVar)                  \
193     V(StGlobalVar)                  \
194     V(TryUpdateGlobalRecord)        \
195     V(LdGlobalRecord)               \
196     V(StGlobalRecord)               \
197     V(ThrowReferenceError)          \
198     V(ThrowTypeError)               \
199     V(ThrowSyntaxError)             \
200     V(NewClassFunc)                 \
201     V(DefineClass)                  \
202     V(SuperCall)                    \
203     V(SuperCallSpread)              \
204     V(DefineMethod)                 \
205     V(LdSuperByValue)               \
206     V(StSuperByValue)               \
207     V(ThrowDeleteSuperProperty)     \
208     V(GetIteratorNext)              \
209     V(ModWithTSType)                \
210     V(MulWithTSType)                \
211     V(SubWithTSType)                \
212     V(DivWithTSType)                \
213     V(AddWithTSType)                \
214     V(GetBitOPDate)                 \
215     V(ShlWithTSType)                \
216     V(ShrWithTSType)                \
217     V(AshrWithTSType)               \
218     V(AndWithTSType)                \
219     V(OrWithTSType)                 \
220     V(XorWithTSType)                \
221     V(EqualWithIC)                  \
222     V(NotEqualWithIC)               \
223     V(Compare)                      \
224     V(LessDynWithIC)                \
225     V(LessEqDynWithIC)              \
226     V(GreaterDynWithIC)             \
227     V(SetPropertyByName)            \
228     V(GreaterEqDynWithIC)           \
229     V(LdBigInt)
230 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
231 #define BUITINS_API_LIST(V)                   \
232     V(Array, Constructor)                     \
233     V(Array, From)                            \
234     V(Array, Of)                              \
235     V(Array, IsArray)                         \
236     V(Array, Entries)                         \
237     V(Array, Species)                         \
238     V(Array, Concat)                          \
239     V(Array, CopyWithin)                      \
240     V(Array, Fill)                            \
241     V(Array, Filter)                          \
242     V(Array, Find)                            \
243     V(Array, FindIndex)                       \
244     V(Array, IndexOf)                         \
245     V(Array, Join)                            \
246     V(Array, Keys)                            \
247     V(Array, LastIndexOf)                     \
248     V(Array, Map)                             \
249     V(Array, Pop)                             \
250     V(Array, Push)                            \
251     V(Array, Reduce)                          \
252     V(Array, ReduceRight)                     \
253     V(Array, Reverse)                         \
254     V(Array, Shift)                           \
255     V(Array, Slice)                           \
256     V(Array, Some)                            \
257     V(Array, Sort)                            \
258     V(Array, Splice)                          \
259     V(Array, ToLocaleString)                  \
260     V(Array, ToString)                        \
261     V(Array, Unshift)                         \
262     V(Array, Values)                          \
263     V(ArrayBuffer, Constructor)               \
264     V(ArrayBuffer, Slice)                     \
265     V(ArrayBuffer, GetValueFromBuffer)        \
266     V(ArrayBuffer, SetValueInBuffer)          \
267     V(ArrayBuffer, CloneArrayBuffer)          \
268     V(ArrayBuffer, AllocateArrayBuffer)       \
269     V(AsyncFunction, Constructor)             \
270     V(Boolean, Constructor)                   \
271     V(Boolean, ThisBooleanValue)              \
272     V(DataView, Constructor)                  \
273     V(DataView, GetBuffer)                    \
274     V(DataView, GetByteLength)                \
275     V(DataView, GetOffset)                    \
276     V(DataView, GetViewValue)                 \
277     V(DataView, SetViewValue)                 \
278     V(Date, Constructor)                      \
279     V(Date, Now)                              \
280     V(Date, UTC)                              \
281     V(Date, Parse)                            \
282     V(Date, GetDateField)                     \
283     V(Date, GetTime)                          \
284     V(Date, SetTime)                          \
285     V(Date, ToJSON)                           \
286     V(Date, ValueOf)                          \
287     V(Date, ToPrimitive)                      \
288     V(Function, Constructor)                  \
289     V(Function, PrototypeApply)               \
290     V(Function, PrototypeBind)                \
291     V(Function, PrototypeCall)                \
292     V(Function, PrototypeToString)            \
293     V(Function, PrototypeHasInstance)         \
294     V(Generator, Constructor)                 \
295     V(Generator, PrototypeNext)               \
296     V(Generator, PrototypeReturn)             \
297     V(Generator, PrototypeThrow)              \
298     V(Global, IsFinite)                       \
299     V(Global, IsNaN)                          \
300     V(Global, PrintEntryPoint)                \
301     V(Global, NewobjDynrange)                 \
302     V(Global, CallJsBoundFunction)            \
303     V(Global, CallJsProxy)                    \
304     V(Global, DecodeURI)                      \
305     V(Global, EncodeURI)                      \
306     V(Global, DecodeURIComponent)             \
307     V(Global, EncodeURIComponent)             \
308     V(Iterator, Constructor)                  \
309     V(Iterator, Next)                         \
310     V(Iterator, Throw)                        \
311     V(Iterator, Return)                       \
312     V(Iterator, GetObj)                       \
313     V(Json, Parse)                            \
314     V(Json, Stringify)                        \
315     V(Map, Constructor)                       \
316     V(Map, Species)                           \
317     V(Map, Clear)                             \
318     V(Map, Delete)                            \
319     V(Map, Entries)                           \
320     V(Map, Get)                               \
321     V(Map, Has)                               \
322     V(Map, Keys)                              \
323     V(Map, Set)                               \
324     V(Map, GetSize)                           \
325     V(Map, Values)                            \
326     V(Math, Abs)                              \
327     V(Math, Acos)                             \
328     V(Math, Acosh)                            \
329     V(Math, Asin)                             \
330     V(Math, Asinh)                            \
331     V(Math, Atan)                             \
332     V(Math, Atanh)                            \
333     V(Math, Atan2)                            \
334     V(Math, Cbrt)                             \
335     V(Math, Ceil)                             \
336     V(Math, Clz32)                            \
337     V(Math, Cos)                              \
338     V(Math, Cosh)                             \
339     V(Math, Exp)                              \
340     V(Math, Expm1)                            \
341     V(Math, Floor)                            \
342     V(Math, Fround)                           \
343     V(Math, Hypot)                            \
344     V(Math, Imul)                             \
345     V(Math, Log)                              \
346     V(Math, Log1p)                            \
347     V(Math, Log10)                            \
348     V(Math, Log2)                             \
349     V(Math, Max)                              \
350     V(Math, Min)                              \
351     V(Math, Pow)                              \
352     V(Math, Random)                           \
353     V(Math, Round)                            \
354     V(Math, Sign)                             \
355     V(Math, Sin)                              \
356     V(Math, Sinh)                             \
357     V(Math, Sqrt)                             \
358     V(Math, Tan)                              \
359     V(Math, Tanh)                             \
360     V(Math, Trunc)                            \
361     V(Number, Constructor)                    \
362     V(Number, IsFinite)                       \
363     V(Number, IsInteger)                      \
364     V(Number, IsNaN)                          \
365     V(Number, IsSafeInteger)                  \
366     V(Number, ParseFloat)                     \
367     V(Number, ParseInt)                       \
368     V(Number, ToExponential)                  \
369     V(Number, ToFixed)                        \
370     V(Number, ToLocaleString)                 \
371     V(Number, ToPrecision)                    \
372     V(Number, ToString)                       \
373     V(Number, ValueOf)                        \
374     V(Number, ThisNumberValue)                \
375     V(BigInt, Constructor)                    \
376     V(BigInt, AsUintN)                        \
377     V(BigInt, AsIntN)                         \
378     V(BigInt, ToLocaleString)                 \
379     V(BigInt, ToString)                       \
380     V(BigInt, ValueOf)                        \
381     V(BigInt, ThisBigIntValue)                \
382     V(Object, Constructor)                    \
383     V(Object, Assign)                         \
384     V(Object, Create)                         \
385     V(Object, DefineProperties)               \
386     V(Object, DefineProperty)                 \
387     V(Object, Freeze)                         \
388     V(Object, GetOwnPropertyDesciptor)        \
389     V(Object, GetOwnPropertyKeys)             \
390     V(Object, GetOwnPropertyNames)            \
391     V(Object, GetOwnPropertySymbols)          \
392     V(Object, GetPrototypeOf)                 \
393     V(Object, Is)                             \
394     V(Object, Keys)                           \
395     V(Object, PreventExtensions)              \
396     V(Object, Seal)                           \
397     V(Object, SetPrototypeOf)                 \
398     V(Object, HasOwnProperty)                 \
399     V(Object, IsPrototypeOf)                  \
400     V(Object, ToLocaleString)                 \
401     V(Object, GetBuiltinTag)                  \
402     V(Object, ToString)                       \
403     V(Object, ValueOf)                        \
404     V(Object, ProtoGetter)                    \
405     V(Object, ProtoSetter)                    \
406     V(PromiseHandler, Resolve)                \
407     V(PromiseHandler, Reject)                 \
408     V(PromiseHandler, Executor)               \
409     V(PromiseHandler, ResolveElementFunction) \
410     V(PromiseJob, Reaction)                   \
411     V(PromiseJob, ResolveThenableJob)         \
412     V(Promise, Constructor)                   \
413     V(Promise, All)                           \
414     V(Promise, Race)                          \
415     V(Promise, Reject)                        \
416     V(Promise, Resolve)                       \
417     V(Promise, GetSpecies)                    \
418     V(Promise, Catch)                         \
419     V(Promise, Then)                          \
420     V(Promise, PerformPromiseThen)            \
421     V(Proxy, Constructor)                     \
422     V(Proxy, Revocable)                       \
423     V(Proxy, InvalidateProxyFunction)         \
424     V(Reflect, Apply)                         \
425     V(Reflect, Constructor)                   \
426     V(Reflect, DefineProperty)                \
427     V(Reflect, DeleteProperty)                \
428     V(Reflect, Get)                           \
429     V(Reflect, GetOwnPropertyDescriptor)      \
430     V(Reflect, GetPrototypeOf)                \
431     V(Reflect, Has)                           \
432     V(Reflect, OwnKeys)                       \
433     V(Reflect, PreventExtensions)             \
434     V(Reflect, Set)                           \
435     V(Reflect, SetPrototypeOf)                \
436     V(RegExp, Constructor)                    \
437     V(RegExp, Exec)                           \
438     V(RegExp, Test)                           \
439     V(RegExp, ToString)                       \
440     V(RegExp, GetFlags)                       \
441     V(RegExp, GetSpecies)                     \
442     V(RegExp, Match)                          \
443     V(RegExp, Replace)                        \
444     V(RegExp, Search)                         \
445     V(RegExp, Split)                          \
446     V(RegExp, Create)                         \
447     V(Set, Constructor)                       \
448     V(Set, Species)                           \
449     V(Set, Add)                               \
450     V(Set, Clear)                             \
451     V(Set, Delete)                            \
452     V(Set, Entries)                           \
453     V(Set, Has)                               \
454     V(Set, GetSize)                           \
455     V(Set, Values)                            \
456     V(StringIterator, Next)                   \
457     V(String, Constructor)                    \
458     V(String, FromCharCode)                   \
459     V(String, FromCodePoint)                  \
460     V(String, Raw)                            \
461     V(String, GetSubstitution)                \
462     V(String, CharAt)                         \
463     V(String, CharCodeAt)                     \
464     V(String, CodePointAt)                    \
465     V(String, Concat)                         \
466     V(String, EndsWith)                       \
467     V(String, Includes)                       \
468     V(String, IndexOf)                        \
469     V(String, LastIndexOf)                    \
470     V(String, LocaleCompare)                  \
471     V(String, Match)                          \
472     V(String, Normalize)                      \
473     V(String, Repeat)                         \
474     V(String, Replace)                        \
475     V(String, Search)                         \
476     V(String, Slice)                          \
477     V(String, Split)                          \
478     V(String, StartsWith)                     \
479     V(String, Substring)                      \
480     V(String, ToLocaleLowerCase)              \
481     V(String, ToLocaleUpperCase)              \
482     V(String, ToLowerCase)                    \
483     V(String, ToString)                       \
484     V(String, ToUpperCase)                    \
485     V(String, Trim)                           \
486     V(String, GetStringIterator)              \
487     V(String, SubStr)                         \
488     V(Symbol, Constructor)                    \
489     V(Symbol, ToString)                       \
490     V(Symbol, ValueOf)                        \
491     V(Symbol, For)                            \
492     V(Symbol, KeyFor)                         \
493     V(Symbol, DescriptionGetter)              \
494     V(Symbol, ThisSymbolValue)                \
495     V(Symbol, ToPrimitive)                    \
496     V(Symbol, SymbolDescriptiveString)        \
497     V(TypedArray, BaseConstructor)            \
498     V(TypedArray, From)                       \
499     V(TypedArray, Of)                         \
500     V(TypedArray, Species)                    \
501     V(TypedArray, GetBuffer)                  \
502     V(TypedArray, GetByteLength)              \
503     V(TypedArray, GetByteOffset)              \
504     V(TypedArray, CopyWithin)                 \
505     V(TypedArray, Entries)                    \
506     V(TypedArray, Every)                      \
507     V(TypedArray, Filter)                     \
508     V(TypedArray, ForEach)                    \
509     V(TypedArray, Join)                       \
510     V(TypedArray, Keys)                       \
511     V(TypedArray, GetLength)                  \
512     V(TypedArray, Map)                        \
513     V(TypedArray, Set)                        \
514     V(TypedArray, Slice)                      \
515     V(TypedArray, Sort)                       \
516     V(TypedArray, Subarray)                   \
517     V(TypedArray, Values)                     \
518     V(TypedArray, ToStringTag)                \
519     V(WeakMap, Constructor)                   \
520     V(WeakMap, Delete)                        \
521     V(WeakMap, Get)                           \
522     V(WeakMap, Has)                           \
523     V(WeakMap, Set)                           \
524     V(WeakSet, Constructor)                   \
525     V(WeakSet, Delete)                        \
526     V(WeakSet, Add)                           \
527     V(WeakSet, Has)                           \
528     V(ArrayList, Constructor)                 \
529     V(ArrayList, Add)                         \
530     V(ArrayList, Insert)                      \
531     V(ArrayList, Clear)                       \
532     V(ArrayList, Clone)                       \
533     V(ArrayList, Has)                         \
534     V(ArrayList, GetCapacity)                 \
535     V(ArrayList, IncreaseCapacityTo)          \
536     V(ArrayList, TrimToCurrentLength)         \
537     V(ArrayList, GetIndexOf)                  \
538     V(ArrayList, IsEmpty)                     \
539     V(ArrayList, GetLastIndexOf)              \
540     V(ArrayList, RemoveByIndex)               \
541     V(ArrayList, Remove)                      \
542     V(ArrayList, RemoveByRange)               \
543     V(ArrayList, ReplaceAllElements)          \
544     V(ArrayList, Sort)                        \
545     V(ArrayList, SubArrayList)                \
546     V(ArrayList, ConvertToArray)              \
547     V(ArrayList, ForEach)                     \
548     V(ArrayList, GetIteratorObj)              \
549     V(ArrayList, Get)                         \
550     V(ArrayList, Set)                         \
551     V(ArrayList, GetSize)                     \
552     V(TreeMap, Constructor)                   \
553     V(TreeMap, HasKey)                        \
554     V(TreeMap, HasValue)                      \
555     V(TreeMap, GetFirstKey)                   \
556     V(TreeMap, GetLastKey)                    \
557     V(TreeMap, Set)                           \
558     V(TreeMap, Get)                           \
559     V(TreeMap, SetAll)                        \
560     V(TreeMap, Remove)                        \
561     V(TreeMap, Clear)                         \
562     V(TreeMap, GetLowerKey)                   \
563     V(TreeMap, GetHigherKey)                  \
564     V(TreeMap, Replace)                       \
565     V(TreeMap, IsEmpty)                       \
566     V(TreeMap, GetLength)                     \
567     V(TreeMap, Keys)                          \
568     V(TreeMap, Values)                        \
569     V(TreeMap, Entries)                       \
570     V(TreeMap, ForEach)                       \
571     V(TreeSet, Constructor)                   \
572     V(TreeSet, Add)                           \
573     V(TreeSet, Remove)                        \
574     V(TreeSet, Clear)                         \
575     V(TreeSet, Has)                           \
576     V(TreeSet, GetFirstValue)                 \
577     V(TreeSet, GetLastValue)                  \
578     V(TreeSet, GetLowerValue)                 \
579     V(TreeSet, GetHigherValue)                \
580     V(TreeSet, PopFirst)                      \
581     V(TreeSet, PopLast)                       \
582     V(TreeSet, IsEmpty)                       \
583     V(TreeSet, GetLength)                     \
584     V(TreeSet, Values)                        \
585     V(TreeSet, ForEach)                       \
586     V(TreeSet, Entries)
587 
588 #define ABSTRACT_OPERATION_LIST(V) \
589     V(JSTaggedValue, ToString)     \
590 
591 #define MEM_ALLOCATE_AND_GC_LIST(V)  \
592     V(FullGC_RunPhases)              \
593     V(MixGC_RunPhases)               \
594     V(STWYoungGC_RunPhases)          \
595     V(ConcurrentMarking)             \
596     V(ConcurrentMarkingInitialize)   \
597     V(WaitConcurrentMarkingFinished) \
598     V(ReMarking)                     \
599     V(ConcurrentSweepingInitialize)  \
600     V(ConcurrentSweepingWait)        \
601     V(ParallelEvacuationInitialize)  \
602     V(ParallelEvacuation)            \
603     V(ParallelUpdateReference)       \
604     V(WaitUpdateFinished)            \
605     V(UpdateRoot)                    \
606     V(UpdateWeakReference)           \
607     V(ParallelEvacuationFinalize)    \
608     V(HugeSpaceExpand)               \
609     V(NonMovableSpaceExpand)         \
610     V(HeapPrepare)                   \
611 
612 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
613 #define INTERPRETER_CALLER_ID(name) INTERPRETER_ID_##name,
614 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
615 #define BUILTINS_API_ID(class, name) BUILTINS_ID_##class##_##name,
616 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
617 #define ABSTRACT_OPERATION_ID(class, name) ABSTRACT_ID_##class##_##name,
618 
619 #define MEM_ALLOCATE_AND_GC_ID(name) MEM_ID##name,
620 
621 enum EcmaRuntimeCallerId {
622     INTERPRETER_CALLER_LIST(INTERPRETER_CALLER_ID) BUITINS_API_LIST(BUILTINS_API_ID)
623     ABSTRACT_OPERATION_LIST(ABSTRACT_OPERATION_ID)
624     MEM_ALLOCATE_AND_GC_LIST(MEM_ALLOCATE_AND_GC_ID)
625     RUNTIME_CALLER_NUMBER,
626 };
627 
628 #if ECMASCRIPT_ENABLE_INTERPRETER_TRUNTIME_STAT
629 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
630 #define INTERPRETER_TRACE(thread, name)                                                        \
631     [[maybe_unused]] JSThread *_js_thread_ = thread;                                           \
632     [[maybe_unused]] EcmaRuntimeStat *_run_stat_ = _js_thread_->GetEcmaVM()->GetRuntimeStat(); \
633     RuntimeTimerScope interpret_##name##_scope_(thread, INTERPRETER_CALLER_ID(name) _run_stat_)
634 #else
635 #define INTERPRETER_TRACE(thread, name) static_cast<void>(0) // NOLINT(cppcoreguidelines-macro-usage)
636 #endif // ECMASCRIPT_ENABLE_INTERPRETER_TRUNTIME_STAT
637 
638 #if ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT
639 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
640 #define BUILTINS_API_TRACE(thread, class, name)                                                \
641     [[maybe_unused]] JSThread *_js_thread_ = thread;                                           \
642     [[maybe_unused]] EcmaRuntimeStat *_run_stat_ = _js_thread_->GetEcmaVM()->GetRuntimeStat(); \
643     RuntimeTimerScope builtins_##class##name##_scope_(thread, BUILTINS_API_ID(class, name) _run_stat_)
644 
645 // NOLINTNEXTLINE(cppcoreguidelines-macro-usage)
646 #define ABSTRACT_OPERATION_TRACE(thread, class, name)                                          \
647     [[maybe_unused]] JSThread *_js_thread_ = thread;                                           \
648     [[maybe_unused]] EcmaRuntimeStat *_run_stat_ = _js_thread_->GetEcmaVM()->GetRuntimeStat(); \
649     RuntimeTimerScope abstract_##class##name##_scope_(thread, ABSTRACT_OPERATION_ID(class, name) _run_stat_)
650 #else
651 #define BUILTINS_API_TRACE(thread, class, name) static_cast<void>(0) // NOLINT(cppcoreguidelines-macro-usage)
652 #define ABSTRACT_OPERATION_TRACE(thread, class, name) static_cast<void>(0) // NOLINT(cppcoreguidelines-macro-usage)
653 #endif // ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT
654 
655 #if ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT
656 #define MEM_ALLOCATE_AND_GC_TRACE(vm, name)             \
657     CHECK_JS_THREAD(vm);                                \
658     EcmaRuntimeStat *_run_stat_ = vm->GetRuntimeStat(); \
659     RuntimeTimerScope mem_##name##_scope_(vm, MEM_ALLOCATE_AND_GC_ID(name) _run_stat_)
660 #else
661 #define MEM_ALLOCATE_AND_GC_TRACE(vm, name) static_cast<void>(0) // NOLINT(cppcoreguidelines-macro-usage)
662 #endif // ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT
663 }  // namespace panda::ecmascript
664 #endif
665