BugFix of SizeFromJSHClass for Ecmastring

Description:
Can not use hclass from header in SizeFromJSHClass because hclass may be
forwarded.
Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I6R4I3

Signed-off-by: yuanyao <yuanyao14@huawei.com>
Change-Id: Ic049d64c29edfeb3be20287ef02c73a8001196fa
This commit is contained in:
yuanyao 2023-03-28 21:39:59 +08:00
parent f239575570
commit 2ec70f62a7

View File

@ -194,8 +194,11 @@ inline size_t JSHClass::SizeFromJSHClass(TaggedObject *header)
size = AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT));
break;
case JSType::LINE_STRING:
size = LineEcmaString::ObjectSize(reinterpret_cast<EcmaString* >(header));
size = AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT));
break;
case JSType::TREE_STRING:
size = EcmaStringAccessor(reinterpret_cast<EcmaString *>(header)).ObjectSize();
size = TreeEcmaString::SIZE;
size = AlignUp(size, static_cast<size_t>(MemAlignment::MEM_ALIGN_OBJECT));
break;
case JSType::MACHINE_CODE_OBJECT: