Fix isOneByte assert

Issues: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8TJ04
Signed-off-by: K0u1hw <wangchunyang15@huawei.com>

Change-Id: Iaf9390a3c576cadff5a64b635b0b51561bf4804f
This commit is contained in:
K0u1hw 2024-01-04 11:45:37 +08:00
parent d03813d421
commit 752896650d
2 changed files with 7 additions and 1 deletions

View File

@ -267,6 +267,10 @@ JSTaggedValue JSStableArray::Join(JSHandle<JSArray> receiver, EcmaRuntimeCallInf
if (elementsLength == 0 && length != 0) {
len = length;
}
if (len <= 1) {
// sep unused, set isOneByte to default(true)
isOneByte = true;
}
for (uint32_t k = 0; k < len; k++) {
JSTaggedValue element = JSTaggedValue::Undefined();
if (k < elementsLength) {

View File

@ -75,4 +75,6 @@ try {
Object.getOwnPropertyDescriptors(Array(1e9).join('c'))
} catch (e) {
print(e instanceof RangeError);
}
}
([11])["join"]('쏄');