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#ifndef ECMASCRIPT_OBJECT_FACTORY_H
174514f5e3Sopenharmony_ci#define ECMASCRIPT_OBJECT_FACTORY_H
184514f5e3Sopenharmony_ci
194514f5e3Sopenharmony_ci#include "ecmascript/base/error_type.h"
204514f5e3Sopenharmony_ci#include "ecmascript/base/number_helper.h"
214514f5e3Sopenharmony_ci#include "ecmascript/compiler/builtins/builtins_call_signature.h"
224514f5e3Sopenharmony_ci#include "ecmascript/ecma_string.h"
234514f5e3Sopenharmony_ci#include "ecmascript/js_function_kind.h"
244514f5e3Sopenharmony_ci#include "ecmascript/js_handle.h"
254514f5e3Sopenharmony_ci#include "ecmascript/js_hclass.h"
264514f5e3Sopenharmony_ci#include "ecmascript/js_native_pointer.h"
274514f5e3Sopenharmony_ci#include "ecmascript/js_tagged_value.h"
284514f5e3Sopenharmony_ci#include "ecmascript/mem/heap_region_allocator.h"
294514f5e3Sopenharmony_ci#include "ecmascript/mem/machine_code.h"
304514f5e3Sopenharmony_ci#include "ecmascript/mem/native_area_allocator.h"
314514f5e3Sopenharmony_ci#include "ecmascript/mem/space.h"
324514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_object.h"
334514f5e3Sopenharmony_ci#include "ecmascript/tagged_array.h"
344514f5e3Sopenharmony_ci#include "ecmascript/byte_array.h"
354514f5e3Sopenharmony_ci#include "ecmascript/pgo_profiler/pgo_extra_profiler.h"
364514f5e3Sopenharmony_ci
374514f5e3Sopenharmony_cinamespace panda::ecmascript {
384514f5e3Sopenharmony_cistruct MethodLiteral;
394514f5e3Sopenharmony_ciclass Method;
404514f5e3Sopenharmony_ciclass JSObject;
414514f5e3Sopenharmony_ciclass JSArray;
424514f5e3Sopenharmony_ciclass JSAPIPlainArray;
434514f5e3Sopenharmony_ciclass JSSymbol;
444514f5e3Sopenharmony_ciclass JSFunctionBase;
454514f5e3Sopenharmony_ciclass JSFunction;
464514f5e3Sopenharmony_ciclass JSBoundFunction;
474514f5e3Sopenharmony_ciclass JSProxyRevocFunction;
484514f5e3Sopenharmony_ciclass JSAsyncAwaitStatusFunction;
494514f5e3Sopenharmony_ciclass JSPrimitiveRef;
504514f5e3Sopenharmony_ciclass GlobalEnv;
514514f5e3Sopenharmony_ciclass GlobalEnvConstants;
524514f5e3Sopenharmony_ciclass AccessorData;
534514f5e3Sopenharmony_ciclass JSGlobalObject;
544514f5e3Sopenharmony_ciclass LexicalEnv;
554514f5e3Sopenharmony_ciclass SendableEnv;
564514f5e3Sopenharmony_ciclass JSDate;
574514f5e3Sopenharmony_ciclass JSProxy;
584514f5e3Sopenharmony_ciclass JSRealm;
594514f5e3Sopenharmony_ciclass JSArguments;
604514f5e3Sopenharmony_ciclass TaggedQueue;
614514f5e3Sopenharmony_ciclass JSForInIterator;
624514f5e3Sopenharmony_ciclass JSSet;
634514f5e3Sopenharmony_ciclass JSSharedSet;
644514f5e3Sopenharmony_ciclass JSMap;
654514f5e3Sopenharmony_ciclass JSSharedMap;
664514f5e3Sopenharmony_ciclass JSRegExp;
674514f5e3Sopenharmony_ciclass JSSetIterator;
684514f5e3Sopenharmony_ciclass JSSharedSetIterator;
694514f5e3Sopenharmony_ciclass JSRegExpIterator;
704514f5e3Sopenharmony_ciclass JSMapIterator;
714514f5e3Sopenharmony_ciclass JSSharedMapIterator;
724514f5e3Sopenharmony_ciclass JSArrayIterator;
734514f5e3Sopenharmony_ciclass JSSharedArrayIterator;
744514f5e3Sopenharmony_ciclass JSAPIPlainArrayIterator;
754514f5e3Sopenharmony_ciclass JSStringIterator;
764514f5e3Sopenharmony_ciclass JSGeneratorObject;
774514f5e3Sopenharmony_ciclass CompletionRecord;
784514f5e3Sopenharmony_ciclass GeneratorContext;
794514f5e3Sopenharmony_ciclass JSArrayBuffer;
804514f5e3Sopenharmony_ciclass JSSendableArrayBuffer;
814514f5e3Sopenharmony_ciclass JSDataView;
824514f5e3Sopenharmony_ciclass JSPromise;
834514f5e3Sopenharmony_ciclass JSPromiseReactionsFunction;
844514f5e3Sopenharmony_ciclass JSPromiseExecutorFunction;
854514f5e3Sopenharmony_ciclass JSAsyncModuleFulfilledFunction;
864514f5e3Sopenharmony_ciclass JSAsyncModuleRejectedFunction;
874514f5e3Sopenharmony_ciclass JSPromiseAllResolveElementFunction;
884514f5e3Sopenharmony_ciclass JSAsyncGeneratorResNextRetProRstFtn;
894514f5e3Sopenharmony_ciclass JSPromiseAnyRejectElementFunction;
904514f5e3Sopenharmony_ciclass JSPromiseAllSettledElementFunction;
914514f5e3Sopenharmony_ciclass JSPromiseFinallyFunction;
924514f5e3Sopenharmony_ciclass JSPromiseValueThunkOrThrowerFunction;
934514f5e3Sopenharmony_ciclass PromiseReaction;
944514f5e3Sopenharmony_ciclass PromiseCapability;
954514f5e3Sopenharmony_ciclass PromiseIteratorRecord;
964514f5e3Sopenharmony_ciclass JSAsyncFuncObject;
974514f5e3Sopenharmony_ciclass JSAsyncFunction;
984514f5e3Sopenharmony_ciclass JSAsyncFromSyncIterUnwarpFunction;
994514f5e3Sopenharmony_ciclass PromiseRecord;
1004514f5e3Sopenharmony_ciclass JSLocale;
1014514f5e3Sopenharmony_ciclass ResolvingFunctionsRecord;
1024514f5e3Sopenharmony_ciclass EcmaVM;
1034514f5e3Sopenharmony_ciclass Heap;
1044514f5e3Sopenharmony_ciclass SharedHeap;
1054514f5e3Sopenharmony_ciclass ConstantPool;
1064514f5e3Sopenharmony_ciclass Program;
1074514f5e3Sopenharmony_ciclass LayoutInfo;
1084514f5e3Sopenharmony_ciclass JSIntlBoundFunction;
1094514f5e3Sopenharmony_ciclass FreeObject;
1104514f5e3Sopenharmony_ciclass JSNativePointer;
1114514f5e3Sopenharmony_ciclass JSAPIArrayList;
1124514f5e3Sopenharmony_ciclass JSAPIArrayListIterator;
1134514f5e3Sopenharmony_ciclass JSAPIDeque;
1144514f5e3Sopenharmony_ciclass JSAPIDequeIterator;
1154514f5e3Sopenharmony_ciclass TaggedHashArray;
1164514f5e3Sopenharmony_ciclass LinkedNode;
1174514f5e3Sopenharmony_ciclass RBTreeNode;
1184514f5e3Sopenharmony_ciclass JSAPIHashMap;
1194514f5e3Sopenharmony_ciclass JSAPIHashSet;
1204514f5e3Sopenharmony_ciclass JSAPIHashMapIterator;
1214514f5e3Sopenharmony_ciclass JSAPIHashSetIterator;
1224514f5e3Sopenharmony_ciclass JSAPILightWeightMap;
1234514f5e3Sopenharmony_ciclass JSAPILightWeightMapIterator;
1244514f5e3Sopenharmony_ciclass JSAPILightWeightSet;
1254514f5e3Sopenharmony_ciclass JSAPILightWeightSetIterator;
1264514f5e3Sopenharmony_ciclass JSAPIQueue;
1274514f5e3Sopenharmony_ciclass JSAPIQueueIterator;
1284514f5e3Sopenharmony_ciclass JSAPIStack;
1294514f5e3Sopenharmony_ciclass JSAPIStackIterator;
1304514f5e3Sopenharmony_ciclass JSAPITreeSet;
1314514f5e3Sopenharmony_ciclass JSAPITreeMap;
1324514f5e3Sopenharmony_ciclass JSAPITreeSetIterator;
1334514f5e3Sopenharmony_ciclass JSAPITreeMapIterator;
1344514f5e3Sopenharmony_ciclass JSAPIVector;
1354514f5e3Sopenharmony_ciclass JSAPIVectorIterator;
1364514f5e3Sopenharmony_ciclass JSAPIBitVector;
1374514f5e3Sopenharmony_ciclass JSAPIBitVectorIterator;
1384514f5e3Sopenharmony_ciclass JSAPILinkedList;
1394514f5e3Sopenharmony_ciclass JSAPIList;
1404514f5e3Sopenharmony_ciclass JSAPILinkedListIterator;
1414514f5e3Sopenharmony_ciclass JSAPIListIterator;
1424514f5e3Sopenharmony_ciclass ModuleNamespace;
1434514f5e3Sopenharmony_ciclass NativeModuleFailureInfo;
1444514f5e3Sopenharmony_ciclass ImportEntry;
1454514f5e3Sopenharmony_ciclass LocalExportEntry;
1464514f5e3Sopenharmony_ciclass IndirectExportEntry;
1474514f5e3Sopenharmony_ciclass StarExportEntry;
1484514f5e3Sopenharmony_ciclass SourceTextModule;
1494514f5e3Sopenharmony_ciclass CjsModule;
1504514f5e3Sopenharmony_ciclass CjsRequire;
1514514f5e3Sopenharmony_ciclass CjsExports;
1524514f5e3Sopenharmony_ciclass ResolvedBinding;
1534514f5e3Sopenharmony_ciclass ResolvedIndexBinding;
1544514f5e3Sopenharmony_ciclass ResolvedRecordIndexBinding;
1554514f5e3Sopenharmony_ciclass ResolvedRecordBinding;
1564514f5e3Sopenharmony_ciclass BigInt;
1574514f5e3Sopenharmony_ciclass AsyncGeneratorRequest;
1584514f5e3Sopenharmony_ciclass AsyncIteratorRecord;
1594514f5e3Sopenharmony_ciclass JSAsyncGeneratorFunction;
1604514f5e3Sopenharmony_ciclass JSAsyncGeneratorObject;
1614514f5e3Sopenharmony_ciclass CellRecord;
1624514f5e3Sopenharmony_ciclass ClassLiteral;
1634514f5e3Sopenharmony_ci
1644514f5e3Sopenharmony_cinamespace job {
1654514f5e3Sopenharmony_ciclass MicroJobQueue;
1664514f5e3Sopenharmony_ciclass PendingJob;
1674514f5e3Sopenharmony_ci}  // namespace job
1684514f5e3Sopenharmony_ciclass TransitionHandler;
1694514f5e3Sopenharmony_ciclass PrototypeHandler;
1704514f5e3Sopenharmony_ciclass TransWithProtoHandler;
1714514f5e3Sopenharmony_ciclass StoreTSHandler;
1724514f5e3Sopenharmony_ciclass PropertyBox;
1734514f5e3Sopenharmony_ciclass ProtoChangeMarker;
1744514f5e3Sopenharmony_ciclass ProtoChangeDetails;
1754514f5e3Sopenharmony_ciclass MarkerCell;
1764514f5e3Sopenharmony_ciclass ProfileTypeInfo;
1774514f5e3Sopenharmony_ciclass MachineCode;
1784514f5e3Sopenharmony_ciclass ClassInfoExtractor;
1794514f5e3Sopenharmony_ciclass AOTLiteralInfo;
1804514f5e3Sopenharmony_ciclass ProfileTypeInfoCell;
1814514f5e3Sopenharmony_ciclass FunctionTemplate;
1824514f5e3Sopenharmony_ciclass VTable;
1834514f5e3Sopenharmony_cinamespace kungfu {
1844514f5e3Sopenharmony_ciclass TSHClassGenerator;
1854514f5e3Sopenharmony_ci}  // namespace kungfu
1864514f5e3Sopenharmony_ci
1874514f5e3Sopenharmony_cienum class CompletionRecordType : uint8_t;
1884514f5e3Sopenharmony_cienum class PrimitiveType : uint8_t;
1894514f5e3Sopenharmony_cienum class IterationKind : uint8_t;
1904514f5e3Sopenharmony_cienum class MethodIndex : uint8_t;
1914514f5e3Sopenharmony_cienum class SharedTypes : uint8_t;
1924514f5e3Sopenharmony_ciusing ErrorType = base::ErrorType;
1934514f5e3Sopenharmony_ciusing base::ErrorType;
1944514f5e3Sopenharmony_ciusing ExtraProfileTypeInfo = pgo::ExtraProfileTypeInfo;
1954514f5e3Sopenharmony_ci
1964514f5e3Sopenharmony_cienum class RemoveSlots { YES, NO };
1974514f5e3Sopenharmony_cienum class GrowMode { KEEP, GROW };
1984514f5e3Sopenharmony_cienum class StackCheck { YES, NO };
1994514f5e3Sopenharmony_ci
2004514f5e3Sopenharmony_ciclass ObjectFactory {
2014514f5e3Sopenharmony_cipublic:
2024514f5e3Sopenharmony_ci    static constexpr JSTaggedType FREE_MEMMORY_ADDRESS_ZAM_VALUE = 0xDEADFACE;
2034514f5e3Sopenharmony_ci    ObjectFactory(JSThread *thread, Heap *heap, SharedHeap *sHeap);
2044514f5e3Sopenharmony_ci    ~ObjectFactory() = default;
2054514f5e3Sopenharmony_ci    JSHandle<Method> NewMethodForNativeFunction(const void *func, FunctionKind kind = FunctionKind::NORMAL_FUNCTION,
2064514f5e3Sopenharmony_ci                                                kungfu::BuiltinsStubCSigns::ID builtinId =
2074514f5e3Sopenharmony_ci                                                kungfu::BuiltinsStubCSigns::INVALID,
2084514f5e3Sopenharmony_ci                                                MemSpaceType methodSpaceType = SHARED_OLD_SPACE);
2094514f5e3Sopenharmony_ci
2104514f5e3Sopenharmony_ci    JSHandle<ProfileTypeInfo> NewProfileTypeInfo(uint32_t length);
2114514f5e3Sopenharmony_ci    JSHandle<ConstantPool> NewConstantPool(uint32_t capacity);
2124514f5e3Sopenharmony_ci    JSHandle<Program> NewProgram();
2134514f5e3Sopenharmony_ci
2144514f5e3Sopenharmony_ci    JSHandle<JSObject> PUBLIC_API GetJSError(const ErrorType &errorType, const char *data = nullptr,
2154514f5e3Sopenharmony_ci        StackCheck needCheckStack = StackCheck::YES);
2164514f5e3Sopenharmony_ci
2174514f5e3Sopenharmony_ci    JSHandle<JSObject> NewJSError(const ErrorType &errorType, const JSHandle<EcmaString> &message,
2184514f5e3Sopenharmony_ci        StackCheck needCheckStack = StackCheck::YES);
2194514f5e3Sopenharmony_ci
2204514f5e3Sopenharmony_ci    JSHandle<JSObject> NewJSAggregateError();
2214514f5e3Sopenharmony_ci
2224514f5e3Sopenharmony_ci    JSHandle<TransitionHandler> NewTransitionHandler();
2234514f5e3Sopenharmony_ci
2244514f5e3Sopenharmony_ci    JSHandle<PrototypeHandler> NewPrototypeHandler();
2254514f5e3Sopenharmony_ci
2264514f5e3Sopenharmony_ci    JSHandle<TransWithProtoHandler> NewTransWithProtoHandler();
2274514f5e3Sopenharmony_ci
2284514f5e3Sopenharmony_ci    JSHandle<StoreTSHandler> NewStoreTSHandler();
2294514f5e3Sopenharmony_ci
2304514f5e3Sopenharmony_ci    JSHandle<JSObject> NewEmptyJSObject(uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
2314514f5e3Sopenharmony_ci
2324514f5e3Sopenharmony_ci    // use for others create, prototype is Function.prototype
2334514f5e3Sopenharmony_ci    // use for native function
2344514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunction(const JSHandle<GlobalEnv> &env, const void *nativeFunc = nullptr,
2354514f5e3Sopenharmony_ci                                       FunctionKind kind = FunctionKind::NORMAL_FUNCTION,
2364514f5e3Sopenharmony_ci                                       kungfu::BuiltinsStubCSigns::ID builtinId = kungfu::BuiltinsStubCSigns::INVALID,
2374514f5e3Sopenharmony_ci                                       MemSpaceType methodSpaceType = SHARED_OLD_SPACE);
2384514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewSFunction(const JSHandle<GlobalEnv> &env,
2394514f5e3Sopenharmony_ci                                      const void *nativeFunc = nullptr,
2404514f5e3Sopenharmony_ci                                      FunctionKind kind = FunctionKind::NORMAL_FUNCTION,
2414514f5e3Sopenharmony_ci                                      kungfu::BuiltinsStubCSigns::ID builtinId = kungfu::BuiltinsStubCSigns::INVALID,
2424514f5e3Sopenharmony_ci                                      MemSpaceType spaceType = SHARED_OLD_SPACE);
2434514f5e3Sopenharmony_ci    void InitializeMethod(const MethodLiteral *methodLiteral, JSHandle<Method> &method);
2444514f5e3Sopenharmony_ci    // use for method
2454514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunction(const JSHandle<GlobalEnv> &env, const JSHandle<Method> &method);
2464514f5e3Sopenharmony_ci
2474514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunction(const JSHandle<Method> &methodHandle);
2484514f5e3Sopenharmony_ci
2494514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunction(const JSHandle<Method> &methodHandle,
2504514f5e3Sopenharmony_ci                                       const JSHandle<JSTaggedValue> &homeObject);
2514514f5e3Sopenharmony_ci
2524514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSNativeErrorFunction(const JSHandle<GlobalEnv> &env, const void *nativeFunc = nullptr);
2534514f5e3Sopenharmony_ci
2544514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewSpecificTypedArrayFunction(const JSHandle<GlobalEnv> &env,
2554514f5e3Sopenharmony_ci                                                       const void *nativeFunc = nullptr,
2564514f5e3Sopenharmony_ci                                                       kungfu::BuiltinsStubCSigns::ID builtinId =
2574514f5e3Sopenharmony_ci                                                       kungfu::BuiltinsStubCSigns::INVALID);
2584514f5e3Sopenharmony_ci
2594514f5e3Sopenharmony_ci    JSHandle<JSObject> OrdinaryNewJSObjectCreate(const JSHandle<JSTaggedValue> &proto);
2604514f5e3Sopenharmony_ci
2614514f5e3Sopenharmony_ci    JSHandle<JSObject> CreateNullJSObject();
2624514f5e3Sopenharmony_ci
2634514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewAotFunction(uint32_t numArgs, uintptr_t codeEntry);
2644514f5e3Sopenharmony_ci
2654514f5e3Sopenharmony_ci    JSHandle<JSBoundFunction> NewJSBoundFunction(const JSHandle<JSTaggedValue> &target,
2664514f5e3Sopenharmony_ci                                                 const JSHandle<JSTaggedValue> &boundThis,
2674514f5e3Sopenharmony_ci                                                 const JSHandle<TaggedArray> &args);
2684514f5e3Sopenharmony_ci
2694514f5e3Sopenharmony_ci    JSHandle<JSIntlBoundFunction> NewJSIntlBoundFunction(MethodIndex idx, int functionLength = 1);
2704514f5e3Sopenharmony_ci
2714514f5e3Sopenharmony_ci    JSHandle<JSProxyRevocFunction> NewJSProxyRevocFunction(const JSHandle<JSProxy> &proxy);
2724514f5e3Sopenharmony_ci
2734514f5e3Sopenharmony_ci    JSHandle<JSAsyncAwaitStatusFunction> NewJSAsyncAwaitStatusFunction(MethodIndex idx);
2744514f5e3Sopenharmony_ci
2754514f5e3Sopenharmony_ci    JSHandle<JSGeneratorObject> NewJSGeneratorObject(JSHandle<JSTaggedValue> generatorFunction);
2764514f5e3Sopenharmony_ci
2774514f5e3Sopenharmony_ci    JSHandle<JSAsyncFuncObject> NewJSAsyncFuncObject();
2784514f5e3Sopenharmony_ci    JSHandle<JSAsyncGeneratorObject> NewJSAsyncGeneratorObject(JSHandle<JSTaggedValue> generatorFunction);
2794514f5e3Sopenharmony_ci
2804514f5e3Sopenharmony_ci    JSHandle<JSPrimitiveRef> NewJSPrimitiveRef(const JSHandle<JSFunction> &function,
2814514f5e3Sopenharmony_ci                                               const JSHandle<JSTaggedValue> &object);
2824514f5e3Sopenharmony_ci    JSHandle<JSPrimitiveRef> NewJSPrimitiveRef(PrimitiveType type, const JSHandle<JSTaggedValue> &object);
2834514f5e3Sopenharmony_ci
2844514f5e3Sopenharmony_ci    // get JSHClass for Ecma ClassLinker
2854514f5e3Sopenharmony_ci    JSHandle<GlobalEnv> NewGlobalEnv(JSHClass *globalEnvClass);
2864514f5e3Sopenharmony_ci
2874514f5e3Sopenharmony_ci    // get JSHClass for Ecma ClassLinker
2884514f5e3Sopenharmony_ci    JSHandle<LexicalEnv> NewLexicalEnv(int numSlots);
2894514f5e3Sopenharmony_ci
2904514f5e3Sopenharmony_ci    inline LexicalEnv *InlineNewLexicalEnv(int numSlots);
2914514f5e3Sopenharmony_ci
2924514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewEmptySymbol();
2934514f5e3Sopenharmony_ci
2944514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewJSSymbol();
2954514f5e3Sopenharmony_ci
2964514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewPrivateSymbol();
2974514f5e3Sopenharmony_ci
2984514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewPrivateNameSymbol(const JSHandle<JSTaggedValue> &name);
2994514f5e3Sopenharmony_ci
3004514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewWellKnownSymbol(const JSHandle<JSTaggedValue> &name);
3014514f5e3Sopenharmony_ci
3024514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewPublicSymbol(const JSHandle<JSTaggedValue> &name);
3034514f5e3Sopenharmony_ci
3044514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSymbolWithTable(const JSHandle<JSTaggedValue> &name);
3054514f5e3Sopenharmony_ci
3064514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewPrivateNameSymbolWithChar(std::string_view description);
3074514f5e3Sopenharmony_ci
3084514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewWellKnownSymbolWithChar(std::string_view description);
3094514f5e3Sopenharmony_ci
3104514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewPublicSymbolWithChar(std::string_view description);
3114514f5e3Sopenharmony_ci
3124514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSymbolWithTableWithChar(std::string_view description);
3134514f5e3Sopenharmony_ci
3144514f5e3Sopenharmony_ci    JSHandle<AccessorData> NewAccessorData();
3154514f5e3Sopenharmony_ci    JSHandle<AccessorData> NewInternalAccessor(void *setter, void *getter);
3164514f5e3Sopenharmony_ci
3174514f5e3Sopenharmony_ci    JSHandle<PromiseCapability> NewPromiseCapability();
3184514f5e3Sopenharmony_ci
3194514f5e3Sopenharmony_ci    JSHandle<PromiseReaction> NewPromiseReaction();
3204514f5e3Sopenharmony_ci
3214514f5e3Sopenharmony_ci    JSHandle<PromiseRecord> NewPromiseRecord();
3224514f5e3Sopenharmony_ci    JSHandle<AsyncGeneratorRequest> NewAsyncGeneratorRequest();
3234514f5e3Sopenharmony_ci
3244514f5e3Sopenharmony_ci    JSHandle<AsyncIteratorRecord> NewAsyncIteratorRecord(const JSHandle<JSTaggedValue> &itor,
3254514f5e3Sopenharmony_ci                                                         const JSHandle<JSTaggedValue> &next, bool done);
3264514f5e3Sopenharmony_ci
3274514f5e3Sopenharmony_ci    JSHandle<ResolvingFunctionsRecord> NewResolvingFunctionsRecord();
3284514f5e3Sopenharmony_ci
3294514f5e3Sopenharmony_ci    JSHandle<PromiseIteratorRecord> NewPromiseIteratorRecord(const JSHandle<JSTaggedValue> &itor, bool done);
3304514f5e3Sopenharmony_ci
3314514f5e3Sopenharmony_ci    JSHandle<job::MicroJobQueue> NewMicroJobQueue();
3324514f5e3Sopenharmony_ci
3334514f5e3Sopenharmony_ci    JSHandle<job::PendingJob> NewPendingJob(const JSHandle<JSFunction> &func, const JSHandle<TaggedArray> &argv);
3344514f5e3Sopenharmony_ci
3354514f5e3Sopenharmony_ci    JSHandle<JSArray> NewJSArray();
3364514f5e3Sopenharmony_ci    JSHandle<JSSharedArray> PUBLIC_API NewJSSArray();
3374514f5e3Sopenharmony_ci    JSHandle<JSArray> PUBLIC_API NewJSArray(size_t length, JSHandle<JSHClass> &hclass);
3384514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API NewJsonFixedArray(size_t start, size_t length,
3394514f5e3Sopenharmony_ci                                                       const std::vector<JSHandle<JSTaggedValue>> &vec);
3404514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API NewSJsonFixedArray(size_t start, size_t length,
3414514f5e3Sopenharmony_ci                                                        const std::vector<JSHandle<JSTaggedValue>> &vec);
3424514f5e3Sopenharmony_ci
3434514f5e3Sopenharmony_ci    JSHandle<JSProxy> NewJSProxy(const JSHandle<JSTaggedValue> &target, const JSHandle<JSTaggedValue> &handler);
3444514f5e3Sopenharmony_ci    JSHandle<JSRealm> NewJSRealm();
3454514f5e3Sopenharmony_ci
3464514f5e3Sopenharmony_ci    JSHandle<JSArguments> NewJSArguments();
3474514f5e3Sopenharmony_ci
3484514f5e3Sopenharmony_ci    JSHandle<JSPrimitiveRef> NewJSString(const JSHandle<JSTaggedValue> &str, const JSHandle<JSTaggedValue> &newTarget);
3494514f5e3Sopenharmony_ci
3504514f5e3Sopenharmony_ci    template <typename Derived>
3514514f5e3Sopenharmony_ci    JSHandle<TaggedArray> ConvertListToArray(const JSThread *thread, const JSHandle<Derived> &list,
3524514f5e3Sopenharmony_ci                                             uint32_t numberOfNodes)
3534514f5e3Sopenharmony_ci    {
3544514f5e3Sopenharmony_ci        MemSpaceType spaceType = numberOfNodes < LENGTH_THRESHOLD ? MemSpaceType::SEMI_SPACE : MemSpaceType::OLD_SPACE;
3554514f5e3Sopenharmony_ci        JSHandle<TaggedArray> dstElements = NewTaggedArrayWithoutInit(numberOfNodes, spaceType);
3564514f5e3Sopenharmony_ci        if (numberOfNodes == 0) {
3574514f5e3Sopenharmony_ci            return dstElements;
3584514f5e3Sopenharmony_ci        }
3594514f5e3Sopenharmony_ci        int dataIndex = Derived::ELEMENTS_START_INDEX;
3604514f5e3Sopenharmony_ci        for (uint32_t i = 0; i < numberOfNodes; i++) {
3614514f5e3Sopenharmony_ci            dataIndex = list->GetElement(dataIndex + Derived::NEXT_PTR_OFFSET).GetInt();
3624514f5e3Sopenharmony_ci            dstElements->Set(thread, i, list->GetElement(dataIndex));
3634514f5e3Sopenharmony_ci        }
3644514f5e3Sopenharmony_ci        return dstElements;
3654514f5e3Sopenharmony_ci    }
3664514f5e3Sopenharmony_ci
3674514f5e3Sopenharmony_ci    JSHandle<JSObject> NewAndCopyJSArrayObject(JSHandle<JSObject> thisObjHandle, uint32_t newLength,
3684514f5e3Sopenharmony_ci                                               uint32_t oldLength, uint32_t k = 0);
3694514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewAndCopyTaggedArray(JSHandle<TaggedArray> &srcElements, uint32_t newLength,
3704514f5e3Sopenharmony_ci                                                uint32_t oldLength, uint32_t k = 0);
3714514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewAndCopyTaggedArraySkipBarrier(JSHandle<TaggedArray> &srcElements, uint32_t newLength,
3724514f5e3Sopenharmony_ci                                                           uint32_t oldLength, uint32_t k = 0);
3734514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewAndCopySNameDictionary(JSHandle<TaggedArray> &srcElements, uint32_t length);
3744514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewAndCopyTaggedArrayByObject(JSHandle<JSObject> thisObjHandle, uint32_t newLength,
3754514f5e3Sopenharmony_ci                                                        uint32_t oldLength, uint32_t k = 0);
3764514f5e3Sopenharmony_ci    JSHandle<MutantTaggedArray> NewAndCopyMutantTaggedArrayByObject(JSHandle<JSObject> thisObjHandle,
3774514f5e3Sopenharmony_ci                                                                    uint32_t newLength, uint32_t oldLength,
3784514f5e3Sopenharmony_ci                                                                    uint32_t k = 0);
3794514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API NewTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
3804514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewTaggedArray(uint32_t length, JSTaggedValue initVal, bool nonMovable);
3814514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewTaggedArray(uint32_t length, JSTaggedValue initVal, MemSpaceType spaceType);
3824514f5e3Sopenharmony_ci    // Copy on write array is allocated in nonmovable space by default.
3834514f5e3Sopenharmony_ci    JSHandle<COWTaggedArray> NewCOWTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
3844514f5e3Sopenharmony_ci    JSHandle<COWMutantTaggedArray> NewCOWMutantTaggedArray(uint32_t length, JSTaggedType initVal = base::SPECIAL_HOLE);
3854514f5e3Sopenharmony_ci    JSHandle<MutantTaggedArray> NewMutantTaggedArray(uint32_t length, JSTaggedType initVal = base::SPECIAL_HOLE);
3864514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API NewDictionaryArray(uint32_t length);
3874514f5e3Sopenharmony_ci    JSHandle<JSForInIterator> NewJSForinIterator(const JSHandle<JSTaggedValue> &obj,
3884514f5e3Sopenharmony_ci                                                 const JSHandle<JSTaggedValue> keys,
3894514f5e3Sopenharmony_ci                                                 const JSHandle<JSTaggedValue> cachedHclass);
3904514f5e3Sopenharmony_ci
3914514f5e3Sopenharmony_ci    JSHandle<ByteArray> NewByteArray(uint32_t length, uint32_t size, void *srcData = nullptr,
3924514f5e3Sopenharmony_ci                                     MemSpaceType spaceType = MemSpaceType::SEMI_SPACE);
3934514f5e3Sopenharmony_ci
3944514f5e3Sopenharmony_ci    JSHandle<PropertyBox> NewPropertyBox(const JSHandle<JSTaggedValue> &name);
3954514f5e3Sopenharmony_ci
3964514f5e3Sopenharmony_ci    JSHandle<ProtoChangeMarker> NewProtoChangeMarker();
3974514f5e3Sopenharmony_ci
3984514f5e3Sopenharmony_ci    JSHandle<ProtoChangeDetails> NewProtoChangeDetails();
3994514f5e3Sopenharmony_ci
4004514f5e3Sopenharmony_ci    JSHandle<MarkerCell> NewMarkerCell();
4014514f5e3Sopenharmony_ci    JSHandle<BigInt> NewBigInt(uint32_t length);
4024514f5e3Sopenharmony_ci    // use for copy properties keys's array to another array
4034514f5e3Sopenharmony_ci    JSHandle<TaggedArray> ExtendArray(const JSHandle<TaggedArray> &old, uint32_t length,
4044514f5e3Sopenharmony_ci                                      JSTaggedValue initVal = JSTaggedValue::Hole(),
4054514f5e3Sopenharmony_ci                                      MemSpaceType type = MemSpaceType::SEMI_SPACE,
4064514f5e3Sopenharmony_ci                                      ElementsKind kind = ElementsKind::GENERIC);
4074514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CopyPartArray(const JSHandle<TaggedArray> &old, uint32_t start, uint32_t end);
4084514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API CopyArray(const JSHandle<TaggedArray> &old, uint32_t oldLength, uint32_t newLength,
4094514f5e3Sopenharmony_ci                                               JSTaggedValue initVal = JSTaggedValue::Hole(),
4104514f5e3Sopenharmony_ci                                               MemSpaceType type = MemSpaceType::SEMI_SPACE,
4114514f5e3Sopenharmony_ci                                               ElementsKind kind = ElementsKind::GENERIC);
4124514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CopyFromEnumCache(const JSHandle<TaggedArray> &old);
4134514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CloneProperties(const JSHandle<TaggedArray> &old);
4144514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CloneProperties(const JSHandle<TaggedArray> &old, const JSHandle<JSTaggedValue> &env,
4154514f5e3Sopenharmony_ci                                          const JSHandle<JSObject> &obj);
4164514f5e3Sopenharmony_ci
4174514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> PUBLIC_API CreateLayoutInfo(int properties, MemSpaceType type = MemSpaceType::SEMI_SPACE,
4184514f5e3Sopenharmony_ci                                                     GrowMode mode = GrowMode::GROW);
4194514f5e3Sopenharmony_ci
4204514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> ExtendLayoutInfo(const JSHandle<LayoutInfo> &old, int properties);
4214514f5e3Sopenharmony_ci
4224514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> CopyLayoutInfo(const JSHandle<LayoutInfo> &old);
4234514f5e3Sopenharmony_ci
4244514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> CopyAndReSort(const JSHandle<LayoutInfo> &old, int end, int capacity);
4254514f5e3Sopenharmony_ci
4264514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetEmptyString() const;
4274514f5e3Sopenharmony_ci
4284514f5e3Sopenharmony_ci    JSHandle<TaggedArray> EmptyArray() const;
4294514f5e3Sopenharmony_ci
4304514f5e3Sopenharmony_ci    JSHandle<MutantTaggedArray> EmptyMutantArray() const;
4314514f5e3Sopenharmony_ci
4324514f5e3Sopenharmony_ci    FreeObject *FillFreeObject(uintptr_t address, size_t size, RemoveSlots removeSlots = RemoveSlots::NO,
4334514f5e3Sopenharmony_ci                               uintptr_t hugeObjectHead = 0);
4344514f5e3Sopenharmony_ci
4354514f5e3Sopenharmony_ci    TaggedObject *NewObject(const JSHandle<JSHClass> &hclass);
4364514f5e3Sopenharmony_ci
4374514f5e3Sopenharmony_ci    TaggedObject *NewNonMovableObject(const JSHandle<JSHClass> &hclass, uint32_t inobjPropCount = 0);
4384514f5e3Sopenharmony_ci
4394514f5e3Sopenharmony_ci    void InitializeExtraProperties(const JSHandle<JSHClass> &hclass, TaggedObject *obj, uint32_t inobjPropCount);
4404514f5e3Sopenharmony_ci
4414514f5e3Sopenharmony_ci    JSHandle<TaggedQueue> NewTaggedQueue(uint32_t length);
4424514f5e3Sopenharmony_ci
4434514f5e3Sopenharmony_ci    JSHandle<TaggedQueue> GetEmptyTaggedQueue() const;
4444514f5e3Sopenharmony_ci
4454514f5e3Sopenharmony_ci    JSHandle<JSSetIterator> NewJSSetIterator(const JSHandle<JSSet> &set, IterationKind kind);
4464514f5e3Sopenharmony_ci    JSHandle<JSSharedSetIterator> NewJSSetIterator(const JSHandle<JSSharedSet> &set, IterationKind kind);
4474514f5e3Sopenharmony_ci
4484514f5e3Sopenharmony_ci    JSHandle<JSRegExpIterator> NewJSRegExpIterator(const JSHandle<JSTaggedValue> &matcher,
4494514f5e3Sopenharmony_ci                                                   const JSHandle<EcmaString> &inputStr, bool global,
4504514f5e3Sopenharmony_ci                                                   bool fullUnicode);
4514514f5e3Sopenharmony_ci
4524514f5e3Sopenharmony_ci    JSHandle<JSMapIterator> NewJSMapIterator(const JSHandle<JSMap> &map, IterationKind kind);
4534514f5e3Sopenharmony_ci
4544514f5e3Sopenharmony_ci    JSHandle<JSSharedMapIterator> NewJSMapIterator(const JSHandle<JSSharedMap> &map, IterationKind kind);
4554514f5e3Sopenharmony_ci
4564514f5e3Sopenharmony_ci    JSHandle<JSArrayIterator> NewJSArrayIterator(const JSHandle<JSObject> &array, IterationKind kind);
4574514f5e3Sopenharmony_ci    JSHandle<JSSharedArrayIterator> NewJSSharedArrayIterator(const JSHandle<JSObject> &array, IterationKind kind);
4584514f5e3Sopenharmony_ci
4594514f5e3Sopenharmony_ci    JSHandle<CompletionRecord> NewCompletionRecord(CompletionRecordType type, JSHandle<JSTaggedValue> value);
4604514f5e3Sopenharmony_ci
4614514f5e3Sopenharmony_ci    JSHandle<GeneratorContext> NewGeneratorContext();
4624514f5e3Sopenharmony_ci
4634514f5e3Sopenharmony_ci    JSHandle<JSPromiseReactionsFunction> CreateJSPromiseReactionsFunction(MethodIndex idx);
4644514f5e3Sopenharmony_ci
4654514f5e3Sopenharmony_ci    JSHandle<JSPromiseExecutorFunction> CreateJSPromiseExecutorFunction();
4664514f5e3Sopenharmony_ci
4674514f5e3Sopenharmony_ci    JSHandle<JSAsyncModuleFulfilledFunction> CreateJSAsyncModuleFulfilledFunction();
4684514f5e3Sopenharmony_ci
4694514f5e3Sopenharmony_ci    JSHandle<JSAsyncModuleRejectedFunction> CreateJSAsyncModuleRejectedFunction();
4704514f5e3Sopenharmony_ci
4714514f5e3Sopenharmony_ci    JSHandle<JSPromiseAllResolveElementFunction> NewJSPromiseAllResolveElementFunction();
4724514f5e3Sopenharmony_ci
4734514f5e3Sopenharmony_ci    JSHandle<JSPromiseAnyRejectElementFunction> NewJSPromiseAnyRejectElementFunction();
4744514f5e3Sopenharmony_ci
4754514f5e3Sopenharmony_ci    JSHandle<JSPromiseAllSettledElementFunction> NewJSPromiseAllSettledResolveElementFunction();
4764514f5e3Sopenharmony_ci
4774514f5e3Sopenharmony_ci    JSHandle<JSPromiseAllSettledElementFunction> NewJSPromiseAllSettledRejectElementFunction();
4784514f5e3Sopenharmony_ci
4794514f5e3Sopenharmony_ci    JSHandle<JSPromiseFinallyFunction> NewJSPromiseThenFinallyFunction();
4804514f5e3Sopenharmony_ci
4814514f5e3Sopenharmony_ci    JSHandle<JSPromiseFinallyFunction> NewJSPromiseCatchFinallyFunction();
4824514f5e3Sopenharmony_ci
4834514f5e3Sopenharmony_ci    JSHandle<JSPromiseValueThunkOrThrowerFunction> NewJSPromiseValueThunkFunction();
4844514f5e3Sopenharmony_ci
4854514f5e3Sopenharmony_ci    JSHandle<JSPromiseValueThunkOrThrowerFunction> NewJSPromiseThrowerFunction();
4864514f5e3Sopenharmony_ci
4874514f5e3Sopenharmony_ci    JSHandle<JSAsyncGeneratorResNextRetProRstFtn> NewJSAsyGenResNextRetProRstFulfilledFtn();
4884514f5e3Sopenharmony_ci
4894514f5e3Sopenharmony_ci    JSHandle<JSAsyncGeneratorResNextRetProRstFtn> NewJSAsyGenResNextRetProRstRejectedFtn();
4904514f5e3Sopenharmony_ci
4914514f5e3Sopenharmony_ci    JSHandle<JSAsyncFromSyncIterUnwarpFunction> NewJSAsyncFromSyncIterUnwarpFunction();
4924514f5e3Sopenharmony_ci
4934514f5e3Sopenharmony_ci    JSHandle<JSObject> CloneObjectLiteral(JSHandle<JSObject> object, const JSHandle<JSTaggedValue> &env,
4944514f5e3Sopenharmony_ci                                          bool canShareHClass = true);
4954514f5e3Sopenharmony_ci    JSHandle<JSObject> CloneObjectLiteral(JSHandle<JSObject> object);
4964514f5e3Sopenharmony_ci    JSHandle<JSArray> CloneArrayLiteral(JSHandle<JSArray> object);
4974514f5e3Sopenharmony_ci    JSHandle<JSFunction> CloneJSFunction(JSHandle<JSFunction> func);
4984514f5e3Sopenharmony_ci    JSHandle<JSFunction> CloneSFunction(JSHandle<JSFunction> func);
4994514f5e3Sopenharmony_ci    JSHandle<JSFunction> CloneClassCtor(JSHandle<JSFunction> ctor, const JSHandle<JSTaggedValue> &lexenv,
5004514f5e3Sopenharmony_ci                                        bool canShareHClass);
5014514f5e3Sopenharmony_ci    JSHandle<JSFunction> CreateJSFunctionFromTemplate(JSHandle<FunctionTemplate> funcTemp);
5024514f5e3Sopenharmony_ci    JSHandle<JSFunction> CreateSFunctionFromTemplate(JSHandle<FunctionTemplate> funcTemp);
5034514f5e3Sopenharmony_ci
5044514f5e3Sopenharmony_ci    void NewJSArrayBufferData(const JSHandle<JSArrayBuffer> &array, int32_t length);
5054514f5e3Sopenharmony_ci    void NewJSSendableArrayBufferData(const JSHandle<JSSendableArrayBuffer> &array, int32_t length);
5064514f5e3Sopenharmony_ci    JSHandle<JSSendableArrayBuffer> NewJSSendableArrayBuffer(int32_t length);
5074514f5e3Sopenharmony_ci    JSHandle<JSSendableArrayBuffer> NewJSSendableArrayBuffer(void *buffer, int32_t length,
5084514f5e3Sopenharmony_ci                                                             const NativePointerCallback &deleter, void *data);
5094514f5e3Sopenharmony_ci
5104514f5e3Sopenharmony_ci    JSHandle<JSArrayBuffer> NewJSArrayBuffer(int32_t length);
5114514f5e3Sopenharmony_ci
5124514f5e3Sopenharmony_ci    JSHandle<JSArrayBuffer> NewJSArrayBuffer(void *buffer, int32_t length, const NativePointerCallback &deleter,
5134514f5e3Sopenharmony_ci                                             void *data, bool share = false);
5144514f5e3Sopenharmony_ci
5154514f5e3Sopenharmony_ci    JSHandle<JSDataView> NewJSDataView(JSHandle<JSArrayBuffer> buffer, uint32_t offset, uint32_t length);
5164514f5e3Sopenharmony_ci
5174514f5e3Sopenharmony_ci    void NewJSSharedArrayBufferData(const JSHandle<JSArrayBuffer> &array, int32_t length);
5184514f5e3Sopenharmony_ci
5194514f5e3Sopenharmony_ci    JSHandle<JSArrayBuffer> NewJSSharedArrayBuffer(int32_t length);
5204514f5e3Sopenharmony_ci
5214514f5e3Sopenharmony_ci    JSHandle<JSArrayBuffer> NewJSSharedArrayBuffer(void *buffer, int32_t length);
5224514f5e3Sopenharmony_ci
5234514f5e3Sopenharmony_ci    void NewJSRegExpByteCodeData(const JSHandle<JSRegExp> &regexp, void *buffer, size_t size);
5244514f5e3Sopenharmony_ci
5254514f5e3Sopenharmony_ci    template<typename T, typename S>
5264514f5e3Sopenharmony_ci    inline void NewJSIntlIcuData(const JSHandle<T> &obj, const S &icu, const NativePointerCallback &callback);
5274514f5e3Sopenharmony_ci
5284514f5e3Sopenharmony_ci    EcmaString *PUBLIC_API InternString(const JSHandle<JSTaggedValue> &key);
5294514f5e3Sopenharmony_ci
5304514f5e3Sopenharmony_ci    inline JSHandle<JSNativePointer> NewJSNativePointer(void *externalPointer,
5314514f5e3Sopenharmony_ci                                                        const NativePointerCallback &callBack = nullptr,
5324514f5e3Sopenharmony_ci                                                        void *data = nullptr,
5334514f5e3Sopenharmony_ci                                                        bool nonMovable = false,
5344514f5e3Sopenharmony_ci                                                        size_t nativeBindingsize = 0,
5354514f5e3Sopenharmony_ci                                                        Concurrent isConcurrent = Concurrent::NO,
5364514f5e3Sopenharmony_ci                                                        NativeFlag flag = NativeFlag::NO_DIV);
5374514f5e3Sopenharmony_ci
5384514f5e3Sopenharmony_ci    JSHandle<JSObject> NewOldSpaceObjLiteralByHClass(const JSHandle<JSHClass> &hclass);
5394514f5e3Sopenharmony_ci    JSHandle<JSHClass> SetLayoutInObjHClass(const JSHandle<TaggedArray> &properties, size_t length,
5404514f5e3Sopenharmony_ci                                            const JSHandle<JSHClass> &objClass);
5414514f5e3Sopenharmony_ci    static bool CanObjectLiteralHClassCache(size_t length);
5424514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateObjectLiteralRootHClass(size_t length);
5434514f5e3Sopenharmony_ci    JSHandle<JSHClass> GetObjectLiteralRootHClass(size_t length);
5444514f5e3Sopenharmony_ci    JSHandle<JSHClass> GetObjectLiteralHClass(const JSHandle<TaggedArray> &properties, size_t length);
5454514f5e3Sopenharmony_ci    // only use for creating Function.prototype and Function
5464514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunctionByHClass(const JSHandle<Method> &method, const JSHandle<JSHClass> &clazz,
5474514f5e3Sopenharmony_ci                                               MemSpaceType type = MemSpaceType::SEMI_SPACE);
5484514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunctionByHClass(const void *func, const JSHandle<JSHClass> &clazz,
5494514f5e3Sopenharmony_ci                                               FunctionKind kind = FunctionKind::NORMAL_FUNCTION);
5504514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunctionByHClassWithoutAccessor(const void *func,
5514514f5e3Sopenharmony_ci        const JSHandle<JSHClass> &clazz, FunctionKind kind = FunctionKind::NORMAL_FUNCTION);
5524514f5e3Sopenharmony_ci    JSHandle<Method> NewMethod(const MethodLiteral *methodLiteral, MemSpaceType spaceType = OLD_SPACE);
5534514f5e3Sopenharmony_ci
5544514f5e3Sopenharmony_ci    JSHandle<Method> NewMethod(const JSPandaFile *jsPandaFile, MethodLiteral *methodLiteral,
5554514f5e3Sopenharmony_ci                               JSHandle<ConstantPool> constpool, uint32_t entryIndex,
5564514f5e3Sopenharmony_ci                               bool needSetAotFlag, bool *canFastCall = nullptr);
5574514f5e3Sopenharmony_ci
5584514f5e3Sopenharmony_ci    // used for creating jsobject by constructor
5594514f5e3Sopenharmony_ci    JSHandle<JSObject> PUBLIC_API NewJSObjectByConstructor(const JSHandle<JSFunction> &constructor,
5604514f5e3Sopenharmony_ci                                                           const JSHandle<JSTaggedValue> &newTarget);
5614514f5e3Sopenharmony_ci    JSHandle<JSObject> NewJSObjectByConstructor(JSHandle<GlobalEnv> env,
5624514f5e3Sopenharmony_ci        const JSHandle<JSFunction> &constructor, uint32_t inlinedProps);
5634514f5e3Sopenharmony_ci    JSHandle<JSObject> NewJSObjectByConstructor(const JSHandle<JSFunction> &constructor,
5644514f5e3Sopenharmony_ci                                                uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
5654514f5e3Sopenharmony_ci    void InitializeJSObject(const JSHandle<JSObject> &obj, const JSHandle<JSHClass> &jshclass);
5664514f5e3Sopenharmony_ci
5674514f5e3Sopenharmony_ci    JSHandle<JSObject> NewJSObjectWithInit(const JSHandle<JSHClass> &jshclass);
5684514f5e3Sopenharmony_ci    uintptr_t NewSpaceBySnapshotAllocator(size_t size);
5694514f5e3Sopenharmony_ci    TaggedObject *NewMachineCodeObject(size_t length, MachineCodeDesc &desc);
5704514f5e3Sopenharmony_ci    JSHandle<MachineCode> SetMachineCodeObjectData(TaggedObject *obj, size_t length,
5714514f5e3Sopenharmony_ci        const MachineCodeDesc &desc, JSHandle<Method> &method);
5724514f5e3Sopenharmony_ci    JSHandle<MachineCode> NewMachineCodeObject(size_t length, const MachineCodeDesc &desc, JSHandle<Method> &method);
5734514f5e3Sopenharmony_ci    JSHandle<ClassInfoExtractor> NewClassInfoExtractor(JSHandle<JSTaggedValue> method);
5744514f5e3Sopenharmony_ci    JSHandle<ClassLiteral> NewClassLiteral();
5754514f5e3Sopenharmony_ci
5764514f5e3Sopenharmony_ci    // ----------------------------------- new string ----------------------------------------
5774514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromASCII(std::string_view data);
5784514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf8WithoutStringTable(std::string_view data);
5794514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromUtf8(std::string_view data);
5804514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf8(std::string_view data, bool canBeCompress);
5814514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf8ReadOnly(std::string_view data);
5824514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromASCIISkippingStringTable(std::string_view data);
5834514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16WithoutStringTable(std::u16string_view data);
5844514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16(std::u16string_view data);
5854514f5e3Sopenharmony_ci
5864514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromStdString(const std::string &data);
5874514f5e3Sopenharmony_ci
5884514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf8WithoutStringTable(const uint8_t *utf8Data, uint32_t utf8Len);
5894514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf8(const uint8_t *utf8Data, uint32_t utf8Len);
5904514f5e3Sopenharmony_ci
5914514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16WithoutStringTable(const uint16_t *utf16Data, uint32_t utf16Len);
5924514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromUtf16(const uint16_t *utf16Data, uint32_t utf16Len);
5934514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16Compress(const uint16_t *utf16Data, uint32_t utf16Len);
5944514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16NotCompress(const uint16_t *utf16Data, uint32_t utf16Len);
5954514f5e3Sopenharmony_ci
5964514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf8Literal(const uint8_t *utf8Data, uint32_t utf8Len);
5974514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromUtf8LiteralCompress(const uint8_t *utf8Data, uint32_t utf8Len);
5984514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromUtf8LiteralCompressSubString(const JSHandle<EcmaString> &string,
5994514f5e3Sopenharmony_ci                                                                        uint32_t offset, uint32_t utf8Len);
6004514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewCompressedUtf8(const uint8_t *utf8Data, uint32_t utf8Len);
6014514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewCompressedUtf8SubString(const JSHandle<EcmaString> &string,
6024514f5e3Sopenharmony_ci                                                               uint32_t offset, uint32_t utf8Len);
6034514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16Literal(const uint16_t *utf16Data, uint32_t utf16Len);
6044514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromUtf16LiteralCompress(const uint16_t *utf16Data, uint32_t utf16Len);
6054514f5e3Sopenharmony_ci    JSHandle<EcmaString> PUBLIC_API NewFromUtf16LiteralNotCompress(const uint16_t *utf16Data, uint32_t utf16Len);
6064514f5e3Sopenharmony_ci
6074514f5e3Sopenharmony_ci    inline EcmaString *AllocLineStringObject(size_t size);
6084514f5e3Sopenharmony_ci    inline EcmaString *AllocLineStringObjectNoGC(size_t size);
6094514f5e3Sopenharmony_ci    inline EcmaString *AllocOldSpaceLineStringObject(size_t size);
6104514f5e3Sopenharmony_ci    inline EcmaString *AllocReadOnlyLineStringObject(size_t size);
6114514f5e3Sopenharmony_ci    inline EcmaString *AllocNonMovableLineStringObject(size_t size);
6124514f5e3Sopenharmony_ci    inline EcmaString *AllocSlicedStringObject(MemSpaceType type);
6134514f5e3Sopenharmony_ci    inline EcmaString *AllocConstantStringObject(MemSpaceType type);
6144514f5e3Sopenharmony_ci    inline EcmaString *AllocTreeStringObject();
6154514f5e3Sopenharmony_ci
6164514f5e3Sopenharmony_ci    JSHandle<EcmaString> ConcatFromString(const JSHandle<EcmaString> &firstString,
6174514f5e3Sopenharmony_ci                                          const JSHandle<EcmaString> &secondString);
6184514f5e3Sopenharmony_ci
6194514f5e3Sopenharmony_ci    // used for creating Function
6204514f5e3Sopenharmony_ci    JSHandle<JSObject> PUBLIC_API NewJSObject(const JSHandle<JSHClass> &jshclass);
6214514f5e3Sopenharmony_ci
6224514f5e3Sopenharmony_ci    // used for creating jshclass in Builtins, Function, Class_Linker
6234514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewEcmaHClass(uint32_t size, JSType type, const JSHandle<JSTaggedValue> &prototype);
6244514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewEcmaHClass(uint32_t size, uint32_t inlinedProps, JSType type,
6254514f5e3Sopenharmony_ci                                     const JSHandle<JSTaggedValue> &prototype);
6264514f5e3Sopenharmony_ci
6274514f5e3Sopenharmony_ci    // used for creating jshclass in Builtins, Function, Class_Linker
6284514f5e3Sopenharmony_ci    JSHandle<JSHClass> PUBLIC_API NewEcmaHClass(uint32_t size, JSType type,
6294514f5e3Sopenharmony_ci                                                uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
6304514f5e3Sopenharmony_ci
6314514f5e3Sopenharmony_ci    JSHandle<JSHClass> PUBLIC_API NewEcmaHClass(uint32_t size, uint32_t inlinedProps, JSType type,
6324514f5e3Sopenharmony_ci        const JSHandle<JSTaggedValue> &prototype, const JSHandle<JSTaggedValue> &layout);
6334514f5e3Sopenharmony_ci
6344514f5e3Sopenharmony_ci    // It is used to provide iterators for non ECMA standard jsapi containers.
6354514f5e3Sopenharmony_ci    JSHandle<JSAPIPlainArray> NewJSAPIPlainArray(uint32_t capacity);
6364514f5e3Sopenharmony_ci    JSHandle<JSAPIPlainArrayIterator> NewJSAPIPlainArrayIterator(const JSHandle<JSAPIPlainArray> &plainarray,
6374514f5e3Sopenharmony_ci                                                                 IterationKind kind);
6384514f5e3Sopenharmony_ci    JSHandle<JSAPIArrayList> NewJSAPIArrayList(uint32_t capacity);
6394514f5e3Sopenharmony_ci
6404514f5e3Sopenharmony_ci    JSHandle<JSAPILightWeightMapIterator> NewJSAPILightWeightMapIterator(const JSHandle<JSAPILightWeightMap> &obj,
6414514f5e3Sopenharmony_ci                                                                         IterationKind kind);
6424514f5e3Sopenharmony_ci    JSHandle<JSAPILightWeightSetIterator> NewJSAPILightWeightSetIterator(const JSHandle<JSAPILightWeightSet> &obj,
6434514f5e3Sopenharmony_ci                                                                         IterationKind kind);
6444514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CopyQueue(const JSHandle<TaggedArray> &old, uint32_t newLength,
6454514f5e3Sopenharmony_ci                                    uint32_t front, uint32_t tail);
6464514f5e3Sopenharmony_ci    JSHandle<JSAPIQueueIterator> NewJSAPIQueueIterator(const JSHandle<JSAPIQueue> &queue);
6474514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CopyDeque(const JSHandle<TaggedArray> &old, uint32_t newLength, uint32_t oldLength,
6484514f5e3Sopenharmony_ci                                    uint32_t first, uint32_t last);
6494514f5e3Sopenharmony_ci    JSHandle<JSAPIDequeIterator> NewJSAPIDequeIterator(const JSHandle<JSAPIDeque> &deque);
6504514f5e3Sopenharmony_ci    JSHandle<JSAPIArrayListIterator> NewJSAPIArrayListIterator(const JSHandle<JSAPIArrayList> &arrayList);
6514514f5e3Sopenharmony_ci    JSHandle<JSAPIList> NewJSAPIList();
6524514f5e3Sopenharmony_ci    JSHandle<JSAPILinkedList> NewJSAPILinkedList();
6534514f5e3Sopenharmony_ci    JSHandle<JSAPILinkedListIterator> NewJSAPILinkedListIterator(const JSHandle<JSAPILinkedList> &linkedList);
6544514f5e3Sopenharmony_ci    JSHandle<JSAPIListIterator> NewJSAPIListIterator(const JSHandle<JSAPIList> &list);
6554514f5e3Sopenharmony_ci    JSHandle<JSAPITreeMapIterator> NewJSAPITreeMapIterator(const JSHandle<JSAPITreeMap> &map, IterationKind kind);
6564514f5e3Sopenharmony_ci    JSHandle<JSAPITreeSetIterator> NewJSAPITreeSetIterator(const JSHandle<JSAPITreeSet> &set, IterationKind kind);
6574514f5e3Sopenharmony_ci    JSHandle<JSAPIStackIterator> NewJSAPIStackIterator(const JSHandle<JSAPIStack> &stack);
6584514f5e3Sopenharmony_ci    JSHandle<JSAPIVector> NewJSAPIVector(uint32_t capacity);
6594514f5e3Sopenharmony_ci    JSHandle<JSAPIVectorIterator> NewJSAPIVectorIterator(const JSHandle<JSAPIVector> &vector);
6604514f5e3Sopenharmony_ci    JSHandle<JSAPIBitVector> NewJSAPIBitVector(uint32_t capacity);
6614514f5e3Sopenharmony_ci    JSHandle<JSAPIBitVectorIterator> NewJSAPIBitVectorIterator(const JSHandle<JSAPIBitVector> &bitVector);
6624514f5e3Sopenharmony_ci    JSHandle<JSAPIHashMapIterator> NewJSAPIHashMapIterator(const JSHandle<JSAPIHashMap> &hashMap, IterationKind kind);
6634514f5e3Sopenharmony_ci    JSHandle<JSAPIHashSetIterator> NewJSAPIHashSetIterator(const JSHandle<JSAPIHashSet> &hashSet, IterationKind kind);
6644514f5e3Sopenharmony_ci    JSHandle<TaggedHashArray> NewTaggedHashArray(uint32_t length);
6654514f5e3Sopenharmony_ci    JSHandle<LinkedNode> NewLinkedNode(int hash, const JSHandle<JSTaggedValue> &key,
6664514f5e3Sopenharmony_ci                                       const JSHandle<JSTaggedValue> &value,
6674514f5e3Sopenharmony_ci                                       const JSHandle<LinkedNode> &next);
6684514f5e3Sopenharmony_ci    JSHandle<RBTreeNode> NewTreeNode(int hash, const JSHandle<JSTaggedValue> &key,
6694514f5e3Sopenharmony_ci                                     const JSHandle<JSTaggedValue> &value);
6704514f5e3Sopenharmony_ci    // --------------------------------------module--------------------------------------------
6714514f5e3Sopenharmony_ci    JSHandle<ModuleNamespace> NewModuleNamespace();
6724514f5e3Sopenharmony_ci    JSHandle<NativeModuleFailureInfo> NewNativeModuleFailureInfo();
6734514f5e3Sopenharmony_ci    JSHandle<ImportEntry> NewImportEntry();
6744514f5e3Sopenharmony_ci    JSHandle<ImportEntry> NewImportEntry(const JSHandle<JSTaggedValue> &moduleRequest,
6754514f5e3Sopenharmony_ci                                         const JSHandle<JSTaggedValue> &importName,
6764514f5e3Sopenharmony_ci                                         const JSHandle<JSTaggedValue> &localName,
6774514f5e3Sopenharmony_ci                                         SharedTypes sharedTypes);
6784514f5e3Sopenharmony_ci    JSHandle<LocalExportEntry> NewLocalExportEntry();
6794514f5e3Sopenharmony_ci    JSHandle<LocalExportEntry> NewLocalExportEntry(
6804514f5e3Sopenharmony_ci        const JSHandle<JSTaggedValue> &exportName, const JSHandle<JSTaggedValue> &localName,
6814514f5e3Sopenharmony_ci        const uint32_t index, SharedTypes sharedTypes);
6824514f5e3Sopenharmony_ci    JSHandle<IndirectExportEntry> NewIndirectExportEntry();
6834514f5e3Sopenharmony_ci    JSHandle<IndirectExportEntry> NewIndirectExportEntry(const JSHandle<JSTaggedValue> &exportName,
6844514f5e3Sopenharmony_ci                                                         const JSHandle<JSTaggedValue> &moduleRequest,
6854514f5e3Sopenharmony_ci                                                         const JSHandle<JSTaggedValue> &importName,
6864514f5e3Sopenharmony_ci                                                         SharedTypes sharedTypes);
6874514f5e3Sopenharmony_ci    JSHandle<StarExportEntry> NewStarExportEntry();
6884514f5e3Sopenharmony_ci    JSHandle<StarExportEntry> NewStarExportEntry(const JSHandle<JSTaggedValue> &moduleRequest,
6894514f5e3Sopenharmony_ci                                                 SharedTypes sharedTypes);
6904514f5e3Sopenharmony_ci    JSHandle<SourceTextModule> NewSourceTextModule();
6914514f5e3Sopenharmony_ci    JSHandle<ResolvedBinding> NewResolvedBindingRecord();
6924514f5e3Sopenharmony_ci    JSHandle<ResolvedBinding> NewResolvedBindingRecord(const JSHandle<SourceTextModule> &module,
6934514f5e3Sopenharmony_ci                                                       const JSHandle<JSTaggedValue> &bindingName);
6944514f5e3Sopenharmony_ci    JSHandle<ResolvedIndexBinding> NewResolvedIndexBindingRecord();
6954514f5e3Sopenharmony_ci    JSHandle<ResolvedIndexBinding> NewResolvedIndexBindingRecord(
6964514f5e3Sopenharmony_ci        const JSHandle<SourceTextModule> &module, int32_t index);
6974514f5e3Sopenharmony_ci
6984514f5e3Sopenharmony_ci    JSHandle<CellRecord> NewCellRecord();
6994514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSAsyncGeneratorFunction(const JSHandle<Method> &method);
7004514f5e3Sopenharmony_ci    // --------------------------------------require--------------------------------------------
7014514f5e3Sopenharmony_ci    JSHandle<CjsModule> NewCjsModule();
7024514f5e3Sopenharmony_ci    JSHandle<CjsExports> NewCjsExports();
7034514f5e3Sopenharmony_ci    JSHandle<CjsRequire> NewCjsRequire();
7044514f5e3Sopenharmony_ci
7054514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateIteratorResultInstanceClass(const JSHandle<GlobalEnv> &env);
7064514f5e3Sopenharmony_ci
7074514f5e3Sopenharmony_ci    // --------------------------------------old space object--------------------------------------------
7084514f5e3Sopenharmony_ci    JSHandle<JSObject> NewOldSpaceJSObject(const JSHandle<JSHClass> &jshclass);
7094514f5e3Sopenharmony_ci    TaggedObject *NewOldSpaceObject(const JSHandle<JSHClass> &hclass);
7104514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewOldSpaceTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
7114514f5e3Sopenharmony_ci
7124514f5e3Sopenharmony_ci    // ---------------------------------New objects used internally--------------------------------------
7134514f5e3Sopenharmony_ci    JSHandle<JSArray> NewJSStableArrayWithElements(const JSHandle<TaggedArray> &elements);
7144514f5e3Sopenharmony_ci
7154514f5e3Sopenharmony_ci    // ---------------------------------------Used by AOT------------------------------------------------
7164514f5e3Sopenharmony_ci    JSHandle<AOTLiteralInfo> NewAOTLiteralInfo(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
7174514f5e3Sopenharmony_ci    JSHandle<ExtraProfileTypeInfo> NewExtraProfileTypeInfo();
7184514f5e3Sopenharmony_ci    JSHandle<ProfileTypeInfoCell> NewProfileTypeInfoCell(const JSHandle<JSTaggedValue> &value);
7194514f5e3Sopenharmony_ci    JSHandle<FunctionTemplate> NewFunctionTemplate(
7204514f5e3Sopenharmony_ci        const JSHandle<Method> &method, const JSHandle<JSTaggedValue> &module, int32_t length);
7214514f5e3Sopenharmony_ci    JSHandle<VTable> NewVTable(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
7224514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewEcmaHClass(JSHClass *hclass, uint32_t size, JSType type,
7234514f5e3Sopenharmony_ci                                     uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
7244514f5e3Sopenharmony_ci
7254514f5e3Sopenharmony_ci    // napi interface to create object with initial inline properties
7264514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateJSObjectWithProperties(size_t propertyCount, const Local<JSValueRef> *keys,
7274514f5e3Sopenharmony_ci                                                         const PropertyDescriptor *attributes);
7284514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateJSObjectWithNamedProperties(size_t propertyCount, const char **keys,
7294514f5e3Sopenharmony_ci                                                              const Local<JSValueRef> *values);
7304514f5e3Sopenharmony_ci    // Fill the given free memory range with special zam value.
7314514f5e3Sopenharmony_ci    void FillFreeMemoryRange(uintptr_t start, uintptr_t end);
7324514f5e3Sopenharmony_ci
7334514f5e3Sopenharmony_ci    // -----------------------------------shared object-----------------------------------------
7344514f5e3Sopenharmony_ci    JSHandle<JSObject> PUBLIC_API NewSharedOldSpaceJSObject(const JSHandle<JSHClass> &jshclass);
7354514f5e3Sopenharmony_ci
7364514f5e3Sopenharmony_ci    JSHandle<JSObject> PUBLIC_API NewSharedOldSpaceJSObjectWithInit(const JSHandle<JSHClass> &jshclass);
7374514f5e3Sopenharmony_ci
7384514f5e3Sopenharmony_ci    TaggedObject *NewSharedOldSpaceObject(const JSHandle<JSHClass> &hclass);
7394514f5e3Sopenharmony_ci
7404514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateSObjectWithProperties(std::vector<PropertyDescriptor> &descs);
7414514f5e3Sopenharmony_ci
7424514f5e3Sopenharmony_ci    JSHandle<JSHClass> PUBLIC_API NewSEcmaHClass(uint32_t size, JSType type, uint32_t inlinedProps);
7434514f5e3Sopenharmony_ci
7444514f5e3Sopenharmony_ci    JSHandle<JSHClass> PUBLIC_API NewSEcmaHClass(JSHClass *hclass, uint32_t size, JSType type,
7454514f5e3Sopenharmony_ci        uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
7464514f5e3Sopenharmony_ci
7474514f5e3Sopenharmony_ci    JSHandle<JSHClass> PUBLIC_API NewSEcmaHClass(uint32_t size, uint32_t inlinedProps, JSType type,
7484514f5e3Sopenharmony_ci        const JSHandle<JSTaggedValue> &prototype, const JSHandle<JSTaggedValue> &layout);
7494514f5e3Sopenharmony_ci
7504514f5e3Sopenharmony_ci    JSHandle<JSHClass> PUBLIC_API NewSEcmaHClassDictMode(uint32_t size, uint32_t inlinedProps, JSType type,
7514514f5e3Sopenharmony_ci                                              const JSHandle<JSTaggedValue> &prototype);
7524514f5e3Sopenharmony_ci
7534514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewSEcmaHClassClass(JSHClass *hclass, uint32_t size, JSType type);
7544514f5e3Sopenharmony_ci
7554514f5e3Sopenharmony_ci    JSHandle<JSHClass> InitSClassClass();
7564514f5e3Sopenharmony_ci
7574514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewSEcmaReadOnlyHClass(JSHClass *hclass, uint32_t size, JSType type,
7584514f5e3Sopenharmony_ci                                             uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
7594514f5e3Sopenharmony_ci
7604514f5e3Sopenharmony_ci    JSHandle<TaggedArray> SharedEmptyArray() const;
7614514f5e3Sopenharmony_ci
7624514f5e3Sopenharmony_ci    JSHandle<TaggedArray> CopySArray(const JSHandle<TaggedArray> &old, uint32_t oldLength, uint32_t newLength,
7634514f5e3Sopenharmony_ci                                               JSTaggedValue initVal = JSTaggedValue::Hole(),
7644514f5e3Sopenharmony_ci                                               ElementsKind kind = ElementsKind::GENERIC);
7654514f5e3Sopenharmony_ci
7664514f5e3Sopenharmony_ci    JSHandle<TaggedArray> ExtendSArray(const JSHandle<TaggedArray> &old, uint32_t length,
7674514f5e3Sopenharmony_ci                                       JSTaggedValue initVal, [[maybe_unused]] ElementsKind kind);
7684514f5e3Sopenharmony_ci
7694514f5e3Sopenharmony_ci    JSHandle<Method> NewSMethodForNativeFunction(const void *func, FunctionKind kind = FunctionKind::NORMAL_FUNCTION,
7704514f5e3Sopenharmony_ci                                                kungfu::BuiltinsStubCSigns::ID builtinId =
7714514f5e3Sopenharmony_ci                                                kungfu::BuiltinsStubCSigns::INVALID,
7724514f5e3Sopenharmony_ci                                                MemSpaceType spaceType = SHARED_OLD_SPACE);
7734514f5e3Sopenharmony_ci
7744514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewSFunctionByHClass(const JSHandle<Method> &methodHandle,
7754514f5e3Sopenharmony_ci                                              const JSHandle<JSHClass> &hclass);
7764514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewSFunctionByHClass(const void *func, const JSHandle<JSHClass> &hclass,
7774514f5e3Sopenharmony_ci        FunctionKind kind,
7784514f5e3Sopenharmony_ci        kungfu::BuiltinsStubCSigns::ID builtinId = kungfu::BuiltinsStubCSigns::INVALID,
7794514f5e3Sopenharmony_ci        MemSpaceType spaceType = SHARED_OLD_SPACE);
7804514f5e3Sopenharmony_ci
7814514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewSFunctionWithAccessor(
7824514f5e3Sopenharmony_ci        const void *func,
7834514f5e3Sopenharmony_ci        const JSHandle<JSHClass> &hclass,
7844514f5e3Sopenharmony_ci        FunctionKind kind,
7854514f5e3Sopenharmony_ci        kungfu::BuiltinsStubCSigns::ID builtinId = kungfu::BuiltinsStubCSigns::INVALID,
7864514f5e3Sopenharmony_ci        MemSpaceType spaceType = SHARED_OLD_SPACE);
7874514f5e3Sopenharmony_ci
7884514f5e3Sopenharmony_ci    JSHandle<Method> NewSMethod(const MethodLiteral *methodLiteral, MemSpaceType methodSpaceType = SHARED_OLD_SPACE);
7894514f5e3Sopenharmony_ci
7904514f5e3Sopenharmony_ci    JSHandle<Method> PUBLIC_API NewSMethod(const JSPandaFile *jsPandaFile,
7914514f5e3Sopenharmony_ci                                           MethodLiteral *methodLiteral,
7924514f5e3Sopenharmony_ci                                           JSHandle<ConstantPool> constpool,
7934514f5e3Sopenharmony_ci                                           uint32_t entryIndex,
7944514f5e3Sopenharmony_ci                                           bool needSetAotFlag,
7954514f5e3Sopenharmony_ci                                           bool *canFastCall = nullptr);
7964514f5e3Sopenharmony_ci
7974514f5e3Sopenharmony_ci    JSHandle<ConstantPool> NewSConstantPool(uint32_t capacity);
7984514f5e3Sopenharmony_ci
7994514f5e3Sopenharmony_ci    JSHandle<AOTLiteralInfo> NewSAOTLiteralInfo(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
8004514f5e3Sopenharmony_ci
8014514f5e3Sopenharmony_ci    JSHandle<COWTaggedArray> NewSCOWTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
8024514f5e3Sopenharmony_ci
8034514f5e3Sopenharmony_ci    JSHandle<ClassLiteral> NewSClassLiteral();
8044514f5e3Sopenharmony_ci
8054514f5e3Sopenharmony_ci    JSHandle<ClassInfoExtractor> NewSClassInfoExtractor(JSHandle<JSTaggedValue> method);
8064514f5e3Sopenharmony_ci
8074514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewSOldSpaceTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole());
8084514f5e3Sopenharmony_ci
8094514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API NewSTaggedArray(uint32_t length,
8104514f5e3Sopenharmony_ci                                                     JSTaggedValue initVal = JSTaggedValue::Hole(),
8114514f5e3Sopenharmony_ci                                                     MemSpaceType spaceType = SHARED_OLD_SPACE);
8124514f5e3Sopenharmony_ci
8134514f5e3Sopenharmony_ci    JSHandle<AccessorData> NewSAccessorData();
8144514f5e3Sopenharmony_ci
8154514f5e3Sopenharmony_ci    JSHandle<SourceTextModule> NewSSourceTextModule();
8164514f5e3Sopenharmony_ci
8174514f5e3Sopenharmony_ci    JSHandle<ModuleNamespace> NewSModuleNamespace();
8184514f5e3Sopenharmony_ci
8194514f5e3Sopenharmony_ci    JSHandle<ImportEntry> NewSImportEntry(const JSHandle<JSTaggedValue> &moduleRequest,
8204514f5e3Sopenharmony_ci                                         const JSHandle<JSTaggedValue> &importName,
8214514f5e3Sopenharmony_ci                                         const JSHandle<JSTaggedValue> &localName);
8224514f5e3Sopenharmony_ci
8234514f5e3Sopenharmony_ci    JSHandle<LocalExportEntry> NewSLocalExportEntry(const JSHandle<JSTaggedValue> &exportName,
8244514f5e3Sopenharmony_ci        const JSHandle<JSTaggedValue> &localName, const uint32_t index);
8254514f5e3Sopenharmony_ci
8264514f5e3Sopenharmony_ci    JSHandle<IndirectExportEntry> NewSIndirectExportEntry(const JSHandle<JSTaggedValue> &exportName,
8274514f5e3Sopenharmony_ci                                                         const JSHandle<JSTaggedValue> &moduleRequest,
8284514f5e3Sopenharmony_ci                                                         const JSHandle<JSTaggedValue> &importName);
8294514f5e3Sopenharmony_ci
8304514f5e3Sopenharmony_ci    JSHandle<StarExportEntry> NewSStarExportEntry(const JSHandle<JSTaggedValue> &moduleRequest);
8314514f5e3Sopenharmony_ci
8324514f5e3Sopenharmony_ci    JSHandle<ResolvedIndexBinding> NewSResolvedIndexBindingRecord();
8334514f5e3Sopenharmony_ci
8344514f5e3Sopenharmony_ci    JSHandle<ResolvedIndexBinding> NewSResolvedIndexBindingRecord(const JSHandle<SourceTextModule> &module,
8354514f5e3Sopenharmony_ci        int32_t index);
8364514f5e3Sopenharmony_ci
8374514f5e3Sopenharmony_ci    JSHandle<ResolvedBinding> NewSResolvedBindingRecord();
8384514f5e3Sopenharmony_ci
8394514f5e3Sopenharmony_ci    JSHandle<ResolvedBinding> NewSResolvedBindingRecord(const JSHandle<SourceTextModule> &module,
8404514f5e3Sopenharmony_ci        const JSHandle<JSTaggedValue> &bindingName);
8414514f5e3Sopenharmony_ci
8424514f5e3Sopenharmony_ci    JSHandle<ResolvedRecordIndexBinding> NewSResolvedRecordIndexBindingRecord();
8434514f5e3Sopenharmony_ci
8444514f5e3Sopenharmony_ci    JSHandle<ResolvedRecordIndexBinding> NewSResolvedRecordIndexBindingRecord(
8454514f5e3Sopenharmony_ci        const JSHandle<EcmaString> &moduleRecord, const JSHandle<EcmaString> &abcFileName, int32_t index);
8464514f5e3Sopenharmony_ci
8474514f5e3Sopenharmony_ci    JSHandle<ResolvedRecordBinding> NewSResolvedRecordBindingRecord();
8484514f5e3Sopenharmony_ci
8494514f5e3Sopenharmony_ci    JSHandle<ResolvedRecordBinding> NewSResolvedRecordBindingRecord(
8504514f5e3Sopenharmony_ci        const JSHandle<EcmaString> &moduleRecord, const JSHandle<JSTaggedValue> &bindingName);
8514514f5e3Sopenharmony_ci
8524514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> CopyAndReSortSLayoutInfo(const JSHandle<LayoutInfo> &old, int end, int capacity);
8534514f5e3Sopenharmony_ci
8544514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> PUBLIC_API CreateSLayoutInfo(uint32_t properties);
8554514f5e3Sopenharmony_ci
8564514f5e3Sopenharmony_ci    JSHandle<LayoutInfo> PUBLIC_API NewSEmptyLayoutInfo();
8574514f5e3Sopenharmony_ci
8584514f5e3Sopenharmony_ci    JSHandle<ProfileTypeInfoCell> NewSEmptyProfileTypeInfoCell();
8594514f5e3Sopenharmony_ci
8604514f5e3Sopenharmony_ci    JSHandle<FunctionTemplate> NewSFunctionTemplate(
8614514f5e3Sopenharmony_ci        const JSHandle<Method> &method, const JSHandle<JSTaggedValue> &module, int32_t length);
8624514f5e3Sopenharmony_ci
8634514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewSEmptyArray(); // only used for EcmaVM.
8644514f5e3Sopenharmony_ci
8654514f5e3Sopenharmony_ci    JSHandle<MutantTaggedArray> NewSEmptyMutantArray();
8664514f5e3Sopenharmony_ci
8674514f5e3Sopenharmony_ci    JSHandle<TaggedArray> PUBLIC_API NewSDictionaryArray(uint32_t length);
8684514f5e3Sopenharmony_ci
8694514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewSTaggedArrayWithoutInit(uint32_t length,
8704514f5e3Sopenharmony_ci                                                     MemSpaceType spaceType = MemSpaceType::SHARED_OLD_SPACE);
8714514f5e3Sopenharmony_ci
8724514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateSFunctionClass(uint32_t size, JSType type,
8734514f5e3Sopenharmony_ci                                            const JSHandle<JSTaggedValue> &prototype,
8744514f5e3Sopenharmony_ci                                            bool isAccessor = true, bool setProto = false);
8754514f5e3Sopenharmony_ci
8764514f5e3Sopenharmony_ci    JSHandle<JSNativePointer> NewSJSNativePointer(void *externalPointer,
8774514f5e3Sopenharmony_ci                                                  const NativePointerCallback &callBack,
8784514f5e3Sopenharmony_ci                                                  void *data = nullptr,
8794514f5e3Sopenharmony_ci                                                  bool nonMovable = false,
8804514f5e3Sopenharmony_ci                                                  size_t nativeBindingsize = 0,
8814514f5e3Sopenharmony_ci                                                  NativeFlag flag = NativeFlag::NO_DIV);
8824514f5e3Sopenharmony_ci
8834514f5e3Sopenharmony_ci    JSHandle<JSNativePointer> NewSReadOnlyJSNativePointer(void *externalPointer);
8844514f5e3Sopenharmony_ci
8854514f5e3Sopenharmony_ci    JSHandle<AccessorData> NewSInternalAccessor(void *setter, void *getter);
8864514f5e3Sopenharmony_ci
8874514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSWellKnownSymbol(const JSHandle<JSTaggedValue> &name);
8884514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSEmptySymbol();
8894514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSWellKnownSymbolWithChar(std::string_view description);
8904514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSPublicSymbolWithChar(std::string_view description);
8914514f5e3Sopenharmony_ci    JSHandle<JSSymbol> NewSPublicSymbol(const JSHandle<JSTaggedValue> &name);
8924514f5e3Sopenharmony_ci    JSHandle<SendableEnv> NewSendableEnv(int numSlots);
8934514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSSendableFunction(const JSHandle<Method> &methodHandle);
8944514f5e3Sopenharmony_ci
8954514f5e3Sopenharmony_ciprivate:
8964514f5e3Sopenharmony_ci    friend class GlobalEnv;
8974514f5e3Sopenharmony_ci    friend class GlobalEnvConstants;
8984514f5e3Sopenharmony_ci    friend class EcmaString;
8994514f5e3Sopenharmony_ci    friend class SnapshotProcessor;
9004514f5e3Sopenharmony_ci    friend class SingleCharTable;
9014514f5e3Sopenharmony_ci    void InitObjectFields(const TaggedObject *object);
9024514f5e3Sopenharmony_ci
9034514f5e3Sopenharmony_ci    JSThread *thread_ {nullptr};
9044514f5e3Sopenharmony_ci    bool isTriggerGc_ {false};
9054514f5e3Sopenharmony_ci    bool triggerSemiGC_ {false};
9064514f5e3Sopenharmony_ci
9074514f5e3Sopenharmony_ci    EcmaVM *vm_ {nullptr};
9084514f5e3Sopenharmony_ci    Heap *heap_ {nullptr};
9094514f5e3Sopenharmony_ci    SharedHeap *sHeap_ {nullptr};
9104514f5e3Sopenharmony_ci
9114514f5e3Sopenharmony_ci    static constexpr uint32_t LENGTH_THRESHOLD = 50;
9124514f5e3Sopenharmony_ci    static constexpr int MAX_LITERAL_HCLASS_CACHE_SIZE = 63;
9134514f5e3Sopenharmony_ci
9144514f5e3Sopenharmony_ci    NO_COPY_SEMANTIC(ObjectFactory);
9154514f5e3Sopenharmony_ci    NO_MOVE_SEMANTIC(ObjectFactory);
9164514f5e3Sopenharmony_ci
9174514f5e3Sopenharmony_ci    void NewObjectHook() const;
9184514f5e3Sopenharmony_ci    void NewSObjectHook() const;
9194514f5e3Sopenharmony_ci    // used for creating jshclass in GlobalEnv, EcmaVM
9204514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewEcmaHClassClass(JSHClass *hclass, uint32_t size, JSType type);
9214514f5e3Sopenharmony_ci
9224514f5e3Sopenharmony_ci    JSHandle<JSHClass> NewEcmaReadOnlyHClass(JSHClass *hclass, uint32_t size, JSType type,
9234514f5e3Sopenharmony_ci                                             uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
9244514f5e3Sopenharmony_ci    JSHandle<JSHClass> InitClassClass();
9254514f5e3Sopenharmony_ci
9264514f5e3Sopenharmony_ci    // used to create nonmovable js_object
9274514f5e3Sopenharmony_ci    JSHandle<JSObject> NewNonMovableJSObject(const JSHandle<JSHClass> &jshclass);
9284514f5e3Sopenharmony_ci
9294514f5e3Sopenharmony_ci    // used to create nonmovable utf8 string at global constants
9304514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromASCIINonMovable(std::string_view data);
9314514f5e3Sopenharmony_ci    // used to create read only utf8 string at global constants
9324514f5e3Sopenharmony_ci    JSHandle<EcmaString> NewFromASCIIReadOnly(std::string_view data);
9334514f5e3Sopenharmony_ci
9344514f5e3Sopenharmony_ci    // used for creating Function
9354514f5e3Sopenharmony_ci    JSHandle<JSFunction> NewJSFunction(const JSHandle<GlobalEnv> &env, const JSHandle<JSHClass> &hclass);
9364514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateObjectClass(const JSHandle<TaggedArray> &keys, const JSHandle<TaggedArray> &values);
9374514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateObjectClass(const JSHandle<TaggedArray> &properties, size_t length);
9384514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateFunctionClass(FunctionKind kind, uint32_t size, JSType type,
9394514f5e3Sopenharmony_ci                                           const JSHandle<JSTaggedValue> &prototype);
9404514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateBoundFunctionClass();
9414514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateDefaultClassPrototypeHClass(JSHClass *hclass);
9424514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateDefaultClassConstructorHClass(JSHClass *hclass);
9434514f5e3Sopenharmony_ci
9444514f5e3Sopenharmony_ci    // used for creating ref.prototype in buildins, such as Number.prototype
9454514f5e3Sopenharmony_ci    JSHandle<JSPrimitiveRef> NewJSPrimitiveRef(const JSHandle<JSHClass> &hclass,
9464514f5e3Sopenharmony_ci                                               const JSHandle<JSTaggedValue> &object);
9474514f5e3Sopenharmony_ci
9484514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetStringFromStringTable(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress) const;
9494514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetCompressedSubStringFromStringTable(const JSHandle<EcmaString> &string, uint32_t offset,
9504514f5e3Sopenharmony_ci                                                               uint32_t utf8Len) const;
9514514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetStringFromStringTableNonMovable(const uint8_t *utf8Data, uint32_t utf8Len) const;
9524514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetStringFromStringTableReadOnly(const uint8_t *utf8Data, uint32_t utf8Len,
9534514f5e3Sopenharmony_ci                                                          bool canBeCompress = true) const;
9544514f5e3Sopenharmony_ci    // For MUtf-8 string data
9554514f5e3Sopenharmony_ci    EcmaString *PUBLIC_API GetRawStringFromStringTable(StringData sd,
9564514f5e3Sopenharmony_ci                                                       MemSpaceType type = MemSpaceType::SHARED_OLD_SPACE,
9574514f5e3Sopenharmony_ci                                                       bool isConstantString = false, uint32_t idOffset = 0) const;
9584514f5e3Sopenharmony_ci    EcmaString *GetRawStringFromStringTableWithoutJSHandle(StringData sd,
9594514f5e3Sopenharmony_ci                                                           MemSpaceType type = MemSpaceType::SHARED_OLD_SPACE,
9604514f5e3Sopenharmony_ci                                                           bool isConstantString = false,
9614514f5e3Sopenharmony_ci                                                           uint32_t idOffset = 0) const;
9624514f5e3Sopenharmony_ci
9634514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetStringFromStringTable(const uint16_t *utf16Data, uint32_t utf16Len,
9644514f5e3Sopenharmony_ci                                                  bool canBeCompress) const;
9654514f5e3Sopenharmony_ci
9664514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetStringFromStringTable(EcmaString *string) const;
9674514f5e3Sopenharmony_ci
9684514f5e3Sopenharmony_ci    JSHandle<EcmaString> GetStringFromStringTable(const JSHandle<EcmaString> &firstString,
9694514f5e3Sopenharmony_ci                                                  const JSHandle<EcmaString> &secondString);
9704514f5e3Sopenharmony_ci
9714514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateJSArguments(const JSHandle<GlobalEnv> &env);
9724514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateJSArrayInstanceClass(JSHandle<JSTaggedValue> proto,
9734514f5e3Sopenharmony_ci                                                  uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS);
9744514f5e3Sopenharmony_ci    JSHandle<JSHClass> CreateJSRegExpInstanceClass(JSHandle<JSTaggedValue> proto);
9754514f5e3Sopenharmony_ci
9764514f5e3Sopenharmony_ci    inline TaggedObject *AllocObjectWithSpaceType(size_t size, JSHClass *cls, MemSpaceType type);
9774514f5e3Sopenharmony_ci    JSHandle<TaggedArray> NewTaggedArrayWithoutInit(uint32_t length, MemSpaceType spaceType);
9784514f5e3Sopenharmony_ci
9794514f5e3Sopenharmony_ci    // For object with many properties, directly create new HClass instead of searching on transitions
9804514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateLargeJSObjectWithProperties(size_t propertyCount,
9814514f5e3Sopenharmony_ci                                                              const Local<JSValueRef> *keys,
9824514f5e3Sopenharmony_ci                                                              const PropertyDescriptor *descs);
9834514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateLargeJSObjectWithNamedProperties(size_t propertyCount, const char **keys,
9844514f5e3Sopenharmony_ci                                                                   const Local<JSValueRef> *values);
9854514f5e3Sopenharmony_ci    // For object with numerous properties, directly create it in dictionary mode
9864514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateDictionaryJSObjectWithProperties(size_t propertyCount,
9874514f5e3Sopenharmony_ci                                                                   const Local<JSValueRef> *keys,
9884514f5e3Sopenharmony_ci                                                                   const PropertyDescriptor *descs);
9894514f5e3Sopenharmony_ci    JSHandle<JSTaggedValue> CreateDictionaryJSObjectWithNamedProperties(size_t propertyCount, const char **keys,
9904514f5e3Sopenharmony_ci                                                                        const Local<JSValueRef> *values);
9914514f5e3Sopenharmony_ci
9924514f5e3Sopenharmony_ci    JSHandle<MutantTaggedArray> NewMutantTaggedArrayWithoutInit(uint32_t length, MemSpaceType spaceType);
9934514f5e3Sopenharmony_ci
9944514f5e3Sopenharmony_ci    friend class Builtins;    // create builtins object need hclass
9954514f5e3Sopenharmony_ci    friend class JSFunction;  // create prototype_or_hclass need hclass
9964514f5e3Sopenharmony_ci    friend class JSHClass;    // HC transition need hclass
9974514f5e3Sopenharmony_ci    friend class EcmaVM;      // hold the factory instance
9984514f5e3Sopenharmony_ci    friend class JsVerificationTest;
9994514f5e3Sopenharmony_ci    friend class PandaFileTranslator;
10004514f5e3Sopenharmony_ci    friend class LiteralDataExtractor;
10014514f5e3Sopenharmony_ci    friend class RuntimeStubs;
10024514f5e3Sopenharmony_ci    friend class ClassInfoExtractor;
10034514f5e3Sopenharmony_ci    friend class ModuleDataExtractor;
10044514f5e3Sopenharmony_ci    friend class ModuleDataAccessor;
10054514f5e3Sopenharmony_ci    friend class ConstantPool;
10064514f5e3Sopenharmony_ci    friend class EcmaContext;
10074514f5e3Sopenharmony_ci    friend class kungfu::TSHClassGenerator;
10084514f5e3Sopenharmony_ci    friend class panda::FunctionRef;
10094514f5e3Sopenharmony_ci};
10104514f5e3Sopenharmony_ci
10114514f5e3Sopenharmony_ciclass ClassLinkerFactory {
10124514f5e3Sopenharmony_ciprivate:
10134514f5e3Sopenharmony_ci    friend class GlobalEnv;  // root class in class_linker need hclass
10144514f5e3Sopenharmony_ci    friend class EcmaVM;     // root class in class_linker need hclass
10154514f5e3Sopenharmony_ci};
10164514f5e3Sopenharmony_ci}  // namespace panda::ecmascript
10174514f5e3Sopenharmony_ci#endif  // ECMASCRIPT_OBJECT_FACTORY_H
1018