[ignition] Use Smis directly for type feedback

Since type feedback is stored as Smis, we can avoid a few shift
instructions per bytecode handler by performing type feedback updates
on Smis directly, rather than converting between Smi and Word32.

Review-Url: https://codereview.chromium.org/2624753002
Cr-Commit-Position: refs/heads/master@{#42236}
This commit is contained in:
leszeks 2017-01-11 07:28:14 -08:00 committed by Commit bot
parent ec45e6ed2e
commit 1f55c1b5ae
5 changed files with 123 additions and 105 deletions

View File

@ -131,6 +131,13 @@ Node* CodeStubAssembler::SelectTaggedConstant(Node* condition, Node* true_value,
MachineRepresentation::kTagged);
}
Node* CodeStubAssembler::SelectSmiConstant(Node* condition, Smi* true_value,
Smi* false_value) {
return SelectConstant(condition, SmiConstant(true_value),
SmiConstant(false_value),
MachineRepresentation::kTaggedSigned);
}
Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); }
#define HEAP_CONSTANT_ACCESSOR(rootName, name) \
@ -5489,11 +5496,9 @@ void CodeStubAssembler::UpdateFeedback(Node* feedback,
// This method is used for binary op and compare feedback. These
// vector nodes are initialized with a smi 0, so we can simply OR
// our new feedback in place.
// TODO(interpreter): Consider passing the feedback as Smi already to avoid
// the tagging completely.
Node* previous_feedback =
LoadFixedArrayElement(type_feedback_vector, slot_id);
Node* combined_feedback = SmiOr(previous_feedback, SmiFromWord32(feedback));
Node* combined_feedback = SmiOr(previous_feedback, feedback);
StoreFixedArrayElement(type_feedback_vector, slot_id, combined_feedback,
SKIP_WRITE_BARRIER);
}

View File

@ -250,6 +250,17 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* SelectBooleanConstant(Node* condition);
Node* SelectTaggedConstant(Node* condition, Node* true_value,
Node* false_value);
Node* SelectSmiConstant(Node* condition, Smi* true_value, Smi* false_value);
Node* SelectSmiConstant(Node* condition, int true_value, Smi* false_value) {
return SelectSmiConstant(condition, Smi::FromInt(true_value), false_value);
}
Node* SelectSmiConstant(Node* condition, Smi* true_value, int false_value) {
return SelectSmiConstant(condition, true_value, Smi::FromInt(false_value));
}
Node* SelectSmiConstant(Node* condition, int true_value, int false_value) {
return SelectSmiConstant(condition, Smi::FromInt(true_value),
Smi::FromInt(false_value));
}
Node* TruncateWordToWord32(Node* value);

View File

