Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Side by Side Diff: src/hydrogen.cc

Issue 1122823002: When adding constant string with something unknown, assume it's a string. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 10592 matching lines...) Expand 10 before | Expand all | Expand 10 after
10603 HValue* HGraphBuilder::BuildBinaryOperation( 10603 HValue* HGraphBuilder::BuildBinaryOperation(
10604 Token::Value op, 10604 Token::Value op,
10605 HValue* left, 10605 HValue* left,
10606 HValue* right, 10606 HValue* right,
10607 Type* left_type, 10607 Type* left_type,
10608 Type* right_type, 10608 Type* right_type,
10609 Type* result_type, 10609 Type* result_type,
10610 Maybe<int> fixed_right_arg, 10610 Maybe<int> fixed_right_arg,
10611 HAllocationMode allocation_mode, 10611 HAllocationMode allocation_mode,
10612 LanguageMode language_mode) { 10612 LanguageMode language_mode) {
10613 bool maybe_string_add = false;
10614 if (op == Token::ADD) {
10615 // If we are adding constant string with something for which we don't have
10616 // a feedback yet, assume that it's also going to be a string and don't
10617 // generate deopt instructions.
10618 if (!left_type->IsInhabited() && right->IsConstant() &&
10619 HConstant::cast(right)->HasStringValue()) {
10620 left_type = Type::String();
10621 }
10622
10623 if (!right_type->IsInhabited() && left->IsConstant() &&
10624 HConstant::cast(left)->HasStringValue()) {
10625 right_type = Type::String();
10626 }
10627
10628 maybe_string_add = (left_type->Maybe(Type::String()) ||
10629 left_type->Maybe(Type::Receiver()) ||
10630 right_type->Maybe(Type::String()) ||
10631 right_type->Maybe(Type::Receiver()));
10632 }
10633
10613 Representation left_rep = RepresentationFor(left_type); 10634 Representation left_rep = RepresentationFor(left_type);
10614 Representation right_rep = RepresentationFor(right_type); 10635 Representation right_rep = RepresentationFor(right_type);
10615 10636
10616 bool maybe_string_add = op == Token::ADD &&
10617 (left_type->Maybe(Type::String()) ||
10618 left_type->Maybe(Type::Receiver()) ||
10619 right_type->Maybe(Type::String()) ||
10620 right_type->Maybe(Type::Receiver()));
10621
10622 if (!left_type->IsInhabited()) { 10637 if (!left_type->IsInhabited()) {
10623 Add<HDeoptimize>( 10638 Add<HDeoptimize>(
10624 Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation, 10639 Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation,
10625 is_strong(language_mode) ? Deoptimizer::EAGER : Deoptimizer::SOFT); 10640 is_strong(language_mode) ? Deoptimizer::EAGER : Deoptimizer::SOFT);
10626 left_type = Type::Any(zone()); 10641 left_type = Type::Any(zone());
10627 left_rep = RepresentationFor(left_type); 10642 left_rep = RepresentationFor(left_type);
10628 maybe_string_add = op == Token::ADD; 10643 maybe_string_add = op == Token::ADD;
10629 } 10644 }
10630 10645
10631 if (!right_type->IsInhabited()) { 10646 if (!right_type->IsInhabited()) {
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after
13129 if (ShouldProduceTraceOutput()) { 13144 if (ShouldProduceTraceOutput()) {
13130 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13145 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13131 } 13146 }
13132 13147
13133 #ifdef DEBUG 13148 #ifdef DEBUG
13134 graph_->Verify(false); // No full verify. 13149 graph_->Verify(false); // No full verify.
13135 #endif 13150 #endif
13136 } 13151 }
13137 13152
13138 } } // namespace v8::internal 13153 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698