Commit 1f55c1b5 authored by leszeks's avatar leszeks Committed by Commit bot

[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}
parent ec45e6ed
......@@ -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);
}
......
......@@ -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);
......
This diff is collapsed.
......@@ -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);
}
}
......
This diff is collapsed.
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