14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_ci#include <cmath>
174514f5e3Sopenharmony_ci#include <cfenv>
184514f5e3Sopenharmony_ci#include <sstream>
194514f5e3Sopenharmony_ci#include <sys/time.h>
204514f5e3Sopenharmony_ci
214514f5e3Sopenharmony_ci#include "ecmascript/stubs/runtime_optimized_stubs-inl.h"
224514f5e3Sopenharmony_ci#include "ecmascript/stubs/runtime_stubs-inl.h"
234514f5e3Sopenharmony_ci#include "ecmascript/base/json_stringifier.h"
244514f5e3Sopenharmony_ci#include "ecmascript/base/typed_array_helper-inl.h"
254514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_array.h"
264514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_arraybuffer.h"
274514f5e3Sopenharmony_ci#include "ecmascript/js_stable_array.h"
284514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_bigint.h"
294514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_function.h"
304514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_iterator.h"
314514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_reflect.h"
324514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_string_iterator.h"
334514f5e3Sopenharmony_ci#include "ecmascript/compiler/builtins/containers_stub_builder.h"
344514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_array.h"
354514f5e3Sopenharmony_ci#include "ecmascript/dfx/cpu_profiler/cpu_profiler.h"
364514f5e3Sopenharmony_ci#include "ecmascript/dfx/stackinfo/js_stackinfo.h"
374514f5e3Sopenharmony_ci#include "ecmascript/dfx/vmstat/function_call_timer.h"
384514f5e3Sopenharmony_ci#include "ecmascript/dfx/vmstat/opt_code_profiler.h"
394514f5e3Sopenharmony_ci#include "ecmascript/ic/ic_runtime_stub-inl.h"
404514f5e3Sopenharmony_ci#include "ecmascript/interpreter/interpreter_assembly.h"
414514f5e3Sopenharmony_ci#include "ecmascript/interpreter/slow_runtime_stub.h"
424514f5e3Sopenharmony_ci#include "ecmascript/jit/jit.h"
434514f5e3Sopenharmony_ci#include "ecmascript/js_array_iterator.h"
444514f5e3Sopenharmony_ci#include "ecmascript/js_map_iterator.h"
454514f5e3Sopenharmony_ci#include "ecmascript/js_set_iterator.h"
464514f5e3Sopenharmony_ci#include "ecmascript/js_string_iterator.h"
474514f5e3Sopenharmony_ci#include "ecmascript/js_stable_array.h"
484514f5e3Sopenharmony_ci#include "ecmascript/stubs/runtime_stubs.h"
494514f5e3Sopenharmony_ci#include "ecmascript/linked_hash_table.h"
504514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_object.h"
514514f5e3Sopenharmony_ci#ifdef ARK_SUPPORT_INTL
524514f5e3Sopenharmony_ci#include "ecmascript/js_collator.h"
534514f5e3Sopenharmony_ci#include "ecmascript/js_locale.h"
544514f5e3Sopenharmony_ci#else
554514f5e3Sopenharmony_ci#ifndef ARK_NOT_SUPPORT_INTL_GLOBAL
564514f5e3Sopenharmony_ci#include "ecmascript/intl/global_intl_helper.h"
574514f5e3Sopenharmony_ci#endif
584514f5e3Sopenharmony_ci#endif
594514f5e3Sopenharmony_ci
604514f5e3Sopenharmony_cinamespace panda::ecmascript {
614514f5e3Sopenharmony_ci#if defined(__clang__)
624514f5e3Sopenharmony_ci#pragma clang diagnostic push
634514f5e3Sopenharmony_ci#pragma clang diagnostic ignored "-Wunused-parameter"
644514f5e3Sopenharmony_ci#elif defined(__GNUC__)
654514f5e3Sopenharmony_ci#pragma GCC diagnostic push
664514f5e3Sopenharmony_ci#pragma GCC diagnostic ignored "-Wunused-parameter"
674514f5e3Sopenharmony_ci#endif
684514f5e3Sopenharmony_ci
694514f5e3Sopenharmony_ci#define DEF_RUNTIME_STUBS(name) \
704514f5e3Sopenharmony_ci    JSTaggedType RuntimeStubs::name(uintptr_t argGlue, uint32_t argc, uintptr_t argv)
714514f5e3Sopenharmony_ci
724514f5e3Sopenharmony_ci#define RUNTIME_STUBS_HEADER(name)                        \
734514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);      \
744514f5e3Sopenharmony_ci    RUNTIME_TRACE(thread, name);                          \
754514f5e3Sopenharmony_ci    [[maybe_unused]] EcmaHandleScope handleScope(thread)  \
764514f5e3Sopenharmony_ci
774514f5e3Sopenharmony_ci#define GET_ASM_FRAME(CurrentSp) \
784514f5e3Sopenharmony_ci    (reinterpret_cast<AsmInterpretedFrame *>(CurrentSp) - 1) // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic)
794514f5e3Sopenharmony_ci
804514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AddElementInternal)
814514f5e3Sopenharmony_ci{
824514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AddElementInternal);
834514f5e3Sopenharmony_ci    JSHandle<JSObject> receiver = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
844514f5e3Sopenharmony_ci    JSTaggedValue argIndex = GetArg(argv, argc, 1);  // 1: means the first parameter
854514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
864514f5e3Sopenharmony_ci    JSTaggedValue attr = GetArg(argv, argc, 3);  // 3: means the third parameter
874514f5e3Sopenharmony_ci    PropertyAttributes attrValue(attr);
884514f5e3Sopenharmony_ci    auto result = JSObject::AddElementInternal(thread, receiver, argIndex.GetInt(), value, attrValue);
894514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
904514f5e3Sopenharmony_ci}
914514f5e3Sopenharmony_ci
924514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(InitializeGeneratorFunction)
934514f5e3Sopenharmony_ci{
944514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(InitializeGeneratorFunction);
954514f5e3Sopenharmony_ci    FunctionKind kind = static_cast<FunctionKind>(GetTArg(argv, argc, 0)); // 1: means the first parameter
964514f5e3Sopenharmony_ci    JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv();
974514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
984514f5e3Sopenharmony_ci    JSHandle<JSFunction> objFun(env->GetObjectFunction());
994514f5e3Sopenharmony_ci    JSHandle<JSObject> initialGeneratorFuncPrototype = factory->NewJSObjectByConstructor(objFun);
1004514f5e3Sopenharmony_ci    if (kind == FunctionKind::ASYNC_GENERATOR_FUNCTION) {
1014514f5e3Sopenharmony_ci        JSObject::SetPrototype(thread, initialGeneratorFuncPrototype, env->GetAsyncGeneratorPrototype());
1024514f5e3Sopenharmony_ci    } else if (kind == FunctionKind::GENERATOR_FUNCTION) {
1034514f5e3Sopenharmony_ci        JSObject::SetPrototype(thread, initialGeneratorFuncPrototype, env->GetGeneratorPrototype());
1044514f5e3Sopenharmony_ci    }
1054514f5e3Sopenharmony_ci    return initialGeneratorFuncPrototype.GetTaggedType();
1064514f5e3Sopenharmony_ci}
1074514f5e3Sopenharmony_ci
1084514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(FunctionDefineOwnProperty)
1094514f5e3Sopenharmony_ci{
1104514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(FunctionDefineOwnProperty);
1114514f5e3Sopenharmony_ci    JSHandle<JSFunction> func(GetHArg<JSTaggedValue>(argv, argc, 0));
1124514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> accessor = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
1134514f5e3Sopenharmony_ci    FunctionKind kind = static_cast<FunctionKind>(GetTArg(argv, argc, 2)); // 2: means the second parameter
1144514f5e3Sopenharmony_ci    PropertyDescriptor desc(thread, accessor, kind != FunctionKind::BUILTIN_CONSTRUCTOR, false, false);
1154514f5e3Sopenharmony_ci    JSObject::DefineOwnProperty(thread, JSHandle<JSObject>(func),
1164514f5e3Sopenharmony_ci                                thread->GlobalConstants()->GetHandledPrototypeString(), desc);
1174514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
1184514f5e3Sopenharmony_ci}
1194514f5e3Sopenharmony_ci
1204514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(HeapAlloc)
1214514f5e3Sopenharmony_ci{
1224514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(HeapAlloc);
1234514f5e3Sopenharmony_ci    JSTaggedValue allocateSize = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
1244514f5e3Sopenharmony_ci    auto size = static_cast<size_t>(allocateSize.GetLargeUInt());
1254514f5e3Sopenharmony_ci    JSHandle<JSHClass> hclassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
1264514f5e3Sopenharmony_ci    auto type = static_cast<RegionSpaceFlag>(GetArg(argv, argc, 2).GetInt());
1274514f5e3Sopenharmony_ci    MemSpaceType mtype;
1284514f5e3Sopenharmony_ci    switch (type) {
1294514f5e3Sopenharmony_ci        case RegionSpaceFlag::IN_YOUNG_SPACE:
1304514f5e3Sopenharmony_ci            mtype = MemSpaceType::SEMI_SPACE;
1314514f5e3Sopenharmony_ci            break;
1324514f5e3Sopenharmony_ci        case RegionSpaceFlag::IN_OLD_SPACE:
1334514f5e3Sopenharmony_ci            mtype = MemSpaceType::OLD_SPACE;
1344514f5e3Sopenharmony_ci            break;
1354514f5e3Sopenharmony_ci        case RegionSpaceFlag::IN_NON_MOVABLE_SPACE:
1364514f5e3Sopenharmony_ci            mtype = MemSpaceType::NON_MOVABLE;
1374514f5e3Sopenharmony_ci            break;
1384514f5e3Sopenharmony_ci        case RegionSpaceFlag::IN_SHARED_OLD_SPACE:
1394514f5e3Sopenharmony_ci            mtype = MemSpaceType::SHARED_OLD_SPACE;
1404514f5e3Sopenharmony_ci            break;
1414514f5e3Sopenharmony_ci        case RegionSpaceFlag::IN_SHARED_NON_MOVABLE:
1424514f5e3Sopenharmony_ci            mtype = MemSpaceType::SHARED_NON_MOVABLE;
1434514f5e3Sopenharmony_ci            break;
1444514f5e3Sopenharmony_ci        default:
1454514f5e3Sopenharmony_ci            LOG_ECMA(FATAL) << "this branch is unreachable";
1464514f5e3Sopenharmony_ci            UNREACHABLE();
1474514f5e3Sopenharmony_ci    }
1484514f5e3Sopenharmony_ci    auto hclass = JSHClass::Cast(hclassHandle.GetTaggedValue().GetTaggedObject());
1494514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
1504514f5e3Sopenharmony_ci    auto result = factory->AllocObjectWithSpaceType(size, hclass, mtype);
1514514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
1524514f5e3Sopenharmony_ci}
1534514f5e3Sopenharmony_ci
1544514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AllocateInYoung)
1554514f5e3Sopenharmony_ci{
1564514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AllocateInYoung);
1574514f5e3Sopenharmony_ci    JSTaggedValue allocateSize = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
1584514f5e3Sopenharmony_ci    auto size = static_cast<size_t>(allocateSize.GetLargeUInt());
1594514f5e3Sopenharmony_ci    auto heap = const_cast<Heap*>(thread->GetEcmaVM()->GetHeap());
1604514f5e3Sopenharmony_ci    auto result = heap->AllocateYoungOrHugeObject(size);
1614514f5e3Sopenharmony_ci    ASSERT(result != nullptr);
1624514f5e3Sopenharmony_ci    if (argc > 1) { // 1: means the first parameter
1634514f5e3Sopenharmony_ci        JSHandle<JSHClass> hclassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
1644514f5e3Sopenharmony_ci        auto hclass = JSHClass::Cast(hclassHandle.GetTaggedValue().GetTaggedObject());
1654514f5e3Sopenharmony_ci        heap->SetHClassAndDoAllocateEvent(thread, result, hclass, size);
1664514f5e3Sopenharmony_ci    }
1674514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
1684514f5e3Sopenharmony_ci}
1694514f5e3Sopenharmony_ci
1704514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AllocateInOld)
1714514f5e3Sopenharmony_ci{
1724514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AllocateInOld);
1734514f5e3Sopenharmony_ci    JSTaggedValue allocateSize = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
1744514f5e3Sopenharmony_ci    auto size = static_cast<size_t>(allocateSize.GetLargeUInt());
1754514f5e3Sopenharmony_ci    auto heap = const_cast<Heap*>(thread->GetEcmaVM()->GetHeap());
1764514f5e3Sopenharmony_ci    auto result = heap->AllocateOldOrHugeObject(size);
1774514f5e3Sopenharmony_ci    ASSERT(result != nullptr);
1784514f5e3Sopenharmony_ci    if (argc > 1) { // 1: means the first parameter
1794514f5e3Sopenharmony_ci        JSHandle<JSHClass> hclassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
1804514f5e3Sopenharmony_ci        auto hclass = JSHClass::Cast(hclassHandle.GetTaggedValue().GetTaggedObject());
1814514f5e3Sopenharmony_ci        heap->SetHClassAndDoAllocateEvent(thread, result, hclass, size);
1824514f5e3Sopenharmony_ci    }
1834514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
1844514f5e3Sopenharmony_ci}
1854514f5e3Sopenharmony_ci
1864514f5e3Sopenharmony_ci#define ALLOCATE_IN_SHARED_HEAP(SPACE)                                                     \
1874514f5e3Sopenharmony_ci    DEF_RUNTIME_STUBS(AllocateInS##SPACE)                                                  \
1884514f5e3Sopenharmony_ci    {                                                                                      \
1894514f5e3Sopenharmony_ci        RUNTIME_STUBS_HEADER(AllocateInS##SPACE);                                          \
1904514f5e3Sopenharmony_ci        JSTaggedValue allocateSize = GetArg(argv, argc, 0);                                \
1914514f5e3Sopenharmony_ci        auto size = static_cast<size_t>(allocateSize.GetInt());                            \
1924514f5e3Sopenharmony_ci        auto sharedHeap = const_cast<SharedHeap*>(SharedHeap::GetInstance());              \
1934514f5e3Sopenharmony_ci        ASSERT(size <= MAX_REGULAR_HEAP_OBJECT_SIZE);                                      \
1944514f5e3Sopenharmony_ci        auto result = sharedHeap->Allocate##SPACE##OrHugeObject(thread, size);             \
1954514f5e3Sopenharmony_ci        ASSERT(result != nullptr);                                                         \
1964514f5e3Sopenharmony_ci        if (argc > 1) {                                                                    \
1974514f5e3Sopenharmony_ci            JSHandle<JSHClass> hclassHandle = GetHArg<JSHClass>(argv, argc, 1);            \
1984514f5e3Sopenharmony_ci            auto hclass = JSHClass::Cast(hclassHandle.GetTaggedValue().GetTaggedObject()); \
1994514f5e3Sopenharmony_ci            sharedHeap->SetHClassAndDoAllocateEvent(thread, result, hclass, size);         \
2004514f5e3Sopenharmony_ci        }                                                                                  \
2014514f5e3Sopenharmony_ci        return JSTaggedValue(result).GetRawData();                                         \
2024514f5e3Sopenharmony_ci    }
2034514f5e3Sopenharmony_ci
2044514f5e3Sopenharmony_ci#undef ALLOCATE_IN_SHARED_HEAP
2054514f5e3Sopenharmony_ci
2064514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AllocateInSNonMovable)
2074514f5e3Sopenharmony_ci{
2084514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AllocateInSNonMovable);
2094514f5e3Sopenharmony_ci    JSTaggedValue allocateSize = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
2104514f5e3Sopenharmony_ci    auto size = static_cast<size_t>(allocateSize.GetInt());
2114514f5e3Sopenharmony_ci    auto heap = const_cast<Heap*>(thread->GetEcmaVM()->GetHeap());
2124514f5e3Sopenharmony_ci    auto result = heap->AllocateSharedNonMovableSpaceFromTlab(thread, size);
2134514f5e3Sopenharmony_ci    if (result != nullptr) {
2144514f5e3Sopenharmony_ci        return JSTaggedValue(result).GetRawData();
2154514f5e3Sopenharmony_ci    }
2164514f5e3Sopenharmony_ci    auto sharedHeap = const_cast<SharedHeap*>(SharedHeap::GetInstance());
2174514f5e3Sopenharmony_ci    result = sharedHeap->AllocateNonMovableOrHugeObject(thread, size);
2184514f5e3Sopenharmony_ci    ASSERT(result != nullptr);
2194514f5e3Sopenharmony_ci    if (argc > 1) { // 1: means the first parameter
2204514f5e3Sopenharmony_ci        JSHandle<JSHClass> hclassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
2214514f5e3Sopenharmony_ci        auto hclass = JSHClass::Cast(hclassHandle.GetTaggedValue().GetTaggedObject());
2224514f5e3Sopenharmony_ci        sharedHeap->SetHClassAndDoAllocateEvent(thread, result, hclass, size);
2234514f5e3Sopenharmony_ci    }
2244514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
2254514f5e3Sopenharmony_ci}
2264514f5e3Sopenharmony_ci
2274514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DefineOwnProperty)
2284514f5e3Sopenharmony_ci{
2294514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DefineOwnProperty);
2304514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);
2314514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
2324514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
2334514f5e3Sopenharmony_ci    PropertyDescriptor desc(thread, value, true, true, true);
2344514f5e3Sopenharmony_ci    bool res = JSTaggedValue::DefineOwnProperty(thread, obj, key, desc);
2354514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
2364514f5e3Sopenharmony_ci}
2374514f5e3Sopenharmony_ci
2384514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AllocateInSOld)
2394514f5e3Sopenharmony_ci{
2404514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AllocateInSOld);
2414514f5e3Sopenharmony_ci    JSTaggedValue allocateSize = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
2424514f5e3Sopenharmony_ci    auto size = static_cast<size_t>(allocateSize.GetInt());
2434514f5e3Sopenharmony_ci    auto heap = const_cast<Heap*>(thread->GetEcmaVM()->GetHeap());
2444514f5e3Sopenharmony_ci    auto result = heap->AllocateSharedOldSpaceFromTlab(thread, size);
2454514f5e3Sopenharmony_ci    if (result != nullptr) {
2464514f5e3Sopenharmony_ci        return JSTaggedValue(result).GetRawData();
2474514f5e3Sopenharmony_ci    }
2484514f5e3Sopenharmony_ci    auto sharedHeap = const_cast<SharedHeap*>(SharedHeap::GetInstance());
2494514f5e3Sopenharmony_ci    result = sharedHeap->AllocateOldOrHugeObject(thread, size);
2504514f5e3Sopenharmony_ci    ASSERT(result != nullptr);
2514514f5e3Sopenharmony_ci    if (argc > 1) { // 1: means the first parameter
2524514f5e3Sopenharmony_ci        JSHandle<JSHClass> hclassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
2534514f5e3Sopenharmony_ci        auto hclass = JSHClass::Cast(hclassHandle.GetTaggedValue().GetTaggedObject());
2544514f5e3Sopenharmony_ci        sharedHeap->SetHClassAndDoAllocateEvent(thread, result, hclass, size);
2554514f5e3Sopenharmony_ci    }
2564514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
2574514f5e3Sopenharmony_ci}
2584514f5e3Sopenharmony_ci
2594514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(TypedArraySpeciesCreate)
2604514f5e3Sopenharmony_ci{
2614514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(TypedArraySpeciesCreate);
2624514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);    // 0: means the zeroth parameter
2634514f5e3Sopenharmony_ci    JSHandle<JSTypedArray> thisObj(obj);
2644514f5e3Sopenharmony_ci    JSTaggedValue indexValue = GetArg(argv, argc, 1);   // 1: means the first parameter
2654514f5e3Sopenharmony_ci    uint32_t index = static_cast<uint32_t>(indexValue.GetInt());
2664514f5e3Sopenharmony_ci    JSTaggedValue arrayLen = GetArg(argv, argc, 2); // 2: means the second parameter
2674514f5e3Sopenharmony_ci    uint32_t length = static_cast<uint32_t>(arrayLen.GetInt());
2684514f5e3Sopenharmony_ci    JSTaggedType args[1] = {JSTaggedValue(length).GetRawData()};
2694514f5e3Sopenharmony_ci    JSHandle<JSObject> newArr = base::TypedArrayHelper::TypedArraySpeciesCreate(thread, thisObj, index, args);
2704514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
2714514f5e3Sopenharmony_ci    return newArr.GetTaggedValue().GetRawData();
2724514f5e3Sopenharmony_ci}
2734514f5e3Sopenharmony_ci
2744514f5e3Sopenharmony_civoid RuntimeStubs::CopyTypedArrayBuffer(JSTypedArray *srcArray, JSTypedArray *targetArray, int32_t srcStartPos,
2754514f5e3Sopenharmony_ci    int32_t tarStartPos, int32_t count, int32_t elementSize)
2764514f5e3Sopenharmony_ci{
2774514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
2784514f5e3Sopenharmony_ci    if (count <= 0) {
2794514f5e3Sopenharmony_ci        return;
2804514f5e3Sopenharmony_ci    }
2814514f5e3Sopenharmony_ci    JSTaggedValue srcBuffer = srcArray->GetViewedArrayBufferOrByteArray();
2824514f5e3Sopenharmony_ci    JSTaggedValue targetBuffer = targetArray->GetViewedArrayBufferOrByteArray();
2834514f5e3Sopenharmony_ci    uint32_t srcByteIndex = static_cast<uint32_t>(srcStartPos * elementSize + srcArray->GetByteOffset());
2844514f5e3Sopenharmony_ci    uint32_t targetByteIndex = static_cast<uint32_t>(tarStartPos * elementSize + targetArray->GetByteOffset());
2854514f5e3Sopenharmony_ci    uint8_t *srcBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(srcBuffer, srcByteIndex);
2864514f5e3Sopenharmony_ci    uint8_t *targetBuf = (uint8_t *)builtins::BuiltinsArrayBuffer::GetDataPointFromBuffer(targetBuffer,
2874514f5e3Sopenharmony_ci                                                                                          targetByteIndex);
2884514f5e3Sopenharmony_ci    if (memmove_s(targetBuf, elementSize * count, srcBuf, elementSize * count) != EOK) {
2894514f5e3Sopenharmony_ci        LOG_FULL(FATAL) << "memmove_s failed";
2904514f5e3Sopenharmony_ci        UNREACHABLE();
2914514f5e3Sopenharmony_ci    }
2924514f5e3Sopenharmony_ci}
2934514f5e3Sopenharmony_ci
2944514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallInternalGetter)
2954514f5e3Sopenharmony_ci{
2964514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallInternalGetter);
2974514f5e3Sopenharmony_ci    JSTaggedType argAccessor = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
2984514f5e3Sopenharmony_ci    JSHandle<JSObject> argReceiver = GetHArg<JSObject>(argv, argc, 1);  // 1: means the first parameter
2994514f5e3Sopenharmony_ci
3004514f5e3Sopenharmony_ci    auto accessor = AccessorData::Cast(reinterpret_cast<TaggedObject *>(argAccessor));
3014514f5e3Sopenharmony_ci    return accessor->CallInternalGet(thread, argReceiver).GetRawData();
3024514f5e3Sopenharmony_ci}
3034514f5e3Sopenharmony_ci
3044514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallInternalSetter)
3054514f5e3Sopenharmony_ci{
3064514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallInternalSetter);
3074514f5e3Sopenharmony_ci    JSHandle<JSObject> receiver = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
3084514f5e3Sopenharmony_ci    JSTaggedType argSetter = GetTArg(argv, argc, 1);  // 1: means the first parameter
3094514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
3104514f5e3Sopenharmony_ci    auto setter = AccessorData::Cast((reinterpret_cast<TaggedObject *>(argSetter)));
3114514f5e3Sopenharmony_ci    auto result = setter->CallInternalSet(thread, receiver, value, true);
3124514f5e3Sopenharmony_ci    if (!result) {
3134514f5e3Sopenharmony_ci        return JSTaggedValue::Exception().GetRawData();
3144514f5e3Sopenharmony_ci    }
3154514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
3164514f5e3Sopenharmony_ci}
3174514f5e3Sopenharmony_ci
3184514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetHash32)
3194514f5e3Sopenharmony_ci{
3204514f5e3Sopenharmony_ci    JSTaggedValue argKey = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
3214514f5e3Sopenharmony_ci    JSTaggedValue len = GetArg(argv, argc, 1);  // 1: means the first parameter
3224514f5e3Sopenharmony_ci    int key = argKey.GetInt();
3234514f5e3Sopenharmony_ci    auto pkey = reinterpret_cast<uint8_t *>(&key);
3244514f5e3Sopenharmony_ci    uint32_t result = panda::GetHash32(pkey, len.GetInt());
3254514f5e3Sopenharmony_ci    return JSTaggedValue(static_cast<uint64_t>(result)).GetRawData();
3264514f5e3Sopenharmony_ci}
3274514f5e3Sopenharmony_ci
3284514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ComputeHashcode)
3294514f5e3Sopenharmony_ci{
3304514f5e3Sopenharmony_ci    JSTaggedType ecmaString = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
3314514f5e3Sopenharmony_ci    auto string = reinterpret_cast<EcmaString *>(ecmaString);
3324514f5e3Sopenharmony_ci    uint32_t result = EcmaStringAccessor(string).ComputeHashcode();
3334514f5e3Sopenharmony_ci    return JSTaggedValue(static_cast<uint64_t>(result)).GetRawData();
3344514f5e3Sopenharmony_ci}
3354514f5e3Sopenharmony_ci
3364514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewInternalString)
3374514f5e3Sopenharmony_ci{
3384514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewInternalString);
3394514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
3404514f5e3Sopenharmony_ci    return JSTaggedValue(thread->GetEcmaVM()->GetFactory()->InternString(keyHandle)).GetRawData();
3414514f5e3Sopenharmony_ci}
3424514f5e3Sopenharmony_ci
3434514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewTaggedArray)
3444514f5e3Sopenharmony_ci{
3454514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewTaggedArray);
3464514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
3474514f5e3Sopenharmony_ci
3484514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
3494514f5e3Sopenharmony_ci    return factory->NewTaggedArray(length.GetInt()).GetTaggedValue().GetRawData();
3504514f5e3Sopenharmony_ci}
3514514f5e3Sopenharmony_ci
3524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CopyArray)
3534514f5e3Sopenharmony_ci{
3544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CopyArray);
3554514f5e3Sopenharmony_ci    JSHandle<TaggedArray> array = GetHArg<TaggedArray>(argv, argc, 0);  // 0: means the zeroth parameter
3564514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 1);  // 1: means the first parameter
3574514f5e3Sopenharmony_ci    JSTaggedValue capacity = GetArg(argv, argc, 2);  // 2: means the second parameter
3584514f5e3Sopenharmony_ci
3594514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
3604514f5e3Sopenharmony_ci    return factory->CopyArray(array, length.GetInt(), capacity.GetInt()).GetTaggedValue().GetRawData();
3614514f5e3Sopenharmony_ci}
3624514f5e3Sopenharmony_ci
3634514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(RTSubstitution)
3644514f5e3Sopenharmony_ci{
3654514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(RTSubstitution);
3664514f5e3Sopenharmony_ci    JSHandle<EcmaString> matched = GetHArg<EcmaString>(argv, argc, 0);     // 0: means the zeroth parameter
3674514f5e3Sopenharmony_ci    JSHandle<EcmaString> srcString = GetHArg<EcmaString>(argv, argc, 1);   // 1: means the first parameter
3684514f5e3Sopenharmony_ci    int position = GetArg(argv, argc, 2).GetInt();                         // 2: means the second parameter
3694514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
3704514f5e3Sopenharmony_ci    JSHandle<TaggedArray> captureList = factory->EmptyArray();
3714514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
3724514f5e3Sopenharmony_ci    JSHandle<EcmaString> replacement = GetHArg<EcmaString>(argv, argc, 3); // 3: means the third parameter
3734514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsString::GetSubstitution(thread, matched, srcString, position,
3744514f5e3Sopenharmony_ci        captureList, undefined, replacement);
3754514f5e3Sopenharmony_ci    return result.GetRawData();
3764514f5e3Sopenharmony_ci}
3774514f5e3Sopenharmony_ci
3784514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NameDictPutIfAbsent)
3794514f5e3Sopenharmony_ci{
3804514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NameDictPutIfAbsent);
3814514f5e3Sopenharmony_ci    JSTaggedType receiver = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
3824514f5e3Sopenharmony_ci    JSTaggedType array = GetTArg(argv, argc, 1);  // 1: means the first parameter
3834514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
3844514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> valueHandle = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
3854514f5e3Sopenharmony_ci    JSTaggedValue attr = GetArg(argv, argc, 4);   // 4: means the fourth parameter
3864514f5e3Sopenharmony_ci    JSTaggedValue needTransToDict = GetArg(argv, argc, 5);  // 5: means the fifth parameter
3874514f5e3Sopenharmony_ci
3884514f5e3Sopenharmony_ci    PropertyAttributes propAttr(attr);
3894514f5e3Sopenharmony_ci    if (needTransToDict.IsTrue()) {
3904514f5e3Sopenharmony_ci        JSHandle<JSObject> objHandle(thread, JSTaggedValue(reinterpret_cast<TaggedObject *>(receiver)));
3914514f5e3Sopenharmony_ci        JSHandle<NameDictionary> dictHandle(JSObject::TransitionToDictionary(thread, objHandle));
3924514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
3934514f5e3Sopenharmony_ci        return NameDictionary::
3944514f5e3Sopenharmony_ci            PutIfAbsent(thread, dictHandle, keyHandle, valueHandle, propAttr).GetTaggedValue().GetRawData();
3954514f5e3Sopenharmony_ci    } else {
3964514f5e3Sopenharmony_ci        JSHandle<NameDictionary> dictHandle(thread, JSTaggedValue(reinterpret_cast<TaggedObject *>(array)));
3974514f5e3Sopenharmony_ci        return NameDictionary::
3984514f5e3Sopenharmony_ci            PutIfAbsent(thread, dictHandle, keyHandle, valueHandle, propAttr).GetTaggedValue().GetRawData();
3994514f5e3Sopenharmony_ci    }
4004514f5e3Sopenharmony_ci}
4014514f5e3Sopenharmony_ci
4024514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NumberDictionaryPut)
4034514f5e3Sopenharmony_ci{
4044514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NumberDictionaryPut);
4054514f5e3Sopenharmony_ci    JSTaggedType receiver = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
4064514f5e3Sopenharmony_ci    JSTaggedType array = GetTArg(argv, argc, 1);  // 1: means the first parameter
4074514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 2);  // 2: means the second parameter
4084514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> valueHandle = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
4094514f5e3Sopenharmony_ci    JSTaggedValue attr = GetArg(argv, argc, 4);   // 4: means the fourth parameter
4104514f5e3Sopenharmony_ci    JSTaggedValue needTransToDict = GetArg(argv, argc, 5);  // 5: means the fifth parameter
4114514f5e3Sopenharmony_ci
4124514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle(thread, key);
4134514f5e3Sopenharmony_ci    PropertyAttributes propAttr(attr);
4144514f5e3Sopenharmony_ci    JSHandle<JSObject> objHandle(thread, JSTaggedValue(reinterpret_cast<TaggedObject *>(receiver)));
4154514f5e3Sopenharmony_ci    if (needTransToDict.IsTrue()) {
4164514f5e3Sopenharmony_ci        JSObject::ElementsToDictionary(thread, objHandle);
4174514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
4184514f5e3Sopenharmony_ci        JSHandle<NumberDictionary> dict(thread, objHandle->GetElements());
4194514f5e3Sopenharmony_ci        return NumberDictionary::Put(thread, dict, keyHandle, valueHandle, propAttr).GetTaggedValue().GetRawData();
4204514f5e3Sopenharmony_ci    } else {
4214514f5e3Sopenharmony_ci        JSHandle<NumberDictionary> dict(thread, JSTaggedValue(reinterpret_cast<TaggedObject *>(array)));
4224514f5e3Sopenharmony_ci        return NumberDictionary::Put(thread, dict, keyHandle, valueHandle, propAttr).GetTaggedValue().GetRawData();
4234514f5e3Sopenharmony_ci    }
4244514f5e3Sopenharmony_ci}
4254514f5e3Sopenharmony_ci
4264514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(PropertiesSetValue)
4274514f5e3Sopenharmony_ci{
4284514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(PropertiesSetValue);
4294514f5e3Sopenharmony_ci    JSHandle<JSObject> objHandle = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
4304514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> valueHandle = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
4314514f5e3Sopenharmony_ci    JSHandle<TaggedArray> arrayHandle = GetHArg<TaggedArray>(argv, argc, 2);   // 2: means the second parameter
4324514f5e3Sopenharmony_ci    JSTaggedValue taggedCapacity = GetArg(argv, argc, 3);
4334514f5e3Sopenharmony_ci    JSTaggedValue taggedIndex = GetArg(argv, argc, 4);
4344514f5e3Sopenharmony_ci    int capacity = taggedCapacity.GetInt();
4354514f5e3Sopenharmony_ci    int index = taggedIndex.GetInt();
4364514f5e3Sopenharmony_ci
4374514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
4384514f5e3Sopenharmony_ci    JSHandle<TaggedArray> properties;
4394514f5e3Sopenharmony_ci    if (capacity == 0) {
4404514f5e3Sopenharmony_ci        properties = factory->NewTaggedArray(JSObject::MIN_PROPERTIES_LENGTH);
4414514f5e3Sopenharmony_ci    } else {
4424514f5e3Sopenharmony_ci        uint32_t maxNonInlinedFastPropsCapacity = objHandle->GetNonInlinedFastPropsCapacity();
4434514f5e3Sopenharmony_ci        uint32_t newLen = JSObject::ComputeNonInlinedFastPropsCapacity(thread, capacity,
4444514f5e3Sopenharmony_ci                                                                       maxNonInlinedFastPropsCapacity);
4454514f5e3Sopenharmony_ci        properties = factory->CopyArray(arrayHandle, capacity, newLen);
4464514f5e3Sopenharmony_ci    }
4474514f5e3Sopenharmony_ci    properties->Set(thread, index, valueHandle);
4484514f5e3Sopenharmony_ci    objHandle->SetProperties(thread, properties);
4494514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
4504514f5e3Sopenharmony_ci}
4514514f5e3Sopenharmony_ci
4524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CheckAndCopyArray)
4534514f5e3Sopenharmony_ci{
4544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CheckAndCopyArray);
4554514f5e3Sopenharmony_ci    JSTaggedType argReceiver = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
4564514f5e3Sopenharmony_ci    JSHandle<JSArray> receiverHandle(thread, reinterpret_cast<JSArray *>(argReceiver));
4574514f5e3Sopenharmony_ci    JSArray::CheckAndCopyArray(thread, receiverHandle);
4584514f5e3Sopenharmony_ci    return receiverHandle->GetElements().GetRawData();
4594514f5e3Sopenharmony_ci}
4604514f5e3Sopenharmony_ci
4614514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JSArrayReduceUnStable)
4624514f5e3Sopenharmony_ci{
4634514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JSArrayReduceUnStable);
4644514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
4654514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObjVal = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the one parameter
4664514f5e3Sopenharmony_ci    JSTaggedType taggedValueK = GetTArg(argv, argc, 2);  // 2: means the two parameter
4674514f5e3Sopenharmony_ci    int64_t k = JSTaggedNumber(JSTaggedValue(taggedValueK)).GetNumber();
4684514f5e3Sopenharmony_ci    JSTaggedType taggedValueLen = GetTArg(argv, argc, 3);  // 3: means the three parameter
4694514f5e3Sopenharmony_ci    int64_t len = JSTaggedNumber(JSTaggedValue(taggedValueLen)).GetNumber();
4704514f5e3Sopenharmony_ci    JSMutableHandle<JSTaggedValue> accumulator = JSMutableHandle<JSTaggedValue>(thread,
4714514f5e3Sopenharmony_ci        GetHArg<JSTaggedValue>(argv, argc, 4));  // 4: means the four parameter
4724514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> callbackFnHandle = GetHArg<JSTaggedValue>(argv, argc, 5);  // 5: means the five parameter
4734514f5e3Sopenharmony_ci
4744514f5e3Sopenharmony_ci    JSTaggedValue ret = builtins::BuiltinsArray::ReduceUnStableJSArray(thread, thisHandle, thisObjVal, k, len,
4754514f5e3Sopenharmony_ci        accumulator, callbackFnHandle);
4764514f5e3Sopenharmony_ci    return ret.GetRawData();
4774514f5e3Sopenharmony_ci}
4784514f5e3Sopenharmony_ci
4794514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JSObjectGrowElementsCapacity)
4804514f5e3Sopenharmony_ci{
4814514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JSObjectGrowElementsCapacity);
4824514f5e3Sopenharmony_ci    JSHandle<JSObject> elements = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
4834514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 1);                    // 1: means the zeroth parameter
4844514f5e3Sopenharmony_ci    uint32_t newLength = static_cast<uint32_t>(length.GetInt());
4854514f5e3Sopenharmony_ci    JSHandle<TaggedArray> newElements = JSObject::GrowElementsCapacity(thread, elements, newLength, true);
4864514f5e3Sopenharmony_ci    return newElements.GetTaggedValue().GetRawData();
4874514f5e3Sopenharmony_ci}
4884514f5e3Sopenharmony_ci
4894514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewEcmaHClass)
4904514f5e3Sopenharmony_ci{
4914514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewEcmaHClass);
4924514f5e3Sopenharmony_ci    JSTaggedValue size = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
4934514f5e3Sopenharmony_ci    JSTaggedValue type = GetArg(argv, argc, 1);  // 1: means the first parameter
4944514f5e3Sopenharmony_ci    JSTaggedValue inlinedProps = GetArg(argv, argc, 2);  // 2: means the second parameter
4954514f5e3Sopenharmony_ci    return (thread->GetEcmaVM()->GetFactory()->NewEcmaHClass(
4964514f5e3Sopenharmony_ci        size.GetInt(), JSType(type.GetInt()), inlinedProps.GetInt())).GetTaggedValue().GetRawData();
4974514f5e3Sopenharmony_ci}
4984514f5e3Sopenharmony_ci
4994514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JSArrayFilterUnStable)
5004514f5e3Sopenharmony_ci{
5014514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JSArrayFilterUnStable);
5024514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArgHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
5034514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObjVal = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the one parameter
5044514f5e3Sopenharmony_ci    JSTaggedType taggedValueK = GetTArg(argv, argc, 2);  // 2: means the two parameter
5054514f5e3Sopenharmony_ci    int64_t k = JSTaggedNumber(JSTaggedValue(taggedValueK)).GetNumber();
5064514f5e3Sopenharmony_ci    JSTaggedType taggedValueLen = GetTArg(argv, argc, 3);  // 3: means the three parameter
5074514f5e3Sopenharmony_ci    int64_t len = JSTaggedNumber(JSTaggedValue(taggedValueLen)).GetNumber();
5084514f5e3Sopenharmony_ci    JSTaggedType toIndexValue = GetTArg(argv, argc, 4);  // 4: means the three parameter
5094514f5e3Sopenharmony_ci    int32_t toIndex = JSTaggedNumber(JSTaggedValue(toIndexValue)).GetNumber();
5104514f5e3Sopenharmony_ci    JSHandle<JSObject> newArrayHandle = JSMutableHandle<JSObject>(thread,
5114514f5e3Sopenharmony_ci        GetHArg<JSObject>(argv, argc, 5));  // 5: means the four parameter
5124514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> callbackFnHandle = GetHArg<JSTaggedValue>(argv, argc, 6);  // 6: means the five parameter
5134514f5e3Sopenharmony_ci
5144514f5e3Sopenharmony_ci    JSTaggedValue ret = builtins::BuiltinsArray::FilterUnStableJSArray(thread, thisArgHandle, thisObjVal, k, len,
5154514f5e3Sopenharmony_ci        toIndex, newArrayHandle, callbackFnHandle);
5164514f5e3Sopenharmony_ci    return ret.GetRawData();
5174514f5e3Sopenharmony_ci}
5184514f5e3Sopenharmony_ci
5194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JSArrayMapUnStable)
5204514f5e3Sopenharmony_ci{
5214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JSArrayMapUnStable);
5224514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArgHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
5234514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObjVal = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the one parameter
5244514f5e3Sopenharmony_ci    JSTaggedType taggedValueK = GetTArg(argv, argc, 2);  // 2: means the two parameter
5254514f5e3Sopenharmony_ci    int64_t k = JSTaggedNumber(JSTaggedValue(taggedValueK)).GetNumber();
5264514f5e3Sopenharmony_ci    JSTaggedType taggedValueLen = GetTArg(argv, argc, 3);  // 3: means the three parameter
5274514f5e3Sopenharmony_ci    int64_t len = JSTaggedNumber(JSTaggedValue(taggedValueLen)).GetNumber();
5284514f5e3Sopenharmony_ci    JSHandle<JSObject> newArrayHandle =
5294514f5e3Sopenharmony_ci        JSMutableHandle<JSObject>(thread, GetHArg<JSObject>(argv, argc, 4));  // 4: means the four parameter
5304514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> callbackFnHandle = GetHArg<JSTaggedValue>(argv, argc, 5);  // 5: means the five parameter
5314514f5e3Sopenharmony_ci
5324514f5e3Sopenharmony_ci    JSTaggedValue ret = builtins::BuiltinsArray::MapUnStableJSArray(thread, thisArgHandle, thisObjVal, k, len,
5334514f5e3Sopenharmony_ci        newArrayHandle, callbackFnHandle);
5344514f5e3Sopenharmony_ci    return ret.GetRawData();
5354514f5e3Sopenharmony_ci}
5364514f5e3Sopenharmony_ci
5374514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(UpdateLayOutAndAddTransition)
5384514f5e3Sopenharmony_ci{
5394514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(UpdateLayOutAndAddTransition);
5404514f5e3Sopenharmony_ci    JSHandle<JSHClass> oldHClassHandle = GetHArg<JSHClass>(argv, argc, 0);  // 0: means the zeroth parameter
5414514f5e3Sopenharmony_ci    JSHandle<JSHClass> newHClassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
5424514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
5434514f5e3Sopenharmony_ci    JSTaggedValue attr = GetArg(argv, argc, 3);  // 3: means the third parameter
5444514f5e3Sopenharmony_ci
5454514f5e3Sopenharmony_ci    PropertyAttributes attrValue(attr);
5464514f5e3Sopenharmony_ci
5474514f5e3Sopenharmony_ci    JSHClass::AddPropertyToNewHClass(thread, oldHClassHandle, newHClassHandle, keyHandle, attrValue);
5484514f5e3Sopenharmony_ci
5494514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
5504514f5e3Sopenharmony_ci}
5514514f5e3Sopenharmony_ci
5524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CopyAndUpdateObjLayout)
5534514f5e3Sopenharmony_ci{
5544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CopyAndUpdateObjLayout);
5554514f5e3Sopenharmony_ci    JSHandle<JSHClass> newHClassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
5564514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
5574514f5e3Sopenharmony_ci    JSTaggedValue attr = GetArg(argv, argc, 3);  // 3: means the third parameter
5584514f5e3Sopenharmony_ci
5594514f5e3Sopenharmony_ci    auto factory = thread->GetEcmaVM()->GetFactory();
5604514f5e3Sopenharmony_ci    PropertyAttributes attrValue(attr);
5614514f5e3Sopenharmony_ci
5624514f5e3Sopenharmony_ci    // 1. Copy
5634514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> oldLayout(thread, newHClassHandle->GetLayout());
5644514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> newLayout(factory->CopyLayoutInfo(oldLayout));
5654514f5e3Sopenharmony_ci    newHClassHandle->SetLayout(thread, newLayout);
5664514f5e3Sopenharmony_ci
5674514f5e3Sopenharmony_ci    // 2. Update attr
5684514f5e3Sopenharmony_ci    auto hclass = JSHClass::Cast(newHClassHandle.GetTaggedValue().GetTaggedObject());
5694514f5e3Sopenharmony_ci    int entry = JSHClass::FindPropertyEntry(thread, hclass, keyHandle.GetTaggedValue());
5704514f5e3Sopenharmony_ci    ASSERT(entry != -1);
5714514f5e3Sopenharmony_ci    newLayout->SetNormalAttr(thread, entry, attrValue);
5724514f5e3Sopenharmony_ci
5734514f5e3Sopenharmony_ci    // 3. Maybe Transition And Maintain subtypeing check
5744514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
5754514f5e3Sopenharmony_ci}
5764514f5e3Sopenharmony_ci
5774514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(UpdateHClassForElementsKind)
5784514f5e3Sopenharmony_ci{
5794514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(UpdateHClassForElementsKind);
5804514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the first parameter
5814514f5e3Sopenharmony_ci    JSTaggedType elementsKind = GetTArg(argv, argc, 1);        // 1: means the first parameter
5824514f5e3Sopenharmony_ci    ASSERT(receiver->IsJSArray());
5834514f5e3Sopenharmony_ci    ElementsKind kind = Elements::FixElementsKind(static_cast<ElementsKind>(elementsKind));
5844514f5e3Sopenharmony_ci    auto array = JSHandle<JSArray>(receiver);
5854514f5e3Sopenharmony_ci    ASSERT(JSHClass::IsInitialArrayHClassWithElementsKind(thread, receiver->GetTaggedObject()->GetClass(),
5864514f5e3Sopenharmony_ci                                                          receiver->GetTaggedObject()->GetClass()->GetElementsKind()));
5874514f5e3Sopenharmony_ci    if (!JSHClass::TransitToElementsKindUncheck(thread, JSHandle<JSObject>(array), kind)) {
5884514f5e3Sopenharmony_ci        return JSTaggedValue::Hole().GetRawData();
5894514f5e3Sopenharmony_ci    }
5904514f5e3Sopenharmony_ci
5914514f5e3Sopenharmony_ci    if (!thread->GetEcmaVM()->IsEnableElementsKind()) {
5924514f5e3Sopenharmony_ci        // Update TrackInfo
5934514f5e3Sopenharmony_ci        if (!thread->IsPGOProfilerEnable()) {
5944514f5e3Sopenharmony_ci            return JSTaggedValue::Hole().GetRawData();
5954514f5e3Sopenharmony_ci        }
5964514f5e3Sopenharmony_ci        auto trackInfoVal = JSHandle<JSArray>(receiver)->GetTrackInfo();
5974514f5e3Sopenharmony_ci        thread->GetEcmaVM()->GetPGOProfiler()->UpdateTrackElementsKind(trackInfoVal, kind);
5984514f5e3Sopenharmony_ci    }
5994514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
6004514f5e3Sopenharmony_ci}
6014514f5e3Sopenharmony_ci
6024514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewMutantTaggedArray)
6034514f5e3Sopenharmony_ci{
6044514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewMutantTaggedArray);
6054514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
6064514f5e3Sopenharmony_ci
6074514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
6084514f5e3Sopenharmony_ci    return factory->NewMutantTaggedArray(length.GetInt()).GetTaggedValue().GetRawData();
6094514f5e3Sopenharmony_ci}
6104514f5e3Sopenharmony_ci
6114514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewCOWMutantTaggedArray)
6124514f5e3Sopenharmony_ci{
6134514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewCOWMutantTaggedArray);
6144514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
6154514f5e3Sopenharmony_ci
6164514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
6174514f5e3Sopenharmony_ci    return factory->NewCOWMutantTaggedArray(length.GetInt()).GetTaggedValue().GetRawData();
6184514f5e3Sopenharmony_ci}
6194514f5e3Sopenharmony_ci
6204514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewCOWTaggedArray)
6214514f5e3Sopenharmony_ci{
6224514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewCOWTaggedArray);
6234514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
6244514f5e3Sopenharmony_ci
6254514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
6264514f5e3Sopenharmony_ci    return factory->NewCOWMutantTaggedArray(length.GetInt()).GetTaggedValue().GetRawData();
6274514f5e3Sopenharmony_ci}
6284514f5e3Sopenharmony_ci
6294514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ForceGC)
6304514f5e3Sopenharmony_ci{
6314514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ForceGC);
6324514f5e3Sopenharmony_ci    if (!thread->GetEcmaVM()->GetJSOptions().EnableForceGC()) {
6334514f5e3Sopenharmony_ci        return JSTaggedValue::Hole().GetRawData();
6344514f5e3Sopenharmony_ci    }
6354514f5e3Sopenharmony_ci    thread->GetEcmaVM()->CollectGarbage(TriggerGCType::FULL_GC);
6364514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
6374514f5e3Sopenharmony_ci}
6384514f5e3Sopenharmony_ci
6394514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(RuntimeDump)
6404514f5e3Sopenharmony_ci{
6414514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(RuntimeDump);
6424514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = JSHandle<JSTaggedValue>(GetHArg<JSTaggedValue>(argv, argc, 0));
6434514f5e3Sopenharmony_ci    {
6444514f5e3Sopenharmony_ci        std::ostringstream oss;
6454514f5e3Sopenharmony_ci        obj->Dump(oss);
6464514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "RuntimeDump: " << oss.str();
6474514f5e3Sopenharmony_ci    }
6484514f5e3Sopenharmony_ci
6494514f5e3Sopenharmony_ci    LOG_ECMA(ERROR) << "---------- before force gc ---------------";
6504514f5e3Sopenharmony_ci    {
6514514f5e3Sopenharmony_ci        thread->GetEcmaVM()->CollectGarbage(TriggerGCType::FULL_GC);
6524514f5e3Sopenharmony_ci    }
6534514f5e3Sopenharmony_ci    LOG_ECMA(ERROR) << "---------- end force gc ---------------";
6544514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
6554514f5e3Sopenharmony_ci}
6564514f5e3Sopenharmony_ci
6574514f5e3Sopenharmony_civoid RuntimeStubs::Dump(JSTaggedType rawValue)
6584514f5e3Sopenharmony_ci{
6594514f5e3Sopenharmony_ci    std::ostringstream oss;
6604514f5e3Sopenharmony_ci    auto value = JSTaggedValue(rawValue);
6614514f5e3Sopenharmony_ci    value.Dump(oss);
6624514f5e3Sopenharmony_ci    LOG_ECMA(INFO) << "dump log for read-only crash " << oss.str();
6634514f5e3Sopenharmony_ci}
6644514f5e3Sopenharmony_ci
6654514f5e3Sopenharmony_civoid RuntimeStubs::DebugDump(JSTaggedType rawValue)
6664514f5e3Sopenharmony_ci{
6674514f5e3Sopenharmony_ci    DebugDumpWithHint(reinterpret_cast<uintptr_t>(nullptr), rawValue);
6684514f5e3Sopenharmony_ci}
6694514f5e3Sopenharmony_ci
6704514f5e3Sopenharmony_civoid RuntimeStubs::DumpWithHint(uintptr_t hintStrAddress, JSTaggedType rawValue)
6714514f5e3Sopenharmony_ci{
6724514f5e3Sopenharmony_ci    const char *origHintStr = reinterpret_cast<const char*>(hintStrAddress); // May be nullptr
6734514f5e3Sopenharmony_ci    const char *hintStr = (origHintStr == nullptr) ? "" : origHintStr;
6744514f5e3Sopenharmony_ci    DumpToStreamWithHint(std::cout, hintStr, JSTaggedValue(rawValue));
6754514f5e3Sopenharmony_ci    std::cout << std::endl; // New line
6764514f5e3Sopenharmony_ci}
6774514f5e3Sopenharmony_ci
6784514f5e3Sopenharmony_civoid RuntimeStubs::DebugDumpWithHint(uintptr_t hintStrAddress, JSTaggedType rawValue)
6794514f5e3Sopenharmony_ci{
6804514f5e3Sopenharmony_ci    const char *origHintStr = reinterpret_cast<const char*>(hintStrAddress); // May be nullptr
6814514f5e3Sopenharmony_ci    const char *hintStr = (origHintStr == nullptr) ? "" : origHintStr;
6824514f5e3Sopenharmony_ci    // The immediate lambda expression call is not evaluated when the logger is unabled.
6834514f5e3Sopenharmony_ci    LOG_ECMA(DEBUG) << [](const char *hintStr, JSTaggedType rawValue) {
6844514f5e3Sopenharmony_ci        std::ostringstream out;
6854514f5e3Sopenharmony_ci        DumpToStreamWithHint(out, hintStr, JSTaggedValue(rawValue));
6864514f5e3Sopenharmony_ci        return out.str();
6874514f5e3Sopenharmony_ci    }(hintStr, rawValue);
6884514f5e3Sopenharmony_ci}
6894514f5e3Sopenharmony_ci
6904514f5e3Sopenharmony_civoid RuntimeStubs::DumpToStreamWithHint(std::ostream &out, std::string_view hint, JSTaggedValue value)
6914514f5e3Sopenharmony_ci{
6924514f5e3Sopenharmony_ci    constexpr std::string_view dumpDelimiterLine = "================";
6934514f5e3Sopenharmony_ci    // Begin line
6944514f5e3Sopenharmony_ci    out << dumpDelimiterLine << " Begin dump: " << hint << ' ' << dumpDelimiterLine << std::endl;
6954514f5e3Sopenharmony_ci    // Dumps raw data
6964514f5e3Sopenharmony_ci    out << "(Raw value = 0x" << std::setw(base::INT64_HEX_DIGITS) << std::hex
6974514f5e3Sopenharmony_ci        << std::setfill('0') << value.GetRawData() << ") ";
6984514f5e3Sopenharmony_ci    out << std::dec << std::setfill(' '); // Recovers integer radix & fill character
6994514f5e3Sopenharmony_ci    // Dumps tagged value
7004514f5e3Sopenharmony_ci    value.Dump(out);
7014514f5e3Sopenharmony_ci    // End line
7024514f5e3Sopenharmony_ci    out << dumpDelimiterLine << "   End dump: " << hint << ' ' << dumpDelimiterLine;
7034514f5e3Sopenharmony_ci}
7044514f5e3Sopenharmony_ci
7054514f5e3Sopenharmony_civoid RuntimeStubs::DebugPrint(int fmtMessageId, ...)
7064514f5e3Sopenharmony_ci{
7074514f5e3Sopenharmony_ci    std::string format = MessageString::GetMessageString(fmtMessageId);
7084514f5e3Sopenharmony_ci    va_list args;
7094514f5e3Sopenharmony_ci    va_start(args, fmtMessageId);
7104514f5e3Sopenharmony_ci    std::string result = base::StringHelper::Vformat(format.c_str(), args);
7114514f5e3Sopenharmony_ci    if (MessageString::IsBuiltinsStubMessageString(fmtMessageId)) {
7124514f5e3Sopenharmony_ci        LOG_BUILTINS(DEBUG) << result;
7134514f5e3Sopenharmony_ci    } else {
7144514f5e3Sopenharmony_ci        LOG_ECMA(DEBUG) << result;
7154514f5e3Sopenharmony_ci    }
7164514f5e3Sopenharmony_ci    va_end(args);
7174514f5e3Sopenharmony_ci}
7184514f5e3Sopenharmony_ci
7194514f5e3Sopenharmony_civoid RuntimeStubs::DebugPrintCustom(uintptr_t fmt, ...)
7204514f5e3Sopenharmony_ci{
7214514f5e3Sopenharmony_ci    va_list args;
7224514f5e3Sopenharmony_ci    va_start(args, fmt);
7234514f5e3Sopenharmony_ci    std::string result = base::StringHelper::Vformat(reinterpret_cast<const char*>(fmt), args);
7244514f5e3Sopenharmony_ci    LOG_ECMA(DEBUG) << result;
7254514f5e3Sopenharmony_ci    va_end(args);
7264514f5e3Sopenharmony_ci}
7274514f5e3Sopenharmony_ci
7284514f5e3Sopenharmony_civoid RuntimeStubs::DebugPrintInstruction([[maybe_unused]] uintptr_t argGlue, const uint8_t *pc)
7294514f5e3Sopenharmony_ci{
7304514f5e3Sopenharmony_ci    BytecodeInstruction inst(pc);
7314514f5e3Sopenharmony_ci    LOG_INTERPRETER(DEBUG) << inst;
7324514f5e3Sopenharmony_ci}
7334514f5e3Sopenharmony_ci
7344514f5e3Sopenharmony_civoid RuntimeStubs::DebugOsrEntry([[maybe_unused]] uintptr_t argGlue, const uint8_t *codeEntry)
7354514f5e3Sopenharmony_ci{
7364514f5e3Sopenharmony_ci    LOG_JIT(DEBUG) << "[OSR]: Enter OSR Code: " << reinterpret_cast<const void*>(codeEntry);
7374514f5e3Sopenharmony_ci}
7384514f5e3Sopenharmony_ci
7394514f5e3Sopenharmony_civoid RuntimeStubs::Comment(uintptr_t argStr)
7404514f5e3Sopenharmony_ci{
7414514f5e3Sopenharmony_ci    std::string str(reinterpret_cast<char *>(argStr));
7424514f5e3Sopenharmony_ci    LOG_ECMA(DEBUG) << str;
7434514f5e3Sopenharmony_ci}
7444514f5e3Sopenharmony_ci
7454514f5e3Sopenharmony_civoid RuntimeStubs::FatalPrint(int fmtMessageId, ...)
7464514f5e3Sopenharmony_ci{
7474514f5e3Sopenharmony_ci    std::string format = MessageString::GetMessageString(fmtMessageId);
7484514f5e3Sopenharmony_ci    va_list args;
7494514f5e3Sopenharmony_ci    va_start(args, fmtMessageId);
7504514f5e3Sopenharmony_ci    std::string result = base::StringHelper::Vformat(format.c_str(), args);
7514514f5e3Sopenharmony_ci    LOG_FULL(FATAL) << result;
7524514f5e3Sopenharmony_ci    va_end(args);
7534514f5e3Sopenharmony_ci    LOG_ECMA(FATAL) << "this branch is unreachable";
7544514f5e3Sopenharmony_ci    UNREACHABLE();
7554514f5e3Sopenharmony_ci}
7564514f5e3Sopenharmony_ci
7574514f5e3Sopenharmony_civoid RuntimeStubs::FatalPrintCustom(uintptr_t fmt, ...)
7584514f5e3Sopenharmony_ci{
7594514f5e3Sopenharmony_ci    va_list args;
7604514f5e3Sopenharmony_ci    va_start(args, fmt);
7614514f5e3Sopenharmony_ci    std::string result = base::StringHelper::Vformat(reinterpret_cast<const char*>(fmt), args);
7624514f5e3Sopenharmony_ci    LOG_FULL(FATAL) << result;
7634514f5e3Sopenharmony_ci    va_end(args);
7644514f5e3Sopenharmony_ci    LOG_ECMA(FATAL) << "this branch is unreachable";
7654514f5e3Sopenharmony_ci    UNREACHABLE();
7664514f5e3Sopenharmony_ci}
7674514f5e3Sopenharmony_ci
7684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NoticeThroughChainAndRefreshUser)
7694514f5e3Sopenharmony_ci{
7704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NoticeThroughChainAndRefreshUser);
7714514f5e3Sopenharmony_ci    JSHandle<JSHClass> oldHClassHandle = GetHArg<JSHClass>(argv, argc, 0);  // 0: means the zeroth parameter
7724514f5e3Sopenharmony_ci    JSHandle<JSHClass> newHClassHandle = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
7734514f5e3Sopenharmony_ci
7744514f5e3Sopenharmony_ci    JSHClass::NoticeThroughChain(thread, oldHClassHandle);
7754514f5e3Sopenharmony_ci    JSHClass::RefreshUsers(thread, oldHClassHandle, newHClassHandle);
7764514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
7774514f5e3Sopenharmony_ci}
7784514f5e3Sopenharmony_ci
7794514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Inc)
7804514f5e3Sopenharmony_ci{
7814514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Inc);
7824514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
7834514f5e3Sopenharmony_ci    return RuntimeInc(thread, value).GetRawData();
7844514f5e3Sopenharmony_ci}
7854514f5e3Sopenharmony_ci
7864514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Dec)
7874514f5e3Sopenharmony_ci{
7884514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Dec);
7894514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
7904514f5e3Sopenharmony_ci    return RuntimeDec(thread, value).GetRawData();
7914514f5e3Sopenharmony_ci}
7924514f5e3Sopenharmony_ci
7934514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallGetPrototype)
7944514f5e3Sopenharmony_ci{
7954514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallGetPrototype);
7964514f5e3Sopenharmony_ci    JSHandle<JSProxy> proxy = GetHArg<JSProxy>(argv, argc, 0);  // 0: means the zeroth parameter
7974514f5e3Sopenharmony_ci    return JSProxy::GetPrototype(thread, proxy).GetRawData();
7984514f5e3Sopenharmony_ci}
7994514f5e3Sopenharmony_ci
8004514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(RegularJSObjDeletePrototype)
8014514f5e3Sopenharmony_ci{
8024514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(RegularJSObjDeletePrototype);
8034514f5e3Sopenharmony_ci    JSHandle<JSObject> tagged = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
8044514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 1);
8054514f5e3Sopenharmony_ci    uint32_t index = 0;
8064514f5e3Sopenharmony_ci    if (value.IsString()) {
8074514f5e3Sopenharmony_ci        auto string = JSHandle<EcmaString>(thread, value);
8084514f5e3Sopenharmony_ci        if (EcmaStringAccessor(string).ToElementIndex(&index)) {
8094514f5e3Sopenharmony_ci            value = JSTaggedValue(index);
8104514f5e3Sopenharmony_ci        } else if (!EcmaStringAccessor(string).IsInternString()) {
8114514f5e3Sopenharmony_ci            JSTaggedValue key(RuntimeTryGetInternString(argGlue, string));
8124514f5e3Sopenharmony_ci            if (key.IsHole()) {
8134514f5e3Sopenharmony_ci                return JSTaggedValue::True().GetRawData();
8144514f5e3Sopenharmony_ci            } else {
8154514f5e3Sopenharmony_ci                value = key;
8164514f5e3Sopenharmony_ci            }
8174514f5e3Sopenharmony_ci        }
8184514f5e3Sopenharmony_ci    }
8194514f5e3Sopenharmony_ci    auto result = JSObject::DeleteProperty(thread, tagged, JSHandle<JSTaggedValue>(thread, value));
8204514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
8214514f5e3Sopenharmony_ci    if (!result) {
8224514f5e3Sopenharmony_ci        auto factory = thread->GetEcmaVM()->GetFactory();
8234514f5e3Sopenharmony_ci        JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "Cannot delete property", StackCheck::NO);
8244514f5e3Sopenharmony_ci        thread->SetException(error.GetTaggedValue());
8254514f5e3Sopenharmony_ci        return JSTaggedValue::Exception().GetRawData();
8264514f5e3Sopenharmony_ci    }
8274514f5e3Sopenharmony_ci    return JSTaggedValue::True().GetRawData();
8284514f5e3Sopenharmony_ci}
8294514f5e3Sopenharmony_ci
8304514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallJSObjDeletePrototype)
8314514f5e3Sopenharmony_ci{
8324514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallJSObjDeletePrototype);
8334514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> tagged = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
8344514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);
8354514f5e3Sopenharmony_ci    auto result = JSTaggedValue::DeleteProperty(thread, tagged, value);
8364514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
8374514f5e3Sopenharmony_ci    if (!result) {
8384514f5e3Sopenharmony_ci        auto factory = thread->GetEcmaVM()->GetFactory();
8394514f5e3Sopenharmony_ci        JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "Cannot delete property", StackCheck::NO);
8404514f5e3Sopenharmony_ci        thread->SetException(error.GetTaggedValue());
8414514f5e3Sopenharmony_ci        return JSTaggedValue::Exception().GetRawData();
8424514f5e3Sopenharmony_ci    }
8434514f5e3Sopenharmony_ci    return JSTaggedValue::True().GetRawData();
8444514f5e3Sopenharmony_ci}
8454514f5e3Sopenharmony_ci
8464514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToPropertyKey)
8474514f5e3Sopenharmony_ci{
8484514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToPropertyKey);
8494514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
8504514f5e3Sopenharmony_ci    JSTaggedValue res = JSTaggedValue::ToPropertyKey(thread, key).GetTaggedValue();
8514514f5e3Sopenharmony_ci    return res.GetRawData();
8524514f5e3Sopenharmony_ci}
8534514f5e3Sopenharmony_ci
8544514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToPropertyKeyValue)
8554514f5e3Sopenharmony_ci{
8564514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToPropertyKeyValue);
8574514f5e3Sopenharmony_ci    std::string string_key = "value";
8584514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = JSHandle<JSTaggedValue>(thread,
8594514f5e3Sopenharmony_ci        base::BuiltinsBase::GetTaggedString(thread, string_key.c_str()));
8604514f5e3Sopenharmony_ci    JSTaggedValue res = JSTaggedValue::ToPropertyKey(thread, key).GetTaggedValue();
8614514f5e3Sopenharmony_ci    return res.GetRawData();
8624514f5e3Sopenharmony_ci}
8634514f5e3Sopenharmony_ci
8644514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToPropertyKeyWritable)
8654514f5e3Sopenharmony_ci{
8664514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToPropertyKeyWritable);
8674514f5e3Sopenharmony_ci    std::string string_key = "writable";
8684514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = JSHandle<JSTaggedValue>(thread,
8694514f5e3Sopenharmony_ci        base::BuiltinsBase::GetTaggedString(thread, string_key.c_str()));
8704514f5e3Sopenharmony_ci    JSTaggedValue res = JSTaggedValue::ToPropertyKey(thread, key).GetTaggedValue();
8714514f5e3Sopenharmony_ci    return res.GetRawData();
8724514f5e3Sopenharmony_ci}
8734514f5e3Sopenharmony_ci
8744514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToPropertyKeyEnumerable)
8754514f5e3Sopenharmony_ci{
8764514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToPropertyKeyEnumerable);
8774514f5e3Sopenharmony_ci    std::string string_key = "enumerable";
8784514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = JSHandle<JSTaggedValue>(thread,
8794514f5e3Sopenharmony_ci        base::BuiltinsBase::GetTaggedString(thread, string_key.c_str()));
8804514f5e3Sopenharmony_ci    JSTaggedValue res = JSTaggedValue::ToPropertyKey(thread, key).GetTaggedValue();
8814514f5e3Sopenharmony_ci    return res.GetRawData();
8824514f5e3Sopenharmony_ci}
8834514f5e3Sopenharmony_ci
8844514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToPropertyKeyConfigurable)
8854514f5e3Sopenharmony_ci{
8864514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToPropertyKeyConfigurable);
8874514f5e3Sopenharmony_ci    std::string string_key = "configurable";
8884514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = JSHandle<JSTaggedValue>(thread,
8894514f5e3Sopenharmony_ci        base::BuiltinsBase::GetTaggedString(thread, string_key.c_str()));
8904514f5e3Sopenharmony_ci    JSTaggedValue res = JSTaggedValue::ToPropertyKey(thread, key).GetTaggedValue();
8914514f5e3Sopenharmony_ci    return res.GetRawData();
8924514f5e3Sopenharmony_ci}
8934514f5e3Sopenharmony_ci
8944514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Exp)
8954514f5e3Sopenharmony_ci{
8964514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Exp);
8974514f5e3Sopenharmony_ci    JSTaggedValue baseValue = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
8984514f5e3Sopenharmony_ci    JSTaggedValue exponentValue = GetArg(argv, argc, 1);  // 1: means the first parameter
8994514f5e3Sopenharmony_ci    if (baseValue.IsNumber() && exponentValue.IsNumber()) {
9004514f5e3Sopenharmony_ci        // fast path
9014514f5e3Sopenharmony_ci        double doubleBase = baseValue.IsInt() ? baseValue.GetInt() : baseValue.GetDouble();
9024514f5e3Sopenharmony_ci        double doubleExponent = exponentValue.IsInt() ? exponentValue.GetInt() : exponentValue.GetDouble();
9034514f5e3Sopenharmony_ci        if (std::abs(doubleBase) == 1 && std::isinf(doubleExponent)) {
9044514f5e3Sopenharmony_ci            return JSTaggedValue(base::NAN_VALUE).GetRawData();
9054514f5e3Sopenharmony_ci        }
9064514f5e3Sopenharmony_ci        if ((doubleBase == 0 &&
9074514f5e3Sopenharmony_ci            ((base::bit_cast<uint64_t>(doubleBase)) & base::DOUBLE_SIGN_MASK) == base::DOUBLE_SIGN_MASK) &&
9084514f5e3Sopenharmony_ci            std::isfinite(doubleExponent) && base::NumberHelper::TruncateDouble(doubleExponent) == doubleExponent &&
9094514f5e3Sopenharmony_ci            base::NumberHelper::TruncateDouble(doubleExponent / 2) + base::HALF ==  // 2 : half
9104514f5e3Sopenharmony_ci            (doubleExponent / 2)) {  // 2 : half
9114514f5e3Sopenharmony_ci            if (doubleExponent > 0) {
9124514f5e3Sopenharmony_ci                return JSTaggedValue(-0.0).GetRawData();
9134514f5e3Sopenharmony_ci            }
9144514f5e3Sopenharmony_ci            if (doubleExponent < 0) {
9154514f5e3Sopenharmony_ci                return JSTaggedValue(-base::POSITIVE_INFINITY).GetRawData();
9164514f5e3Sopenharmony_ci            }
9174514f5e3Sopenharmony_ci        }
9184514f5e3Sopenharmony_ci        return JSTaggedValue(std::pow(doubleBase, doubleExponent)).GetRawData();
9194514f5e3Sopenharmony_ci    }
9204514f5e3Sopenharmony_ci    // Slow path
9214514f5e3Sopenharmony_ci    JSTaggedValue res = RuntimeExp(thread, baseValue, exponentValue);
9224514f5e3Sopenharmony_ci    return res.GetRawData();
9234514f5e3Sopenharmony_ci}
9244514f5e3Sopenharmony_ci
9254514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(IsIn)
9264514f5e3Sopenharmony_ci{
9274514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(IsIn);
9284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9294514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
9304514f5e3Sopenharmony_ci    return RuntimeIsIn(thread, prop, obj).GetRawData();
9314514f5e3Sopenharmony_ci}
9324514f5e3Sopenharmony_ci
9334514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(InstanceOf)
9344514f5e3Sopenharmony_ci{
9354514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(InstanceOf);
9364514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9374514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
9384514f5e3Sopenharmony_ci    return RuntimeInstanceof(thread, obj, target).GetRawData();
9394514f5e3Sopenharmony_ci}
9404514f5e3Sopenharmony_ci
9414514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DumpObject)
9424514f5e3Sopenharmony_ci{
9434514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DumpObject);
9444514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9454514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> targetId = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
9464514f5e3Sopenharmony_ci    LOG_ECMA(INFO) << "InstanceOf Stability Testing Num: " << targetId->GetInt();
9474514f5e3Sopenharmony_ci    std::ostringstream oss;
9484514f5e3Sopenharmony_ci    target->Dump(oss);
9494514f5e3Sopenharmony_ci    LOG_ECMA(INFO) << "dump log for instance of target: " << oss.str();
9504514f5e3Sopenharmony_ci    return JSTaggedValue::True().GetRawData();
9514514f5e3Sopenharmony_ci}
9524514f5e3Sopenharmony_ci
9534514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(BigIntConstructor)
9544514f5e3Sopenharmony_ci{
9554514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(BigIntConstructor);
9564514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);
9574514f5e3Sopenharmony_ci    return builtins::BuiltinsBigInt::BigIntConstructorInternal(thread, value).GetRawData();
9584514f5e3Sopenharmony_ci}
9594514f5e3Sopenharmony_ci
9604514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateGeneratorObj)
9614514f5e3Sopenharmony_ci{
9624514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateGeneratorObj);
9634514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> genFunc = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9644514f5e3Sopenharmony_ci    return RuntimeCreateGeneratorObj(thread, genFunc).GetRawData();
9654514f5e3Sopenharmony_ci}
9664514f5e3Sopenharmony_ci
9674514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateAsyncGeneratorObj)
9684514f5e3Sopenharmony_ci{
9694514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateAsyncGeneratorObj);
9704514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> genFunc = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9714514f5e3Sopenharmony_ci    return RuntimeCreateAsyncGeneratorObj(thread, genFunc).GetRawData();
9724514f5e3Sopenharmony_ci}
9734514f5e3Sopenharmony_ci
9744514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetTemplateObject)
9754514f5e3Sopenharmony_ci{
9764514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetTemplateObject);
9774514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> literal = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9784514f5e3Sopenharmony_ci    return RuntimeGetTemplateObject(thread, literal).GetRawData();
9794514f5e3Sopenharmony_ci}
9804514f5e3Sopenharmony_ci
9814514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateStringIterator)
9824514f5e3Sopenharmony_ci{
9834514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateStringIterator);
9844514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
9854514f5e3Sopenharmony_ci    return JSStringIterator::CreateStringIterator(thread, JSHandle<EcmaString>(obj)).GetTaggedValue().GetRawData();
9864514f5e3Sopenharmony_ci}
9874514f5e3Sopenharmony_ci
9884514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewJSArrayIterator)
9894514f5e3Sopenharmony_ci{
9904514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewJSArrayIterator);
9914514f5e3Sopenharmony_ci    JSHandle<JSObject> obj = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
9924514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
9934514f5e3Sopenharmony_ci    return factory->NewJSArrayIterator(obj, IterationKind::VALUE).GetTaggedValue().GetRawData();
9944514f5e3Sopenharmony_ci}
9954514f5e3Sopenharmony_ci
9964514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewJSTypedArrayIterator)
9974514f5e3Sopenharmony_ci{
9984514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewJSArrayIterator);
9994514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10004514f5e3Sopenharmony_ci    base::TypedArrayHelper::ValidateTypedArray(thread, obj);
10014514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
10024514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
10034514f5e3Sopenharmony_ci    JSHandle<JSArrayIterator> iter(factory->NewJSArrayIterator(JSHandle<JSObject>(obj), IterationKind::VALUE));
10044514f5e3Sopenharmony_ci    return iter.GetTaggedValue().GetRawData();
10054514f5e3Sopenharmony_ci}
10064514f5e3Sopenharmony_ci
10074514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(MapIteratorNext)
10084514f5e3Sopenharmony_ci{
10094514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(MapIteratorNext);
10104514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10114514f5e3Sopenharmony_ci    return JSMapIterator::NextInternal(thread, thisObj).GetRawData();
10124514f5e3Sopenharmony_ci}
10134514f5e3Sopenharmony_ci
10144514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetIteratorNext)
10154514f5e3Sopenharmony_ci{
10164514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetIteratorNext);
10174514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10184514f5e3Sopenharmony_ci    return JSSetIterator::NextInternal(thread, thisObj).GetRawData();
10194514f5e3Sopenharmony_ci}
10204514f5e3Sopenharmony_ci
10214514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StringIteratorNext)
10224514f5e3Sopenharmony_ci{
10234514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StringIteratorNext);
10244514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10254514f5e3Sopenharmony_ci    return builtins::BuiltinsStringIterator::NextInternal(thread, thisObj).GetRawData();
10264514f5e3Sopenharmony_ci}
10274514f5e3Sopenharmony_ci
10284514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ArrayIteratorNext)
10294514f5e3Sopenharmony_ci{
10304514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ArrayIteratorNext);
10314514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10324514f5e3Sopenharmony_ci    return JSArrayIterator::NextInternal(thread, thisObj).GetRawData();
10334514f5e3Sopenharmony_ci}
10344514f5e3Sopenharmony_ci
10354514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(IteratorReturn)
10364514f5e3Sopenharmony_ci{
10374514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(IteratorReturn);
10384514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10394514f5e3Sopenharmony_ci    return builtins::BuiltinsIterator::ReturnInternal(thread, thisObj).GetRawData();
10404514f5e3Sopenharmony_ci}
10414514f5e3Sopenharmony_ci
10424514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetNextPropName)
10434514f5e3Sopenharmony_ci{
10444514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetNextPropName);
10454514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> iter = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10464514f5e3Sopenharmony_ci    return RuntimeGetNextPropName(thread, iter).GetRawData();
10474514f5e3Sopenharmony_ci}
10484514f5e3Sopenharmony_ci
10494514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetNextPropNameSlowpath)
10504514f5e3Sopenharmony_ci{
10514514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetNextPropNameSlowpath);
10524514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> iter = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10534514f5e3Sopenharmony_ci    ASSERT(iter->IsForinIterator());
10544514f5e3Sopenharmony_ci    JSTaggedValue res = JSForInIterator::NextInternalSlowpath(thread, JSHandle<JSForInIterator>::Cast(iter));
10554514f5e3Sopenharmony_ci    return res.GetRawData();
10564514f5e3Sopenharmony_ci}
10574514f5e3Sopenharmony_ci
10584514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(IterNext)
10594514f5e3Sopenharmony_ci{
10604514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(IterNext);
10614514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> iter = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10624514f5e3Sopenharmony_ci    return RuntimeIterNext(thread, iter).GetRawData();
10634514f5e3Sopenharmony_ci}
10644514f5e3Sopenharmony_ci
10654514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CloseIterator)
10664514f5e3Sopenharmony_ci{
10674514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CloseIterator);
10684514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> iter = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10694514f5e3Sopenharmony_ci    return RuntimeCloseIterator(thread, iter).GetRawData();
10704514f5e3Sopenharmony_ci}
10714514f5e3Sopenharmony_ci
10724514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SuperCallSpread)
10734514f5e3Sopenharmony_ci{
10744514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SuperCallSpread);
10754514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
10764514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> array = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
10774514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType *>(thread->GetCurrentInterpretedFrame());
10784514f5e3Sopenharmony_ci    JSTaggedValue function = InterpreterAssembly::GetNewTarget(sp);
10794514f5e3Sopenharmony_ci    return RuntimeSuperCallSpread(thread, func, JSHandle<JSTaggedValue>(thread, function), array).GetRawData();
10804514f5e3Sopenharmony_ci}
10814514f5e3Sopenharmony_ci
10824514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptSuperCallSpread)
10834514f5e3Sopenharmony_ci{
10844514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptSuperCallSpread);
10854514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
10864514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
10874514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> taggedArray = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
10884514f5e3Sopenharmony_ci    return RuntimeOptSuperCallSpread(thread, func, newTarget, taggedArray).GetRawData();
10894514f5e3Sopenharmony_ci}
10904514f5e3Sopenharmony_ci
10914514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SuperCallForwardAllArgs)
10924514f5e3Sopenharmony_ci{
10934514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SuperCallForwardAllArgs);
10944514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType *>(thread->GetCurrentInterpretedFrame());
10954514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: index of child constructor
10964514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> superFunc(thread, JSTaggedValue::GetPrototype(thread, func));
10974514f5e3Sopenharmony_ci    auto newTarget = JSHandle<JSTaggedValue>(thread, InterpreterAssembly::GetNewTarget(sp));
10984514f5e3Sopenharmony_ci    uint32_t startIdx = 0;
10994514f5e3Sopenharmony_ci    uint32_t restNumArgs = InterpreterAssembly::GetNumArgs(sp, 0, startIdx);  // 0: rest args start idx
11004514f5e3Sopenharmony_ci    return RuntimeSuperCallForwardAllArgs(thread, sp, superFunc, newTarget, restNumArgs, startIdx).GetRawData();
11014514f5e3Sopenharmony_ci}
11024514f5e3Sopenharmony_ci
11034514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptSuperCallForwardAllArgs)
11044514f5e3Sopenharmony_ci{
11054514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptSuperCallForwardAllArgs);
11064514f5e3Sopenharmony_ci    JSTaggedType *sp = reinterpret_cast<JSTaggedType *>(GetActualArgv(thread));
11074514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> superFunc = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: index of super constructor
11084514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: index of newTarget
11094514f5e3Sopenharmony_ci    int actualArgc = GetArg(argv, argc, 2).GetInt();                            // 2: index of actual argc
11104514f5e3Sopenharmony_ci    ASSERT(actualArgc >= 0);
11114514f5e3Sopenharmony_ci    uint32_t convertedActualArgc = static_cast<uint32_t>(actualArgc);
11124514f5e3Sopenharmony_ci    ASSERT(convertedActualArgc >= NUM_MANDATORY_JSFUNC_ARGS);
11134514f5e3Sopenharmony_ci    uint32_t restNumArgs = convertedActualArgc - NUM_MANDATORY_JSFUNC_ARGS;
11144514f5e3Sopenharmony_ci    uint32_t startIdx = NUM_MANDATORY_JSFUNC_ARGS;
11154514f5e3Sopenharmony_ci    return RuntimeSuperCallForwardAllArgs(thread, sp, superFunc, newTarget, restNumArgs, startIdx).GetRawData();
11164514f5e3Sopenharmony_ci}
11174514f5e3Sopenharmony_ci
11184514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetCallSpreadArgs)
11194514f5e3Sopenharmony_ci{
11204514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetCallSpreadArgs);
11214514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> jsArray = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11224514f5e3Sopenharmony_ci    return RuntimeGetCallSpreadArgs(thread, jsArray).GetRawData();
11234514f5e3Sopenharmony_ci}
11244514f5e3Sopenharmony_ci
11254514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DelObjProp)
11264514f5e3Sopenharmony_ci{
11274514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DelObjProp);
11284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11294514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
11304514f5e3Sopenharmony_ci    return RuntimeDelObjProp(thread, obj, prop).GetRawData();
11314514f5e3Sopenharmony_ci}
11324514f5e3Sopenharmony_ci
11334514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewObjApply)
11344514f5e3Sopenharmony_ci{
11354514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewObjApply);
11364514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11374514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> array = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
11384514f5e3Sopenharmony_ci    return RuntimeNewObjApply(thread, func, array).GetRawData();
11394514f5e3Sopenharmony_ci}
11404514f5e3Sopenharmony_ci
11414514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateIterResultObj)
11424514f5e3Sopenharmony_ci{
11434514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateIterResultObj);
11444514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11454514f5e3Sopenharmony_ci    JSTaggedValue flag = GetArg(argv, argc, 1);  // 1: means the first parameter
11464514f5e3Sopenharmony_ci    return RuntimeCreateIterResultObj(thread, value, flag).GetRawData();
11474514f5e3Sopenharmony_ci}
11484514f5e3Sopenharmony_ci
11494514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AsyncFunctionAwaitUncaught)
11504514f5e3Sopenharmony_ci{
11514514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AsyncFunctionAwaitUncaught);
11524514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> asyncFuncObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11534514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
11544514f5e3Sopenharmony_ci    return RuntimeAsyncFunctionAwaitUncaught(thread, asyncFuncObj, value).GetRawData();
11554514f5e3Sopenharmony_ci}
11564514f5e3Sopenharmony_ci
11574514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AsyncFunctionResolveOrReject)
11584514f5e3Sopenharmony_ci{
11594514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AsyncFunctionResolveOrReject);
11604514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> asyncFuncObj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11614514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
11624514f5e3Sopenharmony_ci    JSTaggedValue isResolve = GetArg(argv, argc, 2);  // 2: means the second parameter
11634514f5e3Sopenharmony_ci    return RuntimeAsyncFunctionResolveOrReject(thread, asyncFuncObj, value, isResolve.IsTrue()).GetRawData();
11644514f5e3Sopenharmony_ci}
11654514f5e3Sopenharmony_ci
11664514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AsyncGeneratorResolve)
11674514f5e3Sopenharmony_ci{
11684514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AsyncGeneratorResolve);
11694514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> asyncGenerator = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
11704514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
11714514f5e3Sopenharmony_ci    JSTaggedValue flag = GetArg(argv, argc, 2); // 2: means the second parameter
11724514f5e3Sopenharmony_ci    return RuntimeAsyncGeneratorResolve(thread, asyncGenerator, value, flag).GetRawData();
11734514f5e3Sopenharmony_ci}
11744514f5e3Sopenharmony_ci
11754514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AsyncGeneratorReject)
11764514f5e3Sopenharmony_ci{
11774514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AsyncGeneratorReject);
11784514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> asyncGenerator = GetHArg<JSTaggedValue>(argv, argc, 0);
11794514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);
11804514f5e3Sopenharmony_ci    return RuntimeAsyncGeneratorReject(thread, asyncGenerator, value).GetRawData();
11814514f5e3Sopenharmony_ci}
11824514f5e3Sopenharmony_ci
11834514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetGeneratorState)
11844514f5e3Sopenharmony_ci{
11854514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetGeneratorState);
11864514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> asyncGenerator = GetHArg<JSTaggedValue>(argv, argc, 0);
11874514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 1);
11884514f5e3Sopenharmony_ci    RuntimeSetGeneratorState(thread, asyncGenerator, index.GetInt());
11894514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
11904514f5e3Sopenharmony_ci}
11914514f5e3Sopenharmony_ci
11924514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CopyDataProperties)
11934514f5e3Sopenharmony_ci{
11944514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CopyDataProperties);
11954514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> dst = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
11964514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> src = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
11974514f5e3Sopenharmony_ci    return RuntimeCopyDataProperties(thread, dst, src).GetRawData();
11984514f5e3Sopenharmony_ci}
11994514f5e3Sopenharmony_ci
12004514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StArraySpread)
12014514f5e3Sopenharmony_ci{
12024514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StArraySpread);
12034514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> dst = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12044514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 1);  // 1: means the first parameter
12054514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> src = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
12064514f5e3Sopenharmony_ci    return RuntimeStArraySpread(thread, dst, index, src).GetRawData();
12074514f5e3Sopenharmony_ci}
12084514f5e3Sopenharmony_ci
12094514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetIteratorNext)
12104514f5e3Sopenharmony_ci{
12114514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetIteratorNext);
12124514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12134514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> method = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
12144514f5e3Sopenharmony_ci    return RuntimeGetIteratorNext(thread, obj, method).GetRawData();
12154514f5e3Sopenharmony_ci}
12164514f5e3Sopenharmony_ci
12174514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetObjectWithProto)
12184514f5e3Sopenharmony_ci{
12194514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetObjectWithProto);
12204514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> proto = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12214514f5e3Sopenharmony_ci    JSHandle<JSObject> obj = GetHArg<JSObject>(argv, argc, 1);  // 1: means the first parameter
12224514f5e3Sopenharmony_ci    return RuntimeSetObjectWithProto(thread, proto, obj).GetRawData();
12234514f5e3Sopenharmony_ci}
12244514f5e3Sopenharmony_ci
12254514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LoadICByValue)
12264514f5e3Sopenharmony_ci{
12274514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LoadICByValue);
12284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileTypeInfo = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12294514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
12304514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
12314514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 3);  // 3: means the third parameter
12324514f5e3Sopenharmony_ci
12334514f5e3Sopenharmony_ci    JSTaggedValue::RequireObjectCoercible(thread, receiver, "Cannot load property of null or undefined");
12344514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
12354514f5e3Sopenharmony_ci
12364514f5e3Sopenharmony_ci    if (profileTypeInfo->IsUndefined()) {
12374514f5e3Sopenharmony_ci        return RuntimeLdObjByValue(thread, receiver, key, false, JSTaggedValue::Undefined()).GetRawData();
12384514f5e3Sopenharmony_ci    }
12394514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key);
12404514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
12414514f5e3Sopenharmony_ci    LoadICRuntime icRuntime(thread, JSHandle<ProfileTypeInfo>::Cast(profileTypeInfo), slotId.GetInt(), ICKind::LoadIC);
12424514f5e3Sopenharmony_ci    return icRuntime.LoadValueMiss(receiver, propKey).GetRawData();
12434514f5e3Sopenharmony_ci}
12444514f5e3Sopenharmony_ci
12454514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StoreICByValue)
12464514f5e3Sopenharmony_ci{
12474514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StoreICByValue);
12484514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileTypeInfo = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12494514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
12504514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
12514514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
12524514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 4);   // 4: means the fourth parameter
12534514f5e3Sopenharmony_ci
12544514f5e3Sopenharmony_ci    if (profileTypeInfo->IsUndefined()) {
12554514f5e3Sopenharmony_ci        return RuntimeStObjByValue(thread, receiver, key, value).GetRawData();
12564514f5e3Sopenharmony_ci    }
12574514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key);
12584514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
12594514f5e3Sopenharmony_ci    StoreICRuntime icRuntime(thread, JSHandle<ProfileTypeInfo>::Cast(profileTypeInfo), slotId.GetInt(),
12604514f5e3Sopenharmony_ci                             ICKind::StoreIC);
12614514f5e3Sopenharmony_ci    return icRuntime.StoreMiss(receiver, propKey, value).GetRawData();
12624514f5e3Sopenharmony_ci}
12634514f5e3Sopenharmony_ci
12644514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StoreOwnICByValue)
12654514f5e3Sopenharmony_ci{
12664514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StoreOwnICByValue);
12674514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileTypeInfo = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12684514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
12694514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
12704514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
12714514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 4);   // 4: means the fourth parameter
12724514f5e3Sopenharmony_ci    if (profileTypeInfo->IsUndefined()) {
12734514f5e3Sopenharmony_ci        return RuntimeStOwnByIndex(thread, receiver, key, value).GetRawData();
12744514f5e3Sopenharmony_ci    }
12754514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> propKey = JSTaggedValue::ToPropertyKey(thread, key);
12764514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
12774514f5e3Sopenharmony_ci    StoreICRuntime icRuntime(thread, JSHandle<ProfileTypeInfo>::Cast(profileTypeInfo), slotId.GetInt(),
12784514f5e3Sopenharmony_ci                             ICKind::StoreIC);
12794514f5e3Sopenharmony_ci    return icRuntime.StoreMiss(receiver, propKey, value, true).GetRawData();
12804514f5e3Sopenharmony_ci}
12814514f5e3Sopenharmony_ci
12824514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StOwnByValue)
12834514f5e3Sopenharmony_ci{
12844514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StOwnByValue);
12854514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12864514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
12874514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
12884514f5e3Sopenharmony_ci
12894514f5e3Sopenharmony_ci    return RuntimeStOwnByValue(thread, obj, key, value).GetRawData();
12904514f5e3Sopenharmony_ci}
12914514f5e3Sopenharmony_ci
12924514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdSuperByValue)
12934514f5e3Sopenharmony_ci{
12944514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdSuperByValue);
12954514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
12964514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
12974514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType *>(thread->GetCurrentInterpretedFrame());
12984514f5e3Sopenharmony_ci    JSTaggedValue thisFunc = InterpreterAssembly::GetFunction(sp);
12994514f5e3Sopenharmony_ci    return RuntimeLdSuperByValue(thread, obj, key, thisFunc).GetRawData();
13004514f5e3Sopenharmony_ci}
13014514f5e3Sopenharmony_ci
13024514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptLdSuperByValue)
13034514f5e3Sopenharmony_ci{
13044514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptLdSuperByValue);
13054514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13064514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
13074514f5e3Sopenharmony_ci    JSTaggedValue thisFunc = GetArg(argv, argc, 2);  // 2: means the second parameter
13084514f5e3Sopenharmony_ci    return RuntimeLdSuperByValue(thread, obj, key, thisFunc).GetRawData();
13094514f5e3Sopenharmony_ci}
13104514f5e3Sopenharmony_ci
13114514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StSuperByValue)
13124514f5e3Sopenharmony_ci{
13134514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StSuperByValue);
13144514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13154514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
13164514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
13174514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType *>(thread->GetCurrentInterpretedFrame());
13184514f5e3Sopenharmony_ci    JSTaggedValue thisFunc = InterpreterAssembly::GetFunction(sp);
13194514f5e3Sopenharmony_ci    return RuntimeStSuperByValue(thread, obj, key, value, thisFunc).GetRawData();
13204514f5e3Sopenharmony_ci}
13214514f5e3Sopenharmony_ci
13224514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptStSuperByValue)
13234514f5e3Sopenharmony_ci{
13244514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptStSuperByValue);
13254514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13264514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
13274514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
13284514f5e3Sopenharmony_ci    JSTaggedValue thisFunc = GetArg(argv, argc, 3);  // 3: means the third parameter
13294514f5e3Sopenharmony_ci    return RuntimeStSuperByValue(thread, obj, key, value, thisFunc).GetRawData();
13304514f5e3Sopenharmony_ci}
13314514f5e3Sopenharmony_ci
13324514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetMethodFromCache)
13334514f5e3Sopenharmony_ci{
13344514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetMethodFromCache);
13354514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13364514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 1);  // 1: means the first parameter
13374514f5e3Sopenharmony_ci    return ConstantPool::GetMethodFromCache(
13384514f5e3Sopenharmony_ci        thread, constpool.GetTaggedValue(), index.GetInt()).GetRawData();
13394514f5e3Sopenharmony_ci}
13404514f5e3Sopenharmony_ci
13414514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetStringFromCache)
13424514f5e3Sopenharmony_ci{
13434514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetStringFromCache);
13444514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13454514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 1);  // 1: means the first parameter
13464514f5e3Sopenharmony_ci    return ConstantPool::GetStringFromCache(
13474514f5e3Sopenharmony_ci        thread, constpool.GetTaggedValue(), index.GetInt()).GetRawData();
13484514f5e3Sopenharmony_ci}
13494514f5e3Sopenharmony_ci
13504514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetObjectLiteralFromCache)
13514514f5e3Sopenharmony_ci{
13524514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetObjectLiteralFromCache);
13534514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13544514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 1);  // 1: means the first parameter
13554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
13564514f5e3Sopenharmony_ci    JSTaggedValue cp = thread->GetCurrentEcmaContext()->FindOrCreateUnsharedConstpool(constpool.GetTaggedValue());
13574514f5e3Sopenharmony_ci    return ConstantPool::GetLiteralFromCache<ConstPoolType::OBJECT_LITERAL>(
13584514f5e3Sopenharmony_ci        thread, cp, index.GetInt(), module.GetTaggedValue()).GetRawData();
13594514f5e3Sopenharmony_ci}
13604514f5e3Sopenharmony_ci
13614514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetArrayLiteralFromCache)
13624514f5e3Sopenharmony_ci{
13634514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetArrayLiteralFromCache);
13644514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13654514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 1);  // 1: means the first parameter
13664514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
13674514f5e3Sopenharmony_ci    JSTaggedValue cp = thread->GetCurrentEcmaContext()->FindOrCreateUnsharedConstpool(constpool.GetTaggedValue());
13684514f5e3Sopenharmony_ci    return ConstantPool::GetLiteralFromCache<ConstPoolType::ARRAY_LITERAL>(
13694514f5e3Sopenharmony_ci        thread, cp, index.GetInt(), module.GetTaggedValue()).GetRawData();
13704514f5e3Sopenharmony_ci}
13714514f5e3Sopenharmony_ci
13724514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdObjByIndex)
13734514f5e3Sopenharmony_ci{
13744514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdObjByIndex);
13754514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13764514f5e3Sopenharmony_ci    JSTaggedValue idx = GetArg(argv, argc, 1);  // 1: means the first parameter
13774514f5e3Sopenharmony_ci    JSTaggedValue callGetter = GetArg(argv, argc, 2);  // 2: means the second parameter
13784514f5e3Sopenharmony_ci    JSTaggedValue receiver = GetArg(argv, argc, 3);  // 3: means the third parameter
13794514f5e3Sopenharmony_ci    return RuntimeLdObjByIndex(thread, obj, idx.GetInt(), callGetter.IsTrue(), receiver).GetRawData();
13804514f5e3Sopenharmony_ci}
13814514f5e3Sopenharmony_ci
13824514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StObjByIndex)
13834514f5e3Sopenharmony_ci{
13844514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StObjByIndex);
13854514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13864514f5e3Sopenharmony_ci    JSTaggedValue idx = GetArg(argv, argc, 1);  // 1: means the first parameter
13874514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
13884514f5e3Sopenharmony_ci    return RuntimeStObjByIndex(thread, obj, idx.GetInt(), value).GetRawData();
13894514f5e3Sopenharmony_ci}
13904514f5e3Sopenharmony_ci
13914514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StOwnByIndex)
13924514f5e3Sopenharmony_ci{
13934514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StOwnByIndex);
13944514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
13954514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> idx = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
13964514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
13974514f5e3Sopenharmony_ci    return RuntimeStOwnByIndex(thread, obj, idx, value).GetRawData();
13984514f5e3Sopenharmony_ci}
13994514f5e3Sopenharmony_ci
14004514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StGlobalRecord)
14014514f5e3Sopenharmony_ci{
14024514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StGlobalRecord);
14034514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
14044514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
14054514f5e3Sopenharmony_ci    JSTaggedValue isConst = GetArg(argv, argc, 2);
14064514f5e3Sopenharmony_ci    return RuntimeStGlobalRecord(thread, prop, value, isConst.IsTrue()).GetRawData();
14074514f5e3Sopenharmony_ci}
14084514f5e3Sopenharmony_ci
14094514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Neg)
14104514f5e3Sopenharmony_ci{
14114514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Neg);
14124514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
14134514f5e3Sopenharmony_ci    return RuntimeNeg(thread, value).GetRawData();
14144514f5e3Sopenharmony_ci}
14154514f5e3Sopenharmony_ci
14164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Not)
14174514f5e3Sopenharmony_ci{
14184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Not);
14194514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
14204514f5e3Sopenharmony_ci    return RuntimeNot(thread, value).GetRawData();
14214514f5e3Sopenharmony_ci}
14224514f5e3Sopenharmony_ci
14234514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Shl2)
14244514f5e3Sopenharmony_ci{
14254514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Shl2);
14264514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
14274514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
14284514f5e3Sopenharmony_ci
14294514f5e3Sopenharmony_ci    auto res = SlowRuntimeStub::Shl2(thread, left, right);
14304514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
14314514f5e3Sopenharmony_ci}
14324514f5e3Sopenharmony_ci
14334514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Shr2)
14344514f5e3Sopenharmony_ci{
14354514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Shr2);
14364514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
14374514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
14384514f5e3Sopenharmony_ci
14394514f5e3Sopenharmony_ci    auto res = SlowRuntimeStub::Shr2(thread, left, right);
14404514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
14414514f5e3Sopenharmony_ci}
14424514f5e3Sopenharmony_ci
14434514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Ashr2)
14444514f5e3Sopenharmony_ci{
14454514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Ashr2);
14464514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
14474514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
14484514f5e3Sopenharmony_ci
14494514f5e3Sopenharmony_ci    auto res = SlowRuntimeStub::Ashr2(thread, left, right);
14504514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
14514514f5e3Sopenharmony_ci}
14524514f5e3Sopenharmony_ci
14534514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(And2)
14544514f5e3Sopenharmony_ci{
14554514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(And2);
14564514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
14574514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
14584514f5e3Sopenharmony_ci
14594514f5e3Sopenharmony_ci    auto res = SlowRuntimeStub::And2(thread, left, right);
14604514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
14614514f5e3Sopenharmony_ci}
14624514f5e3Sopenharmony_ci
14634514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Xor2)
14644514f5e3Sopenharmony_ci{
14654514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Xor2);
14664514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
14674514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
14684514f5e3Sopenharmony_ci
14694514f5e3Sopenharmony_ci    auto res = SlowRuntimeStub::Xor2(thread, left, right);
14704514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
14714514f5e3Sopenharmony_ci}
14724514f5e3Sopenharmony_ci
14734514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Or2)
14744514f5e3Sopenharmony_ci{
14754514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Or2);
14764514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
14774514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
14784514f5e3Sopenharmony_ci
14794514f5e3Sopenharmony_ci    auto res = SlowRuntimeStub::Or2(thread, left, right);
14804514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
14814514f5e3Sopenharmony_ci}
14824514f5e3Sopenharmony_ci
14834514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateClassWithBuffer)
14844514f5e3Sopenharmony_ci{
14854514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateClassWithBuffer);
14864514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> base = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
14874514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> lexenv = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
14884514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
14894514f5e3Sopenharmony_ci    JSTaggedValue methodId = GetArg(argv, argc, 3);  // 3: means the third parameter
14904514f5e3Sopenharmony_ci    JSTaggedValue literalId = GetArg(argv, argc, 4);  // 4: means the four parameter
14914514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 5);  // 5: means the fifth parameter
14924514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> length = GetHArg<JSTaggedValue>(argv, argc, 6);  // 6: means the sixth parameter
14934514f5e3Sopenharmony_ci
14944514f5e3Sopenharmony_ci    auto res = RuntimeCreateClassWithBuffer(thread, base, lexenv, constpool,
14954514f5e3Sopenharmony_ci                                            static_cast<uint16_t>(methodId.GetInt()),
14964514f5e3Sopenharmony_ci                                            static_cast<uint16_t>(literalId.GetInt()),
14974514f5e3Sopenharmony_ci                                            module, length);
14984514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_IC
14994514f5e3Sopenharmony_ci    const uint32_t INDEX_OF_SLOT_ID = 7; // 7: index of slotId in argv
15004514f5e3Sopenharmony_ci    if (argc > INDEX_OF_SLOT_ID) {
15014514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
15024514f5e3Sopenharmony_ci        uint16_t slotId = static_cast<uint16_t>(GetArg(argv, argc, INDEX_OF_SLOT_ID).GetInt());
15034514f5e3Sopenharmony_ci        const uint32_t INDEX_OF_JS_FUNC = 8;  // 8: index of jsFunc in argv
15044514f5e3Sopenharmony_ci        ASSERT(argc > INDEX_OF_JS_FUNC);
15054514f5e3Sopenharmony_ci        JSHandle<JSFunction> jsFuncHandle = GetHArg<JSFunction>(argv, argc, INDEX_OF_JS_FUNC);
15064514f5e3Sopenharmony_ci        JSHandle<JSFunction> resHandle(thread, res);
15074514f5e3Sopenharmony_ci        SetProfileTypeInfoCellToFunction(thread, jsFuncHandle, resHandle, slotId);
15084514f5e3Sopenharmony_ci        res = resHandle.GetTaggedValue();
15094514f5e3Sopenharmony_ci    }
15104514f5e3Sopenharmony_ci#endif
15114514f5e3Sopenharmony_ci    return res.GetRawData();
15124514f5e3Sopenharmony_ci}
15134514f5e3Sopenharmony_ci
15144514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateSharedClass)
15154514f5e3Sopenharmony_ci{
15164514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateSharedClass);
15174514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> base = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
15184514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
15194514f5e3Sopenharmony_ci    JSTaggedValue methodId = GetArg(argv, argc, 2);  // 2: means the second parameter
15204514f5e3Sopenharmony_ci    JSTaggedValue literalId = GetArg(argv, argc, 3);  // 3: means the third parameter
15214514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 4);  // 4: means the fourth parameter
15224514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 5);  // 5: means the fifth parameter
15234514f5e3Sopenharmony_ci    return RuntimeCreateSharedClass(thread, base, constpool,
15244514f5e3Sopenharmony_ci                                    static_cast<uint16_t>(methodId.GetInt()),
15254514f5e3Sopenharmony_ci                                    static_cast<uint16_t>(literalId.GetInt()),
15264514f5e3Sopenharmony_ci                                    static_cast<uint16_t>(length.GetInt()), module).GetRawData();
15274514f5e3Sopenharmony_ci}
15284514f5e3Sopenharmony_ci
15294514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdSendableClass)
15304514f5e3Sopenharmony_ci{
15314514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdSendableClass);
15324514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> env = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
15334514f5e3Sopenharmony_ci    uint16_t level = static_cast<uint16_t>(GetArg(argv, argc, 1).GetInt());  // 1: means the first parameter
15344514f5e3Sopenharmony_ci    return RuntimeLdSendableClass(env, level).GetRawData();
15354514f5e3Sopenharmony_ci}
15364514f5e3Sopenharmony_ci
15374514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetClassConstructorLength)
15384514f5e3Sopenharmony_ci{
15394514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetClassConstructorLength);
15404514f5e3Sopenharmony_ci    JSTaggedValue ctor = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
15414514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 1);  // 1: means the first parameter
15424514f5e3Sopenharmony_ci    return RuntimeSetClassConstructorLength(thread, ctor, length).GetRawData();
15434514f5e3Sopenharmony_ci}
15444514f5e3Sopenharmony_ci
15454514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(UpdateHotnessCounter)
15464514f5e3Sopenharmony_ci{
15474514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(UpdateHotnessCounter);
15484514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
15494514f5e3Sopenharmony_ci    thread->CheckSafepoint();
15504514f5e3Sopenharmony_ci    JSHandle<Method> method(thread, thisFunc->GetMethod());
15514514f5e3Sopenharmony_ci    auto profileTypeInfo = thisFunc->GetProfileTypeInfo();
15524514f5e3Sopenharmony_ci    if (profileTypeInfo.IsUndefined()) {
15534514f5e3Sopenharmony_ci        uint32_t slotSize = method->GetSlotSize();
15544514f5e3Sopenharmony_ci        auto res = RuntimeNotifyInlineCache(thread, thisFunc, slotSize);
15554514f5e3Sopenharmony_ci        return res.GetRawData();
15564514f5e3Sopenharmony_ci    }
15574514f5e3Sopenharmony_ci    return profileTypeInfo.GetRawData();
15584514f5e3Sopenharmony_ci}
15594514f5e3Sopenharmony_ci
15604514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(PGODump)
15614514f5e3Sopenharmony_ci{
15624514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(PGODump);
15634514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
15644514f5e3Sopenharmony_ci    thread->GetEcmaVM()->GetPGOProfiler()->PGODump(thisFunc.GetTaggedType());
15654514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
15664514f5e3Sopenharmony_ci}
15674514f5e3Sopenharmony_ci
15684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(PGOPreDump)
15694514f5e3Sopenharmony_ci{
15704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(PGOPreDump);
15714514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
15724514f5e3Sopenharmony_ci    thread->GetEcmaVM()->GetPGOProfiler()->PGOPreDump(thisFunc.GetTaggedType());
15734514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
15744514f5e3Sopenharmony_ci}
15754514f5e3Sopenharmony_ci
15764514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(UpdateHotnessCounterWithProf)
15774514f5e3Sopenharmony_ci{
15784514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(UpdateHotnessCounterWithProf);
15794514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
15804514f5e3Sopenharmony_ci    thread->CheckSafepoint();
15814514f5e3Sopenharmony_ci    auto profileTypeInfo = thisFunc->GetProfileTypeInfo();
15824514f5e3Sopenharmony_ci    if (profileTypeInfo.IsUndefined()) {
15834514f5e3Sopenharmony_ci        uint32_t slotSize = thisFunc->GetCallTarget()->GetSlotSize();
15844514f5e3Sopenharmony_ci        auto res = RuntimeNotifyInlineCache(thread, thisFunc, slotSize);
15854514f5e3Sopenharmony_ci        return res.GetRawData();
15864514f5e3Sopenharmony_ci    }
15874514f5e3Sopenharmony_ci    return profileTypeInfo.GetRawData();
15884514f5e3Sopenharmony_ci}
15894514f5e3Sopenharmony_ci
15904514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JitCompile)
15914514f5e3Sopenharmony_ci{
15924514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JitCompile);
15934514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
15944514f5e3Sopenharmony_ci    JSTaggedValue offset = GetArg(argv, argc, 1);  // 1: means the first parameter
15954514f5e3Sopenharmony_ci    Jit::Compile(thread->GetEcmaVM(), thisFunc, CompilerTier::FAST, offset.GetInt(), JitCompileMode::ASYNC);
15964514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
15974514f5e3Sopenharmony_ci}
15984514f5e3Sopenharmony_ci
15994514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(BaselineJitCompile)
16004514f5e3Sopenharmony_ci{
16014514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(BaselineJitCompile);
16024514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
16034514f5e3Sopenharmony_ci    Jit::Compile(thread->GetEcmaVM(), thisFunc, CompilerTier::BASELINE,
16044514f5e3Sopenharmony_ci                 MachineCode::INVALID_OSR_OFFSET, JitCompileMode::ASYNC);
16054514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
16064514f5e3Sopenharmony_ci}
16074514f5e3Sopenharmony_ci
16084514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CountInterpExecFuncs)
16094514f5e3Sopenharmony_ci{
16104514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CountInterpExecFuncs);
16114514f5e3Sopenharmony_ci    JSHandle thisFunc = GetHArg<JSFunction>(argv, argc, 0); // 0: means the zeroth parameter
16124514f5e3Sopenharmony_ci    Jit::CountInterpExecFuncs(thisFunc);
16134514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
16144514f5e3Sopenharmony_ci}
16154514f5e3Sopenharmony_ci
16164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CheckSafePoint)
16174514f5e3Sopenharmony_ci{
16184514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
16194514f5e3Sopenharmony_ci    thread->CheckSafepoint();
16204514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
16214514f5e3Sopenharmony_ci}
16224514f5e3Sopenharmony_ci
16234514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LoadICByName)
16244514f5e3Sopenharmony_ci{
16254514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LoadICByName);
16264514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
16274514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiverHandle = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
16284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
16294514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 3);  // 3: means the third parameter
16304514f5e3Sopenharmony_ci
16314514f5e3Sopenharmony_ci    if (profileHandle->IsUndefined()) {
16324514f5e3Sopenharmony_ci        auto res = JSTaggedValue::GetProperty(thread, receiverHandle, keyHandle).GetValue().GetTaggedValue();
16334514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
16344514f5e3Sopenharmony_ci        return res.GetRawData();
16354514f5e3Sopenharmony_ci    }
16364514f5e3Sopenharmony_ci    LoadICRuntime icRuntime(
16374514f5e3Sopenharmony_ci        thread, JSHandle<ProfileTypeInfo>::Cast(profileHandle), slotId.GetInt(), ICKind::NamedLoadIC);
16384514f5e3Sopenharmony_ci    return icRuntime.LoadMiss(receiverHandle, keyHandle).GetRawData();
16394514f5e3Sopenharmony_ci}
16404514f5e3Sopenharmony_ci
16414514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(TryLdGlobalICByName)
16424514f5e3Sopenharmony_ci{
16434514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(TryLdGlobalICByName);
16444514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
16454514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
16464514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 2);  // 2: means the third parameter
16474514f5e3Sopenharmony_ci
16484514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
16494514f5e3Sopenharmony_ci    JSHandle<GlobalEnv> globalEnv = ecmaVm->GetGlobalEnv();
16504514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> globalObj(thread, globalEnv->GetGlobalObject());
16514514f5e3Sopenharmony_ci    if (profileHandle->IsUndefined()) {
16524514f5e3Sopenharmony_ci        auto res = RuntimeTryLdGlobalByName(thread, globalObj, keyHandle);
16534514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
16544514f5e3Sopenharmony_ci        return res.GetRawData();
16554514f5e3Sopenharmony_ci    }
16564514f5e3Sopenharmony_ci    LoadICRuntime icRuntime(
16574514f5e3Sopenharmony_ci        thread, JSHandle<ProfileTypeInfo>::Cast(profileHandle), slotId.GetInt(), ICKind::NamedGlobalTryLoadIC);
16584514f5e3Sopenharmony_ci    return icRuntime.LoadMiss(globalObj, keyHandle).GetRawData();
16594514f5e3Sopenharmony_ci}
16604514f5e3Sopenharmony_ci
16614514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StoreICByName)
16624514f5e3Sopenharmony_ci{
16634514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StoreICByName);
16644514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileHandle = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
16654514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiverHandle = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
16664514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> keyHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
16674514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> valueHandle = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
16684514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 4);   // 4: means the fourth parameter
16694514f5e3Sopenharmony_ci
16704514f5e3Sopenharmony_ci    if (profileHandle->IsUndefined()) {
16714514f5e3Sopenharmony_ci        JSTaggedValue::SetProperty(thread, receiverHandle, keyHandle, valueHandle, true);
16724514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
16734514f5e3Sopenharmony_ci        return JSTaggedValue::True().GetRawData();
16744514f5e3Sopenharmony_ci    }
16754514f5e3Sopenharmony_ci    StoreICRuntime icRuntime(
16764514f5e3Sopenharmony_ci        thread, JSHandle<ProfileTypeInfo>::Cast(profileHandle), slotId.GetInt(), ICKind::NamedStoreIC);
16774514f5e3Sopenharmony_ci    return icRuntime.StoreMiss(receiverHandle, keyHandle, valueHandle).GetRawData();
16784514f5e3Sopenharmony_ci}
16794514f5e3Sopenharmony_ci
16804514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetFunctionNameNoPrefix)
16814514f5e3Sopenharmony_ci{
16824514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetFunctionNameNoPrefix);
16834514f5e3Sopenharmony_ci    JSTaggedType argFunc = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
16844514f5e3Sopenharmony_ci    JSTaggedValue argName = GetArg(argv, argc, 1);  // 1: means the first parameter
16854514f5e3Sopenharmony_ci    JSFunction::SetFunctionNameNoPrefix(thread, reinterpret_cast<JSFunction *>(argFunc), argName);
16864514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
16874514f5e3Sopenharmony_ci}
16884514f5e3Sopenharmony_ci
16894514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StOwnByValueWithNameSet)
16904514f5e3Sopenharmony_ci{
16914514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StOwnByValueWithNameSet);
16924514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
16934514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
16944514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
16954514f5e3Sopenharmony_ci    return RuntimeStOwnByValueWithNameSet(thread, obj, prop, value).GetRawData();
16964514f5e3Sopenharmony_ci}
16974514f5e3Sopenharmony_ci
16984514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StOwnByName)
16994514f5e3Sopenharmony_ci{
17004514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StOwnByName);
17014514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
17024514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
17034514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
17044514f5e3Sopenharmony_ci    return RuntimeStOwnByName(thread, obj, prop, value).GetRawData();
17054514f5e3Sopenharmony_ci}
17064514f5e3Sopenharmony_ci
17074514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StOwnByNameWithNameSet)
17084514f5e3Sopenharmony_ci{
17094514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StOwnByNameWithNameSet);
17104514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
17114514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
17124514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
17134514f5e3Sopenharmony_ci    return RuntimeStOwnByValueWithNameSet(thread, obj, prop, value).GetRawData();
17144514f5e3Sopenharmony_ci}
17154514f5e3Sopenharmony_ci
17164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SuspendGenerator)
17174514f5e3Sopenharmony_ci{
17184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SuspendGenerator);
17194514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
17204514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
17214514f5e3Sopenharmony_ci    return RuntimeSuspendGenerator(thread, obj, value).GetRawData();
17224514f5e3Sopenharmony_ci}
17234514f5e3Sopenharmony_ci
17244514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptSuspendGenerator)
17254514f5e3Sopenharmony_ci{
17264514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptSuspendGenerator);
17274514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
17284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
17294514f5e3Sopenharmony_ci    return RuntimeOptSuspendGenerator(thread, obj, value).GetRawData();
17304514f5e3Sopenharmony_ci}
17314514f5e3Sopenharmony_ci
17324514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptAsyncGeneratorResolve)
17334514f5e3Sopenharmony_ci{
17344514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptAsyncGeneratorResolve);
17354514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> asyncGenerator = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
17364514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
17374514f5e3Sopenharmony_ci    JSTaggedValue flag = GetArg(argv, argc, 2); // 2: means the second parameter
17384514f5e3Sopenharmony_ci    return RuntimeOptAsyncGeneratorResolve(thread, asyncGenerator, value, flag).GetRawData();
17394514f5e3Sopenharmony_ci}
17404514f5e3Sopenharmony_ci
17414514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptCreateObjectWithExcludedKeys)
17424514f5e3Sopenharmony_ci{
17434514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptCreateObjectWithExcludedKeys);
17444514f5e3Sopenharmony_ci    return RuntimeOptCreateObjectWithExcludedKeys(thread, argv, argc).GetRawData();
17454514f5e3Sopenharmony_ci}
17464514f5e3Sopenharmony_ci
17474514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(UpFrame)
17484514f5e3Sopenharmony_ci{
17494514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(UpFrame);
17504514f5e3Sopenharmony_ci    FrameHandler frameHandler(thread);
17514514f5e3Sopenharmony_ci    uint32_t pcOffset = panda_file::INVALID_OFFSET;
17524514f5e3Sopenharmony_ci    for (; frameHandler.HasFrame(); frameHandler.PrevJSFrame()) {
17534514f5e3Sopenharmony_ci        if (frameHandler.IsEntryFrame() || frameHandler.IsBuiltinFrame()) {
17544514f5e3Sopenharmony_ci            thread->SetCurrentFrame(frameHandler.GetSp());
17554514f5e3Sopenharmony_ci            thread->SetLastFp(frameHandler.GetFp());
17564514f5e3Sopenharmony_ci            return JSTaggedValue(static_cast<uint64_t>(0)).GetRawData();
17574514f5e3Sopenharmony_ci        }
17584514f5e3Sopenharmony_ci        auto method = frameHandler.GetMethod();
17594514f5e3Sopenharmony_ci        uint32_t curBytecodePcOfst = INVALID_INDEX;
17604514f5e3Sopenharmony_ci        if (reinterpret_cast<uintptr_t>(frameHandler.GetPc()) == std::numeric_limits<uintptr_t>::max()) {
17614514f5e3Sopenharmony_ci            // For baselineJit
17624514f5e3Sopenharmony_ci            uintptr_t curNativePc = frameHandler.GetBaselineNativePc();
17634514f5e3Sopenharmony_ci            ASSERT(curNativePc != 0);
17644514f5e3Sopenharmony_ci            LOG_BASELINEJIT(DEBUG) << "current native pc in UpFrame: " << std::hex <<
17654514f5e3Sopenharmony_ci                reinterpret_cast<void*>(curNativePc);
17664514f5e3Sopenharmony_ci            JSHandle<JSTaggedValue> funcVal = JSHandle<JSTaggedValue>(thread, frameHandler.GetFunction());
17674514f5e3Sopenharmony_ci            JSHandle<JSFunction> func = JSHandle<JSFunction>::Cast(funcVal);
17684514f5e3Sopenharmony_ci            curBytecodePcOfst = RuntimeGetBytecodePcOfstForBaseline(func, curNativePc);
17694514f5e3Sopenharmony_ci        } else {
17704514f5e3Sopenharmony_ci            curBytecodePcOfst = frameHandler.GetBytecodeOffset();
17714514f5e3Sopenharmony_ci        }
17724514f5e3Sopenharmony_ci        pcOffset = method->FindCatchBlock(curBytecodePcOfst);
17734514f5e3Sopenharmony_ci        if (pcOffset != INVALID_INDEX) {
17744514f5e3Sopenharmony_ci            thread->SetCurrentFrame(frameHandler.GetSp());
17754514f5e3Sopenharmony_ci            thread->SetLastFp(frameHandler.GetFp());
17764514f5e3Sopenharmony_ci            uintptr_t pc = reinterpret_cast<uintptr_t>(method->GetBytecodeArray() + pcOffset);
17774514f5e3Sopenharmony_ci            return JSTaggedValue(static_cast<uint64_t>(pc)).GetRawData();
17784514f5e3Sopenharmony_ci        }
17794514f5e3Sopenharmony_ci        if (!method->IsNativeWithCallField()) {
17804514f5e3Sopenharmony_ci            auto *debuggerMgr = thread->GetEcmaVM()->GetJsDebuggerManager();
17814514f5e3Sopenharmony_ci            debuggerMgr->GetNotificationManager()->MethodExitEvent(thread, method);
17824514f5e3Sopenharmony_ci        }
17834514f5e3Sopenharmony_ci    }
17844514f5e3Sopenharmony_ci    LOG_FULL(FATAL) << "EXCEPTION: EntryFrame Not Found";
17854514f5e3Sopenharmony_ci    UNREACHABLE();
17864514f5e3Sopenharmony_ci}
17874514f5e3Sopenharmony_ci
17884514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetModuleNamespaceByIndex)
17894514f5e3Sopenharmony_ci{
17904514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetModuleNamespaceByIndex);
17914514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
17924514f5e3Sopenharmony_ci    return RuntimeGetModuleNamespace(thread, index.GetInt()).GetRawData();
17934514f5e3Sopenharmony_ci}
17944514f5e3Sopenharmony_ci
17954514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetModuleNamespaceByIndexOnJSFunc)
17964514f5e3Sopenharmony_ci{
17974514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetModuleNamespaceByIndexOnJSFunc);
17984514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);
17994514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 1);
18004514f5e3Sopenharmony_ci    return RuntimeGetModuleNamespace(thread, index.GetInt(), jsFunc).GetRawData();
18014514f5e3Sopenharmony_ci}
18024514f5e3Sopenharmony_ci
18034514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetModuleNamespace)
18044514f5e3Sopenharmony_ci{
18054514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetModuleNamespace);
18064514f5e3Sopenharmony_ci    JSTaggedValue localName = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18074514f5e3Sopenharmony_ci    return RuntimeGetModuleNamespace(thread, localName).GetRawData();
18084514f5e3Sopenharmony_ci}
18094514f5e3Sopenharmony_ci
18104514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StModuleVarByIndex)
18114514f5e3Sopenharmony_ci{
18124514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StModuleVar);
18134514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18144514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 1);  // 1: means the first parameter
18154514f5e3Sopenharmony_ci    RuntimeStModuleVar(thread, index.GetInt(), value);
18164514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
18174514f5e3Sopenharmony_ci}
18184514f5e3Sopenharmony_ci
18194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StModuleVarByIndexOnJSFunc)
18204514f5e3Sopenharmony_ci{
18214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StModuleVarByIndexOnJSFunc);
18224514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);
18234514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 1);
18244514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 2);
18254514f5e3Sopenharmony_ci    RuntimeStModuleVar(thread, index.GetInt(), value, jsFunc);
18264514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
18274514f5e3Sopenharmony_ci}
18284514f5e3Sopenharmony_ci
18294514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StModuleVar)
18304514f5e3Sopenharmony_ci{
18314514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StModuleVar);
18324514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18334514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 1);  // 1: means the first parameter
18344514f5e3Sopenharmony_ci    RuntimeStModuleVar(thread, key, value);
18354514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
18364514f5e3Sopenharmony_ci}
18374514f5e3Sopenharmony_ci
18384514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdLocalModuleVarByIndex)
18394514f5e3Sopenharmony_ci{
18404514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdLocalModuleVarByIndex);
18414514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18424514f5e3Sopenharmony_ci    return RuntimeLdLocalModuleVar(thread, index.GetInt()).GetRawData();
18434514f5e3Sopenharmony_ci}
18444514f5e3Sopenharmony_ci
18454514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdLocalModuleVarByIndexWithModule)
18464514f5e3Sopenharmony_ci{
18474514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdLocalModuleVarByIndexWithModule);
18484514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18494514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
18504514f5e3Sopenharmony_ci    return RuntimeLdLocalModuleVarWithModule(thread, index.GetInt(), module).GetRawData();
18514514f5e3Sopenharmony_ci}
18524514f5e3Sopenharmony_ci
18534514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdExternalModuleVarByIndex)
18544514f5e3Sopenharmony_ci{
18554514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdExternalModuleVarByIndex);
18564514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18574514f5e3Sopenharmony_ci    return RuntimeLdExternalModuleVar(thread, index.GetInt()).GetRawData();
18584514f5e3Sopenharmony_ci}
18594514f5e3Sopenharmony_ci
18604514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdExternalModuleVarByIndexWithModule)
18614514f5e3Sopenharmony_ci{
18624514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdExternalModuleVarByIndexWithModule);
18634514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18644514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
18654514f5e3Sopenharmony_ci    return RuntimeLdExternalModuleVarWithModule(thread, index.GetInt(), module).GetRawData();
18664514f5e3Sopenharmony_ci}
18674514f5e3Sopenharmony_ci
18684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdSendableExternalModuleVarByIndex)
18694514f5e3Sopenharmony_ci{
18704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdSendableExternalModuleVarByIndex);
18714514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18724514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 1); // 1: means the first parameter
18734514f5e3Sopenharmony_ci    return RuntimeLdSendableExternalModuleVar(thread, index.GetInt(), jsFunc).GetRawData();
18744514f5e3Sopenharmony_ci}
18754514f5e3Sopenharmony_ci
18764514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdLazyExternalModuleVarByIndex)
18774514f5e3Sopenharmony_ci{
18784514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdLazyExternalModuleVarByIndex);
18794514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18804514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 1); // 1: means the first parameter
18814514f5e3Sopenharmony_ci    return RuntimeLdLazyExternalModuleVar(thread, index.GetInt(), jsFunc).GetRawData();
18824514f5e3Sopenharmony_ci}
18834514f5e3Sopenharmony_ci
18844514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdLazySendableExternalModuleVarByIndex)
18854514f5e3Sopenharmony_ci{
18864514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdLazySendableExternalModuleVarByIndex);
18874514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
18884514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 1); // 1: means the first parameter
18894514f5e3Sopenharmony_ci    return RuntimeLdLazySendableExternalModuleVar(thread, index.GetInt(), jsFunc).GetRawData();
18904514f5e3Sopenharmony_ci}
18914514f5e3Sopenharmony_ci
18924514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdLocalModuleVarByIndexOnJSFunc)
18934514f5e3Sopenharmony_ci{
18944514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdLocalModuleVarByIndexOnJSFunc);
18954514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);
18964514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 1);
18974514f5e3Sopenharmony_ci    return RuntimeLdLocalModuleVar(thread, index.GetInt(), jsFunc).GetRawData();
18984514f5e3Sopenharmony_ci}
18994514f5e3Sopenharmony_ci
19004514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdExternalModuleVarByIndexOnJSFunc)
19014514f5e3Sopenharmony_ci{
19024514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdExternalModuleVarByIndexOnJSFunc);
19034514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);
19044514f5e3Sopenharmony_ci    JSTaggedValue jsFunc = GetArg(argv, argc, 1);
19054514f5e3Sopenharmony_ci    return RuntimeLdExternalModuleVar(thread, index.GetInt(), jsFunc).GetRawData();
19064514f5e3Sopenharmony_ci}
19074514f5e3Sopenharmony_ci
19084514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdModuleVar)
19094514f5e3Sopenharmony_ci{
19104514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdModuleVar);
19114514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
19124514f5e3Sopenharmony_ci    JSTaggedValue taggedFlag = GetArg(argv, argc, 1);  // 1: means the first parameter
19134514f5e3Sopenharmony_ci    bool innerFlag = taggedFlag.GetInt() != 0;
19144514f5e3Sopenharmony_ci    return RuntimeLdModuleVar(thread, key, innerFlag).GetRawData();
19154514f5e3Sopenharmony_ci}
19164514f5e3Sopenharmony_ci
19174514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetPropIterator)
19184514f5e3Sopenharmony_ci{
19194514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetPropIterator);
19204514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
19214514f5e3Sopenharmony_ci    return RuntimeGetPropIterator(thread, value).GetRawData();
19224514f5e3Sopenharmony_ci}
19234514f5e3Sopenharmony_ci
19244514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetPropIteratorSlowpath)
19254514f5e3Sopenharmony_ci{
19264514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetPropIteratorSlowpath);
19274514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
19284514f5e3Sopenharmony_ci    return JSObject::LoadEnumerateProperties(thread, value).GetTaggedValue().GetRawData();
19294514f5e3Sopenharmony_ci}
19304514f5e3Sopenharmony_ci
19314514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(PrimitiveStringCreate)
19324514f5e3Sopenharmony_ci{
19334514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(PrimitiveStringCreate);
19344514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> str = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
19354514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget = thread->GlobalConstants()->GetHandledUndefined();
19364514f5e3Sopenharmony_ci    return JSPrimitiveRef::StringCreate(thread, str, newTarget).GetTaggedValue().GetRawData();
19374514f5e3Sopenharmony_ci}
19384514f5e3Sopenharmony_ci
19394514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AsyncFunctionEnter)
19404514f5e3Sopenharmony_ci{
19414514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AsyncFunctionEnter);
19424514f5e3Sopenharmony_ci    return RuntimeAsyncFunctionEnter(thread).GetRawData();
19434514f5e3Sopenharmony_ci}
19444514f5e3Sopenharmony_ci
19454514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetIterator)
19464514f5e3Sopenharmony_ci{
19474514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetIterator);
19484514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
19494514f5e3Sopenharmony_ci    return RuntimeGetIterator(thread, obj).GetRawData();
19504514f5e3Sopenharmony_ci}
19514514f5e3Sopenharmony_ci
19524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetAsyncIterator)
19534514f5e3Sopenharmony_ci{
19544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetAsyncIterator);
19554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
19564514f5e3Sopenharmony_ci    return RuntimeGetAsyncIterator(thread, obj).GetRawData();
19574514f5e3Sopenharmony_ci}
19584514f5e3Sopenharmony_ci
19594514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdPrivateProperty)
19604514f5e3Sopenharmony_ci{
19614514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdPrivateProperty);
19624514f5e3Sopenharmony_ci    JSTaggedValue lexicalEnv = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
19634514f5e3Sopenharmony_ci    uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt());  // 1: means the first parameter
19644514f5e3Sopenharmony_ci    uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt());  // 2: means the second parameter
19654514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 3);  // 3: means the third parameter
19664514f5e3Sopenharmony_ci    return RuntimeLdPrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj).GetRawData();
19674514f5e3Sopenharmony_ci}
19684514f5e3Sopenharmony_ci
19694514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StPrivateProperty)
19704514f5e3Sopenharmony_ci{
19714514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StPrivateProperty);
19724514f5e3Sopenharmony_ci    JSTaggedValue lexicalEnv = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
19734514f5e3Sopenharmony_ci    uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt());  // 1: means the first parameter
19744514f5e3Sopenharmony_ci    uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt());  // 2: means the second parameter
19754514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 3);  // 3: means the third parameter
19764514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 4);  // 4: means the fourth parameter
19774514f5e3Sopenharmony_ci    return RuntimeStPrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj, value).GetRawData();
19784514f5e3Sopenharmony_ci}
19794514f5e3Sopenharmony_ci
19804514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(TestIn)
19814514f5e3Sopenharmony_ci{
19824514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(TestIn);
19834514f5e3Sopenharmony_ci    JSTaggedValue lexicalEnv = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
19844514f5e3Sopenharmony_ci    uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt());  // 1: means the first parameter
19854514f5e3Sopenharmony_ci    uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt());  // 2: means the second parameter
19864514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 3);  // 3: means the third parameter
19874514f5e3Sopenharmony_ci    return RuntimeTestIn(thread, lexicalEnv, levelIndex, slotIndex, obj).GetRawData();
19884514f5e3Sopenharmony_ci}
19894514f5e3Sopenharmony_ci
19904514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Throw)
19914514f5e3Sopenharmony_ci{
19924514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Throw);
19934514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
19944514f5e3Sopenharmony_ci    RuntimeThrow(thread, value);
19954514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
19964514f5e3Sopenharmony_ci}
19974514f5e3Sopenharmony_ci
19984514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowThrowNotExists)
19994514f5e3Sopenharmony_ci{
20004514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowThrowNotExists);
20014514f5e3Sopenharmony_ci    RuntimeThrowThrowNotExists(thread);
20024514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
20034514f5e3Sopenharmony_ci}
20044514f5e3Sopenharmony_ci
20054514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowPatternNonCoercible)
20064514f5e3Sopenharmony_ci{
20074514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowPatternNonCoercible);
20084514f5e3Sopenharmony_ci    RuntimeThrowPatternNonCoercible(thread);
20094514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
20104514f5e3Sopenharmony_ci}
20114514f5e3Sopenharmony_ci
20124514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowDeleteSuperProperty)
20134514f5e3Sopenharmony_ci{
20144514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowDeleteSuperProperty);
20154514f5e3Sopenharmony_ci    RuntimeThrowDeleteSuperProperty(thread);
20164514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
20174514f5e3Sopenharmony_ci}
20184514f5e3Sopenharmony_ci
20194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowUndefinedIfHole)
20204514f5e3Sopenharmony_ci{
20214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowUndefinedIfHole);
20224514f5e3Sopenharmony_ci    JSHandle<EcmaString> obj = GetHArg<EcmaString>(argv, argc, 0);  // 0: means the zeroth parameter
20234514f5e3Sopenharmony_ci    RuntimeThrowUndefinedIfHole(thread, obj);
20244514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
20254514f5e3Sopenharmony_ci}
20264514f5e3Sopenharmony_ci
20274514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowIfNotObject)
20284514f5e3Sopenharmony_ci{
20294514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowIfNotObject);
20304514f5e3Sopenharmony_ci    RuntimeThrowIfNotObject(thread);
20314514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
20324514f5e3Sopenharmony_ci}
20334514f5e3Sopenharmony_ci
20344514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowConstAssignment)
20354514f5e3Sopenharmony_ci{
20364514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowConstAssignment);
20374514f5e3Sopenharmony_ci    JSHandle<EcmaString> value = GetHArg<EcmaString>(argv, argc, 0);  // 0: means the zeroth parameter
20384514f5e3Sopenharmony_ci    RuntimeThrowConstAssignment(thread, value);
20394514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
20404514f5e3Sopenharmony_ci}
20414514f5e3Sopenharmony_ci
20424514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowTypeError)
20434514f5e3Sopenharmony_ci{
20444514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowTypeError);
20454514f5e3Sopenharmony_ci    JSTaggedValue argMessageStringId = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
20464514f5e3Sopenharmony_ci    std::string message = MessageString::GetMessageString(argMessageStringId.GetInt());
20474514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
20484514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, message.c_str(), StackCheck::NO);
20494514f5e3Sopenharmony_ci    THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), JSTaggedValue::Hole().GetRawData());
20504514f5e3Sopenharmony_ci}
20514514f5e3Sopenharmony_ci
20524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(MismatchError)
20534514f5e3Sopenharmony_ci{
20544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(MismatchError);
20554514f5e3Sopenharmony_ci    JSTaggedValue shareFieldType = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
20564514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 1);  // 1: means the first parameter
20574514f5e3Sopenharmony_ci    std::stringstream oss;
20584514f5e3Sopenharmony_ci    value.DumpTaggedValueType(oss);
20594514f5e3Sopenharmony_ci    LOG_ECMA(ERROR) << "Sendable obj Match field type fail. expected type: " <<
20604514f5e3Sopenharmony_ci        ClassHelper::StaticFieldTypeToString(shareFieldType.GetInt()) << ", actual type: " << oss.str();
20614514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
20624514f5e3Sopenharmony_ci}
20634514f5e3Sopenharmony_ci
20644514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewJSPrimitiveRef)
20654514f5e3Sopenharmony_ci{
20664514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewJSPrimitiveRef);
20674514f5e3Sopenharmony_ci    JSHandle<JSFunction> thisFunc = GetHArg<JSFunction>(argv, argc, 0); // 0: means the zeroth parameter
20684514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue> (argv, argc, 1);
20694514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
20704514f5e3Sopenharmony_ci    return factory->NewJSPrimitiveRef(thisFunc, obj).GetTaggedValue().GetRawData();
20714514f5e3Sopenharmony_ci}
20724514f5e3Sopenharmony_ci
20734514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowRangeError)
20744514f5e3Sopenharmony_ci{
20754514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowRangeError);
20764514f5e3Sopenharmony_ci    JSTaggedValue argMessageStringId = GetArg(argv, argc, 0);
20774514f5e3Sopenharmony_ci    std::string message = MessageString::GetMessageString(argMessageStringId.GetInt());
20784514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
20794514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::RANGE_ERROR, message.c_str(), StackCheck::NO);
20804514f5e3Sopenharmony_ci    THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), JSTaggedValue::Hole().GetRawData());
20814514f5e3Sopenharmony_ci}
20824514f5e3Sopenharmony_ci
20834514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LoadMiss)
20844514f5e3Sopenharmony_ci{
20854514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LoadMiss);
20864514f5e3Sopenharmony_ci    JSTaggedType profileTypeInfo = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
20874514f5e3Sopenharmony_ci    JSTaggedValue receiver = GetArg(argv, argc, 1);  // 1: means the first parameter
20884514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 2);  // 2: means the second parameter
20894514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 3);  // 3: means the third parameter
20904514f5e3Sopenharmony_ci    JSTaggedValue kind = GetArg(argv, argc, 4);   // 4: means the fourth parameter
20914514f5e3Sopenharmony_ci    return ICRuntimeStub::LoadMiss(thread, reinterpret_cast<ProfileTypeInfo *>(profileTypeInfo), receiver, key,
20924514f5e3Sopenharmony_ci        slotId.GetInt(), static_cast<ICKind>(kind.GetInt())).GetRawData();
20934514f5e3Sopenharmony_ci}
20944514f5e3Sopenharmony_ci
20954514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StoreMiss)
20964514f5e3Sopenharmony_ci{
20974514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StoreMiss);
20984514f5e3Sopenharmony_ci    JSTaggedType profileTypeInfo = GetTArg(argv, argc, 0);  // 0: means the zeroth parameter
20994514f5e3Sopenharmony_ci    JSTaggedValue receiver = GetArg(argv, argc, 1);  // 1: means the first parameter
21004514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 2);  // 2: means the second parameter
21014514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 3);  // 3: means the third parameter
21024514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 4);  // 4: means the fourth parameter
21034514f5e3Sopenharmony_ci    JSTaggedValue kind = GetArg(argv, argc, 5);  // 5: means the fifth parameter
21044514f5e3Sopenharmony_ci    return ICRuntimeStub::StoreMiss(thread, reinterpret_cast<ProfileTypeInfo *>(profileTypeInfo), receiver, key, value,
21054514f5e3Sopenharmony_ci        slotId.GetInt(), static_cast<ICKind>(kind.GetInt())).GetRawData();
21064514f5e3Sopenharmony_ci}
21074514f5e3Sopenharmony_ci
21084514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(TryUpdateGlobalRecord)
21094514f5e3Sopenharmony_ci{
21104514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(TryUpdateGlobalRecord);
21114514f5e3Sopenharmony_ci    JSTaggedValue prop = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
21124514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 1);  // 1: means the first parameter
21134514f5e3Sopenharmony_ci    return RuntimeTryUpdateGlobalRecord(thread, prop, value).GetRawData();
21144514f5e3Sopenharmony_ci}
21154514f5e3Sopenharmony_ci
21164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowReferenceError)
21174514f5e3Sopenharmony_ci{
21184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowReferenceError);
21194514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
21204514f5e3Sopenharmony_ci    return RuntimeThrowReferenceError(thread, prop, " is not defined").GetRawData();
21214514f5e3Sopenharmony_ci}
21224514f5e3Sopenharmony_ci
21234514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdGlobalICVar)
21244514f5e3Sopenharmony_ci{
21254514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdGlobalICVar);
21264514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> global = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
21274514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
21284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> profileHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
21294514f5e3Sopenharmony_ci    JSTaggedValue slotId = GetArg(argv, argc, 3);  // 3: means the third parameter
21304514f5e3Sopenharmony_ci
21314514f5e3Sopenharmony_ci    if (profileHandle->IsUndefined()) {
21324514f5e3Sopenharmony_ci        return RuntimeLdGlobalVarFromProto(thread, global, prop).GetRawData();
21334514f5e3Sopenharmony_ci    }
21344514f5e3Sopenharmony_ci    LoadICRuntime icRuntime(
21354514f5e3Sopenharmony_ci        thread, JSHandle<ProfileTypeInfo>::Cast(profileHandle), slotId.GetInt(), ICKind::NamedGlobalLoadIC);
21364514f5e3Sopenharmony_ci    return icRuntime.LoadMiss(global, prop).GetRawData();
21374514f5e3Sopenharmony_ci}
21384514f5e3Sopenharmony_ci
21394514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StGlobalVar)
21404514f5e3Sopenharmony_ci{
21414514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StGlobalVar);
21424514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
21434514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
21444514f5e3Sopenharmony_ci    return RuntimeStGlobalVar(thread, prop, value).GetRawData();
21454514f5e3Sopenharmony_ci}
21464514f5e3Sopenharmony_ci
21474514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToIndex)
21484514f5e3Sopenharmony_ci{
21494514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToIndex);
21504514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
21514514f5e3Sopenharmony_ci    return JSTaggedValue::ToIndex(thread, value).GetRawData();
21524514f5e3Sopenharmony_ci}
21534514f5e3Sopenharmony_ci
21544514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewJSObjectByConstructor)
21554514f5e3Sopenharmony_ci{
21564514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewJSObjectByConstructor);
21574514f5e3Sopenharmony_ci    JSHandle<JSFunction> constructor = GetHArg<JSFunction>(argv, argc, 0);      // 0: means the zeroth parameter
21584514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
21594514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
21604514f5e3Sopenharmony_ci    JSHandle<JSObject> obj = factory->NewJSObjectByConstructor(constructor, newTarget);
21614514f5e3Sopenharmony_ci    return obj.GetTaggedValue().GetRawData();
21624514f5e3Sopenharmony_ci}
21634514f5e3Sopenharmony_ci
21644514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CloneHclass)
21654514f5e3Sopenharmony_ci{
21664514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CloneHclass);
21674514f5e3Sopenharmony_ci    JSHandle<JSHClass> objHclass = GetHArg<JSHClass>(argv, argc, 0);      // 0: means the zeroth parameter
21684514f5e3Sopenharmony_ci    return JSHClass::Clone(thread, objHclass).GetTaggedValue().GetRawData();
21694514f5e3Sopenharmony_ci}
21704514f5e3Sopenharmony_ci
21714514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AllocateTypedArrayBuffer)
21724514f5e3Sopenharmony_ci{
21734514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AllocateTypedArrayBuffer);
21744514f5e3Sopenharmony_ci    JSHandle<JSObject> obj = GetHArg<JSObject>(argv, argc, 0);    // 0: means the zeroth parameter
21754514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 1);  // 1: means the first parameter
21764514f5e3Sopenharmony_ci    return base::TypedArrayHelper::AllocateTypedArrayBuffer(thread, obj, length.GetNumber(),
21774514f5e3Sopenharmony_ci        base::TypedArrayHelper::GetType(JSHandle<JSTypedArray>(obj))).GetTaggedValue().GetRawData();
21784514f5e3Sopenharmony_ci}
21794514f5e3Sopenharmony_ci
21804514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToNumber)
21814514f5e3Sopenharmony_ci{
21824514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToNumber);
21834514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
21844514f5e3Sopenharmony_ci    return RuntimeToNumber(thread, value).GetRawData();
21854514f5e3Sopenharmony_ci}
21864514f5e3Sopenharmony_ci
21874514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToBoolean)
21884514f5e3Sopenharmony_ci{
21894514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToBoolean);
21904514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
21914514f5e3Sopenharmony_ci    bool result = value.ToBoolean();
21924514f5e3Sopenharmony_ci    return JSTaggedValue(result).GetRawData();
21934514f5e3Sopenharmony_ci}
21944514f5e3Sopenharmony_ci
21954514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Eq)
21964514f5e3Sopenharmony_ci{
21974514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Eq);
21984514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
21994514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22004514f5e3Sopenharmony_ci    return RuntimeEq(thread, left, right).GetRawData();
22014514f5e3Sopenharmony_ci}
22024514f5e3Sopenharmony_ci
22034514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NotEq)
22044514f5e3Sopenharmony_ci{
22054514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NotEq);
22064514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22074514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22084514f5e3Sopenharmony_ci    return RuntimeNotEq(thread, left, right).GetRawData();
22094514f5e3Sopenharmony_ci}
22104514f5e3Sopenharmony_ci
22114514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Less)
22124514f5e3Sopenharmony_ci{
22134514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Less);
22144514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22154514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22164514f5e3Sopenharmony_ci    return RuntimeLess(thread, left, right).GetRawData();
22174514f5e3Sopenharmony_ci}
22184514f5e3Sopenharmony_ci
22194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LessEq)
22204514f5e3Sopenharmony_ci{
22214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LessEq);
22224514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22234514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22244514f5e3Sopenharmony_ci    return RuntimeLessEq(thread, left, right).GetRawData();
22254514f5e3Sopenharmony_ci}
22264514f5e3Sopenharmony_ci
22274514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Greater)
22284514f5e3Sopenharmony_ci{
22294514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Greater);
22304514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22314514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22324514f5e3Sopenharmony_ci    return RuntimeGreater(thread, left, right).GetRawData();
22334514f5e3Sopenharmony_ci}
22344514f5e3Sopenharmony_ci
22354514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GreaterEq)
22364514f5e3Sopenharmony_ci{
22374514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GreaterEq);
22384514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22394514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22404514f5e3Sopenharmony_ci    return RuntimeGreaterEq(thread, left, right).GetRawData();
22414514f5e3Sopenharmony_ci}
22424514f5e3Sopenharmony_ci
22434514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Add2)
22444514f5e3Sopenharmony_ci{
22454514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Add2);
22464514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22474514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22484514f5e3Sopenharmony_ci    JSTaggedValue res = RuntimeAdd2(thread, left, right);
22494514f5e3Sopenharmony_ci    return res.GetRawData();
22504514f5e3Sopenharmony_ci}
22514514f5e3Sopenharmony_ci
22524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Sub2)
22534514f5e3Sopenharmony_ci{
22544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Sub2);
22554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22564514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22574514f5e3Sopenharmony_ci    return RuntimeSub2(thread, left, right).GetRawData();
22584514f5e3Sopenharmony_ci}
22594514f5e3Sopenharmony_ci
22604514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Mul2)
22614514f5e3Sopenharmony_ci{
22624514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Mul2);
22634514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22644514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22654514f5e3Sopenharmony_ci    return RuntimeMul2(thread, left, right).GetRawData();
22664514f5e3Sopenharmony_ci}
22674514f5e3Sopenharmony_ci
22684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Div2)
22694514f5e3Sopenharmony_ci{
22704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Div2);
22714514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22724514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22734514f5e3Sopenharmony_ci    return RuntimeDiv2(thread, left, right).GetRawData();
22744514f5e3Sopenharmony_ci}
22754514f5e3Sopenharmony_ci
22764514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(Mod2)
22774514f5e3Sopenharmony_ci{
22784514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(Mod2);
22794514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> left = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
22804514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> right = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
22814514f5e3Sopenharmony_ci    return RuntimeMod2(thread, left, right).GetRawData();
22824514f5e3Sopenharmony_ci}
22834514f5e3Sopenharmony_ci
22844514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JumpToCInterpreter)
22854514f5e3Sopenharmony_ci{
22864514f5e3Sopenharmony_ci#ifndef EXCLUDE_C_INTERPRETER
22874514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JumpToCInterpreter);
22884514f5e3Sopenharmony_ci    JSTaggedValue constpool = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
22894514f5e3Sopenharmony_ci    JSTaggedValue profileTypeInfo = GetArg(argv, argc, 1);  // 1: means the first parameter
22904514f5e3Sopenharmony_ci    JSTaggedValue acc = GetArg(argv, argc, 2);  // 2: means the second parameter
22914514f5e3Sopenharmony_ci    JSTaggedValue hotnessCounter = GetArg(argv, argc, 3);  // 3: means the third parameter
22924514f5e3Sopenharmony_ci
22934514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType *>(thread->GetCurrentInterpretedFrame());
22944514f5e3Sopenharmony_ci    const uint8_t *currentPc = reinterpret_cast<const uint8_t*>(GET_ASM_FRAME(sp)->pc);
22954514f5e3Sopenharmony_ci
22964514f5e3Sopenharmony_ci    uint8_t opcode = currentPc[0];
22974514f5e3Sopenharmony_ci    asmDispatchTable[opcode](thread, currentPc, sp, constpool, profileTypeInfo, acc, hotnessCounter.GetInt());
22984514f5e3Sopenharmony_ci    sp = const_cast<JSTaggedType *>(thread->GetCurrentInterpretedFrame());
22994514f5e3Sopenharmony_ci    return JSTaggedValue(reinterpret_cast<uint64_t>(sp)).GetRawData();
23004514f5e3Sopenharmony_ci#else
23014514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
23024514f5e3Sopenharmony_ci#endif
23034514f5e3Sopenharmony_ci}
23044514f5e3Sopenharmony_ci
23054514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NotifyBytecodePcChanged)
23064514f5e3Sopenharmony_ci{
23074514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NotifyBytecodePcChanged);
23084514f5e3Sopenharmony_ci    FrameHandler frameHandler(thread);
23094514f5e3Sopenharmony_ci    for (; frameHandler.HasFrame(); frameHandler.PrevJSFrame()) {
23104514f5e3Sopenharmony_ci        if (frameHandler.IsEntryFrame() || frameHandler.IsBuiltinFrame()) {
23114514f5e3Sopenharmony_ci            continue;
23124514f5e3Sopenharmony_ci        }
23134514f5e3Sopenharmony_ci        Method *method = frameHandler.GetMethod();
23144514f5e3Sopenharmony_ci        // Skip builtins method
23154514f5e3Sopenharmony_ci        if (method->IsNativeWithCallField()) {
23164514f5e3Sopenharmony_ci            continue;
23174514f5e3Sopenharmony_ci        }
23184514f5e3Sopenharmony_ci        auto bcOffset = frameHandler.GetBytecodeOffset();
23194514f5e3Sopenharmony_ci        auto *debuggerMgr = thread->GetEcmaVM()->GetJsDebuggerManager();
23204514f5e3Sopenharmony_ci        debuggerMgr->GetNotificationManager()->BytecodePcChangedEvent(thread, method, bcOffset);
23214514f5e3Sopenharmony_ci        return JSTaggedValue::Hole().GetRawData();
23224514f5e3Sopenharmony_ci    }
23234514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
23244514f5e3Sopenharmony_ci}
23254514f5e3Sopenharmony_ci
23264514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NotifyDebuggerStatement)
23274514f5e3Sopenharmony_ci{
23284514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NotifyDebuggerStatement);
23294514f5e3Sopenharmony_ci    return RuntimeNotifyDebuggerStatement(thread).GetRawData();
23304514f5e3Sopenharmony_ci}
23314514f5e3Sopenharmony_ci
23324514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(MethodEntry)
23334514f5e3Sopenharmony_ci{
23344514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(MethodEntry);
23354514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
23364514f5e3Sopenharmony_ci    if (func.GetTaggedValue().IsECMAObject()) {
23374514f5e3Sopenharmony_ci        Method *method = ECMAObject::Cast(func.GetTaggedValue().GetTaggedObject())->GetCallTarget();
23384514f5e3Sopenharmony_ci        if (method->IsNativeWithCallField()) {
23394514f5e3Sopenharmony_ci            return JSTaggedValue::Hole().GetRawData();
23404514f5e3Sopenharmony_ci        }
23414514f5e3Sopenharmony_ci        JSHandle<JSFunction> funcObj = JSHandle<JSFunction>::Cast(func);
23424514f5e3Sopenharmony_ci        FrameHandler frameHandler(thread);
23434514f5e3Sopenharmony_ci        for (; frameHandler.HasFrame(); frameHandler.PrevJSFrame()) {
23444514f5e3Sopenharmony_ci            if (frameHandler.IsEntryFrame() || frameHandler.IsBuiltinFrame()) {
23454514f5e3Sopenharmony_ci                continue;
23464514f5e3Sopenharmony_ci            }
23474514f5e3Sopenharmony_ci            auto *debuggerMgr = thread->GetEcmaVM()->GetJsDebuggerManager();
23484514f5e3Sopenharmony_ci            debuggerMgr->GetNotificationManager()->MethodEntryEvent(thread, method, funcObj->GetLexicalEnv());
23494514f5e3Sopenharmony_ci            return JSTaggedValue::Hole().GetRawData();
23504514f5e3Sopenharmony_ci        }
23514514f5e3Sopenharmony_ci    }
23524514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
23534514f5e3Sopenharmony_ci}
23544514f5e3Sopenharmony_ci
23554514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(MethodExit)
23564514f5e3Sopenharmony_ci{
23574514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(MethodExit);
23584514f5e3Sopenharmony_ci    FrameHandler frameHandler(thread);
23594514f5e3Sopenharmony_ci    for (; frameHandler.HasFrame(); frameHandler.PrevJSFrame()) {
23604514f5e3Sopenharmony_ci        if (frameHandler.IsEntryFrame() || frameHandler.IsBuiltinFrame()) {
23614514f5e3Sopenharmony_ci            continue;
23624514f5e3Sopenharmony_ci        }
23634514f5e3Sopenharmony_ci        Method *method = frameHandler.GetMethod();
23644514f5e3Sopenharmony_ci        // Skip builtins method
23654514f5e3Sopenharmony_ci        if (method->IsNativeWithCallField()) {
23664514f5e3Sopenharmony_ci            continue;
23674514f5e3Sopenharmony_ci        }
23684514f5e3Sopenharmony_ci        auto *debuggerMgr = thread->GetEcmaVM()->GetJsDebuggerManager();
23694514f5e3Sopenharmony_ci        debuggerMgr->GetNotificationManager()->MethodExitEvent(thread, method);
23704514f5e3Sopenharmony_ci        return JSTaggedValue::Hole().GetRawData();
23714514f5e3Sopenharmony_ci    }
23724514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
23734514f5e3Sopenharmony_ci}
23744514f5e3Sopenharmony_ci
23754514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateEmptyObject)
23764514f5e3Sopenharmony_ci{
23774514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateEmptyObject);
23784514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
23794514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
23804514f5e3Sopenharmony_ci    JSHandle<GlobalEnv> globalEnv = ecmaVm->GetGlobalEnv();
23814514f5e3Sopenharmony_ci    return RuntimeCreateEmptyObject(thread, factory, globalEnv).GetRawData();
23824514f5e3Sopenharmony_ci}
23834514f5e3Sopenharmony_ci
23844514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateEmptyArray)
23854514f5e3Sopenharmony_ci{
23864514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateEmptyArray);
23874514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
23884514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
23894514f5e3Sopenharmony_ci    JSHandle<GlobalEnv> globalEnv = ecmaVm->GetGlobalEnv();
23904514f5e3Sopenharmony_ci    return RuntimeCreateEmptyArray(thread, factory, globalEnv).GetRawData();
23914514f5e3Sopenharmony_ci}
23924514f5e3Sopenharmony_ci
23934514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetSymbolFunction)
23944514f5e3Sopenharmony_ci{
23954514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetSymbolFunction);
23964514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
23974514f5e3Sopenharmony_ci    JSHandle<GlobalEnv> globalEnv = ecmaVm->GetGlobalEnv();
23984514f5e3Sopenharmony_ci    return globalEnv->GetSymbolFunction().GetTaggedValue().GetRawData();
23994514f5e3Sopenharmony_ci}
24004514f5e3Sopenharmony_ci
24014514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetUnmapedArgs)
24024514f5e3Sopenharmony_ci{
24034514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetUnmapedArgs);
24044514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType*>(thread->GetCurrentInterpretedFrame());
24054514f5e3Sopenharmony_ci    uint32_t startIdx = 0;
24064514f5e3Sopenharmony_ci    // 0: means restIdx
24074514f5e3Sopenharmony_ci    uint32_t actualNumArgs = InterpreterAssembly::GetNumArgs(sp, 0, startIdx);
24084514f5e3Sopenharmony_ci    return RuntimeGetUnmapedArgs(thread, sp, actualNumArgs, startIdx).GetRawData();
24094514f5e3Sopenharmony_ci}
24104514f5e3Sopenharmony_ci
24114514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CopyRestArgs)
24124514f5e3Sopenharmony_ci{
24134514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CopyRestArgs);
24144514f5e3Sopenharmony_ci    JSTaggedValue restIdx = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
24154514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType*>(thread->GetCurrentInterpretedFrame());
24164514f5e3Sopenharmony_ci    uint32_t startIdx = 0;
24174514f5e3Sopenharmony_ci    uint32_t restNumArgs = InterpreterAssembly::GetNumArgs(sp, restIdx.GetInt(), startIdx);
24184514f5e3Sopenharmony_ci    return RuntimeCopyRestArgs(thread, sp, restNumArgs, startIdx).GetRawData();
24194514f5e3Sopenharmony_ci}
24204514f5e3Sopenharmony_ci
24214514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateArrayWithBuffer)
24224514f5e3Sopenharmony_ci{
24234514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateArrayWithBuffer);
24244514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> argArray = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
24254514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
24264514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
24274514f5e3Sopenharmony_ci    return RuntimeCreateArrayWithBuffer(thread, factory, argArray).GetRawData();
24284514f5e3Sopenharmony_ci}
24294514f5e3Sopenharmony_ci
24304514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateObjectWithBuffer)
24314514f5e3Sopenharmony_ci{
24324514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateObjectWithBuffer);
24334514f5e3Sopenharmony_ci    JSHandle<JSObject> argObj = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
24344514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
24354514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
24364514f5e3Sopenharmony_ci    return RuntimeCreateObjectWithBuffer(thread, factory, argObj).GetRawData();
24374514f5e3Sopenharmony_ci}
24384514f5e3Sopenharmony_ci
24394514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewThisObject)
24404514f5e3Sopenharmony_ci{
24414514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewThisObject);
24424514f5e3Sopenharmony_ci    JSHandle<JSFunction> ctor(GetHArg<JSTaggedValue>(argv, argc, 0));  // 0: means the zeroth parameter
24434514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget(GetHArg<JSTaggedValue>(argv, argc, 1));  // 1: means the first parameter
24444514f5e3Sopenharmony_ci
24454514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
24464514f5e3Sopenharmony_ci    JSHandle<JSObject> obj;
24474514f5e3Sopenharmony_ci    if (newTarget->IsUndefined()) {
24484514f5e3Sopenharmony_ci        obj = factory->NewJSObjectByConstructor(ctor);
24494514f5e3Sopenharmony_ci    } else {
24504514f5e3Sopenharmony_ci        obj = factory->NewJSObjectByConstructor(ctor, newTarget);
24514514f5e3Sopenharmony_ci    }
24524514f5e3Sopenharmony_ci    if (obj.GetTaggedValue().IsJSShared()) {
24534514f5e3Sopenharmony_ci        obj->GetJSHClass()->SetExtensible(false);
24544514f5e3Sopenharmony_ci    }
24554514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
24564514f5e3Sopenharmony_ci    return obj.GetTaggedType();  // state is not set here
24574514f5e3Sopenharmony_ci}
24584514f5e3Sopenharmony_ci
24594514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewObjRange)
24604514f5e3Sopenharmony_ci{
24614514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewObjRange);
24624514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
24634514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
24644514f5e3Sopenharmony_ci    JSTaggedValue firstArgIdx = GetArg(argv, argc, 2);  // 2: means the second parameter
24654514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 3);  // 3: means the third parameter
24664514f5e3Sopenharmony_ci    return RuntimeNewObjRange(thread, func, newTarget, static_cast<uint16_t>(firstArgIdx.GetInt()),
24674514f5e3Sopenharmony_ci        static_cast<uint16_t>(length.GetInt())).GetRawData();
24684514f5e3Sopenharmony_ci}
24694514f5e3Sopenharmony_ci
24704514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DefineFunc)
24714514f5e3Sopenharmony_ci{
24724514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DefineFunc);
24734514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> constpool = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
24744514f5e3Sopenharmony_ci    JSTaggedValue methodId = GetArg(argv, argc, 1);  // 1: means the first parameter
24754514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
24764514f5e3Sopenharmony_ci    uint16_t length = static_cast<uint16_t>(GetArg(argv, argc, 3).GetInt()); // 3: means the third parameter
24774514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> env = GetHArg<JSTaggedValue>(argv, argc, 4); // 4: means the fourth parameter
24784514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> homeObject = GetHArg<JSTaggedValue>(argv, argc, 5); // 5: means the fifth parameter
24794514f5e3Sopenharmony_ci    return RuntimeDefinefunc(thread, constpool, static_cast<uint16_t>(methodId.GetInt()), module,
24804514f5e3Sopenharmony_ci        length, env, homeObject).GetRawData();
24814514f5e3Sopenharmony_ci}
24824514f5e3Sopenharmony_ci
24834514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateRegExpWithLiteral)
24844514f5e3Sopenharmony_ci{
24854514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateRegExpWithLiteral);
24864514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> pattern = GetHArg<JSTaggedValue>(argv, argc, 0);
24874514f5e3Sopenharmony_ci    JSTaggedValue flags = GetArg(argv, argc, 1);
24884514f5e3Sopenharmony_ci    return RuntimeCreateRegExpWithLiteral(thread, pattern, static_cast<uint8_t>(flags.GetInt())).GetRawData();
24894514f5e3Sopenharmony_ci}
24904514f5e3Sopenharmony_ci
24914514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowIfSuperNotCorrectCall)
24924514f5e3Sopenharmony_ci{
24934514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowIfSuperNotCorrectCall);
24944514f5e3Sopenharmony_ci    JSTaggedValue index = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
24954514f5e3Sopenharmony_ci    JSTaggedValue thisValue = GetArg(argv, argc, 1);  // 1: means the first parameter
24964514f5e3Sopenharmony_ci    return RuntimeThrowIfSuperNotCorrectCall(thread, static_cast<uint16_t>(index.GetInt()), thisValue).GetRawData();
24974514f5e3Sopenharmony_ci}
24984514f5e3Sopenharmony_ci
24994514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateObjectHavingMethod)
25004514f5e3Sopenharmony_ci{
25014514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateObjectHavingMethod);
25024514f5e3Sopenharmony_ci    JSHandle<JSObject> literal = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
25034514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> env = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
25044514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
25054514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
25064514f5e3Sopenharmony_ci    return RuntimeCreateObjectHavingMethod(thread, factory, literal, env).GetRawData();
25074514f5e3Sopenharmony_ci}
25084514f5e3Sopenharmony_ci
25094514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreateObjectWithExcludedKeys)
25104514f5e3Sopenharmony_ci{
25114514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreateObjectWithExcludedKeys);
25124514f5e3Sopenharmony_ci    JSTaggedValue numKeys = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
25134514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> objVal = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
25144514f5e3Sopenharmony_ci    JSTaggedValue firstArgRegIdx = GetArg(argv, argc, 2);  // 2: means the second parameter
25154514f5e3Sopenharmony_ci    return RuntimeCreateObjectWithExcludedKeys(thread, static_cast<uint16_t>(numKeys.GetInt()), objVal,
25164514f5e3Sopenharmony_ci        static_cast<uint16_t>(firstArgRegIdx.GetInt())).GetRawData();
25174514f5e3Sopenharmony_ci}
25184514f5e3Sopenharmony_ci
25194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DefineMethod)
25204514f5e3Sopenharmony_ci{
25214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DefineMethod);
25224514f5e3Sopenharmony_ci    JSHandle<Method> method = GetHArg<Method>(argv, argc, 0);  // 0: means the zeroth parameter
25234514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> homeObject = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
25244514f5e3Sopenharmony_ci    uint16_t length = static_cast<uint16_t>(GetArg(argv, argc, 2).GetInt()); // 2: means the second parameter
25254514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> env = GetHArg<JSTaggedValue>(argv, argc, 3); // 3: means the third parameter
25264514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 4); // 4: means the fourth parameter
25274514f5e3Sopenharmony_ci    auto res = RuntimeDefineMethod(thread, method, homeObject, length, env, module);
25284514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_IC
25294514f5e3Sopenharmony_ci    const uint32_t INDEX_OF_SLOT_ID = 5; // 5: index of slotId in argv
25304514f5e3Sopenharmony_ci    if (argc > INDEX_OF_SLOT_ID) {
25314514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
25324514f5e3Sopenharmony_ci        uint16_t slotId = static_cast<uint16_t>(GetArg(argv, argc, INDEX_OF_SLOT_ID).GetInt());
25334514f5e3Sopenharmony_ci        const uint32_t INDEX_OF_JS_FUNC = 6;  // 6: index of jsFunc in argv
25344514f5e3Sopenharmony_ci        ASSERT(argc > INDEX_OF_JS_FUNC);
25354514f5e3Sopenharmony_ci        JSHandle<JSFunction> jsFuncHandle = GetHArg<JSFunction>(argv, argc, INDEX_OF_JS_FUNC);
25364514f5e3Sopenharmony_ci        JSHandle<JSFunction> resHandle(thread, res);
25374514f5e3Sopenharmony_ci        SetProfileTypeInfoCellToFunction(thread, jsFuncHandle, resHandle, slotId);
25384514f5e3Sopenharmony_ci        res = resHandle.GetTaggedValue();
25394514f5e3Sopenharmony_ci    }
25404514f5e3Sopenharmony_ci#endif
25414514f5e3Sopenharmony_ci    return res.GetRawData();
25424514f5e3Sopenharmony_ci}
25434514f5e3Sopenharmony_ci
25444514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetPatchModule)
25454514f5e3Sopenharmony_ci{
25464514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetPatchModule);
25474514f5e3Sopenharmony_ci    JSHandle<JSFunction> func = GetHArg<JSFunction>(argv, argc, 0);  // 0: means the zeroth parameter
25484514f5e3Sopenharmony_ci    RuntimeSetPatchModule(thread, func);
25494514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
25504514f5e3Sopenharmony_ci}
25514514f5e3Sopenharmony_ci
25524514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallSpread)
25534514f5e3Sopenharmony_ci{
25544514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallSpread);
25554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
25564514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
25574514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> array = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
25584514f5e3Sopenharmony_ci    return RuntimeCallSpread(thread, func, obj, array).GetRawData();
25594514f5e3Sopenharmony_ci}
25604514f5e3Sopenharmony_ci
25614514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DefineGetterSetterByValue)
25624514f5e3Sopenharmony_ci{
25634514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DefineGetterSetterByValue);
25644514f5e3Sopenharmony_ci    JSHandle<JSObject> obj = GetHArg<JSObject>(argv, argc, 0);  // 0: means the zeroth parameter
25654514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> prop = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
25664514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> getter = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
25674514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> setter = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
25684514f5e3Sopenharmony_ci    JSTaggedValue flag = GetArg(argv, argc, 4);  // 4: means the fourth parameter
25694514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 5);  // 5: means the sixth parameter
25704514f5e3Sopenharmony_ci    int32_t pcOffset = GetArg(argv, argc, 6).GetInt();  // 6: means the seventh parameter
25714514f5e3Sopenharmony_ci    bool bFlag = flag.ToBoolean();
25724514f5e3Sopenharmony_ci    return RuntimeDefineGetterSetterByValue(thread, obj, prop, getter, setter, bFlag, func, pcOffset).GetRawData();
25734514f5e3Sopenharmony_ci}
25744514f5e3Sopenharmony_ci
25754514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SuperCall)
25764514f5e3Sopenharmony_ci{
25774514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SuperCall);
25784514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
25794514f5e3Sopenharmony_ci    JSTaggedValue firstVRegIdx = GetArg(argv, argc, 1);  // 1: means the first parameter
25804514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 2);  // 2: means the second parameter
25814514f5e3Sopenharmony_ci    auto sp = const_cast<JSTaggedType*>(thread->GetCurrentInterpretedFrame());
25824514f5e3Sopenharmony_ci    JSTaggedValue newTarget = InterpreterAssembly::GetNewTarget(sp);
25834514f5e3Sopenharmony_ci    return RuntimeSuperCall(thread, func, JSHandle<JSTaggedValue>(thread, newTarget),
25844514f5e3Sopenharmony_ci        static_cast<uint16_t>(firstVRegIdx.GetInt()),
25854514f5e3Sopenharmony_ci        static_cast<uint16_t>(length.GetInt())).GetRawData();
25864514f5e3Sopenharmony_ci}
25874514f5e3Sopenharmony_ci
25884514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptSuperCall)
25894514f5e3Sopenharmony_ci{
25904514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptSuperCall);
25914514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
25924514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> newTarget = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
25934514f5e3Sopenharmony_ci    JSHandle<TaggedArray> taggedArray(thread, GetArg(argv, argc, 2));  // 2: means the second parameter
25944514f5e3Sopenharmony_ci    JSTaggedValue length = GetArg(argv, argc, 3);  // 3: means the third parameter
25954514f5e3Sopenharmony_ci    return RuntimeOptSuperCall(thread, func, newTarget, taggedArray,
25964514f5e3Sopenharmony_ci                               static_cast<uint16_t>(length.GetInt())).GetRawData();
25974514f5e3Sopenharmony_ci}
25984514f5e3Sopenharmony_ci
25994514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowNotCallableException)
26004514f5e3Sopenharmony_ci{
26014514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowNotCallableException);
26024514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
26034514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
26044514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR, "is not callable", StackCheck::NO);
26054514f5e3Sopenharmony_ci    thread->SetException(error.GetTaggedValue());
26064514f5e3Sopenharmony_ci    return JSTaggedValue::Exception().GetRawData();
26074514f5e3Sopenharmony_ci}
26084514f5e3Sopenharmony_ci
26094514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowSetterIsUndefinedException)
26104514f5e3Sopenharmony_ci{
26114514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowSetterIsUndefinedException);
26124514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
26134514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
26144514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
26154514f5e3Sopenharmony_ci        "Cannot set property when setter is undefined", StackCheck::NO);
26164514f5e3Sopenharmony_ci    thread->SetException(error.GetTaggedValue());
26174514f5e3Sopenharmony_ci    return JSTaggedValue::Exception().GetRawData();
26184514f5e3Sopenharmony_ci}
26194514f5e3Sopenharmony_ci
26204514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowCallConstructorException)
26214514f5e3Sopenharmony_ci{
26224514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowCallConstructorException);
26234514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
26244514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
26254514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
26264514f5e3Sopenharmony_ci                                                   "class constructor cannot called without 'new'", StackCheck::NO);
26274514f5e3Sopenharmony_ci    thread->SetException(error.GetTaggedValue());
26284514f5e3Sopenharmony_ci    return JSTaggedValue::Exception().GetRawData();
26294514f5e3Sopenharmony_ci}
26304514f5e3Sopenharmony_ci
26314514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowNonConstructorException)
26324514f5e3Sopenharmony_ci{
26334514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowNonConstructorException);
26344514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
26354514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
26364514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
26374514f5e3Sopenharmony_ci                                                   "function is non-constructor", StackCheck::NO);
26384514f5e3Sopenharmony_ci    thread->SetException(error.GetTaggedValue());
26394514f5e3Sopenharmony_ci    return JSTaggedValue::Exception().GetRawData();
26404514f5e3Sopenharmony_ci}
26414514f5e3Sopenharmony_ci
26424514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowStackOverflowException)
26434514f5e3Sopenharmony_ci{
26444514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowStackOverflowException);
26454514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
26464514f5e3Sopenharmony_ci    // Multi-thread could cause stack-overflow-check failed too,
26474514f5e3Sopenharmony_ci    // so check thread here to distinguish it with the actual stack overflow.
26484514f5e3Sopenharmony_ci    ecmaVm->CheckThread();
26494514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
26504514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::RANGE_ERROR, "Stack overflow!", StackCheck::NO);
26514514f5e3Sopenharmony_ci    if (LIKELY(!thread->HasPendingException())) {
26524514f5e3Sopenharmony_ci        thread->SetException(error.GetTaggedValue());
26534514f5e3Sopenharmony_ci    }
26544514f5e3Sopenharmony_ci    return JSTaggedValue::Exception().GetRawData();
26554514f5e3Sopenharmony_ci}
26564514f5e3Sopenharmony_ci
26574514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ThrowDerivedMustReturnException)
26584514f5e3Sopenharmony_ci{
26594514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ThrowDerivedMustReturnException);
26604514f5e3Sopenharmony_ci    EcmaVM *ecmaVm = thread->GetEcmaVM();
26614514f5e3Sopenharmony_ci    ObjectFactory *factory = ecmaVm->GetFactory();
26624514f5e3Sopenharmony_ci    JSHandle<JSObject> error = factory->GetJSError(ErrorType::TYPE_ERROR,
26634514f5e3Sopenharmony_ci        "Derived constructor must return object or undefined", StackCheck::NO);
26644514f5e3Sopenharmony_ci    thread->SetException(error.GetTaggedValue());
26654514f5e3Sopenharmony_ci    return JSTaggedValue::Exception().GetRawData();
26664514f5e3Sopenharmony_ci}
26674514f5e3Sopenharmony_ci
26684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdBigInt)
26694514f5e3Sopenharmony_ci{
26704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdBigInt);
26714514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> numberBigInt = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
26724514f5e3Sopenharmony_ci    return RuntimeLdBigInt(thread, numberBigInt).GetRawData();
26734514f5e3Sopenharmony_ci}
26744514f5e3Sopenharmony_ci
26754514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallBigIntAsIntN)
26764514f5e3Sopenharmony_ci{
26774514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallBigIntAsIntN);
26784514f5e3Sopenharmony_ci    JSTaggedValue bits = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
26794514f5e3Sopenharmony_ci    JSTaggedValue bigint = GetArg(argv, argc, 1);  // 1: means the first parameter
26804514f5e3Sopenharmony_ci    return RuntimeCallBigIntAsIntN(thread, bits, bigint).GetRawData();
26814514f5e3Sopenharmony_ci}
26824514f5e3Sopenharmony_ci
26834514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CallBigIntAsUintN)
26844514f5e3Sopenharmony_ci{
26854514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CallBigIntAsUintN);
26864514f5e3Sopenharmony_ci    JSTaggedValue bits = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
26874514f5e3Sopenharmony_ci    JSTaggedValue bigint = GetArg(argv, argc, 1);  // 1: means the first parameter
26884514f5e3Sopenharmony_ci    return RuntimeCallBigIntAsUintN(thread, bits, bigint).GetRawData();
26894514f5e3Sopenharmony_ci}
26904514f5e3Sopenharmony_ci
26914514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToNumeric)
26924514f5e3Sopenharmony_ci{
26934514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToNumeric);
26944514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
26954514f5e3Sopenharmony_ci    return RuntimeToNumeric(thread, value).GetRawData();
26964514f5e3Sopenharmony_ci}
26974514f5e3Sopenharmony_ci
26984514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ToNumericConvertBigInt)
26994514f5e3Sopenharmony_ci{
27004514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ToNumericConvertBigInt);
27014514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
27024514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> numericVal(thread, RuntimeToNumeric(thread, value));
27034514f5e3Sopenharmony_ci    if (numericVal->IsBigInt()) {
27044514f5e3Sopenharmony_ci        JSHandle<BigInt> bigNumericVal(numericVal);
27054514f5e3Sopenharmony_ci        return BigInt::BigIntToNumber(bigNumericVal).GetRawData();
27064514f5e3Sopenharmony_ci    }
27074514f5e3Sopenharmony_ci    return numericVal->GetRawData();
27084514f5e3Sopenharmony_ci}
27094514f5e3Sopenharmony_ci
27104514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DynamicImport)
27114514f5e3Sopenharmony_ci{
27124514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DynamicImport);
27134514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> specifier = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
27144514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> currentFunc = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the zeroth parameter
27154514f5e3Sopenharmony_ci    return RuntimeDynamicImport(thread, specifier, currentFunc).GetRawData();
27164514f5e3Sopenharmony_ci}
27174514f5e3Sopenharmony_ci
27184514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewLexicalEnvWithName)
27194514f5e3Sopenharmony_ci{
27204514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewLexicalEnvWithName);
27214514f5e3Sopenharmony_ci    JSTaggedValue numVars = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27224514f5e3Sopenharmony_ci    JSTaggedValue scopeId = GetArg(argv, argc, 1);  // 1: means the first parameter
27234514f5e3Sopenharmony_ci    return RuntimeNewLexicalEnvWithName(thread,
27244514f5e3Sopenharmony_ci        static_cast<uint16_t>(numVars.GetInt()),
27254514f5e3Sopenharmony_ci        static_cast<uint16_t>(scopeId.GetInt())).GetRawData();
27264514f5e3Sopenharmony_ci}
27274514f5e3Sopenharmony_ci
27284514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NewSendableEnv)
27294514f5e3Sopenharmony_ci{
27304514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NewSendableEnv);
27314514f5e3Sopenharmony_ci    JSTaggedValue numVars = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27324514f5e3Sopenharmony_ci    return RuntimeNewSendableEnv(thread, static_cast<uint16_t>(numVars.GetInt())).GetRawData();
27334514f5e3Sopenharmony_ci}
27344514f5e3Sopenharmony_ci
27354514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptGetUnmapedArgs)
27364514f5e3Sopenharmony_ci{
27374514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptGetUnmapedArgs);
27384514f5e3Sopenharmony_ci    JSTaggedValue actualNumArgs = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27394514f5e3Sopenharmony_ci    return RuntimeOptGetUnmapedArgs(thread, actualNumArgs.GetInt()).GetRawData();
27404514f5e3Sopenharmony_ci}
27414514f5e3Sopenharmony_ci
27424514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptNewLexicalEnvWithName)
27434514f5e3Sopenharmony_ci{
27444514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptNewLexicalEnvWithName);
27454514f5e3Sopenharmony_ci    JSTaggedValue taggedNumVars = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27464514f5e3Sopenharmony_ci    JSTaggedValue taggedScopeId = GetArg(argv, argc, 1);  // 1: means the first parameter
27474514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> currentLexEnv = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
27484514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
27494514f5e3Sopenharmony_ci    uint16_t numVars = static_cast<uint16_t>(taggedNumVars.GetInt());
27504514f5e3Sopenharmony_ci    uint16_t scopeId = static_cast<uint16_t>(taggedScopeId.GetInt());
27514514f5e3Sopenharmony_ci    return RuntimeOptNewLexicalEnvWithName(thread, numVars, scopeId, currentLexEnv, func).GetRawData();
27524514f5e3Sopenharmony_ci}
27534514f5e3Sopenharmony_ci
27544514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptCopyRestArgs)
27554514f5e3Sopenharmony_ci{
27564514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptCopyRestArgs);
27574514f5e3Sopenharmony_ci    JSTaggedValue actualArgc = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27584514f5e3Sopenharmony_ci    JSTaggedValue restIndex = GetArg(argv, argc, 1);  // 1: means the first parameter
27594514f5e3Sopenharmony_ci    return RuntimeOptCopyRestArgs(thread, actualArgc.GetInt(), restIndex.GetInt()).GetRawData();
27604514f5e3Sopenharmony_ci}
27614514f5e3Sopenharmony_ci
27624514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(OptNewObjRange)
27634514f5e3Sopenharmony_ci{
27644514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(OptNewObjRange);
27654514f5e3Sopenharmony_ci    return RuntimeOptNewObjRange(thread, argv, argc).GetRawData();
27664514f5e3Sopenharmony_ci}
27674514f5e3Sopenharmony_ci
27684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetTypeArrayPropertyByIndex)
27694514f5e3Sopenharmony_ci{
27704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetTypeArrayPropertyByIndex);
27714514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27724514f5e3Sopenharmony_ci    JSTaggedValue idx = GetArg(argv, argc, 1);  // 1: means the first parameter
27734514f5e3Sopenharmony_ci    JSTaggedValue jsType = GetArg(argv, argc, 2); // 2: means the second parameter
27744514f5e3Sopenharmony_ci    return JSTypedArray::FastGetPropertyByIndex(thread, obj, idx.GetInt(), JSType(jsType.GetInt())).GetRawData();
27754514f5e3Sopenharmony_ci}
27764514f5e3Sopenharmony_ci
27774514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetTypeArrayPropertyByIndex)
27784514f5e3Sopenharmony_ci{
27794514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetTypeArrayPropertyByIndex);
27804514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
27814514f5e3Sopenharmony_ci    JSTaggedValue idx = GetArg(argv, argc, 1);  // 1: means the first parameter
27824514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 2);  // 2: means the second parameter
27834514f5e3Sopenharmony_ci    JSTaggedValue jsType = GetArg(argv, argc, 3); // 3: means the third parameter
27844514f5e3Sopenharmony_ci    return JSTypedArray::FastSetPropertyByIndex(thread, obj, idx.GetInt(), value, JSType(jsType.GetInt())).GetRawData();
27854514f5e3Sopenharmony_ci}
27864514f5e3Sopenharmony_ci
27874514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(FastCopyElementToArray)
27884514f5e3Sopenharmony_ci{
27894514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(FastCopyElementToArray);
27904514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> typedArray = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
27914514f5e3Sopenharmony_ci    JSHandle<TaggedArray> array = GetHArg<TaggedArray>(argv, argc, 1);  // 1: means the first parameter
27924514f5e3Sopenharmony_ci    return JSTaggedValue(JSTypedArray::FastCopyElementToArray(thread, typedArray, array)).GetRawData();
27934514f5e3Sopenharmony_ci}
27944514f5e3Sopenharmony_ci
27954514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetPropertyByName)
27964514f5e3Sopenharmony_ci{
27974514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetPropertyByName);
27984514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
27994514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
28004514f5e3Sopenharmony_ci    return JSTaggedValue::GetProperty(thread, target, key).GetValue()->GetRawData();
28014514f5e3Sopenharmony_ci}
28024514f5e3Sopenharmony_ci
28034514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DebugAOTPrint)
28044514f5e3Sopenharmony_ci{
28054514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DebugAOTPrint);
28064514f5e3Sopenharmony_ci    int ecmaOpcode = GetArg(argv, argc, 0).GetInt();
28074514f5e3Sopenharmony_ci    int path = GetArg(argv, argc, 1).GetInt();
28084514f5e3Sopenharmony_ci    std::string pathStr = path == 0 ? "slow path  " : "TYPED path ";
28094514f5e3Sopenharmony_ci
28104514f5e3Sopenharmony_ci    std::string data = JsStackInfo::BuildJsStackTrace(thread, true);
28114514f5e3Sopenharmony_ci    std::string opcode = kungfu::GetEcmaOpcodeStr(static_cast<EcmaOpcode>(ecmaOpcode));
28124514f5e3Sopenharmony_ci    LOG_ECMA(INFO) << "AOT " << pathStr << ": " << opcode << "@ " << data;
28134514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
28144514f5e3Sopenharmony_ci}
28154514f5e3Sopenharmony_ci
28164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ProfileOptimizedCode)
28174514f5e3Sopenharmony_ci{
28184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ProfileOptimizedCode);
28194514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func = GetHArg<JSTaggedValue>(argv, argc, 0);
28204514f5e3Sopenharmony_ci    int bcIndex = GetArg(argv, argc, 1).GetInt();
28214514f5e3Sopenharmony_ci    EcmaOpcode ecmaOpcode = static_cast<EcmaOpcode>(GetArg(argv, argc, 2).GetInt());
28224514f5e3Sopenharmony_ci    OptCodeProfiler::Mode mode = static_cast<OptCodeProfiler::Mode>(GetArg(argv, argc, 3).GetInt());
28234514f5e3Sopenharmony_ci    OptCodeProfiler *profiler = thread->GetCurrentEcmaContext()->GetOptCodeProfiler();
28244514f5e3Sopenharmony_ci    profiler->Update(func, bcIndex, ecmaOpcode, mode);
28254514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
28264514f5e3Sopenharmony_ci}
28274514f5e3Sopenharmony_ci
28284514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ProfileTypedOp)
28294514f5e3Sopenharmony_ci{
28304514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ProfileOptimizedCode);
28314514f5e3Sopenharmony_ci    kungfu::OpCode opcode = static_cast<kungfu::OpCode>(GetArg(argv, argc, 0).GetInt());
28324514f5e3Sopenharmony_ci    TypedOpProfiler *profiler = thread->GetCurrentEcmaContext()->GetTypdOpProfiler();
28334514f5e3Sopenharmony_ci    if (profiler != nullptr) {
28344514f5e3Sopenharmony_ci        profiler->Update(opcode);
28354514f5e3Sopenharmony_ci    }
28364514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
28374514f5e3Sopenharmony_ci}
28384514f5e3Sopenharmony_ci
28394514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(VerifyVTableLoading)
28404514f5e3Sopenharmony_ci{
28414514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(VerifyVTableLoading);
28424514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 0);        // 0: means the zeroth parameter
28434514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);             // 1: means the first parameter
28444514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> typedPathValue = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
28454514f5e3Sopenharmony_ci
28464514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> verifiedPathValue = JSTaggedValue::GetProperty(thread, receiver, key).GetValue();
28474514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
28484514f5e3Sopenharmony_ci    if (UNLIKELY(!JSTaggedValue::SameValue(typedPathValue, verifiedPathValue))) {
28494514f5e3Sopenharmony_ci        std::ostringstream oss;
28504514f5e3Sopenharmony_ci        receiver->Dump(oss);
28514514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Load Failed, receiver: " << oss.str();
28524514f5e3Sopenharmony_ci        oss.str("");
28534514f5e3Sopenharmony_ci
28544514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Load Failed, key: "
28554514f5e3Sopenharmony_ci                        << EcmaStringAccessor(key.GetTaggedValue()).ToStdString();
28564514f5e3Sopenharmony_ci
28574514f5e3Sopenharmony_ci        typedPathValue->Dump(oss);
28584514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Load Failed, typed path value: " << oss.str();
28594514f5e3Sopenharmony_ci        oss.str("");
28604514f5e3Sopenharmony_ci
28614514f5e3Sopenharmony_ci        verifiedPathValue->Dump(oss);
28624514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Load Failed, verified path value: " << oss.str();
28634514f5e3Sopenharmony_ci    }
28644514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
28654514f5e3Sopenharmony_ci}
28664514f5e3Sopenharmony_ci
28674514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(VerifyVTableStoring)
28684514f5e3Sopenharmony_ci{
28694514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(VerifyVTableStoring);
28704514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 0);    // 0: means the zeroth parameter
28714514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);         // 1: means the first parameter
28724514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> storeValue = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
28734514f5e3Sopenharmony_ci
28744514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> verifiedValue = JSTaggedValue::GetProperty(thread, receiver, key).GetValue();
28754514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
28764514f5e3Sopenharmony_ci    if (UNLIKELY(!JSTaggedValue::SameValue(storeValue, verifiedValue))) {
28774514f5e3Sopenharmony_ci        std::ostringstream oss;
28784514f5e3Sopenharmony_ci        receiver->Dump(oss);
28794514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Store Failed, receiver: " << oss.str();
28804514f5e3Sopenharmony_ci        oss.str("");
28814514f5e3Sopenharmony_ci
28824514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Store Failed, key: "
28834514f5e3Sopenharmony_ci                        << EcmaStringAccessor(key.GetTaggedValue()).ToStdString();
28844514f5e3Sopenharmony_ci
28854514f5e3Sopenharmony_ci        storeValue->Dump(oss);
28864514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Store Failed, typed path store value: " << oss.str();
28874514f5e3Sopenharmony_ci        oss.str("");
28884514f5e3Sopenharmony_ci
28894514f5e3Sopenharmony_ci        verifiedValue->Dump(oss);
28904514f5e3Sopenharmony_ci        LOG_ECMA(ERROR) << "Verify VTable Store Failed, verified path load value: " << oss.str();
28914514f5e3Sopenharmony_ci    }
28924514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
28934514f5e3Sopenharmony_ci}
28944514f5e3Sopenharmony_ci
28954514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(JSObjectGetMethod)
28964514f5e3Sopenharmony_ci{
28974514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(JSObjectGetMethod);
28984514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj(thread, GetArg(argv, argc, 0));
28994514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key(thread, GetArg(argv, argc, 1));
29004514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> result = JSObject::GetMethod(thread, obj, key);
29014514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
29024514f5e3Sopenharmony_ci    return result->GetRawData();
29034514f5e3Sopenharmony_ci}
29044514f5e3Sopenharmony_ci
29054514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(BigIntEqual)
29064514f5e3Sopenharmony_ci{
29074514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(BigIntEqual);
29084514f5e3Sopenharmony_ci    JSTaggedValue left = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29094514f5e3Sopenharmony_ci    JSTaggedValue right = GetArg(argv, argc, 1);  // 1: means the first parameter
29104514f5e3Sopenharmony_ci    if (BigInt::Equal(left, right)) {
29114514f5e3Sopenharmony_ci        return JSTaggedValue::VALUE_TRUE;
29124514f5e3Sopenharmony_ci    }
29134514f5e3Sopenharmony_ci    return JSTaggedValue::VALUE_FALSE;
29144514f5e3Sopenharmony_ci}
29154514f5e3Sopenharmony_ci
29164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StringEqual)
29174514f5e3Sopenharmony_ci{
29184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StringEqual);
29194514f5e3Sopenharmony_ci    JSHandle<EcmaString> left = GetHArg<EcmaString>(argv, argc, 0);
29204514f5e3Sopenharmony_ci    JSHandle<EcmaString> right = GetHArg<EcmaString>(argv, argc, 1);
29214514f5e3Sopenharmony_ci    EcmaVM *vm = thread->GetEcmaVM();
29224514f5e3Sopenharmony_ci    left = JSHandle<EcmaString>(thread, EcmaStringAccessor::Flatten(vm, left));
29234514f5e3Sopenharmony_ci    right = JSHandle<EcmaString>(thread, EcmaStringAccessor::Flatten(vm, right));
29244514f5e3Sopenharmony_ci    if (EcmaStringAccessor::StringsAreEqualDiffUtfEncoding(*left, *right)) {
29254514f5e3Sopenharmony_ci        return JSTaggedValue::VALUE_TRUE;
29264514f5e3Sopenharmony_ci    }
29274514f5e3Sopenharmony_ci    return JSTaggedValue::VALUE_FALSE;
29284514f5e3Sopenharmony_ci}
29294514f5e3Sopenharmony_ci
29304514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StringIndexOf)
29314514f5e3Sopenharmony_ci{
29324514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StringIndexOf);
29334514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
29344514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> searchElement = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
29354514f5e3Sopenharmony_ci    uint32_t from = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt());  // 2: means the second parameter
29364514f5e3Sopenharmony_ci    uint32_t len = static_cast<uint32_t>(GetArg(argv, argc, 3).GetInt());  // 3: means the third parameter
29374514f5e3Sopenharmony_ci
29384514f5e3Sopenharmony_ci    return JSStableArray::IndexOf(thread, receiver, searchElement, from, len).GetRawData();
29394514f5e3Sopenharmony_ci}
29404514f5e3Sopenharmony_ci
29414514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LdPatchVar)
29424514f5e3Sopenharmony_ci{
29434514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LdPatchVar);
29444514f5e3Sopenharmony_ci    JSTaggedValue idx = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29454514f5e3Sopenharmony_ci    return RuntimeLdPatchVar(thread, idx.GetInt()).GetRawData();
29464514f5e3Sopenharmony_ci}
29474514f5e3Sopenharmony_ci
29484514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(StPatchVar)
29494514f5e3Sopenharmony_ci{
29504514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(StPatchVar);
29514514f5e3Sopenharmony_ci    JSTaggedValue idx = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29524514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
29534514f5e3Sopenharmony_ci    return RuntimeStPatchVar(thread, idx.GetInt(), value).GetRawData();
29544514f5e3Sopenharmony_ci}
29554514f5e3Sopenharmony_ci
29564514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NotifyConcurrentResult)
29574514f5e3Sopenharmony_ci{
29584514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NotifyConcurrentResult);
29594514f5e3Sopenharmony_ci    JSTaggedValue result = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29604514f5e3Sopenharmony_ci    JSTaggedValue hint = GetArg(argv, argc, 1);  // 1: means the first parameter
29614514f5e3Sopenharmony_ci    return RuntimeNotifyConcurrentResult(thread, result, hint).GetRawData();
29624514f5e3Sopenharmony_ci}
29634514f5e3Sopenharmony_ci
29644514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(UpdateAOTHClass)
29654514f5e3Sopenharmony_ci{
29664514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(UpdateAOTHClass);
29674514f5e3Sopenharmony_ci    JSHandle<JSHClass> oldhclass = GetHArg<JSHClass>(argv, argc, 0);  // 0: means the zeroth parameter
29684514f5e3Sopenharmony_ci    JSHandle<JSHClass> newhclass = GetHArg<JSHClass>(argv, argc, 1);  // 1: means the first parameter
29694514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 2);  // 2: means the second parameter
29704514f5e3Sopenharmony_ci    return RuntimeUpdateAOTHClass(thread, oldhclass, newhclass, key).GetRawData();
29714514f5e3Sopenharmony_ci}
29724514f5e3Sopenharmony_ci
29734514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DefineField)
29744514f5e3Sopenharmony_ci{
29754514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DefineField);
29764514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29774514f5e3Sopenharmony_ci    JSTaggedValue propKey = GetArg(argv, argc, 1);  // 1: means the first parameter
29784514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 2);  // 2: means the second parameter
29794514f5e3Sopenharmony_ci    return RuntimeDefineField(thread, obj, propKey, value).GetRawData();
29804514f5e3Sopenharmony_ci}
29814514f5e3Sopenharmony_ci
29824514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(CreatePrivateProperty)
29834514f5e3Sopenharmony_ci{
29844514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(CreatePrivateProperty);
29854514f5e3Sopenharmony_ci    JSTaggedValue lexicalEnv = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29864514f5e3Sopenharmony_ci    uint32_t count = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt());  // 1: means the first parameter
29874514f5e3Sopenharmony_ci    JSTaggedValue constpool = GetArg(argv, argc, 2);  // 2: means the second parameter
29884514f5e3Sopenharmony_ci    uint32_t literalId = static_cast<uint32_t>(GetArg(argv, argc, 3).GetInt());  // 3: means the third parameter
29894514f5e3Sopenharmony_ci    JSTaggedValue module = GetArg(argv, argc, 4);  // 4: means the fourth parameter
29904514f5e3Sopenharmony_ci    return RuntimeCreatePrivateProperty(thread, lexicalEnv, count, constpool, literalId, module).GetRawData();
29914514f5e3Sopenharmony_ci}
29924514f5e3Sopenharmony_ci
29934514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DefinePrivateProperty)
29944514f5e3Sopenharmony_ci{
29954514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DefinePrivateProperty);
29964514f5e3Sopenharmony_ci    JSTaggedValue lexicalEnv = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
29974514f5e3Sopenharmony_ci    uint32_t levelIndex = static_cast<uint32_t>(GetArg(argv, argc, 1).GetInt());  // 1: means the first parameter
29984514f5e3Sopenharmony_ci    uint32_t slotIndex = static_cast<uint32_t>(GetArg(argv, argc, 2).GetInt());  // 2: means the second parameter
29994514f5e3Sopenharmony_ci    JSTaggedValue obj = GetArg(argv, argc, 3);  // 3: means the third parameter
30004514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 4);  // 4: means the fourth parameter
30014514f5e3Sopenharmony_ci    return RuntimeDefinePrivateProperty(thread, lexicalEnv, levelIndex, slotIndex, obj, value).GetRawData();
30024514f5e3Sopenharmony_ci}
30034514f5e3Sopenharmony_ci
30044514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ContainerRBTreeForEach)
30054514f5e3Sopenharmony_ci{
30064514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ContainerRBTreeForEach);
30074514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> node = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: param index
30084514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> callbackFnHandle = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: param index
30094514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArgHandle = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: param index
30104514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisHandle = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: param index
30114514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> type = GetHArg<JSTaggedValue>(argv, argc, 4);  // 4: param index
30124514f5e3Sopenharmony_ci
30134514f5e3Sopenharmony_ci    ASSERT(node->IsRBTreeNode());
30144514f5e3Sopenharmony_ci    ASSERT(callbackFnHandle->IsCallable());
30154514f5e3Sopenharmony_ci    ASSERT(type->IsInt());
30164514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
30174514f5e3Sopenharmony_ci    auto containersType = static_cast<kungfu::ContainersType>(type->GetInt());
30184514f5e3Sopenharmony_ci    JSMutableHandle<TaggedQueue> queue(thread, thread->GetEcmaVM()->GetFactory()->NewTaggedQueue(0));
30194514f5e3Sopenharmony_ci    JSMutableHandle<RBTreeNode> treeNode(thread, JSTaggedValue::Undefined());
30204514f5e3Sopenharmony_ci    queue.Update(JSTaggedValue(TaggedQueue::Push(thread, queue, node)));
30214514f5e3Sopenharmony_ci    while (!queue->Empty()) {
30224514f5e3Sopenharmony_ci        treeNode.Update(queue->Pop(thread));
30234514f5e3Sopenharmony_ci        EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle,
30244514f5e3Sopenharmony_ci                                                                        undefined, 3); // 3: three args
30254514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
30264514f5e3Sopenharmony_ci        info->SetCallArg(containersType == kungfu::ContainersType::HASHSET_FOREACH ?
30274514f5e3Sopenharmony_ci                         treeNode->GetKey() : treeNode->GetValue(), treeNode->GetKey(), thisHandle.GetTaggedValue());
30284514f5e3Sopenharmony_ci        JSTaggedValue funcResult = JSFunction::Call(info);
30294514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, funcResult.GetRawData());
30304514f5e3Sopenharmony_ci        if (!treeNode->GetLeft().IsHole()) {
30314514f5e3Sopenharmony_ci            JSHandle<JSTaggedValue> left(thread, treeNode->GetLeft());
30324514f5e3Sopenharmony_ci            queue.Update(JSTaggedValue(TaggedQueue::Push(thread, queue, left)));
30334514f5e3Sopenharmony_ci        }
30344514f5e3Sopenharmony_ci        if (!treeNode->GetRight().IsHole()) {
30354514f5e3Sopenharmony_ci            JSHandle<JSTaggedValue> right(thread, treeNode->GetRight());
30364514f5e3Sopenharmony_ci            queue.Update(JSTaggedValue(TaggedQueue::Push(thread, queue, right)));
30374514f5e3Sopenharmony_ci        }
30384514f5e3Sopenharmony_ci    }
30394514f5e3Sopenharmony_ci    return JSTaggedValue::True().GetRawData();
30404514f5e3Sopenharmony_ci}
30414514f5e3Sopenharmony_ci
30424514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(InsertStringToTable)
30434514f5e3Sopenharmony_ci{
30444514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(InsertStringToTable);
30454514f5e3Sopenharmony_ci    JSHandle<EcmaString> str = GetHArg<EcmaString>(argv, argc, 0);  // 0: means the zeroth parameter
30464514f5e3Sopenharmony_ci    return JSTaggedValue::Cast(
30474514f5e3Sopenharmony_ci        static_cast<void *>(thread->GetEcmaVM()->GetEcmaStringTable()->InsertStringToTable(thread->GetEcmaVM(), str)));
30484514f5e3Sopenharmony_ci}
30494514f5e3Sopenharmony_ci
30504514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SlowFlattenString)
30514514f5e3Sopenharmony_ci{
30524514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SlowFlattenString);
30534514f5e3Sopenharmony_ci    JSHandle<EcmaString> str = GetHArg<EcmaString>(argv, argc, 0);  // 0: means the zeroth parameter
30544514f5e3Sopenharmony_ci    return JSTaggedValue(EcmaStringAccessor::SlowFlatten(thread->GetEcmaVM(), str)).GetRawData();
30554514f5e3Sopenharmony_ci}
30564514f5e3Sopenharmony_ci
30574514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(TryGetInternString)
30584514f5e3Sopenharmony_ci{
30594514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(TryGetInternString);
30604514f5e3Sopenharmony_ci    JSHandle<EcmaString> string = GetHArg<EcmaString>(argv, argc, 0);  // 0: means the zeroth parameter
30614514f5e3Sopenharmony_ci    return RuntimeTryGetInternString(argGlue, string);
30624514f5e3Sopenharmony_ci}
30634514f5e3Sopenharmony_ci
30644514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DecodeURIComponent)
30654514f5e3Sopenharmony_ci{
30664514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DecodeURIComponent);
30674514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> arg = GetHArg<JSTaggedValue>(argv, argc, 0);
30684514f5e3Sopenharmony_ci    JSHandle<EcmaString> string = JSTaggedValue::ToString(thread, arg);
30694514f5e3Sopenharmony_ci    if (thread->HasPendingException()) {
30704514f5e3Sopenharmony_ci        return JSTaggedValue::VALUE_EXCEPTION;
30714514f5e3Sopenharmony_ci    }
30724514f5e3Sopenharmony_ci    if (EcmaStringAccessor(string).IsTreeString()) {
30734514f5e3Sopenharmony_ci        string = JSHandle<EcmaString>(thread, EcmaStringAccessor::Flatten(thread->GetEcmaVM(), string));
30744514f5e3Sopenharmony_ci    }
30754514f5e3Sopenharmony_ci    auto stringAcc = EcmaStringAccessor(string);
30764514f5e3Sopenharmony_ci    JSTaggedValue result;
30774514f5e3Sopenharmony_ci    if (stringAcc.IsLineString()) {
30784514f5e3Sopenharmony_ci        // line string or flatten tree string
30794514f5e3Sopenharmony_ci        if (!stringAcc.IsUtf16()) {
30804514f5e3Sopenharmony_ci            result = RuntimeDecodeURIComponent<uint8_t>(thread, string, stringAcc.GetDataUtf8());
30814514f5e3Sopenharmony_ci        } else {
30824514f5e3Sopenharmony_ci            result = RuntimeDecodeURIComponent<uint16_t>(thread, string, stringAcc.GetDataUtf16());
30834514f5e3Sopenharmony_ci        }
30844514f5e3Sopenharmony_ci    } else if (stringAcc.IsConstantString()) {
30854514f5e3Sopenharmony_ci        ASSERT(stringAcc.IsUtf8());
30864514f5e3Sopenharmony_ci        result = RuntimeDecodeURIComponent<uint8_t>(thread, string, stringAcc.GetDataUtf8());
30874514f5e3Sopenharmony_ci    } else {
30884514f5e3Sopenharmony_ci        ASSERT(stringAcc.IsSlicedString());
30894514f5e3Sopenharmony_ci        auto parent = SlicedString::Cast(string.GetTaggedValue())->GetParent();
30904514f5e3Sopenharmony_ci        auto parentStrAcc = EcmaStringAccessor(parent);
30914514f5e3Sopenharmony_ci        auto startIndex = SlicedString::Cast(string.GetTaggedValue())->GetStartIndex();
30924514f5e3Sopenharmony_ci        if (parentStrAcc.IsLineString()) {
30934514f5e3Sopenharmony_ci            if (parentStrAcc.IsUtf8()) {
30944514f5e3Sopenharmony_ci                result = RuntimeDecodeURIComponent<uint8_t>(thread, string,
30954514f5e3Sopenharmony_ci                                                            parentStrAcc.GetDataUtf8() + startIndex);
30964514f5e3Sopenharmony_ci            } else {
30974514f5e3Sopenharmony_ci                result = RuntimeDecodeURIComponent<uint16_t>(thread, string,
30984514f5e3Sopenharmony_ci                                                             parentStrAcc.GetDataUtf16() + startIndex);
30994514f5e3Sopenharmony_ci            }
31004514f5e3Sopenharmony_ci        } else {
31014514f5e3Sopenharmony_ci            result = RuntimeDecodeURIComponent<uint8_t>(thread, string, parentStrAcc.GetDataUtf8() + startIndex);
31024514f5e3Sopenharmony_ci        }
31034514f5e3Sopenharmony_ci    }
31044514f5e3Sopenharmony_ci    return result.GetRawData();
31054514f5e3Sopenharmony_ci}
31064514f5e3Sopenharmony_ci
31074514f5e3Sopenharmony_ciJSTaggedType RuntimeStubs::CreateArrayFromList([[maybe_unused]] uintptr_t argGlue, int32_t argc,
31084514f5e3Sopenharmony_ci                                               JSTaggedValue *argvPtr)
31094514f5e3Sopenharmony_ci{
31104514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
31114514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
31124514f5e3Sopenharmony_ci    JSHandle<TaggedArray> taggedArray = factory->NewTaggedArray(argc - NUM_MANDATORY_JSFUNC_ARGS);
31134514f5e3Sopenharmony_ci    for (int index = NUM_MANDATORY_JSFUNC_ARGS; index < argc; ++index) {
31144514f5e3Sopenharmony_ci        taggedArray->Set(thread, index - NUM_MANDATORY_JSFUNC_ARGS, argvPtr[index]);
31154514f5e3Sopenharmony_ci    }
31164514f5e3Sopenharmony_ci    JSHandle<JSArray> arrHandle = JSArray::CreateArrayFromList(thread, taggedArray);
31174514f5e3Sopenharmony_ci    return arrHandle.GetTaggedValue().GetRawData();
31184514f5e3Sopenharmony_ci}
31194514f5e3Sopenharmony_ci
31204514f5e3Sopenharmony_ciint32_t RuntimeStubs::FindElementWithCache(uintptr_t argGlue, JSTaggedType hclass,
31214514f5e3Sopenharmony_ci                                           JSTaggedType key, int32_t num)
31224514f5e3Sopenharmony_ci{
31234514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
31244514f5e3Sopenharmony_ci    auto cls = reinterpret_cast<JSHClass *>(hclass);
31254514f5e3Sopenharmony_ci    JSTaggedValue propKey = JSTaggedValue(key);
31264514f5e3Sopenharmony_ci    auto layoutInfo = LayoutInfo::Cast(cls->GetLayout().GetTaggedObject());
31274514f5e3Sopenharmony_ci    PropertiesCache *cache = thread->GetPropertiesCache();
31284514f5e3Sopenharmony_ci    int index = cache->Get(cls, propKey);
31294514f5e3Sopenharmony_ci    if (index == PropertiesCache::NOT_FOUND) {
31304514f5e3Sopenharmony_ci        index = layoutInfo->BinarySearch(propKey, num);
31314514f5e3Sopenharmony_ci        cache->Set(cls, propKey, index);
31324514f5e3Sopenharmony_ci    }
31334514f5e3Sopenharmony_ci    return index;
31344514f5e3Sopenharmony_ci}
31354514f5e3Sopenharmony_ci
31364514f5e3Sopenharmony_civoid RuntimeStubs::UpdateFieldType(JSTaggedType hclass, uint64_t value)
31374514f5e3Sopenharmony_ci{
31384514f5e3Sopenharmony_ci    auto cls = reinterpret_cast<JSHClass *>(hclass);
31394514f5e3Sopenharmony_ci    PropertyAttributes attrValue(value);
31404514f5e3Sopenharmony_ci    JSHClass::UpdateFieldType(cls, attrValue);
31414514f5e3Sopenharmony_ci}
31424514f5e3Sopenharmony_ci
31434514f5e3Sopenharmony_ciJSTaggedType RuntimeStubs::GetActualArgvNoGC(uintptr_t argGlue)
31444514f5e3Sopenharmony_ci{
31454514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
31464514f5e3Sopenharmony_ci    JSTaggedType *current = const_cast<JSTaggedType *>(thread->GetLastLeaveFrame());
31474514f5e3Sopenharmony_ci    FrameIterator it(current, thread);
31484514f5e3Sopenharmony_ci    ASSERT(it.IsOptimizedFrame());
31494514f5e3Sopenharmony_ci    it.Advance<GCVisitedFlag::VISITED>();
31504514f5e3Sopenharmony_ci    ASSERT(it.IsAotOrJitFunctionFrame());
31514514f5e3Sopenharmony_ci    if (it.IsFastJitFunctionFrame()) {
31524514f5e3Sopenharmony_ci        auto fastJitFunctionFrame = it.GetFrame<FASTJITFunctionFrame>();
31534514f5e3Sopenharmony_ci        return reinterpret_cast<uintptr_t>(fastJitFunctionFrame->GetArgv(it));
31544514f5e3Sopenharmony_ci    } else {
31554514f5e3Sopenharmony_ci        auto optimizedJSFunctionFrame = it.GetFrame<OptimizedJSFunctionFrame>();
31564514f5e3Sopenharmony_ci        return reinterpret_cast<uintptr_t>(optimizedJSFunctionFrame->GetArgv(it));
31574514f5e3Sopenharmony_ci    }
31584514f5e3Sopenharmony_ci}
31594514f5e3Sopenharmony_ci
31604514f5e3Sopenharmony_cidouble RuntimeStubs::FloatMod(double x, double y)
31614514f5e3Sopenharmony_ci{
31624514f5e3Sopenharmony_ci    return std::fmod(x, y);
31634514f5e3Sopenharmony_ci}
31644514f5e3Sopenharmony_ci
31654514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAcos(double x)
31664514f5e3Sopenharmony_ci{
31674514f5e3Sopenharmony_ci    return std::acos(x);
31684514f5e3Sopenharmony_ci}
31694514f5e3Sopenharmony_ci
31704514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAcosh(double x)
31714514f5e3Sopenharmony_ci{
31724514f5e3Sopenharmony_ci    return std::acosh(x);
31734514f5e3Sopenharmony_ci}
31744514f5e3Sopenharmony_ci
31754514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAsin(double x)
31764514f5e3Sopenharmony_ci{
31774514f5e3Sopenharmony_ci    return std::asin(x);
31784514f5e3Sopenharmony_ci}
31794514f5e3Sopenharmony_ci
31804514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAsinh(double x)
31814514f5e3Sopenharmony_ci{
31824514f5e3Sopenharmony_ci    return std::asinh(x);
31834514f5e3Sopenharmony_ci}
31844514f5e3Sopenharmony_ci
31854514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAtan(double x)
31864514f5e3Sopenharmony_ci{
31874514f5e3Sopenharmony_ci    return std::atan(x);
31884514f5e3Sopenharmony_ci}
31894514f5e3Sopenharmony_ci
31904514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAtan2(double y, double x)
31914514f5e3Sopenharmony_ci{
31924514f5e3Sopenharmony_ci    return std::atan2(y, x);
31934514f5e3Sopenharmony_ci}
31944514f5e3Sopenharmony_ci
31954514f5e3Sopenharmony_cidouble RuntimeStubs::FloatAtanh(double x)
31964514f5e3Sopenharmony_ci{
31974514f5e3Sopenharmony_ci    return std::atanh(x);
31984514f5e3Sopenharmony_ci}
31994514f5e3Sopenharmony_ci
32004514f5e3Sopenharmony_cidouble RuntimeStubs::FloatCos(double x)
32014514f5e3Sopenharmony_ci{
32024514f5e3Sopenharmony_ci    return std::cos(x);
32034514f5e3Sopenharmony_ci}
32044514f5e3Sopenharmony_ci
32054514f5e3Sopenharmony_cidouble RuntimeStubs::FloatCosh(double x)
32064514f5e3Sopenharmony_ci{
32074514f5e3Sopenharmony_ci    return std::cosh(x);
32084514f5e3Sopenharmony_ci}
32094514f5e3Sopenharmony_ci
32104514f5e3Sopenharmony_cidouble RuntimeStubs::FloatSin(double x)
32114514f5e3Sopenharmony_ci{
32124514f5e3Sopenharmony_ci    return std::sin(x);
32134514f5e3Sopenharmony_ci}
32144514f5e3Sopenharmony_ci
32154514f5e3Sopenharmony_cidouble RuntimeStubs::FloatSinh(double x)
32164514f5e3Sopenharmony_ci{
32174514f5e3Sopenharmony_ci    return std::sinh(x);
32184514f5e3Sopenharmony_ci}
32194514f5e3Sopenharmony_ci
32204514f5e3Sopenharmony_cidouble RuntimeStubs::FloatTan(double x)
32214514f5e3Sopenharmony_ci{
32224514f5e3Sopenharmony_ci    return std::tan(x);
32234514f5e3Sopenharmony_ci}
32244514f5e3Sopenharmony_ci
32254514f5e3Sopenharmony_cidouble RuntimeStubs::FloatTanh(double x)
32264514f5e3Sopenharmony_ci{
32274514f5e3Sopenharmony_ci    return std::tanh(x);
32284514f5e3Sopenharmony_ci}
32294514f5e3Sopenharmony_ci
32304514f5e3Sopenharmony_cidouble RuntimeStubs::FloatCbrt(double x)
32314514f5e3Sopenharmony_ci{
32324514f5e3Sopenharmony_ci    return std::cbrt(x);
32334514f5e3Sopenharmony_ci}
32344514f5e3Sopenharmony_ci
32354514f5e3Sopenharmony_cidouble RuntimeStubs::FloatTrunc(double x)
32364514f5e3Sopenharmony_ci{
32374514f5e3Sopenharmony_ci    return std::trunc(x);
32384514f5e3Sopenharmony_ci}
32394514f5e3Sopenharmony_ci
32404514f5e3Sopenharmony_cidouble RuntimeStubs::FloatCeil(double x)
32414514f5e3Sopenharmony_ci{
32424514f5e3Sopenharmony_ci    return std::ceil(x);
32434514f5e3Sopenharmony_ci}
32444514f5e3Sopenharmony_ci
32454514f5e3Sopenharmony_cidouble RuntimeStubs::FloatFloor(double x)
32464514f5e3Sopenharmony_ci{
32474514f5e3Sopenharmony_ci    return std::floor(x);
32484514f5e3Sopenharmony_ci}
32494514f5e3Sopenharmony_ci
32504514f5e3Sopenharmony_cidouble RuntimeStubs::FloatLog(double x)
32514514f5e3Sopenharmony_ci{
32524514f5e3Sopenharmony_ci    return std::log(x);
32534514f5e3Sopenharmony_ci}
32544514f5e3Sopenharmony_ci
32554514f5e3Sopenharmony_cidouble RuntimeStubs::FloatLog2(double x)
32564514f5e3Sopenharmony_ci{
32574514f5e3Sopenharmony_ci    return std::log2(x);
32584514f5e3Sopenharmony_ci}
32594514f5e3Sopenharmony_ci
32604514f5e3Sopenharmony_cidouble RuntimeStubs::FloatLog10(double x)
32614514f5e3Sopenharmony_ci{
32624514f5e3Sopenharmony_ci    return std::log10(x);
32634514f5e3Sopenharmony_ci}
32644514f5e3Sopenharmony_ci
32654514f5e3Sopenharmony_cidouble RuntimeStubs::FloatLog1p(double x)
32664514f5e3Sopenharmony_ci{
32674514f5e3Sopenharmony_ci    return std::log1p(x);
32684514f5e3Sopenharmony_ci}
32694514f5e3Sopenharmony_ci
32704514f5e3Sopenharmony_cidouble RuntimeStubs::FloatExp(double x)
32714514f5e3Sopenharmony_ci{
32724514f5e3Sopenharmony_ci    return std::exp(x);
32734514f5e3Sopenharmony_ci}
32744514f5e3Sopenharmony_ci
32754514f5e3Sopenharmony_cidouble RuntimeStubs::FloatExpm1(double x)
32764514f5e3Sopenharmony_ci{
32774514f5e3Sopenharmony_ci    return std::expm1(x);
32784514f5e3Sopenharmony_ci}
32794514f5e3Sopenharmony_ci
32804514f5e3Sopenharmony_cidouble RuntimeStubs::FloatPow(double base, double exp)
32814514f5e3Sopenharmony_ci{
32824514f5e3Sopenharmony_ci    return std::pow(base, exp);
32834514f5e3Sopenharmony_ci}
32844514f5e3Sopenharmony_ci
32854514f5e3Sopenharmony_cibool RuntimeStubs::NumberIsFinite(double x)
32864514f5e3Sopenharmony_ci{
32874514f5e3Sopenharmony_ci    return std::isfinite(x);
32884514f5e3Sopenharmony_ci}
32894514f5e3Sopenharmony_ci
32904514f5e3Sopenharmony_cidouble RuntimeStubs::CallDateNow()
32914514f5e3Sopenharmony_ci{
32924514f5e3Sopenharmony_ci    // time from now is in ms.
32934514f5e3Sopenharmony_ci    int64_t ans;
32944514f5e3Sopenharmony_ci    struct timeval tv {
32954514f5e3Sopenharmony_ci    };
32964514f5e3Sopenharmony_ci    gettimeofday(&tv, nullptr);
32974514f5e3Sopenharmony_ci    ans = static_cast<int64_t>(tv.tv_sec) * MS_PER_SECOND + (tv.tv_usec / MS_PER_SECOND);
32984514f5e3Sopenharmony_ci    return static_cast<double>(ans);
32994514f5e3Sopenharmony_ci}
33004514f5e3Sopenharmony_ci
33014514f5e3Sopenharmony_ciint32_t RuntimeStubs::DoubleToInt(double x, size_t bits)
33024514f5e3Sopenharmony_ci{
33034514f5e3Sopenharmony_ci    return base::NumberHelper::DoubleToInt(x, bits);
33044514f5e3Sopenharmony_ci}
33054514f5e3Sopenharmony_ci
33064514f5e3Sopenharmony_ciJSTaggedType RuntimeStubs::DoubleToLength(double x)
33074514f5e3Sopenharmony_ci{
33084514f5e3Sopenharmony_ci    double length = base::NumberHelper::TruncateDouble(x);
33094514f5e3Sopenharmony_ci    if (length < 0.0) {
33104514f5e3Sopenharmony_ci        return JSTaggedNumber(static_cast<double>(0)).GetRawData();
33114514f5e3Sopenharmony_ci    }
33124514f5e3Sopenharmony_ci    if (length > SAFE_NUMBER) {
33134514f5e3Sopenharmony_ci        return JSTaggedNumber(static_cast<double>(SAFE_NUMBER)).GetRawData();
33144514f5e3Sopenharmony_ci    }
33154514f5e3Sopenharmony_ci    return JSTaggedNumber(length).GetRawData();
33164514f5e3Sopenharmony_ci}
33174514f5e3Sopenharmony_ci
33184514f5e3Sopenharmony_civoid RuntimeStubs::InsertNewToEdenRSet([[maybe_unused]] uintptr_t argGlue,
33194514f5e3Sopenharmony_ci    uintptr_t object, size_t offset)
33204514f5e3Sopenharmony_ci{
33214514f5e3Sopenharmony_ci    Region *region = Region::ObjectAddressToRange(object);
33224514f5e3Sopenharmony_ci    uintptr_t slotAddr = object + offset;
33234514f5e3Sopenharmony_ci    return region->InsertNewToEdenRSet(slotAddr);
33244514f5e3Sopenharmony_ci}
33254514f5e3Sopenharmony_ci
33264514f5e3Sopenharmony_civoid RuntimeStubs::InsertOldToNewRSet([[maybe_unused]] uintptr_t argGlue,
33274514f5e3Sopenharmony_ci    uintptr_t object, size_t offset)
33284514f5e3Sopenharmony_ci{
33294514f5e3Sopenharmony_ci    Region *region = Region::ObjectAddressToRange(object);
33304514f5e3Sopenharmony_ci    uintptr_t slotAddr = object + offset;
33314514f5e3Sopenharmony_ci    return region->InsertOldToNewRSet(slotAddr);
33324514f5e3Sopenharmony_ci}
33334514f5e3Sopenharmony_ci
33344514f5e3Sopenharmony_civoid RuntimeStubs::InsertLocalToShareRSet([[maybe_unused]] uintptr_t argGlue,
33354514f5e3Sopenharmony_ci    uintptr_t object, size_t offset)
33364514f5e3Sopenharmony_ci{
33374514f5e3Sopenharmony_ci    Region *region = Region::ObjectAddressToRange(object);
33384514f5e3Sopenharmony_ci    uintptr_t slotAddr = object + offset;
33394514f5e3Sopenharmony_ci    region->InsertLocalToShareRSet(slotAddr);
33404514f5e3Sopenharmony_ci}
33414514f5e3Sopenharmony_ci
33424514f5e3Sopenharmony_civoid RuntimeStubs::SetBitAtomic(GCBitset::GCBitsetWord *word, GCBitset::GCBitsetWord mask,
33434514f5e3Sopenharmony_ci                                GCBitset::GCBitsetWord oldValue)
33444514f5e3Sopenharmony_ci{
33454514f5e3Sopenharmony_ci    volatile auto atomicWord = reinterpret_cast<volatile std::atomic<GCBitset::GCBitsetWord> *>(word);
33464514f5e3Sopenharmony_ci    GCBitset::GCBitsetWord oldValueBeforeCAS = oldValue;
33474514f5e3Sopenharmony_ci    std::atomic_compare_exchange_strong_explicit(atomicWord, &oldValue, oldValue | mask,
33484514f5e3Sopenharmony_ci        std::memory_order_release, std::memory_order_relaxed);
33494514f5e3Sopenharmony_ci    while (oldValue != oldValueBeforeCAS) {
33504514f5e3Sopenharmony_ci        if (oldValue & mask) {
33514514f5e3Sopenharmony_ci            return;
33524514f5e3Sopenharmony_ci        }
33534514f5e3Sopenharmony_ci        oldValueBeforeCAS = oldValue;
33544514f5e3Sopenharmony_ci        std::atomic_compare_exchange_strong_explicit(atomicWord, &oldValue, oldValue | mask,
33554514f5e3Sopenharmony_ci            std::memory_order_release, std::memory_order_relaxed);
33564514f5e3Sopenharmony_ci    }
33574514f5e3Sopenharmony_ci}
33584514f5e3Sopenharmony_ci
33594514f5e3Sopenharmony_civoid RuntimeStubs::MarkingBarrier([[maybe_unused]] uintptr_t argGlue,
33604514f5e3Sopenharmony_ci    uintptr_t object, size_t offset, TaggedObject *value)
33614514f5e3Sopenharmony_ci{
33624514f5e3Sopenharmony_ci    uintptr_t slotAddr = object + offset;
33634514f5e3Sopenharmony_ci    Region *objectRegion = Region::ObjectAddressToRange(object);
33644514f5e3Sopenharmony_ci    Region *valueRegion = Region::ObjectAddressToRange(value);
33654514f5e3Sopenharmony_ci    ASSERT(!valueRegion->InSharedHeap());
33664514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
33674514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_BARRIER_CHECK
33684514f5e3Sopenharmony_ci    if (!thread->GetEcmaVM()->GetHeap()->IsAlive(JSTaggedValue(value).GetHeapObject())) {
33694514f5e3Sopenharmony_ci        LOG_FULL(FATAL) << "RuntimeStubs::MarkingBarrier checked value:" << value << " is invalid!";
33704514f5e3Sopenharmony_ci    }
33714514f5e3Sopenharmony_ci#endif
33724514f5e3Sopenharmony_ci    ASSERT(thread->IsConcurrentMarkingOrFinished());
33734514f5e3Sopenharmony_ci    Barriers::UpdateWithoutEden(thread, slotAddr, objectRegion, value, valueRegion);
33744514f5e3Sopenharmony_ci}
33754514f5e3Sopenharmony_ci
33764514f5e3Sopenharmony_civoid RuntimeStubs::MarkingBarrierWithEden([[maybe_unused]] uintptr_t argGlue,
33774514f5e3Sopenharmony_ci    uintptr_t object, size_t offset, TaggedObject *value)
33784514f5e3Sopenharmony_ci{
33794514f5e3Sopenharmony_ci    uintptr_t slotAddr = object + offset;
33804514f5e3Sopenharmony_ci    Region *objectRegion = Region::ObjectAddressToRange(object);
33814514f5e3Sopenharmony_ci    Region *valueRegion = Region::ObjectAddressToRange(value);
33824514f5e3Sopenharmony_ci    ASSERT(!valueRegion->InSharedHeap());
33834514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
33844514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_BARRIER_CHECK
33854514f5e3Sopenharmony_ci    if (!thread->GetEcmaVM()->GetHeap()->IsAlive(JSTaggedValue(value).GetHeapObject())) {
33864514f5e3Sopenharmony_ci        LOG_FULL(FATAL) << "RuntimeStubs::MarkingBarrierWithEden checked value:" << value << " is invalid!";
33874514f5e3Sopenharmony_ci    }
33884514f5e3Sopenharmony_ci#endif
33894514f5e3Sopenharmony_ci    ASSERT(thread->IsConcurrentMarkingOrFinished());
33904514f5e3Sopenharmony_ci    Barriers::Update(thread, slotAddr, objectRegion, value, valueRegion);
33914514f5e3Sopenharmony_ci}
33924514f5e3Sopenharmony_ci
33934514f5e3Sopenharmony_civoid RuntimeStubs::SharedGCMarkingBarrier([[maybe_unused]] uintptr_t argGlue, TaggedObject *value)
33944514f5e3Sopenharmony_ci{
33954514f5e3Sopenharmony_ci    Region *valueRegion = Region::ObjectAddressToRange(value);
33964514f5e3Sopenharmony_ci    ASSERT(valueRegion->InSharedSweepableSpace());
33974514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
33984514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_BARRIER_CHECK
33994514f5e3Sopenharmony_ci    if (!thread->GetEcmaVM()->GetHeap()->IsAlive(JSTaggedValue(value).GetHeapObject())) {
34004514f5e3Sopenharmony_ci        LOG_FULL(FATAL) << "RuntimeStubs::SharedGCMarkingBarrier checked value:" << value << " is invalid!";
34014514f5e3Sopenharmony_ci    }
34024514f5e3Sopenharmony_ci#endif
34034514f5e3Sopenharmony_ci    ASSERT(thread->IsSharedConcurrentMarkingOrFinished());
34044514f5e3Sopenharmony_ci    Barriers::UpdateShared(thread, value, valueRegion);
34054514f5e3Sopenharmony_ci}
34064514f5e3Sopenharmony_ci
34074514f5e3Sopenharmony_civoid RuntimeStubs::StoreBarrier([[maybe_unused]] uintptr_t argGlue,
34084514f5e3Sopenharmony_ci    uintptr_t object, size_t offset, TaggedObject *value)
34094514f5e3Sopenharmony_ci{
34104514f5e3Sopenharmony_ci    uintptr_t slotAddr = object + offset;
34114514f5e3Sopenharmony_ci    Region *objectRegion = Region::ObjectAddressToRange(object);
34124514f5e3Sopenharmony_ci    Region *valueRegion = Region::ObjectAddressToRange(value);
34134514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
34144514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_BARRIER_CHECK
34154514f5e3Sopenharmony_ci    if (!thread->GetEcmaVM()->GetHeap()->IsAlive(JSTaggedValue(value).GetHeapObject())) {
34164514f5e3Sopenharmony_ci        LOG_FULL(FATAL) << "RuntimeStubs::StoreBarrier checked value:" << value << " is invalid!";
34174514f5e3Sopenharmony_ci    }
34184514f5e3Sopenharmony_ci#endif
34194514f5e3Sopenharmony_ci    if (objectRegion->InGeneralOldSpace() && valueRegion->InGeneralNewSpace()) {
34204514f5e3Sopenharmony_ci        // Should align with '8' in 64 and 32 bit platform
34214514f5e3Sopenharmony_ci        ASSERT((slotAddr % static_cast<uint8_t>(MemAlignment::MEM_ALIGN_OBJECT)) == 0);
34224514f5e3Sopenharmony_ci        objectRegion->InsertOldToNewRSet(slotAddr);
34234514f5e3Sopenharmony_ci    } else if (!objectRegion->InSharedHeap() && valueRegion->InSharedSweepableSpace()) {
34244514f5e3Sopenharmony_ci        objectRegion->InsertLocalToShareRSet(slotAddr);
34254514f5e3Sopenharmony_ci    } else if (valueRegion->InEdenSpace() && objectRegion->InYoungSpace()) {
34264514f5e3Sopenharmony_ci        objectRegion->InsertNewToEdenRSet(slotAddr);
34274514f5e3Sopenharmony_ci    }
34284514f5e3Sopenharmony_ci    if (!valueRegion->InSharedHeap() && thread->IsConcurrentMarkingOrFinished()) {
34294514f5e3Sopenharmony_ci        Barriers::Update(thread, slotAddr, objectRegion, value, valueRegion);
34304514f5e3Sopenharmony_ci    }
34314514f5e3Sopenharmony_ci    if (valueRegion->InSharedSweepableSpace() && thread->IsSharedConcurrentMarkingOrFinished()) {
34324514f5e3Sopenharmony_ci        Barriers::UpdateShared(thread, value, valueRegion);
34334514f5e3Sopenharmony_ci    }
34344514f5e3Sopenharmony_ci}
34354514f5e3Sopenharmony_ci
34364514f5e3Sopenharmony_cibool RuntimeStubs::StringsAreEquals(EcmaString *str1, EcmaString *str2)
34374514f5e3Sopenharmony_ci{
34384514f5e3Sopenharmony_ci    return EcmaStringAccessor::StringsAreEqualDiffUtfEncoding(str1, str2);
34394514f5e3Sopenharmony_ci}
34404514f5e3Sopenharmony_ci
34414514f5e3Sopenharmony_cibool RuntimeStubs::BigIntEquals(JSTaggedType left, JSTaggedType right)
34424514f5e3Sopenharmony_ci{
34434514f5e3Sopenharmony_ci    return BigInt::Equal(JSTaggedValue(left), JSTaggedValue(right));
34444514f5e3Sopenharmony_ci}
34454514f5e3Sopenharmony_ci
34464514f5e3Sopenharmony_cibool RuntimeStubs::BigIntSameValueZero(JSTaggedType left, JSTaggedType right)
34474514f5e3Sopenharmony_ci{
34484514f5e3Sopenharmony_ci    return BigInt::SameValueZero(JSTaggedValue(left), JSTaggedValue(right));
34494514f5e3Sopenharmony_ci}
34504514f5e3Sopenharmony_ci
34514514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::JSHClassFindProtoTransitions(JSHClass *cls, JSTaggedValue key, JSTaggedValue proto)
34524514f5e3Sopenharmony_ci{
34534514f5e3Sopenharmony_ci    return JSTaggedValue(cls->FindProtoTransitions(key, proto));
34544514f5e3Sopenharmony_ci}
34554514f5e3Sopenharmony_ci
34564514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::NumberHelperStringToDouble(EcmaString *numberString)
34574514f5e3Sopenharmony_ci{
34584514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
34594514f5e3Sopenharmony_ci    CVector<uint8_t> buf;
34604514f5e3Sopenharmony_ci    Span<const uint8_t> str = EcmaStringAccessor(numberString).ToUtf8Span(buf);
34614514f5e3Sopenharmony_ci    if (base::NumberHelper::IsEmptyString(str.begin(), str.end())) {
34624514f5e3Sopenharmony_ci        return base::BuiltinsBase::GetTaggedDouble(base::NAN_VALUE);
34634514f5e3Sopenharmony_ci    }
34644514f5e3Sopenharmony_ci    double result = base::NumberHelper::StringToDouble(str.begin(), str.end(), 0, base::IGNORE_TRAILING);
34654514f5e3Sopenharmony_ci    return base::BuiltinsBase::GetTaggedDouble(result);
34664514f5e3Sopenharmony_ci}
34674514f5e3Sopenharmony_ci
34684514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::GetStringToListCacheArray(uintptr_t argGlue)
34694514f5e3Sopenharmony_ci{
34704514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
34714514f5e3Sopenharmony_ci    return thread->GetCurrentEcmaContext()->GetStringToListResultCache().GetTaggedValue();
34724514f5e3Sopenharmony_ci}
34734514f5e3Sopenharmony_ci
34744514f5e3Sopenharmony_cidouble RuntimeStubs::TimeClip(double time)
34754514f5e3Sopenharmony_ci{
34764514f5e3Sopenharmony_ci    return JSDate::TimeClip(time);
34774514f5e3Sopenharmony_ci}
34784514f5e3Sopenharmony_ci
34794514f5e3Sopenharmony_cidouble RuntimeStubs::SetDateValues(double year, double month, double day)
34804514f5e3Sopenharmony_ci{
34814514f5e3Sopenharmony_ci    if (std::isnan(year) || !std::isfinite(year) || std::isnan(month) || !std::isfinite(month) || std::isnan(day) ||
34824514f5e3Sopenharmony_ci        !std::isfinite(day)) {
34834514f5e3Sopenharmony_ci        return base::NAN_VALUE;
34844514f5e3Sopenharmony_ci    }
34854514f5e3Sopenharmony_ci
34864514f5e3Sopenharmony_ci    return JSDate::SetDateValues(static_cast<int64_t>(year), static_cast<int64_t>(month), static_cast<int64_t>(day));
34874514f5e3Sopenharmony_ci}
34884514f5e3Sopenharmony_ci
34894514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::NewObject(EcmaRuntimeCallInfo *info)
34904514f5e3Sopenharmony_ci{
34914514f5e3Sopenharmony_ci    ASSERT(info);
34924514f5e3Sopenharmony_ci    JSThread *thread = info->GetThread();
34934514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> func(info->GetFunction());
34944514f5e3Sopenharmony_ci    if (!func->IsHeapObject()) {
34954514f5e3Sopenharmony_ci        RETURN_STACK_BEFORE_THROW_IF_ASM(thread);
34964514f5e3Sopenharmony_ci        THROW_TYPE_ERROR_AND_RETURN(thread, "function is nullptr", JSTaggedValue::Exception());
34974514f5e3Sopenharmony_ci    }
34984514f5e3Sopenharmony_ci
34994514f5e3Sopenharmony_ci    if (!func->IsJSFunction()) {
35004514f5e3Sopenharmony_ci        if (func->IsBoundFunction()) {
35014514f5e3Sopenharmony_ci            JSTaggedValue result = JSBoundFunction::ConstructInternal(info);
35024514f5e3Sopenharmony_ci            RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
35034514f5e3Sopenharmony_ci            return result;
35044514f5e3Sopenharmony_ci        }
35054514f5e3Sopenharmony_ci
35064514f5e3Sopenharmony_ci        if (func->IsJSProxy()) {
35074514f5e3Sopenharmony_ci            JSTaggedValue jsObj = JSProxy::ConstructInternal(info);
35084514f5e3Sopenharmony_ci            RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
35094514f5e3Sopenharmony_ci            return jsObj;
35104514f5e3Sopenharmony_ci        }
35114514f5e3Sopenharmony_ci        THROW_TYPE_ERROR_AND_RETURN(thread, "Constructed NonConstructable", JSTaggedValue::Exception());
35124514f5e3Sopenharmony_ci    }
35134514f5e3Sopenharmony_ci
35144514f5e3Sopenharmony_ci    JSTaggedValue result = JSFunction::ConstructInternal(info);
35154514f5e3Sopenharmony_ci    RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
35164514f5e3Sopenharmony_ci    return result;
35174514f5e3Sopenharmony_ci}
35184514f5e3Sopenharmony_ci
35194514f5e3Sopenharmony_civoid RuntimeStubs::SaveFrameToContext(JSThread *thread, JSHandle<GeneratorContext> context)
35204514f5e3Sopenharmony_ci{
35214514f5e3Sopenharmony_ci    FrameHandler frameHandler(thread);
35224514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
35234514f5e3Sopenharmony_ci    uint32_t nregs = frameHandler.GetNumberArgs();
35244514f5e3Sopenharmony_ci    JSHandle<TaggedArray> regsArray = factory->NewTaggedArray(nregs);
35254514f5e3Sopenharmony_ci    for (uint32_t i = 0; i < nregs; i++) {
35264514f5e3Sopenharmony_ci        JSTaggedValue value = frameHandler.GetVRegValue(i);
35274514f5e3Sopenharmony_ci        regsArray->Set(thread, i, value);
35284514f5e3Sopenharmony_ci    }
35294514f5e3Sopenharmony_ci    context->SetRegsArray(thread, regsArray.GetTaggedValue());
35304514f5e3Sopenharmony_ci    JSTaggedValue function = frameHandler.GetFunction();
35314514f5e3Sopenharmony_ci    JSFunction *func = JSFunction::Cast(function.GetTaggedObject());
35324514f5e3Sopenharmony_ci    Method *method = func->GetCallTarget();
35334514f5e3Sopenharmony_ci    if (func->IsCompiledCode()) {
35344514f5e3Sopenharmony_ci        bool isFastCall = func->IsCompiledFastCall();  // get this flag before clear it
35354514f5e3Sopenharmony_ci        uintptr_t entry = isFastCall ? thread->GetRTInterface(kungfu::RuntimeStubCSigns::ID_FastCallToAsmInterBridge)
35364514f5e3Sopenharmony_ci                                     : thread->GetRTInterface(kungfu::RuntimeStubCSigns::ID_AOTCallToAsmInterBridge);
35374514f5e3Sopenharmony_ci        func->SetCodeEntry(entry);
35384514f5e3Sopenharmony_ci        method->ClearAOTStatusWhenDeopt(entry);
35394514f5e3Sopenharmony_ci        func->ClearCompiledCodeFlags();
35404514f5e3Sopenharmony_ci    }
35414514f5e3Sopenharmony_ci    context->SetMethod(thread, function);
35424514f5e3Sopenharmony_ci    context->SetThis(thread, frameHandler.GetThis());
35434514f5e3Sopenharmony_ci
35444514f5e3Sopenharmony_ci    BytecodeInstruction ins(frameHandler.GetPc());
35454514f5e3Sopenharmony_ci    auto offset = ins.GetSize();
35464514f5e3Sopenharmony_ci    context->SetAcc(thread, frameHandler.GetAcc());
35474514f5e3Sopenharmony_ci    context->SetLexicalEnv(thread, thread->GetCurrentLexenv());
35484514f5e3Sopenharmony_ci    context->SetNRegs(nregs);
35494514f5e3Sopenharmony_ci    context->SetBCOffset(frameHandler.GetBytecodeOffset() + offset);
35504514f5e3Sopenharmony_ci}
35514514f5e3Sopenharmony_ci
35524514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::CallBoundFunction(EcmaRuntimeCallInfo *info)
35534514f5e3Sopenharmony_ci{
35544514f5e3Sopenharmony_ci    JSThread *thread = info->GetThread();
35554514f5e3Sopenharmony_ci    JSHandle<JSBoundFunction> boundFunc(info->GetFunction());
35564514f5e3Sopenharmony_ci    if (boundFunc->GetBoundTarget().IsJSFunction()) {
35574514f5e3Sopenharmony_ci        JSHandle<JSFunction> targetFunc(thread, boundFunc->GetBoundTarget());
35584514f5e3Sopenharmony_ci        if (targetFunc->IsClassConstructor()) {
35594514f5e3Sopenharmony_ci            THROW_TYPE_ERROR_AND_RETURN(thread, "class constructor cannot called without 'new'",
35604514f5e3Sopenharmony_ci                                        JSTaggedValue::Exception());
35614514f5e3Sopenharmony_ci        }
35624514f5e3Sopenharmony_ci    }
35634514f5e3Sopenharmony_ci    JSHandle<TaggedArray> boundArgs(thread, boundFunc->GetBoundArguments());
35644514f5e3Sopenharmony_ci    const uint32_t boundLength = boundArgs->GetLength();
35654514f5e3Sopenharmony_ci    const uint32_t argsLength = info->GetArgsNumber() + boundLength;
35664514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
35674514f5e3Sopenharmony_ci    EcmaRuntimeCallInfo *runtimeInfo = EcmaInterpreter::NewRuntimeCallInfo(thread,
35684514f5e3Sopenharmony_ci        JSHandle<JSTaggedValue>(thread, boundFunc->GetBoundTarget()),
35694514f5e3Sopenharmony_ci        info->GetThis(), undefined, argsLength);
35704514f5e3Sopenharmony_ci    RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread);
35714514f5e3Sopenharmony_ci    if (boundLength == 0) {
35724514f5e3Sopenharmony_ci        runtimeInfo->SetCallArg(argsLength, 0, info, 0);
35734514f5e3Sopenharmony_ci    } else {
35744514f5e3Sopenharmony_ci        // 0 ~ boundLength is boundArgs; boundLength ~ argsLength is args of EcmaRuntimeCallInfo.
35754514f5e3Sopenharmony_ci        runtimeInfo->SetCallArg(boundLength, boundArgs);
35764514f5e3Sopenharmony_ci        runtimeInfo->SetCallArg(argsLength, boundLength, info, 0);
35774514f5e3Sopenharmony_ci    }
35784514f5e3Sopenharmony_ci    return EcmaInterpreter::Execute(runtimeInfo);
35794514f5e3Sopenharmony_ci}
35804514f5e3Sopenharmony_ci
35814514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(DeoptHandler)
35824514f5e3Sopenharmony_ci{
35834514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(DeoptHandler);
35844514f5e3Sopenharmony_ci    size_t depth = static_cast<size_t>(GetArg(argv, argc, 1).GetInt());
35854514f5e3Sopenharmony_ci    Deoptimizier deopt(thread, depth);
35864514f5e3Sopenharmony_ci    std::vector<kungfu::ARKDeopt> deoptBundle;
35874514f5e3Sopenharmony_ci    deopt.CollectDeoptBundleVec(deoptBundle);
35884514f5e3Sopenharmony_ci    ASSERT(!deoptBundle.empty());
35894514f5e3Sopenharmony_ci    size_t shift = Deoptimizier::ComputeShift(depth);
35904514f5e3Sopenharmony_ci    deopt.CollectVregs(deoptBundle, shift);
35914514f5e3Sopenharmony_ci    kungfu::DeoptType type = static_cast<kungfu::DeoptType>(GetArg(argv, argc, 0).GetInt());
35924514f5e3Sopenharmony_ci    deopt.UpdateAndDumpDeoptInfo(type);
35934514f5e3Sopenharmony_ci    return deopt.ConstructAsmInterpretFrame();
35944514f5e3Sopenharmony_ci}
35954514f5e3Sopenharmony_ci
35964514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AotInlineTrace)
35974514f5e3Sopenharmony_ci{
35984514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AotInlineTrace);
35994514f5e3Sopenharmony_ci    JSTaggedValue callerFunc = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
36004514f5e3Sopenharmony_ci    JSTaggedValue inlineFunc = GetArg(argv, argc, 1);  // 1: means the first parameter
36014514f5e3Sopenharmony_ci    JSFunction *callerJSFunc = JSFunction::Cast(callerFunc);
36024514f5e3Sopenharmony_ci    JSFunction *inlineJSFunc = JSFunction::Cast(inlineFunc);
36034514f5e3Sopenharmony_ci    Method *callerMethod = Method::Cast(JSFunction::Cast(callerJSFunc)->GetMethod());
36044514f5e3Sopenharmony_ci    Method *inlineMethod = Method::Cast(JSFunction::Cast(inlineJSFunc)->GetMethod());
36054514f5e3Sopenharmony_ci    auto callerRecordName = callerMethod->GetRecordNameStr();
36064514f5e3Sopenharmony_ci    auto inlineRecordNanme = inlineMethod->GetRecordNameStr();
36074514f5e3Sopenharmony_ci    const std::string callerFuncName(callerMethod->GetMethodName());
36084514f5e3Sopenharmony_ci    const std::string inlineFuncNanme(inlineMethod->GetMethodName());
36094514f5e3Sopenharmony_ci    std::string callerFullName = callerFuncName + "@" + std::string(callerRecordName);
36104514f5e3Sopenharmony_ci    std::string inlineFullName = inlineFuncNanme + "@" + std::string(inlineRecordNanme);
36114514f5e3Sopenharmony_ci
36124514f5e3Sopenharmony_ci    LOG_TRACE(INFO) << "aot inline function name: " << inlineFullName << " caller function name: " << callerFullName;
36134514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
36144514f5e3Sopenharmony_ci}
36154514f5e3Sopenharmony_ci
36164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AotInlineBuiltinTrace)
36174514f5e3Sopenharmony_ci{
36184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AotInlineBuiltinTrace);
36194514f5e3Sopenharmony_ci    JSTaggedValue callerFunc = GetArg(argv, argc, 0);
36204514f5e3Sopenharmony_ci    JSFunction *callerJSFunc = JSFunction::Cast(callerFunc);
36214514f5e3Sopenharmony_ci    Method *callerMethod = Method::Cast(callerJSFunc->GetMethod());
36224514f5e3Sopenharmony_ci    auto callerRecordName = callerMethod->GetRecordNameStr();
36234514f5e3Sopenharmony_ci    const std::string callerFuncName(callerMethod->GetMethodName());
36244514f5e3Sopenharmony_ci    std::string callerFullName = callerFuncName + "@" + std::string(callerRecordName);
36254514f5e3Sopenharmony_ci
36264514f5e3Sopenharmony_ci    auto builtinId = static_cast<kungfu::BuiltinsStubCSigns::ID>(GetArg(argv, argc, 1).GetInt());
36274514f5e3Sopenharmony_ci    LOG_TRACE(INFO) << "aot inline builtin: " << kungfu::BuiltinsStubCSigns::GetBuiltinName(builtinId)
36284514f5e3Sopenharmony_ci                    << ", caller function name:" << callerFullName;
36294514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
36304514f5e3Sopenharmony_ci}
36314514f5e3Sopenharmony_ci
36324514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LocaleCompare)
36334514f5e3Sopenharmony_ci{
36344514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LocaleCompare);
36354514f5e3Sopenharmony_ci
36364514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisTag = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
36374514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thatTag = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
36384514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> locales = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
36394514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> options = GetHArg<JSTaggedValue>(argv, argc, 3);  // 3: means the third parameter
36404514f5e3Sopenharmony_ci
36414514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObj(JSTaggedValue::RequireObjectCoercible(thread, thisTag));
36424514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
36434514f5e3Sopenharmony_ci    [[maybe_unused]] JSHandle<EcmaString> thisHandle = JSTaggedValue::ToString(thread, thisObj);
36444514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
36454514f5e3Sopenharmony_ci    [[maybe_unused]] JSHandle<EcmaString> thatHandle = JSTaggedValue::ToString(thread, thatTag);
36464514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
36474514f5e3Sopenharmony_ci
36484514f5e3Sopenharmony_ci    return builtins::BuiltinsString::DoLocaleCompare(thread, thisHandle, thatHandle, locales, options).GetRawData();
36494514f5e3Sopenharmony_ci}
36504514f5e3Sopenharmony_ci
36514514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ArraySort)
36524514f5e3Sopenharmony_ci{
36534514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ArraySort);
36544514f5e3Sopenharmony_ci
36554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisHandle = GetHArg<JSTaggedValue>(argv, argc, 0);
36564514f5e3Sopenharmony_ci    return RuntimeArraySort(thread, thisHandle).GetRawData();
36574514f5e3Sopenharmony_ci}
36584514f5e3Sopenharmony_ci
36594514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::RuntimeArraySort(JSThread *thread, JSHandle<JSTaggedValue> thisHandle)
36604514f5e3Sopenharmony_ci{
36614514f5e3Sopenharmony_ci    // 1. Let obj be ToObject(this value).
36624514f5e3Sopenharmony_ci    JSHandle<JSObject> thisObjHandle = JSTaggedValue::ToObject(thread, thisHandle);
36634514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception());
36644514f5e3Sopenharmony_ci
36654514f5e3Sopenharmony_ci    // 2. Let len be ToLength(Get(obj, "length")).
36664514f5e3Sopenharmony_ci    int64_t len = ArrayHelper::GetArrayLength(thread, JSHandle<JSTaggedValue>(thisObjHandle));
36674514f5e3Sopenharmony_ci    // 3. ReturnIfAbrupt(len).
36684514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception());
36694514f5e3Sopenharmony_ci    JSHandle<JSHClass> hclass(thread, thisObjHandle->GetClass());
36704514f5e3Sopenharmony_ci    if (!hclass->IsDictionaryElement()) {
36714514f5e3Sopenharmony_ci        JSHandle<TaggedArray> elements(thread, thisObjHandle->GetElements());
36724514f5e3Sopenharmony_ci        // remove elements number check with pgo later and add int fast path at the same time
36734514f5e3Sopenharmony_ci        if (len <= elements->GetLength() && CheckElementsNumber(elements, len)) {
36744514f5e3Sopenharmony_ci            return ArrayNumberSort(thread, thisObjHandle, len);
36754514f5e3Sopenharmony_ci        }
36764514f5e3Sopenharmony_ci    }
36774514f5e3Sopenharmony_ci
36784514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> callbackFnHandle(thread, JSTaggedValue::Undefined());
36794514f5e3Sopenharmony_ci    JSArray::Sort(thread, JSHandle<JSTaggedValue>::Cast(thisObjHandle), callbackFnHandle);
36804514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception());
36814514f5e3Sopenharmony_ci    return thisObjHandle.GetTaggedValue();
36824514f5e3Sopenharmony_ci}
36834514f5e3Sopenharmony_ci
36844514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(HClassCloneWithAddProto)
36854514f5e3Sopenharmony_ci{
36864514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(HClassCloneWithAddProto);
36874514f5e3Sopenharmony_ci    JSHandle<JSHClass> jshclass = GetHArg<JSHClass>(argv, argc, 0);            // 0: means the zeroth parameter
36884514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);       // 1: means the first parameter
36894514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> proto = GetHArg<JSTaggedValue>(argv, argc, 2);     // 2: means the second parameter
36904514f5e3Sopenharmony_ci    return JSHClass::CloneWithAddProto(thread, jshclass, key, proto).GetTaggedValue().GetRawData();
36914514f5e3Sopenharmony_ci}
36924514f5e3Sopenharmony_ci
36934514f5e3Sopenharmony_civoid RuntimeStubs::StartCallTimer(uintptr_t argGlue, JSTaggedType func, bool isAot)
36944514f5e3Sopenharmony_ci{
36954514f5e3Sopenharmony_ci    auto thread =  JSThread::GlueToJSThread(argGlue);
36964514f5e3Sopenharmony_ci    JSTaggedValue callTarget(func);
36974514f5e3Sopenharmony_ci    Method *method = Method::Cast(JSFunction::Cast(callTarget)->GetMethod());
36984514f5e3Sopenharmony_ci    if (method->IsNativeWithCallField()) {
36994514f5e3Sopenharmony_ci        return;
37004514f5e3Sopenharmony_ci    }
37014514f5e3Sopenharmony_ci    size_t methodId = method->GetMethodId().GetOffset();
37024514f5e3Sopenharmony_ci    auto callTimer = thread->GetEcmaVM()->GetCallTimer();
37034514f5e3Sopenharmony_ci    callTimer->InitialStatAndTimer(method, methodId, isAot);
37044514f5e3Sopenharmony_ci    callTimer->StartCount(methodId, isAot);
37054514f5e3Sopenharmony_ci}
37064514f5e3Sopenharmony_ci
37074514f5e3Sopenharmony_civoid RuntimeStubs::EndCallTimer(uintptr_t argGlue, JSTaggedType func)
37084514f5e3Sopenharmony_ci{
37094514f5e3Sopenharmony_ci    auto thread =  JSThread::GlueToJSThread(argGlue);
37104514f5e3Sopenharmony_ci    JSTaggedValue callTarget(func);
37114514f5e3Sopenharmony_ci    Method *method = Method::Cast(JSFunction::Cast(callTarget)->GetMethod());
37124514f5e3Sopenharmony_ci    if (method->IsNativeWithCallField()) {
37134514f5e3Sopenharmony_ci        return;
37144514f5e3Sopenharmony_ci    }
37154514f5e3Sopenharmony_ci    auto callTimer = thread->GetEcmaVM()->GetCallTimer();
37164514f5e3Sopenharmony_ci    callTimer->StopCount(method);
37174514f5e3Sopenharmony_ci}
37184514f5e3Sopenharmony_ci
37194514f5e3Sopenharmony_ciint32_t RuntimeStubs::StringGetStart(bool isUtf8, EcmaString *srcString, int32_t length, int32_t startIndex)
37204514f5e3Sopenharmony_ci{
37214514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
37224514f5e3Sopenharmony_ci    if (isUtf8) {
37234514f5e3Sopenharmony_ci        Span<const uint8_t> data(EcmaStringAccessor(srcString).GetDataUtf8() + startIndex, length);
37244514f5e3Sopenharmony_ci        return static_cast<int32_t>(base::StringHelper::GetStart(data, length));
37254514f5e3Sopenharmony_ci    } else {
37264514f5e3Sopenharmony_ci        Span<const uint16_t> data(EcmaStringAccessor(srcString).GetDataUtf16() + startIndex, length);
37274514f5e3Sopenharmony_ci        return static_cast<int32_t>(base::StringHelper::GetStart(data, length));
37284514f5e3Sopenharmony_ci    }
37294514f5e3Sopenharmony_ci}
37304514f5e3Sopenharmony_ci
37314514f5e3Sopenharmony_ciint32_t RuntimeStubs::StringGetEnd(bool isUtf8, EcmaString *srcString,
37324514f5e3Sopenharmony_ci    int32_t start, int32_t length, int32_t startIndex)
37334514f5e3Sopenharmony_ci{
37344514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
37354514f5e3Sopenharmony_ci    if (isUtf8) {
37364514f5e3Sopenharmony_ci        Span<const uint8_t> data(EcmaStringAccessor(srcString).GetDataUtf8() + startIndex, length);
37374514f5e3Sopenharmony_ci        return base::StringHelper::GetEnd(data, start, length);
37384514f5e3Sopenharmony_ci    } else {
37394514f5e3Sopenharmony_ci        Span<const uint16_t> data(EcmaStringAccessor(srcString).GetDataUtf16() + startIndex, length);
37404514f5e3Sopenharmony_ci        return base::StringHelper::GetEnd(data, start, length);
37414514f5e3Sopenharmony_ci    }
37424514f5e3Sopenharmony_ci}
37434514f5e3Sopenharmony_ci
37444514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(FastStringify)
37454514f5e3Sopenharmony_ci{
37464514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(FastStringify);
37474514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);
37484514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
37494514f5e3Sopenharmony_ci    base::JsonStringifier jsonStringifier(thread);
37504514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> result = jsonStringifier.Stringify(value, undefined, undefined);
37514514f5e3Sopenharmony_ci    return result.GetTaggedValue().GetRawData();
37524514f5e3Sopenharmony_ci}
37534514f5e3Sopenharmony_ci
37544514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetLinkedHash)
37554514f5e3Sopenharmony_ci{
37564514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetLinkedHash);
37574514f5e3Sopenharmony_ci    JSTaggedValue key = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
37584514f5e3Sopenharmony_ci    return JSTaggedValue(LinkedHash::Hash(thread, key)).GetRawData();
37594514f5e3Sopenharmony_ci}
37604514f5e3Sopenharmony_ci
37614514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LinkedHashMapComputeCapacity)
37624514f5e3Sopenharmony_ci{
37634514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LinkedHashMapComputeCapacity);
37644514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
37654514f5e3Sopenharmony_ci    return JSTaggedValue(LinkedHashMap::ComputeCapacity(value.GetInt())).GetRawData();
37664514f5e3Sopenharmony_ci}
37674514f5e3Sopenharmony_ci
37684514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LinkedHashSetComputeCapacity)
37694514f5e3Sopenharmony_ci{
37704514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LinkedHashSetComputeCapacity);
37714514f5e3Sopenharmony_ci    JSTaggedValue value = GetArg(argv, argc, 0);  // 0: means the zeroth parameter
37724514f5e3Sopenharmony_ci    return JSTaggedValue(LinkedHashSet::ComputeCapacity(value.GetInt())).GetRawData();
37734514f5e3Sopenharmony_ci}
37744514f5e3Sopenharmony_ci
37754514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ObjectSlowAssign)
37764514f5e3Sopenharmony_ci{
37774514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ObjectSlowAssign);
37784514f5e3Sopenharmony_ci    JSHandle<JSObject> toAssign = GetHArg<JSObject>(argv, argc, 0);            // 0: means the zeroth parameter
37794514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> source = GetHArg<JSTaggedValue>(argv, argc, 1);    // 1: means the first parameter
37804514f5e3Sopenharmony_ci    return builtins::BuiltinsObject::AssignTaggedValue(thread, source, toAssign).GetRawData();
37814514f5e3Sopenharmony_ci}
37824514f5e3Sopenharmony_ci
37834514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NameDictionaryGetAllEnumKeys)
37844514f5e3Sopenharmony_ci{
37854514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NameDictionaryGetAllEnumKeys);
37864514f5e3Sopenharmony_ci    JSHandle<JSObject> object = GetHArg<JSObject>(argv, argc, 0);            // 0: means the zeroth parameter
37874514f5e3Sopenharmony_ci    JSTaggedValue argKeys = GetArg(argv, argc, 1);    // 1: means the first parameter
37884514f5e3Sopenharmony_ci    int numOfKeys = argKeys.GetInt();
37894514f5e3Sopenharmony_ci    uint32_t keys = 0;
37904514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
37914514f5e3Sopenharmony_ci    JSHandle<TaggedArray> keyArray = factory->NewTaggedArray(numOfKeys);
37924514f5e3Sopenharmony_ci    NameDictionary *dict = NameDictionary::Cast(object->GetProperties().GetTaggedObject());
37934514f5e3Sopenharmony_ci    dict->GetAllEnumKeys(thread, 0, keyArray, &keys);
37944514f5e3Sopenharmony_ci    if (keys < keyArray->GetLength()) {
37954514f5e3Sopenharmony_ci        keyArray->Trim(thread, keys);
37964514f5e3Sopenharmony_ci    }
37974514f5e3Sopenharmony_ci    return keyArray.GetTaggedValue().GetRawData();
37984514f5e3Sopenharmony_ci}
37994514f5e3Sopenharmony_ci
38004514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NumberDictionaryGetAllEnumKeys)
38014514f5e3Sopenharmony_ci{
38024514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NumberDictionaryGetAllEnumKeys);
38034514f5e3Sopenharmony_ci    JSHandle<TaggedArray> array = GetHArg<TaggedArray>(argv, argc, 0);  // 0: means the zeroth parameter
38044514f5e3Sopenharmony_ci    JSHandle<TaggedArray> elementArray = GetHArg<TaggedArray>(argv, argc, 1);  // 1: means the first parameter
38054514f5e3Sopenharmony_ci    JSTaggedValue argKeys = GetArg(argv, argc, 2);  // 2: means the second parameter
38064514f5e3Sopenharmony_ci    int elementIndex = argKeys.GetInt();
38074514f5e3Sopenharmony_ci    uint32_t keys = elementIndex;
38084514f5e3Sopenharmony_ci    NumberDictionary::GetAllEnumKeys(
38094514f5e3Sopenharmony_ci        thread, JSHandle<NumberDictionary>(array), elementIndex, elementArray, &keys);
38104514f5e3Sopenharmony_ci    if (keys < elementArray->GetLength()) {
38114514f5e3Sopenharmony_ci        elementArray->Trim(thread, keys);
38124514f5e3Sopenharmony_ci    }
38134514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
38144514f5e3Sopenharmony_ci}
38154514f5e3Sopenharmony_ci
38164514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(NumberToString)
38174514f5e3Sopenharmony_ci{
38184514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(NumberToString);
38194514f5e3Sopenharmony_ci    JSTaggedValue argKeys = GetArg(argv, argc, 0);
38204514f5e3Sopenharmony_ci    return JSHandle<JSTaggedValue>::Cast(base::NumberHelper::NumberToString(thread,
38214514f5e3Sopenharmony_ci        argKeys)).GetTaggedValue().GetRawData();
38224514f5e3Sopenharmony_ci}
38234514f5e3Sopenharmony_ci
38244514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(IntToString)
38254514f5e3Sopenharmony_ci{
38264514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(IntToString);
38274514f5e3Sopenharmony_ci    JSTaggedValue argKeys = GetArg(argv, argc, 0);
38284514f5e3Sopenharmony_ci    return JSHandle<JSTaggedValue>::Cast(base::NumberHelper::IntToEcmaString(thread,
38294514f5e3Sopenharmony_ci        argKeys.GetInt())).GetTaggedValue().GetRawData();
38304514f5e3Sopenharmony_ci}
38314514f5e3Sopenharmony_ci
38324514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LocaleCompareWithGc)
38334514f5e3Sopenharmony_ci{
38344514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LocaleCompareWithGc);
38354514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> locales = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
38364514f5e3Sopenharmony_ci    JSHandle<EcmaString> thisHandle = GetHArg<EcmaString>(argv, argc, 1);    // 1: means the first parameter
38374514f5e3Sopenharmony_ci    JSHandle<EcmaString> thatHandle = GetHArg<EcmaString>(argv, argc, 2);    // 2: means the second parameter
38384514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> options = GetHArg<JSTaggedValue>(argv, argc, 3); // 3: means the third parameter
38394514f5e3Sopenharmony_ci    bool cacheable = options->IsUndefined() && (locales->IsUndefined() || locales->IsString());
38404514f5e3Sopenharmony_ci    const CompareStringsOption csOption = JSCollator::CompareStringsOptionFor(thread, locales, options);
38414514f5e3Sopenharmony_ci    return builtins::BuiltinsString::LocaleCompareGC(thread, thisHandle, thatHandle, locales,
38424514f5e3Sopenharmony_ci        options, csOption, cacheable).GetRawData();
38434514f5e3Sopenharmony_ci}
38444514f5e3Sopenharmony_ci
38454514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ParseInt)
38464514f5e3Sopenharmony_ci{
38474514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ParseInt);
38484514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> msg = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
38494514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> arg2 = GetHArg<JSTaggedValue>(argv, argc, 1);    // 1: means the first parameter
38504514f5e3Sopenharmony_ci
38514514f5e3Sopenharmony_ci    int32_t radix = 0;
38524514f5e3Sopenharmony_ci    // 1. Let inputString be ToString(string).
38534514f5e3Sopenharmony_ci    JSHandle<EcmaString> numberString = JSTaggedValue::ToString(thread, msg);
38544514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
38554514f5e3Sopenharmony_ci    if (!arg2->IsUndefined()) {
38564514f5e3Sopenharmony_ci        // 7. Let R = ToInt32(radix).
38574514f5e3Sopenharmony_ci        radix = JSTaggedValue::ToInt32(thread, arg2);
38584514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
38594514f5e3Sopenharmony_ci    }
38604514f5e3Sopenharmony_ci
38614514f5e3Sopenharmony_ci    return base::NumberHelper::StringToNumber(*numberString, radix).GetRawData();
38624514f5e3Sopenharmony_ci}
38634514f5e3Sopenharmony_ci
38644514f5e3Sopenharmony_ciint RuntimeStubs::FastArraySort(JSTaggedType x, JSTaggedType y)
38654514f5e3Sopenharmony_ci{
38664514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
38674514f5e3Sopenharmony_ci    return JSTaggedValue::IntLexicographicCompare(JSTaggedValue(x), JSTaggedValue(y));
38684514f5e3Sopenharmony_ci}
38694514f5e3Sopenharmony_ci
38704514f5e3Sopenharmony_ciint RuntimeStubs::FastArraySortString(uintptr_t argGlue, JSTaggedValue x, JSTaggedValue y)
38714514f5e3Sopenharmony_ci{
38724514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
38734514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
38744514f5e3Sopenharmony_ci    JSHandle<EcmaString> valueX(thread, x);
38754514f5e3Sopenharmony_ci    JSHandle<EcmaString> valueY(thread, y);
38764514f5e3Sopenharmony_ci    return static_cast<int>(EcmaStringAccessor::Compare(thread->GetEcmaVM(), valueX, valueY));
38774514f5e3Sopenharmony_ci}
38784514f5e3Sopenharmony_ci
38794514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(LocaleCompareCacheable)
38804514f5e3Sopenharmony_ci{
38814514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(LocaleCompareCacheable);
38824514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> locales = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
38834514f5e3Sopenharmony_ci    JSHandle<EcmaString> thisHandle = GetHArg<EcmaString>(argv, argc, 1);    // 1: means the first parameter
38844514f5e3Sopenharmony_ci    JSHandle<EcmaString> thatHandle = GetHArg<EcmaString>(argv, argc, 2);    // 2: means the second parameter
38854514f5e3Sopenharmony_ci    auto collator = JSCollator::GetCachedIcuCollator(thread, locales);
38864514f5e3Sopenharmony_ci    JSTaggedValue result = JSTaggedValue::Undefined();
38874514f5e3Sopenharmony_ci    if (collator != nullptr) {
38884514f5e3Sopenharmony_ci        [[maybe_unused]]const CompareStringsOption csOption = JSCollator::CompareStringsOptionFor(
38894514f5e3Sopenharmony_ci            thread, locales);
38904514f5e3Sopenharmony_ci        result = JSCollator::CompareStrings(thread, collator, thisHandle, thatHandle, csOption);
38914514f5e3Sopenharmony_ci    }
38924514f5e3Sopenharmony_ci    return result.GetRawData();
38934514f5e3Sopenharmony_ci}
38944514f5e3Sopenharmony_ci
38954514f5e3Sopenharmony_ciJSTaggedValue RuntimeStubs::StringToNumber(JSTaggedType numberString, int32_t radix)
38964514f5e3Sopenharmony_ci{
38974514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
38984514f5e3Sopenharmony_ci    auto input = EcmaString::Cast(JSTaggedValue(numberString));
38994514f5e3Sopenharmony_ci    return base::NumberHelper::StringToNumber(input, radix);
39004514f5e3Sopenharmony_ci}
39014514f5e3Sopenharmony_ci
39024514f5e3Sopenharmony_civoid RuntimeStubs::ArrayTrim(uintptr_t argGlue, TaggedArray *array, int64_t newLength)
39034514f5e3Sopenharmony_ci{
39044514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
39054514f5e3Sopenharmony_ci    uint32_t length = static_cast<uint32_t>(newLength);
39064514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
39074514f5e3Sopenharmony_ci    array->Trim(thread, length);
39084514f5e3Sopenharmony_ci}
39094514f5e3Sopenharmony_ci
39104514f5e3Sopenharmony_cibool RuntimeStubs::IsFastRegExp(uintptr_t argGlue, JSTaggedValue thisValue)
39114514f5e3Sopenharmony_ci{
39124514f5e3Sopenharmony_ci    DISALLOW_GARBAGE_COLLECTION;
39134514f5e3Sopenharmony_ci    auto thread = JSThread::GlueToJSThread(argGlue);
39144514f5e3Sopenharmony_ci    [[maybe_unused]] EcmaHandleScope handleScope(thread);
39154514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObjVal(thread, thisValue);
39164514f5e3Sopenharmony_ci    return builtins::BuiltinsRegExp::IsFastRegExp(thread, thisObjVal);
39174514f5e3Sopenharmony_ci}
39184514f5e3Sopenharmony_ci
39194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ArrayForEachContinue)
39204514f5e3Sopenharmony_ci{
39214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ArrayForEachContinue);
39224514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArgHandle = GetHArg<JSTaggedValue>(argv, argc, 0);      // 0: means the zeroth parameter
39234514f5e3Sopenharmony_ci    JSMutableHandle<JSTaggedValue> key(thread, GetHArg<JSTaggedValue>(argv, argc, 1));  // 1: means the first parameter
39244514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisObjVal = GetHArg<JSTaggedValue>(argv, argc, 2);         // 2: means the second parameter
39254514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> callbackFnHandle = GetHArg<JSTaggedValue>(argv, argc, 3);   // 3: means the third parameter
39264514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> lengthHandle = GetHArg<JSTaggedValue>(argv, argc, 4);       // 4: means the fourth parameter
39274514f5e3Sopenharmony_ci    const uint32_t argsLength = 3; // 3: «kValue, k, O»
39284514f5e3Sopenharmony_ci    uint32_t i = static_cast<uint32_t>(key->GetInt());
39294514f5e3Sopenharmony_ci    uint32_t len = static_cast<uint32_t>(lengthHandle->GetInt());
39304514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
39314514f5e3Sopenharmony_ci    while (i < len) {
39324514f5e3Sopenharmony_ci        bool exists = JSTaggedValue::HasProperty(thread, thisObjVal, i);
39334514f5e3Sopenharmony_ci        RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
39344514f5e3Sopenharmony_ci        if (exists) {
39354514f5e3Sopenharmony_ci            JSHandle<JSTaggedValue> kValue = JSArray::FastGetPropertyByValue(thread, thisObjVal, i);
39364514f5e3Sopenharmony_ci            key.Update(JSTaggedValue(i));
39374514f5e3Sopenharmony_ci            RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
39384514f5e3Sopenharmony_ci            EcmaRuntimeCallInfo *info =
39394514f5e3Sopenharmony_ci                EcmaInterpreter::NewRuntimeCallInfo(thread, callbackFnHandle, thisArgHandle, undefined, argsLength);
39404514f5e3Sopenharmony_ci            RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
39414514f5e3Sopenharmony_ci            info->SetCallArg(kValue.GetTaggedValue(), key.GetTaggedValue(), thisObjVal.GetTaggedValue());
39424514f5e3Sopenharmony_ci            JSTaggedValue funcResult = JSFunction::Call(info);
39434514f5e3Sopenharmony_ci            RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, funcResult.GetRawData());
39444514f5e3Sopenharmony_ci        }
39454514f5e3Sopenharmony_ci        i++;
39464514f5e3Sopenharmony_ci    }
39474514f5e3Sopenharmony_ci
39484514f5e3Sopenharmony_ci    return JSTaggedValue::Undefined().GetRawData();
39494514f5e3Sopenharmony_ci}
39504514f5e3Sopenharmony_ci
39514514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(AOTEnableProtoChangeMarker)
39524514f5e3Sopenharmony_ci{
39534514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(AOTEnableProtoChangeMarker);
39544514f5e3Sopenharmony_ci    JSHandle<JSFunction> result(GetHArg<JSTaggedValue>(argv, argc, 0)); // 0: means the zeroth parameter
39554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> ihc = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
39564514f5e3Sopenharmony_ci    JSHandle<AOTLiteralInfo> aotLiteralInfo(GetHArg<JSTaggedValue>(argv, argc, 2)); // 2: means the second parameter
39574514f5e3Sopenharmony_ci    DefineFuncTryUseAOTHClass(thread, result, ihc, aotLiteralInfo);
39584514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
39594514f5e3Sopenharmony_ci}
39604514f5e3Sopenharmony_ci
39614514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetSharedModule)
39624514f5e3Sopenharmony_ci{
39634514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetSharedModule);
39644514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> module = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
39654514f5e3Sopenharmony_ci    ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager();
39664514f5e3Sopenharmony_ci    return moduleManager->GenerateSendableFuncModule(module).GetTaggedValue().GetRawData();
39674514f5e3Sopenharmony_ci}
39684514f5e3Sopenharmony_ci
39694514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(SetPrototypeTransition)
39704514f5e3Sopenharmony_ci{
39714514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(SetPrototypeTransition);
39724514f5e3Sopenharmony_ci    JSHandle<JSObject> obj = GetHArg<JSObject>(argv, argc, 0); // 0: means the zeroth parameter
39734514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> proto = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the third parameter
39744514f5e3Sopenharmony_ci    ElementsKind oldKind = obj->GetJSHClass()->GetElementsKind();
39754514f5e3Sopenharmony_ci    JSHClass::SetPrototypeTransition(thread, obj, proto);
39764514f5e3Sopenharmony_ci    JSObject::TryMigrateToGenericKindForJSObject(thread, obj, oldKind);
39774514f5e3Sopenharmony_ci    return JSTaggedValue::Hole().GetRawData();
39784514f5e3Sopenharmony_ci}
39794514f5e3Sopenharmony_ci
39804514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(HasProperty)
39814514f5e3Sopenharmony_ci{
39824514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(HasProperty);
39834514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> obj = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
39844514f5e3Sopenharmony_ci    JSTaggedValue indexValue = GetArg(argv, argc, 1);  // 1: means the first parameter
39854514f5e3Sopenharmony_ci    uint32_t index = static_cast<uint32_t>(indexValue.GetInt());
39864514f5e3Sopenharmony_ci    bool res = JSTaggedValue::HasProperty(thread, obj, index);
39874514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::Exception().GetRawData());
39884514f5e3Sopenharmony_ci    return JSTaggedValue(res).GetRawData();
39894514f5e3Sopenharmony_ci}
39904514f5e3Sopenharmony_ci
39914514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ObjectPrototypeHasOwnProperty)
39924514f5e3Sopenharmony_ci{
39934514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ObjectPrototypeHasOwnProperty);
39944514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisValue = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
39954514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
39964514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsObject::HasOwnPropertyInternal(thread, thisValue, key);
39974514f5e3Sopenharmony_ci    return result.GetRawData();
39984514f5e3Sopenharmony_ci}
39994514f5e3Sopenharmony_ci
40004514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ReflectHas)
40014514f5e3Sopenharmony_ci{
40024514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ReflectHas);
40034514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40044514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
40054514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsReflect::ReflectHasInternal(thread, target, key);
40064514f5e3Sopenharmony_ci    return result.GetRawData();
40074514f5e3Sopenharmony_ci}
40084514f5e3Sopenharmony_ci
40094514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ReflectConstruct)
40104514f5e3Sopenharmony_ci{
40114514f5e3Sopenharmony_ci    // newTarget = target, args = []
40124514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ReflectConstruct);
40134514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40144514f5e3Sopenharmony_ci    JSHandle<TaggedArray> args = thread->GetEcmaVM()->GetFactory()->EmptyArray();
40154514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsReflect::ReflectConstructInternal(thread, target, args, target);
40164514f5e3Sopenharmony_ci    return result.GetRawData();
40174514f5e3Sopenharmony_ci}
40184514f5e3Sopenharmony_ci
40194514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(ReflectApply)
40204514f5e3Sopenharmony_ci{
40214514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(ReflectApply);
40224514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40234514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisValue = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
40244514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> argumentsList = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
40254514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsReflect::ReflectApplyInternal(thread, target, thisValue, argumentsList);
40264514f5e3Sopenharmony_ci    return result.GetRawData();
40274514f5e3Sopenharmony_ci}
40284514f5e3Sopenharmony_ci
40294514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(FunctionPrototypeApply)
40304514f5e3Sopenharmony_ci{
40314514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(FunctionPrototypeApply);
40324514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisFunc = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40334514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArg = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
40344514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> argArray = GetHArg<JSTaggedValue>(argv, argc, 2);  // 2: means the second parameter
40354514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsFunction::FunctionPrototypeApplyInternal(thread, thisFunc,
40364514f5e3Sopenharmony_ci                                                                                      thisArg, argArray);
40374514f5e3Sopenharmony_ci    return result.GetRawData();
40384514f5e3Sopenharmony_ci}
40394514f5e3Sopenharmony_ci
40404514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(FunctionPrototypeBind)
40414514f5e3Sopenharmony_ci{
40424514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(FunctionPrototypeBind);
40434514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> target = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40444514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArg = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
40454514f5e3Sopenharmony_ci    JSHandle<TaggedArray> argsArray = thread->GetEcmaVM()->GetFactory()->EmptyArray();
40464514f5e3Sopenharmony_ci    JSTaggedValue result = builtins::BuiltinsFunction::FunctionPrototypeBindInternal(thread, target,
40474514f5e3Sopenharmony_ci                                                                                     thisArg, argsArray);
40484514f5e3Sopenharmony_ci    return result.GetRawData();
40494514f5e3Sopenharmony_ci}
40504514f5e3Sopenharmony_ci
40514514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(FunctionPrototypeCall)
40524514f5e3Sopenharmony_ci{
40534514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(FunctionPrototypeCall);
40544514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisFunc = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40554514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> thisArg = GetHArg<JSTaggedValue>(argv, argc, 1);  // 1: means the first parameter
40564514f5e3Sopenharmony_ci    if (!thisFunc->IsCallable()) {
40574514f5e3Sopenharmony_ci        THROW_TYPE_ERROR_AND_RETURN(thread, "call target is not callable", JSTaggedValue::VALUE_EXCEPTION);
40584514f5e3Sopenharmony_ci    }
40594514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> undefined = thread->GlobalConstants()->GetHandledUndefined();
40604514f5e3Sopenharmony_ci    uint32_t argsLength = argc - 2;  // 2: thisFunc and thisArg
40614514f5e3Sopenharmony_ci    EcmaRuntimeCallInfo *info = EcmaInterpreter::NewRuntimeCallInfo(thread, thisFunc, thisArg, undefined, argsLength);
40624514f5e3Sopenharmony_ci    RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedValue::VALUE_EXCEPTION);
40634514f5e3Sopenharmony_ci    uint32_t index = 0;
40644514f5e3Sopenharmony_ci    for (uint32_t i = 2; i < argc; ++i) {  // 2: thisFunc and thisArg
40654514f5e3Sopenharmony_ci        JSTaggedValue arg = GetArg(argv, argc, i);
40664514f5e3Sopenharmony_ci        info->SetCallArg(index++, arg);
40674514f5e3Sopenharmony_ci    }
40684514f5e3Sopenharmony_ci    return JSFunction::Call(info).GetRawData();
40694514f5e3Sopenharmony_ci}
40704514f5e3Sopenharmony_ci
40714514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetCollationValueFromIcuCollator)
40724514f5e3Sopenharmony_ci{
40734514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetCollationValueFromIcuCollator);
40744514f5e3Sopenharmony_ci    JSHandle<JSCollator> collator = GetHArg<JSCollator>(argv, argc, 0);  // 0: means the zeroth parameter
40754514f5e3Sopenharmony_ci
40764514f5e3Sopenharmony_ci    UErrorCode status = U_ZERO_ERROR;
40774514f5e3Sopenharmony_ci    icu::Collator *icuCollator = collator->GetIcuCollator();
40784514f5e3Sopenharmony_ci    icu::Locale icu_locale(icuCollator->getLocale(ULOC_VALID_LOCALE, status));
40794514f5e3Sopenharmony_ci    std::string collation_value =
40804514f5e3Sopenharmony_ci        icu_locale.getUnicodeKeywordValue<std::string>("co", status);
40814514f5e3Sopenharmony_ci    if (collation_value != "search" && collation_value != "") {
40824514f5e3Sopenharmony_ci        return thread->GetEcmaVM()->GetFactory()->NewFromStdString(collation_value).GetTaggedValue().GetRawData();
40834514f5e3Sopenharmony_ci    }
40844514f5e3Sopenharmony_ci    return thread->GlobalConstants()->GetDefaultString().GetRawData();
40854514f5e3Sopenharmony_ci}
40864514f5e3Sopenharmony_ci
40874514f5e3Sopenharmony_ciDEF_RUNTIME_STUBS(GetAllFlagsInternal)
40884514f5e3Sopenharmony_ci{
40894514f5e3Sopenharmony_ci    RUNTIME_STUBS_HEADER(GetAllFlagsInternal);
40904514f5e3Sopenharmony_ci    ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
40914514f5e3Sopenharmony_ci
40924514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 0);  // 0: means the zeroth parameter
40934514f5e3Sopenharmony_ci    int64 bigFlagsStr = value->GetInt();
40944514f5e3Sopenharmony_ci    std::string strFlags = "";
40954514f5e3Sopenharmony_ci    strFlags.reserve(RegExpParser::FLAG_NUM);
40964514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_HASINDICES) {
40974514f5e3Sopenharmony_ci        strFlags += "d";
40984514f5e3Sopenharmony_ci    }
40994514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_GLOBAL) {
41004514f5e3Sopenharmony_ci        strFlags += "g";
41014514f5e3Sopenharmony_ci    }
41024514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_IGNORECASE) {
41034514f5e3Sopenharmony_ci        strFlags += "i";
41044514f5e3Sopenharmony_ci    }
41054514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_MULTILINE) {
41064514f5e3Sopenharmony_ci        strFlags += "m";
41074514f5e3Sopenharmony_ci    }
41084514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_DOTALL) {
41094514f5e3Sopenharmony_ci        strFlags += "s";
41104514f5e3Sopenharmony_ci    }
41114514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_UTF16) {
41124514f5e3Sopenharmony_ci        strFlags += "u";
41134514f5e3Sopenharmony_ci    }
41144514f5e3Sopenharmony_ci    if (bigFlagsStr & RegExpParser::FLAG_STICKY) {
41154514f5e3Sopenharmony_ci        strFlags += "y";
41164514f5e3Sopenharmony_ci    }
41174514f5e3Sopenharmony_ci    JSHandle<EcmaString> flagsString = factory->NewFromUtf8(std::string_view(strFlags));
41184514f5e3Sopenharmony_ci    return flagsString.GetTaggedValue().GetRawData();
41194514f5e3Sopenharmony_ci}
41204514f5e3Sopenharmony_ci
41214514f5e3Sopenharmony_civoid RuntimeStubs::Initialize(JSThread *thread)
41224514f5e3Sopenharmony_ci{
41234514f5e3Sopenharmony_ci#define DEF_RUNTIME_STUB(name) kungfu::RuntimeStubCSigns::ID_##name
41244514f5e3Sopenharmony_ci#define INITIAL_RUNTIME_FUNCTIONS(name) \
41254514f5e3Sopenharmony_ci    thread->RegisterRTInterface(DEF_RUNTIME_STUB(name), reinterpret_cast<uintptr_t>(name));
41264514f5e3Sopenharmony_ci    RUNTIME_STUB_WITHOUT_GC_LIST(INITIAL_RUNTIME_FUNCTIONS)
41274514f5e3Sopenharmony_ci    RUNTIME_STUB_WITH_GC_LIST(INITIAL_RUNTIME_FUNCTIONS)
41284514f5e3Sopenharmony_ci    TEST_RUNTIME_STUB_GC_LIST(INITIAL_RUNTIME_FUNCTIONS)
41294514f5e3Sopenharmony_ci#undef INITIAL_RUNTIME_FUNCTIONS
41304514f5e3Sopenharmony_ci#undef DEF_RUNTIME_STUB
41314514f5e3Sopenharmony_ci}
41324514f5e3Sopenharmony_ci
41334514f5e3Sopenharmony_ci#if defined(__clang__)
41344514f5e3Sopenharmony_ci#pragma clang diagnostic pop
41354514f5e3Sopenharmony_ci#elif defined(__GNUC__)
41364514f5e3Sopenharmony_ci#pragma GCC diagnostic pop
41374514f5e3Sopenharmony_ci#endif
41384514f5e3Sopenharmony_ci}  // namespace panda::ecmascript
4139