Fix maybe_string_add for adds that have no type feedback where --always-opt is on.
R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/1071473003 Cr-Commit-Position: refs/heads/master@{#27667}
This commit is contained in:
parent
322cfb3589
commit
a511c78999
@ -10398,12 +10398,9 @@ HValue* HGraphBuilder::BuildBinaryOperation(
|
||||
Add<HDeoptimize>(
|
||||
Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation,
|
||||
Deoptimizer::SOFT);
|
||||
// TODO(rossberg): we should be able to get rid of non-continuous
|
||||
// defaults.
|
||||
left_type = Type::Any(zone());
|
||||
} else {
|
||||
if (!maybe_string_add) left = TruncateToNumber(left, &left_type);
|
||||
left_rep = Representation::FromType(left_type);
|
||||
maybe_string_add = op == Token::ADD;
|
||||
}
|
||||
|
||||
if (!right_type->IsInhabited()) {
|
||||
@ -10411,9 +10408,13 @@ HValue* HGraphBuilder::BuildBinaryOperation(
|
||||
Deoptimizer::kInsufficientTypeFeedbackForRHSOfBinaryOperation,
|
||||
Deoptimizer::SOFT);
|
||||
right_type = Type::Any(zone());
|
||||
} else {
|
||||
if (!maybe_string_add) right = TruncateToNumber(right, &right_type);
|
||||
right_rep = Representation::FromType(right_type);
|
||||
maybe_string_add = op == Token::ADD;
|
||||
}
|
||||
|
||||
if (!maybe_string_add) {
|
||||
left = TruncateToNumber(left, &left_type);
|
||||
right = TruncateToNumber(right, &right_type);
|
||||
}
|
||||
|
||||
// Special case for string addition here.
|
||||
|
26
test/mjsunit/compiler/generic-add.js
Normal file
26
test/mjsunit/compiler/generic-add.js
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2015 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
function dateL() {
|
||||
var date = new Date();
|
||||
return (date + true) == date.toString() + true;
|
||||
}
|
||||
|
||||
function dateR() {
|
||||
var date = new Date();
|
||||
return (true + date) == true + date.toString();
|
||||
}
|
||||
|
||||
function strL() {
|
||||
return (new String(1) + true) == "1true";
|
||||
}
|
||||
|
||||
function strR() {
|
||||
return (true + new String(1)) == "true1";
|
||||
}
|
||||
|
||||
assertTrue(dateL());
|
||||
assertTrue(dateR());
|
||||
assertTrue(strL());
|
||||
assertTrue(strR());
|
@ -33,11 +33,6 @@
|
||||
'intl402/11.2.3_b': [FAIL],
|
||||
'intl402/12.2.3_b': [FAIL],
|
||||
|
||||
# TODO(mstarzinger): Optimizing top-level code found some issues. Fix!
|
||||
'language/expressions/addition/S11.6.1_A2.2_T2': [PASS, NO_VARIANTS],
|
||||
'language/expressions/addition/S11.6.1_A3.2_T2.2': [PASS, NO_VARIANTS],
|
||||
'language/expressions/addition/S11.6.1_A3.2_T2.4': [PASS, NO_VARIANTS],
|
||||
|
||||
# Unicode canonicalization is not available with i18n turned off.
|
||||
'built-ins/String/prototype/localeCompare/15.5.4.9_CE': [['no_i18n', SKIP]],
|
||||
|
||||
|
@ -32,11 +32,6 @@
|
||||
|
||||
'15.5.4.9_CE': [['no_i18n', SKIP]],
|
||||
|
||||
# TODO(mstarzinger): Optimizing top-level code found some issues. Fix!
|
||||
'S11.6.1_A2.2_T2': [PASS, NO_VARIANTS],
|
||||
'S11.6.1_A3.2_T2.2': [PASS, NO_VARIANTS],
|
||||
'S11.6.1_A3.2_T2.4': [PASS, NO_VARIANTS],
|
||||
|
||||
# BUG(v8:3455)
|
||||
'11.2.3_b': [FAIL],
|
||||
'12.2.3_b': [FAIL],
|
||||
|
Loading…
Reference in New Issue
Block a user