OLD | NEW |
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 10380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10391 bool maybe_string_add = op == Token::ADD && | 10391 bool maybe_string_add = op == Token::ADD && |
10392 (left_type->Maybe(Type::String()) || | 10392 (left_type->Maybe(Type::String()) || |
10393 left_type->Maybe(Type::Receiver()) || | 10393 left_type->Maybe(Type::Receiver()) || |
10394 right_type->Maybe(Type::String()) || | 10394 right_type->Maybe(Type::String()) || |
10395 right_type->Maybe(Type::Receiver())); | 10395 right_type->Maybe(Type::Receiver())); |
10396 | 10396 |
10397 if (!left_type->IsInhabited()) { | 10397 if (!left_type->IsInhabited()) { |
10398 Add<HDeoptimize>( | 10398 Add<HDeoptimize>( |
10399 Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation, | 10399 Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation, |
10400 Deoptimizer::SOFT); | 10400 Deoptimizer::SOFT); |
10401 // TODO(rossberg): we should be able to get rid of non-continuous | |
10402 // defaults. | |
10403 left_type = Type::Any(zone()); | 10401 left_type = Type::Any(zone()); |
10404 } else { | |
10405 if (!maybe_string_add) left = TruncateToNumber(left, &left_type); | |
10406 left_rep = Representation::FromType(left_type); | 10402 left_rep = Representation::FromType(left_type); |
| 10403 maybe_string_add = op == Token::ADD; |
10407 } | 10404 } |
10408 | 10405 |
10409 if (!right_type->IsInhabited()) { | 10406 if (!right_type->IsInhabited()) { |
10410 Add<HDeoptimize>( | 10407 Add<HDeoptimize>( |
10411 Deoptimizer::kInsufficientTypeFeedbackForRHSOfBinaryOperation, | 10408 Deoptimizer::kInsufficientTypeFeedbackForRHSOfBinaryOperation, |
10412 Deoptimizer::SOFT); | 10409 Deoptimizer::SOFT); |
10413 right_type = Type::Any(zone()); | 10410 right_type = Type::Any(zone()); |
10414 } else { | |
10415 if (!maybe_string_add) right = TruncateToNumber(right, &right_type); | |
10416 right_rep = Representation::FromType(right_type); | 10411 right_rep = Representation::FromType(right_type); |
| 10412 maybe_string_add = op == Token::ADD; |
| 10413 } |
| 10414 |
| 10415 if (!maybe_string_add) { |
| 10416 left = TruncateToNumber(left, &left_type); |
| 10417 right = TruncateToNumber(right, &right_type); |
10417 } | 10418 } |
10418 | 10419 |
10419 // Special case for string addition here. | 10420 // Special case for string addition here. |
10420 if (op == Token::ADD && | 10421 if (op == Token::ADD && |
10421 (left_type->Is(Type::String()) || right_type->Is(Type::String()))) { | 10422 (left_type->Is(Type::String()) || right_type->Is(Type::String()))) { |
10422 // Validate type feedback for left argument. | 10423 // Validate type feedback for left argument. |
10423 if (left_type->Is(Type::String())) { | 10424 if (left_type->Is(Type::String())) { |
10424 left = BuildCheckString(left); | 10425 left = BuildCheckString(left); |
10425 } | 10426 } |
10426 | 10427 |
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12921 if (ShouldProduceTraceOutput()) { | 12922 if (ShouldProduceTraceOutput()) { |
12922 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12923 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12923 } | 12924 } |
12924 | 12925 |
12925 #ifdef DEBUG | 12926 #ifdef DEBUG |
12926 graph_->Verify(false); // No full verify. | 12927 graph_->Verify(false); // No full verify. |
12927 #endif | 12928 #endif |
12928 } | 12929 } |
12929 | 12930 |
12930 } } // namespace v8::internal | 12931 } } // namespace v8::internal |
OLD | NEW |