!7641 TypedArray.of IR do not consider thisValue is a Derived

Merge pull request !7641 from 贺存茂/TypedArrayof0602
This commit is contained in:
openharmony_ci 2024-06-04 12:25:45 +00:00 committed by Gitee
commit e4156293ae
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 31 additions and 1 deletions

View File

@ -2468,6 +2468,7 @@ void BuiltinsTypedArrayStubBuilder::Of(GateRef glue, GateRef thisValue,
Label thisExists(env);
Label isEcmaObject(env);
Label isConstructor(env);
Label notDerived(env);
Label thisObjIsECmaObject(env);
Label thisObjIsFastTypedArray(env);
Label defaultConstr(env);
@ -2478,6 +2479,8 @@ void BuiltinsTypedArrayStubBuilder::Of(GateRef glue, GateRef thisValue,
Bind(&isEcmaObject);
BRANCH(IsConstructor(thisValue), &isConstructor, slowPath);
Bind(&isConstructor);
BRANCH(IsDerived(thisValue), slowPath, &notDerived);
Bind(&notDerived);
// 3: maximum of numArgs
BRANCH(Int32LessThanOrEqual(TruncPtrToInt32(numArgs), Int32(3)), &numArgsInRange, slowPath);
Bind(&numArgsInRange);

View File

@ -195,3 +195,12 @@ true
0 0 0 0 0 0 1 2 3
-0 -0 0 0 1 2 3 NaN NaN
-0 -0 0 0 1 2 3 NaN NaN
Class extends Float64Array test success!
Class extends Float32Array test success!
Class extends Int32Array test success!
Class extends Int16Array test success!
Class extends Int8Array test success!
Class extends Uint32Array test success!
Class extends Uint16Array test success!
Class extends Uint8Array test success!
Class extends Uint8ClampedArray test success!

View File

@ -877,3 +877,21 @@ function prettyPrinted(value) {
}
return prettyPrint(value);
}
[
Float64Array,
Float32Array,
Int32Array,
Int16Array,
Int8Array,
Uint32Array,
Uint16Array,
Uint8Array,
Uint8ClampedArray
].forEach(function(ctor, i) {
class C extends ctor{
}
C.of();
print("Class extends "+ ctor.name + " test success!")
});