mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 10:09:54 +00:00
[Fuzz] NewNumber/retype fuzz bugfix
Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAHZ1E Description:1.phi的输入存在CHAR时,需要判断constant输入;2.new Number时输入两个以上参数导致错误的ASSERT Signed-off-by: zhangyinlu <zhangyinlu@huawei.com> Change-Id: Ibfc5e2b481628db2514d0c5276ac61525dd463b9
This commit is contained in:
parent
45abcf3683
commit
6e7e95c0b3
@ -491,7 +491,7 @@ GateRef NumberSpeculativeRetype::VisitStringAdd(GateRef gate)
|
||||
return Circuit::NullGate();
|
||||
}
|
||||
|
||||
TypeInfo NumberSpeculativeRetype::GetOuputForPhi(GateRef gate, bool ignoreConstant)
|
||||
TypeInfo NumberSpeculativeRetype::GetOutputForPhi(GateRef gate, bool ignoreConstant)
|
||||
{
|
||||
size_t valueNum = acc_.GetNumValueIn(gate);
|
||||
bool hasConstantInput = false;
|
||||
@ -515,8 +515,8 @@ TypeInfo NumberSpeculativeRetype::GetOuputForPhi(GateRef gate, bool ignoreConsta
|
||||
}
|
||||
}
|
||||
|
||||
if (hasConstantInput && ignoreConstant && tempType == TypeInfo::NONE) {
|
||||
return GetOuputForPhi(gate, false);
|
||||
if (hasConstantInput && ignoreConstant && (tempType == TypeInfo::NONE || tempType == TypeInfo::CHAR)) {
|
||||
return GetOutputForPhi(gate, false);
|
||||
}
|
||||
return tempType;
|
||||
}
|
||||
@ -524,7 +524,7 @@ TypeInfo NumberSpeculativeRetype::GetOuputForPhi(GateRef gate, bool ignoreConsta
|
||||
GateRef NumberSpeculativeRetype::VisitPhi(GateRef gate)
|
||||
{
|
||||
if (IsRetype()) {
|
||||
auto tempType = GetOuputForPhi(gate, true);
|
||||
auto tempType = GetOutputForPhi(gate, true);
|
||||
TypeInfo typeInfo = GetOutputTypeInfo(gate);
|
||||
if (typeInfo != tempType) {
|
||||
SetOutputTypeInfo(gate, tempType);
|
||||
|
@ -159,7 +159,7 @@ private:
|
||||
GateRef TryConvertConstant(GateRef gate, bool needInt32);
|
||||
GateRef TryConvertConstantToInt32(GateRef gate);
|
||||
GateRef ConvertTaggedToNJSValue(GateRef gate, TypeInfo output);
|
||||
TypeInfo GetOuputForPhi(GateRef gate, bool ignoreConstant);
|
||||
TypeInfo GetOutputForPhi(GateRef gate, bool ignoreConstant);
|
||||
|
||||
TypeInfo GetOutputTypeInfo(GateRef gate) const
|
||||
{
|
||||
|
@ -1482,8 +1482,7 @@ bool TryLowerNewNumber(CircuitBuilder *builder, GateAccessor acc, GateRef gate)
|
||||
if ((acc.GetOpCode(loadBuiltin) == OpCode::LOAD_BUILTIN_OBJECT) &&
|
||||
(acc.GetIndex(loadBuiltin) == static_cast<size_t>(BuiltinType::BT_NUMBER))) {
|
||||
auto arg = builder->ToTaggedIntPtr(builder->Int32(0));
|
||||
if (acc.GetNumValueIn(gate) != 1) {
|
||||
ASSERT(acc.GetNumValueIn(gate) == 2U);
|
||||
if (acc.GetNumValueIn(gate) > 1) {
|
||||
arg = acc.GetValueIn(gate, 1);
|
||||
}
|
||||
|
||||
|
@ -12,3 +12,5 @@
|
||||
# limitations under the License.
|
||||
|
||||
[object Object]
|
||||
7
|
||||
true
|
||||
|
@ -18,3 +18,10 @@ declare function print(arg:any):string;
|
||||
|
||||
let a = new EventInfo()
|
||||
print(a)
|
||||
|
||||
function foo() {
|
||||
let c = new Number(7, Number)
|
||||
print(c)
|
||||
}
|
||||
foo()
|
||||
print(ArkTools.isAOTCompiled(foo))
|
@ -13,3 +13,5 @@
|
||||
|
||||
true
|
||||
97
|
||||
true
|
||||
9,[object Object]
|
@ -25,7 +25,20 @@ for (let i = 0; i < 20; i++) {
|
||||
}
|
||||
|
||||
ArkTools.jitCompileAsync(f);
|
||||
let res = ArkTools.waitJitCompileFinish(f);
|
||||
print(res)
|
||||
print(ArkTools.waitJitCompileFinish(f))
|
||||
|
||||
print(f(ss))
|
||||
|
||||
function f2() {
|
||||
let v1 = 0, v18 = 0, v28 = 1;
|
||||
for (; v28--;) {
|
||||
({ "length": v18, ...v1 } = "123456789");
|
||||
}
|
||||
return [v18, v1];
|
||||
}
|
||||
|
||||
f2();
|
||||
ArkTools.jitCompileAsync(f2);
|
||||
print(ArkTools.waitJitCompileFinish(f2))
|
||||
|
||||
print(f2())
|
||||
|
Loading…
Reference in New Issue
Block a user