Fix assign bug

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

Signed-off-by: xwcai98 <caixinwei5@huawei.com>
Change-Id: Ibcf0b06d438c891739c3155ff390b025430ba21c
This commit is contained in:
xwcai98 2024-11-05 15:13:50 +08:00
parent e688cee54e
commit e1147688e1
5 changed files with 25 additions and 2 deletions

View File

@ -5826,7 +5826,7 @@ void StubBuilder::FastSetPropertyByName(GateRef glue, GateRef obj, GateRef key,
}
Bind(&slowPath);
{
result = CallRuntime(glue, RTSTUB_ID(StoreICByValue), { obj, *keyVar, value, IntToTaggedInt(Int32(0)) });
result = CallRuntime(glue, RTSTUB_ID(StObjByValue), { obj, *keyVar, value });
Jump(&exit);
}
Bind(&exit);

View File

@ -296,6 +296,7 @@ namespace panda::ecmascript {
V(StOwnByValue) \
V(LdSuperByValue) \
V(StSuperByValue) \
V(StObjByValue) \
V(LdObjByIndex) \
V(StObjByIndex) \
V(StOwnByIndex) \

View File

@ -1369,6 +1369,15 @@ DEF_RUNTIME_STUBS(GetArrayLiteralFromCache)
thread, cp, index.GetInt(), module.GetTaggedValue()).GetRawData();
}
DEF_RUNTIME_STUBS(StObjByValue)
{
RUNTIME_STUBS_HEADER(StObjByValue);
JSHandle<JSTaggedValue> receiver = GetHArg<JSTaggedValue>(argv, argc, 0); // 0: means the zeroth parameter
JSHandle<JSTaggedValue> key = GetHArg<JSTaggedValue>(argv, argc, 1); // 1: means the first parameter
JSHandle<JSTaggedValue> value = GetHArg<JSTaggedValue>(argv, argc, 2); // 2: means the second parameter
return RuntimeStObjByValue(thread, receiver, key, value).GetRawData();
}
DEF_RUNTIME_STUBS(LdObjByIndex)
{
RUNTIME_STUBS_HEADER(LdObjByIndex);

View File

@ -17,3 +17,4 @@
3
false
a,b,c
true

View File

@ -54,4 +54,16 @@ const v3 = 10;
const v4 = Symbol("foo");
const obj3 = Object.assign({}, v1, null, v2, undefined, v3, v4);
print(Object.values(obj3))
print(Object.values(obj3));
const v5 = new Uint8Array();
const o7 = {
__proto__ : v5,
};
const o8 = {
get f() {
return this;
},
};
Object.assign(o7, o8);
print(o7.f === o8);