Commit 10f392ac authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[csa] Clean up handling of type feedback variable.

This makes the code dealing with type feedback more concise and uniform
(at the cost of a few redundant comparisons).

Bug: 
Change-Id: If6b98bd1f0dddd392d7b00d65b600127bd30ff7e
Reviewed-on: https://chromium-review.googlesource.com/818984
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50035}
parent e1f23233
This diff is collapsed.
......@@ -1634,9 +1634,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
void ReportFeedbackUpdate(SloppyTNode<FeedbackVector> feedback_vector,
SloppyTNode<IntPtrT> slot_id, const char* reason);
// Combine the new feedback with the existing_feedback.
// Combine the new feedback with the existing_feedback. Do nothing if
// existing_feedback is nullptr.
void CombineFeedback(Variable* existing_feedback, int feedback);
void CombineFeedback(Variable* existing_feedback, Node* feedback);
// Overwrite the existing feedback with new_feedback. Do nothing if
// existing_feedback is nullptr.
void OverwriteFeedback(Variable* existing_feedback, int new_feedback);
// Check if a property name might require protector invalidation when it is
// used for a property store or deletion.
void CheckForAssociatedProtector(Node* name, Label* if_protector);
......@@ -1931,12 +1937,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* context, Node* input, Object::Conversion mode,
BigIntHandling bigint_handling = BigIntHandling::kThrow);
enum class Feedback { kCollect, kNone };
template <Feedback feedback>
void TaggedToNumeric(Node* context, Node* value, Label* done,
Variable* var_numeric, Variable* var_feedback = nullptr);
Variable* var_numeric, Variable* var_feedback);
template <Feedback feedback, Object::Conversion conversion>
template <Object::Conversion conversion>
void TaggedToWord32OrBigIntImpl(Node* context, Node* value, Label* if_number,
Variable* var_word32,
Label* if_bigint = nullptr,
......
......@@ -1301,8 +1301,8 @@ class CompareOperationFeedback {
kInternalizedString = 0x8,
kString = 0x18,
kSymbol = 0x20,
kBigInt = 0x30,
kReceiver = 0x40,
kBigInt = 0x80,
kAny = 0xff
};
};
......
......@@ -1245,8 +1245,7 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
BIND(&if_bigint);
{
var_result.Bind(BigIntOp(value));
CombineFeedback(&var_feedback,
SmiConstant(BinaryOperationFeedback::kBigInt));
CombineFeedback(&var_feedback, BinaryOperationFeedback::kBigInt);
Goto(&end);
}
......@@ -1257,8 +1256,8 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
// only reach this path on the first pass when the feedback is kNone.
CSA_ASSERT(this, SmiEqual(var_feedback.value(),
SmiConstant(BinaryOperationFeedback::kNone)));
var_feedback.Bind(
SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
OverwriteFeedback(&var_feedback,
BinaryOperationFeedback::kNumberOrOddball);
var_value.Bind(LoadObjectField(value, Oddball::kToNumberOffset));
Goto(&start);
}
......@@ -1270,7 +1269,7 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
// only reach this path on the first pass when the feedback is kNone.
CSA_ASSERT(this, SmiEqual(var_feedback.value(),
SmiConstant(BinaryOperationFeedback::kNone)));
var_feedback.Bind(SmiConstant(BinaryOperationFeedback::kAny));
OverwriteFeedback(&var_feedback, BinaryOperationFeedback::kAny);
var_value.Bind(
CallBuiltin(Builtins::kNonNumberToNumeric, GetContext(), value));
Goto(&start);
......@@ -1279,8 +1278,7 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
BIND(&do_float_op);
{
CombineFeedback(&var_feedback,
SmiConstant(BinaryOperationFeedback::kNumber));
CombineFeedback(&var_feedback, BinaryOperationFeedback::kNumber);
var_result.Bind(
AllocateHeapNumberWithValue(FloatOp(var_float_value.value())));
Goto(&end);
......@@ -1310,14 +1308,12 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler {
GotoIf(SmiEqual(smi_value, SmiConstant(Smi::kMinValue)), &if_min_smi);
// Else simply subtract operand from 0.
CombineFeedback(var_feedback,
SmiConstant(BinaryOperationFeedback::kSignedSmall));
CombineFeedback(var_feedback, BinaryOperationFeedback::kSignedSmall);
var_result.Bind(SmiSub(SmiConstant(0), smi_value));
Goto(&end);
BIND(&if_zero);
CombineFeedback(var_feedback,
SmiConstant(BinaryOperationFeedback::kNumber));
CombineFeedback(var_feedback, BinaryOperationFeedback::kNumber);
var_result.Bind(MinusZeroConstant());
Goto(&end);
......@@ -1412,8 +1408,7 @@ class IncDecAssembler : public UnaryNumericOpAssembler {
}
BIND(&if_notoverflow);
CombineFeedback(var_feedback,
SmiConstant(BinaryOperationFeedback::kSignedSmall));
CombineFeedback(var_feedback, BinaryOperationFeedback::kSignedSmall);
return BitcastWordToTaggedSigned(Projection(0, pair));
}
......
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