Commit b4712d52 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Revert "Remove obsolete kNumber binop feedback."

This reverts commit 1169f55b.

Reason for revert: http://crbug.com/758994

Original change's description:
> Remove obsolete kNumber binop feedback.
> 
> With the removal of Crankshaft, kNumber has become obsolete as
> BinaryOperationFeedback. Turbofan uses kNumberOrOddball.
> 
> Bug: 
> Change-Id: If577f5efcc81d7c08f43908f2764ff0ec6f8747c
> Reviewed-on: https://chromium-review.googlesource.com/628376
> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
> Reviewed-by: Mythri Alle <mythria@chromium.org>
> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47555}

TBR=jkummerow@chromium.org,jarin@chromium.org,neis@chromium.org,mythria@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I1b33f572f3e6865e00d2468bffcce2ea466814b3
Reviewed-on: https://chromium-review.googlesource.com/637711Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47642}
parent c6579212
...@@ -602,6 +602,7 @@ struct JSOperatorGlobalCache final { ...@@ -602,6 +602,7 @@ struct JSOperatorGlobalCache final {
Name##Operator<BinaryOperationHint::kSignedSmallInputs> \ Name##Operator<BinaryOperationHint::kSignedSmallInputs> \
k##Name##SignedSmallInputsOperator; \ k##Name##SignedSmallInputsOperator; \
Name##Operator<BinaryOperationHint::kSigned32> k##Name##Signed32Operator; \ Name##Operator<BinaryOperationHint::kSigned32> k##Name##Signed32Operator; \
Name##Operator<BinaryOperationHint::kNumber> k##Name##NumberOperator; \
Name##Operator<BinaryOperationHint::kNumberOrOddball> \ Name##Operator<BinaryOperationHint::kNumberOrOddball> \
k##Name##NumberOrOddballOperator; \ k##Name##NumberOrOddballOperator; \
Name##Operator<BinaryOperationHint::kString> k##Name##StringOperator; \ Name##Operator<BinaryOperationHint::kString> k##Name##StringOperator; \
...@@ -657,6 +658,8 @@ CACHED_OP_LIST(CACHED_OP) ...@@ -657,6 +658,8 @@ CACHED_OP_LIST(CACHED_OP)
return &cache_.k##Name##SignedSmallInputsOperator; \ return &cache_.k##Name##SignedSmallInputsOperator; \
case BinaryOperationHint::kSigned32: \ case BinaryOperationHint::kSigned32: \
return &cache_.k##Name##Signed32Operator; \ return &cache_.k##Name##Signed32Operator; \
case BinaryOperationHint::kNumber: \
return &cache_.k##Name##NumberOperator; \
case BinaryOperationHint::kNumberOrOddball: \ case BinaryOperationHint::kNumberOrOddball: \
return &cache_.k##Name##NumberOrOddballOperator; \ return &cache_.k##Name##NumberOrOddballOperator; \
case BinaryOperationHint::kString: \ case BinaryOperationHint::kString: \
......
...@@ -29,6 +29,9 @@ bool BinaryOperationHintToNumberOperationHint( ...@@ -29,6 +29,9 @@ bool BinaryOperationHintToNumberOperationHint(
case BinaryOperationHint::kSigned32: case BinaryOperationHint::kSigned32:
*number_hint = NumberOperationHint::kSigned32; *number_hint = NumberOperationHint::kSigned32;
return true; return true;
case BinaryOperationHint::kNumber:
*number_hint = NumberOperationHint::kNumber;
return true;
case BinaryOperationHint::kNumberOrOddball: case BinaryOperationHint::kNumberOrOddball:
*number_hint = NumberOperationHint::kNumberOrOddball; *number_hint = NumberOperationHint::kNumberOrOddball;
return true; return true;
......
...@@ -183,6 +183,8 @@ BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback) { ...@@ -183,6 +183,8 @@ BinaryOperationHint BinaryOperationHintFromFeedback(int type_feedback) {
return BinaryOperationHint::kSignedSmall; return BinaryOperationHint::kSignedSmall;
case BinaryOperationFeedback::kSignedSmallInputs: case BinaryOperationFeedback::kSignedSmallInputs:
return BinaryOperationHint::kSignedSmallInputs; return BinaryOperationHint::kSignedSmallInputs;
case BinaryOperationFeedback::kNumber:
return BinaryOperationHint::kNumber;
case BinaryOperationFeedback::kNumberOrOddball: case BinaryOperationFeedback::kNumberOrOddball:
return BinaryOperationHint::kNumberOrOddball; return BinaryOperationHint::kNumberOrOddball;
case BinaryOperationFeedback::kString: case BinaryOperationFeedback::kString:
......
...@@ -1254,17 +1254,23 @@ inline uint32_t ObjectHash(Address address) { ...@@ -1254,17 +1254,23 @@ inline uint32_t ObjectHash(Address address) {
// Type feedback is encoded in such a way that, we can combine the feedback // Type feedback is encoded in such a way that, we can combine the feedback
// at different points by performing an 'OR' operation. Type feedback moves // at different points by performing an 'OR' operation. Type feedback moves
// to a more generic type when we combine feedback. // to a more generic type when we combine feedback.
// kSignedSmall -> kSignedSmallInputs -> kNumberOrOddball -> kAny // kSignedSmall -> kSignedSmallInputs -> kNumber -> kNumberOrOddball -> kAny
// kString -> kAny // kString -> kAny
// TODO(mythria): Remove kNumber type when crankshaft can handle Oddballs
// similar to Numbers. We don't need kNumber feedback for Turbofan. Extra
// information about Number might reduce few instructions but causes more
// deopts. We collect Number only because crankshaft does not handle all
// cases of oddballs.
class BinaryOperationFeedback { class BinaryOperationFeedback {
public: public:
enum { enum {
kNone = 0x0, kNone = 0x0,
kSignedSmall = 0x1, kSignedSmall = 0x1,
kSignedSmallInputs = 0x3, kSignedSmallInputs = 0x3,
kNumberOrOddball = 0x5, kNumber = 0x7,
kString = 0x8, kNumberOrOddball = 0xF,
kAny = 0x1F kString = 0x10,
kAny = 0x3F
}; };
}; };
...@@ -1275,6 +1281,7 @@ class BinaryOperationFeedback { ...@@ -1275,6 +1281,7 @@ class BinaryOperationFeedback {
// kInternalizedString -> kString -> kAny // kInternalizedString -> kString -> kAny
// kSymbol -> kAny // kSymbol -> kAny
// kReceiver -> kAny // kReceiver -> kAny
// TODO(epertoso): consider unifying this with BinaryOperationFeedback.
class CompareOperationFeedback { class CompareOperationFeedback {
public: public:
enum { enum {
......
...@@ -122,8 +122,7 @@ Node* BinaryOpAssembler::Generate_AddWithFeedback(Node* context, Node* lhs, ...@@ -122,8 +122,7 @@ Node* BinaryOpAssembler::Generate_AddWithFeedback(Node* context, Node* lhs,
BIND(&do_fadd); BIND(&do_fadd);
{ {
var_type_feedback.Bind( var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kNumber));
SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
Node* value = Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value()); Node* value = Float64Add(var_fadd_lhs.value(), var_fadd_rhs.value());
Node* result = AllocateHeapNumberWithValue(value); Node* result = AllocateHeapNumberWithValue(value);
var_result.Bind(result); var_result.Bind(result);
...@@ -294,8 +293,7 @@ Node* BinaryOpAssembler::Generate_BinaryOperationWithFeedback( ...@@ -294,8 +293,7 @@ Node* BinaryOpAssembler::Generate_BinaryOperationWithFeedback(
BIND(&do_float_operation); BIND(&do_float_operation);
{ {
var_type_feedback.Bind( var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kNumber));
SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
Node* lhs_value = var_float_lhs.value(); Node* lhs_value = var_float_lhs.value();
Node* rhs_value = var_float_rhs.value(); Node* rhs_value = var_float_rhs.value();
Node* value = floatOperation(lhs_value, rhs_value); Node* value = floatOperation(lhs_value, rhs_value);
...@@ -412,8 +410,7 @@ Node* BinaryOpAssembler::Generate_SubtractWithFeedback(Node* context, Node* lhs, ...@@ -412,8 +410,7 @@ Node* BinaryOpAssembler::Generate_SubtractWithFeedback(Node* context, Node* lhs,
BIND(&if_overflow); BIND(&if_overflow);
{ {
var_type_feedback->Bind( var_type_feedback->Bind(SmiConstant(BinaryOperationFeedback::kNumber));
SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
Node* value = Float64Sub(SmiToFloat64(lhs), SmiToFloat64(rhs)); Node* value = Float64Sub(SmiToFloat64(lhs), SmiToFloat64(rhs));
var_result.Bind(AllocateHeapNumberWithValue(value)); var_result.Bind(AllocateHeapNumberWithValue(value));
Goto(&end); Goto(&end);
...@@ -439,7 +436,7 @@ Node* BinaryOpAssembler::Generate_MultiplyWithFeedback(Node* context, Node* lhs, ...@@ -439,7 +436,7 @@ Node* BinaryOpAssembler::Generate_MultiplyWithFeedback(Node* context, Node* lhs,
Node* result = SmiMul(lhs, rhs); Node* result = SmiMul(lhs, rhs);
var_type_feedback->Bind(SelectSmiConstant( var_type_feedback->Bind(SelectSmiConstant(
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball)); BinaryOperationFeedback::kNumber));
return result; return result;
}; };
auto floatFunction = [=](Node* lhs, Node* rhs) { auto floatFunction = [=](Node* lhs, Node* rhs) {
...@@ -491,7 +488,7 @@ Node* BinaryOpAssembler::Generate_ModulusWithFeedback( ...@@ -491,7 +488,7 @@ Node* BinaryOpAssembler::Generate_ModulusWithFeedback(
Node* result = SmiMod(lhs, rhs); Node* result = SmiMod(lhs, rhs);
var_type_feedback->Bind(SelectSmiConstant( var_type_feedback->Bind(SelectSmiConstant(
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball)); BinaryOperationFeedback::kNumber));
return result; return result;
}; };
auto floatFunction = [=](Node* lhs, Node* rhs) { auto floatFunction = [=](Node* lhs, Node* rhs) {
......
...@@ -1254,7 +1254,7 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback( ...@@ -1254,7 +1254,7 @@ Node* InterpreterAssembler::TruncateTaggedToWord32WithFeedback(
var_result.Bind(TruncateHeapNumberValueToWord32(value)); var_result.Bind(TruncateHeapNumberValueToWord32(value));
var_type_feedback->Bind( var_type_feedback->Bind(
SmiOr(var_type_feedback->value(), SmiOr(var_type_feedback->value(),
SmiConstant(BinaryOperationFeedback::kNumberOrOddball))); SmiConstant(BinaryOperationFeedback::kNumber)));
Goto(&done_loop); Goto(&done_loop);
} }
......
...@@ -1017,9 +1017,9 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler { ...@@ -1017,9 +1017,9 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler {
UNREACHABLE(); UNREACHABLE();
} }
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
if (FLAG_debug_code) { if (FLAG_debug_code) {
Label ok(this); Label ok(this);
...@@ -1108,9 +1108,9 @@ IGNITION_HANDLER(BitwiseOrSmi, InterpreterAssembler) { ...@@ -1108,9 +1108,9 @@ IGNITION_HANDLER(BitwiseOrSmi, InterpreterAssembler) {
Node* rhs_value = SmiToWord32(right); Node* rhs_value = SmiToWord32(right);
Node* value = Word32Or(lhs_value, rhs_value); Node* value = Word32Or(lhs_value, rhs_value);
Node* result = ChangeInt32ToTagged(value); Node* result = ChangeInt32ToTagged(value);
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
Node* function = LoadRegister(Register::function_closure()); Node* function = LoadRegister(Register::function_closure());
UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()), UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()),
feedback_vector, slot_index, function); feedback_vector, slot_index, function);
...@@ -1134,9 +1134,9 @@ IGNITION_HANDLER(BitwiseXorSmi, InterpreterAssembler) { ...@@ -1134,9 +1134,9 @@ IGNITION_HANDLER(BitwiseXorSmi, InterpreterAssembler) {
Node* rhs_value = SmiToWord32(right); Node* rhs_value = SmiToWord32(right);
Node* value = Word32Xor(lhs_value, rhs_value); Node* value = Word32Xor(lhs_value, rhs_value);
Node* result = ChangeInt32ToTagged(value); Node* result = ChangeInt32ToTagged(value);
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
Node* function = LoadRegister(Register::function_closure()); Node* function = LoadRegister(Register::function_closure());
UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()), UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()),
feedback_vector, slot_index, function); feedback_vector, slot_index, function);
...@@ -1160,9 +1160,9 @@ IGNITION_HANDLER(BitwiseAndSmi, InterpreterAssembler) { ...@@ -1160,9 +1160,9 @@ IGNITION_HANDLER(BitwiseAndSmi, InterpreterAssembler) {
Node* rhs_value = SmiToWord32(right); Node* rhs_value = SmiToWord32(right);
Node* value = Word32And(lhs_value, rhs_value); Node* value = Word32And(lhs_value, rhs_value);
Node* result = ChangeInt32ToTagged(value); Node* result = ChangeInt32ToTagged(value);
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
Node* function = LoadRegister(Register::function_closure()); Node* function = LoadRegister(Register::function_closure());
UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()), UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()),
feedback_vector, slot_index, function); feedback_vector, slot_index, function);
...@@ -1189,9 +1189,9 @@ IGNITION_HANDLER(ShiftLeftSmi, InterpreterAssembler) { ...@@ -1189,9 +1189,9 @@ IGNITION_HANDLER(ShiftLeftSmi, InterpreterAssembler) {
Node* shift_count = Word32And(rhs_value, Int32Constant(0x1f)); Node* shift_count = Word32And(rhs_value, Int32Constant(0x1f));
Node* value = Word32Shl(lhs_value, shift_count); Node* value = Word32Shl(lhs_value, shift_count);
Node* result = ChangeInt32ToTagged(value); Node* result = ChangeInt32ToTagged(value);
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
Node* function = LoadRegister(Register::function_closure()); Node* function = LoadRegister(Register::function_closure());
UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()), UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()),
feedback_vector, slot_index, function); feedback_vector, slot_index, function);
...@@ -1218,9 +1218,9 @@ IGNITION_HANDLER(ShiftRightSmi, InterpreterAssembler) { ...@@ -1218,9 +1218,9 @@ IGNITION_HANDLER(ShiftRightSmi, InterpreterAssembler) {
Node* shift_count = Word32And(rhs_value, Int32Constant(0x1f)); Node* shift_count = Word32And(rhs_value, Int32Constant(0x1f));
Node* value = Word32Sar(lhs_value, shift_count); Node* value = Word32Sar(lhs_value, shift_count);
Node* result = ChangeInt32ToTagged(value); Node* result = ChangeInt32ToTagged(value);
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
Node* function = LoadRegister(Register::function_closure()); Node* function = LoadRegister(Register::function_closure());
UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()), UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()),
feedback_vector, slot_index, function); feedback_vector, slot_index, function);
...@@ -1247,9 +1247,9 @@ IGNITION_HANDLER(ShiftRightLogicalSmi, InterpreterAssembler) { ...@@ -1247,9 +1247,9 @@ IGNITION_HANDLER(ShiftRightLogicalSmi, InterpreterAssembler) {
Node* shift_count = Word32And(rhs_value, Int32Constant(0x1f)); Node* shift_count = Word32And(rhs_value, Int32Constant(0x1f));
Node* value = Word32Shr(lhs_value, shift_count); Node* value = Word32Shr(lhs_value, shift_count);
Node* result = ChangeUint32ToTagged(value); Node* result = ChangeUint32ToTagged(value);
Node* result_type = SelectSmiConstant( Node* result_type = SelectSmiConstant(TaggedIsSmi(result),
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall, BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumberOrOddball); BinaryOperationFeedback::kNumber);
Node* function = LoadRegister(Register::function_closure()); Node* function = LoadRegister(Register::function_closure());
UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()), UpdateFeedback(SmiOr(result_type, var_lhs_type_feedback.value()),
feedback_vector, slot_index, function); feedback_vector, slot_index, function);
...@@ -1294,8 +1294,7 @@ IGNITION_HANDLER(ToNumber, InterpreterAssembler) { ...@@ -1294,8 +1294,7 @@ IGNITION_HANDLER(ToNumber, InterpreterAssembler) {
BIND(&if_objectisnumber); BIND(&if_objectisnumber);
{ {
var_result.Bind(object); var_result.Bind(object);
var_type_feedback.Bind( var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kNumber));
SmiConstant(BinaryOperationFeedback::kNumberOrOddball));
Goto(&if_done); Goto(&if_done);
} }
...@@ -1444,7 +1443,7 @@ IGNITION_HANDLER(Inc, InterpreterAssembler) { ...@@ -1444,7 +1443,7 @@ IGNITION_HANDLER(Inc, InterpreterAssembler) {
Node* finc_result = Float64Add(finc_value, one); Node* finc_result = Float64Add(finc_value, one);
var_type_feedback.Bind( var_type_feedback.Bind(
SmiOr(var_type_feedback.value(), SmiOr(var_type_feedback.value(),
SmiConstant(BinaryOperationFeedback::kNumberOrOddball))); SmiConstant(BinaryOperationFeedback::kNumber)));
result_var.Bind(AllocateHeapNumberWithValue(finc_result)); result_var.Bind(AllocateHeapNumberWithValue(finc_result));
Goto(&end); Goto(&end);
} }
...@@ -1569,7 +1568,7 @@ IGNITION_HANDLER(Dec, InterpreterAssembler) { ...@@ -1569,7 +1568,7 @@ IGNITION_HANDLER(Dec, InterpreterAssembler) {
Node* fdec_result = Float64Sub(fdec_value, one); Node* fdec_result = Float64Sub(fdec_value, one);
var_type_feedback.Bind( var_type_feedback.Bind(
SmiOr(var_type_feedback.value(), SmiOr(var_type_feedback.value(),
SmiConstant(BinaryOperationFeedback::kNumberOrOddball))); SmiConstant(BinaryOperationFeedback::kNumber)));
result_var.Bind(AllocateHeapNumberWithValue(fdec_result)); result_var.Bind(AllocateHeapNumberWithValue(fdec_result));
Goto(&end); Goto(&end);
} }
......
...@@ -17,6 +17,8 @@ std::ostream& operator<<(std::ostream& os, BinaryOperationHint hint) { ...@@ -17,6 +17,8 @@ std::ostream& operator<<(std::ostream& os, BinaryOperationHint hint) {
return os << "SignedSmallInputs"; return os << "SignedSmallInputs";
case BinaryOperationHint::kSigned32: case BinaryOperationHint::kSigned32:
return os << "Signed32"; return os << "Signed32";
case BinaryOperationHint::kNumber:
return os << "Number";
case BinaryOperationHint::kNumberOrOddball: case BinaryOperationHint::kNumberOrOddball:
return os << "NumberOrOddball"; return os << "NumberOrOddball";
case BinaryOperationHint::kString: case BinaryOperationHint::kString:
......
...@@ -17,6 +17,7 @@ enum class BinaryOperationHint : uint8_t { ...@@ -17,6 +17,7 @@ enum class BinaryOperationHint : uint8_t {
kSignedSmall, kSignedSmall,
kSignedSmallInputs, kSignedSmallInputs,
kSigned32, kSigned32,
kNumber,
kNumberOrOddball, kNumberOrOddball,
kString, kString,
kAny kAny
......
...@@ -559,14 +559,14 @@ TEST(InterpreterBinaryOpTypeFeedback) { ...@@ -559,14 +559,14 @@ TEST(InterpreterBinaryOpTypeFeedback) {
{Token::Value::ADD, ast_factory.NewSmi(Smi::kMaxValue), {Token::Value::ADD, ast_factory.NewSmi(Smi::kMaxValue),
ast_factory.NewSmi(1), ast_factory.NewSmi(1),
isolate->factory()->NewHeapNumber(Smi::kMaxValue + 1.0), isolate->factory()->NewHeapNumber(Smi::kMaxValue + 1.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::ADD, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), {Token::Value::ADD, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3),
isolate->factory()->NewHeapNumber(3.1415 + 3), isolate->factory()->NewHeapNumber(3.1415 + 3),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::ADD, ast_factory.NewNumber(3.1415), {Token::Value::ADD, ast_factory.NewNumber(3.1415),
ast_factory.NewNumber(1.4142), ast_factory.NewNumber(1.4142),
isolate->factory()->NewHeapNumber(3.1415 + 1.4142), isolate->factory()->NewHeapNumber(3.1415 + 1.4142),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::ADD, {Token::Value::ADD,
ast_factory.NewString(ast_factory.GetOneByteString("foo")), ast_factory.NewString(ast_factory.GetOneByteString("foo")),
ast_factory.NewString(ast_factory.GetOneByteString("bar")), ast_factory.NewString(ast_factory.GetOneByteString("bar")),
...@@ -584,14 +584,14 @@ TEST(InterpreterBinaryOpTypeFeedback) { ...@@ -584,14 +584,14 @@ TEST(InterpreterBinaryOpTypeFeedback) {
ast_factory.NewSmi(static_cast<uint32_t>(Smi::kMinValue)), ast_factory.NewSmi(static_cast<uint32_t>(Smi::kMinValue)),
ast_factory.NewSmi(1), ast_factory.NewSmi(1),
isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0), isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::SUB, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), {Token::Value::SUB, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3),
isolate->factory()->NewHeapNumber(3.1415 - 3), isolate->factory()->NewHeapNumber(3.1415 - 3),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::SUB, ast_factory.NewNumber(3.1415), {Token::Value::SUB, ast_factory.NewNumber(3.1415),
ast_factory.NewNumber(1.4142), ast_factory.NewNumber(1.4142),
isolate->factory()->NewHeapNumber(3.1415 - 1.4142), isolate->factory()->NewHeapNumber(3.1415 - 1.4142),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::SUB, ast_factory.NewSmi(2), {Token::Value::SUB, ast_factory.NewSmi(2),
ast_factory.NewString(ast_factory.GetOneByteString("1")), ast_factory.NewString(ast_factory.GetOneByteString("1")),
Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny},
...@@ -603,14 +603,14 @@ TEST(InterpreterBinaryOpTypeFeedback) { ...@@ -603,14 +603,14 @@ TEST(InterpreterBinaryOpTypeFeedback) {
ast_factory.NewSmi(static_cast<uint32_t>(Smi::kMinValue)), ast_factory.NewSmi(static_cast<uint32_t>(Smi::kMinValue)),
ast_factory.NewSmi(2), ast_factory.NewSmi(2),
isolate->factory()->NewHeapNumber(Smi::kMinValue * 2.0), isolate->factory()->NewHeapNumber(Smi::kMinValue * 2.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::MUL, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), {Token::Value::MUL, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3),
isolate->factory()->NewHeapNumber(3 * 3.1415), isolate->factory()->NewHeapNumber(3 * 3.1415),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::MUL, ast_factory.NewNumber(3.1415), {Token::Value::MUL, ast_factory.NewNumber(3.1415),
ast_factory.NewNumber(1.4142), ast_factory.NewNumber(1.4142),
isolate->factory()->NewHeapNumber(3.1415 * 1.4142), isolate->factory()->NewHeapNumber(3.1415 * 1.4142),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::MUL, ast_factory.NewSmi(2), {Token::Value::MUL, ast_factory.NewSmi(2),
ast_factory.NewString(ast_factory.GetOneByteString("1")), ast_factory.NewString(ast_factory.GetOneByteString("1")),
Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny},
...@@ -623,11 +623,11 @@ TEST(InterpreterBinaryOpTypeFeedback) { ...@@ -623,11 +623,11 @@ TEST(InterpreterBinaryOpTypeFeedback) {
BinaryOperationFeedback::kSignedSmallInputs}, BinaryOperationFeedback::kSignedSmallInputs},
{Token::Value::DIV, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), {Token::Value::DIV, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3),
isolate->factory()->NewHeapNumber(3.1415 / 3), isolate->factory()->NewHeapNumber(3.1415 / 3),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::DIV, ast_factory.NewNumber(3.1415), {Token::Value::DIV, ast_factory.NewNumber(3.1415),
ast_factory.NewNumber(-std::numeric_limits<double>::infinity()), ast_factory.NewNumber(-std::numeric_limits<double>::infinity()),
isolate->factory()->NewHeapNumber(-0.0), isolate->factory()->NewHeapNumber(-0.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::DIV, ast_factory.NewSmi(2), {Token::Value::DIV, ast_factory.NewSmi(2),
ast_factory.NewString(ast_factory.GetOneByteString("1")), ast_factory.NewString(ast_factory.GetOneByteString("1")),
Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kAny},
...@@ -637,14 +637,14 @@ TEST(InterpreterBinaryOpTypeFeedback) { ...@@ -637,14 +637,14 @@ TEST(InterpreterBinaryOpTypeFeedback) {
BinaryOperationFeedback::kSignedSmall}, BinaryOperationFeedback::kSignedSmall},
{Token::Value::MOD, ast_factory.NewSmi(static_cast<uint32_t>(-4)), {Token::Value::MOD, ast_factory.NewSmi(static_cast<uint32_t>(-4)),
ast_factory.NewSmi(2), isolate->factory()->NewHeapNumber(-0.0), ast_factory.NewSmi(2), isolate->factory()->NewHeapNumber(-0.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::MOD, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3), {Token::Value::MOD, ast_factory.NewNumber(3.1415), ast_factory.NewSmi(3),
isolate->factory()->NewHeapNumber(fmod(3.1415, 3.0)), isolate->factory()->NewHeapNumber(fmod(3.1415, 3.0)),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::MOD, ast_factory.NewNumber(-3.1415), {Token::Value::MOD, ast_factory.NewNumber(-3.1415),
ast_factory.NewNumber(-1.4142), ast_factory.NewNumber(-1.4142),
isolate->factory()->NewHeapNumber(fmod(-3.1415, -1.4142)), isolate->factory()->NewHeapNumber(fmod(-3.1415, -1.4142)),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::MOD, ast_factory.NewSmi(3), {Token::Value::MOD, ast_factory.NewSmi(3),
ast_factory.NewString(ast_factory.GetOneByteString("-2")), ast_factory.NewString(ast_factory.GetOneByteString("-2")),
Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}}; Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}};
...@@ -701,10 +701,10 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { ...@@ -701,10 +701,10 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
BinaryOperationFeedback::kSignedSmall}, BinaryOperationFeedback::kSignedSmall},
{Token::Value::ADD, ast_factory.NewSmi(2), Smi::kMaxValue, {Token::Value::ADD, ast_factory.NewSmi(2), Smi::kMaxValue,
isolate->factory()->NewHeapNumber(Smi::kMaxValue + 2.0), isolate->factory()->NewHeapNumber(Smi::kMaxValue + 2.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::ADD, ast_factory.NewNumber(3.1415), 2, {Token::Value::ADD, ast_factory.NewNumber(3.1415), 2,
isolate->factory()->NewHeapNumber(3.1415 + 2.0), isolate->factory()->NewHeapNumber(3.1415 + 2.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::ADD, {Token::Value::ADD,
ast_factory.NewString(ast_factory.GetOneByteString("2")), 2, ast_factory.NewString(ast_factory.GetOneByteString("2")), 2,
isolate->factory()->NewStringFromAsciiChecked("22"), isolate->factory()->NewStringFromAsciiChecked("22"),
...@@ -716,10 +716,10 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { ...@@ -716,10 +716,10 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
{Token::Value::SUB, {Token::Value::SUB,
ast_factory.NewSmi(static_cast<uint32_t>(Smi::kMinValue)), 1, ast_factory.NewSmi(static_cast<uint32_t>(Smi::kMinValue)), 1,
isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0), isolate->factory()->NewHeapNumber(Smi::kMinValue - 1.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::SUB, ast_factory.NewNumber(3.1415), 2, {Token::Value::SUB, ast_factory.NewNumber(3.1415), 2,
isolate->factory()->NewHeapNumber(3.1415 - 2.0), isolate->factory()->NewHeapNumber(3.1415 - 2.0),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::SUB, {Token::Value::SUB,
ast_factory.NewString(ast_factory.GetOneByteString("2")), 2, ast_factory.NewString(ast_factory.GetOneByteString("2")), 2,
Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny},
...@@ -729,7 +729,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { ...@@ -729,7 +729,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
BinaryOperationFeedback::kSignedSmall}, BinaryOperationFeedback::kSignedSmall},
{Token::Value::BIT_OR, ast_factory.NewNumber(3.1415), 8, {Token::Value::BIT_OR, ast_factory.NewNumber(3.1415), 8,
Handle<Smi>(Smi::FromInt(11), isolate), Handle<Smi>(Smi::FromInt(11), isolate),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::BIT_OR, {Token::Value::BIT_OR,
ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, ast_factory.NewString(ast_factory.GetOneByteString("2")), 1,
Handle<Smi>(Smi::FromInt(3), isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::FromInt(3), isolate), BinaryOperationFeedback::kAny},
...@@ -738,8 +738,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { ...@@ -738,8 +738,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
Handle<Smi>(Smi::FromInt(1), isolate), Handle<Smi>(Smi::FromInt(1), isolate),
BinaryOperationFeedback::kSignedSmall}, BinaryOperationFeedback::kSignedSmall},
{Token::Value::BIT_AND, ast_factory.NewNumber(3.1415), 2, {Token::Value::BIT_AND, ast_factory.NewNumber(3.1415), 2,
Handle<Smi>(Smi::FromInt(2), isolate), Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kNumber},
BinaryOperationFeedback::kNumberOrOddball},
{Token::Value::BIT_AND, {Token::Value::BIT_AND,
ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, ast_factory.NewString(ast_factory.GetOneByteString("2")), 1,
Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny},
...@@ -749,7 +748,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { ...@@ -749,7 +748,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
BinaryOperationFeedback::kSignedSmall}, BinaryOperationFeedback::kSignedSmall},
{Token::Value::SHL, ast_factory.NewNumber(3.1415), 2, {Token::Value::SHL, ast_factory.NewNumber(3.1415), 2,
Handle<Smi>(Smi::FromInt(12), isolate), Handle<Smi>(Smi::FromInt(12), isolate),
BinaryOperationFeedback::kNumberOrOddball}, BinaryOperationFeedback::kNumber},
{Token::Value::SHL, {Token::Value::SHL,
ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, ast_factory.NewString(ast_factory.GetOneByteString("2")), 1,
Handle<Smi>(Smi::FromInt(4), isolate), BinaryOperationFeedback::kAny}, Handle<Smi>(Smi::FromInt(4), isolate), BinaryOperationFeedback::kAny},
...@@ -758,8 +757,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { ...@@ -758,8 +757,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
Handle<Smi>(Smi::FromInt(1), isolate), Handle<Smi>(Smi::FromInt(1), isolate),
BinaryOperationFeedback::kSignedSmall}, BinaryOperationFeedback::kSignedSmall},
{Token::Value::SAR, ast_factory.NewNumber(3.1415), 2, {Token::Value::SAR, ast_factory.NewNumber(3.1415), 2,
Handle<Smi>(Smi::kZero, isolate), Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kNumber},
BinaryOperationFeedback::kNumberOrOddball},
{Token::Value::SAR, {Token::Value::SAR,
ast_factory.NewString(ast_factory.GetOneByteString("2")), 1, ast_factory.NewString(ast_factory.GetOneByteString("2")), 1,
Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}}; Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}};
...@@ -856,12 +854,12 @@ TEST(InterpreterUnaryOpFeedback) { ...@@ -856,12 +854,12 @@ TEST(InterpreterUnaryOpFeedback) {
Object* feedback1 = callable.vector()->Get(slot1); Object* feedback1 = callable.vector()->Get(slot1);
CHECK(feedback1->IsSmi()); CHECK(feedback1->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kNumberOrOddball, CHECK_EQ(BinaryOperationFeedback::kNumber,
static_cast<Smi*>(feedback1)->value()); static_cast<Smi*>(feedback1)->value());
Object* feedback2 = callable.vector()->Get(slot2); Object* feedback2 = callable.vector()->Get(slot2);
CHECK(feedback2->IsSmi()); CHECK(feedback2->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kNumberOrOddball, CHECK_EQ(BinaryOperationFeedback::kNumber,
static_cast<Smi*>(feedback2)->value()); static_cast<Smi*>(feedback2)->value());
Object* feedback3 = callable.vector()->Get(slot3); Object* feedback3 = callable.vector()->Get(slot3);
...@@ -917,7 +915,7 @@ TEST(InterpreterBitwiseTypeFeedback) { ...@@ -917,7 +915,7 @@ TEST(InterpreterBitwiseTypeFeedback) {
Object* feedback1 = callable.vector()->Get(slot1); Object* feedback1 = callable.vector()->Get(slot1);
CHECK(feedback1->IsSmi()); CHECK(feedback1->IsSmi());
CHECK_EQ(BinaryOperationFeedback::kNumberOrOddball, CHECK_EQ(BinaryOperationFeedback::kNumber,
static_cast<Smi*>(feedback1)->value()); static_cast<Smi*>(feedback1)->value());
Object* feedback2 = callable.vector()->Get(slot2); Object* feedback2 = callable.vector()->Get(slot2);
......
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