@ -553,7 +553,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
call_add_stub(assembler), end(assembler);
Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64),
var_fadd_rhs(assembler, MachineRepresentation::kFloat64),
var_type_feedback(assembler, MachineRepresentation::kWord32),
var_type_feedback(assembler, MachineRepresentation::kTaggedSigned),
var_result(assembler, MachineRepresentation::kTagged);
// Check if the {lhs} is a Smi or a HeapObject.
@ -589,7 +589,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
assembler->Bind(&if_notoverflow);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall));
assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall));
var_result.Bind(assembler->BitcastWordToTaggedSigned(
assembler->Projection(0, pair)));
assembler->Goto(&end);
@ -650,7 +650,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
assembler->Bind(&do_fadd);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumber));
assembler->SmiConstant(BinaryOperationFeedback::kNumber));
Node* value =
assembler->Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value());
Node* result = assembler->AllocateHeapNumberWithValue(value);
@ -697,7 +697,7 @@ compiler::Node* AddWithFeedbackStub::Generate(
&call_with_any_feedback);
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kString));
assembler->SmiConstant(BinaryOperationFeedback::kString));
Callable callable = CodeFactory::StringAdd(
assembler->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
var_result.Bind(assembler->CallStub(callable, context, lhs, rhs));
@ -720,14 +720,14 @@ compiler::Node* AddWithFeedbackStub::Generate(
assembler->Bind(&call_with_oddball_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_add_stub);
}
assembler->Bind(&call_with_any_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
assembler->Goto(&call_add_stub);
}
@ -759,7 +759,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
call_with_any_feedback(assembler);
Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64),
var_fsub_rhs(assembler, MachineRepresentation::kFloat64),
var_type_feedback(assembler, MachineRepresentation::kWord32),
var_type_feedback(assembler, MachineRepresentation::kTaggedSigned),
var_result(assembler, MachineRepresentation::kTagged);
// Check if the {lhs} is a Smi or a HeapObject.
@ -797,7 +797,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
assembler->Bind(&if_notoverflow);
// lhs, rhs, result smi. combined - smi.
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall));
assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall));
var_result.Bind(
assembler->BitcastWordToTaggedSigned(assembler->Projection(0, pair)));
assembler->Goto(&end);
@ -860,7 +860,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
assembler->Bind(&do_fsub);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumber));
assembler->SmiConstant(BinaryOperationFeedback::kNumber));
Node* lhs_value = var_fsub_lhs.value();
Node* rhs_value = var_fsub_rhs.value();
Node* value = assembler->Float64Sub(lhs_value, rhs_value);
@ -884,7 +884,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
assembler->Bind(&if_rhsissmi);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_subtract_stub);
}
@ -898,7 +898,7 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
&check_rhsisoddball);
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_subtract_stub);
}
}
@ -913,14 +913,14 @@ compiler::Node* SubtractWithFeedbackStub::Generate(
assembler->GotoUnless(rhs_is_oddball, &call_with_any_feedback);
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_subtract_stub);
}
assembler->Bind(&call_with_any_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
assembler->Goto(&call_subtract_stub);
}
@ -955,7 +955,7 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64),
var_rhs_float64(assembler, MachineRepresentation::kFloat64),
var_result(assembler, MachineRepresentation::kTagged),
var_type_feedback(assembler, MachineRepresentation::kWord32);
var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Label lhs_is_smi(assembler), lhs_is_not_smi(assembler);
assembler->Branch(assembler->TaggedIsSmi(lhs), &lhs_is_smi, &lhs_is_not_smi);
@ -971,7 +971,7 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
// Both {lhs} and {rhs} are Smis. The result is not necessarily a smi,
// in case of overflow.
var_result.Bind(assembler->SmiMul(lhs, rhs));
var_type_feedback.Bind(assembler->SelectInt32Constant(
var_type_feedback.Bind(assembler->SelectSmiConstant(
assembler->TaggedIsSmi(var_result.value()),
BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber));
@ -1033,7 +1033,7 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
assembler->Bind(&do_fmul);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumber));
assembler->SmiConstant(BinaryOperationFeedback::kNumber));
Node* value =
assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value());
Node* result = assembler->AllocateHeapNumberWithValue(value);
@ -1074,14 +1074,14 @@ compiler::Node* MultiplyWithFeedbackStub::Generate(
assembler->Bind(&call_with_oddball_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_multiply_stub);
}
assembler->Bind(&call_with_any_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
assembler->Goto(&call_multiply_stub);
}
@ -1116,7 +1116,7 @@ compiler::Node* DivideWithFeedbackStub::Generate(
Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
var_divisor_float64(assembler, MachineRepresentation::kFloat64),
var_result(assembler, MachineRepresentation::kTagged),
var_type_feedback(assembler, MachineRepresentation::kWord32);
var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
@ -1182,7 +1182,7 @@ compiler::Node* DivideWithFeedbackStub::Generate(
assembler->GotoIf(assembler->Word32NotEqual(untagged_dividend, truncated),
&bailout);
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall));
assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall));
var_result.Bind(assembler->SmiFromWord32(untagged_result));
assembler->Goto(&end);
@ -1253,7 +1253,7 @@ compiler::Node* DivideWithFeedbackStub::Generate(
assembler->Bind(&do_fdiv);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumber));
assembler->SmiConstant(BinaryOperationFeedback::kNumber));
Node* value = assembler->Float64Div(var_dividend_float64.value(),
var_divisor_float64.value());
var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
@ -1294,14 +1294,14 @@ compiler::Node* DivideWithFeedbackStub::Generate(
assembler->Bind(&call_with_oddball_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_divide_stub);
}
assembler->Bind(&call_with_any_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
assembler->Goto(&call_divide_stub);
}
@ -1335,7 +1335,7 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64),
var_divisor_float64(assembler, MachineRepresentation::kFloat64),
var_result(assembler, MachineRepresentation::kTagged),
var_type_feedback(assembler, MachineRepresentation::kWord32);
var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Label dividend_is_smi(assembler), dividend_is_not_smi(assembler);
assembler->Branch(assembler->TaggedIsSmi(dividend), &dividend_is_smi,
@ -1350,7 +1350,7 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
assembler->Bind(&divisor_is_smi);
{
var_result.Bind(assembler->SmiMod(dividend, divisor));
var_type_feedback.Bind(assembler->SelectInt32Constant(
var_type_feedback.Bind(assembler->SelectSmiConstant(
assembler->TaggedIsSmi(var_result.value()),
BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber));
@ -1414,7 +1414,7 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
assembler->Bind(&do_fmod);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumber));
assembler->SmiConstant(BinaryOperationFeedback::kNumber));
Node* value = assembler->Float64Mod(var_dividend_float64.value(),
var_divisor_float64.value());
var_result.Bind(assembler->AllocateHeapNumberWithValue(value));
@ -1455,14 +1455,14 @@ compiler::Node* ModulusWithFeedbackStub::Generate(
assembler->Bind(&call_with_oddball_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
assembler->SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&call_modulus_stub);
}
assembler->Bind(&call_with_any_feedback);
{
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
assembler->Goto(&call_modulus_stub);
}

View File

@ -1060,7 +1060,7 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
Variable* loop_vars[] = {&var_value, var_type_feedback};
Label loop(this, 2, loop_vars), done_loop(this, &var_result);
var_value.Bind(value);
var_type_feedback->Bind(Int32Constant(BinaryOperationFeedback::kNone));
var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kNone));
Goto(&loop);
Bind(&loop);
{
@ -1076,8 +1076,8 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
// Convert the Smi {value}.
var_result.Bind(SmiToWord32(value));
var_type_feedback->Bind(
Word32Or(var_type_feedback->value(),
Int32Constant(BinaryOperationFeedback::kSignedSmall)));
SmiOr(var_type_feedback->value(),
SmiConstant(BinaryOperationFeedback::kSignedSmall)));
Goto(&done_loop);
}
@ -1095,8 +1095,8 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
// Truncate the floating point value.
var_result.Bind(TruncateHeapNumberValueToWord32(value));
var_type_feedback->Bind(
Word32Or(var_type_feedback->value(),
Int32Constant(BinaryOperationFeedback::kNumber)));
SmiOr(var_type_feedback->value(),
SmiConstant(BinaryOperationFeedback::kNumber)));
Goto(&done_loop);
}
@ -1105,9 +1105,8 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
// We do not require an Or with earlier feedback here because once we
// convert the value to a number, we cannot reach this path. We can
// only reach this path on the first pass when the feedback is kNone.
CSA_ASSERT(this,
Word32Equal(var_type_feedback->value(),
Int32Constant(BinaryOperationFeedback::kNone)));
CSA_ASSERT(this, SmiEqual(var_type_feedback->value(),
SmiConstant(BinaryOperationFeedback::kNone)));
Label if_valueisoddball(this),
if_valueisnotoddball(this, Label::kDeferred);
@ -1120,7 +1119,7 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
// Convert Oddball to a Number and perform checks again.
var_value.Bind(LoadObjectField(value, Oddball::kToNumberOffset));
var_type_feedback->Bind(
Int32Constant(BinaryOperationFeedback::kNumberOrOddball));
SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
Goto(&loop);
}
@ -1129,7 +1128,7 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
// Convert the {value} to a Number first.
Callable callable = CodeFactory::NonNumberToNumber(isolate());
var_value.Bind(CallStub(callable, context, value));
var_type_feedback->Bind(Int32Constant(BinaryOperationFeedback::kAny));
var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kAny));
Goto(&loop);
}
}

