Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: src/interpreter/interpreter.cc

Issue 2624753002: [ignition] Use Smis directly for type feedback (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index eee21247166f6e3a8ab33a5f3ad4519c257da227..fff1f37dd2ef346d0b3ac58588e8ceb83b26cda1 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1044,7 +1044,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);
@@ -1052,7 +1052,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);
@@ -1060,8 +1060,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);
@@ -1074,7 +1073,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);
@@ -1086,9 +1085,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)),
@@ -1099,8 +1098,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);
}
}
@@ -1111,9 +1109,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);
@@ -1122,8 +1120,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);
@@ -1135,9 +1133,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);
@@ -1148,13 +1146,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)),
@@ -1166,7 +1164,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);
}
}
@@ -1262,8 +1260,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(
@@ -1302,7 +1301,7 @@ void Interpreter::DoBitwiseBinaryOp(Token::Value bitwise_op,
UNREACHABLE();
}
- Node* result_type = __ SelectInt32Constant(
+ Node* result_type = __ SelectSmiConstant(
__ TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
@@ -1317,9 +1316,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();
}
@@ -1405,7 +1404,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);
@@ -1459,7 +1458,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);
@@ -1494,16 +1493,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();
@@ -1520,16 +1520,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();
@@ -1547,17 +1548,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();
@@ -1575,17 +1577,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();
@@ -1662,12 +1665,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);
{
@@ -1690,9 +1693,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);
@@ -1726,9 +1729,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);
@@ -1741,7 +1744,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);
}
@@ -1752,7 +1755,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);
}
@@ -1765,9 +1768,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);
}
@@ -1800,11 +1803,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);
@@ -1828,9 +1831,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);
@@ -1864,9 +1867,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);
@@ -1879,7 +1882,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);
}
@@ -1890,7 +1893,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);
}
@@ -1903,9 +1906,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);
}

Powered by Google App Engine
This is Rietveld 408576698