Reviewers: Toon Verwaest,
Message:
PTAL
Description:
When adding constant string with something unknown, assume it's a string.
Please review this at https://codereview.chromium.org/1122823002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+21, -6 lines):
M src/hydrogen.cc
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,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.