mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-10-06 23:54:03 +00:00
fix ide heapdump
Signed-off-by: z00522183 <zhanheng2@huawei.com> Change-Id: I1860c2a354012fdfd6c39cb36a5f871fec1a2cbc
This commit is contained in:
parent
068f004cc6
commit
a0090ce8c6
@ -216,20 +216,20 @@ bool HeapProfiler::DumpHeapSnapshot(DumpFormat dumpFormat, Stream *stream, Progr
|
||||
bool isFullGC, bool isSimplify, bool isSync)
|
||||
{
|
||||
bool res = false;
|
||||
base::BlockHookScope blockScope;
|
||||
ThreadManagedScope managedScope(vm_->GetJSThread());
|
||||
if (isFullGC) {
|
||||
[[maybe_unused]] bool heapClean = ForceFullGC(vm_);
|
||||
ASSERT(heapClean);
|
||||
}
|
||||
// suspend All.
|
||||
SuspendAllScope suspendScope(vm_->GetAssociatedJSThread());
|
||||
if (isFullGC) {
|
||||
DISALLOW_GARBAGE_COLLECTION;
|
||||
const_cast<Heap *>(vm_->GetHeap())->Prepare();
|
||||
}
|
||||
pid_t pid = -1;
|
||||
{
|
||||
base::BlockHookScope blockScope;
|
||||
ThreadManagedScope managedScope(vm_->GetJSThread());
|
||||
// suspend All.
|
||||
SuspendAllScope suspendScope(vm_->GetAssociatedJSThread());
|
||||
if (isFullGC) {
|
||||
DISALLOW_GARBAGE_COLLECTION;
|
||||
const_cast<Heap *>(vm_->GetHeap())->Prepare();
|
||||
}
|
||||
// fork
|
||||
if ((pid = fork()) < 0) {
|
||||
LOG_ECMA(ERROR) << "DumpHeapSnapshot fork failed!";
|
||||
|
@ -1114,7 +1114,8 @@ const CString HeapSnapshot::ParseObjectName(TaggedObject *obj)
|
||||
{
|
||||
ASSERT(JSTaggedValue(obj).IsJSObject());
|
||||
JSThread *thread = vm_->GetJSThread();
|
||||
return JSObject::ExtractConstructorAndRecordName(thread, obj);
|
||||
bool isCallGetter = false;
|
||||
return JSObject::ExtractConstructorAndRecordName(thread, obj, true, &isCallGetter);
|
||||
}
|
||||
|
||||
Node *HeapSnapshot::InsertNodeUnique(Node *node)
|
||||
|
@ -2388,14 +2388,20 @@ void JSObject::ToPropertyDescriptor(JSThread *thread, const JSHandle<JSTaggedVal
|
||||
// 23. Return desc.
|
||||
}
|
||||
|
||||
const CString JSObject::ExtractConstructorAndRecordName(JSThread *thread, TaggedObject *obj)
|
||||
const CString JSObject::ExtractConstructorAndRecordName(JSThread *thread, TaggedObject *obj, bool noAllocate,
|
||||
bool *isCallGetter)
|
||||
{
|
||||
CString result = "";
|
||||
const GlobalEnvConstants *globalConst = thread->GlobalConstants();
|
||||
|
||||
JSHandle<JSTaggedValue> contructorKey = globalConst->GetHandledConstructorString();
|
||||
JSTaggedValue objConstructor = ObjectFastOperator::GetPropertyByName(thread, JSTaggedValue(obj),
|
||||
contructorKey.GetTaggedValue());
|
||||
contructorKey.GetTaggedValue(), noAllocate,
|
||||
isCallGetter);
|
||||
if (*isCallGetter) {
|
||||
return "JSObject";
|
||||
}
|
||||
|
||||
if (!objConstructor.IsJSFunction()) {
|
||||
return "JSObject";
|
||||
}
|
||||
|
@ -702,7 +702,8 @@ public:
|
||||
DECL_VISIT_OBJECT_FOR_JS_OBJECT(ECMAObject, PROPERTIES_OFFSET, SIZE)
|
||||
|
||||
DECL_DUMP()
|
||||
static const CString ExtractConstructorAndRecordName(JSThread *thread, TaggedObject *obj);
|
||||
static const CString ExtractConstructorAndRecordName(JSThread *thread, TaggedObject *obj, bool noAllocate = false,
|
||||
bool *isCallGetter = nullptr);
|
||||
|
||||
static JSHandle<NameDictionary> PUBLIC_API TransitionToDictionary(const JSThread *thread,
|
||||
const JSHandle<JSObject> &receiver);
|
||||
|
@ -146,7 +146,8 @@ JSTaggedValue ObjectFastOperator::TryGetPropertyByNameThroughCacheAtLocal(JSThre
|
||||
|
||||
template<ObjectFastOperator::Status status>
|
||||
JSTaggedValue ObjectFastOperator::GetPropertyByName(JSThread *thread, JSTaggedValue receiver,
|
||||
JSTaggedValue key)
|
||||
JSTaggedValue key, [[maybe_unused]]bool noAllocate,
|
||||
[[maybe_unused]]bool *isCallGetter)
|
||||
{
|
||||
INTERPRETER_TRACE(thread, GetPropertyByName);
|
||||
// no gc when return hole
|
||||
@ -194,6 +195,10 @@ JSTaggedValue ObjectFastOperator::GetPropertyByName(JSThread *thread, JSTaggedVa
|
||||
if (GetInternal(status)) {
|
||||
return value;
|
||||
}
|
||||
if (noAllocate) {
|
||||
*isCallGetter = true;
|
||||
return value;
|
||||
}
|
||||
return CallGetter(thread, receiver, holder, value);
|
||||
}
|
||||
ASSERT(!value.IsAccessor());
|
||||
@ -213,6 +218,10 @@ JSTaggedValue ObjectFastOperator::GetPropertyByName(JSThread *thread, JSTaggedVa
|
||||
if (GetInternal(status)) {
|
||||
return value;
|
||||
}
|
||||
if (noAllocate) {
|
||||
*isCallGetter = true;
|
||||
return value;
|
||||
}
|
||||
return CallGetter(thread, receiver, holder, value);
|
||||
}
|
||||
ASSERT(!value.IsAccessor());
|
||||
|
@ -56,7 +56,8 @@ public:
|
||||
|
||||
template<Status status = Status::None>
|
||||
static inline JSTaggedValue GetPropertyByName(JSThread *thread, JSTaggedValue receiver,
|
||||
JSTaggedValue key);
|
||||
JSTaggedValue key, bool noAllocate = false,
|
||||
bool *isCallGetter = nullptr);
|
||||
|
||||
template <Status status = Status::None>
|
||||
static inline JSTaggedValue TrySetPropertyByNameThroughCacheAtLocal(JSThread *thread, JSTaggedValue receiver,
|
||||
|
Loading…
Reference in New Issue
Block a user