issue:#I4UX5L

Reason: fix FastStub SetPropertyByName crash bug

 Description: SetLayoutToHClass set the wrong machine type, and cause a crash.

Signed-off-by: sunzhe23 <sunzhe23@huawei.com>
This commit is contained in:
sunzhe23
2022-02-22 22:35:15 -08:00
parent 3dc54d64c6
commit dd0fbb3fce
4 changed files with 7 additions and 17 deletions
+2 -2
View File
@@ -155,7 +155,6 @@ namespace panda::ecmascript::kungfu {
V(TryLoadICByValue, 5) \
V(TryStoreICByName, 5) \
V(TryStoreICByValue, 6) \
V(TestAbsoluteAddressRelocation, 2) \
INTERPRETER_STUB_HELPER_LIST(V)
@@ -164,7 +163,8 @@ namespace panda::ecmascript::kungfu {
V(FastMulGCTest, 3) \
V(PhiGateTest, 1) \
V(LoopTest, 1) \
V(LoopTest1, 1)
V(LoopTest1, 1) \
V(TestAbsoluteAddressRelocation, 2)
#define CALL_STUB_LIST(V) \
FAST_RUNTIME_STUB_LIST(V) \
+2 -2
View File
@@ -1468,10 +1468,10 @@ GateRef Stub::SetProtoChangeDetailsToHClass(StubMachineType type, GateRef glue,
return Store(type, glue, hClass, offset, protoChange);
}
GateRef Stub::SetLayoutToHClass(GateRef glue, GateRef hClass, GateRef attr)
GateRef Stub::SetLayoutToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef attr)
{
GateRef offset = GetIntPtrConstant(JSHClass::LAYOUT_OFFSET);
return Store(StubMachineType::TAGGED_POINTER, glue, hClass, offset, attr);
return Store(type, glue, hClass, offset, attr);
}
GateRef Stub::SetParentToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef parent)
+2 -12
View File
@@ -2254,18 +2254,8 @@ void Stub::CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef srcHClass)
auto env = GetEnvironment();
Label entry(env);
env->PushCurrentLabel(&entry);
Label exit(env);
Label isEcmaObject(env);
Label notEcmaObject(env);
auto proto = GetPrototypeFromHClass(srcHClass);
Branch(IsEcmaObject(proto), &isEcmaObject, &exit);
Bind(&isEcmaObject);
{
SetIsProtoTypeToHClass(glue, LoadHClass(proto), TrueConstant());
Jump(&exit);
}
Bind(&exit);
SetPrototypeToHClass(StubMachineType::TAGGED_POINTER, glue, dstHClass, proto);
SetPrototypeToHClass(StubMachineType::INT64, glue, dstHClass, proto);
SetBitFieldToHClass(glue, dstHClass, GetBitFieldFromHClass(srcHClass));
SetNumberOfPropsToHClass(glue, dstHClass, GetNumberOfPropsFromHClass(srcHClass));
SetParentToHClass(StubMachineType::INT64, glue, dstHClass, GetInt64Constant(JSTaggedValue::VALUE_NULL));
@@ -2273,7 +2263,7 @@ void Stub::CopyAllHClass(GateRef glue, GateRef dstHClass, GateRef srcHClass)
SetProtoChangeDetailsToHClass(StubMachineType::INT64, glue, dstHClass,
GetInt64Constant(JSTaggedValue::VALUE_NULL));
SetEnumCacheToHClass(StubMachineType::INT64, glue, dstHClass, GetInt64Constant(JSTaggedValue::VALUE_NULL));
SetLayoutToHClass(glue, dstHClass, GetLayoutFromHClass(srcHClass));
SetLayoutToHClass(StubMachineType::INT64, glue, dstHClass, GetLayoutFromHClass(srcHClass));
env->PopCurrentLabel();
return;
}
+1 -1
View File
@@ -667,7 +667,7 @@ public:
inline GateRef SetPrototypeToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef proto);
inline GateRef SetProtoChangeDetailsToHClass(StubMachineType type, GateRef glue, GateRef hClass,
GateRef protoChange);
inline GateRef SetLayoutToHClass(GateRef glue, GateRef hClass, GateRef attr);
inline GateRef SetLayoutToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef attr);
inline GateRef SetParentToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef parent);
inline GateRef SetEnumCacheToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef key);
inline GateRef SetTransitionsToHClass(StubMachineType type, GateRef glue, GateRef hClass, GateRef transition);