Commit 87cc641e authored by epertoso's avatar epertoso Committed by Commit bot

[stubs] Renames WordIsSmi to TaggedIsSmi, introducing an appropriate bitcast of the parameter.

WordIsSmi, by itself, is not that descriptive, as it just ands a word with the heap object tag. With this change, the MachineGraphVerifier can check that the input to TaggedIsSmi actually has a tagged representation.

This CL also introduces a few bitcast operators in the Smi* macros in the CodeStubAssembler.

R=bmeurer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2407303002
Cr-Commit-Position: refs/heads/master@{#40209}
parent a18ff08b
......@@ -1236,7 +1236,7 @@ void Builtins::Generate_ArrayIsArray(CodeStubAssembler* assembler) {
Label call_runtime(assembler), return_true(assembler),
return_false(assembler);
assembler->GotoIf(assembler->WordIsSmi(object), &return_false);
assembler->GotoIf(assembler->TaggedIsSmi(object), &return_false);
Node* instance_type = assembler->LoadInstanceType(object);
assembler->GotoIf(assembler->Word32Equal(
......@@ -1296,7 +1296,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
{
// Handle case where JSArray length is not an Smi in the runtime
Node* len = assembler->LoadObjectField(array, JSArray::kLengthOffset);
assembler->GotoUnless(assembler->WordIsSmi(len), &call_runtime);
assembler->GotoUnless(assembler->TaggedIsSmi(len), &call_runtime);
len_var.Bind(assembler->SmiToWord(len));
assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero),
......@@ -1309,7 +1309,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
init_k_zero(assembler), init_k_n(assembler);
Node* tagged_n = assembler->ToInteger(context, start_from);
assembler->Branch(assembler->WordIsSmi(tagged_n), &init_k_smi,
assembler->Branch(assembler->TaggedIsSmi(tagged_n), &init_k_smi,
&init_k_heap_num);
assembler->Bind(&init_k_smi);
......@@ -1395,7 +1395,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
undef_loop(assembler, &index_var), not_smi(assembler),
not_heap_num(assembler);
assembler->GotoUnless(assembler->WordIsSmi(search_element), &not_smi);
assembler->GotoUnless(assembler->TaggedIsSmi(search_element), &not_smi);
search_num.Bind(assembler->SmiToFloat64(search_element));
assembler->Goto(&heap_num_loop);
......@@ -1464,7 +1464,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0,
CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoUnless(assembler->WordIsSmi(element_k), &not_smi);
assembler->GotoUnless(assembler->TaggedIsSmi(element_k), &not_smi);
assembler->Branch(
assembler->Float64Equal(search_num.value(),
assembler->SmiToFloat64(element_k)),
......@@ -1492,7 +1492,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0,
CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->WordNotEqual(assembler->LoadMap(element_k),
heap_number_map),
&continue_loop);
......@@ -1514,7 +1514,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
&return_false);
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
assembler->GotoUnless(assembler->IsStringInstanceType(
assembler->LoadInstanceType(element_k)),
&continue_loop);
......@@ -1546,7 +1546,7 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
Node* map_k = assembler->LoadMap(element_k);
assembler->BranchIfSimd128Equal(search_element, map, element_k, map_k,
......@@ -1564,7 +1564,8 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
hole_loop(assembler, &index_var), search_notnan(assembler);
Variable search_num(assembler, MachineRepresentation::kFloat64);
assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan);
assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
&search_notnan);
search_num.Bind(assembler->SmiToFloat64(search_element));
assembler->Goto(&not_nan_loop);
......@@ -1618,7 +1619,8 @@ void Builtins::Generate_ArrayIncludes(CodeStubAssembler* assembler) {
hole_loop(assembler, &index_var), search_notnan(assembler);
Variable search_num(assembler, MachineRepresentation::kFloat64);
assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan);
assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
&search_notnan);
search_num.Bind(assembler->SmiToFloat64(search_element));
assembler->Goto(&not_nan_loop);
......@@ -1738,7 +1740,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
{
// Handle case where JSArray length is not an Smi in the runtime
Node* len = assembler->LoadObjectField(array, JSArray::kLengthOffset);
assembler->GotoUnless(assembler->WordIsSmi(len), &call_runtime);
assembler->GotoUnless(assembler->TaggedIsSmi(len), &call_runtime);
len_var.Bind(assembler->SmiToWord(len));
assembler->Branch(assembler->WordEqual(len_var.value(), intptr_zero),
......@@ -1751,7 +1753,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
init_k_zero(assembler), init_k_n(assembler);
Node* tagged_n = assembler->ToInteger(context, start_from);
assembler->Branch(assembler->WordIsSmi(tagged_n), &init_k_smi,
assembler->Branch(assembler->TaggedIsSmi(tagged_n), &init_k_smi,
&init_k_heap_num);
assembler->Bind(&init_k_smi);
......@@ -1837,7 +1839,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
undef_loop(assembler, &index_var), not_smi(assembler),
not_heap_num(assembler);
assembler->GotoUnless(assembler->WordIsSmi(search_element), &not_smi);
assembler->GotoUnless(assembler->TaggedIsSmi(search_element), &not_smi);
search_num.Bind(assembler->SmiToFloat64(search_element));
assembler->Goto(&heap_num_loop);
......@@ -1903,7 +1905,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0,
CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoUnless(assembler->WordIsSmi(element_k), &not_smi);
assembler->GotoUnless(assembler->TaggedIsSmi(element_k), &not_smi);
assembler->Branch(
assembler->Float64Equal(search_num.value(),
assembler->SmiToFloat64(element_k)),
......@@ -1931,7 +1933,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
&return_not_found);
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
assembler->GotoUnless(assembler->IsStringInstanceType(
assembler->LoadInstanceType(element_k)),
&continue_loop);
......@@ -1963,7 +1965,7 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
Node* element_k = assembler->LoadFixedArrayElement(
elements, index_var.value(), 0, CodeStubAssembler::INTPTR_PARAMETERS);
assembler->GotoIf(assembler->WordIsSmi(element_k), &continue_loop);
assembler->GotoIf(assembler->TaggedIsSmi(element_k), &continue_loop);
Node* map_k = assembler->LoadMap(element_k);
assembler->BranchIfSimd128Equal(search_element, map, element_k, map_k,
......@@ -1980,7 +1982,8 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
Label not_nan_loop(assembler, &index_var), search_notnan(assembler);
Variable search_num(assembler, MachineRepresentation::kFloat64);
assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan);
assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
&search_notnan);
search_num.Bind(assembler->SmiToFloat64(search_element));
assembler->Goto(&not_nan_loop);
......@@ -2017,7 +2020,8 @@ void Builtins::Generate_ArrayIndexOf(CodeStubAssembler* assembler) {
Label not_nan_loop(assembler, &index_var), search_notnan(assembler);
Variable search_num(assembler, MachineRepresentation::kFloat64);
assembler->GotoUnless(assembler->WordIsSmi(search_element), &search_notnan);
assembler->GotoUnless(assembler->TaggedIsSmi(search_element),
&search_notnan);
search_num.Bind(assembler->SmiToFloat64(search_element));
assembler->Goto(&not_nan_loop);
......
......@@ -60,7 +60,7 @@ void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler,
// Verify that the {result} is actually a primitive.
Label if_resultisprimitive(assembler),
if_resultisnotprimitive(assembler, Label::kDeferred);
assembler->GotoIf(assembler->WordIsSmi(result), &if_resultisprimitive);
assembler->GotoIf(assembler->TaggedIsSmi(result), &if_resultisprimitive);
Node* result_instance_type = assembler->LoadInstanceType(result);
STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE);
assembler->Branch(assembler->Int32LessThanOrEqual(
......@@ -162,7 +162,7 @@ void Builtins::Generate_ToString(CodeStubAssembler* assembler) {
Label is_number(assembler);
Label runtime(assembler);
assembler->GotoIf(assembler->WordIsSmi(input), &is_number);
assembler->GotoIf(assembler->TaggedIsSmi(input), &is_number);
Node* input_map = assembler->LoadMap(input);
Node* input_instance_type = assembler->LoadMapInstanceType(input_map);
......@@ -252,7 +252,7 @@ void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler,
// Check if the {method} is callable.
Label if_methodiscallable(assembler),
if_methodisnotcallable(assembler, Label::kDeferred);
assembler->GotoIf(assembler->WordIsSmi(method), &if_methodisnotcallable);
assembler->GotoIf(assembler->TaggedIsSmi(method), &if_methodisnotcallable);
Node* method_map = assembler->LoadMap(method);
Node* method_bit_field = assembler->LoadMapBitField(method_map);
assembler->Branch(
......@@ -270,7 +270,7 @@ void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler,
var_result.Bind(result);
// Return the {result} if it is a primitive.
assembler->GotoIf(assembler->WordIsSmi(result), &return_result);
assembler->GotoIf(assembler->TaggedIsSmi(result), &return_result);
Node* result_instance_type = assembler->LoadInstanceType(result);
STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE);
assembler->GotoIf(assembler->Int32LessThanOrEqual(
......@@ -345,7 +345,7 @@ void Builtins::Generate_ToLength(CodeStubAssembler* assembler) {
assembler->GotoIf(assembler->WordIsPositiveSmi(len), &return_len);
// Check if {len} is a (negative) Smi.
assembler->GotoIf(assembler->WordIsSmi(len), &return_zero);
assembler->GotoIf(assembler->TaggedIsSmi(len), &return_zero);
// Check if {len} is a HeapNumber.
Label if_lenisheapnumber(assembler),
......@@ -420,7 +420,7 @@ void Builtins::Generate_ToObject(CodeStubAssembler* assembler) {
Variable constructor_function_index_var(assembler,
MachineType::PointerRepresentation());
assembler->Branch(assembler->WordIsSmi(object), &if_number, &if_notsmi);
assembler->Branch(assembler->TaggedIsSmi(object), &if_number, &if_notsmi);
assembler->Bind(&if_notsmi);
Node* map = assembler->LoadMap(object);
......
......@@ -919,7 +919,7 @@ void Builtins::Generate_DatePrototype_GetField(CodeStubAssembler* assembler,
Label receiver_not_date(assembler, Label::kDeferred);
assembler->GotoIf(assembler->WordIsSmi(receiver), &receiver_not_date);
assembler->GotoIf(assembler->TaggedIsSmi(receiver), &receiver_not_date);
Node* receiver_instance_type = assembler->LoadInstanceType(receiver);
assembler->GotoIf(
assembler->Word32NotEqual(receiver_instance_type,
......
......@@ -26,7 +26,8 @@ void Generate_GeneratorPrototypeResume(
// Check if the {receiver} is actually a JSGeneratorObject.
Label if_receiverisincompatible(assembler, Label::kDeferred);
assembler->GotoIf(assembler->WordIsSmi(receiver), &if_receiverisincompatible);
assembler->GotoIf(assembler->TaggedIsSmi(receiver),
&if_receiverisincompatible);
Node* receiver_instance_type = assembler->LoadInstanceType(receiver);
assembler->GotoUnless(assembler->Word32Equal(
receiver_instance_type,
......
......@@ -121,7 +121,7 @@ void Builtins::Generate_GlobalIsFinite(CodeStubAssembler* assembler) {
Node* num = var_num.value();
// Check if {num} is a Smi or a HeapObject.
assembler->GotoIf(assembler->WordIsSmi(num), &return_true);
assembler->GotoIf(assembler->TaggedIsSmi(num), &return_true);
// Check if {num} is a HeapNumber.
Label if_numisheapnumber(assembler),
......@@ -176,7 +176,7 @@ void Builtins::Generate_GlobalIsNaN(CodeStubAssembler* assembler) {
Node* num = var_num.value();
// Check if {num} is a Smi or a HeapObject.
assembler->GotoIf(assembler->WordIsSmi(num), &return_false);
assembler->GotoIf(assembler->TaggedIsSmi(num), &return_false);
// Check if {num} is a HeapNumber.
Label if_numisheapnumber(assembler),
......
......@@ -133,7 +133,7 @@ void Generate_MathRoundingOperation(
// Check if {x} is a Smi or a HeapObject.
Label if_xissmi(assembler), if_xisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(x), &if_xissmi, &if_xisnotsmi);
assembler->Branch(assembler->TaggedIsSmi(x), &if_xissmi, &if_xisnotsmi);
assembler->Bind(&if_xissmi);
{
......@@ -214,7 +214,7 @@ void Builtins::Generate_MathClz32(CodeStubAssembler* assembler) {
// Check if {x} is a Smi or a HeapObject.
Label if_xissmi(assembler), if_xisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(x), &if_xissmi, &if_xisnotsmi);
assembler->Branch(assembler->TaggedIsSmi(x), &if_xissmi, &if_xisnotsmi);
assembler->Bind(&if_xissmi);
{
......
......@@ -22,7 +22,7 @@ void Builtins::Generate_NumberIsFinite(CodeStubAssembler* assembler) {
Label return_true(assembler), return_false(assembler);
// Check if {number} is a Smi.
assembler->GotoIf(assembler->WordIsSmi(number), &return_true);
assembler->GotoIf(assembler->TaggedIsSmi(number), &return_true);
// Check if {number} is a HeapNumber.
assembler->GotoUnless(
......@@ -53,7 +53,7 @@ void Builtins::Generate_NumberIsInteger(CodeStubAssembler* assembler) {
Label return_true(assembler), return_false(assembler);
// Check if {number} is a Smi.
assembler->GotoIf(assembler->WordIsSmi(number), &return_true);
assembler->GotoIf(assembler->TaggedIsSmi(number), &return_true);
// Check if {number} is a HeapNumber.
assembler->GotoUnless(
......@@ -89,7 +89,7 @@ void Builtins::Generate_NumberIsNaN(CodeStubAssembler* assembler) {
Label return_true(assembler), return_false(assembler);
// Check if {number} is a Smi.
assembler->GotoIf(assembler->WordIsSmi(number), &return_false);
assembler->GotoIf(assembler->TaggedIsSmi(number), &return_false);
// Check if {number} is a HeapNumber.
assembler->GotoUnless(
......@@ -118,7 +118,7 @@ void Builtins::Generate_NumberIsSafeInteger(CodeStubAssembler* assembler) {
Label return_true(assembler), return_false(assembler);
// Check if {number} is a Smi.
assembler->GotoIf(assembler->WordIsSmi(number), &return_true);
assembler->GotoIf(assembler->TaggedIsSmi(number), &return_true);
// Check if {number} is a HeapNumber.
assembler->GotoUnless(
......@@ -170,7 +170,7 @@ void Builtins::Generate_NumberParseFloat(CodeStubAssembler* assembler) {
// Check if the {input} is a HeapObject or a Smi.
Label if_inputissmi(assembler), if_inputisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(input), &if_inputissmi,
assembler->Branch(assembler->TaggedIsSmi(input), &if_inputissmi,
&if_inputisnotsmi);
assembler->Bind(&if_inputissmi);
......@@ -511,13 +511,14 @@ void Builtins::Generate_Add(CodeStubAssembler* assembler) {
// Check if the {lhs} is a Smi or a HeapObject.
Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi,
&if_lhsisnotsmi);
assembler->Bind(&if_lhsissmi);
{
// Check if the {rhs} is also a Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi,
assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
&if_rhsisnotsmi);
assembler->Bind(&if_rhsissmi);
......@@ -630,7 +631,7 @@ void Builtins::Generate_Add(CodeStubAssembler* assembler) {
{
// Check if {rhs} is a Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi,
assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
&if_rhsisnotsmi);
assembler->Bind(&if_rhsissmi);
......@@ -872,13 +873,14 @@ void Builtins::Generate_Subtract(CodeStubAssembler* assembler) {
// Check if the {lhs} is a Smi or a HeapObject.
Label if_lhsissmi(assembler), if_lhsisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(lhs), &if_lhsissmi, &if_lhsisnotsmi);
assembler->Branch(assembler->TaggedIsSmi(lhs), &if_lhsissmi,
&if_lhsisnotsmi);
assembler->Bind(&if_lhsissmi);
{
// Check if the {rhs} is also a Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi,
assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
&if_rhsisnotsmi);
assembler->Bind(&if_rhsissmi);
......@@ -950,7 +952,7 @@ void Builtins::Generate_Subtract(CodeStubAssembler* assembler) {
{
// Check if the {rhs} is a Smi.
Label if_rhsissmi(assembler), if_rhsisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(rhs), &if_rhsissmi,
assembler->Branch(assembler->TaggedIsSmi(rhs), &if_rhsissmi,
&if_rhsisnotsmi);
assembler->Bind(&if_rhsissmi);
......@@ -1045,12 +1047,13 @@ void Builtins::Generate_Multiply(CodeStubAssembler* assembler) {
Node* rhs = var_rhs.value();
Label lhs_is_smi(assembler), lhs_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi,
&lhs_is_not_smi);
assembler->Bind(&lhs_is_smi);
{
Label rhs_is_smi(assembler), rhs_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(rhs), &rhs_is_smi,
assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi,
&rhs_is_not_smi);
assembler->Bind(&rhs_is_smi);
......@@ -1103,7 +1106,7 @@ void Builtins::Generate_Multiply(CodeStubAssembler* assembler) {
{
// Check if {rhs} is a Smi.
Label rhs_is_smi(assembler), rhs_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(rhs), &rhs_is_smi,
assembler->Branch(assembler->TaggedIsSmi(rhs), &rhs_is_smi,
&rhs_is_not_smi);
assembler->Bind(&rhs_is_smi);
......@@ -1198,13 +1201,13 @@ void Builtins::Generate_Divide(CodeStubAssembler* assembler) {
Node* divisor = var_divisor.value();
Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi,
assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
&dividend_is_not_smi);
assembler->Bind(&dividend_is_smi);
{
Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi,
assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
&divisor_is_not_smi);
assembler->Bind(&divisor_is_smi);
......@@ -1321,7 +1324,7 @@ void Builtins::Generate_Divide(CodeStubAssembler* assembler) {
{
// Check if {divisor} is a Smi.
Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi,
assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
&divisor_is_not_smi);
assembler->Bind(&divisor_is_smi);
......@@ -1418,14 +1421,14 @@ void Builtins::Generate_Modulus(CodeStubAssembler* assembler) {
Node* divisor = var_divisor.value();
Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(dividend), &dividend_is_smi,
assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
&dividend_is_not_smi);
assembler->Bind(&dividend_is_smi);
{
Label dividend_is_not_zero(assembler);
Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi,
assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
&divisor_is_not_smi);
assembler->Bind(&divisor_is_smi);
......@@ -1479,7 +1482,7 @@ void Builtins::Generate_Modulus(CodeStubAssembler* assembler) {
{
// Check if {divisor} is a Smi.
Label divisor_is_smi(assembler), divisor_is_not_smi(assembler);
assembler->Branch(assembler->WordIsSmi(divisor), &divisor_is_smi,
assembler->Branch(assembler->TaggedIsSmi(divisor), &divisor_is_smi,
&divisor_is_not_smi);
assembler->Bind(&divisor_is_smi);
......
......@@ -28,7 +28,7 @@ void Builtins::Generate_ObjectHasOwnProperty(CodeStubAssembler* assembler) {
// Smi receivers do not have own properties.
Label if_objectisnotsmi(assembler);
assembler->Branch(assembler->WordIsSmi(object), &return_false,
assembler->Branch(assembler->TaggedIsSmi(object), &return_false,
&if_objectisnotsmi);
assembler->Bind(&if_objectisnotsmi);
......@@ -224,7 +224,7 @@ void IsString(CodeStubAssembler* assembler, compiler::Node* object,
typedef CodeStubAssembler::Label Label;
Label if_notsmi(assembler);
assembler->Branch(assembler->WordIsSmi(object), if_notstring, &if_notsmi);
assembler->Branch(assembler->TaggedIsSmi(object), if_notstring, &if_notsmi);
assembler->Bind(&if_notsmi);
{
......@@ -302,7 +302,7 @@ void Builtins::Generate_ObjectProtoToString(CodeStubAssembler* assembler) {
assembler->GotoIf(assembler->Word32Equal(receiver, assembler->NullConstant()),
&return_null);
assembler->GotoIf(assembler->WordIsSmi(receiver), &return_number);
assembler->GotoIf(assembler->TaggedIsSmi(receiver), &return_number);
Node* receiver_instance_type = assembler->LoadInstanceType(receiver);
ReturnIfPrimitive(assembler, receiver_instance_type, &return_string,
......@@ -427,7 +427,7 @@ void Builtins::Generate_ObjectProtoToString(CodeStubAssembler* assembler) {
assembler->Bind(&return_jsvalue);
{
Node* value = assembler->LoadJSValueValue(receiver);
assembler->GotoIf(assembler->WordIsSmi(value), &return_number);
assembler->GotoIf(assembler->TaggedIsSmi(value), &return_number);
ReturnIfPrimitive(assembler, assembler->LoadInstanceType(value),
&return_string, &return_boolean, &return_number);
......
......@@ -379,7 +379,7 @@ void Builtins::Generate_RegExpPrototypeExec(CodeStubAssembler* a) {
var_lastindex.Bind(lastindex);
Label if_isoob(a, Label::kDeferred);
a->GotoUnless(a->WordIsSmi(lastindex), &if_isoob);
a->GotoUnless(a->TaggedIsSmi(lastindex), &if_isoob);
a->GotoUnless(a->SmiLessThanOrEqual(lastindex, string_length), &if_isoob);
a->Goto(&run_exec);
......@@ -460,7 +460,7 @@ compiler::Node* ThrowIfNotJSReceiver(CodeStubAssembler* a, Isolate* isolate,
Label out(a), throw_exception(a, Label::kDeferred);
Variable var_value_map(a, MachineRepresentation::kTagged);
a->GotoIf(a->WordIsSmi(value), &throw_exception);
a->GotoIf(a->TaggedIsSmi(value), &throw_exception);
// Load the instance type of the {value}.
var_value_map.Bind(a->LoadMap(value));
......@@ -727,7 +727,7 @@ void Generate_FlagGetter(CodeStubAssembler* a, JSRegExp::Flag flag,
Label if_isunmodifiedjsregexp(a),
if_isnotunmodifiedjsregexp(a, Label::kDeferred);
a->GotoIf(a->WordIsSmi(receiver), &if_isnotunmodifiedjsregexp);
a->GotoIf(a->TaggedIsSmi(receiver), &if_isnotunmodifiedjsregexp);
Node* const receiver_map = a->LoadMap(receiver);
Node* const instance_type = a->LoadMapInstanceType(receiver_map);
......
......@@ -37,7 +37,7 @@ void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged,
not_float_or_clamped(a), invalid(a);
// Fail if it is not a heap object.
a->Branch(a->WordIsSmi(tagged), &is_smi, &not_smi);
a->Branch(a->TaggedIsSmi(tagged), &is_smi, &not_smi);
a->Bind(&is_smi);
a->Goto(&invalid);
......@@ -102,7 +102,7 @@ compiler::Node* ConvertTaggedAtomicIndexToWord32(CodeStubAssembler* a,
CodeStubAssembler::Label done(a, &var_result);
CodeStubAssembler::Label if_numberissmi(a), if_numberisnotsmi(a);
a->Branch(a->WordIsSmi(number_index), &if_numberissmi, &if_numberisnotsmi);
a->Branch(a->TaggedIsSmi(number_index), &if_numberissmi, &if_numberisnotsmi);
a->Bind(&if_numberissmi);
{
......
......@@ -713,7 +713,8 @@ void Builtins::Generate_StringPrototypeCharAt(CodeStubAssembler* assembler) {
Label return_emptystring(assembler, Label::kDeferred);
position = assembler->ToInteger(context, position,
CodeStubAssembler::kTruncateMinusZero);
assembler->GotoUnless(assembler->WordIsSmi(position), &return_emptystring);
assembler->GotoUnless(assembler->TaggedIsSmi(position),
&return_emptystring);
// Determine the actual length of the {receiver} String.
Node* receiver_length =
......@@ -758,7 +759,7 @@ void Builtins::Generate_StringPrototypeCharCodeAt(
Label return_nan(assembler, Label::kDeferred);
position = assembler->ToInteger(context, position,
CodeStubAssembler::kTruncateMinusZero);
assembler->GotoUnless(assembler->WordIsSmi(position), &return_nan);
assembler->GotoUnless(assembler->TaggedIsSmi(position), &return_nan);
// Determine the actual length of the {receiver} String.
Node* receiver_length =
......@@ -999,7 +1000,7 @@ void Builtins::Generate_StringPrototypeSubstr(CodeStubAssembler* a) {
a->ToInteger(context, start, CodeStubAssembler::kTruncateMinusZero);
Label if_issmi(a), if_isheapnumber(a, Label::kDeferred);
a->Branch(a->WordIsSmi(start_int), &if_issmi, &if_isheapnumber);
a->Branch(a->TaggedIsSmi(start_int), &if_issmi, &if_isheapnumber);
a->Bind(&if_issmi);
{
......@@ -1043,7 +1044,7 @@ void Builtins::Generate_StringPrototypeSubstr(CodeStubAssembler* a) {
a->ToInteger(context, length, CodeStubAssembler::kTruncateMinusZero));
}
a->Branch(a->WordIsSmi(var_length.value()), &if_issmi, &if_isheapnumber);
a->Branch(a->TaggedIsSmi(var_length.value()), &if_issmi, &if_isheapnumber);
// Set {length} to min(max({length}, 0), {string_length} - {start}
a->Bind(&if_issmi);
......@@ -1109,7 +1110,7 @@ compiler::Node* ToSmiBetweenZeroAnd(CodeStubAssembler* a,
a->ToInteger(context, value, CodeStubAssembler::kTruncateMinusZero);
Label if_issmi(a), if_isnotsmi(a, Label::kDeferred);
a->Branch(a->WordIsSmi(value_int), &if_issmi, &if_isnotsmi);
a->Branch(a->TaggedIsSmi(value_int), &if_issmi, &if_isnotsmi);
a->Bind(&if_issmi);
{
......@@ -1429,7 +1430,7 @@ void Builtins::Generate_StringIteratorPrototypeNext(
Node* iterator = assembler->Parameter(0);
Node* context = assembler->Parameter(3);
assembler->GotoIf(assembler->WordIsSmi(iterator), &throw_bad_receiver);
assembler->GotoIf(assembler->TaggedIsSmi(iterator), &throw_bad_receiver);
assembler->GotoUnless(
assembler->WordEqual(assembler->LoadInstanceType(iterator),
assembler->Int32Constant(JS_STRING_ITERATOR_TYPE)),
......
......@@ -31,7 +31,8 @@ void Generate_TypedArrayProtoypeGetter(CodeStubAssembler* assembler,
// Check if the {receiver} is actually a JSTypedArray.
Label if_receiverisincompatible(assembler, Label::kDeferred);
assembler->GotoIf(assembler->WordIsSmi(receiver), &if_receiverisincompatible);
assembler->GotoIf(assembler->TaggedIsSmi(receiver),
&if_receiverisincompatible);
Node* receiver_instance_type = assembler->LoadInstanceType(receiver);
assembler->GotoUnless(
assembler->Word32Equal(receiver_instance_type,
......
This diff is collapsed.
......@@ -150,7 +150,7 @@ class CodeStubAssembler : public compiler::CodeAssembler {
void Assert(compiler::Node* condition);
// Check a value for smi-ness
compiler::Node* WordIsSmi(compiler::Node* a);
compiler::Node* TaggedIsSmi(compiler::Node* a);
// Check that the value is a non-negative smi.
compiler::Node* WordIsPositiveSmi(compiler::Node* a);
......
This diff is collapsed.
......@@ -585,7 +585,7 @@ Node* InterpreterAssembler::CallJSWithFeedback(Node* function, Node* context,
{
// The compare above could have been a SMI/SMI comparison. Guard against
// this convincing us that we have a monomorphic JSFunction.
Node* is_smi = WordIsSmi(function);
Node* is_smi = TaggedIsSmi(function);
GotoIf(is_smi, &extra_checks);
// Increment the call count.
......@@ -649,7 +649,7 @@ Node* InterpreterAssembler::CallJSWithFeedback(Node* function, Node* context,
HeapConstant(TypeFeedbackVector::UninitializedSentinel(isolate())));
GotoUnless(is_uninitialized, &mark_megamorphic);
Node* is_smi = WordIsSmi(function);
Node* is_smi = TaggedIsSmi(function);
GotoIf(is_smi, &mark_megamorphic);
// Check if function is an object of JSFunction type
......@@ -774,7 +774,7 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context,
GotoIf(is_feedback_unavailable, &call_construct);
// Check that the constructor is not a smi.
Node* is_smi = WordIsSmi(constructor);
Node* is_smi = TaggedIsSmi(constructor);
GotoIf(is_smi, &call_construct);
// Check that constructor is a JSFunction.
......@@ -818,7 +818,7 @@ Node* InterpreterAssembler::CallConstruct(Node* constructor, Node* context,
// If the weak cell is cleared, we have a new chance to become
// monomorphic.
Comment("check if weak cell is cleared");
Node* is_smi = WordIsSmi(feedback_value);
Node* is_smi = TaggedIsSmi(feedback_value);
BranchIf(is_smi, &initialize, &mark_megamorphic);
}
......@@ -1161,7 +1161,7 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
// Check if the {value} is a Smi or a HeapObject.
Label if_valueissmi(this), if_valueisnotsmi(this);
Branch(WordIsSmi(value), &if_valueissmi, &if_valueisnotsmi);
Branch(TaggedIsSmi(value), &if_valueissmi, &if_valueisnotsmi);
Bind(&if_valueissmi);
{
......
......@@ -125,7 +125,7 @@ Node* IntrinsicsHelper::IsInstanceType(Node* input, int type) {
InterpreterAssembler::Label if_not_smi(assembler_), return_true(assembler_),
return_false(assembler_), end(assembler_);
Node* arg = __ LoadRegister(input);
__ GotoIf(__ WordIsSmi(arg), &return_false);
__ GotoIf(__ TaggedIsSmi(arg), &return_false);
Node* condition = CompareInstanceType(arg, type, kInstanceTypeEqual);
__ Branch(condition, &return_true, &return_false);
......@@ -154,7 +154,7 @@ Node* IntrinsicsHelper::IsJSReceiver(Node* input, Node* arg_count,
end(assembler_);
Node* arg = __ LoadRegister(input);
__ GotoIf(__ WordIsSmi(arg), &return_false);
__ GotoIf(__ TaggedIsSmi(arg), &return_false);
STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
Node* condition = CompareInstanceType(arg, FIRST_JS_RECEIVER_TYPE,
......@@ -202,7 +202,7 @@ Node* IntrinsicsHelper::IsSmi(Node* input, Node* arg_count, Node* context) {
Node* arg = __ LoadRegister(input);
__ Branch(__ WordIsSmi(arg), &if_smi, &if_not_smi);
__ Branch(__ TaggedIsSmi(arg), &if_smi, &if_not_smi);
__ Bind(&if_smi);
{
return_value.Bind(__ BooleanConstant(true));
......@@ -321,7 +321,7 @@ Node* IntrinsicsHelper::ValueOf(Node* args_reg, Node* arg_count,
return_value.Bind(object);
// If the object is a smi return the object.
__ GotoIf(__ WordIsSmi(object), &done);
__ GotoIf(__ TaggedIsSmi(object), &done);
// If the object is not a value type, return the object.
Node* condition =
......@@ -346,7 +346,7 @@ Node* IntrinsicsHelper::ClassOf(Node* args_reg, Node* arg_count,
Node* object = __ LoadRegister(args_reg);
// If the object is not a JSReceiver, we return null.
__ GotoIf(__ WordIsSmi(object), &null);
__ GotoIf(__ TaggedIsSmi(object), &null);
STATIC_ASSERT(LAST_JS_RECEIVER_TYPE == LAST_TYPE);
Node* is_js_receiver = CompareInstanceType(object, FIRST_JS_RECEIVER_TYPE,
kInstanceTypeGreaterThanOrEqual);
......
......@@ -960,7 +960,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
Variable var_type_feedback(assembler, MachineRepresentation::kWord32);
Label lhs_is_smi(assembler), lhs_is_not_smi(assembler),
gather_rhs_type(assembler), do_compare(assembler);
__ Branch(__ WordIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
__ Branch(__ TaggedIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
__ Bind(&lhs_is_smi);
var_type_feedback.Bind(
......@@ -986,7 +986,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Bind(&gather_rhs_type);
{
Label rhs_is_smi(assembler);
__ GotoIf(__ WordIsSmi(rhs), &rhs_is_smi);
__ GotoIf(__ TaggedIsSmi(rhs), &rhs_is_smi);
Node* rhs_map = __ LoadMap(rhs);
Node* rhs_type =
......@@ -1131,13 +1131,13 @@ void Interpreter::DoBitwiseBinaryOp(Token::Value bitwise_op,
}
Node* result_type =
__ Select(__ WordIsSmi(result),
__ Select(__ TaggedIsSmi(result),
__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ Int32Constant(BinaryOperationFeedback::kNumber));
if (FLAG_debug_code) {
Label ok(assembler);
__ GotoIf(__ WordIsSmi(result), &ok);
__ GotoIf(__ TaggedIsSmi(result), &ok);
Node* result_map = __ LoadMap(result);
__ AbortIfWordNotEqual(result_map, __ HeapNumberMapConstant(),
kExpectedHeapNumber);
......@@ -1222,7 +1222,7 @@ void Interpreter::DoAddSmi(InterpreterAssembler* assembler) {
// {right} is known to be a Smi.
// Check if the {left} is a Smi take the fast path.
__ BranchIf(__ WordIsSmi(left), &fastpath, &slowpath);
__ BranchIf(__ TaggedIsSmi(left), &fastpath, &slowpath);
__ Bind(&fastpath);
{
// Try fast Smi addition first.
......@@ -1275,7 +1275,7 @@ void Interpreter::DoSubSmi(InterpreterAssembler* assembler) {
// {right} is known to be a Smi.
// Check if the {left} is a Smi take the fast path.
__ BranchIf(__ WordIsSmi(left), &fastpath, &slowpath);
__ BranchIf(__ TaggedIsSmi(left), &fastpath, &slowpath);
__ Bind(&fastpath);
{
// Try fast Smi subtraction first.
......@@ -1329,7 +1329,7 @@ void Interpreter::DoBitwiseOrSmi(InterpreterAssembler* assembler) {
Node* value = __ Word32Or(lhs_value, rhs_value);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type =
__ Select(__ WordIsSmi(result),
__ Select(__ TaggedIsSmi(result),
__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ Int32Constant(BinaryOperationFeedback::kNumber));
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
......@@ -1357,7 +1357,7 @@ void Interpreter::DoBitwiseAndSmi(InterpreterAssembler* assembler) {
Node* value = __ Word32And(lhs_value, rhs_value);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type =
__ Select(__ WordIsSmi(result),
__ Select(__ TaggedIsSmi(result),
__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ Int32Constant(BinaryOperationFeedback::kNumber));
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
......@@ -1387,7 +1387,7 @@ void Interpreter::DoShiftLeftSmi(InterpreterAssembler* assembler) {
Node* value = __ Word32Shl(lhs_value, shift_count);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type =
__ Select(__ WordIsSmi(result),
__ Select(__ TaggedIsSmi(result),
__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ Int32Constant(BinaryOperationFeedback::kNumber));
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
......@@ -1417,7 +1417,7 @@ void Interpreter::DoShiftRightSmi(InterpreterAssembler* assembler) {
Node* value = __ Word32Sar(lhs_value, shift_count);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type =
__ Select(__ WordIsSmi(result),
__ Select(__ TaggedIsSmi(result),
__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ Int32Constant(BinaryOperationFeedback::kNumber));
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_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