Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 9bdc070300512b44f0c6ea5ba292b8530655ef9f..603b1fa62b6ece1728037c045f9795fe37537072 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -10610,15 +10610,30 @@ HValue* HGraphBuilder::BuildBinaryOperation( |
Maybe<int> fixed_right_arg, |
HAllocationMode allocation_mode, |
LanguageMode language_mode) { |
+ bool maybe_string_add = false; |
+ if (op == Token::ADD) { |
+ // If we are adding constant string with something for which we don't have |
+ // a feedback yet, assume that it's also going to be a string and don't |
+ // generate deopt instructions. |
+ if (!left_type->IsInhabited() && right->IsConstant() && |
+ HConstant::cast(right)->HasStringValue()) { |
+ left_type = Type::String(); |
+ } |
+ |
+ if (!right_type->IsInhabited() && left->IsConstant() && |
+ HConstant::cast(left)->HasStringValue()) { |
+ right_type = Type::String(); |
+ } |
+ |
+ maybe_string_add = (left_type->Maybe(Type::String()) || |
+ left_type->Maybe(Type::Receiver()) || |
+ right_type->Maybe(Type::String()) || |
+ right_type->Maybe(Type::Receiver())); |
+ } |
+ |
Representation left_rep = RepresentationFor(left_type); |
Representation right_rep = RepresentationFor(right_type); |
- bool maybe_string_add = op == Token::ADD && |
- (left_type->Maybe(Type::String()) || |
- left_type->Maybe(Type::Receiver()) || |
- right_type->Maybe(Type::String()) || |
- right_type->Maybe(Type::Receiver())); |
- |
if (!left_type->IsInhabited()) { |
Add<HDeoptimize>( |
Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation, |