Fix assert bug

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

Signed-off-by: 王笑佳 <wangxiaojia5@huawei.com>
This commit is contained in:
王笑佳 2024-11-13 17:00:00 +08:00
parent d5527468e1
commit 623d8b7ce4
4 changed files with 26 additions and 2 deletions

View File

@ -200,7 +200,9 @@ JSHandle<TaggedArray> JSAPIDeque::OwnKeys(JSThread *thread, const JSHandle<JSAPI
uint32_t length = deque->GetSize();
JSHandle<TaggedArray> oldElements(thread, deque->GetElements());
ASSERT(!oldElements->IsDictionaryMode());
if (oldElements->IsDictionaryMode()) {
return JSObject::GetOwnPropertyKeys(thread, JSHandle<JSObject>::Cast(deque));
}
uint32_t oldCapacity = oldElements->GetLength();
uint32_t newCapacity = ComputeCapacity(oldCapacity);
uint32_t firstIndex = deque->GetFirst();

View File

@ -158,7 +158,9 @@ JSHandle<TaggedArray> JSAPIQueue::OwnKeys(JSThread *thread, const JSHandle<JSAPI
uint32_t length = obj->GetLength().GetArrayLength();
JSHandle<TaggedArray> oldElements(thread, obj->GetElements());
ASSERT(!oldElements->IsDictionaryMode());
if (oldElements->IsDictionaryMode()) {
return JSObject::GetOwnPropertyKeys(thread, JSHandle<JSObject>::Cast(obj));
}
uint32_t oldCapacity = oldElements->GetLength();
uint32_t newCapacity = ComputeCapacity(oldCapacity);
uint32_t front = obj->GetFront();

View File

@ -168,5 +168,15 @@ if (globalThis["ArkPrivate"] != undefined) {
v22 = new C11()
v22[2295334561] = 0
print(v22.length)
class C44 extends Deque{
constructor(a) {
super()
super[a] = 11
const o10 = {
...this
}
}
}
new C44(38062)
}
export let dequeRes = "Test Deque done";

View File

@ -162,5 +162,15 @@ if (globalThis["ArkPrivate"] != undefined) {
} catch (error) {
print(error)
}
class C4 extends Queue{
constructor(a) {
super()
super[a] = 11
const o10 = {
...this
}
}
}
new C4(38062)
}
export let queueRes = "Test Queue done";