Commit fce55b52 authored by ishell's avatar ishell Committed by Commit bot

[stubs] Use CSA::IsHeapNumberMap() instead of manual map comparing.

Bonus: fixed a couple of places where 32-bit comparison was used.

BUG=

Review-Url: https://codereview.chromium.org/2543873003
Cr-Commit-Position: refs/heads/master@{#41417}
parent 71cc94da
......@@ -1423,7 +1423,6 @@ void Builtins::Generate_ArrayIncludes(compiler::CodeAssemblerState* state) {
Node* the_hole = assembler.TheHoleConstant();
Node* undefined = assembler.UndefinedConstant();
Node* heap_number_map = assembler.HeapNumberMapConstant();
Variable len_var(&assembler, MachineType::PointerRepresentation()),
index_var(&assembler, MachineType::PointerRepresentation()),
......@@ -1554,8 +1553,7 @@ void Builtins::Generate_ArrayIncludes(compiler::CodeAssemblerState* state) {
assembler.GotoIf(assembler.WordEqual(search_element, undefined),
&undef_loop);
Node* map = assembler.LoadMap(search_element);
assembler.GotoIf(assembler.WordNotEqual(map, heap_number_map),
&not_heap_num);
assembler.GotoUnless(assembler.IsHeapNumberMap(map), &not_heap_num);
search_num.Bind(assembler.LoadHeapNumberValue(search_element));
assembler.Goto(&heap_num_loop);
......@@ -1619,9 +1617,9 @@ void Builtins::Generate_ArrayIncludes(compiler::CodeAssemblerState* state) {
&return_true, &continue_loop);
assembler.Bind(&not_smi);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(element_k),
heap_number_map),
&continue_loop);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(element_k)),
&continue_loop);
assembler.Branch(
assembler.Float64Equal(search_num.value(),
assembler.LoadHeapNumberValue(element_k)),
......@@ -1642,9 +1640,9 @@ void Builtins::Generate_ArrayIncludes(compiler::CodeAssemblerState* state) {
elements, index_var.value(), 0,
CodeStubAssembler::INTPTR_PARAMETERS);
assembler.GotoIf(assembler.TaggedIsSmi(element_k), &continue_loop);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(element_k),
heap_number_map),
&continue_loop);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(element_k)),
&continue_loop);
assembler.BranchIfFloat64IsNaN(assembler.LoadHeapNumberValue(element_k),
&return_true, &continue_loop);
......@@ -1718,9 +1716,9 @@ void Builtins::Generate_ArrayIncludes(compiler::CodeAssemblerState* state) {
assembler.Goto(&not_nan_loop);
assembler.Bind(&search_notnan);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(search_element),
heap_number_map),
&return_false);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(search_element)),
&return_false);
search_num.Bind(assembler.LoadHeapNumberValue(search_element));
......@@ -1775,9 +1773,9 @@ void Builtins::Generate_ArrayIncludes(compiler::CodeAssemblerState* state) {
assembler.Bind(&search_notnan);
assembler.GotoIf(assembler.WordEqual(search_element, undefined),
&hole_loop);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(search_element),
heap_number_map),
&return_false);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(search_element)),
&return_false);
search_num.Bind(assembler.LoadHeapNumberValue(search_element));
......@@ -1866,7 +1864,6 @@ void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
Node* intptr_one = assembler.IntPtrConstant(1);
Node* undefined = assembler.UndefinedConstant();
Node* heap_number_map = assembler.HeapNumberMapConstant();
Variable len_var(&assembler, MachineType::PointerRepresentation()),
index_var(&assembler, MachineType::PointerRepresentation()),
......@@ -1997,8 +1994,7 @@ void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
assembler.GotoIf(assembler.WordEqual(search_element, undefined),
&undef_loop);
Node* map = assembler.LoadMap(search_element);
assembler.GotoIf(assembler.WordNotEqual(map, heap_number_map),
&not_heap_num);
assembler.GotoUnless(assembler.IsHeapNumberMap(map), &not_heap_num);
search_num.Bind(assembler.LoadHeapNumberValue(search_element));
assembler.Goto(&heap_num_loop);
......@@ -2061,9 +2057,9 @@ void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
&return_found, &continue_loop);
assembler.Bind(&not_smi);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(element_k),
heap_number_map),
&continue_loop);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(element_k)),
&continue_loop);
assembler.Branch(
assembler.Float64Equal(search_num.value(),
assembler.LoadHeapNumberValue(element_k)),
......@@ -2137,9 +2133,9 @@ void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
assembler.Goto(&not_nan_loop);
assembler.Bind(&search_notnan);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(search_element),
heap_number_map),
&return_not_found);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(search_element)),
&return_not_found);
search_num.Bind(assembler.LoadHeapNumberValue(search_element));
......@@ -2174,9 +2170,9 @@ void Builtins::Generate_ArrayIndexOf(compiler::CodeAssemblerState* state) {
assembler.Goto(&not_nan_loop);
assembler.Bind(&search_notnan);
assembler.GotoIf(assembler.WordNotEqual(assembler.LoadMap(search_element),
heap_number_map),
&return_not_found);
assembler.GotoUnless(
assembler.IsHeapNumberMap(assembler.LoadMap(search_element)),
&return_not_found);
search_num.Bind(assembler.LoadHeapNumberValue(search_element));
......
......@@ -184,9 +184,8 @@ void Builtins::Generate_ToString(compiler::CodeAssemblerState* state) {
assembler.Bind(&not_string);
{
assembler.GotoUnless(
assembler.WordEqual(input_map, assembler.HeapNumberMapConstant()),
&not_heap_number);
assembler.GotoUnless(assembler.IsHeapNumberMap(input_map),
&not_heap_number);
assembler.Goto(&is_number);
}
......
......@@ -127,8 +127,7 @@ void Builtins::Generate_GlobalIsFinite(compiler::CodeAssemblerState* state) {
// Check if {num} is a HeapNumber.
Label if_numisheapnumber(&assembler),
if_numisnotheapnumber(&assembler, Label::kDeferred);
assembler.Branch(assembler.WordEqual(assembler.LoadMap(num),
assembler.HeapNumberMapConstant()),
assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(num)),
&if_numisheapnumber, &if_numisnotheapnumber);
assembler.Bind(&if_numisheapnumber);
......@@ -182,8 +181,7 @@ void Builtins::Generate_GlobalIsNaN(compiler::CodeAssemblerState* state) {
// Check if {num} is a HeapNumber.
Label if_numisheapnumber(&assembler),
if_numisnotheapnumber(&assembler, Label::kDeferred);
assembler.Branch(assembler.WordEqual(assembler.LoadMap(num),
assembler.HeapNumberMapConstant()),
assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(num)),
&if_numisheapnumber, &if_numisnotheapnumber);
assembler.Bind(&if_numisheapnumber);
......
......@@ -81,8 +81,7 @@ void Builtins::Generate_MathAbs(compiler::CodeAssemblerState* state) {
// Check if {x} is a HeapNumber.
Label if_xisheapnumber(&assembler),
if_xisnotheapnumber(&assembler, Label::kDeferred);
assembler.Branch(assembler.WordEqual(assembler.LoadMap(x),
assembler.HeapNumberMapConstant()),
assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(x)),
&if_xisheapnumber, &if_xisnotheapnumber);
assembler.Bind(&if_xisheapnumber);
......@@ -140,10 +139,8 @@ void Generate_MathRoundingOperation(
// Check if {x} is a HeapNumber.
Label if_xisheapnumber(assembler),
if_xisnotheapnumber(assembler, Label::kDeferred);
assembler->Branch(
assembler->WordEqual(assembler->LoadMap(x),
assembler->HeapNumberMapConstant()),
&if_xisheapnumber, &if_xisnotheapnumber);
assembler->Branch(assembler->IsHeapNumberMap(assembler->LoadMap(x)),
&if_xisheapnumber, &if_xisnotheapnumber);
assembler->Bind(&if_xisheapnumber);
{
......@@ -281,8 +278,7 @@ void Builtins::Generate_MathClz32(compiler::CodeAssemblerState* state) {
// Check if {x} is a HeapNumber.
Label if_xisheapnumber(&assembler),
if_xisnotheapnumber(&assembler, Label::kDeferred);
assembler.Branch(assembler.WordEqual(assembler.LoadMap(x),
assembler.HeapNumberMapConstant()),
assembler.Branch(assembler.IsHeapNumberMap(assembler.LoadMap(x)),
&if_xisheapnumber, &if_xisnotheapnumber);
assembler.Bind(&if_xisheapnumber);
......
......@@ -989,9 +989,7 @@ TF_BUILTIN(Subtract, CodeStubAssembler) {
// Check if the {lhs} is a HeapNumber.
Label if_lhsisnumber(this), if_lhsisnotnumber(this, Label::kDeferred);
Node* number_map = HeapNumberMapConstant();
Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber,
&if_lhsisnotnumber);
Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber);
Bind(&if_lhsisnumber);
{
......@@ -1014,8 +1012,7 @@ TF_BUILTIN(Subtract, CodeStubAssembler) {
// Check if the {rhs} is a HeapNumber.
Label if_rhsisnumber(this), if_rhsisnotnumber(this, Label::kDeferred);
Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber,
&if_rhsisnotnumber);
Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber);
Bind(&if_rhsisnumber);
{
......@@ -1067,8 +1064,6 @@ TF_BUILTIN(Multiply, CodeStubAssembler) {
Variable var_lhs_float64(this, MachineRepresentation::kFloat64),
var_rhs_float64(this, MachineRepresentation::kFloat64);
Node* number_map = HeapNumberMapConstant();
// We might need to loop one or two times due to ToNumber conversions.
Variable var_lhs(this, MachineRepresentation::kTagged),
var_rhs(this, MachineRepresentation::kTagged),
......@@ -1105,8 +1100,7 @@ TF_BUILTIN(Multiply, CodeStubAssembler) {
// Check if {rhs} is a HeapNumber.
Label rhs_is_number(this), rhs_is_not_number(this, Label::kDeferred);
Branch(WordEqual(rhs_map, number_map), &rhs_is_number,
&rhs_is_not_number);
Branch(IsHeapNumberMap(rhs_map), &rhs_is_number, &rhs_is_not_number);
Bind(&rhs_is_number);
{
......@@ -1132,8 +1126,7 @@ TF_BUILTIN(Multiply, CodeStubAssembler) {
// Check if {lhs} is a HeapNumber.
Label lhs_is_number(this), lhs_is_not_number(this, Label::kDeferred);
Branch(WordEqual(lhs_map, number_map), &lhs_is_number,
&lhs_is_not_number);
Branch(IsHeapNumberMap(lhs_map), &lhs_is_number, &lhs_is_not_number);
Bind(&lhs_is_number);
{
......@@ -1155,8 +1148,7 @@ TF_BUILTIN(Multiply, CodeStubAssembler) {
// Check if {rhs} is a HeapNumber.
Label rhs_is_number(this), rhs_is_not_number(this, Label::kDeferred);
Branch(WordEqual(rhs_map, number_map), &rhs_is_number,
&rhs_is_not_number);
Branch(IsHeapNumberMap(rhs_map), &rhs_is_number, &rhs_is_not_number);
Bind(&rhs_is_number);
{
......@@ -1209,8 +1201,6 @@ TF_BUILTIN(Divide, CodeStubAssembler) {
Variable var_dividend_float64(this, MachineRepresentation::kFloat64),
var_divisor_float64(this, MachineRepresentation::kFloat64);
Node* number_map = HeapNumberMapConstant();
// We might need to loop one or two times due to ToNumber conversions.
Variable var_dividend(this, MachineRepresentation::kTagged),
var_divisor(this, MachineRepresentation::kTagged),
......@@ -1299,7 +1289,7 @@ TF_BUILTIN(Divide, CodeStubAssembler) {
// Check if {divisor} is a HeapNumber.
Label divisor_is_number(this),
divisor_is_not_number(this, Label::kDeferred);
Branch(WordEqual(divisor_map, number_map), &divisor_is_number,
Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
&divisor_is_not_number);
Bind(&divisor_is_number);
......@@ -1328,7 +1318,7 @@ TF_BUILTIN(Divide, CodeStubAssembler) {
// Check if {dividend} is a HeapNumber.
Label dividend_is_number(this),
dividend_is_not_number(this, Label::kDeferred);
Branch(WordEqual(dividend_map, number_map), &dividend_is_number,
Branch(IsHeapNumberMap(dividend_map), &dividend_is_number,
&dividend_is_not_number);
Bind(&dividend_is_number);
......@@ -1353,7 +1343,7 @@ TF_BUILTIN(Divide, CodeStubAssembler) {
// Check if {divisor} is a HeapNumber.
Label divisor_is_number(this),
divisor_is_not_number(this, Label::kDeferred);
Branch(WordEqual(divisor_map, number_map), &divisor_is_number,
Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
&divisor_is_not_number);
Bind(&divisor_is_number);
......@@ -1409,8 +1399,6 @@ TF_BUILTIN(Modulus, CodeStubAssembler) {
Variable var_dividend_float64(this, MachineRepresentation::kFloat64),
var_divisor_float64(this, MachineRepresentation::kFloat64);
Node* number_map = HeapNumberMapConstant();
// We might need to loop one or two times due to ToNumber conversions.
Variable var_dividend(this, MachineRepresentation::kTagged),
var_divisor(this, MachineRepresentation::kTagged);
......@@ -1447,7 +1435,7 @@ TF_BUILTIN(Modulus, CodeStubAssembler) {
// Check if {divisor} is a HeapNumber.
Label divisor_is_number(this),
divisor_is_not_number(this, Label::kDeferred);
Branch(WordEqual(divisor_map, number_map), &divisor_is_number,
Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
&divisor_is_not_number);
Bind(&divisor_is_number);
......@@ -1476,7 +1464,7 @@ TF_BUILTIN(Modulus, CodeStubAssembler) {
// Check if {dividend} is a HeapNumber.
Label dividend_is_number(this),
dividend_is_not_number(this, Label::kDeferred);
Branch(WordEqual(dividend_map, number_map), &dividend_is_number,
Branch(IsHeapNumberMap(dividend_map), &dividend_is_number,
&dividend_is_not_number);
Bind(&dividend_is_number);
......@@ -1501,7 +1489,7 @@ TF_BUILTIN(Modulus, CodeStubAssembler) {
// Check if {divisor} is a HeapNumber.
Label divisor_is_number(this),
divisor_is_not_number(this, Label::kDeferred);
Branch(WordEqual(divisor_map, number_map), &divisor_is_number,
Branch(IsHeapNumberMap(divisor_map), &divisor_is_number,
&divisor_is_not_number);
Bind(&divisor_is_number);
......
......@@ -1031,8 +1031,7 @@ void Builtins::Generate_StringPrototypeSubstr(
// two cases according to the spec: if it is negative, "" is returned; if
// it is positive, then length is set to {string_length} - {start}.
CSA_ASSERT(&a, a.WordEqual(a.LoadMap(var_length.value()),
a.HeapNumberMapConstant()));
CSA_ASSERT(&a, a.IsHeapNumberMap(a.LoadMap(var_length.value())));
Label if_isnegative(&a), if_ispositive(&a);
Node* const float_zero = a.Float64Constant(0.);
......@@ -1101,8 +1100,7 @@ compiler::Node* ToSmiBetweenZeroAnd(CodeStubAssembler* a,
a->Bind(&if_isnotsmi);
{
// {value} is a heap number - in this case, it is definitely out of bounds.
CSA_ASSERT(a,
a->WordEqual(a->LoadMap(value_int), a->HeapNumberMapConstant()));
CSA_ASSERT(a, a->IsHeapNumberMap(a->LoadMap(value_int)));
Node* const float_zero = a->Float64Constant(0.);
Node* const smi_zero = a->SmiConstant(Smi::kZero);
......
......@@ -2463,8 +2463,8 @@ Node* CodeStubAssembler::TruncateTaggedToWord32(Node* context, Node* value) {
// Check if {value} is a HeapNumber.
Label if_valueisheapnumber(this),
if_valueisnotheapnumber(this, Label::kDeferred);
Branch(WordEqual(LoadMap(value), HeapNumberMapConstant()),
&if_valueisheapnumber, &if_valueisnotheapnumber);
Branch(IsHeapNumberMap(LoadMap(value)), &if_valueisheapnumber,
&if_valueisnotheapnumber);
Bind(&if_valueisheapnumber);
{
......@@ -3668,7 +3668,7 @@ Node* CodeStubAssembler::NumberToString(Node* context, Node* argument) {
// Argument isn't smi, check to see if it's a heap-number.
Node* map = LoadMap(argument);
GotoUnless(WordEqual(map, HeapNumberMapConstant()), &runtime);
GotoUnless(IsHeapNumberMap(map), &runtime);
// Make a hash from the two 32-bit values of the double.
Node* low =
......@@ -3685,7 +3685,7 @@ Node* CodeStubAssembler::NumberToString(Node* context, Node* argument) {
LoadFixedArrayElement(number_string_cache, index, 0, INTPTR_PARAMETERS);
GotoIf(TaggedIsSmi(number_key), &runtime);
map = LoadMap(number_key);
GotoUnless(WordEqual(map, HeapNumberMapConstant()), &runtime);
GotoUnless(IsHeapNumberMap(map), &runtime);
// Cache entry's key must match the heap number value we're looking for.
Node* low_compare = LoadObjectField(number_key, HeapNumber::kValueOffset,
......@@ -3776,7 +3776,7 @@ Node* CodeStubAssembler::ToName(Node* context, Node* value) {
Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) {
// Assert input is a HeapObject (not smi or heap number)
CSA_ASSERT(this, Word32BinaryNot(TaggedIsSmi(input)));
CSA_ASSERT(this, Word32NotEqual(LoadMap(input), HeapNumberMapConstant()));
CSA_ASSERT(this, Word32BinaryNot(IsHeapNumberMap(LoadMap(input))));
// We might need to loop once here due to ToPrimitive conversions.
Variable var_input(this, MachineRepresentation::kTagged);
......@@ -3827,7 +3827,7 @@ Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) {
Label if_resultisnumber(this), if_resultisnotnumber(this);
GotoIf(TaggedIsSmi(result), &if_resultisnumber);
Node* result_map = LoadMap(result);
Branch(WordEqual(result_map, HeapNumberMapConstant()), &if_resultisnumber,
Branch(IsHeapNumberMap(result_map), &if_resultisnumber,
&if_resultisnotnumber);
Bind(&if_resultisnumber);
......@@ -3875,8 +3875,7 @@ Node* CodeStubAssembler::ToNumber(Node* context, Node* input) {
{
Label not_heap_number(this, Label::kDeferred);
Node* input_map = LoadMap(input);
GotoIf(Word32NotEqual(input_map, HeapNumberMapConstant()),
&not_heap_number);
GotoUnless(IsHeapNumberMap(input_map), &not_heap_number);
var_result.Bind(input);
Goto(&end);
......@@ -4009,8 +4008,7 @@ Node* CodeStubAssembler::ToString(Node* context, Node* input) {
GotoIf(IsStringInstanceType(input_instance_type), &done);
Label not_heap_number(this);
Branch(WordNotEqual(input_map, HeapNumberMapConstant()), &not_heap_number,
&is_number);
Branch(IsHeapNumberMap(input_map), &is_number, &not_heap_number);
Bind(&is_number);
result.Bind(NumberToString(context, input));
......@@ -4119,8 +4117,8 @@ Node* CodeStubAssembler::ToInteger(Node* context, Node* input,
// Check if {arg} is a HeapNumber.
Label if_argisheapnumber(this),
if_argisnotheapnumber(this, Label::kDeferred);
Branch(WordEqual(LoadMap(arg), HeapNumberMapConstant()),
&if_argisheapnumber, &if_argisnotheapnumber);
Branch(IsHeapNumberMap(LoadMap(arg)), &if_argisheapnumber,
&if_argisnotheapnumber);
Bind(&if_argisheapnumber);
{
......@@ -5411,7 +5409,7 @@ Node* CodeStubAssembler::TryToIntptr(Node* key, Label* miss) {
Label done(this, &var_intptr_key), key_is_smi(this);
GotoIf(TaggedIsSmi(key), &key_is_smi);
// Try to convert a heap number to a Smi.
GotoUnless(WordEqual(LoadMap(key), HeapNumberMapConstant()), miss);
GotoUnless(IsHeapNumberMap(LoadMap(key)), miss);
{
Node* value = LoadHeapNumberValue(key);
Node* int_value = RoundFloat64ToInt32(value);
......@@ -6325,7 +6323,7 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
Bind(&if_rhsisnotsmi);
{
CSA_ASSERT(this, WordEqual(LoadMap(rhs), HeapNumberMapConstant()));
CSA_ASSERT(this, IsHeapNumberMap(LoadMap(rhs)));
// Convert the {lhs} and {rhs} to floating point values, and
// perform a floating point comparison.
var_fcmp_lhs.Bind(SmiToFloat64(lhs));
......@@ -6336,7 +6334,7 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
Bind(&if_lhsisnotsmi);
{
CSA_ASSERT(this, WordEqual(LoadMap(lhs), HeapNumberMapConstant()));
CSA_ASSERT(this, IsHeapNumberMap(LoadMap(lhs)));
// Check if {rhs} is a Smi or a HeapObject.
Label if_rhsissmi(this), if_rhsisnotsmi(this);
......@@ -6353,7 +6351,7 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
Bind(&if_rhsisnotsmi);
{
CSA_ASSERT(this, WordEqual(LoadMap(rhs), HeapNumberMapConstant()));
CSA_ASSERT(this, IsHeapNumberMap(LoadMap(rhs)));
// Convert the {lhs} and {rhs} to floating point values, and
// perform a floating point comparison.
......@@ -6482,9 +6480,6 @@ Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode,
Bind(&if_lhsisnotsmi);
{
// Load the HeapNumber map for later comparisons.
Node* number_map = HeapNumberMapConstant();
// Load the map of {lhs}.
Node* lhs_map = LoadMap(lhs);
......@@ -6496,8 +6491,7 @@ Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode,
{
// Check if the {lhs} is a HeapNumber.
Label if_lhsisnumber(this), if_lhsisnotnumber(this, Label::kDeferred);
Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber,
&if_lhsisnotnumber);
Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber);
Bind(&if_lhsisnumber);
{
......@@ -6527,8 +6521,7 @@ Node* CodeStubAssembler::RelationalComparison(RelationalComparisonMode mode,
// Check if {lhs} is a HeapNumber.
Label if_lhsisnumber(this), if_lhsisnotnumber(this);
Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber,
&if_lhsisnotnumber);
Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber);
Bind(&if_lhsisnumber);
{
......@@ -6836,10 +6829,8 @@ Node* CodeStubAssembler::Equal(ResultMode mode, Node* lhs, Node* rhs,
Node* rhs_map = LoadMap(rhs);
// Check if {rhs} is a HeapNumber.
Node* number_map = HeapNumberMapConstant();
Label if_rhsisnumber(this), if_rhsisnotnumber(this);
Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber,
&if_rhsisnotnumber);
Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber);
Bind(&if_rhsisnumber);
{
......@@ -7338,7 +7329,6 @@ Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
{
// The {lhs} and {rhs} reference different objects, yet for Smi, HeapNumber,
// String and Simd128Value they can still be considered equal.
Node* number_map = HeapNumberMapConstant();
// Check if {lhs} is a Smi or a HeapObject.
Label if_lhsissmi(this), if_lhsisnotsmi(this);
......@@ -7351,8 +7341,7 @@ Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
// Check if {lhs} is a HeapNumber.
Label if_lhsisnumber(this), if_lhsisnotnumber(this);
Branch(WordEqual(lhs_map, number_map), &if_lhsisnumber,
&if_lhsisnotnumber);
Branch(IsHeapNumberMap(lhs_map), &if_lhsisnumber, &if_lhsisnotnumber);
Bind(&if_lhsisnumber);
{
......@@ -7377,8 +7366,7 @@ Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
// Check if {rhs} is also a HeapNumber.
Label if_rhsisnumber(this), if_rhsisnotnumber(this);
Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber,
&if_rhsisnotnumber);
Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber);
Bind(&if_rhsisnumber);
{
......@@ -7483,8 +7471,7 @@ Node* CodeStubAssembler::StrictEqual(ResultMode mode, Node* lhs, Node* rhs,
// The {rhs} could be a HeapNumber with the same value as {lhs}.
Label if_rhsisnumber(this), if_rhsisnotnumber(this);
Branch(WordEqual(rhs_map, number_map), &if_rhsisnumber,
&if_rhsisnotnumber);
Branch(IsHeapNumberMap(rhs_map), &if_rhsisnumber, &if_rhsisnotnumber);
Bind(&if_rhsisnumber);
{
......
......@@ -1047,8 +1047,6 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
var_result(assembler, MachineRepresentation::kTagged),
var_type_feedback(assembler, MachineRepresentation::kWord32);
Node* number_map = assembler->HeapNumberMapConstant();
Label lhs_is_smi(assembler), lhs_is_not_smi(assembler);
assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
......@@ -1076,7 +1074,7 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
Node* rhs_map = assembler->LoadMap(rhs);
// Check if {rhs} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(rhs_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
&check_rhsisoddball);
// Convert {lhs} to a double and multiply it with the value of {rhs}.
......@@ -1091,7 +1089,7 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
Node* lhs_map = assembler->LoadMap(lhs);
// Check if {lhs} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(lhs_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(lhs_map),
&if_lhsisnotnumber);
// Check if {rhs} is a Smi.
......@@ -1112,7 +1110,7 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
Node* rhs_map = assembler->LoadMap(rhs);
// Check if {rhs} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(rhs_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map),
&check_rhsisoddball);
// Both {lhs} and {rhs} are HeapNumbers. Load their values and
......@@ -1211,8 +1209,6 @@ compiler::Node* DivideWithFeedbackStub::Generate(
var_result(assembler, MachineRepresentation::kTagged),
var_type_feedback(assembler, MachineRepresentation::kWord32);
Node* number_map = assembler->HeapNumberMapConstant();
Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
&dividend_is_not_smi);
......@@ -1297,7 +1293,7 @@ compiler::Node* DivideWithFeedbackStub::Generate(
Node* divisor_map = assembler->LoadMap(divisor);
// Check if {divisor} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(divisor_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(divisor_map),
&check_divisor_for_oddball);
// Convert {dividend} to a double and divide it with the value of
......@@ -1312,7 +1308,7 @@ compiler::Node* DivideWithFeedbackStub::Generate(
Node* dividend_map = assembler->LoadMap(dividend);
// Check if {dividend} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(dividend_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(dividend_map),
&dividend_is_not_number);
// Check if {divisor} is a Smi.
......@@ -1334,7 +1330,7 @@ compiler::Node* DivideWithFeedbackStub::Generate(
Node* divisor_map = assembler->LoadMap(divisor);
// Check if {divisor} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(divisor_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(divisor_map),
&check_divisor_for_oddball);
// Both {dividend} and {divisor} are HeapNumbers. Load their values
......@@ -1433,8 +1429,6 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
var_result(assembler, MachineRepresentation::kTagged),
var_type_feedback(assembler, MachineRepresentation::kWord32);
Node* number_map = assembler->HeapNumberMapConstant();
Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
&dividend_is_not_smi);
......@@ -1460,7 +1454,7 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
Node* divisor_map = assembler->LoadMap(divisor);
// Check if {divisor} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(divisor_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(divisor_map),
&check_divisor_for_oddball);
// Convert {dividend} to a double and divide it with the value of
......@@ -1476,7 +1470,7 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
Node* dividend_map = assembler->LoadMap(dividend);
// Check if {dividend} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(dividend_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(dividend_map),
&dividend_is_not_number);
// Check if {divisor} is a Smi.
......@@ -1498,7 +1492,7 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
Node* divisor_map = assembler->LoadMap(divisor);
// Check if {divisor} is a HeapNumber.
assembler->GotoUnless(assembler->WordEqual(divisor_map, number_map),
assembler->GotoUnless(assembler->IsHeapNumberMap(divisor_map),
&check_divisor_for_oddball);
// Both {dividend} and {divisor} are HeapNumbers. Load their values
......
......@@ -1112,8 +1112,8 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
Label if_valueisheapnumber(this),
if_valueisnotheapnumber(this, Label::kDeferred);
Node* value_map = LoadMap(value);
Branch(WordEqual(value_map, HeapNumberMapConstant()),
&if_valueisheapnumber, &if_valueisnotheapnumber);
Branch(IsHeapNumberMap(value_map), &if_valueisheapnumber,
&if_valueisnotheapnumber);
Bind(&if_valueisheapnumber);
{
......
......@@ -1036,8 +1036,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Bind(&lhs_is_not_smi);
{
Node* lhs_map = __ LoadMap(lhs);
__ GotoUnless(__ WordEqual(lhs_map, __ HeapNumberMapConstant()),
&lhs_is_not_number);
__ GotoUnless(__ IsHeapNumberMap(lhs_map), &lhs_is_not_number);
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kNumber));
......@@ -1081,8 +1080,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Bind(&rhs_is_not_smi);
{
Node* rhs_map = __ LoadMap(rhs);
__ GotoUnless(__ WordEqual(rhs_map, __ HeapNumberMapConstant()),
&rhs_is_not_number);
__ GotoUnless(__ IsHeapNumberMap(rhs_map), &rhs_is_not_number);
var_type_feedback.Bind(
__ Word32Or(var_type_feedback.value(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment