1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ECMASCRIPT_MEM_OBJECT_XRAY_H 17 #define ECMASCRIPT_MEM_OBJECT_XRAY_H 18 19 #include <cstdint> 20 21 #include "ecmascript/ecma_vm.h" 22 #include "ecmascript/js_async_from_sync_iterator.h" 23 #include "ecmascript/global_env.h" 24 #include "ecmascript/ic/ic_handler.h" 25 #include "ecmascript/ic/proto_change_details.h" 26 #include "ecmascript/jobs/micro_job_queue.h" 27 #include "ecmascript/jobs/pending_job.h" 28 #include "ecmascript/jspandafile/class_info_extractor.h" 29 #include "ecmascript/jspandafile/class_literal.h" 30 #include "ecmascript/jspandafile/program_object.h" 31 #include "ecmascript/js_api/js_api_arraylist.h" 32 #include "ecmascript/js_api/js_api_arraylist_iterator.h" 33 #include "ecmascript/js_api/js_api_deque.h" 34 #include "ecmascript/js_api/js_api_deque_iterator.h" 35 #include "ecmascript/js_api/js_api_hashmap.h" 36 #include "ecmascript/js_api/js_api_hashmap_iterator.h" 37 #include "ecmascript/js_api/js_api_hashset.h" 38 #include "ecmascript/js_api/js_api_hashset_iterator.h" 39 #include "ecmascript/js_api/js_api_lightweightmap.h" 40 #include "ecmascript/js_api/js_api_lightweightmap_iterator.h" 41 #include "ecmascript/js_api/js_api_lightweightset.h" 42 #include "ecmascript/js_api/js_api_lightweightset_iterator.h" 43 #include "ecmascript/js_api/js_api_linked_list.h" 44 #include "ecmascript/js_api/js_api_linked_list_iterator.h" 45 #include "ecmascript/js_api/js_api_list.h" 46 #include "ecmascript/js_api/js_api_list_iterator.h" 47 #include "ecmascript/js_api/js_api_plain_array.h" 48 #include "ecmascript/js_api/js_api_plain_array_iterator.h" 49 #include "ecmascript/js_api/js_api_queue.h" 50 #include "ecmascript/js_api/js_api_queue_iterator.h" 51 #include "ecmascript/js_api/js_api_stack.h" 52 #include "ecmascript/js_api/js_api_stack_iterator.h" 53 #include "ecmascript/js_api/js_api_tree_map.h" 54 #include "ecmascript/js_api/js_api_tree_map_iterator.h" 55 #include "ecmascript/js_api/js_api_tree_set.h" 56 #include "ecmascript/js_api/js_api_tree_set_iterator.h" 57 #include "ecmascript/js_api/js_api_vector.h" 58 #include "ecmascript/js_api/js_api_vector_iterator.h" 59 #include "ecmascript/js_arguments.h" 60 #include "ecmascript/js_array.h" 61 #include "ecmascript/js_array_iterator.h" 62 #include "ecmascript/js_arraybuffer.h" 63 #include "ecmascript/js_async_function.h" 64 #include "ecmascript/js_async_generator_object.h" 65 #include "ecmascript/js_collator.h" 66 #include "ecmascript/js_dataview.h" 67 #include "ecmascript/js_date.h" 68 #include "ecmascript/js_date_time_format.h" 69 #include "ecmascript/js_for_in_iterator.h" 70 #include "ecmascript/js_finalization_registry.h" 71 #include "ecmascript/js_function.h" 72 #include "ecmascript/js_generator_object.h" 73 #include "ecmascript/js_hclass.h" 74 #include "ecmascript/js_intl.h" 75 #include "ecmascript/js_locale.h" 76 #include "ecmascript/js_map.h" 77 #include "ecmascript/js_map_iterator.h" 78 #include "ecmascript/js_number_format.h" 79 #include "ecmascript/js_object-inl.h" 80 #include "ecmascript/js_plural_rules.h" 81 #include "ecmascript/js_primitive_ref.h" 82 #include "ecmascript/js_promise.h" 83 #include "ecmascript/js_realm.h" 84 #include "ecmascript/js_regexp.h" 85 #include "ecmascript/js_regexp_iterator.h" 86 #include "ecmascript/js_relative_time_format.h" 87 #include "ecmascript/js_set.h" 88 #include "ecmascript/js_displaynames.h" 89 #include "ecmascript/js_list_format.h" 90 #include "ecmascript/js_set_iterator.h" 91 #include "ecmascript/js_string_iterator.h" 92 #include "ecmascript/js_typed_array.h" 93 #include "ecmascript/byte_array.h" 94 #include "ecmascript/js_weak_container.h" 95 #include "ecmascript/jspandafile/class_info_extractor.h" 96 #include "ecmascript/jspandafile/program_object.h" 97 #include "ecmascript/js_weak_ref.h" 98 #include "ecmascript/mem/machine_code.h" 99 #include "ecmascript/mem/mem.h" 100 #include "ecmascript/mem/slots.h" 101 #include "ecmascript/module/js_module_namespace.h" 102 #include "ecmascript/module/js_module_source_text.h" 103 #include "ecmascript/tagged_node.h" 104 #include "ecmascript/ts_types/ts_type.h" 105 #include "ecmascript/ts_types/ts_type_table.h" 106 #include "ecmascript/require/js_cjs_module.h" 107 #include "ecmascript/require/js_cjs_require.h" 108 #include "ecmascript/require/js_cjs_exports.h" 109 110 namespace panda::ecmascript { 111 class ObjectXRay { 112 public: ObjectXRay(EcmaVM * ecmaVm)113 explicit ObjectXRay(EcmaVM *ecmaVm) : ecmaVm_(ecmaVm) {} 114 ~ObjectXRay() = default; 115 VisitVMRoots(const RootVisitor & visitor,const RootRangeVisitor & rangeVisitor,const RootBaseAndDerivedVisitor & derivedVisitor)116 inline void VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &rangeVisitor, 117 const RootBaseAndDerivedVisitor &derivedVisitor) const 118 { 119 ecmaVm_->Iterate(visitor, rangeVisitor); 120 ecmaVm_->GetJSThread()->Iterate(visitor, rangeVisitor, derivedVisitor); 121 } 122 template<VisitType visitType> VisitObjectBody(TaggedObject * object,JSHClass * klass,const EcmaObjectRangeVisitor & visitor)123 inline void VisitObjectBody(TaggedObject *object, JSHClass *klass, const EcmaObjectRangeVisitor &visitor) 124 { 125 // handle body 126 JSType type = klass->GetObjectType(); 127 switch (type) { 128 case JSType::JS_OBJECT: 129 case JSType::JS_ERROR: 130 case JSType::JS_EVAL_ERROR: 131 case JSType::JS_RANGE_ERROR: 132 case JSType::JS_REFERENCE_ERROR: 133 case JSType::JS_TYPE_ERROR: 134 case JSType::JS_AGGREGATE_ERROR: 135 case JSType::JS_URI_ERROR: 136 case JSType::JS_SYNTAX_ERROR: 137 case JSType::JS_OOM_ERROR: 138 case JSType::JS_ASYNCITERATOR: 139 case JSType::JS_ITERATOR: 140 JSObject::Cast(object)->VisitRangeSlot(visitor); 141 break; 142 case JSType::JS_ASYNC_FROM_SYNC_ITERATOR: 143 JSAsyncFromSyncIterator::Cast(object)->VisitRangeSlot(visitor); 144 break; 145 case JSType::JS_GLOBAL_OBJECT: 146 JSGlobalObject::Cast(object)->VisitRangeSlot(visitor); 147 break; 148 case JSType::JS_FUNCTION_BASE: { 149 auto jsFunctionBase = JSFunctionBase::Cast(object); 150 jsFunctionBase->VisitRangeSlot(visitor); 151 break; 152 } 153 case JSType::JS_FUNCTION: { 154 auto jsFunction = JSFunction::Cast(object); 155 jsFunction->VisitRangeSlot(visitor); 156 break; 157 } 158 case JSType::JS_GENERATOR_FUNCTION: { 159 auto jsGeneratorFunction = JSGeneratorFunction::Cast(object); 160 jsGeneratorFunction->VisitRangeSlot(visitor); 161 break; 162 } 163 case JSType::JS_ASYNC_GENERATOR_FUNCTION: { 164 auto jsGeneratorFunction = JSAsyncGeneratorFunction::Cast(object); 165 jsGeneratorFunction->VisitRangeSlot(visitor); 166 break; 167 } 168 case JSType::JS_PROXY_REVOC_FUNCTION: { 169 auto jsProxyRevocFunction = JSProxyRevocFunction::Cast(object); 170 jsProxyRevocFunction->VisitRangeSlot(visitor); 171 break; 172 } 173 case JSType::JS_PROMISE_REACTIONS_FUNCTION: { 174 auto jsPromiseReactionsFunction = JSPromiseReactionsFunction::Cast(object); 175 jsPromiseReactionsFunction->VisitRangeSlot(visitor); 176 break; 177 } 178 case JSType::JS_PROMISE_EXECUTOR_FUNCTION: { 179 auto jsPromiseExecutorFunction = JSPromiseExecutorFunction::Cast(object); 180 jsPromiseExecutorFunction->VisitRangeSlot(visitor); 181 break; 182 } 183 case JSType::JS_ASYNC_FROM_SYNC_ITER_UNWARP_FUNCTION: { 184 auto jsAsyncFromSyncIterUnwarpFunction = JSAsyncFromSyncIterUnwarpFunction::Cast(object); 185 jsAsyncFromSyncIterUnwarpFunction->VisitRangeSlot(visitor); 186 break; 187 } 188 case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION: { 189 auto jsPromiseAllResolveElementFunction = JSPromiseAllResolveElementFunction::Cast(object); 190 jsPromiseAllResolveElementFunction->VisitRangeSlot(visitor); 191 break; 192 } 193 case JSType::JS_ASYNC_GENERATOR_RESUME_NEXT_RETURN_PROCESSOR_RST_FTN: { 194 auto jsAsyGeneratorRseNextRtnProRstFtn = JSAsyncGeneratorResNextRetProRstFtn::Cast(object); 195 jsAsyGeneratorRseNextRtnProRstFtn->VisitRangeSlot(visitor); 196 break; 197 } 198 case JSType::JS_PROMISE_ANY_REJECT_ELEMENT_FUNCTION: { 199 auto jsPromiseAnyRejectElementFunction = JSPromiseAnyRejectElementFunction::Cast(object); 200 jsPromiseAnyRejectElementFunction->VisitRangeSlot(visitor); 201 break; 202 } 203 case JSType::JS_PROMISE_ALL_SETTLED_ELEMENT_FUNCTION: { 204 auto jsPromiseAllSettledElementFunction = JSPromiseAllSettledElementFunction::Cast(object); 205 jsPromiseAllSettledElementFunction->VisitRangeSlot(visitor); 206 break; 207 } 208 case JSType::JS_PROMISE_FINALLY_FUNCTION: { 209 auto jsPromiseFinallyFunction = JSPromiseFinallyFunction::Cast(object); 210 jsPromiseFinallyFunction->VisitRangeSlot(visitor); 211 break; 212 } 213 case JSType::JS_PROMISE_VALUE_THUNK_OR_THROWER_FUNCTION: { 214 auto jsPromiseValueThunkOrThrowerFunction = JSPromiseValueThunkOrThrowerFunction::Cast(object); 215 jsPromiseValueThunkOrThrowerFunction->VisitRangeSlot(visitor); 216 break; 217 } 218 case JSType::JS_ASYNC_FUNCTION: { 219 auto jsAsyncFunction = JSAsyncFunction::Cast(object); 220 jsAsyncFunction->VisitRangeSlot(visitor); 221 break; 222 } 223 case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION: { 224 auto jsAsyncAwaitStatusFunction = JSAsyncAwaitStatusFunction::Cast(object); 225 jsAsyncAwaitStatusFunction->VisitRangeSlot(visitor); 226 break; 227 } 228 case JSType::JS_REG_EXP: 229 JSRegExp::Cast(object)->VisitRangeSlot(visitor); 230 break; 231 case JSType::JS_SET: 232 JSSet::Cast(object)->VisitRangeSlot(visitor); 233 break; 234 case JSType::JS_MAP: 235 JSMap::Cast(object)->VisitRangeSlot(visitor); 236 break; 237 case JSType::JS_WEAK_MAP: 238 JSWeakMap::Cast(object)->VisitRangeSlot(visitor); 239 break; 240 case JSType::JS_WEAK_SET: 241 JSWeakSet::Cast(object)->VisitRangeSlot(visitor); 242 break; 243 case JSType::JS_WEAK_REF: 244 JSWeakRef::Cast(object)->VisitRangeSlot(visitor); 245 break; 246 case JSType::JS_FINALIZATION_REGISTRY: 247 JSFinalizationRegistry::Cast(object)->VisitRangeSlot(visitor); 248 break; 249 case JSType::CELL_RECORD: 250 CellRecord::Cast(object)->VisitRangeSlot(visitor); 251 break; 252 case JSType::JS_DATE: 253 JSDate::Cast(object)->VisitRangeSlot(visitor); 254 break; 255 case JSType::JS_FORIN_ITERATOR: 256 JSForInIterator::Cast(object)->VisitRangeSlot(visitor); 257 break; 258 case JSType::JS_MAP_ITERATOR: 259 JSMapIterator::Cast(object)->VisitRangeSlot(visitor); 260 break; 261 case JSType::JS_SET_ITERATOR: 262 JSSetIterator::Cast(object)->VisitRangeSlot(visitor); 263 break; 264 case JSType::JS_REG_EXP_ITERATOR: 265 JSRegExpIterator::Cast(object)->VisitRangeSlot(visitor); 266 break; 267 case JSType::JS_ARRAY_ITERATOR: 268 JSArrayIterator::Cast(object)->VisitRangeSlot(visitor); 269 break; 270 case JSType::JS_STRING_ITERATOR: 271 JSStringIterator::Cast(object)->VisitRangeSlot(visitor); 272 break; 273 case JSType::JS_ARRAY_BUFFER: 274 JSArrayBuffer::Cast(object)->VisitRangeSlot(visitor); 275 break; 276 case JSType::JS_SHARED_ARRAY_BUFFER: 277 JSArrayBuffer::Cast(object)->VisitRangeSlot(visitor); 278 break; 279 case JSType::JS_PROMISE: 280 JSPromise::Cast(object)->VisitRangeSlot(visitor); 281 break; 282 case JSType::JS_DATA_VIEW: 283 JSDataView::Cast(object)->VisitRangeSlot(visitor); 284 break; 285 case JSType::JS_BOUND_FUNCTION: { 286 auto jsBoundFunction = JSBoundFunction::Cast(object); 287 jsBoundFunction->VisitRangeSlot(visitor); 288 break; 289 } 290 case JSType::JS_ARGUMENTS: 291 JSArguments::Cast(object)->VisitRangeSlot(visitor); 292 break; 293 case JSType::JS_GENERATOR_OBJECT: 294 JSGeneratorObject::Cast(object)->VisitRangeSlot(visitor); 295 break; 296 case JSType::JS_ASYNC_GENERATOR_OBJECT: 297 JSAsyncGeneratorObject::Cast(object)->VisitRangeSlot(visitor); 298 break; 299 case JSType::JS_ASYNC_FUNC_OBJECT: 300 JSAsyncFuncObject::Cast(object)->VisitRangeSlot(visitor); 301 break; 302 case JSType::JS_ARRAY: 303 JSArray::Cast(object)->VisitRangeSlot(visitor); 304 break; 305 case JSType::JS_TYPED_ARRAY: 306 case JSType::JS_INT8_ARRAY: 307 case JSType::JS_UINT8_ARRAY: 308 case JSType::JS_UINT8_CLAMPED_ARRAY: 309 case JSType::JS_INT16_ARRAY: 310 case JSType::JS_UINT16_ARRAY: 311 case JSType::JS_INT32_ARRAY: 312 case JSType::JS_UINT32_ARRAY: 313 case JSType::JS_FLOAT32_ARRAY: 314 case JSType::JS_FLOAT64_ARRAY: 315 case JSType::JS_BIGINT64_ARRAY: 316 case JSType::JS_BIGUINT64_ARRAY: 317 JSTypedArray::Cast(object)->VisitRangeSlot(visitor); 318 break; 319 case JSType::BYTE_ARRAY: 320 break; 321 case JSType::JS_PRIMITIVE_REF: 322 JSPrimitiveRef::Cast(object)->VisitRangeSlot(visitor); 323 break; 324 case JSType::JS_PROXY: { 325 auto jsProxy = JSProxy::Cast(object); 326 jsProxy->VisitRangeSlot(visitor); 327 break; 328 } 329 case JSType::HCLASS: 330 // semi gc is not needed to visit hclass 331 if (visitType != VisitType::SEMI_GC_VISIT) { 332 JSHClass::Cast(object)->VisitRangeSlot(visitor); 333 } 334 break; 335 case JSType::LINE_STRING: 336 case JSType::CONSTANT_STRING: 337 break; 338 case JSType::TREE_STRING: 339 TreeEcmaString::Cast(object)->VisitRangeSlot(visitor); 340 break; 341 case JSType::JS_NATIVE_POINTER: 342 if (visitType == VisitType::SNAPSHOT_VISIT) { 343 JSNativePointer::Cast(object)->VisitRangeSlotForNative(visitor); 344 } 345 break; 346 case JSType::TAGGED_ARRAY: 347 case JSType::TAGGED_DICTIONARY: 348 case JSType::TEMPLATE_MAP: 349 case JSType::LEXICAL_ENV: 350 case JSType::AOT_LITERAL_INFO: 351 case JSType::VTABLE: 352 case JSType::COW_TAGGED_ARRAY: 353 TaggedArray::Cast(object)->VisitRangeSlot(visitor); 354 break; 355 case JSType::CONSTANT_POOL: 356 ConstantPool::Cast(object)->VisitRangeSlot(visitor); 357 break; 358 case JSType::GLOBAL_ENV: 359 GlobalEnv::Cast(object)->VisitRangeSlot(visitor); 360 break; 361 case JSType::ACCESSOR_DATA: 362 case JSType::INTERNAL_ACCESSOR: 363 AccessorData::Cast(object)->VisitRangeSlot(visitor); 364 break; 365 case JSType::SYMBOL: 366 JSSymbol::Cast(object)->VisitRangeSlot(visitor); 367 break; 368 case JSType::JS_GENERATOR_CONTEXT: 369 GeneratorContext::Cast(object)->VisitRangeSlot(visitor); 370 break; 371 case JSType::PROTOTYPE_HANDLER: 372 PrototypeHandler::Cast(object)->VisitRangeSlot(visitor); 373 break; 374 case JSType::TRANSITION_HANDLER: 375 TransitionHandler::Cast(object)->VisitRangeSlot(visitor); 376 break; 377 case JSType::TRANS_WITH_PROTO_HANDLER: 378 TransWithProtoHandler::Cast(object)->VisitRangeSlot(visitor); 379 break; 380 case JSType::STORE_TS_HANDLER: 381 StoreTSHandler::Cast(object)->VisitRangeSlot(visitor); 382 break; 383 case JSType::PROPERTY_BOX: 384 PropertyBox::Cast(object)->VisitRangeSlot(visitor); 385 break; 386 case JSType::PROTO_CHANGE_MARKER: 387 break; 388 case JSType::PROTOTYPE_INFO: 389 ProtoChangeDetails::Cast(object)->VisitRangeSlot(visitor); 390 break; 391 case JSType::PROMISE_CAPABILITY: 392 PromiseCapability::Cast(object)->VisitRangeSlot(visitor); 393 break; 394 case JSType::ASYNC_GENERATOR_REQUEST: 395 AsyncGeneratorRequest::Cast(object)->VisitRangeSlot(visitor); 396 break; 397 case JSType::ASYNC_ITERATOR_RECORD: 398 AsyncIteratorRecord::Cast(object)->VisitRangeSlot(visitor); 399 break; 400 case JSType::PROMISE_RECORD: 401 PromiseRecord::Cast(object)->VisitRangeSlot(visitor); 402 break; 403 case JSType::RESOLVING_FUNCTIONS_RECORD: 404 ResolvingFunctionsRecord::Cast(object)->VisitRangeSlot(visitor); 405 break; 406 case JSType::PROMISE_REACTIONS: 407 PromiseReaction::Cast(object)->VisitRangeSlot(visitor); 408 break; 409 case JSType::PROMISE_ITERATOR_RECORD: 410 PromiseIteratorRecord::Cast(object)->VisitRangeSlot(visitor); 411 break; 412 case JSType::MICRO_JOB_QUEUE: 413 job::MicroJobQueue::Cast(object)->VisitRangeSlot(visitor); 414 break; 415 case JSType::PENDING_JOB: 416 job::PendingJob::Cast(object)->VisitRangeSlot(visitor); 417 break; 418 case JSType::COMPLETION_RECORD: 419 CompletionRecord::Cast(object)->VisitRangeSlot(visitor); 420 break; 421 case JSType::PROGRAM: 422 Program::Cast(object)->VisitRangeSlot(visitor); 423 break; 424 case JSType::JS_INTL: 425 JSIntl::Cast(object)->VisitRangeSlot(visitor); 426 break; 427 case JSType::JS_NUMBER_FORMAT: 428 JSNumberFormat::Cast(object)->VisitRangeSlot(visitor); 429 break; 430 case JSType::JS_LOCALE: 431 JSLocale::Cast(object)->VisitRangeSlot(visitor); 432 break; 433 case JSType::JS_DATE_TIME_FORMAT: 434 JSDateTimeFormat::Cast(object)->VisitRangeSlot(visitor); 435 break; 436 case JSType::JS_RELATIVE_TIME_FORMAT: 437 JSRelativeTimeFormat::Cast(object)->VisitRangeSlot(visitor); 438 break; 439 case JSType::JS_INTL_BOUND_FUNCTION: { 440 auto jsIntlBoundFunction = JSIntlBoundFunction::Cast(object); 441 jsIntlBoundFunction->VisitRangeSlot(visitor); 442 break; 443 } 444 case JSType::JS_REALM: 445 JSRealm::Cast(object)->VisitRangeSlot(visitor); 446 break; 447 case JSType::JS_COLLATOR: 448 JSCollator::Cast(object)->VisitRangeSlot(visitor); 449 break; 450 case JSType::JS_PLURAL_RULES: 451 JSPluralRules::Cast(object)->VisitRangeSlot(visitor); 452 break; 453 case JSType::JS_DISPLAYNAMES: 454 JSDisplayNames::Cast(object)->VisitRangeSlot(visitor); 455 break; 456 case JSType::JS_LIST_FORMAT: 457 JSListFormat::Cast(object)->VisitRangeSlot(visitor); 458 break; 459 case JSType::MACHINE_CODE_OBJECT: 460 MachineCode::Cast(object)->VisitRangeSlot(visitor); 461 break; 462 case JSType::CLASS_INFO_EXTRACTOR: { 463 auto classInfoExtractor = ClassInfoExtractor::Cast(object); 464 classInfoExtractor->VisitRangeSlot(visitor); 465 break; 466 } 467 case JSType::JS_API_QUEUE: 468 JSAPIQueue::Cast(object)->VisitRangeSlot(visitor); 469 break; 470 case JSType::JS_API_QUEUE_ITERATOR: 471 JSAPIQueueIterator::Cast(object)->VisitRangeSlot(visitor); 472 break; 473 case JSType::JS_API_ARRAY_LIST: 474 JSAPIArrayList::Cast(object)->VisitRangeSlot(visitor); 475 break; 476 case JSType::JS_API_ARRAYLIST_ITERATOR: 477 JSAPIArrayListIterator::Cast(object)->VisitRangeSlot(visitor); 478 break; 479 case JSType::JS_API_LIGHT_WEIGHT_MAP: 480 JSAPILightWeightMap::Cast(object)->VisitRangeSlot(visitor); 481 break; 482 case JSType::JS_API_LIGHT_WEIGHT_MAP_ITERATOR: 483 JSAPILightWeightMapIterator::Cast(object)->VisitRangeSlot(visitor); 484 break; 485 case JSType::JS_API_LIGHT_WEIGHT_SET: 486 JSAPILightWeightSet::Cast(object)->VisitRangeSlot(visitor); 487 break; 488 case JSType::JS_API_LIGHT_WEIGHT_SET_ITERATOR: 489 JSAPILightWeightSetIterator::Cast(object)->VisitRangeSlot(visitor); 490 break; 491 case JSType::TS_OBJECT_TYPE: 492 TSObjectType::Cast(object)->VisitRangeSlot(visitor); 493 break; 494 case JSType::TS_CLASS_TYPE: 495 TSClassType::Cast(object)->VisitRangeSlot(visitor); 496 break; 497 case JSType::TS_UNION_TYPE: 498 TSUnionType::Cast(object)->VisitRangeSlot(visitor); 499 break; 500 case JSType::TS_INTERFACE_TYPE: 501 TSInterfaceType::Cast(object)->VisitRangeSlot(visitor); 502 break; 503 case JSType::TS_CLASS_INSTANCE_TYPE: 504 break; 505 case JSType::TS_FUNCTION_TYPE: 506 TSFunctionType::Cast(object)->VisitRangeSlot(visitor); 507 break; 508 case JSType::TS_ARRAY_TYPE: 509 break; 510 case JSType::TS_ITERATOR_INSTANCE_TYPE: 511 break; 512 case JSType::TS_NAMESPACE_TYPE: 513 TSNamespaceType::Cast(object)->VisitRangeSlot(visitor); 514 break; 515 case JSType::RB_TREENODE: 516 RBTreeNode::Cast(object)->VisitRangeSlot(visitor); 517 break; 518 case JSType::LINKED_NODE: 519 LinkedNode::Cast(object)->VisitRangeSlot(visitor); 520 break; 521 case JSType::JS_API_HASH_MAP: 522 JSAPIHashMap::Cast(object)->VisitRangeSlot(visitor); 523 break; 524 case JSType::JS_API_HASH_SET: 525 JSAPIHashSet::Cast(object)->VisitRangeSlot(visitor); 526 break; 527 case JSType::JS_API_HASHMAP_ITERATOR: 528 JSAPIHashMapIterator::Cast(object)->VisitRangeSlot(visitor); 529 break; 530 case JSType::JS_API_HASHSET_ITERATOR: 531 JSAPIHashSetIterator::Cast(object)->VisitRangeSlot(visitor); 532 break; 533 case JSType::JS_API_TREE_MAP: 534 JSAPITreeMap::Cast(object)->VisitRangeSlot(visitor); 535 break; 536 case JSType::JS_API_TREE_SET: 537 JSAPITreeSet::Cast(object)->VisitRangeSlot(visitor); 538 break; 539 case JSType::JS_API_TREEMAP_ITERATOR: 540 JSAPITreeMapIterator::Cast(object)->VisitRangeSlot(visitor); 541 break; 542 case JSType::JS_API_TREESET_ITERATOR: 543 JSAPITreeSetIterator::Cast(object)->VisitRangeSlot(visitor); 544 break; 545 case JSType::JS_API_PLAIN_ARRAY: 546 JSAPIPlainArray::Cast(object)->VisitRangeSlot(visitor); 547 break; 548 case JSType::JS_API_PLAIN_ARRAY_ITERATOR: 549 JSAPIPlainArrayIterator::Cast(object)->VisitRangeSlot(visitor); 550 break; 551 case JSType::JS_API_DEQUE: 552 JSAPIDeque::Cast(object)->VisitRangeSlot(visitor); 553 break; 554 case JSType::JS_API_DEQUE_ITERATOR: 555 JSAPIDequeIterator::Cast(object)->VisitRangeSlot(visitor); 556 break; 557 case JSType::JS_API_STACK: 558 JSAPIStack::Cast(object)->VisitRangeSlot(visitor); 559 break; 560 case JSType::JS_API_STACK_ITERATOR: 561 JSAPIStackIterator::Cast(object)->VisitRangeSlot(visitor); 562 break; 563 case JSType::JS_API_VECTOR: 564 JSAPIVector::Cast(object)->VisitRangeSlot(visitor); 565 break; 566 case JSType::JS_API_VECTOR_ITERATOR: 567 JSAPIVectorIterator::Cast(object)->VisitRangeSlot(visitor); 568 break; 569 case JSType::JS_API_LIST: 570 JSAPIList::Cast(object)->VisitRangeSlot(visitor); 571 break; 572 case JSType::JS_API_LINKED_LIST: 573 JSAPILinkedList::Cast(object)->VisitRangeSlot(visitor); 574 break; 575 case JSType::JS_API_LIST_ITERATOR: 576 JSAPIListIterator::Cast(object)->VisitRangeSlot(visitor); 577 break; 578 case JSType::JS_API_LINKED_LIST_ITERATOR: 579 JSAPILinkedListIterator::Cast(object)->VisitRangeSlot(visitor); 580 break; 581 case JSType::BIGINT: 582 break; 583 case JSType::SOURCE_TEXT_MODULE_RECORD: 584 SourceTextModule::Cast(object)->VisitRangeSlot(visitor); 585 break; 586 case JSType::IMPORTENTRY_RECORD: 587 ImportEntry::Cast(object)->VisitRangeSlot(visitor); 588 break; 589 case JSType::LOCAL_EXPORTENTRY_RECORD: 590 LocalExportEntry::Cast(object)->VisitRangeSlot(visitor); 591 break; 592 case JSType::INDIRECT_EXPORTENTRY_RECORD: 593 IndirectExportEntry::Cast(object)->VisitRangeSlot(visitor); 594 break; 595 case JSType::STAR_EXPORTENTRY_RECORD: 596 StarExportEntry::Cast(object)->VisitRangeSlot(visitor); 597 break; 598 case JSType::RESOLVEDBINDING_RECORD: 599 ResolvedBinding::Cast(object)->VisitRangeSlot(visitor); 600 break; 601 case JSType::RESOLVEDINDEXBINDING_RECORD: 602 ResolvedIndexBinding::Cast(object)->VisitRangeSlot(visitor); 603 break; 604 case JSType::JS_MODULE_NAMESPACE: 605 ModuleNamespace::Cast(object)->VisitRangeSlot(visitor); 606 break; 607 case JSType::JS_CJS_EXPORTS: 608 CjsExports::Cast(object)->VisitRangeSlot(visitor); 609 break; 610 case JSType::JS_CJS_MODULE: 611 CjsModule::Cast(object)->VisitRangeSlot(visitor); 612 break; 613 case JSType::JS_CJS_REQUIRE: 614 CjsRequire::Cast(object)->VisitRangeSlot(visitor); 615 break; 616 case JSType::METHOD: 617 Method::Cast(object)->VisitRangeSlot(visitor); 618 break; 619 case JSType::CLASS_LITERAL: 620 ClassLiteral::Cast(object)->VisitRangeSlot(visitor); 621 break; 622 default: 623 LOG_ECMA(FATAL) << "this branch is unreachable, type:" << static_cast<size_t>(type); 624 UNREACHABLE(); 625 } 626 } 627 628 private: 629 EcmaVM *ecmaVm_ {nullptr}; 630 }; 631 } // namespace panda::ecmascript 632 633 #endif // ECMASCRIPT_MEM_OBJECT_XRAY_H 634