14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2021 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#ifndef ECMASCRIPT_BUILTINS_BUILTINS_ARK_TOOLS_H 174514f5e3Sopenharmony_ci#define ECMASCRIPT_BUILTINS_BUILTINS_ARK_TOOLS_H 184514f5e3Sopenharmony_ci 194514f5e3Sopenharmony_ci#include "ecmascript/base/builtins_base.h" 204514f5e3Sopenharmony_ci#include "ecmascript/js_thread.h" 214514f5e3Sopenharmony_ci 224514f5e3Sopenharmony_ci// List of functions in ArkTools, extension of ArkTS engine. 234514f5e3Sopenharmony_ci// V(name, func, length, stubIndex) 244514f5e3Sopenharmony_ci// where BuiltinsArkTools::func refers to the native implementation of ArkTools[name]. 254514f5e3Sopenharmony_ci// kungfu::BuiltinsStubCSigns::stubIndex refers to the builtin stub index, or INVALID if no stub available. 264514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_COMMON(V) \ 274514f5e3Sopenharmony_ci V("compareHClass", CompareHClass, 2, INVALID) \ 284514f5e3Sopenharmony_ci V("dumpHClass", DumpHClass, 1, INVALID) \ 294514f5e3Sopenharmony_ci V("excutePendingJob", ExcutePendingJob, 0, INVALID) \ 304514f5e3Sopenharmony_ci V("forceFullGC", ForceFullGC, 0, INVALID) \ 314514f5e3Sopenharmony_ci V("getHClass", GetHClass, 1, INVALID) \ 324514f5e3Sopenharmony_ci V("getLexicalEnv", GetLexicalEnv, 1, INVALID) \ 334514f5e3Sopenharmony_ci V("isSlicedString", IsSlicedString, 1, INVALID) \ 344514f5e3Sopenharmony_ci V("hiddenStackSourceFile", HiddenStackSourceFile, 0, INVALID) \ 354514f5e3Sopenharmony_ci V("hintGC", HintGC, 0, INVALID) \ 364514f5e3Sopenharmony_ci V("isNotHoleProperty", IsNotHoleProperty, 2, INVALID) \ 374514f5e3Sopenharmony_ci V("isPrototype", IsPrototype, 1, INVALID) \ 384514f5e3Sopenharmony_ci V("isRegExpReplaceDetectorValid", IsRegExpReplaceDetectorValid, 0, INVALID) \ 394514f5e3Sopenharmony_ci V("isRegExpFlagsDetectorValid", IsRegExpFlagsDetectorValid, 0, INVALID) \ 404514f5e3Sopenharmony_ci V("isNumberStringNotRegexpLikeDetectorValid", IsNumberStringNotRegexpLikeDetectorValid, 0, INVALID) \ 414514f5e3Sopenharmony_ci V("isSymbolIteratorDetectorValid", IsSymbolIteratorDetectorValid, 1, INVALID) \ 424514f5e3Sopenharmony_ci V("isTSHClass", IsTSHClass, 1, INVALID) \ 434514f5e3Sopenharmony_ci V("pgoAssertType", PGOAssertType, 2, INVALID) \ 444514f5e3Sopenharmony_ci V("print", ObjectDump, 0, INVALID) \ 454514f5e3Sopenharmony_ci V("removeAOTFlag", RemoveAOTFlag, 1, INVALID) \ 464514f5e3Sopenharmony_ci V("timeInUs", TimeInUs, 0, INVALID) \ 474514f5e3Sopenharmony_ci V("getElementsKind", GetElementsKind, 1, INVALID) \ 484514f5e3Sopenharmony_ci V("isAOTCompiled", IsAOTCompiled, 1, INVALID) \ 494514f5e3Sopenharmony_ci V("isSameProfileTypeInfo", IsSameProfileTypeInfo, 2, INVALID) \ 504514f5e3Sopenharmony_ci V("isProfileTypeInfoValid", IsProfileTypeInfoValid, 1, INVALID) \ 514514f5e3Sopenharmony_ci V("isAOTDeoptimized", IsAOTDeoptimized, 1, INVALID) \ 524514f5e3Sopenharmony_ci V("printTypedOpProfiler", PrintTypedOpProfiler, 1, INVALID) \ 534514f5e3Sopenharmony_ci V("clearTypedOpProfiler", ClearTypedOpProfiler, 0, INVALID) \ 544514f5e3Sopenharmony_ci V("isOnHeap", IsOnHeap, 1, INVALID) \ 554514f5e3Sopenharmony_ci V("checkDeoptStatus", CheckDeoptStatus, 2, INVALID) \ 564514f5e3Sopenharmony_ci V("checkCircularImport", CheckCircularImport, 2, INVALID) \ 574514f5e3Sopenharmony_ci V("hashCode", HashCode, 1, ArkToolsHashCode) \ 584514f5e3Sopenharmony_ci V("startRuntimeStat", StartRuntimeStat, 0, INVALID) \ 594514f5e3Sopenharmony_ci V("stopRuntimeStat", StopRuntimeStat, 0, INVALID) \ 604514f5e3Sopenharmony_ci V("iterateFrame", IterateFrame, 0, INVALID) 614514f5e3Sopenharmony_ci 624514f5e3Sopenharmony_ci// List of mock ArkTools extension builtins 634514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_REGRESS(V) \ 644514f5e3Sopenharmony_ci V("prepareFunctionForOptimization", PrepareFunctionForOptimization, 1, INVALID) \ 654514f5e3Sopenharmony_ci V("optimizeFunctionOnNextCall", OptimizeFunctionOnNextCall, 1, INVALID) \ 664514f5e3Sopenharmony_ci V("optimizeMaglevOnNextCall", OptimizeMaglevOnNextCall, 1, INVALID) \ 674514f5e3Sopenharmony_ci V("deoptimizeFunction", DeoptimizeFunction, 1, INVALID) \ 684514f5e3Sopenharmony_ci V("optimizeOsr", OptimizeOsr, 1, INVALID) \ 694514f5e3Sopenharmony_ci V("neverOptimizeFunction", NeverOptimizeFunction, 1, INVALID) \ 704514f5e3Sopenharmony_ci V("heapObjectVerify", HeapObjectVerify, 1, INVALID) \ 714514f5e3Sopenharmony_ci V("disableOptimizationFinalization", DisableOptimizationFinalization, 0, INVALID) \ 724514f5e3Sopenharmony_ci V("deoptimizeNow", DeoptimizeNow, 0, INVALID) \ 734514f5e3Sopenharmony_ci V("deoptimize_now", DeoptimizeNow, 0, INVALID) \ 744514f5e3Sopenharmony_ci V("waitForBackgroundOptimization", WaitForBackgroundOptimization, 0, INVALID) \ 754514f5e3Sopenharmony_ci V("gc", Gc, 0, INVALID) \ 764514f5e3Sopenharmony_ci V("toLength", ToLength, 1, INVALID) \ 774514f5e3Sopenharmony_ci V("hasHoleyElements", HasHoleyElements, 1, INVALID) \ 784514f5e3Sopenharmony_ci V("hasDictionaryElements", HasDictionaryElements, 1, INVALID) \ 794514f5e3Sopenharmony_ci V("hasSmiElements", HasSmiElements, 1, INVALID) \ 804514f5e3Sopenharmony_ci V("hasDoubleElements", HasDoubleElements, 1, INVALID) \ 814514f5e3Sopenharmony_ci V("hasObjectElements", HasObjectElements, 1, INVALID) \ 824514f5e3Sopenharmony_ci V("arrayBufferDetach", ArrayBufferDetach, 1, INVALID) \ 834514f5e3Sopenharmony_ci V("haveSameMap", HaveSameMap, 2, INVALID) \ 844514f5e3Sopenharmony_ci V("isSameHeapObject", IsSameHeapObject, 2, INVALID) \ 854514f5e3Sopenharmony_ci V("isSmi", IsSmi, 1, INVALID) \ 864514f5e3Sopenharmony_ci V("createPrivateSymbol", CreatePrivateSymbol, 1, INVALID) \ 874514f5e3Sopenharmony_ci V("isArray", IsArray, 1, INVALID) \ 884514f5e3Sopenharmony_ci V("createDataProperty", CreateDataProperty, 3, INVALID) \ 894514f5e3Sopenharmony_ci V("functionGetInferredName", FunctionGetInferredName, 1, INVALID) \ 904514f5e3Sopenharmony_ci V("stringLessThan", StringLessThan, 2, INVALID) \ 914514f5e3Sopenharmony_ci V("stringMaxLength", StringMaxLength, 0, INVALID) \ 924514f5e3Sopenharmony_ci V("arrayBufferMaxByteLength", ArrayBufferMaxByteLength, 0, INVALID) \ 934514f5e3Sopenharmony_ci V("typedArrayMaxLength", TypedArrayMaxLength, 0, INVALID) \ 944514f5e3Sopenharmony_ci V("maxSmi", MaxSmi, 0, INVALID) \ 954514f5e3Sopenharmony_ci V("is64Bit", Is64Bit, 0, INVALID) \ 964514f5e3Sopenharmony_ci V("finalizeOptimization", FinalizeOptimization, 0, INVALID) \ 974514f5e3Sopenharmony_ci V("ensureFeedbackVectorForFunction", EnsureFeedbackVectorForFunction, 1, INVALID) \ 984514f5e3Sopenharmony_ci V("compileBaseline", CompileBaseline, 1, INVALID) \ 994514f5e3Sopenharmony_ci V("debugGetLoadedScriptIds", DebugGetLoadedScriptIds, 0, INVALID) \ 1004514f5e3Sopenharmony_ci V("toFastProperties", ToFastProperties, 1, INVALID) \ 1014514f5e3Sopenharmony_ci V("abortJS", AbortJS, 1, INVALID) \ 1024514f5e3Sopenharmony_ci V("internalizeString", InternalizeString, 1, INVALID) \ 1034514f5e3Sopenharmony_ci V("handleDebuggerStatement", HandleDebuggerStatement, 0, INVALID) \ 1044514f5e3Sopenharmony_ci V("setAllocationTimeout", SetAllocationTimeout, 0, INVALID) \ 1054514f5e3Sopenharmony_ci V("hasFastProperties", HasFastProperties, 1, INVALID) \ 1064514f5e3Sopenharmony_ci V("hasOwnConstDataProperty", HasOwnConstDataProperty, 2, INVALID) \ 1074514f5e3Sopenharmony_ci V("getHoleNaNUpper", GetHoleNaNUpper, 0, INVALID) \ 1084514f5e3Sopenharmony_ci V("getHoleNaNLower", GetHoleNaNLower, 0, INVALID) \ 1094514f5e3Sopenharmony_ci V("systemBreak", SystemBreak, 0, INVALID) \ 1104514f5e3Sopenharmony_ci V("scheduleBreak", ScheduleBreak, 0, INVALID) \ 1114514f5e3Sopenharmony_ci V("enqueueMicrotask", EnqueueMicrotask, 1, INVALID) \ 1124514f5e3Sopenharmony_ci V("debugPrint", DebugPrint, 1, INVALID) \ 1134514f5e3Sopenharmony_ci V("getOptimizationStatus", GetOptimizationStatus, 1, INVALID) \ 1144514f5e3Sopenharmony_ci V("getUndetectable", GetUndetectable, 0, INVALID) \ 1154514f5e3Sopenharmony_ci V("setKeyedProperty", SetKeyedProperty, 3, INVALID) \ 1164514f5e3Sopenharmony_ci V("disassembleFunction", DisassembleFunction, 1, INVALID) \ 1174514f5e3Sopenharmony_ci V("tryMigrateInstance", TryMigrateInstance, 1, INVALID) \ 1184514f5e3Sopenharmony_ci V("inLargeObjectSpace", InLargeObjectSpace, 1, INVALID) \ 1194514f5e3Sopenharmony_ci V("performMicrotaskCheckpoint", PerformMicrotaskCheckpoint, 0, INVALID) \ 1204514f5e3Sopenharmony_ci V("isJSReceiver", IsJSReceiver, 1, INVALID) \ 1214514f5e3Sopenharmony_ci V("isDictPropertyConstTrackingEnabled", IsDictPropertyConstTrackingEnabled, 1, INVALID) \ 1224514f5e3Sopenharmony_ci V("allocateHeapNumber", AllocateHeapNumber, 1, INVALID) \ 1234514f5e3Sopenharmony_ci V("constructConsString", ConstructConsString, 1, INVALID) \ 1244514f5e3Sopenharmony_ci V("completeInobjectSlackTracking", CompleteInobjectSlackTracking, 1, INVALID) \ 1254514f5e3Sopenharmony_ci V("normalizeElements", NormalizeElements, 1, INVALID) \ 1264514f5e3Sopenharmony_ci V("call", Call, 2, INVALID) \ 1274514f5e3Sopenharmony_ci V("debugPushPromise", DebugPushPromise, 1, INVALID) \ 1284514f5e3Sopenharmony_ci V("setForceSlowPath", SetForceSlowPath, 1, INVALID) \ 1294514f5e3Sopenharmony_ci V("notifyContextDisposed", NotifyContextDisposed, 0, INVALID) \ 1304514f5e3Sopenharmony_ci V("optimizeObjectForAddingMultipleProperties", OptimizeObjectForAddingMultipleProperties, 2, INVALID) \ 1314514f5e3Sopenharmony_ci V("isBeingInterpreted", IsBeingInterpreted, 0, INVALID) \ 1324514f5e3Sopenharmony_ci V("clearFunctionFeedback", ClearFunctionFeedback, 1, INVALID) \ 1334514f5e3Sopenharmony_ci V("inYoungSpace", InYoungSpace, 1, INVALID) \ 1344514f5e3Sopenharmony_ci V("inOldSpace", InOldSpace, 1, INVALID) 1354514f5e3Sopenharmony_ci 1364514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_JITCOMPILE(V) \ 1374514f5e3Sopenharmony_ci V("jitCompileSync", JitCompileSync, 1, INVALID) \ 1384514f5e3Sopenharmony_ci V("jitCompileAsync", JitCompileAsync, 1, INVALID) \ 1394514f5e3Sopenharmony_ci V("waitJitCompileFinish", WaitJitCompileFinish, 1, INVALID) \ 1404514f5e3Sopenharmony_ci V("waitAllJitCompileFinish", WaitAllJitCompileFinish, 0, INVALID) 1414514f5e3Sopenharmony_ci 1424514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_SCOPE_LOCK_STAT 1434514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_SCOPE_LOCK_STATS(V) \ 1444514f5e3Sopenharmony_ci V("startScopeLockStats", StartScopeLockStats, 0, INVALID) \ 1454514f5e3Sopenharmony_ci V("stopScopeLockStats", StopScopeLockStats, 0, INVALID) 1464514f5e3Sopenharmony_ci#else 1474514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_SCOPE_LOCK_STATS(V) // Nothing 1484514f5e3Sopenharmony_ci#endif 1494514f5e3Sopenharmony_ci 1504514f5e3Sopenharmony_ci#ifdef ECMASCRIPT_SUPPORT_CPUPROFILER 1514514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_CPUPROFILER(V) \ 1524514f5e3Sopenharmony_ci V("startCpuProf", StartCpuProfiler, 0, INVALID) \ 1534514f5e3Sopenharmony_ci V("stopCpuProf", StopCpuProfiler, 0, INVALID) 1544514f5e3Sopenharmony_ci#else 1554514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS_CPUPROFILER(V) // Nothing 1564514f5e3Sopenharmony_ci#endif 1574514f5e3Sopenharmony_ci 1584514f5e3Sopenharmony_ci#define BUILTIN_ARK_TOOLS_FUNCTIONS(V) \ 1594514f5e3Sopenharmony_ci BUILTIN_ARK_TOOLS_FUNCTIONS_COMMON(V) \ 1604514f5e3Sopenharmony_ci BUILTIN_ARK_TOOLS_FUNCTIONS_CPUPROFILER(V) \ 1614514f5e3Sopenharmony_ci BUILTIN_ARK_TOOLS_FUNCTIONS_REGRESS(V) \ 1624514f5e3Sopenharmony_ci BUILTIN_ARK_TOOLS_FUNCTIONS_SCOPE_LOCK_STATS(V) \ 1634514f5e3Sopenharmony_ci BUILTIN_ARK_TOOLS_FUNCTIONS_JITCOMPILE(V) 1644514f5e3Sopenharmony_ci 1654514f5e3Sopenharmony_cinamespace panda::ecmascript::builtins { 1664514f5e3Sopenharmony_ciclass BuiltinsArkTools : public base::BuiltinsBase { 1674514f5e3Sopenharmony_cipublic: 1684514f5e3Sopenharmony_ci // Make sure the enable-ark-tools and open-ark-tools has been opened before use it 1694514f5e3Sopenharmony_ci // Use through ArkTools.print(msg, [obj1, obj2, ... objn]) in js 1704514f5e3Sopenharmony_ci static JSTaggedValue ObjectDump(EcmaRuntimeCallInfo *info); 1714514f5e3Sopenharmony_ci 1724514f5e3Sopenharmony_ci static JSTaggedValue ExcutePendingJob(EcmaRuntimeCallInfo *info); 1734514f5e3Sopenharmony_ci 1744514f5e3Sopenharmony_ci static JSTaggedValue GetLexicalEnv(EcmaRuntimeCallInfo *info); 1754514f5e3Sopenharmony_ci 1764514f5e3Sopenharmony_ci static JSTaggedValue CompareHClass(EcmaRuntimeCallInfo *info); 1774514f5e3Sopenharmony_ci 1784514f5e3Sopenharmony_ci static JSTaggedValue DumpHClass(EcmaRuntimeCallInfo *info); 1794514f5e3Sopenharmony_ci 1804514f5e3Sopenharmony_ci // return whether the hclass used for object is created by static ts type 1814514f5e3Sopenharmony_ci static JSTaggedValue IsTSHClass(EcmaRuntimeCallInfo *info); 1824514f5e3Sopenharmony_ci 1834514f5e3Sopenharmony_ci static JSTaggedValue GetHClass(EcmaRuntimeCallInfo *info); 1844514f5e3Sopenharmony_ci 1854514f5e3Sopenharmony_ci static JSTaggedValue IsSlicedString(EcmaRuntimeCallInfo *info); 1864514f5e3Sopenharmony_ci 1874514f5e3Sopenharmony_ci static JSTaggedValue IsNotHoleProperty(EcmaRuntimeCallInfo *info); 1884514f5e3Sopenharmony_ci 1894514f5e3Sopenharmony_ci static JSTaggedValue ForcePartialGC(EcmaRuntimeCallInfo *info); 1904514f5e3Sopenharmony_ci 1914514f5e3Sopenharmony_ci static JSTaggedValue ForceFullGC(EcmaRuntimeCallInfo *info); 1924514f5e3Sopenharmony_ci 1934514f5e3Sopenharmony_ci static JSTaggedValue HintGC(EcmaRuntimeCallInfo *info); 1944514f5e3Sopenharmony_ci 1954514f5e3Sopenharmony_ci static JSTaggedValue HiddenStackSourceFile(EcmaRuntimeCallInfo *info); 1964514f5e3Sopenharmony_ci 1974514f5e3Sopenharmony_ci static JSTaggedValue RemoveAOTFlag(EcmaRuntimeCallInfo *info); 1984514f5e3Sopenharmony_ci 1994514f5e3Sopenharmony_ci static JSTaggedValue CheckCircularImport(EcmaRuntimeCallInfo *info); 2004514f5e3Sopenharmony_ci 2014514f5e3Sopenharmony_ci static JSTaggedValue HashCode(EcmaRuntimeCallInfo *info); 2024514f5e3Sopenharmony_ci 2034514f5e3Sopenharmony_ci#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER) 2044514f5e3Sopenharmony_ci static JSTaggedValue StartCpuProfiler(EcmaRuntimeCallInfo *info); 2054514f5e3Sopenharmony_ci 2064514f5e3Sopenharmony_ci static JSTaggedValue StopCpuProfiler(EcmaRuntimeCallInfo *info); 2074514f5e3Sopenharmony_ci 2084514f5e3Sopenharmony_ci static std::string GetProfileName(); 2094514f5e3Sopenharmony_ci 2104514f5e3Sopenharmony_ci static bool CreateFile(std::string &fileName); 2114514f5e3Sopenharmony_ci#endif 2124514f5e3Sopenharmony_ci // ArkTools.isPrototype(object) 2134514f5e3Sopenharmony_ci static JSTaggedValue IsPrototype(EcmaRuntimeCallInfo *info); 2144514f5e3Sopenharmony_ci 2154514f5e3Sopenharmony_ci // ArkTools.isAOTCompiledAssert(func) 2164514f5e3Sopenharmony_ci static JSTaggedValue IsAOTCompiled(EcmaRuntimeCallInfo *info); 2174514f5e3Sopenharmony_ci 2184514f5e3Sopenharmony_ci // ArkTools.isSameProfileTypeInfo(func1, func2) 2194514f5e3Sopenharmony_ci static JSTaggedValue IsSameProfileTypeInfo(EcmaRuntimeCallInfo *info); 2204514f5e3Sopenharmony_ci 2214514f5e3Sopenharmony_ci // ArkTools.isProfileTypeInfoValid(func) 2224514f5e3Sopenharmony_ci static JSTaggedValue IsProfileTypeInfoValid(EcmaRuntimeCallInfo *info); 2234514f5e3Sopenharmony_ci 2244514f5e3Sopenharmony_ci // ArkTools.isAOTCompiledAssert(func) 2254514f5e3Sopenharmony_ci static JSTaggedValue IsAOTDeoptimized(EcmaRuntimeCallInfo *info); 2264514f5e3Sopenharmony_ci 2274514f5e3Sopenharmony_ci // ArkTools.CheckDeoptStatus(func, deopt?) 2284514f5e3Sopenharmony_ci static JSTaggedValue CheckDeoptStatus(EcmaRuntimeCallInfo *info); 2294514f5e3Sopenharmony_ci 2304514f5e3Sopenharmony_ci // ArkTools.isOnHeap(object) 2314514f5e3Sopenharmony_ci static JSTaggedValue IsOnHeap(EcmaRuntimeCallInfo *info); 2324514f5e3Sopenharmony_ci 2334514f5e3Sopenharmony_ci // ArkTools.GetElementsKind(array) 2344514f5e3Sopenharmony_ci static JSTaggedValue GetElementsKind(EcmaRuntimeCallInfo *info); 2354514f5e3Sopenharmony_ci 2364514f5e3Sopenharmony_ci static JSTaggedValue PrintTypedOpProfiler(EcmaRuntimeCallInfo *info); 2374514f5e3Sopenharmony_ci 2384514f5e3Sopenharmony_ci static JSTaggedValue ClearTypedOpProfiler(EcmaRuntimeCallInfo *info); 2394514f5e3Sopenharmony_ci 2404514f5e3Sopenharmony_ci static JSTaggedValue IsRegExpReplaceDetectorValid(EcmaRuntimeCallInfo *info); 2414514f5e3Sopenharmony_ci 2424514f5e3Sopenharmony_ci static JSTaggedValue IsRegExpFlagsDetectorValid(EcmaRuntimeCallInfo *info); 2434514f5e3Sopenharmony_ci 2444514f5e3Sopenharmony_ci static JSTaggedValue IsNumberStringNotRegexpLikeDetectorValid(EcmaRuntimeCallInfo *info); 2454514f5e3Sopenharmony_ci 2464514f5e3Sopenharmony_ci static JSTaggedValue IsSymbolIteratorDetectorValid(EcmaRuntimeCallInfo *info); 2474514f5e3Sopenharmony_ci 2484514f5e3Sopenharmony_ci static JSTaggedValue TimeInUs(EcmaRuntimeCallInfo *info); 2494514f5e3Sopenharmony_ci 2504514f5e3Sopenharmony_ci#if ECMASCRIPT_ENABLE_SCOPE_LOCK_STAT 2514514f5e3Sopenharmony_ci static JSTaggedValue StartScopeLockStats(EcmaRuntimeCallInfo *info); 2524514f5e3Sopenharmony_ci 2534514f5e3Sopenharmony_ci static JSTaggedValue StopScopeLockStats(EcmaRuntimeCallInfo *info); 2544514f5e3Sopenharmony_ci#endif 2554514f5e3Sopenharmony_ci 2564514f5e3Sopenharmony_ci static JSTaggedValue PrepareFunctionForOptimization(EcmaRuntimeCallInfo *info); 2574514f5e3Sopenharmony_ci 2584514f5e3Sopenharmony_ci static JSTaggedValue OptimizeFunctionOnNextCall(EcmaRuntimeCallInfo *info); 2594514f5e3Sopenharmony_ci 2604514f5e3Sopenharmony_ci static JSTaggedValue OptimizeMaglevOnNextCall(EcmaRuntimeCallInfo *info); 2614514f5e3Sopenharmony_ci 2624514f5e3Sopenharmony_ci static JSTaggedValue DeoptimizeFunction(EcmaRuntimeCallInfo *info); 2634514f5e3Sopenharmony_ci 2644514f5e3Sopenharmony_ci static JSTaggedValue OptimizeOsr(EcmaRuntimeCallInfo *info); 2654514f5e3Sopenharmony_ci 2664514f5e3Sopenharmony_ci static JSTaggedValue NeverOptimizeFunction(EcmaRuntimeCallInfo *info); 2674514f5e3Sopenharmony_ci 2684514f5e3Sopenharmony_ci static JSTaggedValue HeapObjectVerify(EcmaRuntimeCallInfo *info); 2694514f5e3Sopenharmony_ci 2704514f5e3Sopenharmony_ci static JSTaggedValue DisableOptimizationFinalization(EcmaRuntimeCallInfo *info); 2714514f5e3Sopenharmony_ci 2724514f5e3Sopenharmony_ci static JSTaggedValue DeoptimizeNow(EcmaRuntimeCallInfo *info); 2734514f5e3Sopenharmony_ci 2744514f5e3Sopenharmony_ci static JSTaggedValue WaitForBackgroundOptimization(EcmaRuntimeCallInfo *info); 2754514f5e3Sopenharmony_ci 2764514f5e3Sopenharmony_ci static JSTaggedValue Gc(EcmaRuntimeCallInfo *info); 2774514f5e3Sopenharmony_ci 2784514f5e3Sopenharmony_ci static JSTaggedValue PGOAssertType(EcmaRuntimeCallInfo *info); 2794514f5e3Sopenharmony_ci 2804514f5e3Sopenharmony_ci static JSTaggedValue ToLength(EcmaRuntimeCallInfo *info); 2814514f5e3Sopenharmony_ci 2824514f5e3Sopenharmony_ci static JSTaggedValue HasHoleyElements(EcmaRuntimeCallInfo *info); 2834514f5e3Sopenharmony_ci 2844514f5e3Sopenharmony_ci static JSTaggedValue HasDictionaryElements(EcmaRuntimeCallInfo *info); 2854514f5e3Sopenharmony_ci 2864514f5e3Sopenharmony_ci static JSTaggedValue HasSmiElements(EcmaRuntimeCallInfo *info); 2874514f5e3Sopenharmony_ci 2884514f5e3Sopenharmony_ci static JSTaggedValue HasDoubleElements(EcmaRuntimeCallInfo *info); 2894514f5e3Sopenharmony_ci 2904514f5e3Sopenharmony_ci static JSTaggedValue HasObjectElements(EcmaRuntimeCallInfo *info); 2914514f5e3Sopenharmony_ci 2924514f5e3Sopenharmony_ci static JSTaggedValue ArrayBufferDetach(EcmaRuntimeCallInfo *info); 2934514f5e3Sopenharmony_ci 2944514f5e3Sopenharmony_ci static JSTaggedValue HaveSameMap(EcmaRuntimeCallInfo *info); 2954514f5e3Sopenharmony_ci 2964514f5e3Sopenharmony_ci static JSTaggedValue IsSameHeapObject(EcmaRuntimeCallInfo *info); 2974514f5e3Sopenharmony_ci 2984514f5e3Sopenharmony_ci static JSTaggedValue IsSmi(EcmaRuntimeCallInfo *info); 2994514f5e3Sopenharmony_ci 3004514f5e3Sopenharmony_ci static JSTaggedValue CreatePrivateSymbol(EcmaRuntimeCallInfo *info); 3014514f5e3Sopenharmony_ci 3024514f5e3Sopenharmony_ci static JSTaggedValue IsArray(EcmaRuntimeCallInfo *info); 3034514f5e3Sopenharmony_ci 3044514f5e3Sopenharmony_ci static JSTaggedValue CreateDataProperty(EcmaRuntimeCallInfo *info); 3054514f5e3Sopenharmony_ci 3064514f5e3Sopenharmony_ci static JSTaggedValue FunctionGetInferredName(EcmaRuntimeCallInfo *info); 3074514f5e3Sopenharmony_ci 3084514f5e3Sopenharmony_ci static JSTaggedValue StringLessThan(EcmaRuntimeCallInfo *info); 3094514f5e3Sopenharmony_ci 3104514f5e3Sopenharmony_ci static JSTaggedValue StringMaxLength(EcmaRuntimeCallInfo *info); 3114514f5e3Sopenharmony_ci 3124514f5e3Sopenharmony_ci static JSTaggedValue ArrayBufferMaxByteLength(EcmaRuntimeCallInfo *info); 3134514f5e3Sopenharmony_ci 3144514f5e3Sopenharmony_ci static JSTaggedValue TypedArrayMaxLength(EcmaRuntimeCallInfo *info); 3154514f5e3Sopenharmony_ci 3164514f5e3Sopenharmony_ci static JSTaggedValue MaxSmi(EcmaRuntimeCallInfo *info); 3174514f5e3Sopenharmony_ci 3184514f5e3Sopenharmony_ci static JSTaggedValue Is64Bit(EcmaRuntimeCallInfo *info); 3194514f5e3Sopenharmony_ci 3204514f5e3Sopenharmony_ci static JSTaggedValue FinalizeOptimization(EcmaRuntimeCallInfo *info); 3214514f5e3Sopenharmony_ci 3224514f5e3Sopenharmony_ci static JSTaggedValue EnsureFeedbackVectorForFunction(EcmaRuntimeCallInfo *info); 3234514f5e3Sopenharmony_ci 3244514f5e3Sopenharmony_ci static JSTaggedValue CompileBaseline(EcmaRuntimeCallInfo *info); 3254514f5e3Sopenharmony_ci 3264514f5e3Sopenharmony_ci static JSTaggedValue DebugGetLoadedScriptIds(EcmaRuntimeCallInfo *info); 3274514f5e3Sopenharmony_ci 3284514f5e3Sopenharmony_ci static JSTaggedValue ToFastProperties(EcmaRuntimeCallInfo *info); 3294514f5e3Sopenharmony_ci 3304514f5e3Sopenharmony_ci static JSTaggedValue AbortJS(EcmaRuntimeCallInfo *info); 3314514f5e3Sopenharmony_ci 3324514f5e3Sopenharmony_ci static JSTaggedValue InternalizeString(EcmaRuntimeCallInfo *info); 3334514f5e3Sopenharmony_ci 3344514f5e3Sopenharmony_ci static JSTaggedValue HandleDebuggerStatement(EcmaRuntimeCallInfo *info); 3354514f5e3Sopenharmony_ci 3364514f5e3Sopenharmony_ci static JSTaggedValue SetAllocationTimeout(EcmaRuntimeCallInfo *info); 3374514f5e3Sopenharmony_ci 3384514f5e3Sopenharmony_ci static JSTaggedValue HasFastProperties(EcmaRuntimeCallInfo *info); 3394514f5e3Sopenharmony_ci 3404514f5e3Sopenharmony_ci static JSTaggedValue HasOwnConstDataProperty(EcmaRuntimeCallInfo *info); 3414514f5e3Sopenharmony_ci 3424514f5e3Sopenharmony_ci static JSTaggedValue GetHoleNaNUpper(EcmaRuntimeCallInfo *info); 3434514f5e3Sopenharmony_ci 3444514f5e3Sopenharmony_ci static JSTaggedValue GetHoleNaNLower(EcmaRuntimeCallInfo *info); 3454514f5e3Sopenharmony_ci 3464514f5e3Sopenharmony_ci static JSTaggedValue SystemBreak(EcmaRuntimeCallInfo *info); 3474514f5e3Sopenharmony_ci 3484514f5e3Sopenharmony_ci static JSTaggedValue ScheduleBreak(EcmaRuntimeCallInfo *info); 3494514f5e3Sopenharmony_ci 3504514f5e3Sopenharmony_ci static JSTaggedValue EnqueueMicrotask(EcmaRuntimeCallInfo *info); 3514514f5e3Sopenharmony_ci 3524514f5e3Sopenharmony_ci static JSTaggedValue DebugPrint(EcmaRuntimeCallInfo *info); 3534514f5e3Sopenharmony_ci 3544514f5e3Sopenharmony_ci static JSTaggedValue GetOptimizationStatus(EcmaRuntimeCallInfo *info); 3554514f5e3Sopenharmony_ci 3564514f5e3Sopenharmony_ci static JSTaggedValue GetUndetectable(EcmaRuntimeCallInfo *info); 3574514f5e3Sopenharmony_ci 3584514f5e3Sopenharmony_ci static JSTaggedValue SetKeyedProperty(EcmaRuntimeCallInfo *info); 3594514f5e3Sopenharmony_ci 3604514f5e3Sopenharmony_ci static JSTaggedValue DisassembleFunction(EcmaRuntimeCallInfo *info); 3614514f5e3Sopenharmony_ci 3624514f5e3Sopenharmony_ci static JSTaggedValue TryMigrateInstance(EcmaRuntimeCallInfo *info); 3634514f5e3Sopenharmony_ci 3644514f5e3Sopenharmony_ci static JSTaggedValue InLargeObjectSpace(EcmaRuntimeCallInfo *info); 3654514f5e3Sopenharmony_ci 3664514f5e3Sopenharmony_ci static JSTaggedValue PerformMicrotaskCheckpoint(EcmaRuntimeCallInfo *info); 3674514f5e3Sopenharmony_ci 3684514f5e3Sopenharmony_ci static JSTaggedValue IsJSReceiver(EcmaRuntimeCallInfo *info); 3694514f5e3Sopenharmony_ci 3704514f5e3Sopenharmony_ci static JSTaggedValue IsDictPropertyConstTrackingEnabled(EcmaRuntimeCallInfo *info); 3714514f5e3Sopenharmony_ci 3724514f5e3Sopenharmony_ci static JSTaggedValue AllocateHeapNumber(EcmaRuntimeCallInfo *info); 3734514f5e3Sopenharmony_ci 3744514f5e3Sopenharmony_ci static JSTaggedValue ConstructConsString(EcmaRuntimeCallInfo *info); 3754514f5e3Sopenharmony_ci 3764514f5e3Sopenharmony_ci static JSTaggedValue CompleteInobjectSlackTracking(EcmaRuntimeCallInfo *info); 3774514f5e3Sopenharmony_ci 3784514f5e3Sopenharmony_ci static JSTaggedValue NormalizeElements(EcmaRuntimeCallInfo *info); 3794514f5e3Sopenharmony_ci 3804514f5e3Sopenharmony_ci static JSTaggedValue Call(EcmaRuntimeCallInfo *info); 3814514f5e3Sopenharmony_ci 3824514f5e3Sopenharmony_ci static JSTaggedValue DebugPushPromise(EcmaRuntimeCallInfo *info); 3834514f5e3Sopenharmony_ci 3844514f5e3Sopenharmony_ci static JSTaggedValue SetForceSlowPath(EcmaRuntimeCallInfo *info); 3854514f5e3Sopenharmony_ci 3864514f5e3Sopenharmony_ci static JSTaggedValue NotifyContextDisposed(EcmaRuntimeCallInfo *info); 3874514f5e3Sopenharmony_ci 3884514f5e3Sopenharmony_ci static JSTaggedValue OptimizeObjectForAddingMultipleProperties(EcmaRuntimeCallInfo *info); 3894514f5e3Sopenharmony_ci 3904514f5e3Sopenharmony_ci static JSTaggedValue IsBeingInterpreted(EcmaRuntimeCallInfo *info); 3914514f5e3Sopenharmony_ci 3924514f5e3Sopenharmony_ci static JSTaggedValue ClearFunctionFeedback(EcmaRuntimeCallInfo *info); 3934514f5e3Sopenharmony_ci 3944514f5e3Sopenharmony_ci static JSTaggedValue JitCompileSync(EcmaRuntimeCallInfo *info); 3954514f5e3Sopenharmony_ci static JSTaggedValue JitCompileAsync(EcmaRuntimeCallInfo *info); 3964514f5e3Sopenharmony_ci static JSTaggedValue WaitJitCompileFinish(EcmaRuntimeCallInfo *info); 3974514f5e3Sopenharmony_ci static JSTaggedValue WaitAllJitCompileFinish(EcmaRuntimeCallInfo *info); 3984514f5e3Sopenharmony_ci 3994514f5e3Sopenharmony_ci static JSTaggedValue StartRuntimeStat(EcmaRuntimeCallInfo *info); 4004514f5e3Sopenharmony_ci static JSTaggedValue StopRuntimeStat(EcmaRuntimeCallInfo *info); 4014514f5e3Sopenharmony_ci 4024514f5e3Sopenharmony_ci static JSTaggedValue IterateFrame(EcmaRuntimeCallInfo *info); 4034514f5e3Sopenharmony_ci 4044514f5e3Sopenharmony_ci static JSTaggedValue InYoungSpace(EcmaRuntimeCallInfo *info); 4054514f5e3Sopenharmony_ci static JSTaggedValue InOldSpace(EcmaRuntimeCallInfo *info); 4064514f5e3Sopenharmony_ci 4074514f5e3Sopenharmony_ci static Span<const base::BuiltinFunctionEntry> GetArkToolsFunctions() 4084514f5e3Sopenharmony_ci { 4094514f5e3Sopenharmony_ci return Span<const base::BuiltinFunctionEntry>(ARK_TOOLS_FUNCTIONS); 4104514f5e3Sopenharmony_ci } 4114514f5e3Sopenharmony_ci 4124514f5e3Sopenharmony_ciprivate: 4134514f5e3Sopenharmony_ci#define BUILTINS_ARK_TOOLS_FUNCTION_ENTRY(name, method, length, id) \ 4144514f5e3Sopenharmony_ci base::BuiltinFunctionEntry::Create(name, BuiltinsArkTools::method, length, kungfu::BuiltinsStubCSigns::id), 4154514f5e3Sopenharmony_ci 4164514f5e3Sopenharmony_ci static constexpr std::array ARK_TOOLS_FUNCTIONS = { 4174514f5e3Sopenharmony_ci BUILTIN_ARK_TOOLS_FUNCTIONS(BUILTINS_ARK_TOOLS_FUNCTION_ENTRY) 4184514f5e3Sopenharmony_ci }; 4194514f5e3Sopenharmony_ci#undef BUILTINS_ARK_TOOLS_FUNCTION_ENTRY 4204514f5e3Sopenharmony_ci}; 4214514f5e3Sopenharmony_ci} // namespace panda::ecmascript::builtins 4224514f5e3Sopenharmony_ci 4234514f5e3Sopenharmony_ci#endif // ECMASCRIPT_BUILTINS_BUILTINS_ARK_TOOLS_H 424