View File

@ -1042,7 +1042,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Bind(&gather_type_feedback);
{
Variable var_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Label lhs_is_not_smi(assembler), lhs_is_not_number(assembler),
lhs_is_not_string(assembler), gather_rhs_type(assembler),
update_feedback(assembler);
@ -1050,7 +1050,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ GotoUnless(__ TaggedIsSmi(lhs), &lhs_is_not_smi);
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kSignedSmall));
__ SmiConstant(CompareOperationFeedback::kSignedSmall));
__ Goto(&gather_rhs_type);
__ Bind(&lhs_is_not_smi);
@ -1058,8 +1058,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
Node* lhs_map = __ LoadMap(lhs);
__ GotoUnless(__ IsHeapNumberMap(lhs_map), &lhs_is_not_number);
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kNumber));
var_type_feedback.Bind(__ SmiConstant(CompareOperationFeedback::kNumber));
__ Goto(&gather_rhs_type);
__ Bind(&lhs_is_not_number);
@ -1072,7 +1071,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
&lhs_is_not_oddball);
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kNumberOrOddball));
__ SmiConstant(CompareOperationFeedback::kNumberOrOddball));
__ Goto(&gather_rhs_type);
__ Bind(&lhs_is_not_oddball);
@ -1084,9 +1083,9 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
if (Token::IsOrderedRelationalCompareOp(compare_op)) {
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kString));
__ SmiConstant(CompareOperationFeedback::kString));
} else {
var_type_feedback.Bind(__ SelectInt32Constant(
var_type_feedback.Bind(__ SelectSmiConstant(
__ Word32Equal(
__ Word32And(lhs_instance_type,
__ Int32Constant(kIsNotInternalizedMask)),
@ -1097,8 +1096,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Goto(&gather_rhs_type);
__ Bind(&lhs_is_not_string);
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kAny));
var_type_feedback.Bind(__ SmiConstant(CompareOperationFeedback::kAny));
__ Goto(&gather_rhs_type);
}
}
@ -1109,9 +1107,9 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ GotoUnless(__ TaggedIsSmi(rhs), &rhs_is_not_smi);
var_type_feedback.Bind(__ Word32Or(
var_type_feedback.value(),
__ Int32Constant(CompareOperationFeedback::kSignedSmall)));
var_type_feedback.Bind(
__ SmiOr(var_type_feedback.value(),
__ SmiConstant(CompareOperationFeedback::kSignedSmall)));
__ Goto(&update_feedback);
__ Bind(&rhs_is_not_smi);
@ -1120,8 +1118,8 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ GotoUnless(__ IsHeapNumberMap(rhs_map), &rhs_is_not_number);
var_type_feedback.Bind(
__ Word32Or(var_type_feedback.value(),
__ Int32Constant(CompareOperationFeedback::kNumber)));
__ SmiOr(var_type_feedback.value(),
__ SmiConstant(CompareOperationFeedback::kNumber)));
__ Goto(&update_feedback);
__ Bind(&rhs_is_not_number);
@ -1133,9 +1131,9 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Int32Constant(ODDBALL_TYPE)),
&rhs_is_not_oddball);
var_type_feedback.Bind(__ Word32Or(
var_type_feedback.Bind(__ SmiOr(
var_type_feedback.value(),
__ Int32Constant(CompareOperationFeedback::kNumberOrOddball)));
__ SmiConstant(CompareOperationFeedback::kNumberOrOddball)));
__ Goto(&update_feedback);
__ Bind(&rhs_is_not_oddball);
@ -1146,13 +1144,13 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
&rhs_is_not_string);
if (Token::IsOrderedRelationalCompareOp(compare_op)) {
var_type_feedback.Bind(__ Word32Or(
var_type_feedback.value(),
__ Int32Constant(CompareOperationFeedback::kString)));
var_type_feedback.Bind(
__ SmiOr(var_type_feedback.value(),
__ SmiConstant(CompareOperationFeedback::kString)));
} else {
var_type_feedback.Bind(__ Word32Or(
var_type_feedback.Bind(__ SmiOr(
var_type_feedback.value(),
__ SelectInt32Constant(
__ SelectSmiConstant(
__ Word32Equal(
__ Word32And(rhs_instance_type,
__ Int32Constant(kIsNotInternalizedMask)),
@ -1164,7 +1162,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
__ Bind(&rhs_is_not_string);
var_type_feedback.Bind(
__ Int32Constant(CompareOperationFeedback::kAny));
__ SmiConstant(CompareOperationFeedback::kAny));
__ Goto(&update_feedback);
}
}
@ -1260,8 +1258,9 @@ void Interpreter::DoBitwiseBinaryOp(Token::Value bitwise_op,
Node* slot_index = __ BytecodeOperandIdx(1);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32),
var_rhs_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_lhs_type_feedback(assembler,
MachineRepresentation::kTaggedSigned),
var_rhs_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
context, lhs, &var_lhs_type_feedback);
Node* rhs_value = __ TruncateTaggedToWord32WithFeedback(
@ -1300,7 +1299,7 @@ void Interpreter::DoBitwiseBinaryOp(Token::Value bitwise_op,
UNREACHABLE();
}
Node* result_type = __ SelectInt32Constant(
Node* result_type = __ SelectSmiConstant(
__ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
@ -1315,9 +1314,9 @@ void Interpreter::DoBitwiseBinaryOp(Token::Value bitwise_op,
}
Node* input_feedback =
__ Word32Or(var_lhs_type_feedback.value(), var_rhs_type_feedback.value());
__ UpdateFeedback(__ Word32Or(result_type, input_feedback),
type_feedback_vector, slot_index);
__ SmiOr(var_lhs_type_feedback.value(), var_rhs_type_feedback.value());
__ UpdateFeedback(__ SmiOr(result_type, input_feedback), type_feedback_vector,
slot_index);
__ SetAccumulator(result);
__ Dispatch();
}
@ -1403,7 +1402,7 @@ void Interpreter::DoAddSmi(InterpreterAssembler* assembler) {
__ Branch(overflow, &slowpath, &if_notoverflow);
__ Bind(&if_notoverflow);
{
__ UpdateFeedback(__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ UpdateFeedback(__ SmiConstant(BinaryOperationFeedback::kSignedSmall),
type_feedback_vector, slot_index);
var_result.Bind(__ BitcastWordToTaggedSigned(__ Projection(0, pair)));
__ Goto(&end);
@ -1457,7 +1456,7 @@ void Interpreter::DoSubSmi(InterpreterAssembler* assembler) {
__ Branch(overflow, &slowpath, &if_notoverflow);
__ Bind(&if_notoverflow);
{
__ UpdateFeedback(__ Int32Constant(BinaryOperationFeedback::kSignedSmall),
__ UpdateFeedback(__ SmiConstant(BinaryOperationFeedback::kSignedSmall),
type_feedback_vector, slot_index);
var_result.Bind(__ BitcastWordToTaggedSigned(__ Projection(0, pair)));
__ Goto(&end);
@ -1492,16 +1491,17 @@ void Interpreter::DoBitwiseOrSmi(InterpreterAssembler* assembler) {
Node* context = __ GetContext();
Node* slot_index = __ BytecodeOperandIdx(2);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_lhs_type_feedback(assembler,
MachineRepresentation::kTaggedSigned);
Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
context, left, &var_lhs_type_feedback);
Node* rhs_value = __ SmiToWord32(right);
Node* value = __ Word32Or(lhs_value, rhs_value);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type = __ SelectInt32Constant(
Node* result_type = __ SelectSmiConstant(
__ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
__ UpdateFeedback(__ SmiOr(result_type, var_lhs_type_feedback.value()),
type_feedback_vector, slot_index);
__ SetAccumulator(result);
__ Dispatch();
@ -1518,16 +1518,17 @@ void Interpreter::DoBitwiseAndSmi(InterpreterAssembler* assembler) {
Node* context = __ GetContext();
Node* slot_index = __ BytecodeOperandIdx(2);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_lhs_type_feedback(assembler,
MachineRepresentation::kTaggedSigned);
Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
context, left, &var_lhs_type_feedback);
Node* rhs_value = __ SmiToWord32(right);
Node* value = __ Word32And(lhs_value, rhs_value);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type = __ SelectInt32Constant(
Node* result_type = __ SelectSmiConstant(
__ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
__ UpdateFeedback(__ SmiOr(result_type, var_lhs_type_feedback.value()),
type_feedback_vector, slot_index);
__ SetAccumulator(result);
__ Dispatch();
@ -1545,17 +1546,18 @@ void Interpreter::DoShiftLeftSmi(InterpreterAssembler* assembler) {
Node* context = __ GetContext();
Node* slot_index = __ BytecodeOperandIdx(2);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_lhs_type_feedback(assembler,
MachineRepresentation::kTaggedSigned);
Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
context, left, &var_lhs_type_feedback);
Node* rhs_value = __ SmiToWord32(right);
Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f));
Node* value = __ Word32Shl(lhs_value, shift_count);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type = __ SelectInt32Constant(
Node* result_type = __ SelectSmiConstant(
__ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
__ UpdateFeedback(__ SmiOr(result_type, var_lhs_type_feedback.value()),
type_feedback_vector, slot_index);
__ SetAccumulator(result);
__ Dispatch();
@ -1573,17 +1575,18 @@ void Interpreter::DoShiftRightSmi(InterpreterAssembler* assembler) {
Node* context = __ GetContext();
Node* slot_index = __ BytecodeOperandIdx(2);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Variable var_lhs_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_lhs_type_feedback(assembler,
MachineRepresentation::kTaggedSigned);
Node* lhs_value = __ TruncateTaggedToWord32WithFeedback(
context, left, &var_lhs_type_feedback);
Node* rhs_value = __ SmiToWord32(right);
Node* shift_count = __ Word32And(rhs_value, __ Int32Constant(0x1f));
Node* value = __ Word32Sar(lhs_value, shift_count);
Node* result = __ ChangeInt32ToTagged(value);
Node* result_type = __ SelectInt32Constant(
Node* result_type = __ SelectSmiConstant(
__ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
__ UpdateFeedback(__ Word32Or(result_type, var_lhs_type_feedback.value()),
__ UpdateFeedback(__ SmiOr(result_type, var_lhs_type_feedback.value()),
type_feedback_vector, slot_index);
__ SetAccumulator(result);
__ Dispatch();
@ -1660,12 +1663,12 @@ void Interpreter::DoInc(InterpreterAssembler* assembler) {
// We might need to try again due to ToNumber conversion.
Variable value_var(assembler, MachineRepresentation::kTagged);
Variable result_var(assembler, MachineRepresentation::kTagged);
Variable var_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Variable* loop_vars[] = {&value_var, &var_type_feedback};
Label start(assembler, 2, loop_vars);
value_var.Bind(value);
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNone));
assembler->SmiConstant(BinaryOperationFeedback::kNone));
assembler->Goto(&start);
assembler->Bind(&start);
{
@ -1688,9 +1691,9 @@ void Interpreter::DoInc(InterpreterAssembler* assembler) {
assembler->Branch(overflow, &if_overflow, &if_notoverflow);
assembler->Bind(&if_notoverflow);
var_type_feedback.Bind(assembler->Word32Or(
var_type_feedback.Bind(assembler->SmiOr(
var_type_feedback.value(),
assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall)));
assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall)));
result_var.Bind(
assembler->BitcastWordToTaggedSigned(assembler->Projection(0, pair)));
assembler->Goto(&end);
@ -1724,9 +1727,9 @@ void Interpreter::DoInc(InterpreterAssembler* assembler) {
// convert the value to a number, we cannot reach this path. We can
// only reach this path on the first pass when the feedback is kNone.
CSA_ASSERT(assembler,
assembler->Word32Equal(var_type_feedback.value(),
assembler->Int32Constant(
BinaryOperationFeedback::kNone)));
assembler->SmiEqual(
var_type_feedback.value(),
assembler->SmiConstant(BinaryOperationFeedback::kNone)));
Label if_valueisoddball(assembler), if_valuenotoddball(assembler);
Node* instance_type = assembler->LoadMapInstanceType(value_map);
@ -1739,7 +1742,7 @@ void Interpreter::DoInc(InterpreterAssembler* assembler) {
// Convert Oddball to Number and check again.
value_var.Bind(
assembler->LoadObjectField(value, Oddball::kToNumberOffset));
var_type_feedback.Bind(assembler->Int32Constant(
var_type_feedback.Bind(assembler->SmiConstant(
BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&start);
}
@ -1750,7 +1753,7 @@ void Interpreter::DoInc(InterpreterAssembler* assembler) {
Callable callable =
CodeFactory::NonNumberToNumber(assembler->isolate());
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
value_var.Bind(assembler->CallStub(callable, context, value));
assembler->Goto(&start);
}
@ -1763,9 +1766,9 @@ void Interpreter::DoInc(InterpreterAssembler* assembler) {
Node* finc_value = var_finc_value.value();
Node* one = assembler->Float64Constant(1.0);
Node* finc_result = assembler->Float64Add(finc_value, one);
var_type_feedback.Bind(assembler->Word32Or(
var_type_feedback.Bind(assembler->SmiOr(
var_type_feedback.value(),
assembler->Int32Constant(BinaryOperationFeedback::kNumber)));
assembler->SmiConstant(BinaryOperationFeedback::kNumber)));
result_var.Bind(assembler->AllocateHeapNumberWithValue(finc_result));
assembler->Goto(&end);
}
@ -1798,11 +1801,11 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
// We might need to try again due to ToNumber conversion.
Variable value_var(assembler, MachineRepresentation::kTagged);
Variable result_var(assembler, MachineRepresentation::kTagged);
Variable var_type_feedback(assembler, MachineRepresentation::kWord32);
Variable var_type_feedback(assembler, MachineRepresentation::kTaggedSigned);
Variable* loop_vars[] = {&value_var, &var_type_feedback};
Label start(assembler, 2, loop_vars);
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kNone));
assembler->SmiConstant(BinaryOperationFeedback::kNone));
value_var.Bind(value);
assembler->Goto(&start);
assembler->Bind(&start);
@ -1826,9 +1829,9 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
assembler->Branch(overflow, &if_overflow, &if_notoverflow);
assembler->Bind(&if_notoverflow);
var_type_feedback.Bind(assembler->Word32Or(
var_type_feedback.Bind(assembler->SmiOr(
var_type_feedback.value(),
assembler->Int32Constant(BinaryOperationFeedback::kSignedSmall)));
assembler->SmiConstant(BinaryOperationFeedback::kSignedSmall)));
result_var.Bind(
assembler->BitcastWordToTaggedSigned(assembler->Projection(0, pair)));
assembler->Goto(&end);
@ -1862,9 +1865,9 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
// convert the value to a number, we cannot reach this path. We can
// only reach this path on the first pass when the feedback is kNone.
CSA_ASSERT(assembler,
assembler->Word32Equal(var_type_feedback.value(),
assembler->Int32Constant(
BinaryOperationFeedback::kNone)));
assembler->SmiEqual(
var_type_feedback.value(),
assembler->SmiConstant(BinaryOperationFeedback::kNone)));
Label if_valueisoddball(assembler), if_valuenotoddball(assembler);
Node* instance_type = assembler->LoadMapInstanceType(value_map);
@ -1877,7 +1880,7 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
// Convert Oddball to Number and check again.
value_var.Bind(
assembler->LoadObjectField(value, Oddball::kToNumberOffset));
var_type_feedback.Bind(assembler->Int32Constant(
var_type_feedback.Bind(assembler->SmiConstant(
BinaryOperationFeedback::kNumberOrOddball));
assembler->Goto(&start);
}
@ -1888,7 +1891,7 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
Callable callable =
CodeFactory::NonNumberToNumber(assembler->isolate());
var_type_feedback.Bind(
assembler->Int32Constant(BinaryOperationFeedback::kAny));
assembler->SmiConstant(BinaryOperationFeedback::kAny));
value_var.Bind(assembler->CallStub(callable, context, value));
assembler->Goto(&start);
}
@ -1901,9 +1904,9 @@ void Interpreter::DoDec(InterpreterAssembler* assembler) {
Node* fdec_value = var_fdec_value.value();
Node* one = assembler->Float64Constant(1.0);
Node* fdec_result = assembler->Float64Sub(fdec_value, one);
var_type_feedback.Bind(assembler->Word32Or(
var_type_feedback.Bind(assembler->SmiOr(
var_type_feedback.value(),
assembler->Int32Constant(BinaryOperationFeedback::kNumber)));
assembler->SmiConstant(BinaryOperationFeedback::kNumber)));
result_var.Bind(assembler->AllocateHeapNumberWithValue(fdec_result));
assembler->Goto(&end);
}