• 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_STUBS_H
17 #define ECMASCRIPT_RUNTIME_STUBS_H
18 
19 #include "ecmascript/compiler/call_signature.h"
20 #include "ecmascript/frames.h"
21 #include "ecmascript/stubs/test_runtime_stubs.h"
22 #include "ecmascript/ecma_macros.h"
23 #include "ecmascript/js_tagged_value.h"
24 #include "ecmascript/method.h"
25 #include "ecmascript/mem/region.h"
26 
27 namespace panda::ecmascript {
28 using kungfu::CallSignature;
29 class EcmaVM;
30 class GlobalEnv;
31 class JSThread;
32 class JSFunction;
33 class ObjectFactory;
34 class JSBoundFunction;
35 class JSProxy;
36 
37 class GeneratorContext;
38 struct EcmaRuntimeCallInfo;
39 
40 using JSFunctionEntryType = JSTaggedValue (*)(uintptr_t glue, uint32_t argc, const JSTaggedType argV[],
41                                               uintptr_t prevFp, size_t callType);
42 
43 #define RUNTIME_ASM_STUB_LIST(V)             \
44     JS_CALL_TRAMPOLINE_LIST(V)               \
45     ASM_INTERPRETER_TRAMPOLINE_LIST(V)
46 
47 #define ASM_INTERPRETER_TRAMPOLINE_LIST(V)   \
48     V(AsmInterpreterEntry)                   \
49     V(GeneratorReEnterAsmInterp)             \
50     V(PushCallArgsAndDispatchNative)         \
51     V(PushCallArg0AndDispatch)               \
52     V(PushCallArg1AndDispatch)               \
53     V(PushCallArgs2AndDispatch)              \
54     V(PushCallArgs3AndDispatch)              \
55     V(PushCallThisArg0AndDispatch)           \
56     V(PushCallThisArg1AndDispatch)           \
57     V(PushCallThisArgs2AndDispatch)          \
58     V(PushCallThisArgs3AndDispatch)          \
59     V(PushCallRangeAndDispatch)              \
60     V(PushCallNewAndDispatch)                \
61     V(PushCallNewAndDispatchNative)          \
62     V(PushCallRangeAndDispatchNative)        \
63     V(PushCallThisRangeAndDispatch)          \
64     V(ResumeRspAndDispatch)                  \
65     V(ResumeRspAndReturn)                    \
66     V(ResumeCaughtFrameAndDispatch)          \
67     V(ResumeUncaughtFrameAndReturn)          \
68     V(CallSetter)                            \
69     V(CallGetter)                            \
70     V(CallContainersArgs3)
71 
72 #define JS_CALL_TRAMPOLINE_LIST(V)           \
73     V(CallRuntime)                           \
74     V(CallRuntimeWithArgv)                   \
75     V(JSFunctionEntry)                       \
76     V(JSCall)                                \
77     V(ConstructorJSCall)                     \
78     V(JSCallWithArgV)                        \
79     V(ConstructorJSCallWithArgV)             \
80     V(JSProxyCallInternalWithArgV)           \
81     V(OptimizedCallOptimized)                \
82     V(DeoptHandlerAsm)                       \
83     V(JSCallNew)                             \
84     V(JSCallNewWithArgV)
85 
86 
87 #define RUNTIME_STUB_WITHOUT_GC_LIST(V)        \
88     V(DebugPrint)                              \
89     V(DebugPrintInstruction)                   \
90     V(PGOProfiler)                             \
91     V(FatalPrint)                              \
92     V(GetActualArgvNoGC)                       \
93     V(InsertOldToNewRSet)                      \
94     V(MarkingBarrier)                          \
95     V(StoreBarrier)                            \
96     V(DoubleToInt)                             \
97     V(FloatMod)                                \
98     V(FloatSqrt)                               \
99     V(FloatCos)                                \
100     V(FloatSin)                                \
101     V(FloatACos)                               \
102     V(FloatATan)                               \
103     V(FloatFloor)                              \
104     V(FindElementWithCache)                    \
105     V(CreateArrayFromList)                     \
106     V(StringsAreEquals)                        \
107     V(BigIntEquals)                            \
108     V(TimeClip)                                \
109     V(SetDateValues)
110 
111 #define RUNTIME_STUB_WITH_GC_LIST(V)      \
112     V(AddElementInternal)                 \
113     V(AllocateInYoung)                    \
114     V(CallInternalGetter)                 \
115     V(CallInternalSetter)                 \
116     V(CallGetPrototype)                   \
117     V(ThrowTypeError)                     \
118     V(Dump)                               \
119     V(GetHash32)                          \
120     V(ComputeHashcode)                    \
121     V(GetTaggedArrayPtrTest)              \
122     V(NewInternalString)                  \
123     V(NewTaggedArray)                     \
124     V(CopyArray)                          \
125     V(NameDictPutIfAbsent)                \
126     V(PropertiesSetValue)                 \
127     V(TaggedArraySetValue)                \
128     V(CheckAndCopyArray)                  \
129     V(NewEcmaHClass)                      \
130     V(UpdateLayOutAndAddTransition)       \
131     V(NoticeThroughChainAndRefreshUser)   \
132     V(JumpToCInterpreter)                 \
133     V(JumpToDeprecatedInst)               \
134     V(JumpToWideInst)                     \
135     V(JumpToThrowInst)                    \
136     V(StGlobalRecord)                     \
137     V(SetFunctionNameNoPrefix)            \
138     V(StOwnByValueWithNameSet)            \
139     V(StOwnByName)                        \
140     V(StOwnByNameWithNameSet)             \
141     V(SuspendGenerator)                   \
142     V(UpFrame)                            \
143     V(Neg)                                \
144     V(Not)                                \
145     V(Inc)                                \
146     V(Dec)                                \
147     V(Shl2)                               \
148     V(Shr2)                               \
149     V(Ashr2)                              \
150     V(Or2)                                \
151     V(Xor2)                               \
152     V(And2)                               \
153     V(Exp)                                \
154     V(IsIn)                               \
155     V(InstanceOf)                         \
156     V(CreateGeneratorObj)                 \
157     V(ThrowConstAssignment)               \
158     V(GetTemplateObject)                  \
159     V(GetNextPropName)                    \
160     V(ThrowIfNotObject)                   \
161     V(IterNext)                           \
162     V(CloseIterator)                      \
163     V(SuperCallSpread)                    \
164     V(OptSuperCallSpread)                 \
165     V(DelObjProp)                         \
166     V(NewObjApply)                        \
167     V(CreateIterResultObj)                \
168     V(AsyncFunctionAwaitUncaught)         \
169     V(AsyncFunctionResolveOrReject)       \
170     V(ThrowUndefinedIfHole)               \
171     V(CopyDataProperties)                 \
172     V(StArraySpread)                      \
173     V(GetIteratorNext)                    \
174     V(SetObjectWithProto)                 \
175     V(LoadICByValue)                      \
176     V(StoreICByValue)                     \
177     V(StOwnByValue)                       \
178     V(LdSuperByValue)                     \
179     V(StSuperByValue)                     \
180     V(LdObjByIndex)                       \
181     V(StObjByIndex)                       \
182     V(StOwnByIndex)                       \
183     V(CreateClassWithBuffer)              \
184     V(CreateClassWithIHClass)             \
185     V(SetClassConstructorLength)          \
186     V(LoadICByName)                       \
187     V(StoreICByName)                      \
188     V(UpdateHotnessCounter)               \
189     V(GetModuleNamespaceByIndex)          \
190     V(GetModuleNamespaceByIndexOnJSFunc)  \
191     V(GetModuleNamespace)                 \
192     V(StModuleVarByIndex)                 \
193     V(StModuleVarByIndexOnJSFunc)         \
194     V(StModuleVar)                        \
195     V(LdLocalModuleVarByIndex)            \
196     V(LdExternalModuleVarByIndex)         \
197     V(LdLocalModuleVarByIndexOnJSFunc)    \
198     V(LdExternalModuleVarByIndexOnJSFunc) \
199     V(LdModuleVar)                        \
200     V(Throw)                              \
201     V(GetPropIterator)                    \
202     V(AsyncFunctionEnter)                 \
203     V(GetIterator)                        \
204     V(GetAsyncIterator)                   \
205     V(SetGeneratorState)                  \
206     V(ThrowThrowNotExists)                \
207     V(ThrowPatternNonCoercible)           \
208     V(ThrowDeleteSuperProperty)           \
209     V(Eq)                                 \
210     V(TryLdGlobalICByName)                \
211     V(LoadMiss)                           \
212     V(StoreMiss)                          \
213     V(TryUpdateGlobalRecord)              \
214     V(ThrowReferenceError)                \
215     V(StGlobalVar)                        \
216     V(LdGlobalICVar)                      \
217     V(ToNumber)                           \
218     V(ToBoolean)                          \
219     V(NotEq)                              \
220     V(Less)                               \
221     V(LessEq)                             \
222     V(Greater)                            \
223     V(GreaterEq)                          \
224     V(Add2)                               \
225     V(Sub2)                               \
226     V(Mul2)                               \
227     V(Div2)                               \
228     V(Mod2)                               \
229     V(CreateEmptyObject)                  \
230     V(CreateEmptyArray)                   \
231     V(GetSymbolFunction)                  \
232     V(GetUnmapedArgs)                     \
233     V(CopyRestArgs)                       \
234     V(CreateArrayWithBuffer)              \
235     V(CreateObjectWithBuffer)             \
236     V(NewThisObject)                      \
237     V(NewObjRange)                        \
238     V(DefineFunc)                         \
239     V(CreateRegExpWithLiteral)            \
240     V(ThrowIfSuperNotCorrectCall)         \
241     V(CreateObjectHavingMethod)           \
242     V(CreateObjectWithExcludedKeys)       \
243     V(DefineMethod)                       \
244     V(ThrowSetterIsUndefinedException)    \
245     V(ThrowNotCallableException)          \
246     V(ThrowCallConstructorException)      \
247     V(ThrowNonConstructorException)       \
248     V(ThrowStackOverflowException)        \
249     V(ThrowDerivedMustReturnException)    \
250     V(CallSpread)                         \
251     V(DefineGetterSetterByValue)          \
252     V(SuperCall)                          \
253     V(OptSuperCall)                       \
254     V(LdBigInt)                           \
255     V(ToNumeric)                          \
256     V(DynamicImport)                      \
257     V(CreateAsyncGeneratorObj)            \
258     V(AsyncGeneratorResolve)              \
259     V(AsyncGeneratorReject)               \
260     V(NewLexicalEnvWithName)              \
261     V(OptGetUnmapedArgs)                  \
262     V(OptCopyRestArgs)                    \
263     V(NotifyBytecodePcChanged)            \
264     V(OptNewLexicalEnvWithName)           \
265     V(OptSuspendGenerator)                \
266     V(OptNewObjRange)                     \
267     V(GetTypeArrayPropertyByIndex)        \
268     V(SetTypeArrayPropertyByIndex)        \
269     V(JSObjectGetMethod)                  \
270     V(DebugAOTPrint)                      \
271     V(ProfileOptimizedCode)               \
272     V(GetMethodFromCache)                 \
273     V(GetArrayLiteralFromCache)           \
274     V(GetObjectLiteralFromCache)          \
275     V(GetStringFromCache)                 \
276     V(OptLdSuperByValue)                  \
277     V(OptStSuperByValue)                  \
278     V(BigIntEqual)                        \
279     V(StringEqual)                        \
280     V(LdPatchVar)                         \
281     V(StPatchVar)                         \
282     V(DeoptHandler)                       \
283     V(ContainerRBTreeForEach)             \
284     V(NotifyConcurrentResult)
285 
286 #define RUNTIME_STUB_LIST(V)                     \
287     RUNTIME_ASM_STUB_LIST(V)                     \
288     RUNTIME_STUB_WITHOUT_GC_LIST(V)              \
289     RUNTIME_STUB_WITH_GC_LIST(V)                 \
290     TEST_RUNTIME_STUB_GC_LIST(V)
291 
292 class RuntimeStubs {
293 public:
294     static void Initialize(JSThread *thread);
295 
296 #define DECLARE_RUNTIME_STUBS(name) \
297     static JSTaggedType name(uintptr_t argGlue, uint32_t argc, uintptr_t argv);
298     RUNTIME_STUB_WITH_GC_LIST(DECLARE_RUNTIME_STUBS)
TEST_RUNTIME_STUB_GC_LIST(DECLARE_RUNTIME_STUBS)299     TEST_RUNTIME_STUB_GC_LIST(DECLARE_RUNTIME_STUBS)
300 #undef DECLARE_RUNTIME_STUBS
301 
302     inline static JSTaggedType GetTArg(uintptr_t argv, [[maybe_unused]] uint32_t argc, uint32_t index)
303     {
304         ASSERT(index < argc);
305         return *(reinterpret_cast<JSTaggedType *>(argv) + (index));
306     }
307 
GetArg(uintptr_t argv,uint32_t argc,uint32_t index)308     inline static JSTaggedValue GetArg(uintptr_t argv, [[maybe_unused]] uint32_t argc, uint32_t index)
309     {
310         ASSERT(index < argc);
311         return JSTaggedValue(*(reinterpret_cast<JSTaggedType *>(argv) + (index)));
312     }
313 
314     template<typename T>
GetHArg(uintptr_t argv,uint32_t argc,uint32_t index)315     inline static JSHandle<T> GetHArg(uintptr_t argv, [[maybe_unused]] uint32_t argc, uint32_t index)
316     {
317         ASSERT(index < argc);
318         return JSHandle<T>(&(reinterpret_cast<JSTaggedType *>(argv)[index]));
319     }
320 
321     template<typename T>
GetPtrArg(uintptr_t argv,uint32_t argc,uint32_t index)322     inline static T *GetPtrArg(uintptr_t argv, [[maybe_unused]] uint32_t argc, uint32_t index)
323     {
324         ASSERT(index < argc);
325         return reinterpret_cast<T*>(*(reinterpret_cast<JSTaggedType *>(argv) + (index)));
326     }
327 
328     static void DebugPrint(int fmtMessageId, ...);
329     static void DebugPrintInstruction([[maybe_unused]]uintptr_t argGlue, const uint8_t *pc);
330     static void PGOProfiler(uintptr_t argGlue, uintptr_t func);
331     static void FatalPrint(int fmtMessageId, ...);
332     static void MarkingBarrier([[maybe_unused]]uintptr_t argGlue,
333         uintptr_t object, size_t offset, TaggedObject *value);
334     static void StoreBarrier([[maybe_unused]]uintptr_t argGlue,
335         uintptr_t object, size_t offset, TaggedObject *value);
336     static JSTaggedType CreateArrayFromList([[maybe_unused]]uintptr_t argGlue, int32_t argc, JSTaggedValue *argv);
337     static JSTaggedType GetActualArgvNoGC(uintptr_t argGlue);
338     static void InsertOldToNewRSet([[maybe_unused]]uintptr_t argGlue, uintptr_t object, size_t offset);
339     static int32_t DoubleToInt(double x);
340     static JSTaggedType FloatMod(double x, double y);
341     static JSTaggedType FloatSqrt(double x);
342     static JSTaggedType FloatCos(double x);
343     static JSTaggedType FloatSin(double x);
344     static JSTaggedType FloatACos(double x);
345     static JSTaggedType FloatATan(double x);
346     static JSTaggedType FloatFloor(double x);
347     static int32_t FindElementWithCache(uintptr_t argGlue, JSTaggedType hclass,
348                                         JSTaggedType key, int32_t num);
349     static bool StringsAreEquals(EcmaString *str1, EcmaString *str2);
350     static bool BigIntEquals(JSTaggedType left, JSTaggedType right);
351     static double TimeClip(double time);
352     static double SetDateValues(double year, double month, double day);
353 
354     static JSTaggedValue CallBoundFunction(EcmaRuntimeCallInfo *info);
355 private:
356     static void PrintHeapReginInfo(uintptr_t argGlue);
357 
358     static inline JSTaggedValue RuntimeInc(JSThread *thread, const JSHandle<JSTaggedValue> &value);
359     static inline JSTaggedValue RuntimeDec(JSThread *thread, const JSHandle<JSTaggedValue> &value);
360     static inline JSTaggedValue RuntimeExp(JSThread *thread, JSTaggedValue base, JSTaggedValue exponent);
361     static inline JSTaggedValue RuntimeIsIn(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
362                                                const JSHandle<JSTaggedValue> &obj);
363     static inline JSTaggedValue RuntimeInstanceof(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
364                                                      const JSHandle<JSTaggedValue> &target);
365     static inline JSTaggedValue RuntimeCreateGeneratorObj(JSThread *thread, const JSHandle<JSTaggedValue> &genFunc);
366 
367     static inline JSTaggedValue RuntimeCreateAsyncGeneratorObj(JSThread *thread,
368                                                                const JSHandle<JSTaggedValue> &genFunc);
369 
370     static inline JSTaggedValue RuntimeAsyncGeneratorResolve(JSThread *thread, JSHandle<JSTaggedValue> asyncFuncObj,
371                                                              JSHandle<JSTaggedValue> value, JSTaggedValue flag);
372     static inline JSTaggedValue RuntimeAsyncGeneratorReject(JSThread *thread, JSHandle<JSTaggedValue> asyncFuncObj,
373                                                             JSHandle<JSTaggedValue> value);
374     static inline JSTaggedValue RuntimeGetTemplateObject(JSThread *thread, const JSHandle<JSTaggedValue> &literal);
375     static inline JSTaggedValue RuntimeGetNextPropName(JSThread *thread, const JSHandle<JSTaggedValue> &iter);
376     static inline JSTaggedValue RuntimeIterNext(JSThread *thread, const JSHandle<JSTaggedValue> &iter);
377     static inline JSTaggedValue RuntimeCloseIterator(JSThread *thread, const JSHandle<JSTaggedValue> &iter);
378     static inline JSTaggedValue RuntimeSuperCallSpread(JSThread *thread, const JSHandle<JSTaggedValue> &func,
379                                                        const JSHandle<JSTaggedValue> &newTarget,
380                                                        const JSHandle<JSTaggedValue> &array);
381     static inline JSTaggedValue RuntimeDelObjProp(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
382                                                   const JSHandle<JSTaggedValue> &prop);
383     static inline JSTaggedValue RuntimeNewObjApply(JSThread *thread, const JSHandle<JSTaggedValue> &func,
384                                                        const JSHandle<JSTaggedValue> &array);
385     static inline JSTaggedValue RuntimeCreateIterResultObj(JSThread *thread, const JSHandle<JSTaggedValue> &value,
386                                                            JSTaggedValue flag);
387     static inline JSTaggedValue RuntimeAsyncFunctionAwaitUncaught(JSThread *thread,
388                                                                   const JSHandle<JSTaggedValue> &asyncFuncObj,
389                                                                   const JSHandle<JSTaggedValue> &value);
390     static inline JSTaggedValue RuntimeAsyncFunctionResolveOrReject(JSThread *thread,
391                                                                     const JSHandle<JSTaggedValue> &asyncFuncObj,
392                                                                     const JSHandle<JSTaggedValue> &value,
393                                                                     bool is_resolve);
394     static inline JSTaggedValue RuntimeCopyDataProperties(JSThread *thread, const JSHandle<JSTaggedValue> &dst,
395                                                           const JSHandle<JSTaggedValue> &src);
396     static inline JSTaggedValue RuntimeStArraySpread(JSThread *thread, const JSHandle<JSTaggedValue> &dst,
397                                                      JSTaggedValue index, const JSHandle<JSTaggedValue> &src);
398     static inline JSTaggedValue RuntimeSetObjectWithProto(JSThread *thread, const JSHandle<JSTaggedValue> &proto,
399                                                           const JSHandle<JSObject> &obj);
400     static inline JSTaggedValue RuntimeGetIteratorNext(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
401                                                        const JSHandle<JSTaggedValue> &method);
402     static inline JSTaggedValue RuntimeLdObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
403                                                     const JSHandle<JSTaggedValue> &prop, bool callGetter,
404                                                     JSTaggedValue receiver);
405     static inline JSTaggedValue RuntimeStObjByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
406                                                     const JSHandle<JSTaggedValue> &prop,
407                                                     const JSHandle<JSTaggedValue> &value);
408     static inline JSTaggedValue RuntimeStOwnByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
409                                                     const JSHandle<JSTaggedValue> &key,
410                                                     const JSHandle<JSTaggedValue> &value);
411     static inline JSTaggedValue RuntimeLdSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
412                                                       const JSHandle<JSTaggedValue> &key, JSTaggedValue thisFunc);
413     static inline JSTaggedValue RuntimeStSuperByValue(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
414                                                       const JSHandle<JSTaggedValue> &key,
415                                                       const JSHandle<JSTaggedValue> &value, JSTaggedValue thisFunc);
416     static inline JSTaggedValue RuntimeLdObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj, uint32_t idx,
417                                                     bool callGetter, JSTaggedValue receiver);
418     static inline JSTaggedValue RuntimeStObjByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj, uint32_t idx,
419                                                     const JSHandle<JSTaggedValue> &value);
420     static inline JSTaggedValue RuntimeStOwnByIndex(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
421                                                     const JSHandle<JSTaggedValue> &idx,
422                                                     const JSHandle<JSTaggedValue> &value);
423     static inline JSTaggedValue RuntimeStGlobalRecord(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
424                                                       const JSHandle<JSTaggedValue> &value, bool isConst);
425     static inline JSTaggedValue RuntimeNeg(JSThread *thread, const JSHandle<JSTaggedValue> &value);
426     static inline JSTaggedValue RuntimeNot(JSThread *thread, const JSHandle<JSTaggedValue> &value);
427     static inline JSTaggedValue RuntimeResolveClass(JSThread *thread, const JSHandle<JSFunction> &ctor,
428                                                     const JSHandle<TaggedArray> &literal,
429                                                     const JSHandle<JSTaggedValue> &base,
430                                                     const JSHandle<JSTaggedValue> &lexenv);
431     static inline JSTaggedValue RuntimeCloneClassFromTemplate(JSThread *thread, const JSHandle<JSFunction> &ctor,
432                                                               const JSHandle<JSTaggedValue> &base,
433                                                               const JSHandle<JSTaggedValue> &lexenv);
434     static inline JSTaggedValue RuntimeCreateClassWithBuffer(JSThread *thread,
435                                                              const JSHandle<JSTaggedValue> &base,
436                                                              const JSHandle<JSTaggedValue> &lexenv,
437                                                              const JSHandle<JSTaggedValue> &constpool,
438                                                              uint16_t methodId, uint16_t literalId,
439                                                              const JSHandle<JSTaggedValue> &module);
440     static inline JSTaggedValue RuntimeCreateClassWithIHClass(JSThread *thread,
441                                                               const JSHandle<JSTaggedValue> &base,
442                                                               const JSHandle<JSTaggedValue> &lexenv,
443                                                               const JSHandle<JSTaggedValue> &constpool,
444                                                               const uint16_t methodId, uint16_t literalId,
445                                                               const JSHandle<JSHClass> &ihclass,
446                                                               const JSHandle<JSTaggedValue> &module);
447     static inline JSTaggedValue RuntimeSetClassInheritanceRelationship(JSThread *thread,
448                                                                        const JSHandle<JSTaggedValue> &ctor,
449                                                                        const JSHandle<JSTaggedValue> &base);
450     static inline JSTaggedValue RuntimeSetClassConstructorLength(JSThread *thread, JSTaggedValue ctor,
451                                                                  JSTaggedValue length);
452     static inline JSTaggedValue RuntimeNotifyInlineCache(JSThread *thread, const JSHandle<Method> &method,
453                                                          uint32_t icSlotSize);
454     static inline JSTaggedValue RuntimeStOwnByValueWithNameSet(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
455                                                                const JSHandle<JSTaggedValue> &key,
456                                                                const JSHandle<JSTaggedValue> &value);
457     static inline JSTaggedValue RuntimeStOwnByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
458                                                   const JSHandle<JSTaggedValue> &prop,
459                                                    const JSHandle<JSTaggedValue> &value);
460     static inline JSTaggedValue RuntimeSuspendGenerator(JSThread *thread, const JSHandle<JSTaggedValue> &genObj,
461                                                         const JSHandle<JSTaggedValue> &value);
462     static inline JSTaggedValue RuntimeGetModuleNamespace(JSThread *thread, int32_t index);
463     static inline JSTaggedValue RuntimeGetModuleNamespace(JSThread *thread, int32_t index,
464                                                           JSTaggedValue jsFunc);
465     static inline JSTaggedValue RuntimeGetModuleNamespace(JSThread *thread, JSTaggedValue localName);
466     static inline JSTaggedValue RuntimeGetModuleNamespace(JSThread *thread, JSTaggedValue localName,
467                                                           JSTaggedValue jsFunc);
468     static inline void RuntimeStModuleVar(JSThread *thread, int32_t index, JSTaggedValue value);
469     static inline void RuntimeStModuleVar(JSThread *thread, int32_t index, JSTaggedValue value,
470                                           JSTaggedValue jsFunc);
471     static inline void RuntimeStModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value);
472     static inline void RuntimeStModuleVar(JSThread *thread, JSTaggedValue key, JSTaggedValue value,
473                                           JSTaggedValue jsFunc);
474     static inline JSTaggedValue RuntimeLdLocalModuleVar(JSThread *thread, int32_t index);
475     static inline JSTaggedValue RuntimeLdLocalModuleVar(JSThread *thread, int32_t index,
476                                                         JSTaggedValue jsFunc);
477     static inline JSTaggedValue RuntimeLdExternalModuleVar(JSThread *thread, int32_t index);
478     static inline JSTaggedValue RuntimeLdExternalModuleVar(JSThread *thread, int32_t index,
479                                                            JSTaggedValue jsFunc);
480     static inline JSTaggedValue RuntimeLdModuleVar(JSThread *thread, JSTaggedValue key, bool inner);
481     static inline JSTaggedValue RuntimeLdModuleVar(JSThread *thread, JSTaggedValue key, bool inner,
482                                                    JSTaggedValue jsFunc);
483     static inline JSTaggedValue RuntimeGetPropIterator(JSThread *thread, const JSHandle<JSTaggedValue> &value);
484     static inline JSTaggedValue RuntimeAsyncFunctionEnter(JSThread *thread);
485     static inline JSTaggedValue RuntimeGetIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj);
486     static inline JSTaggedValue RuntimeGetAsyncIterator(JSThread *thread, const JSHandle<JSTaggedValue> &obj);
487     static inline void RuntimeSetGeneratorState(JSThread *thread, const JSHandle<JSTaggedValue> &genObj,
488                                                         const int32_t index);
489     static inline void RuntimeThrow(JSThread *thread, JSTaggedValue value);
490     static inline void RuntimeThrowThrowNotExists(JSThread *thread);
491     static inline void RuntimeThrowPatternNonCoercible(JSThread *thread);
492     static inline void RuntimeThrowDeleteSuperProperty(JSThread *thread);
493     static inline void RuntimeThrowUndefinedIfHole(JSThread *thread, const JSHandle<EcmaString> &obj);
494     static inline void RuntimeThrowIfNotObject(JSThread *thread);
495     static inline void RuntimeThrowConstAssignment(JSThread *thread, const JSHandle<EcmaString> &value);
496     static inline JSTaggedValue RuntimeLdGlobalRecord(JSThread *thread, JSTaggedValue key);
497     static inline JSTaggedValue RuntimeTryLdGlobalByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
498                                                          const JSHandle<JSTaggedValue> &prop);
499     static inline JSTaggedValue RuntimeTryUpdateGlobalRecord(JSThread *thread, JSTaggedValue prop, JSTaggedValue value);
500     static inline JSTaggedValue RuntimeThrowReferenceError(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
501                                                            const char *desc);
502     static inline JSTaggedValue RuntimeLdGlobalVarFromProto(JSThread *thread, const JSHandle<JSTaggedValue> &globalObj,
503                                                             const JSHandle<JSTaggedValue> &prop);
504     static inline JSTaggedValue RuntimeStGlobalVar(JSThread *thread, const JSHandle<JSTaggedValue> &prop,
505                                                    const JSHandle<JSTaggedValue> &value);
506     static inline JSTaggedValue RuntimeToNumber(JSThread *thread, const JSHandle<JSTaggedValue> &value);
507     static inline JSTaggedValue RuntimeDynamicImport(JSThread *thread, const JSHandle<JSTaggedValue> &specifier,
508                                                      const JSHandle<JSTaggedValue> &func);
509     static inline JSTaggedValue RuntimeToNumeric(JSThread *thread, const JSHandle<JSTaggedValue> &value);
510     static inline JSTaggedValue RuntimeEq(JSThread *thread, const JSHandle<JSTaggedValue> &left,
511                                              const JSHandle<JSTaggedValue> &right);
512     static inline JSTaggedValue RuntimeLdObjByName(JSThread *thread, JSTaggedValue obj, JSTaggedValue prop,
513                                                    bool callGetter, JSTaggedValue receiver);
514     static inline JSTaggedValue RuntimeNotEq(JSThread *thread, const JSHandle<JSTaggedValue> &left,
515                                                 const JSHandle<JSTaggedValue> &right);
516     static inline JSTaggedValue RuntimeLess(JSThread *thread, const JSHandle<JSTaggedValue> &left,
517                                                const JSHandle<JSTaggedValue> &right);
518     static inline JSTaggedValue RuntimeLessEq(JSThread *thread, const JSHandle<JSTaggedValue> &left,
519                                                  const JSHandle<JSTaggedValue> &right);
520     static inline JSTaggedValue RuntimeGreater(JSThread *thread, const JSHandle<JSTaggedValue> &left,
521                                                   const JSHandle<JSTaggedValue> &right);
522     static inline JSTaggedValue RuntimeGreaterEq(JSThread *thread, const JSHandle<JSTaggedValue> &left,
523                                                     const JSHandle<JSTaggedValue> &right);
524     static inline JSTaggedValue RuntimeAdd2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
525                                                const JSHandle<JSTaggedValue> &right);
526     static inline JSTaggedValue RuntimeShl2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
527                                                const JSHandle<JSTaggedValue> &right);
528     static inline JSTaggedValue RuntimeShr2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
529                                                const JSHandle<JSTaggedValue> &right);
530     static inline JSTaggedValue RuntimeSub2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
531                                                const JSHandle<JSTaggedValue> &right);
532     static inline JSTaggedValue RuntimeMul2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
533                                                const JSHandle<JSTaggedValue> &right);
534     static inline JSTaggedValue RuntimeDiv2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
535                                                const JSHandle<JSTaggedValue> &right);
536     static inline JSTaggedValue RuntimeMod2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
537                                                const JSHandle<JSTaggedValue> &right);
538     static inline JSTaggedValue RuntimeAshr2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
539                                                 const JSHandle<JSTaggedValue> &right);
540     static inline JSTaggedValue RuntimeAnd2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
541                                                const JSHandle<JSTaggedValue> &right);
542     static inline JSTaggedValue RuntimeOr2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
543                                               const JSHandle<JSTaggedValue> &right);
544     static inline JSTaggedValue RuntimeXor2(JSThread *thread, const JSHandle<JSTaggedValue> &left,
545                                                const JSHandle<JSTaggedValue> &right);
546     static inline JSTaggedValue RuntimeStOwnByNameWithNameSet(JSThread *thread,
547                                                               const JSHandle<JSTaggedValue> &obj,
548                                                               const JSHandle<JSTaggedValue> &prop,
549                                                               const JSHandle<JSTaggedValue> &value);
550     static inline JSTaggedValue RuntimeStObjByName(JSThread *thread, const JSHandle<JSTaggedValue> &obj,
551                                                    const JSHandle<JSTaggedValue> &prop,
552                                                    const JSHandle<JSTaggedValue> &value);
553     static inline JSTaggedValue RuntimeToJSTaggedValueWithInt32(JSThread *thread,
554                                                                 const JSHandle<JSTaggedValue> &value);
555     static inline JSTaggedValue RuntimeToJSTaggedValueWithUint32(JSThread *thread,
556                                                                  const JSHandle<JSTaggedValue> &value);
557     static inline JSTaggedValue RuntimeCreateEmptyObject(JSThread *thread, ObjectFactory *factory,
558                                                          JSHandle<GlobalEnv> globalEnv);
559     static inline JSTaggedValue RuntimeCreateEmptyArray(JSThread *thread, ObjectFactory *factory,
560                                                         JSHandle<GlobalEnv> globalEnv);
561     static inline JSTaggedValue RuntimeGetUnmapedArgs(JSThread *thread, JSTaggedType *sp, uint32_t actualNumArgs,
562                                                       uint32_t startIdx);
563     static inline JSTaggedValue RuntimeCopyRestArgs(JSThread *thread, JSTaggedType *sp, uint32_t restNumArgs,
564                                                     uint32_t startIdx);
565     static inline JSTaggedValue RuntimeCreateArrayWithBuffer(JSThread *thread, ObjectFactory *factory,
566                                                              const JSHandle<JSTaggedValue> &literal);
567     static inline JSTaggedValue RuntimeCreateObjectWithBuffer(JSThread *thread, ObjectFactory *factory,
568                                                               const JSHandle<JSObject> &literal);
569     static inline JSTaggedValue RuntimeNewLexicalEnv(JSThread *thread, uint16_t numVars);
570     static inline JSTaggedValue RuntimeNewObjRange(JSThread *thread, const JSHandle<JSTaggedValue> &func,
571                                                       const JSHandle<JSTaggedValue> &newTarget, uint16_t firstArgIdx,
572                                                       uint16_t length);
573     static inline JSTaggedValue RuntimeDefinefunc(JSThread *thread, const JSHandle<Method> &methodHandle);
574     static inline JSTaggedValue RuntimeCreateRegExpWithLiteral(JSThread *thread, const JSHandle<JSTaggedValue> &pattern,
575                                                                uint8_t flags);
576     static inline JSTaggedValue RuntimeThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index,
577                                                                   JSTaggedValue thisValue);
578     static inline JSTaggedValue RuntimeCreateObjectHavingMethod(JSThread *thread, ObjectFactory *factory,
579                                                                 const JSHandle<JSObject> &literal,
580                                                                 const JSHandle<JSTaggedValue> &env);
581     static inline JSTaggedValue RuntimeCreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys,
582                                                                     const JSHandle<JSTaggedValue> &objVal,
583                                                                     uint16_t firstArgRegIdx);
584     static inline JSTaggedValue RuntimeDefineMethod(JSThread *thread, const JSHandle<Method> &methodHandle,
585                                                     const JSHandle<JSTaggedValue> &homeObject);
586     static inline JSTaggedValue RuntimeCallSpread(JSThread *thread, const JSHandle<JSTaggedValue> &func,
587                                                      const JSHandle<JSTaggedValue> &obj,
588                                                      const JSHandle<JSTaggedValue> &array);
589     static inline JSTaggedValue RuntimeDefineGetterSetterByValue(JSThread *thread, const JSHandle<JSObject> &obj,
590                                                                  const JSHandle<JSTaggedValue> &prop,
591                                                                  const JSHandle<JSTaggedValue> &getter,
592                                                                  const JSHandle<JSTaggedValue> &setter, bool flag);
593     static inline JSTaggedValue RuntimeSuperCall(JSThread *thread, const JSHandle<JSTaggedValue> &func,
594                                                  const JSHandle<JSTaggedValue> &newTarget, uint16_t firstVRegIdx,
595                                                  uint16_t length);
596     static inline JSTaggedValue RuntimeOptSuperCall(JSThread *thread, uintptr_t argv, uint32_t argc);
597     static inline JSTaggedValue RuntimeThrowTypeError(JSThread *thread, const char *message);
598     static inline JSTaggedValue RuntimeGetCallSpreadArgs(JSThread *thread, const JSHandle<JSTaggedValue> &array);
599     static inline JSTaggedValue RuntimeThrowReferenceError(JSThread *thread, JSTaggedValue prop, const char *desc);
600     static inline JSTaggedValue RuntimeThrowSyntaxError(JSThread *thread, const char *message);
601     static inline JSTaggedValue RuntimeLdBigInt(JSThread *thread, const JSHandle<JSTaggedValue> &numberBigInt);
602     static inline JSTaggedValue RuntimeNewLexicalEnvWithName(JSThread *thread, uint16_t numVars, uint16_t scopeId);
603     static inline JSTaggedValue RuntimeOptGetUnmapedArgs(JSThread *thread, uint32_t actualNumArgs);
604     static inline JSTaggedValue RuntimeGetUnmapedJSArgumentObj(JSThread *thread,
605                                                                const JSHandle<TaggedArray> &argumentsList);
606     static inline JSTaggedValue RuntimeOptNewLexicalEnvWithName(JSThread *thread, uint16_t numVars, uint16_t scopeId,
607                                                                    JSHandle<JSTaggedValue> &currentLexEnv,
608                                                                    JSHandle<JSTaggedValue> &func);
609     static inline JSTaggedValue RuntimeOptCopyRestArgs(JSThread *thread, uint32_t actualArgc, uint32_t restIndex);
610     static inline JSTaggedValue RuntimeOptSuspendGenerator(JSThread *thread, const JSHandle<JSTaggedValue> &genObj,
611                                                            const JSHandle<JSTaggedValue> &value);
612     static inline JSTaggedValue RuntimeOptNewObjRange(JSThread *thread, uintptr_t argv, uint32_t argc);
613     static inline JSTaggedValue RuntimeOptConstruct(JSThread *thread, JSHandle<JSTaggedValue> ctor,
614                                                     JSHandle<JSTaggedValue> newTarget, JSHandle<JSTaggedValue> preArgs,
615                                                     JSHandle<TaggedArray> args);
616     static inline JSTaggedValue RuntimeOptConstructProxy(JSThread *thread, JSHandle<JSProxy> ctor,
617                                                          JSHandle<JSTaggedValue> newTgt,
618                                                          JSHandle<JSTaggedValue> preArgs, JSHandle<TaggedArray> args);
619     static inline JSTaggedValue RuntimeOptConstructBoundFunction(JSThread *thread, JSHandle<JSBoundFunction> ctor,
620                                                                  JSHandle<JSTaggedValue> newTgt,
621                                                                  JSHandle<JSTaggedValue> preArgs,
622                                                                  JSHandle<TaggedArray> args);
623     static inline JSTaggedValue RuntimeOptConstructGeneric(JSThread *thread, JSHandle<JSFunction> ctor,
624                                                            JSHandle<JSTaggedValue> newTgt,
625                                                            JSHandle<JSTaggedValue> preArgs, JSHandle<TaggedArray> args);
626     static inline JSTaggedValue RuntimeOptGenerateScopeInfo(JSThread *thread, uint16_t scopeId, JSTaggedValue func);
627     static inline JSTaggedType *GetActualArgv(JSThread *thread);
628     static inline JSTaggedType *GetActualArgvFromStub(JSThread *thread);
629     static inline OptimizedJSFunctionFrame *GetOptimizedJSFunctionFrame(JSThread *thread);
630     static inline OptimizedJSFunctionFrame *GetOptimizedJSFunctionFrameNoGC(JSThread *thread);
631 
632     static JSTaggedValue NewObject(EcmaRuntimeCallInfo *info);
633     static void SaveFrameToContext(JSThread *thread, JSHandle<GeneratorContext> context);
634 
635     static inline JSTaggedValue RuntimeLdPatchVar(JSThread *thread, uint32_t index);
636     static inline JSTaggedValue RuntimeStPatchVar(JSThread *thread, uint32_t index,
637                                                   const JSHandle<JSTaggedValue> &value);
638     static inline JSTaggedValue RuntimeNotifyConcurrentResult(JSThread *thread, JSTaggedValue result,
639         JSTaggedValue hint);
640     friend class SlowRuntimeStub;
641 };
642 }  // namespace panda::ecmascript
643 #endif
644