diff --git a/runtime/builtins/builtins_global.cpp b/runtime/builtins/builtins_global.cpp index 766db23081b21caf4838579bdd264e4b6815ca07..241649277f3821f39e268c8c22730262c9f95c98 100644 --- a/runtime/builtins/builtins_global.cpp +++ b/runtime/builtins/builtins_global.cpp @@ -1157,8 +1157,8 @@ JSHandle GCSpecialisedObjectSpaceType(JSThread *thread, const JSH return global_constants->GetHandledObjectSpaceString(); } - auto object_allocator = thread->GetEcmaVM()->GetHeapManager()->GetObjectAllocator().AsObjectAllocator(); - if (object_allocator->IsObjectInYoungSpace(obj_handle.GetTaggedValue().GetHeapObject())) { + auto heap_manager = thread->GetEcmaVM()->GetHeapManager(); + if (heap_manager->IsObjectInYoungSpace(obj_handle.GetTaggedValue().GetHeapObject())) { return global_constants->GetHandledYoungSpaceString(); } return global_constants->GetHandledTenuredSpaceString(); @@ -1171,7 +1171,6 @@ JSTaggedValue global::PinObject(EcmaRuntimeCallInfo *argv) EcmaVM *vm = thread->GetEcmaVM(); JSHandle arg = builtins_common::GetCallArg(argv, 0); if (arg->IsHeapObject()) { - auto *obj_allocator = vm->GetHeapManager()->GetObjectAllocator().AsObjectAllocator(); auto *gc = vm->GetGC(); if (!gc->IsPinningSupported()) { [[maybe_unused]] EcmaHandleScope handle_scope(thread); @@ -1179,7 +1178,7 @@ JSTaggedValue global::PinObject(EcmaRuntimeCallInfo *argv) vm->GetFactory()->GetJSError(ErrorType::TYPE_ERROR, "Current GC does not support pinning"); THROW_NEW_ERROR_AND_RETURN_VALUE(thread, err.GetTaggedValue(), JSTaggedValue::Exception()); } - obj_allocator->PinObject(arg->GetHeapObject()); + vm->GetHeapManager()->PinObject(arg->GetHeapObject()); } else { [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle err = vm->GetFactory()->GetJSError(ErrorType::TYPE_ERROR, "The value must be an object"); @@ -1195,7 +1194,7 @@ JSTaggedValue global::UnpinObject(EcmaRuntimeCallInfo *argv) EcmaVM *vm = thread->GetEcmaVM(); JSHandle arg = builtins_common::GetCallArg(argv, 0); if (arg->IsHeapObject()) { - vm->GetHeapManager()->GetObjectAllocator().AsObjectAllocator()->UnpinObject(arg->GetHeapObject()); + vm->GetHeapManager()->UnpinObject(arg->GetHeapObject()); } else { [[maybe_unused]] EcmaHandleScope handle_scope(thread); JSHandle err = vm->GetFactory()->GetJSError(ErrorType::TYPE_ERROR, "The value must be an object"); diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp index 90ef32fb03161b0b5a57b1b0d23f4b0c46ec631a..9bc11af0a18bd6f548951403b41f03c0792c213c 100644 --- a/runtime/ecma_vm.cpp +++ b/runtime/ecma_vm.cpp @@ -480,7 +480,7 @@ void EcmaVM::DumpHeap(PandaOStringStream *o_str) const { size_t obj_cnt = 0; *o_str << "Dumping heap" << std::endl; - GetHeapManager()->GetObjectAllocator()->IterateOverObjects([&obj_cnt, &o_str](ObjectHeader *mem) { + GetHeapManager()->IterateOverObjects([&obj_cnt, &o_str](ObjectHeader *mem) { JSTaggedValue(mem).Dump(nullptr, *o_str); obj_cnt++; }); @@ -491,7 +491,7 @@ PandaString EcmaVM::GetClassesFootprint() const { PandaUnorderedMap classes_footprint; PandaStringStream result; - GetHeapManager()->GetObjectAllocator()->IterateOverObjects([&classes_footprint](ObjectHeader *mem) { + GetHeapManager()->IterateOverObjects([&classes_footprint](ObjectHeader *mem) { auto obj_type = JSTaggedValue(mem).GetTaggedObject()->GetClass()->GetObjectType(); classes_footprint[obj_type] += mem->ObjectSize(); });