Fix wrong PGO worknode for deserialized function

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAG24R

Tests: all per-merge test passed

Signed-off-by: zhaoziming <zhaoziming9@huawei.com>
Change-Id: I2053dee9f40a71e137c8349cf2e97811bcf365c8
This commit is contained in:
zhaoziming 2024-07-28 19:32:39 +08:00
parent 6df8e37801
commit bcbbd36570
2 changed files with 3 additions and 1 deletions

View File

@ -185,6 +185,7 @@ void BaseDeserializer::HandleNewObjectEncodeFlag(SerializedObjectSpace space, u
concurrentFunctions_.push_back(reinterpret_cast<JSFunction *>(object));
}
func->SetRawProfileTypeInfo(thread_, thread_->GlobalConstants()->GetEmptyProfileTypeInfoCell(), SKIP_BARRIER);
func->SetWorkNodePointer(reinterpret_cast<uintptr_t>(nullptr));
}
UpdateMaybeWeak(ObjectSlot(objAddr + fieldOffset), addr, isWeak);
if (!isRoot) {

View File

@ -851,11 +851,12 @@ public:
OperationResult result2 = JSObject::GetProperty(thread, res, key2);
JSHandle<JSTaggedValue> value2 = result2.GetRawValue();
EXPECT_TRUE(value2->IsJSFunction());
EXPECT_TRUE(JSHandle<JSFunction>::Cast(value2)->GetWorkNodePointer() == reinterpret_cast<uintptr_t>(nullptr));
JSHandle<JSTaggedValue> key3(factory->NewFromASCII("key"));
OperationResult result3 = JSObject::GetProperty(thread, res, key3);
JSHandle<JSTaggedValue> value3 = result3.GetRawValue();
EXPECT_TRUE(value3->IsJSFunction());
EXPECT_TRUE(JSHandle<JSFunction>::Cast(value3)->GetWorkNodePointer() == reinterpret_cast<uintptr_t>(nullptr));
Destroy();
}