14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License. 54514f5e3Sopenharmony_ci * You may obtain a copy of the License at 64514f5e3Sopenharmony_ci * 74514f5e3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 84514f5e3Sopenharmony_ci * 94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and 134514f5e3Sopenharmony_ci * limitations under the License. 144514f5e3Sopenharmony_ci */ 154514f5e3Sopenharmony_ci 164514f5e3Sopenharmony_ci#include "ecmascript/accessor_data.h" 174514f5e3Sopenharmony_ci#include "ecmascript/builtins/builtins_array.h" 184514f5e3Sopenharmony_ci#include "ecmascript/dfx/hprof/heap_profiler.h" 194514f5e3Sopenharmony_ci#include "ecmascript/dfx/hprof/heap_profiler_interface.h" 204514f5e3Sopenharmony_ci#include "ecmascript/dfx/hprof/heap_snapshot.h" 214514f5e3Sopenharmony_ci#include "ecmascript/dfx/hprof/heap_snapshot_json_serializer.h" 224514f5e3Sopenharmony_ci#include "ecmascript/dfx/hprof/string_hashmap.h" 234514f5e3Sopenharmony_ci#include "ecmascript/dfx/native_module_failure_info.h" 244514f5e3Sopenharmony_ci#include "ecmascript/ecma_vm.h" 254514f5e3Sopenharmony_ci#include "ecmascript/global_dictionary-inl.h" 264514f5e3Sopenharmony_ci#include "ecmascript/global_env.h" 274514f5e3Sopenharmony_ci#include "ecmascript/ic/ic_handler.h" 284514f5e3Sopenharmony_ci#include "ecmascript/ic/property_box.h" 294514f5e3Sopenharmony_ci#include "ecmascript/ic/proto_change_details.h" 304514f5e3Sopenharmony_ci#include "ecmascript/jobs/micro_job_queue.h" 314514f5e3Sopenharmony_ci#include "ecmascript/jobs/pending_job.h" 324514f5e3Sopenharmony_ci#include "ecmascript/jspandafile/class_info_extractor.h" 334514f5e3Sopenharmony_ci#include "ecmascript/jspandafile/class_literal.h" 344514f5e3Sopenharmony_ci#include "ecmascript/jspandafile/program_object.h" 354514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_arraylist.h" 364514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_arraylist_iterator.h" 374514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_deque.h" 384514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_deque_iterator.h" 394514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_lightweightmap.h" 404514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_lightweightmap_iterator.h" 414514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_lightweightset.h" 424514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_lightweightset_iterator.h" 434514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_linked_list.h" 444514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_linked_list_iterator.h" 454514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_list.h" 464514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_list_iterator.h" 474514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_plain_array.h" 484514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_plain_array_iterator.h" 494514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_queue.h" 504514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_queue_iterator.h" 514514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_stack.h" 524514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_stack_iterator.h" 534514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_tree_map.h" 544514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_tree_map_iterator.h" 554514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_tree_set.h" 564514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_tree_set_iterator.h" 574514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_vector.h" 584514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_vector_iterator.h" 594514f5e3Sopenharmony_ci#include "ecmascript/js_arguments.h" 604514f5e3Sopenharmony_ci#include "ecmascript/js_array.h" 614514f5e3Sopenharmony_ci#include "ecmascript/js_array_iterator.h" 624514f5e3Sopenharmony_ci#include "ecmascript/js_arraybuffer.h" 634514f5e3Sopenharmony_ci#include "ecmascript/js_async_from_sync_iterator.h" 644514f5e3Sopenharmony_ci#include "ecmascript/js_async_function.h" 654514f5e3Sopenharmony_ci#include "ecmascript/js_async_generator_object.h" 664514f5e3Sopenharmony_ci#include "ecmascript/js_bigint.h" 674514f5e3Sopenharmony_ci#include "ecmascript/js_collator.h" 684514f5e3Sopenharmony_ci#include "ecmascript/js_dataview.h" 694514f5e3Sopenharmony_ci#include "ecmascript/js_date.h" 704514f5e3Sopenharmony_ci#include "ecmascript/js_date_time_format.h" 714514f5e3Sopenharmony_ci#include "ecmascript/js_finalization_registry.h" 724514f5e3Sopenharmony_ci#include "ecmascript/js_for_in_iterator.h" 734514f5e3Sopenharmony_ci#include "ecmascript/js_function.h" 744514f5e3Sopenharmony_ci#include "ecmascript/js_generator_object.h" 754514f5e3Sopenharmony_ci#include "ecmascript/js_global_object.h" 764514f5e3Sopenharmony_ci#include "ecmascript/js_handle.h" 774514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_hashmap.h" 784514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_hashmap_iterator.h" 794514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_hashset.h" 804514f5e3Sopenharmony_ci#include "ecmascript/js_api/js_api_hashset_iterator.h" 814514f5e3Sopenharmony_ci#include "ecmascript/js_intl.h" 824514f5e3Sopenharmony_ci#include "ecmascript/js_locale.h" 834514f5e3Sopenharmony_ci#include "ecmascript/js_map.h" 844514f5e3Sopenharmony_ci#include "ecmascript/js_map_iterator.h" 854514f5e3Sopenharmony_ci#include "ecmascript/js_number_format.h" 864514f5e3Sopenharmony_ci#include "ecmascript/js_object-inl.h" 874514f5e3Sopenharmony_ci#include "ecmascript/js_plural_rules.h" 884514f5e3Sopenharmony_ci#include "ecmascript/js_displaynames.h" 894514f5e3Sopenharmony_ci#include "ecmascript/js_list_format.h" 904514f5e3Sopenharmony_ci#include "ecmascript/js_primitive_ref.h" 914514f5e3Sopenharmony_ci#include "ecmascript/js_promise.h" 924514f5e3Sopenharmony_ci#include "ecmascript/js_realm.h" 934514f5e3Sopenharmony_ci#include "ecmascript/js_regexp.h" 944514f5e3Sopenharmony_ci#include "ecmascript/js_regexp_iterator.h" 954514f5e3Sopenharmony_ci#include "ecmascript/js_relative_time_format.h" 964514f5e3Sopenharmony_ci#include "ecmascript/js_segmenter.h" 974514f5e3Sopenharmony_ci#include "ecmascript/js_segments.h" 984514f5e3Sopenharmony_ci#include "ecmascript/js_segment_iterator.h" 994514f5e3Sopenharmony_ci#include "ecmascript/js_set.h" 1004514f5e3Sopenharmony_ci#include "ecmascript/js_set_iterator.h" 1014514f5e3Sopenharmony_ci#include "ecmascript/js_string_iterator.h" 1024514f5e3Sopenharmony_ci#include "ecmascript/js_tagged_number.h" 1034514f5e3Sopenharmony_ci#include "ecmascript/js_tagged_value-inl.h" 1044514f5e3Sopenharmony_ci#include "ecmascript/js_thread.h" 1054514f5e3Sopenharmony_ci#include "ecmascript/js_typed_array.h" 1064514f5e3Sopenharmony_ci#include "ecmascript/js_weak_container.h" 1074514f5e3Sopenharmony_ci#include "ecmascript/js_weak_ref.h" 1084514f5e3Sopenharmony_ci#include "ecmascript/layout_info-inl.h" 1094514f5e3Sopenharmony_ci#include "ecmascript/lexical_env.h" 1104514f5e3Sopenharmony_ci#include "ecmascript/linked_hash_table.h" 1114514f5e3Sopenharmony_ci#include "ecmascript/marker_cell.h" 1124514f5e3Sopenharmony_ci#include "ecmascript/mem/assert_scope.h" 1134514f5e3Sopenharmony_ci#include "ecmascript/mem/c_containers.h" 1144514f5e3Sopenharmony_ci#include "ecmascript/mem/machine_code.h" 1154514f5e3Sopenharmony_ci#include "ecmascript/module/js_module_source_text.h" 1164514f5e3Sopenharmony_ci#include "ecmascript/object_factory.h" 1174514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_array.h" 1184514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_sendable_arraybuffer.h" 1194514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_array_iterator.h" 1204514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_map.h" 1214514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_map_iterator.h" 1224514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_set.h" 1234514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_set_iterator.h" 1244514f5e3Sopenharmony_ci#include "ecmascript/shared_objects/js_shared_typed_array.h" 1254514f5e3Sopenharmony_ci#include "ecmascript/stubs/runtime_stubs.h" 1264514f5e3Sopenharmony_ci#include "ecmascript/tagged_array.h" 1274514f5e3Sopenharmony_ci#include "ecmascript/tagged_dictionary.h" 1284514f5e3Sopenharmony_ci#include "ecmascript/tagged_hash_array.h" 1294514f5e3Sopenharmony_ci#include "ecmascript/tagged_list.h" 1304514f5e3Sopenharmony_ci#include "ecmascript/tagged_node.h" 1314514f5e3Sopenharmony_ci#include "ecmascript/tagged_tree.h" 1324514f5e3Sopenharmony_ci#include "ecmascript/template_map.h" 1334514f5e3Sopenharmony_ci#include "ecmascript/tests/test_helper.h" 1344514f5e3Sopenharmony_ci#include "ecmascript/transitions_dictionary.h" 1354514f5e3Sopenharmony_ci#include "ecmascript/require/js_cjs_module.h" 1364514f5e3Sopenharmony_ci#include "ecmascript/require/js_cjs_require.h" 1374514f5e3Sopenharmony_ci#include "ecmascript/require/js_cjs_exports.h" 1384514f5e3Sopenharmony_ci#include <sstream> 1394514f5e3Sopenharmony_ci 1404514f5e3Sopenharmony_ciusing namespace panda::ecmascript; 1414514f5e3Sopenharmony_ciusing namespace panda::ecmascript::base; 1424514f5e3Sopenharmony_ciusing Array = panda::ecmascript::builtins::BuiltinsArray; 1434514f5e3Sopenharmony_ci 1444514f5e3Sopenharmony_ci// NOLINTNEXTLINE(cppcoreguidelines-macro-usage) 1454514f5e3Sopenharmony_ci#define CHECK_DUMP_FIELDS(begin, end, num); \ 1464514f5e3Sopenharmony_ci LOG_ECMA_IF((num) != ((end) - (begin)) / JSTaggedValue::TaggedTypeSize() && sizeof(uintptr_t) == 8, FATAL) \ 1474514f5e3Sopenharmony_ci << "Fields in obj are not in dump list. " 1484514f5e3Sopenharmony_ci 1494514f5e3Sopenharmony_cinamespace panda::test { 1504514f5e3Sopenharmony_ciclass EcmaDumpTest : public BaseTestWithScope<false> { 1514514f5e3Sopenharmony_ci}; 1524514f5e3Sopenharmony_ci 1534514f5e3Sopenharmony_ci#ifndef NDEBUG 1544514f5e3Sopenharmony_ciHWTEST_F_L0(EcmaDumpTest, Dump) 1554514f5e3Sopenharmony_ci{ 1564514f5e3Sopenharmony_ci std::ostringstream os; 1574514f5e3Sopenharmony_ci 1584514f5e3Sopenharmony_ci JSTaggedValue value1(100); 1594514f5e3Sopenharmony_ci value1.Dump(os); 1604514f5e3Sopenharmony_ci 1614514f5e3Sopenharmony_ci JSTaggedValue value2(100.0); 1624514f5e3Sopenharmony_ci JSTaggedValue(value2.GetRawData()).Dump(os); 1634514f5e3Sopenharmony_ci 1644514f5e3Sopenharmony_ci JSTaggedValue::Undefined().Dump(os); 1654514f5e3Sopenharmony_ci JSHandle<GlobalEnv> env = thread->GetEcmaVM()->GetGlobalEnv(); 1664514f5e3Sopenharmony_ci env.GetTaggedValue().Dump(os); 1674514f5e3Sopenharmony_ci 1684514f5e3Sopenharmony_ci JSHandle<JSFunction> objFunc(env->GetObjectFunction()); 1694514f5e3Sopenharmony_ci objFunc.GetTaggedValue().Dump(os); 1704514f5e3Sopenharmony_ci} 1714514f5e3Sopenharmony_ci#endif // #ifndef NDEBUG 1724514f5e3Sopenharmony_ci 1734514f5e3Sopenharmony_ciHWTEST_F_L0(EcmaDumpTest, DumpTaggedValueType) 1744514f5e3Sopenharmony_ci{ 1754514f5e3Sopenharmony_ci std::vector<JSHandle<JSTaggedValue>> loopVal {}; 1764514f5e3Sopenharmony_ci std::vector<std::string> loopRes {}; 1774514f5e3Sopenharmony_ci // [Int] 1784514f5e3Sopenharmony_ci int32_t a = 1; 1794514f5e3Sopenharmony_ci JSTaggedValue intVal = JSTaggedValue(a); 1804514f5e3Sopenharmony_ci loopVal.push_back(JSHandle<JSTaggedValue>(thread, intVal)); 1814514f5e3Sopenharmony_ci loopRes.push_back("[Int]"); 1824514f5e3Sopenharmony_ci // [Double] 1834514f5e3Sopenharmony_ci double b = 3.14; 1844514f5e3Sopenharmony_ci JSTaggedValue doubleVal = JSTaggedValue(b); 1854514f5e3Sopenharmony_ci loopVal.push_back(JSHandle<JSTaggedValue>(thread, doubleVal)); 1864514f5e3Sopenharmony_ci loopRes.push_back("[Double]"); 1874514f5e3Sopenharmony_ci // [Undefine] 1884514f5e3Sopenharmony_ci JSTaggedValue undefineVal = JSTaggedValue::Undefined(); 1894514f5e3Sopenharmony_ci loopVal.push_back(JSHandle<JSTaggedValue>(thread, undefineVal)); 1904514f5e3Sopenharmony_ci loopRes.push_back("[Special Value] : Undefined"); 1914514f5e3Sopenharmony_ci // [Null] 1924514f5e3Sopenharmony_ci JSTaggedValue nullVal = JSTaggedValue::Null(); 1934514f5e3Sopenharmony_ci loopVal.push_back(JSHandle<JSTaggedValue>(thread, nullVal)); 1944514f5e3Sopenharmony_ci loopRes.push_back("[Special Value] : Null"); 1954514f5e3Sopenharmony_ci // JSArray 1964514f5e3Sopenharmony_ci JSHandle<JSFunction> array(thread->GetEcmaVM()->GetGlobalEnv()->GetArrayFunction()); 1974514f5e3Sopenharmony_ci JSHandle<JSObject> globalObject(thread, thread->GetEcmaVM()->GetGlobalEnv()->GetGlobalObject()); 1984514f5e3Sopenharmony_ci auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); 1994514f5e3Sopenharmony_ci ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); 2004514f5e3Sopenharmony_ci ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); 2014514f5e3Sopenharmony_ci [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1); 2024514f5e3Sopenharmony_ci JSTaggedValue arrVal = Array::ArrayConstructor(ecmaRuntimeCallInfo1); 2034514f5e3Sopenharmony_ci TestHelper::TearDownFrame(thread, prev); 2044514f5e3Sopenharmony_ci loopVal.push_back(JSHandle<JSTaggedValue>(thread, arrVal)); 2054514f5e3Sopenharmony_ci loopRes.push_back("[Array]"); 2064514f5e3Sopenharmony_ci // Object 2074514f5e3Sopenharmony_ci JSHandle<GlobalEnv> globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 2084514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> objFun = globalEnv->GetObjectFunction(); 2094514f5e3Sopenharmony_ci ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); 2104514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> obj(factory->NewJSObjectByConstructor(JSHandle<JSFunction>(objFun), objFun)); 2114514f5e3Sopenharmony_ci loopVal.push_back(obj); 2124514f5e3Sopenharmony_ci loopRes.push_back("[Object]"); 2134514f5e3Sopenharmony_ci 2144514f5e3Sopenharmony_ci for (int i = 0; i < loopVal.size(); i++) { 2154514f5e3Sopenharmony_ci std::stringstream oss; 2164514f5e3Sopenharmony_ci loopVal[i].GetTaggedValue().DumpTaggedValueType(oss); 2174514f5e3Sopenharmony_ci ASSERT_EQ(oss.str(), loopRes[i]); 2184514f5e3Sopenharmony_ci } 2194514f5e3Sopenharmony_ci} 2204514f5e3Sopenharmony_ci 2214514f5e3Sopenharmony_cistatic JSHandle<JSMap> NewJSMap(JSThread *thread, ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 2224514f5e3Sopenharmony_ci{ 2234514f5e3Sopenharmony_ci JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSMap::SIZE, JSType::JS_MAP, proto); 2244514f5e3Sopenharmony_ci JSHandle<JSMap> jsMap = JSHandle<JSMap>::Cast(factory->NewJSObjectWithInit(mapClass)); 2254514f5e3Sopenharmony_ci JSHandle<LinkedHashMap> linkedMap(LinkedHashMap::Create(thread)); 2264514f5e3Sopenharmony_ci jsMap->SetLinkedMap(thread, linkedMap); 2274514f5e3Sopenharmony_ci return jsMap; 2284514f5e3Sopenharmony_ci} 2294514f5e3Sopenharmony_ci 2304514f5e3Sopenharmony_cistatic JSHandle<JSSharedMap> NewJSSharedMap(JSThread *thread, ObjectFactory *factory) 2314514f5e3Sopenharmony_ci{ 2324514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 2334514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetSFunctionPrototype(); 2344514f5e3Sopenharmony_ci auto emptySLayout = thread->GlobalConstants()->GetHandledEmptySLayoutInfo(); 2354514f5e3Sopenharmony_ci JSHandle<JSHClass> mapClass = factory->NewSEcmaHClass(JSSharedMap::SIZE, 0, 2364514f5e3Sopenharmony_ci JSType::JS_SHARED_MAP, proto, emptySLayout); 2374514f5e3Sopenharmony_ci JSHandle<JSSharedMap> jsMap = JSHandle<JSSharedMap>::Cast(factory->NewJSObjectWithInit(mapClass)); 2384514f5e3Sopenharmony_ci JSHandle<LinkedHashMap> linkedMap( 2394514f5e3Sopenharmony_ci LinkedHashMap::Create(thread, LinkedHashMap::MIN_CAPACITY, MemSpaceKind::SHARED)); 2404514f5e3Sopenharmony_ci jsMap->SetLinkedMap(thread, linkedMap); 2414514f5e3Sopenharmony_ci jsMap->SetModRecord(0); 2424514f5e3Sopenharmony_ci return jsMap; 2434514f5e3Sopenharmony_ci} 2444514f5e3Sopenharmony_ci 2454514f5e3Sopenharmony_cistatic JSHandle<JSSet> NewJSSet(JSThread *thread, ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 2464514f5e3Sopenharmony_ci{ 2474514f5e3Sopenharmony_ci JSHandle<JSHClass> setClass = factory->NewEcmaHClass(JSSet::SIZE, JSType::JS_SET, proto); 2484514f5e3Sopenharmony_ci JSHandle<JSSet> jsSet = JSHandle<JSSet>::Cast(factory->NewJSObjectWithInit(setClass)); 2494514f5e3Sopenharmony_ci JSHandle<LinkedHashSet> linkedSet(LinkedHashSet::Create(thread)); 2504514f5e3Sopenharmony_ci jsSet->SetLinkedSet(thread, linkedSet); 2514514f5e3Sopenharmony_ci return jsSet; 2524514f5e3Sopenharmony_ci} 2534514f5e3Sopenharmony_ci 2544514f5e3Sopenharmony_cistatic JSHandle<JSSharedSet> NewJSSharedSet(JSThread *thread, ObjectFactory *factory) 2554514f5e3Sopenharmony_ci{ 2564514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 2574514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetSFunctionPrototype(); 2584514f5e3Sopenharmony_ci auto emptySLayout = thread->GlobalConstants()->GetHandledEmptySLayoutInfo(); 2594514f5e3Sopenharmony_ci JSHandle<JSHClass> setClass = factory->NewSEcmaHClass(JSSharedSet::SIZE, 0, 2604514f5e3Sopenharmony_ci JSType::JS_SHARED_SET, proto, emptySLayout); 2614514f5e3Sopenharmony_ci JSHandle<JSSharedSet> jsSet = JSHandle<JSSharedSet>::Cast(factory->NewJSObjectWithInit(setClass)); 2624514f5e3Sopenharmony_ci JSHandle<LinkedHashSet> linkedSet( 2634514f5e3Sopenharmony_ci LinkedHashSet::Create(thread, LinkedHashSet::MIN_CAPACITY, MemSpaceKind::SHARED)); 2644514f5e3Sopenharmony_ci jsSet->SetLinkedSet(thread, linkedSet); 2654514f5e3Sopenharmony_ci jsSet->SetModRecord(0); 2664514f5e3Sopenharmony_ci return jsSet; 2674514f5e3Sopenharmony_ci} 2684514f5e3Sopenharmony_ci 2694514f5e3Sopenharmony_cistatic JSHandle<JSAPIHashMap> NewJSAPIHashMap(JSThread *thread, ObjectFactory *factory) 2704514f5e3Sopenharmony_ci{ 2714514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 2724514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 2734514f5e3Sopenharmony_ci JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPIHashMap::SIZE, JSType::JS_API_HASH_MAP, proto); 2744514f5e3Sopenharmony_ci JSHandle<JSAPIHashMap> jsHashMap = JSHandle<JSAPIHashMap>::Cast(factory->NewJSObjectWithInit(mapClass)); 2754514f5e3Sopenharmony_ci jsHashMap->SetTable(thread, TaggedHashArray::Create(thread)); 2764514f5e3Sopenharmony_ci jsHashMap->SetSize(0); 2774514f5e3Sopenharmony_ci return jsHashMap; 2784514f5e3Sopenharmony_ci} 2794514f5e3Sopenharmony_ci 2804514f5e3Sopenharmony_cistatic JSHandle<JSAPIHashSet> NewJSAPIHashSet(JSThread *thread, ObjectFactory *factory) 2814514f5e3Sopenharmony_ci{ 2824514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 2834514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 2844514f5e3Sopenharmony_ci JSHandle<JSHClass> setClass = factory->NewEcmaHClass(JSAPIHashSet::SIZE, JSType::JS_API_HASH_SET, proto); 2854514f5e3Sopenharmony_ci JSHandle<JSAPIHashSet> jsHashSet = JSHandle<JSAPIHashSet>::Cast(factory->NewJSObjectWithInit(setClass)); 2864514f5e3Sopenharmony_ci jsHashSet->SetTable(thread, TaggedHashArray::Create(thread)); 2874514f5e3Sopenharmony_ci jsHashSet->SetSize(0); 2884514f5e3Sopenharmony_ci return jsHashSet; 2894514f5e3Sopenharmony_ci} 2904514f5e3Sopenharmony_ci 2914514f5e3Sopenharmony_cistatic JSHandle<JSAPITreeMap> NewJSAPITreeMap(JSThread *thread, ObjectFactory *factory) 2924514f5e3Sopenharmony_ci{ 2934514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 2944514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 2954514f5e3Sopenharmony_ci JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPITreeMap::SIZE, JSType::JS_API_TREE_MAP, proto); 2964514f5e3Sopenharmony_ci JSHandle<JSAPITreeMap> jsTreeMap = JSHandle<JSAPITreeMap>::Cast(factory->NewJSObjectWithInit(mapClass)); 2974514f5e3Sopenharmony_ci JSHandle<TaggedTreeMap> treeMap(thread, TaggedTreeMap::Create(thread)); 2984514f5e3Sopenharmony_ci jsTreeMap->SetTreeMap(thread, treeMap); 2994514f5e3Sopenharmony_ci return jsTreeMap; 3004514f5e3Sopenharmony_ci} 3014514f5e3Sopenharmony_ci 3024514f5e3Sopenharmony_cistatic JSHandle<JSAPITreeSet> NewJSAPITreeSet(JSThread *thread, ObjectFactory *factory) 3034514f5e3Sopenharmony_ci{ 3044514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 3054514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 3064514f5e3Sopenharmony_ci JSHandle<JSHClass> setClass = factory->NewEcmaHClass(JSAPITreeSet::SIZE, JSType::JS_API_TREE_SET, proto); 3074514f5e3Sopenharmony_ci JSHandle<JSAPITreeSet> jsTreeSet = JSHandle<JSAPITreeSet>::Cast(factory->NewJSObjectWithInit(setClass)); 3084514f5e3Sopenharmony_ci JSHandle<TaggedTreeSet> treeSet(thread, TaggedTreeSet::Create(thread)); 3094514f5e3Sopenharmony_ci jsTreeSet->SetTreeSet(thread, treeSet); 3104514f5e3Sopenharmony_ci return jsTreeSet; 3114514f5e3Sopenharmony_ci} 3124514f5e3Sopenharmony_ci 3134514f5e3Sopenharmony_cistatic JSHandle<JSAPIPlainArray> NewJSAPIPlainArray(JSThread *thread, ObjectFactory *factory) 3144514f5e3Sopenharmony_ci{ 3154514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 3164514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 3174514f5e3Sopenharmony_ci JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPIPlainArray::SIZE, JSType::JS_API_PLAIN_ARRAY, proto); 3184514f5e3Sopenharmony_ci JSHandle<JSAPIPlainArray> jSAPIPlainArray = JSHandle<JSAPIPlainArray>::Cast(factory->NewJSObjectWithInit(mapClass)); 3194514f5e3Sopenharmony_ci JSHandle<TaggedArray> keys = 3204514f5e3Sopenharmony_ci JSAPIPlainArray::CreateSlot(thread, JSAPIPlainArray::DEFAULT_CAPACITY_LENGTH); 3214514f5e3Sopenharmony_ci JSHandle<TaggedArray> values = 3224514f5e3Sopenharmony_ci JSAPIPlainArray::CreateSlot(thread, JSAPIPlainArray::DEFAULT_CAPACITY_LENGTH); 3234514f5e3Sopenharmony_ci jSAPIPlainArray->SetKeys(thread, keys); 3244514f5e3Sopenharmony_ci jSAPIPlainArray->SetValues(thread, values); 3254514f5e3Sopenharmony_ci jSAPIPlainArray->SetLength(0); 3264514f5e3Sopenharmony_ci return jSAPIPlainArray; 3274514f5e3Sopenharmony_ci} 3284514f5e3Sopenharmony_ci 3294514f5e3Sopenharmony_cistatic JSHandle<JSAPIList> NewJSAPIList(JSThread *thread, ObjectFactory *factory) 3304514f5e3Sopenharmony_ci{ 3314514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 3324514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 3334514f5e3Sopenharmony_ci JSHandle<JSHClass> listClass = factory->NewEcmaHClass(JSAPIList::SIZE, JSType::JS_API_LIST, proto); 3344514f5e3Sopenharmony_ci JSHandle<JSAPIList> jsAPIList = JSHandle<JSAPIList>::Cast(factory->NewJSObjectWithInit(listClass)); 3354514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> taggedSingleList(thread, TaggedSingleList::Create(thread)); 3364514f5e3Sopenharmony_ci jsAPIList->SetSingleList(thread, taggedSingleList); 3374514f5e3Sopenharmony_ci return jsAPIList; 3384514f5e3Sopenharmony_ci} 3394514f5e3Sopenharmony_ci 3404514f5e3Sopenharmony_cistatic JSHandle<JSAPILinkedList> NewJSAPILinkedList(JSThread *thread, ObjectFactory *factory) 3414514f5e3Sopenharmony_ci{ 3424514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 3434514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 3444514f5e3Sopenharmony_ci JSHandle<JSHClass> mapClass = factory->NewEcmaHClass(JSAPILinkedList::SIZE, JSType::JS_API_LINKED_LIST, proto); 3454514f5e3Sopenharmony_ci JSHandle<JSAPILinkedList> jsAPILinkedList = JSHandle<JSAPILinkedList>::Cast(factory->NewJSObjectWithInit(mapClass)); 3464514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> linkedlist(thread, TaggedDoubleList::Create(thread)); 3474514f5e3Sopenharmony_ci jsAPILinkedList->SetDoubleList(thread, linkedlist); 3484514f5e3Sopenharmony_ci return jsAPILinkedList; 3494514f5e3Sopenharmony_ci} 3504514f5e3Sopenharmony_ci 3514514f5e3Sopenharmony_cistatic JSHandle<JSObject> NewJSObject(JSThread *thread, ObjectFactory *factory, JSHandle<GlobalEnv> globalEnv) 3524514f5e3Sopenharmony_ci{ 3534514f5e3Sopenharmony_ci JSFunction *jsFunc = globalEnv->GetObjectFunction().GetObject<JSFunction>(); 3544514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> jsFunc1(thread, jsFunc); 3554514f5e3Sopenharmony_ci JSHandle<JSObject> jsObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(jsFunc1), jsFunc1); 3564514f5e3Sopenharmony_ci return jsObj; 3574514f5e3Sopenharmony_ci} 3584514f5e3Sopenharmony_ci 3594514f5e3Sopenharmony_cistatic JSHandle<JSAPIArrayList> NewJSAPIArrayList(JSThread *thread, ObjectFactory *factory, 3604514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto) 3614514f5e3Sopenharmony_ci{ 3624514f5e3Sopenharmony_ci JSHandle<JSHClass> arrayListClass = 3634514f5e3Sopenharmony_ci factory->NewEcmaHClass(JSAPIArrayList::SIZE, JSType::JS_API_ARRAY_LIST, proto); 3644514f5e3Sopenharmony_ci JSHandle<JSAPIArrayList> jsArrayList = JSHandle<JSAPIArrayList>::Cast(factory->NewJSObjectWithInit(arrayListClass)); 3654514f5e3Sopenharmony_ci jsArrayList->SetLength(thread, JSTaggedValue(0)); 3664514f5e3Sopenharmony_ci return jsArrayList; 3674514f5e3Sopenharmony_ci} 3684514f5e3Sopenharmony_ci 3694514f5e3Sopenharmony_cistatic JSHandle<JSAPIStack> NewJSAPIStack(ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 3704514f5e3Sopenharmony_ci{ 3714514f5e3Sopenharmony_ci JSHandle<JSHClass> stackClass = factory->NewEcmaHClass(JSAPIStack::SIZE, JSType::JS_API_STACK, proto); 3724514f5e3Sopenharmony_ci JSHandle<JSAPIStack> jsStack = JSHandle<JSAPIStack>::Cast(factory->NewJSObjectWithInit(stackClass)); 3734514f5e3Sopenharmony_ci jsStack->SetTop(0); 3744514f5e3Sopenharmony_ci return jsStack; 3754514f5e3Sopenharmony_ci} 3764514f5e3Sopenharmony_ci 3774514f5e3Sopenharmony_cistatic JSHandle<JSRegExp> NewJSRegExp(JSThread *thread, ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 3784514f5e3Sopenharmony_ci{ 3794514f5e3Sopenharmony_ci JSHandle<JSHClass> jSRegExpClass = 3804514f5e3Sopenharmony_ci factory->NewEcmaHClass(JSRegExp::SIZE, JSType::JS_REG_EXP, proto); 3814514f5e3Sopenharmony_ci JSHandle<JSRegExp> jSRegExp = JSHandle<JSRegExp>::Cast(factory->NewJSObject(jSRegExpClass)); 3824514f5e3Sopenharmony_ci jSRegExp->SetByteCodeBuffer(thread, JSTaggedValue::Undefined()); 3834514f5e3Sopenharmony_ci jSRegExp->SetOriginalSource(thread, JSTaggedValue::Undefined()); 3844514f5e3Sopenharmony_ci jSRegExp->SetGroupName(thread, JSTaggedValue::Undefined()); 3854514f5e3Sopenharmony_ci jSRegExp->SetOriginalFlags(thread, JSTaggedValue(0)); 3864514f5e3Sopenharmony_ci jSRegExp->SetLength(0); 3874514f5e3Sopenharmony_ci return jSRegExp; 3884514f5e3Sopenharmony_ci} 3894514f5e3Sopenharmony_ci 3904514f5e3Sopenharmony_cistatic JSHandle<JSAPILightWeightMap> NewJSAPILightWeightMap(JSThread *thread, ObjectFactory *factory) 3914514f5e3Sopenharmony_ci{ 3924514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 3934514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 3944514f5e3Sopenharmony_ci JSHandle<JSHClass> lwmapClass = 3954514f5e3Sopenharmony_ci factory->NewEcmaHClass(JSAPILightWeightMap::SIZE, JSType::JS_API_LIGHT_WEIGHT_MAP, proto); 3964514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightMap> jSAPILightWeightMap = 3974514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightMap>::Cast(factory->NewJSObjectWithInit(lwmapClass)); 3984514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> hashArray = 3994514f5e3Sopenharmony_ci JSHandle<JSTaggedValue>(factory->NewTaggedArray(JSAPILightWeightMap::DEFAULT_CAPACITY_LENGTH)); 4004514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> keyArray = 4014514f5e3Sopenharmony_ci JSHandle<JSTaggedValue>(factory->NewTaggedArray(JSAPILightWeightMap::DEFAULT_CAPACITY_LENGTH)); 4024514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> valueArray = 4034514f5e3Sopenharmony_ci JSHandle<JSTaggedValue>(factory->NewTaggedArray(JSAPILightWeightMap::DEFAULT_CAPACITY_LENGTH)); 4044514f5e3Sopenharmony_ci jSAPILightWeightMap->SetHashes(thread, hashArray); 4054514f5e3Sopenharmony_ci jSAPILightWeightMap->SetKeys(thread, keyArray); 4064514f5e3Sopenharmony_ci jSAPILightWeightMap->SetValues(thread, valueArray); 4074514f5e3Sopenharmony_ci jSAPILightWeightMap->SetLength(0); 4084514f5e3Sopenharmony_ci return jSAPILightWeightMap; 4094514f5e3Sopenharmony_ci} 4104514f5e3Sopenharmony_ci 4114514f5e3Sopenharmony_cistatic JSHandle<JSAPILightWeightSet> NewJSAPILightWeightSet(JSThread *thread, ObjectFactory *factory) 4124514f5e3Sopenharmony_ci{ 4134514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 4144514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetObjectFunctionPrototype(); 4154514f5e3Sopenharmony_ci JSHandle<JSHClass> setClass = 4164514f5e3Sopenharmony_ci factory->NewEcmaHClass(JSAPILightWeightSet::SIZE, JSType::JS_API_LIGHT_WEIGHT_SET, proto); 4174514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightSet> jSAPILightWeightSet = 4184514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightSet>::Cast(factory->NewJSObjectWithInit(setClass)); 4194514f5e3Sopenharmony_ci JSHandle<TaggedArray> hashes = 4204514f5e3Sopenharmony_ci JSAPILightWeightSet::CreateSlot(thread, JSAPILightWeightSet::DEFAULT_CAPACITY_LENGTH); 4214514f5e3Sopenharmony_ci JSHandle<TaggedArray> values = 4224514f5e3Sopenharmony_ci JSAPILightWeightSet::CreateSlot(thread, JSAPILightWeightSet::DEFAULT_CAPACITY_LENGTH); 4234514f5e3Sopenharmony_ci jSAPILightWeightSet->SetHashes(thread, hashes); 4244514f5e3Sopenharmony_ci jSAPILightWeightSet->SetValues(thread, values); 4254514f5e3Sopenharmony_ci jSAPILightWeightSet->SetLength(0); 4264514f5e3Sopenharmony_ci return jSAPILightWeightSet; 4274514f5e3Sopenharmony_ci} 4284514f5e3Sopenharmony_ci 4294514f5e3Sopenharmony_cistatic JSHandle<JSAPIQueue> NewJSAPIQueue(JSThread *thread, ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 4304514f5e3Sopenharmony_ci{ 4314514f5e3Sopenharmony_ci JSHandle<JSHClass> queueClass = factory->NewEcmaHClass(JSAPIQueue::SIZE, JSType::JS_API_QUEUE, proto); 4324514f5e3Sopenharmony_ci JSHandle<JSAPIQueue> jsQueue = JSHandle<JSAPIQueue>::Cast(factory->NewJSObjectWithInit(queueClass)); 4334514f5e3Sopenharmony_ci JSHandle<TaggedArray> newElements = factory->NewTaggedArray(JSAPIQueue::DEFAULT_CAPACITY_LENGTH); 4344514f5e3Sopenharmony_ci jsQueue->SetLength(thread, JSTaggedValue(0)); 4354514f5e3Sopenharmony_ci jsQueue->SetFront(0); 4364514f5e3Sopenharmony_ci jsQueue->SetTail(0); 4374514f5e3Sopenharmony_ci jsQueue->SetElements(thread, newElements); 4384514f5e3Sopenharmony_ci return jsQueue; 4394514f5e3Sopenharmony_ci} 4404514f5e3Sopenharmony_ci 4414514f5e3Sopenharmony_cistatic JSHandle<JSAPIDeque> NewJSAPIDeque(JSThread *thread, ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 4424514f5e3Sopenharmony_ci{ 4434514f5e3Sopenharmony_ci JSHandle<JSHClass> dequeClass = factory->NewEcmaHClass(JSAPIDeque::SIZE, JSType::JS_API_DEQUE, proto); 4444514f5e3Sopenharmony_ci JSHandle<JSAPIDeque> jsDeque = JSHandle<JSAPIDeque>::Cast(factory->NewJSObjectWithInit(dequeClass)); 4454514f5e3Sopenharmony_ci JSHandle<TaggedArray> newElements = factory->NewTaggedArray(JSAPIDeque::DEFAULT_CAPACITY_LENGTH); 4464514f5e3Sopenharmony_ci jsDeque->SetFirst(0); 4474514f5e3Sopenharmony_ci jsDeque->SetLast(0); 4484514f5e3Sopenharmony_ci jsDeque->SetElements(thread, newElements); 4494514f5e3Sopenharmony_ci return jsDeque; 4504514f5e3Sopenharmony_ci} 4514514f5e3Sopenharmony_ci 4524514f5e3Sopenharmony_cistatic JSHandle<JSAPIVector> NewJSAPIVector(ObjectFactory *factory, JSHandle<JSTaggedValue> proto) 4534514f5e3Sopenharmony_ci{ 4544514f5e3Sopenharmony_ci JSHandle<JSHClass> vectorClass = factory->NewEcmaHClass(JSAPIVector::SIZE, JSType::JS_API_VECTOR, proto); 4554514f5e3Sopenharmony_ci JSHandle<JSAPIVector> jsVector = JSHandle<JSAPIVector>::Cast(factory->NewJSObjectWithInit(vectorClass)); 4564514f5e3Sopenharmony_ci jsVector->SetLength(0); 4574514f5e3Sopenharmony_ci return jsVector; 4584514f5e3Sopenharmony_ci} 4594514f5e3Sopenharmony_ci 4604514f5e3Sopenharmony_ciHWTEST_F_L0(EcmaDumpTest, HeapProfileDump) 4614514f5e3Sopenharmony_ci{ 4624514f5e3Sopenharmony_ci [[maybe_unused]] ecmascript::EcmaHandleScope scope(thread); 4634514f5e3Sopenharmony_ci auto factory = thread->GetEcmaVM()->GetFactory(); 4644514f5e3Sopenharmony_ci auto globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); 4654514f5e3Sopenharmony_ci auto globalConst = const_cast<GlobalEnvConstants *>(thread->GlobalConstants()); 4664514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> proto = globalEnv->GetFunctionPrototype(); 4674514f5e3Sopenharmony_ci std::vector<Reference> snapshotVector; 4684514f5e3Sopenharmony_ci std::ostringstream os; 4694514f5e3Sopenharmony_ci 4704514f5e3Sopenharmony_ci#define DUMP_FOR_HANDLE(dumpHandle) \ 4714514f5e3Sopenharmony_ci do { \ 4724514f5e3Sopenharmony_ci JSTaggedValue dumpValue = (dumpHandle).GetTaggedValue(); \ 4734514f5e3Sopenharmony_ci dumpValue.Dump(os); \ 4744514f5e3Sopenharmony_ci dumpValue.DumpForSnapshot(snapshotVector); \ 4754514f5e3Sopenharmony_ci /* Testing runtime stubs: */ \ 4764514f5e3Sopenharmony_ci JSTaggedType dumpRawData = dumpValue.GetRawData(); \ 4774514f5e3Sopenharmony_ci uintptr_t hintStr = reinterpret_cast<uintptr_t>("Testing with: " #dumpHandle); \ 4784514f5e3Sopenharmony_ci RuntimeStubs::Dump(dumpRawData); \ 4794514f5e3Sopenharmony_ci RuntimeStubs::DebugDump(dumpRawData); \ 4804514f5e3Sopenharmony_ci RuntimeStubs::DumpWithHint(hintStr, dumpRawData); \ 4814514f5e3Sopenharmony_ci RuntimeStubs::DebugDumpWithHint(hintStr, dumpRawData); \ 4824514f5e3Sopenharmony_ci } while (false) 4834514f5e3Sopenharmony_ci 4844514f5e3Sopenharmony_ci#if defined(PANDA_TARGET_AMD64) || defined(PANDA_TARGET_ARM64) 4854514f5e3Sopenharmony_ci static const unsigned int machineCodeSize = 39; 4864514f5e3Sopenharmony_ci#else 4874514f5e3Sopenharmony_ci static const unsigned int machineCodeSize = 23; 4884514f5e3Sopenharmony_ci#endif 4894514f5e3Sopenharmony_ci 4904514f5e3Sopenharmony_ci#define NEW_OBJECT_AND_DUMP(ClassName, TypeName) \ 4914514f5e3Sopenharmony_ci do { \ 4924514f5e3Sopenharmony_ci JSHandle<JSHClass> class##ClassName = \ 4934514f5e3Sopenharmony_ci factory->NewEcmaHClass(ClassName::SIZE, JSType::TypeName, proto); \ 4944514f5e3Sopenharmony_ci JSHandle<JSObject> object##ClassName = factory->NewJSObjectWithInit(class##ClassName); \ 4954514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(object##ClassName); \ 4964514f5e3Sopenharmony_ci } while (false) 4974514f5e3Sopenharmony_ci 4984514f5e3Sopenharmony_ci for (JSType type = JSType::JS_OBJECT; type <= JSType::TYPE_LAST; type = JSType(static_cast<int>(type) + 1)) { 4994514f5e3Sopenharmony_ci switch (type) { 5004514f5e3Sopenharmony_ci case JSType::JS_ERROR: 5014514f5e3Sopenharmony_ci case JSType::JS_EVAL_ERROR: 5024514f5e3Sopenharmony_ci case JSType::JS_RANGE_ERROR: 5034514f5e3Sopenharmony_ci case JSType::JS_TYPE_ERROR: 5044514f5e3Sopenharmony_ci case JSType::JS_AGGREGATE_ERROR: 5054514f5e3Sopenharmony_ci case JSType::JS_REFERENCE_ERROR: 5064514f5e3Sopenharmony_ci case JSType::JS_URI_ERROR: 5074514f5e3Sopenharmony_ci case JSType::JS_ARGUMENTS: 5084514f5e3Sopenharmony_ci case JSType::JS_SYNTAX_ERROR: 5094514f5e3Sopenharmony_ci case JSType::JS_OOM_ERROR: 5104514f5e3Sopenharmony_ci case JSType::JS_TERMINATION_ERROR: 5114514f5e3Sopenharmony_ci case JSType::JS_OBJECT: 5124514f5e3Sopenharmony_ci case JSType::JS_SHARED_OBJECT: { 5134514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(ECMAObject::SIZE, JSObject::SIZE, 2U); 5144514f5e3Sopenharmony_ci JSHandle<JSObject> jsObj = NewJSObject(thread, factory, globalEnv); 5154514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsObj); 5164514f5e3Sopenharmony_ci break; 5174514f5e3Sopenharmony_ci } 5184514f5e3Sopenharmony_ci case JSType::JS_REALM: { 5194514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSRealm::SIZE, 2U); 5204514f5e3Sopenharmony_ci JSHandle<JSRealm> jsRealm = factory->NewJSRealm(); 5214514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsRealm); 5224514f5e3Sopenharmony_ci break; 5234514f5e3Sopenharmony_ci } 5244514f5e3Sopenharmony_ci case JSType::METHOD: { 5254514f5e3Sopenharmony_ci#ifdef PANDA_TARGET_64 5264514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), Method::SIZE, 6U); 5274514f5e3Sopenharmony_ci#else 5284514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), Method::SIZE, 5U); 5294514f5e3Sopenharmony_ci#endif 5304514f5e3Sopenharmony_ci break; 5314514f5e3Sopenharmony_ci } 5324514f5e3Sopenharmony_ci case JSType::JS_FUNCTION_BASE: { 5334514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSFunctionBase::SIZE, 3U); 5344514f5e3Sopenharmony_ci break; 5354514f5e3Sopenharmony_ci } 5364514f5e3Sopenharmony_ci case JSType::JS_FUNCTION: 5374514f5e3Sopenharmony_ci case JSType::JS_SHARED_FUNCTION: { 5384514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunctionBase::SIZE, JSFunction::SIZE, 9U); 5394514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> jsFunc = globalEnv->GetFunctionFunction(); 5404514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsFunc); 5414514f5e3Sopenharmony_ci break; 5424514f5e3Sopenharmony_ci } 5434514f5e3Sopenharmony_ci case JSType::JS_PROXY_REVOC_FUNCTION: { 5444514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSProxyRevocFunction::SIZE, 1U); 5454514f5e3Sopenharmony_ci JSHandle<JSHClass> proxyRevocClass = 5464514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetProxyRevocFunctionClass()); 5474514f5e3Sopenharmony_ci JSHandle<JSObject> proxyRevocFunc = factory->NewJSObjectWithInit(proxyRevocClass); 5484514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(proxyRevocFunc); 5494514f5e3Sopenharmony_ci break; 5504514f5e3Sopenharmony_ci } 5514514f5e3Sopenharmony_ci case JSType::JS_PROMISE_REACTIONS_FUNCTION: { 5524514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseReactionsFunction::SIZE, 2U); 5534514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseReactClass = 5544514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseReactionFunctionClass()); 5554514f5e3Sopenharmony_ci JSHandle<JSObject> promiseReactFunc = factory->NewJSObjectWithInit(promiseReactClass); 5564514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseReactFunc); 5574514f5e3Sopenharmony_ci break; 5584514f5e3Sopenharmony_ci } 5594514f5e3Sopenharmony_ci case JSType::JS_PROMISE_EXECUTOR_FUNCTION: { 5604514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseExecutorFunction::SIZE, 1U); 5614514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseExeClass = 5624514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseExecutorFunctionClass()); 5634514f5e3Sopenharmony_ci JSHandle<JSObject> promiseExeFunc = factory->NewJSObjectWithInit(promiseExeClass); 5644514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseExeFunc); 5654514f5e3Sopenharmony_ci break; 5664514f5e3Sopenharmony_ci } 5674514f5e3Sopenharmony_ci case JSType::JS_ASYNC_MODULE_FULFILLED_FUNCTION: { 5684514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncModuleFulfilledFunction::SIZE, 0U); 5694514f5e3Sopenharmony_ci JSHandle<JSHClass> moduleFulfilledClass = 5704514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetAsyncModuleFulfilledFunctionClass()); 5714514f5e3Sopenharmony_ci JSHandle<JSObject> moduleFulfilledFunc = factory->NewJSObjectWithInit(moduleFulfilledClass); 5724514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(moduleFulfilledFunc); 5734514f5e3Sopenharmony_ci break; 5744514f5e3Sopenharmony_ci } 5754514f5e3Sopenharmony_ci case JSType::JS_ASYNC_MODULE_REJECTED_FUNCTION: { 5764514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncModuleRejectedFunction::SIZE, 0U); 5774514f5e3Sopenharmony_ci JSHandle<JSHClass> moduleRejectedClass = 5784514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetAsyncModuleRejectedFunctionClass()); 5794514f5e3Sopenharmony_ci JSHandle<JSObject> moduleRejectedFunc = factory->NewJSObjectWithInit(moduleRejectedClass); 5804514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(moduleRejectedFunc); 5814514f5e3Sopenharmony_ci break; 5824514f5e3Sopenharmony_ci } 5834514f5e3Sopenharmony_ci case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION: { 5844514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseAllResolveElementFunction::SIZE, 5U); 5854514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseAllClass = 5864514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseAllResolveElementFunctionClass()); 5874514f5e3Sopenharmony_ci JSHandle<JSObject> promiseAllFunc = factory->NewJSObjectWithInit(promiseAllClass); 5884514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseAllFunc); 5894514f5e3Sopenharmony_ci break; 5904514f5e3Sopenharmony_ci } 5914514f5e3Sopenharmony_ci case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION: { 5924514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseAnyRejectElementFunction::SIZE, 5U); 5934514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseAnyClass = 5944514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseAnyRejectElementFunctionClass()); 5954514f5e3Sopenharmony_ci JSHandle<JSObject> promiseAnyFunc = factory->NewJSObjectWithInit(promiseAnyClass); 5964514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseAnyFunc); 5974514f5e3Sopenharmony_ci break; 5984514f5e3Sopenharmony_ci } 5994514f5e3Sopenharmony_ci case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION: { 6004514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseAllSettledElementFunction::SIZE, 5U); 6014514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseAllSettledClass = 6024514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseAllSettledElementFunctionClass()); 6034514f5e3Sopenharmony_ci JSHandle<JSObject> promiseAllSettledFunc = factory->NewJSObjectWithInit(promiseAllSettledClass); 6044514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseAllSettledFunc); 6054514f5e3Sopenharmony_ci break; 6064514f5e3Sopenharmony_ci } 6074514f5e3Sopenharmony_ci case JSType::JS_PROMISE_FINALLY_FUNCTION: { 6084514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseFinallyFunction::SIZE, 2U); 6094514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseFinallyClass = 6104514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseFinallyFunctionClass()); 6114514f5e3Sopenharmony_ci JSHandle<JSObject> promiseFinallyFunc = factory->NewJSObjectWithInit(promiseFinallyClass); 6124514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseFinallyFunc); 6134514f5e3Sopenharmony_ci break; 6144514f5e3Sopenharmony_ci } 6154514f5e3Sopenharmony_ci case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION: { 6164514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSPromiseValueThunkOrThrowerFunction::SIZE, 1U); 6174514f5e3Sopenharmony_ci JSHandle<JSHClass> promiseValueClass = 6184514f5e3Sopenharmony_ci JSHandle<JSHClass>::Cast(globalEnv->GetPromiseValueThunkOrThrowerFunctionClass()); 6194514f5e3Sopenharmony_ci JSHandle<JSObject> promiseValueFunc = factory->NewJSObjectWithInit(promiseValueClass); 6204514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseValueFunc); 6214514f5e3Sopenharmony_ci break; 6224514f5e3Sopenharmony_ci } 6234514f5e3Sopenharmony_ci case JSType::JS_ASYNC_GENERATOR_FUNCTION: { 6244514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncGeneratorFunction::SIZE, 0U); 6254514f5e3Sopenharmony_ci break; 6264514f5e3Sopenharmony_ci } 6274514f5e3Sopenharmony_ci case JSType::JS_GENERATOR_FUNCTION: { 6284514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSGeneratorFunction::SIZE, 0U); 6294514f5e3Sopenharmony_ci break; 6304514f5e3Sopenharmony_ci } 6314514f5e3Sopenharmony_ci case JSType::JS_ASYNC_FUNCTION: 6324514f5e3Sopenharmony_ci case JSType::JS_SHARED_ASYNC_FUNCTION: { 6334514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncFunction::SIZE, 0U); 6344514f5e3Sopenharmony_ci break; 6354514f5e3Sopenharmony_ci } 6364514f5e3Sopenharmony_ci case JSType::JS_INTL_BOUND_FUNCTION: { 6374514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSIntlBoundFunction::SIZE, 3U); 6384514f5e3Sopenharmony_ci JSHandle<JSIntlBoundFunction> intlBoundFunc = factory->NewJSIntlBoundFunction( 6394514f5e3Sopenharmony_ci MethodIndex::BUILTINS_NUMBER_FORMAT_NUMBER_FORMAT_INTERNAL_FORMAT_NUMBER); 6404514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(intlBoundFunc); 6414514f5e3Sopenharmony_ci break; 6424514f5e3Sopenharmony_ci } 6434514f5e3Sopenharmony_ci case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION: { 6444514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncAwaitStatusFunction::SIZE, 1U); 6454514f5e3Sopenharmony_ci JSHandle<JSAsyncAwaitStatusFunction> asyncAwaitFunc = factory->NewJSAsyncAwaitStatusFunction( 6464514f5e3Sopenharmony_ci MethodIndex::BUILTINS_PROMISE_HANDLER_ASYNC_AWAIT_FULFILLED); 6474514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(asyncAwaitFunc); 6484514f5e3Sopenharmony_ci break; 6494514f5e3Sopenharmony_ci } 6504514f5e3Sopenharmony_ci case JSType::JS_BOUND_FUNCTION: { 6514514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunctionBase::SIZE, JSBoundFunction::SIZE, 3U); 6524514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSBoundFunction, JS_BOUND_FUNCTION); 6534514f5e3Sopenharmony_ci break; 6544514f5e3Sopenharmony_ci } 6554514f5e3Sopenharmony_ci case JSType::JS_REG_EXP: { 6564514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSRegExp::SIZE, 5U); 6574514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSRegExp, JS_REG_EXP); 6584514f5e3Sopenharmony_ci break; 6594514f5e3Sopenharmony_ci } 6604514f5e3Sopenharmony_ci case JSType::JS_SET: { 6614514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSet::SIZE, 1U); 6624514f5e3Sopenharmony_ci JSHandle<JSSet> jsSet = NewJSSet(thread, factory, proto); 6634514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsSet); 6644514f5e3Sopenharmony_ci break; 6654514f5e3Sopenharmony_ci } 6664514f5e3Sopenharmony_ci case JSType::JS_SHARED_SET: { 6674514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSharedSet::SIZE, 2U); 6684514f5e3Sopenharmony_ci JSHandle<JSSharedSet> jsSet = NewJSSharedSet(thread, factory); 6694514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsSet); 6704514f5e3Sopenharmony_ci break; 6714514f5e3Sopenharmony_ci } 6724514f5e3Sopenharmony_ci case JSType::JS_MAP: { 6734514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSMap::SIZE, 1U); 6744514f5e3Sopenharmony_ci JSHandle<JSMap> jsMap = NewJSMap(thread, factory, proto); 6754514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsMap); 6764514f5e3Sopenharmony_ci break; 6774514f5e3Sopenharmony_ci } 6784514f5e3Sopenharmony_ci case JSType::JS_SHARED_MAP: { 6794514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSharedMap::SIZE, 2U); 6804514f5e3Sopenharmony_ci JSHandle<JSSharedMap> jsMap = NewJSSharedMap(thread, factory); 6814514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsMap); 6824514f5e3Sopenharmony_ci break; 6834514f5e3Sopenharmony_ci } 6844514f5e3Sopenharmony_ci case JSType::JS_WEAK_MAP: { 6854514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSWeakMap::SIZE, 1U); 6864514f5e3Sopenharmony_ci JSHandle<JSHClass> weakMapClass = factory->NewEcmaHClass(JSWeakMap::SIZE, JSType::JS_WEAK_MAP, proto); 6874514f5e3Sopenharmony_ci JSHandle<JSWeakMap> jsWeakMap = JSHandle<JSWeakMap>::Cast(factory->NewJSObjectWithInit(weakMapClass)); 6884514f5e3Sopenharmony_ci JSHandle<LinkedHashMap> weakLinkedMap(LinkedHashMap::Create(thread)); 6894514f5e3Sopenharmony_ci jsWeakMap->SetLinkedMap(thread, weakLinkedMap); 6904514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsWeakMap); 6914514f5e3Sopenharmony_ci break; 6924514f5e3Sopenharmony_ci } 6934514f5e3Sopenharmony_ci case JSType::JS_WEAK_SET: { 6944514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSWeakSet::SIZE, 1U); 6954514f5e3Sopenharmony_ci JSHandle<JSHClass> weakSetClass = factory->NewEcmaHClass(JSWeakSet::SIZE, JSType::JS_WEAK_SET, proto); 6964514f5e3Sopenharmony_ci JSHandle<JSWeakSet> jsWeakSet = JSHandle<JSWeakSet>::Cast(factory->NewJSObjectWithInit(weakSetClass)); 6974514f5e3Sopenharmony_ci JSHandle<LinkedHashSet> weakLinkedSet(LinkedHashSet::Create(thread)); 6984514f5e3Sopenharmony_ci jsWeakSet->SetLinkedSet(thread, weakLinkedSet); 6994514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsWeakSet); 7004514f5e3Sopenharmony_ci break; 7014514f5e3Sopenharmony_ci } 7024514f5e3Sopenharmony_ci case JSType::JS_WEAK_REF: { 7034514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSWeakRef::SIZE, 1U); 7044514f5e3Sopenharmony_ci JSHandle<JSHClass> weakRefClass = factory->NewEcmaHClass(JSWeakRef::SIZE, JSType::JS_WEAK_REF, proto); 7054514f5e3Sopenharmony_ci JSHandle<JSWeakRef> jsWeakRef = JSHandle<JSWeakRef>::Cast(factory->NewJSObjectWithInit(weakRefClass)); 7064514f5e3Sopenharmony_ci jsWeakRef->SetWeakObject(thread, JSTaggedValue::Undefined()); 7074514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsWeakRef); 7084514f5e3Sopenharmony_ci break; 7094514f5e3Sopenharmony_ci } 7104514f5e3Sopenharmony_ci case JSType::JS_FINALIZATION_REGISTRY: { 7114514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSFinalizationRegistry::SIZE, 5U); 7124514f5e3Sopenharmony_ci JSHandle<JSHClass> finalizationRegistryClass = 7134514f5e3Sopenharmony_ci factory->NewEcmaHClass(JSFinalizationRegistry::SIZE, JSType::JS_FINALIZATION_REGISTRY, proto); 7144514f5e3Sopenharmony_ci JSHandle<JSFinalizationRegistry> jsFinalizationRegistry = 7154514f5e3Sopenharmony_ci JSHandle<JSFinalizationRegistry>::Cast(factory->NewJSObjectWithInit(finalizationRegistryClass)); 7164514f5e3Sopenharmony_ci JSHandle<LinkedHashMap> weakLinkedMap(LinkedHashMap::Create(thread)); 7174514f5e3Sopenharmony_ci jsFinalizationRegistry->SetMaybeUnregister(thread, weakLinkedMap); 7184514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsFinalizationRegistry); 7194514f5e3Sopenharmony_ci break; 7204514f5e3Sopenharmony_ci } 7214514f5e3Sopenharmony_ci case JSType::CELL_RECORD: { 7224514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, CellRecord::SIZE, 2U); 7234514f5e3Sopenharmony_ci JSHandle<CellRecord> cellRecord = factory->NewCellRecord(); 7244514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(cellRecord); 7254514f5e3Sopenharmony_ci break; 7264514f5e3Sopenharmony_ci } 7274514f5e3Sopenharmony_ci case JSType::JS_DATE: { 7284514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSDate::SIZE, 2U); 7294514f5e3Sopenharmony_ci JSHandle<JSHClass> dateClass = factory->NewEcmaHClass(JSDate::SIZE, JSType::JS_DATE, proto); 7304514f5e3Sopenharmony_ci JSHandle<JSDate> date = JSHandle<JSDate>::Cast(factory->NewJSObjectWithInit(dateClass)); 7314514f5e3Sopenharmony_ci date->SetTimeValue(thread, JSTaggedValue(0.0)); 7324514f5e3Sopenharmony_ci date->SetLocalOffset(thread, JSTaggedValue(0.0)); 7334514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(date); 7344514f5e3Sopenharmony_ci break; 7354514f5e3Sopenharmony_ci } 7364514f5e3Sopenharmony_ci case JSType::JS_FORIN_ITERATOR: { 7374514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSForInIterator::SIZE, 4U); 7384514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> array(thread, factory->NewJSArray().GetTaggedValue()); 7394514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> keys(thread, factory->EmptyArray().GetTaggedValue()); 7404514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> hclass(thread, JSTaggedValue::Undefined()); 7414514f5e3Sopenharmony_ci JSHandle<JSForInIterator> forInIter = factory->NewJSForinIterator(array, keys, hclass); 7424514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(forInIter); 7434514f5e3Sopenharmony_ci break; 7444514f5e3Sopenharmony_ci } 7454514f5e3Sopenharmony_ci case JSType::JS_MAP_ITERATOR: { 7464514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSMapIterator::SIZE, 2U); 7474514f5e3Sopenharmony_ci JSHandle<JSMapIterator> jsMapIter = 7484514f5e3Sopenharmony_ci factory->NewJSMapIterator(NewJSMap(thread, factory, proto), IterationKind::KEY); 7494514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsMapIter); 7504514f5e3Sopenharmony_ci break; 7514514f5e3Sopenharmony_ci } 7524514f5e3Sopenharmony_ci case JSType::JS_SHARED_MAP_ITERATOR: { 7534514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSharedMapIterator::SIZE, 2U); 7544514f5e3Sopenharmony_ci JSHandle<JSSharedMapIterator> jsMapIter = 7554514f5e3Sopenharmony_ci factory->NewJSMapIterator(NewJSSharedMap(thread, factory), IterationKind::KEY); 7564514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsMapIter); 7574514f5e3Sopenharmony_ci break; 7584514f5e3Sopenharmony_ci } 7594514f5e3Sopenharmony_ci case JSType::JS_SET_ITERATOR: { 7604514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSetIterator::SIZE, 2U); 7614514f5e3Sopenharmony_ci JSHandle<JSSetIterator> jsSetIter = 7624514f5e3Sopenharmony_ci factory->NewJSSetIterator(NewJSSet(thread, factory, proto), IterationKind::KEY); 7634514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsSetIter); 7644514f5e3Sopenharmony_ci break; 7654514f5e3Sopenharmony_ci } 7664514f5e3Sopenharmony_ci case JSType::JS_SHARED_SET_ITERATOR: { 7674514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSharedSetIterator::SIZE, 2U); 7684514f5e3Sopenharmony_ci JSHandle<JSSharedSetIterator> jsSetIter = 7694514f5e3Sopenharmony_ci factory->NewJSSetIterator(NewJSSharedSet(thread, factory), IterationKind::KEY); 7704514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsSetIter); 7714514f5e3Sopenharmony_ci break; 7724514f5e3Sopenharmony_ci } 7734514f5e3Sopenharmony_ci case JSType::JS_REG_EXP_ITERATOR: { 7744514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSRegExpIterator::SIZE, 3U); 7754514f5e3Sopenharmony_ci JSHandle<EcmaString> emptyString(thread->GlobalConstants()->GetHandledEmptyString()); 7764514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> jsRegExp(NewJSRegExp(thread, factory, proto)); 7774514f5e3Sopenharmony_ci JSHandle<JSRegExpIterator> jsRegExpIter = 7784514f5e3Sopenharmony_ci factory->NewJSRegExpIterator(jsRegExp, emptyString, false, false); 7794514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsRegExpIter); 7804514f5e3Sopenharmony_ci break; 7814514f5e3Sopenharmony_ci } 7824514f5e3Sopenharmony_ci case JSType::JS_ARRAY_ITERATOR: { 7834514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSArrayIterator::SIZE, 2U); 7844514f5e3Sopenharmony_ci JSHandle<JSArrayIterator> arrayIter = 7854514f5e3Sopenharmony_ci factory->NewJSArrayIterator(JSHandle<JSObject>::Cast(factory->NewJSArray()), IterationKind::KEY); 7864514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(arrayIter); 7874514f5e3Sopenharmony_ci break; 7884514f5e3Sopenharmony_ci } 7894514f5e3Sopenharmony_ci case JSType::JS_SHARED_ARRAY_ITERATOR: { 7904514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSArrayIterator::SIZE, 2U); 7914514f5e3Sopenharmony_ci JSHandle<JSSharedArrayIterator> arrayIter = factory->NewJSSharedArrayIterator( 7924514f5e3Sopenharmony_ci JSHandle<JSObject>::Cast(factory->NewJSSArray()), IterationKind::KEY); 7934514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(arrayIter); 7944514f5e3Sopenharmony_ci break; 7954514f5e3Sopenharmony_ci } 7964514f5e3Sopenharmony_ci case JSType::JS_STRING_ITERATOR: { 7974514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSStringIterator::SIZE, 2U); 7984514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> stringIter = globalEnv->GetStringIterator(); 7994514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(stringIter); 8004514f5e3Sopenharmony_ci break; 8014514f5e3Sopenharmony_ci } 8024514f5e3Sopenharmony_ci case JSType::JS_INTL: { 8034514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSIntl::SIZE, 1U); 8044514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSIntl, JS_INTL); 8054514f5e3Sopenharmony_ci break; 8064514f5e3Sopenharmony_ci } 8074514f5e3Sopenharmony_ci case JSType::JS_LOCALE: { 8084514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSLocale::SIZE, 1U); 8094514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSLocale, JS_LOCALE); 8104514f5e3Sopenharmony_ci break; 8114514f5e3Sopenharmony_ci } 8124514f5e3Sopenharmony_ci case JSType::JS_DATE_TIME_FORMAT: { 8134514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSDateTimeFormat::SIZE, 9U); 8144514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSDateTimeFormat, JS_DATE_TIME_FORMAT); 8154514f5e3Sopenharmony_ci break; 8164514f5e3Sopenharmony_ci } 8174514f5e3Sopenharmony_ci case JSType::JS_RELATIVE_TIME_FORMAT: { 8184514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSRelativeTimeFormat::SIZE, 4U); 8194514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSRelativeTimeFormat, JS_RELATIVE_TIME_FORMAT); 8204514f5e3Sopenharmony_ci break; 8214514f5e3Sopenharmony_ci } 8224514f5e3Sopenharmony_ci case JSType::JS_NUMBER_FORMAT: { 8234514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSNumberFormat::SIZE, 13U); 8244514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSNumberFormat, JS_NUMBER_FORMAT); 8254514f5e3Sopenharmony_ci break; 8264514f5e3Sopenharmony_ci } 8274514f5e3Sopenharmony_ci case JSType::JS_COLLATOR: { 8284514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSCollator::SIZE, 5U); 8294514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSCollator, JS_COLLATOR); 8304514f5e3Sopenharmony_ci break; 8314514f5e3Sopenharmony_ci } 8324514f5e3Sopenharmony_ci case JSType::JS_PLURAL_RULES: { 8334514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSPluralRules::SIZE, 9U); 8344514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSPluralRules, JS_PLURAL_RULES); 8354514f5e3Sopenharmony_ci break; 8364514f5e3Sopenharmony_ci } 8374514f5e3Sopenharmony_ci case JSType::JS_DISPLAYNAMES: { 8384514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSDisplayNames::SIZE, 3U); 8394514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSDisplayNames, JS_DISPLAYNAMES); 8404514f5e3Sopenharmony_ci break; 8414514f5e3Sopenharmony_ci } 8424514f5e3Sopenharmony_ci case JSType::JS_SEGMENTER: { 8434514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSegmenter::SIZE, 3U); 8444514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSSegmenter, JS_SEGMENTER); 8454514f5e3Sopenharmony_ci break; 8464514f5e3Sopenharmony_ci } 8474514f5e3Sopenharmony_ci case JSType::JS_SEGMENTS: { 8484514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSegments::SIZE, 4U); 8494514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSSegments, JS_SEGMENTS); 8504514f5e3Sopenharmony_ci break; 8514514f5e3Sopenharmony_ci } 8524514f5e3Sopenharmony_ci case JSType::JS_SEGMENT_ITERATOR: { 8534514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSegmentIterator::SIZE, 4U); 8544514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSSegmentIterator, JS_SEGMENTS); 8554514f5e3Sopenharmony_ci break; 8564514f5e3Sopenharmony_ci } 8574514f5e3Sopenharmony_ci case JSType::JS_LIST_FORMAT: { 8584514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSListFormat::SIZE, 3U); 8594514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSListFormat, JS_LIST_FORMAT); 8604514f5e3Sopenharmony_ci break; 8614514f5e3Sopenharmony_ci } 8624514f5e3Sopenharmony_ci case JSType::JS_SHARED_ARRAY_BUFFER: 8634514f5e3Sopenharmony_ci case JSType::JS_ARRAY_BUFFER: { 8644514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSArrayBuffer::SIZE, 2U); 8654514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSArrayBuffer, JS_ARRAY_BUFFER); 8664514f5e3Sopenharmony_ci break; 8674514f5e3Sopenharmony_ci } 8684514f5e3Sopenharmony_ci case JSType::JS_SENDABLE_ARRAY_BUFFER: { 8694514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSSendableArrayBuffer::SIZE, 2U); 8704514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSSendableArrayBuffer, JS_SENDABLE_ARRAY_BUFFER); 8714514f5e3Sopenharmony_ci break; 8724514f5e3Sopenharmony_ci } 8734514f5e3Sopenharmony_ci case JSType::JS_PROMISE: { 8744514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSPromise::SIZE, 4U); 8754514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSPromise, JS_PROMISE); 8764514f5e3Sopenharmony_ci break; 8774514f5e3Sopenharmony_ci } 8784514f5e3Sopenharmony_ci case JSType::JS_DATA_VIEW: { 8794514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSDataView::SIZE, 3U); 8804514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSDataView, JS_DATA_VIEW); 8814514f5e3Sopenharmony_ci break; 8824514f5e3Sopenharmony_ci } 8834514f5e3Sopenharmony_ci case JSType::JS_GENERATOR_OBJECT: { 8844514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSGeneratorObject::SIZE, 4U); 8854514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSGeneratorObject, JS_GENERATOR_OBJECT); 8864514f5e3Sopenharmony_ci break; 8874514f5e3Sopenharmony_ci } 8884514f5e3Sopenharmony_ci case JSType::JS_ASYNC_GENERATOR_OBJECT: { 8894514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAsyncGeneratorObject::SIZE, 5U); 8904514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSAsyncGeneratorObject, JS_ASYNC_GENERATOR_OBJECT); 8914514f5e3Sopenharmony_ci break; 8924514f5e3Sopenharmony_ci } 8934514f5e3Sopenharmony_ci case JSType::JS_ASYNC_FUNC_OBJECT: { 8944514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSGeneratorObject::SIZE, JSAsyncFuncObject::SIZE, 1U); 8954514f5e3Sopenharmony_ci JSHandle<JSAsyncFuncObject> asyncFuncObject = factory->NewJSAsyncFuncObject(); 8964514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(asyncFuncObject); 8974514f5e3Sopenharmony_ci break; 8984514f5e3Sopenharmony_ci } 8994514f5e3Sopenharmony_ci case JSType::JS_ARRAY: { 9004514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSArray::SIZE, 2U); 9014514f5e3Sopenharmony_ci JSHandle<JSArray> jsArray = factory->NewJSArray(); 9024514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsArray); 9034514f5e3Sopenharmony_ci break; 9044514f5e3Sopenharmony_ci } 9054514f5e3Sopenharmony_ci case JSType::JS_SHARED_ARRAY: { 9064514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSArray::SIZE, 2U); 9074514f5e3Sopenharmony_ci JSHandle<JSSharedArray> jsArray = factory->NewJSSArray(); 9084514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsArray); 9094514f5e3Sopenharmony_ci break; 9104514f5e3Sopenharmony_ci } 9114514f5e3Sopenharmony_ci case JSType::JS_TYPED_ARRAY: 9124514f5e3Sopenharmony_ci case JSType::JS_INT8_ARRAY: 9134514f5e3Sopenharmony_ci case JSType::JS_UINT8_ARRAY: 9144514f5e3Sopenharmony_ci case JSType::JS_UINT8_CLAMPED_ARRAY: 9154514f5e3Sopenharmony_ci case JSType::JS_INT16_ARRAY: 9164514f5e3Sopenharmony_ci case JSType::JS_UINT16_ARRAY: 9174514f5e3Sopenharmony_ci case JSType::JS_INT32_ARRAY: 9184514f5e3Sopenharmony_ci case JSType::JS_UINT32_ARRAY: 9194514f5e3Sopenharmony_ci case JSType::JS_FLOAT32_ARRAY: 9204514f5e3Sopenharmony_ci case JSType::JS_FLOAT64_ARRAY: 9214514f5e3Sopenharmony_ci case JSType::JS_BIGINT64_ARRAY: 9224514f5e3Sopenharmony_ci case JSType::JS_BIGUINT64_ARRAY: { 9234514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSTypedArray::SIZE, 4U); 9244514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSTypedArray, JS_TYPED_ARRAY); 9254514f5e3Sopenharmony_ci break; 9264514f5e3Sopenharmony_ci } 9274514f5e3Sopenharmony_ci case JSType::JS_SHARED_TYPED_ARRAY: 9284514f5e3Sopenharmony_ci case JSType::JS_SHARED_INT8_ARRAY: 9294514f5e3Sopenharmony_ci case JSType::JS_SHARED_UINT8_ARRAY: 9304514f5e3Sopenharmony_ci case JSType::JS_SHARED_UINT8_CLAMPED_ARRAY: 9314514f5e3Sopenharmony_ci case JSType::JS_SHARED_INT16_ARRAY: 9324514f5e3Sopenharmony_ci case JSType::JS_SHARED_UINT16_ARRAY: 9334514f5e3Sopenharmony_ci case JSType::JS_SHARED_INT32_ARRAY: 9344514f5e3Sopenharmony_ci case JSType::JS_SHARED_UINT32_ARRAY: 9354514f5e3Sopenharmony_ci case JSType::JS_SHARED_FLOAT32_ARRAY: 9364514f5e3Sopenharmony_ci case JSType::JS_SHARED_FLOAT64_ARRAY: 9374514f5e3Sopenharmony_ci case JSType::JS_SHARED_BIGINT64_ARRAY: 9384514f5e3Sopenharmony_ci case JSType::JS_SHARED_BIGUINT64_ARRAY: { 9394514f5e3Sopenharmony_ci // Fixme(Gymee) Add test later 9404514f5e3Sopenharmony_ci break; 9414514f5e3Sopenharmony_ci } 9424514f5e3Sopenharmony_ci case JSType::JS_PRIMITIVE_REF: { 9434514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSPrimitiveRef::SIZE, 1U); 9444514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSPrimitiveRef, JS_PRIMITIVE_REF); 9454514f5e3Sopenharmony_ci break; 9464514f5e3Sopenharmony_ci } 9474514f5e3Sopenharmony_ci case JSType::JS_GLOBAL_OBJECT: { 9484514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSGlobalObject::SIZE, 0U); 9494514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> globalObject = globalEnv->GetJSGlobalObject(); 9504514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(globalObject); 9514514f5e3Sopenharmony_ci break; 9524514f5e3Sopenharmony_ci } 9534514f5e3Sopenharmony_ci case JSType::JS_PROXY: { 9544514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(ECMAObject::SIZE, JSProxy::SIZE, 5U); 9554514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> emptyObj(thread, NewJSObject(thread, factory, globalEnv).GetTaggedValue()); 9564514f5e3Sopenharmony_ci JSHandle<JSProxy> proxy = factory->NewJSProxy(emptyObj, emptyObj); 9574514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(proxy); 9584514f5e3Sopenharmony_ci break; 9594514f5e3Sopenharmony_ci } 9604514f5e3Sopenharmony_ci case JSType::HCLASS: { 9614514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), JSHClass::SIZE, 9U); 9624514f5e3Sopenharmony_ci JSHandle<JSHClass> hclass = factory->NewEcmaHClass(JSHClass::SIZE, JSType::HCLASS, proto); 9634514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(hclass); 9644514f5e3Sopenharmony_ci break; 9654514f5e3Sopenharmony_ci } 9664514f5e3Sopenharmony_ci case JSType::LINE_STRING: 9674514f5e3Sopenharmony_ci case JSType::CONSTANT_STRING: 9684514f5e3Sopenharmony_ci case JSType::TREE_STRING: 9694514f5e3Sopenharmony_ci case JSType::SLICED_STRING: { 9704514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(globalEnv->GetObjectFunction()); 9714514f5e3Sopenharmony_ci break; 9724514f5e3Sopenharmony_ci } 9734514f5e3Sopenharmony_ci case JSType::BIGINT: { 9744514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(globalEnv->GetBigIntFunction()); 9754514f5e3Sopenharmony_ci break; 9764514f5e3Sopenharmony_ci } 9774514f5e3Sopenharmony_ci case JSType::PROFILE_TYPE_INFO_CELL_0: 9784514f5e3Sopenharmony_ci case JSType::PROFILE_TYPE_INFO_CELL_1: 9794514f5e3Sopenharmony_ci case JSType::PROFILE_TYPE_INFO_CELL_N: { 9804514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> handleUndefined(thread, JSTaggedValue::Undefined()); 9814514f5e3Sopenharmony_ci JSHandle<ProfileTypeInfoCell> profileTypeInfoCell = factory->NewProfileTypeInfoCell(handleUndefined); 9824514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(profileTypeInfoCell); 9834514f5e3Sopenharmony_ci break; 9844514f5e3Sopenharmony_ci } 9854514f5e3Sopenharmony_ci case JSType::FUNCTION_TEMPLATE: { 9864514f5e3Sopenharmony_ci auto method = JSFunction::Cast(globalEnv->GetTaggedObjectFunction())->GetMethod(); 9874514f5e3Sopenharmony_ci JSHandle<Method> methodHandle(thread, method); 9884514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> handleUndefined(thread, JSTaggedValue::Undefined()); 9894514f5e3Sopenharmony_ci JSHandle<FunctionTemplate> funcTemp = factory->NewFunctionTemplate(methodHandle, handleUndefined, 0); 9904514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(funcTemp); 9914514f5e3Sopenharmony_ci break; 9924514f5e3Sopenharmony_ci } 9934514f5e3Sopenharmony_ci case JSType::TAGGED_ARRAY: 9944514f5e3Sopenharmony_ci case JSType::VTABLE: 9954514f5e3Sopenharmony_ci case JSType::LEXICAL_ENV: 9964514f5e3Sopenharmony_ci case JSType::SENDABLE_ENV: 9974514f5e3Sopenharmony_ci case JSType::AOT_LITERAL_INFO: { 9984514f5e3Sopenharmony_ci JSHandle<TaggedArray> taggedArray = factory->NewTaggedArray(4); 9994514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(taggedArray); 10004514f5e3Sopenharmony_ci break; 10014514f5e3Sopenharmony_ci } 10024514f5e3Sopenharmony_ci case JSType::CONSTANT_POOL: { 10034514f5e3Sopenharmony_ci JSHandle<ConstantPool> constantPool = factory->NewConstantPool(4); 10044514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(constantPool); 10054514f5e3Sopenharmony_ci break; 10064514f5e3Sopenharmony_ci } 10074514f5e3Sopenharmony_ci case JSType::PROFILE_TYPE_INFO: { 10084514f5e3Sopenharmony_ci JSHandle<ProfileTypeInfo> info = factory->NewProfileTypeInfo(4); 10094514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(info); 10104514f5e3Sopenharmony_ci break; 10114514f5e3Sopenharmony_ci } 10124514f5e3Sopenharmony_ci case JSType::EXTRA_PROFILE_TYPE_INFO: { 10134514f5e3Sopenharmony_ci JSHandle<ExtraProfileTypeInfo> info = factory->NewExtraProfileTypeInfo(); 10144514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(info); 10154514f5e3Sopenharmony_ci break; 10164514f5e3Sopenharmony_ci } 10174514f5e3Sopenharmony_ci case JSType::TAGGED_DICTIONARY: { 10184514f5e3Sopenharmony_ci JSHandle<TaggedArray> dict = factory->NewDictionaryArray(4); 10194514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(dict); 10204514f5e3Sopenharmony_ci break; 10214514f5e3Sopenharmony_ci } 10224514f5e3Sopenharmony_ci case JSType::BYTE_ARRAY: { 10234514f5e3Sopenharmony_ci JSHandle<ByteArray> byteArray = factory->NewByteArray(4, 8); 10244514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(byteArray); 10254514f5e3Sopenharmony_ci break; 10264514f5e3Sopenharmony_ci } 10274514f5e3Sopenharmony_ci case JSType::COW_TAGGED_ARRAY: { 10284514f5e3Sopenharmony_ci JSHandle<COWTaggedArray> dict = factory->NewCOWTaggedArray(4); 10294514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(dict); 10304514f5e3Sopenharmony_ci break; 10314514f5e3Sopenharmony_ci } 10324514f5e3Sopenharmony_ci case JSType::MUTANT_TAGGED_ARRAY: { 10334514f5e3Sopenharmony_ci JSHandle<MutantTaggedArray> array = factory->NewMutantTaggedArray(4); 10344514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(array); 10354514f5e3Sopenharmony_ci break; 10364514f5e3Sopenharmony_ci } 10374514f5e3Sopenharmony_ci case JSType::COW_MUTANT_TAGGED_ARRAY: { 10384514f5e3Sopenharmony_ci JSHandle<COWMutantTaggedArray> array = factory->NewCOWMutantTaggedArray(4); 10394514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(array); 10404514f5e3Sopenharmony_ci break; 10414514f5e3Sopenharmony_ci } 10424514f5e3Sopenharmony_ci case JSType::GLOBAL_ENV: { 10434514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(globalEnv); 10444514f5e3Sopenharmony_ci break; 10454514f5e3Sopenharmony_ci } 10464514f5e3Sopenharmony_ci case JSType::ACCESSOR_DATA: 10474514f5e3Sopenharmony_ci case JSType::INTERNAL_ACCESSOR: { 10484514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, AccessorData::SIZE, 2U); 10494514f5e3Sopenharmony_ci JSHandle<AccessorData> accessor = factory->NewAccessorData(); 10504514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(accessor); 10514514f5e3Sopenharmony_ci break; 10524514f5e3Sopenharmony_ci } 10534514f5e3Sopenharmony_ci case JSType::SYMBOL: { 10544514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), JSSymbol::SIZE, 3U); 10554514f5e3Sopenharmony_ci JSHandle<JSSymbol> symbol = factory->NewJSSymbol(); 10564514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(symbol); 10574514f5e3Sopenharmony_ci break; 10584514f5e3Sopenharmony_ci } 10594514f5e3Sopenharmony_ci case JSType::JS_GENERATOR_CONTEXT: { 10604514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), GeneratorContext::SIZE, 7U); 10614514f5e3Sopenharmony_ci JSHandle<GeneratorContext> genContext = factory->NewGeneratorContext(); 10624514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(genContext); 10634514f5e3Sopenharmony_ci break; 10644514f5e3Sopenharmony_ci } 10654514f5e3Sopenharmony_ci case JSType::PROTOTYPE_HANDLER: { 10664514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), PrototypeHandler::SIZE, 5U); 10674514f5e3Sopenharmony_ci JSHandle<PrototypeHandler> protoHandler = factory->NewPrototypeHandler(); 10684514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(protoHandler); 10694514f5e3Sopenharmony_ci break; 10704514f5e3Sopenharmony_ci } 10714514f5e3Sopenharmony_ci case JSType::TRANSITION_HANDLER: { 10724514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), TransitionHandler::SIZE, 2U); 10734514f5e3Sopenharmony_ci JSHandle<TransitionHandler> transitionHandler = factory->NewTransitionHandler(); 10744514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(transitionHandler); 10754514f5e3Sopenharmony_ci break; 10764514f5e3Sopenharmony_ci } 10774514f5e3Sopenharmony_ci case JSType::TRANS_WITH_PROTO_HANDLER: { 10784514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), TransWithProtoHandler::SIZE, 3U); 10794514f5e3Sopenharmony_ci JSHandle<TransWithProtoHandler> transWithProtoHandler = factory->NewTransWithProtoHandler(); 10804514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(transWithProtoHandler); 10814514f5e3Sopenharmony_ci break; 10824514f5e3Sopenharmony_ci } 10834514f5e3Sopenharmony_ci case JSType::STORE_TS_HANDLER: { 10844514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), StoreTSHandler::SIZE, 3U); 10854514f5e3Sopenharmony_ci JSHandle<StoreTSHandler> storeTSHandler = factory->NewStoreTSHandler(); 10864514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(storeTSHandler); 10874514f5e3Sopenharmony_ci break; 10884514f5e3Sopenharmony_ci } 10894514f5e3Sopenharmony_ci case JSType::PROPERTY_BOX: { 10904514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), PropertyBox::SIZE, 1U); 10914514f5e3Sopenharmony_ci JSHandle<PropertyBox> PropertyBox = factory->NewPropertyBox(globalConst->GetHandledEmptyArray()); 10924514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(PropertyBox); 10934514f5e3Sopenharmony_ci break; 10944514f5e3Sopenharmony_ci } 10954514f5e3Sopenharmony_ci case JSType::PROTO_CHANGE_MARKER: { 10964514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), ProtoChangeMarker::SIZE, 1U); 10974514f5e3Sopenharmony_ci JSHandle<ProtoChangeMarker> protoMaker = factory->NewProtoChangeMarker(); 10984514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(protoMaker); 10994514f5e3Sopenharmony_ci break; 11004514f5e3Sopenharmony_ci } 11014514f5e3Sopenharmony_ci case JSType::MARKER_CELL: { 11024514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), MarkerCell::SIZE, 1U); 11034514f5e3Sopenharmony_ci JSHandle<MarkerCell> markerCell = factory->NewMarkerCell(); 11044514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(markerCell); 11054514f5e3Sopenharmony_ci break; 11064514f5e3Sopenharmony_ci } 11074514f5e3Sopenharmony_ci case JSType::TRACK_INFO: { 11084514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), TrackInfo::SIZE, 3U); 11094514f5e3Sopenharmony_ci break; 11104514f5e3Sopenharmony_ci } 11114514f5e3Sopenharmony_ci case JSType::PROTOTYPE_INFO: { 11124514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), ProtoChangeDetails::SIZE, 2U); 11134514f5e3Sopenharmony_ci JSHandle<ProtoChangeDetails> protoDetails = factory->NewProtoChangeDetails(); 11144514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(protoDetails); 11154514f5e3Sopenharmony_ci break; 11164514f5e3Sopenharmony_ci } 11174514f5e3Sopenharmony_ci case JSType::TEMPLATE_MAP: { 11184514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> templateMap = globalEnv->GetTemplateMap(); 11194514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(templateMap); 11204514f5e3Sopenharmony_ci break; 11214514f5e3Sopenharmony_ci } 11224514f5e3Sopenharmony_ci case JSType::PROGRAM: { 11234514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(ECMAObject::SIZE, Program::SIZE, 1U); 11244514f5e3Sopenharmony_ci JSHandle<Program> program = factory->NewProgram(); 11254514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(program); 11264514f5e3Sopenharmony_ci break; 11274514f5e3Sopenharmony_ci } 11284514f5e3Sopenharmony_ci case JSType::PROMISE_CAPABILITY: { 11294514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, PromiseCapability::SIZE, 3U); 11304514f5e3Sopenharmony_ci JSHandle<PromiseCapability> promiseCapa = factory->NewPromiseCapability(); 11314514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseCapa); 11324514f5e3Sopenharmony_ci break; 11334514f5e3Sopenharmony_ci } 11344514f5e3Sopenharmony_ci case JSType::PROMISE_RECORD: { 11354514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, PromiseRecord::SIZE, 1U); 11364514f5e3Sopenharmony_ci JSHandle<PromiseRecord> promiseRecord = factory->NewPromiseRecord(); 11374514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseRecord); 11384514f5e3Sopenharmony_ci break; 11394514f5e3Sopenharmony_ci } 11404514f5e3Sopenharmony_ci case JSType::RESOLVING_FUNCTIONS_RECORD: { 11414514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ResolvingFunctionsRecord::SIZE, 2U); 11424514f5e3Sopenharmony_ci JSHandle<ResolvingFunctionsRecord> ResolvingFunc = factory->NewResolvingFunctionsRecord(); 11434514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(ResolvingFunc); 11444514f5e3Sopenharmony_ci break; 11454514f5e3Sopenharmony_ci } 11464514f5e3Sopenharmony_ci case JSType::ASYNC_GENERATOR_REQUEST: { 11474514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, AsyncGeneratorRequest::SIZE, 2U); 11484514f5e3Sopenharmony_ci JSHandle<AsyncGeneratorRequest> asyncGeneratorRequest = factory->NewAsyncGeneratorRequest(); 11494514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(asyncGeneratorRequest); 11504514f5e3Sopenharmony_ci break; 11514514f5e3Sopenharmony_ci } 11524514f5e3Sopenharmony_ci case JSType::ASYNC_ITERATOR_RECORD: { 11534514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, AsyncIteratorRecord::SIZE, 3U); 11544514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> emptyObj(thread, NewJSObject(thread, factory, globalEnv).GetTaggedValue()); 11554514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> emptyMethod(thread, NewJSObject(thread, factory, globalEnv).GetTaggedValue()); 11564514f5e3Sopenharmony_ci JSHandle<AsyncIteratorRecord> asyncIteratorRecord = 11574514f5e3Sopenharmony_ci factory->NewAsyncIteratorRecord(emptyObj, emptyMethod, false); 11584514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(asyncIteratorRecord); 11594514f5e3Sopenharmony_ci break; 11604514f5e3Sopenharmony_ci } 11614514f5e3Sopenharmony_ci case JSType::JS_ASYNC_FROM_SYNC_ITERATOR: { 11624514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAsyncFromSyncIterator::SIZE, 1U); 11634514f5e3Sopenharmony_ci NEW_OBJECT_AND_DUMP(JSAsyncFromSyncIterator, JS_ASYNC_FROM_SYNC_ITERATOR); 11644514f5e3Sopenharmony_ci break; 11654514f5e3Sopenharmony_ci } 11664514f5e3Sopenharmony_ci case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION: { 11674514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncFromSyncIterUnwarpFunction::SIZE, 1U); 11684514f5e3Sopenharmony_ci break; 11694514f5e3Sopenharmony_ci } 11704514f5e3Sopenharmony_ci case JSType::PROMISE_REACTIONS: { 11714514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, PromiseReaction::SIZE, 3U); 11724514f5e3Sopenharmony_ci JSHandle<PromiseReaction> promiseReact = factory->NewPromiseReaction(); 11734514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseReact); 11744514f5e3Sopenharmony_ci break; 11754514f5e3Sopenharmony_ci } 11764514f5e3Sopenharmony_ci case JSType::PROMISE_ITERATOR_RECORD: { 11774514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, PromiseIteratorRecord::SIZE, 2U); 11784514f5e3Sopenharmony_ci JSHandle<JSTaggedValue> emptyObj(thread, NewJSObject(thread, factory, globalEnv).GetTaggedValue()); 11794514f5e3Sopenharmony_ci JSHandle<PromiseIteratorRecord> promiseIter = factory->NewPromiseIteratorRecord(emptyObj, false); 11804514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(promiseIter); 11814514f5e3Sopenharmony_ci break; 11824514f5e3Sopenharmony_ci } 11834514f5e3Sopenharmony_ci case JSType::MICRO_JOB_QUEUE: { 11844514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ecmascript::job::MicroJobQueue::SIZE, 2U); 11854514f5e3Sopenharmony_ci JSHandle<ecmascript::job::MicroJobQueue> microJob = factory->NewMicroJobQueue(); 11864514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(microJob); 11874514f5e3Sopenharmony_ci break; 11884514f5e3Sopenharmony_ci } 11894514f5e3Sopenharmony_ci case JSType::PENDING_JOB: { 11904514f5e3Sopenharmony_ci#if defined(ENABLE_HITRACE) 11914514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ecmascript::job::PendingJob::SIZE, 7U); 11924514f5e3Sopenharmony_ci#else 11934514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ecmascript::job::PendingJob::SIZE, 2U); 11944514f5e3Sopenharmony_ci#endif 11954514f5e3Sopenharmony_ci JSHandle<JSHClass> pendingClass(thread, 11964514f5e3Sopenharmony_ci JSHClass::Cast(globalConst->GetPendingJobClass().GetTaggedObject())); 11974514f5e3Sopenharmony_ci JSHandle<TaggedObject> pendingJob(thread, factory->NewObject(pendingClass)); 11984514f5e3Sopenharmony_ci ecmascript::job::PendingJob::Cast(*pendingJob)->SetJob(thread, JSTaggedValue::Undefined()); 11994514f5e3Sopenharmony_ci ecmascript::job::PendingJob::Cast(*pendingJob)->SetArguments(thread, JSTaggedValue::Undefined()); 12004514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(pendingJob); 12014514f5e3Sopenharmony_ci break; 12024514f5e3Sopenharmony_ci } 12034514f5e3Sopenharmony_ci case JSType::COMPLETION_RECORD: { 12044514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, CompletionRecord::SIZE, 2U); 12054514f5e3Sopenharmony_ci JSHandle<CompletionRecord> comRecord = 12064514f5e3Sopenharmony_ci factory->NewCompletionRecord(CompletionRecordType::NORMAL, globalConst->GetHandledEmptyArray()); 12074514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(comRecord); 12084514f5e3Sopenharmony_ci break; 12094514f5e3Sopenharmony_ci } 12104514f5e3Sopenharmony_ci case JSType::MACHINE_CODE_OBJECT: { 12114514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), MachineCode::SIZE, machineCodeSize); 12124514f5e3Sopenharmony_ci GTEST_LOG_(INFO) << "MACHINE_CODE_OBJECT not support new in MachineCodeSpace"; 12134514f5e3Sopenharmony_ci break; 12144514f5e3Sopenharmony_ci } 12154514f5e3Sopenharmony_ci case JSType::CLASS_INFO_EXTRACTOR: { 12164514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), ClassInfoExtractor::SIZE, 8U); 12174514f5e3Sopenharmony_ci JSHandle<ClassInfoExtractor> classInfoExtractor = factory->NewClassInfoExtractor( 12184514f5e3Sopenharmony_ci JSHandle<JSTaggedValue>(thread, JSTaggedValue::Undefined())); 12194514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(classInfoExtractor); 12204514f5e3Sopenharmony_ci break; 12214514f5e3Sopenharmony_ci } 12224514f5e3Sopenharmony_ci case JSType::JS_API_ARRAY_LIST: { 12234514f5e3Sopenharmony_ci // 1 : 1 dump fileds number 12244514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIArrayList::SIZE, 1U); 12254514f5e3Sopenharmony_ci JSHandle<JSAPIArrayList> jsArrayList = NewJSAPIArrayList(thread, factory, proto); 12264514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsArrayList); 12274514f5e3Sopenharmony_ci break; 12284514f5e3Sopenharmony_ci } 12294514f5e3Sopenharmony_ci case JSType::JS_API_ARRAYLIST_ITERATOR: { 12304514f5e3Sopenharmony_ci // 2 : 2 dump fileds number 12314514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIArrayListIterator::SIZE, 2U); 12324514f5e3Sopenharmony_ci JSHandle<JSAPIArrayList> jsArrayList = NewJSAPIArrayList(thread, factory, proto); 12334514f5e3Sopenharmony_ci JSHandle<JSAPIArrayListIterator> jsArrayListIter = factory->NewJSAPIArrayListIterator(jsArrayList); 12344514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsArrayListIter); 12354514f5e3Sopenharmony_ci break; 12364514f5e3Sopenharmony_ci } 12374514f5e3Sopenharmony_ci case JSType::JS_API_BITVECTOR: { 12384514f5e3Sopenharmony_ci break; 12394514f5e3Sopenharmony_ci } 12404514f5e3Sopenharmony_ci case JSType::JS_API_BITVECTOR_ITERATOR: { 12414514f5e3Sopenharmony_ci break; 12424514f5e3Sopenharmony_ci } 12434514f5e3Sopenharmony_ci case JSType::LINKED_NODE: { 12444514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), LinkedNode::SIZE, 4U); 12454514f5e3Sopenharmony_ci break; 12464514f5e3Sopenharmony_ci } 12474514f5e3Sopenharmony_ci case JSType::RB_TREENODE: { 12484514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), RBTreeNode::SIZE, 7U); 12494514f5e3Sopenharmony_ci break; 12504514f5e3Sopenharmony_ci } 12514514f5e3Sopenharmony_ci case JSType::JS_API_HASH_MAP: { 12524514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIHashMap::SIZE, 2U); 12534514f5e3Sopenharmony_ci JSHandle<JSAPIHashMap> jsHashMap = NewJSAPIHashMap(thread, factory); 12544514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsHashMap); 12554514f5e3Sopenharmony_ci break; 12564514f5e3Sopenharmony_ci } 12574514f5e3Sopenharmony_ci case JSType::JS_API_HASH_SET: { 12584514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIHashSet::SIZE, 2U); 12594514f5e3Sopenharmony_ci JSHandle<JSAPIHashSet> jsHashSet = NewJSAPIHashSet(thread, factory); 12604514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsHashSet); 12614514f5e3Sopenharmony_ci break; 12624514f5e3Sopenharmony_ci } 12634514f5e3Sopenharmony_ci case JSType::JS_API_HASHMAP_ITERATOR: { 12644514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIHashMapIterator::SIZE, 4U); 12654514f5e3Sopenharmony_ci JSHandle<JSAPIHashMap> jsHashMap = NewJSAPIHashMap(thread, factory); 12664514f5e3Sopenharmony_ci JSHandle<JSAPIHashMapIterator> jsHashMapIter = 12674514f5e3Sopenharmony_ci factory->NewJSAPIHashMapIterator(jsHashMap, IterationKind::KEY); 12684514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsHashMapIter); 12694514f5e3Sopenharmony_ci break; 12704514f5e3Sopenharmony_ci } 12714514f5e3Sopenharmony_ci case JSType::JS_API_HASHSET_ITERATOR: { 12724514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIHashSetIterator::SIZE, 5U); 12734514f5e3Sopenharmony_ci JSHandle<JSAPIHashSet> jsHashSet = NewJSAPIHashSet(thread, factory); 12744514f5e3Sopenharmony_ci JSHandle<JSAPIHashSetIterator> jsHashSetIter = 12754514f5e3Sopenharmony_ci factory->NewJSAPIHashSetIterator(jsHashSet, IterationKind::KEY); 12764514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsHashSetIter); 12774514f5e3Sopenharmony_ci break; 12784514f5e3Sopenharmony_ci } 12794514f5e3Sopenharmony_ci case JSType::JS_API_LIGHT_WEIGHT_MAP: { 12804514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPILightWeightMap::SIZE, 4U); 12814514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightMap> jSAPILightWeightMap = NewJSAPILightWeightMap(thread, factory); 12824514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jSAPILightWeightMap); 12834514f5e3Sopenharmony_ci break; 12844514f5e3Sopenharmony_ci } 12854514f5e3Sopenharmony_ci case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR: { 12864514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPILightWeightMapIterator::SIZE, 2U); 12874514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightMap> jSAPILightWeightMap = NewJSAPILightWeightMap(thread, factory); 12884514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightMapIterator> jSAPILightWeightMapIterator = 12894514f5e3Sopenharmony_ci factory->NewJSAPILightWeightMapIterator(jSAPILightWeightMap, IterationKind::KEY); 12904514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jSAPILightWeightMapIterator); 12914514f5e3Sopenharmony_ci break; 12924514f5e3Sopenharmony_ci } 12934514f5e3Sopenharmony_ci case JSType::JS_API_LIGHT_WEIGHT_SET: { 12944514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPILightWeightSet::SIZE, 3U); 12954514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightSet> jSAPILightWeightSet = NewJSAPILightWeightSet(thread, factory); 12964514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jSAPILightWeightSet); 12974514f5e3Sopenharmony_ci break; 12984514f5e3Sopenharmony_ci } 12994514f5e3Sopenharmony_ci case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR: { 13004514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPILightWeightSetIterator::SIZE, 2U); 13014514f5e3Sopenharmony_ci JSHandle<JSAPILightWeightSetIterator> jSAPILightWeightSetIter = 13024514f5e3Sopenharmony_ci factory->NewJSAPILightWeightSetIterator(NewJSAPILightWeightSet(thread, factory), 13034514f5e3Sopenharmony_ci IterationKind::KEY); 13044514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jSAPILightWeightSetIter); 13054514f5e3Sopenharmony_ci break; 13064514f5e3Sopenharmony_ci } 13074514f5e3Sopenharmony_ci case JSType::JS_API_QUEUE: { 13084514f5e3Sopenharmony_ci // 2 : 2 dump fileds number 13094514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIQueue::SIZE, 2U); 13104514f5e3Sopenharmony_ci JSHandle<JSAPIQueue> jsQueue = NewJSAPIQueue(thread, factory, proto); 13114514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsQueue); 13124514f5e3Sopenharmony_ci break; 13134514f5e3Sopenharmony_ci } 13144514f5e3Sopenharmony_ci case JSType::JS_API_QUEUE_ITERATOR: { 13154514f5e3Sopenharmony_ci // 2 : 2 dump fileds number 13164514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIQueueIterator::SIZE, 2U); 13174514f5e3Sopenharmony_ci JSHandle<JSAPIQueue> jsQueue = NewJSAPIQueue(thread, factory, proto); 13184514f5e3Sopenharmony_ci JSHandle<JSAPIQueueIterator> jsQueueIter = 13194514f5e3Sopenharmony_ci factory->NewJSAPIQueueIterator(jsQueue); 13204514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsQueueIter); 13214514f5e3Sopenharmony_ci break; 13224514f5e3Sopenharmony_ci } 13234514f5e3Sopenharmony_ci case JSType::JS_API_PLAIN_ARRAY: { 13244514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIPlainArray::SIZE, 3U); 13254514f5e3Sopenharmony_ci JSHandle<JSAPIPlainArray> jSAPIPlainArray = NewJSAPIPlainArray(thread, factory); 13264514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jSAPIPlainArray); 13274514f5e3Sopenharmony_ci break; 13284514f5e3Sopenharmony_ci } 13294514f5e3Sopenharmony_ci case JSType::JS_API_PLAIN_ARRAY_ITERATOR: { 13304514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIPlainArrayIterator::SIZE, 2U); 13314514f5e3Sopenharmony_ci JSHandle<JSAPIPlainArray> jSAPIPlainArray = NewJSAPIPlainArray(thread, factory); 13324514f5e3Sopenharmony_ci JSHandle<JSAPIPlainArrayIterator> jSAPIPlainArrayIter = 13334514f5e3Sopenharmony_ci factory->NewJSAPIPlainArrayIterator(jSAPIPlainArray, IterationKind::KEY); 13344514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jSAPIPlainArrayIter); 13354514f5e3Sopenharmony_ci break; 13364514f5e3Sopenharmony_ci } 13374514f5e3Sopenharmony_ci case JSType::JS_API_TREE_MAP: { 13384514f5e3Sopenharmony_ci // 1 : 1 dump fileds number 13394514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPITreeMap::SIZE, 1U); 13404514f5e3Sopenharmony_ci JSHandle<JSAPITreeMap> jsTreeMap = NewJSAPITreeMap(thread, factory); 13414514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsTreeMap); 13424514f5e3Sopenharmony_ci break; 13434514f5e3Sopenharmony_ci } 13444514f5e3Sopenharmony_ci case JSType::JS_API_TREE_SET: { 13454514f5e3Sopenharmony_ci // 1 : 1 dump fileds number 13464514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPITreeSet::SIZE, 1U); 13474514f5e3Sopenharmony_ci JSHandle<JSAPITreeSet> jsTreeSet = NewJSAPITreeSet(thread, factory); 13484514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsTreeSet); 13494514f5e3Sopenharmony_ci break; 13504514f5e3Sopenharmony_ci } 13514514f5e3Sopenharmony_ci case JSType::JS_API_TREEMAP_ITERATOR: { 13524514f5e3Sopenharmony_ci // 3 : 3 dump fileds number 13534514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPITreeMapIterator::SIZE, 3U); 13544514f5e3Sopenharmony_ci JSHandle<JSAPITreeMap> jsTreeMap = NewJSAPITreeMap(thread, factory); 13554514f5e3Sopenharmony_ci JSHandle<JSAPITreeMapIterator> jsTreeMapIter = 13564514f5e3Sopenharmony_ci factory->NewJSAPITreeMapIterator(jsTreeMap, IterationKind::KEY); 13574514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsTreeMapIter); 13584514f5e3Sopenharmony_ci break; 13594514f5e3Sopenharmony_ci } 13604514f5e3Sopenharmony_ci case JSType::JS_API_TREESET_ITERATOR: { 13614514f5e3Sopenharmony_ci // 3 : 3 dump fileds number 13624514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPITreeSetIterator::SIZE, 3U); 13634514f5e3Sopenharmony_ci JSHandle<JSAPITreeSet> jsTreeSet = NewJSAPITreeSet(thread, factory); 13644514f5e3Sopenharmony_ci JSHandle<JSAPITreeSetIterator> jsTreeSetIter = 13654514f5e3Sopenharmony_ci factory->NewJSAPITreeSetIterator(jsTreeSet, IterationKind::KEY); 13664514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsTreeSetIter); 13674514f5e3Sopenharmony_ci break; 13684514f5e3Sopenharmony_ci } 13694514f5e3Sopenharmony_ci case JSType::JS_API_DEQUE: { 13704514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIDeque::SIZE, 1U); 13714514f5e3Sopenharmony_ci JSHandle<JSAPIDeque> jsDeque = NewJSAPIDeque(thread, factory, proto); 13724514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsDeque); 13734514f5e3Sopenharmony_ci break; 13744514f5e3Sopenharmony_ci } 13754514f5e3Sopenharmony_ci case JSType::JS_API_DEQUE_ITERATOR: { 13764514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIDequeIterator::SIZE, 2U); 13774514f5e3Sopenharmony_ci JSHandle<JSAPIDequeIterator> jsDequeIter = 13784514f5e3Sopenharmony_ci factory->NewJSAPIDequeIterator(NewJSAPIDeque(thread, factory, proto)); 13794514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsDequeIter); 13804514f5e3Sopenharmony_ci break; 13814514f5e3Sopenharmony_ci } 13824514f5e3Sopenharmony_ci case JSType::JS_API_STACK: { 13834514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIStack::SIZE, 1U); 13844514f5e3Sopenharmony_ci JSHandle<JSAPIStack> jsStack = NewJSAPIStack(factory, proto); 13854514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsStack); 13864514f5e3Sopenharmony_ci break; 13874514f5e3Sopenharmony_ci } 13884514f5e3Sopenharmony_ci case JSType::JS_API_STACK_ITERATOR: { 13894514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIStackIterator::SIZE, 2U); 13904514f5e3Sopenharmony_ci JSHandle<JSAPIStackIterator> jsStackIter = 13914514f5e3Sopenharmony_ci factory->NewJSAPIStackIterator(NewJSAPIStack(factory, proto)); 13924514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsStackIter); 13934514f5e3Sopenharmony_ci break; 13944514f5e3Sopenharmony_ci } 13954514f5e3Sopenharmony_ci case JSType::JS_API_VECTOR: { 13964514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIVector::SIZE, 1U); 13974514f5e3Sopenharmony_ci JSHandle<JSAPIVector> jsVector = NewJSAPIVector(factory, proto); 13984514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsVector); 13994514f5e3Sopenharmony_ci break; 14004514f5e3Sopenharmony_ci } 14014514f5e3Sopenharmony_ci case JSType::JS_API_VECTOR_ITERATOR: { 14024514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIVectorIterator::SIZE, 2U); 14034514f5e3Sopenharmony_ci JSHandle<JSAPIVectorIterator> jsVectorIter = 14044514f5e3Sopenharmony_ci factory->NewJSAPIVectorIterator(NewJSAPIVector(factory, proto)); 14054514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsVectorIter); 14064514f5e3Sopenharmony_ci break; 14074514f5e3Sopenharmony_ci } 14084514f5e3Sopenharmony_ci case JSType::JS_API_LIST: { 14094514f5e3Sopenharmony_ci // 1 : 1 dump fileds number 14104514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIList::SIZE, 2U); 14114514f5e3Sopenharmony_ci JSHandle<JSAPIList> jsAPIList = NewJSAPIList(thread, factory); 14124514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsAPIList); 14134514f5e3Sopenharmony_ci break; 14144514f5e3Sopenharmony_ci } 14154514f5e3Sopenharmony_ci case JSType::JS_API_LINKED_LIST: { 14164514f5e3Sopenharmony_ci // 1 : 1 dump fileds number 14174514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPILinkedList::SIZE, 1U); 14184514f5e3Sopenharmony_ci JSHandle<JSAPILinkedList> jsAPILinkedList = NewJSAPILinkedList(thread, factory); 14194514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsAPILinkedList); 14204514f5e3Sopenharmony_ci break; 14214514f5e3Sopenharmony_ci } 14224514f5e3Sopenharmony_ci case JSType::JS_API_LIST_ITERATOR: { 14234514f5e3Sopenharmony_ci // 2 : 2 dump fileds number 14244514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPIListIterator::SIZE, 2U); 14254514f5e3Sopenharmony_ci JSHandle<JSAPIList> jsAPIList = NewJSAPIList(thread, factory); 14264514f5e3Sopenharmony_ci JSHandle<JSAPIListIterator> jsAPIListIter = factory->NewJSAPIListIterator(jsAPIList); 14274514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsAPIListIter); 14284514f5e3Sopenharmony_ci break; 14294514f5e3Sopenharmony_ci } 14304514f5e3Sopenharmony_ci case JSType::JS_API_LINKED_LIST_ITERATOR: { 14314514f5e3Sopenharmony_ci // 2 : 2 dump fileds number 14324514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, JSAPILinkedListIterator::SIZE, 2U); 14334514f5e3Sopenharmony_ci JSHandle<JSAPILinkedList> jsAPILinkedList = NewJSAPILinkedList(thread, factory); 14344514f5e3Sopenharmony_ci JSHandle<JSAPILinkedListIterator> jsAPILinkedListIter = 14354514f5e3Sopenharmony_ci factory->NewJSAPILinkedListIterator(jsAPILinkedList); 14364514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(jsAPILinkedListIter); 14374514f5e3Sopenharmony_ci break; 14384514f5e3Sopenharmony_ci } 14394514f5e3Sopenharmony_ci case JSType::MODULE_RECORD: { 14404514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ModuleRecord::SIZE, 0U); 14414514f5e3Sopenharmony_ci break; 14424514f5e3Sopenharmony_ci } 14434514f5e3Sopenharmony_ci case JSType::SOURCE_TEXT_MODULE_RECORD: { 14444514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(ModuleRecord::SIZE, SourceTextModule::SIZE, 18U); 14454514f5e3Sopenharmony_ci JSHandle<SourceTextModule> moduleSourceRecord = factory->NewSourceTextModule(); 14464514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(moduleSourceRecord); 14474514f5e3Sopenharmony_ci break; 14484514f5e3Sopenharmony_ci } 14494514f5e3Sopenharmony_ci case JSType::IMPORTENTRY_RECORD: { 14504514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ImportEntry::SIZE, 3U); 14514514f5e3Sopenharmony_ci JSHandle<ImportEntry> importEntry = factory->NewImportEntry(); 14524514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(importEntry); 14534514f5e3Sopenharmony_ci break; 14544514f5e3Sopenharmony_ci } 14554514f5e3Sopenharmony_ci case JSType::LOCAL_EXPORTENTRY_RECORD: { 14564514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, LocalExportEntry::SIZE, 3U); 14574514f5e3Sopenharmony_ci JSHandle<LocalExportEntry> localExportEntry = factory->NewLocalExportEntry(); 14584514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(localExportEntry); 14594514f5e3Sopenharmony_ci break; 14604514f5e3Sopenharmony_ci } 14614514f5e3Sopenharmony_ci case JSType::INDIRECT_EXPORTENTRY_RECORD: { 14624514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, IndirectExportEntry::SIZE, 3U); 14634514f5e3Sopenharmony_ci JSHandle<IndirectExportEntry> indirectExportEntry = factory->NewIndirectExportEntry(); 14644514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(indirectExportEntry); 14654514f5e3Sopenharmony_ci break; 14664514f5e3Sopenharmony_ci } 14674514f5e3Sopenharmony_ci case JSType::STAR_EXPORTENTRY_RECORD: { 14684514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, StarExportEntry::SIZE, 1U); 14694514f5e3Sopenharmony_ci JSHandle<StarExportEntry> starExportEntry = factory->NewStarExportEntry(); 14704514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(starExportEntry); 14714514f5e3Sopenharmony_ci break; 14724514f5e3Sopenharmony_ci } 14734514f5e3Sopenharmony_ci case JSType::RESOLVEDBINDING_RECORD: { 14744514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ResolvedBinding::SIZE, 2U); 14754514f5e3Sopenharmony_ci JSHandle<ResolvedBinding> resolvedBinding = factory->NewResolvedBindingRecord(); 14764514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(resolvedBinding); 14774514f5e3Sopenharmony_ci break; 14784514f5e3Sopenharmony_ci } 14794514f5e3Sopenharmony_ci case JSType::RESOLVEDINDEXBINDING_RECORD: { 14804514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ResolvedIndexBinding::SIZE, 2U); 14814514f5e3Sopenharmony_ci JSHandle<ResolvedIndexBinding> resolvedBinding = factory->NewResolvedIndexBindingRecord(); 14824514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(resolvedBinding); 14834514f5e3Sopenharmony_ci break; 14844514f5e3Sopenharmony_ci } 14854514f5e3Sopenharmony_ci case JSType::RESOLVEDRECORDINDEXBINDING_RECORD: { 14864514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ResolvedRecordIndexBinding::SIZE, 3U); 14874514f5e3Sopenharmony_ci JSHandle<ResolvedRecordIndexBinding> recordBinding = factory->NewSResolvedRecordIndexBindingRecord(); 14884514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(recordBinding); 14894514f5e3Sopenharmony_ci break; 14904514f5e3Sopenharmony_ci } 14914514f5e3Sopenharmony_ci case JSType::RESOLVEDRECORDBINDING_RECORD: { 14924514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(Record::SIZE, ResolvedRecordBinding::SIZE, 2U); 14934514f5e3Sopenharmony_ci JSHandle<ResolvedRecordBinding> recordBinding = factory->NewSResolvedRecordBindingRecord(); 14944514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(recordBinding); 14954514f5e3Sopenharmony_ci break; 14964514f5e3Sopenharmony_ci } 14974514f5e3Sopenharmony_ci case JSType::JS_MODULE_NAMESPACE: { 14984514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, ModuleNamespace::SIZE, 3U); 14994514f5e3Sopenharmony_ci JSHandle<ModuleNamespace> moduleNamespace = factory->NewModuleNamespace(); 15004514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(moduleNamespace); 15014514f5e3Sopenharmony_ci break; 15024514f5e3Sopenharmony_ci } 15034514f5e3Sopenharmony_ci case JSType::NATIVE_MODULE_FAILURE_INFO: { 15044514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, NativeModuleFailureInfo::SIZE, 1U); 15054514f5e3Sopenharmony_ci JSHandle<NativeModuleFailureInfo> nativeFailureInfo = factory->NewNativeModuleFailureInfo(); 15064514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(nativeFailureInfo); 15074514f5e3Sopenharmony_ci break; 15084514f5e3Sopenharmony_ci } 15094514f5e3Sopenharmony_ci case JSType::JS_CJS_EXPORTS: { 15104514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, CjsExports::SIZE, 1U); 15114514f5e3Sopenharmony_ci JSHandle<CjsExports> cjsExports = factory->NewCjsExports(); 15124514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(cjsExports); 15134514f5e3Sopenharmony_ci break; 15144514f5e3Sopenharmony_ci } 15154514f5e3Sopenharmony_ci case JSType::JS_CJS_MODULE: { 15164514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, CjsModule::SIZE, 5U); 15174514f5e3Sopenharmony_ci JSHandle<CjsModule> cjsModule = factory->NewCjsModule(); 15184514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(cjsModule); 15194514f5e3Sopenharmony_ci break; 15204514f5e3Sopenharmony_ci } 15214514f5e3Sopenharmony_ci case JSType::JS_CJS_REQUIRE: { 15224514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSObject::SIZE, CjsRequire::SIZE, 2U); 15234514f5e3Sopenharmony_ci JSHandle<CjsRequire> cjsRequire = factory->NewCjsRequire(); 15244514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(cjsRequire); 15254514f5e3Sopenharmony_ci break; 15264514f5e3Sopenharmony_ci } 15274514f5e3Sopenharmony_ci case JSType::JS_ITERATOR: 15284514f5e3Sopenharmony_ci case JSType::JS_ASYNCITERATOR: 15294514f5e3Sopenharmony_ci case JSType::FREE_OBJECT_WITH_ONE_FIELD: 15304514f5e3Sopenharmony_ci case JSType::FREE_OBJECT_WITH_NONE_FIELD: 15314514f5e3Sopenharmony_ci case JSType::FREE_OBJECT_WITH_TWO_FIELD: 15324514f5e3Sopenharmony_ci case JSType::JS_NATIVE_POINTER: { 15334514f5e3Sopenharmony_ci break; 15344514f5e3Sopenharmony_ci } 15354514f5e3Sopenharmony_ci case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN: { 15364514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(JSFunction::SIZE, JSAsyncGeneratorResNextRetProRstFtn::SIZE, 1U); 15374514f5e3Sopenharmony_ci break; 15384514f5e3Sopenharmony_ci } 15394514f5e3Sopenharmony_ci case JSType::CLASS_LITERAL: { 15404514f5e3Sopenharmony_ci CHECK_DUMP_FIELDS(TaggedObject::TaggedObjectSize(), ClassLiteral::SIZE, 2U); 15414514f5e3Sopenharmony_ci JSHandle<ClassLiteral> classLiteral = factory->NewClassLiteral(); 15424514f5e3Sopenharmony_ci DUMP_FOR_HANDLE(classLiteral); 15434514f5e3Sopenharmony_ci break; 15444514f5e3Sopenharmony_ci } 15454514f5e3Sopenharmony_ci default: 15464514f5e3Sopenharmony_ci LOG_ECMA_MEM(FATAL) << "JSType " << static_cast<int>(type) << " cannot be dumped."; 15474514f5e3Sopenharmony_ci UNREACHABLE(); 15484514f5e3Sopenharmony_ci break; 15494514f5e3Sopenharmony_ci } 15504514f5e3Sopenharmony_ci } 15514514f5e3Sopenharmony_ci#undef NEW_OBJECT_AND_DUMP 15524514f5e3Sopenharmony_ci#undef DUMP_FOR_HANDLE 15534514f5e3Sopenharmony_ci} 15544514f5e3Sopenharmony_ci} // namespace panda::test 1555