[*] Ensure Token::EQ_STRICT understands all bigints are comparable.
Closes #5
Last aurora commit: e9f848d4
This commit is contained in:
parent
e9f848d445
commit
1f6ee19ed3
@ -13728,6 +13728,49 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
|
||||
BIND(&if_lhsisnotsmi);
|
||||
{
|
||||
Label if_lhsisbigint(this), if_lhsisnotbigint(this);
|
||||
|
||||
{
|
||||
// Load the instance type of {lhs}.
|
||||
TNode<Uint16T> lhs_instance_type = LoadInstanceType(CAST(lhs));
|
||||
|
||||
// Check if either {rhs} or {lhs} is a BigInt.
|
||||
GotoIf(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint);
|
||||
|
||||
GotoIf(TaggedIsSmi(rhs), &if_lhsisnotbigint);
|
||||
GotoIf(IsBigIntInstanceType(LoadInstanceType(CAST(rhs))), &if_lhsisbigint);
|
||||
|
||||
Goto(&if_lhsisnotbigint);
|
||||
|
||||
BIND(&if_lhsisbigint);
|
||||
{
|
||||
if (Is64()) {
|
||||
Label if_both_bigint(this);
|
||||
|
||||
GotoIf(TaggedIsSmi(lhs), &if_both_bigint);
|
||||
GotoIf(IsHeapNumber(CAST(lhs)), &if_both_bigint);
|
||||
GotoIfLargeBigInt(CAST(lhs), &if_both_bigint);
|
||||
|
||||
GotoIf(TaggedIsSmi(rhs), &if_both_bigint);
|
||||
GotoIf(IsHeapNumber(CAST(rhs)), &if_both_bigint);
|
||||
GotoIfLargeBigInt(CAST(rhs), &if_both_bigint);
|
||||
|
||||
OverwriteFeedback(var_type_feedback,
|
||||
CompareOperationFeedback::kBigInt64);
|
||||
BigInt64Comparison(Operation::kStrictEqual, lhs, rhs, &if_equal,
|
||||
&if_notequal);
|
||||
|
||||
BIND(&if_both_bigint);
|
||||
}
|
||||
|
||||
CombineFeedback(var_type_feedback, CompareOperationFeedback::kBigInt);
|
||||
result = CAST(CallBuiltin(Builtin::kBigIntEqual, NoContextConstant(),
|
||||
lhs, rhs));
|
||||
Goto(&end);
|
||||
}
|
||||
}
|
||||
|
||||
BIND(&if_lhsisnotbigint);
|
||||
// Load the map of {lhs}.
|
||||
TNode<Map> lhs_map = LoadMap(CAST(lhs));
|
||||
|
||||
@ -13792,7 +13835,6 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
|
||||
BIND(&if_rhsisnotsmi);
|
||||
{
|
||||
// Load the instance type of {lhs}.
|
||||
TNode<Uint16T> lhs_instance_type = LoadMapInstanceType(lhs_map);
|
||||
|
||||
// Check if {lhs} is a String.
|
||||
@ -13829,48 +13871,7 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
|
||||
BIND(&if_lhsisnotstring);
|
||||
{
|
||||
// Check if {lhs} is a BigInt.
|
||||
Label if_lhsisbigint(this), if_lhsisnotbigint(this);
|
||||
Branch(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint,
|
||||
&if_lhsisnotbigint);
|
||||
|
||||
BIND(&if_lhsisbigint);
|
||||
{
|
||||
// Load the instance type of {rhs}.
|
||||
TNode<Uint16T> rhs_instance_type = LoadInstanceType(CAST(rhs));
|
||||
|
||||
// Check if {rhs} is also a BigInt.
|
||||
Label if_rhsisbigint(this, Label::kDeferred),
|
||||
if_rhsisnotbigint(this);
|
||||
Branch(IsBigIntInstanceType(rhs_instance_type), &if_rhsisbigint,
|
||||
&if_rhsisnotbigint);
|
||||
|
||||
BIND(&if_rhsisbigint);
|
||||
{
|
||||
if (Is64()) {
|
||||
Label if_both_bigint(this);
|
||||
GotoIfLargeBigInt(CAST(lhs), &if_both_bigint);
|
||||
GotoIfLargeBigInt(CAST(rhs), &if_both_bigint);
|
||||
|
||||
OverwriteFeedback(var_type_feedback,
|
||||
CompareOperationFeedback::kBigInt64);
|
||||
BigInt64Comparison(Operation::kStrictEqual, lhs, rhs,
|
||||
&if_equal, &if_notequal);
|
||||
BIND(&if_both_bigint);
|
||||
}
|
||||
|
||||
CombineFeedback(var_type_feedback,
|
||||
CompareOperationFeedback::kBigInt);
|
||||
result = CAST(CallBuiltin(Builtin::kBigIntEqual,
|
||||
NoContextConstant(), lhs, rhs));
|
||||
Goto(&end);
|
||||
}
|
||||
|
||||
BIND(&if_rhsisnotbigint);
|
||||
Goto(&if_not_equivalent_types);
|
||||
}
|
||||
|
||||
BIND(&if_lhsisnotbigint);
|
||||
if (var_type_feedback != nullptr) {
|
||||
// Load the instance type of {rhs}.
|
||||
TNode<Map> rhs_map = LoadMap(CAST(rhs));
|
||||
@ -13896,7 +13897,8 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
OverwriteFeedback(
|
||||
var_type_feedback,
|
||||
CompareOperationFeedback::kReceiverOrNullOrUndefined);
|
||||
GotoIf(IsOddballInstanceType(rhs_instance_type), &if_notequal);
|
||||
GotoIf(IsOddballInstanceType(rhs_instance_type),
|
||||
&if_notequal);
|
||||
Goto(&if_not_equivalent_types);
|
||||
}
|
||||
|
||||
@ -13908,7 +13910,8 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
|
||||
BIND(&if_lhsisboolean);
|
||||
{
|
||||
OverwriteFeedback(var_type_feedback,
|
||||
OverwriteFeedback(
|
||||
var_type_feedback,
|
||||
CompareOperationFeedback::kNumberOrOddball);
|
||||
GotoIf(IsBooleanMap(rhs_map), &if_notequal);
|
||||
Goto(&if_not_equivalent_types);
|
||||
@ -13960,6 +13963,7 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIND(&if_lhsissmi);
|
||||
{
|
||||
@ -13981,9 +13985,47 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
// Load the map of the {rhs}.
|
||||
TNode<Map> rhs_map = LoadMap(CAST(rhs));
|
||||
|
||||
{
|
||||
// Load the instance type of {rhs}.
|
||||
TNode<Uint16T> rhs_instance_type = LoadInstanceType(CAST(rhs));
|
||||
|
||||
Label if_rhsisbigint(this), if_rhsisnotbigint(this);
|
||||
Branch(IsBigIntInstanceType(rhs_instance_type), &if_rhsisbigint,
|
||||
&if_rhsisnotbigint);
|
||||
|
||||
BIND(&if_rhsisbigint);
|
||||
{
|
||||
if (Is64()) {
|
||||
Label if_both_bigint(this);
|
||||
|
||||
GotoIf(TaggedIsSmi(lhs), &if_both_bigint);
|
||||
GotoIf(IsHeapNumber(CAST(lhs)), &if_both_bigint);
|
||||
GotoIfLargeBigInt(CAST(lhs), &if_both_bigint);
|
||||
|
||||
//GotoIf(TaggedIsSmi(rhs), &if_both_bigint);
|
||||
GotoIfLargeBigInt(CAST(rhs), &if_both_bigint);
|
||||
|
||||
OverwriteFeedback(var_type_feedback,
|
||||
CompareOperationFeedback::kBigInt64);
|
||||
BigInt64Comparison(Operation::kStrictEqual, lhs, rhs, &if_equal,
|
||||
&if_notequal);
|
||||
|
||||
BIND(&if_both_bigint);
|
||||
}
|
||||
|
||||
CombineFeedback(var_type_feedback,
|
||||
CompareOperationFeedback::kBigInt);
|
||||
result = CAST(CallBuiltin(Builtin::kBigIntEqual,
|
||||
NoContextConstant(), lhs, rhs));
|
||||
Goto(&end);
|
||||
}
|
||||
|
||||
BIND(&if_rhsisnotbigint);
|
||||
{
|
||||
// The {rhs} could be a HeapNumber with the same value as {lhs}.
|
||||
Label if_rhsisnumber(this), if_rhsisnotnumber(this);
|
||||
Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber);
|
||||
Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber,
|
||||
&if_rhsisnotnumber);
|
||||
|
||||
BIND(&if_rhsisnumber);
|
||||
{
|
||||
@ -13991,15 +14033,16 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
TNode<Float64T> lhs_value = SmiToFloat64(CAST(lhs));
|
||||
TNode<Float64T> rhs_value = LoadHeapNumberValue(CAST(rhs));
|
||||
|
||||
CombineFeedback(var_type_feedback, CompareOperationFeedback::kNumber);
|
||||
CombineFeedback(var_type_feedback,
|
||||
CompareOperationFeedback::kNumber);
|
||||
|
||||
// Perform a floating point comparison of {lhs} and {rhs}.
|
||||
Branch(Float64Equal(lhs_value, rhs_value), &if_equal, &if_notequal);
|
||||
Branch(Float64Equal(lhs_value, rhs_value), &if_equal,
|
||||
&if_notequal);
|
||||
}
|
||||
|
||||
BIND(&if_rhsisnotnumber);
|
||||
{
|
||||
TNode<Uint16T> rhs_instance_type = LoadMapInstanceType(rhs_map);
|
||||
GotoIfNot(IsOddballInstanceType(rhs_instance_type),
|
||||
&if_not_equivalent_types);
|
||||
OverwriteFeedback(var_type_feedback,
|
||||
@ -14009,6 +14052,8 @@ TNode<Oddball> CodeStubAssembler::StrictEqual(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIND(&if_equal);
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user