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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2709423002: [compiler] Speculate a little more in SpeculativeShiftRightLogical. (Closed)
Patch Set: Created 3 years, 9 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 | test/mjsunit/compiler/shift-shr.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 return; 1979 return;
1980 } 1980 }
1981 case IrOpcode::kSpeculativeNumberShiftRightLogical: { 1981 case IrOpcode::kSpeculativeNumberShiftRightLogical: {
1982 // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we 1982 // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we
1983 // can only eliminate an unused speculative number operation if we know 1983 // can only eliminate an unused speculative number operation if we know
1984 // that the inputs are PlainPrimitive, which excludes everything that's 1984 // that the inputs are PlainPrimitive, which excludes everything that's
1985 // might have side effects or throws during a ToNumber conversion. 1985 // might have side effects or throws during a ToNumber conversion.
1986 if (BothInputsAre(node, Type::PlainPrimitive())) { 1986 if (BothInputsAre(node, Type::PlainPrimitive())) {
1987 if (truncation.IsUnused()) return VisitUnused(node); 1987 if (truncation.IsUnused()) return VisitUnused(node);
1988 } 1988 }
1989 NumberOperationHint hint = NumberOperationHintOf(node->op());
1990 Type* rhs_type = GetUpperBound(node->InputAt(1));
1991 STATIC_ASSERT(NumberOperationHint::kSignedSmall <=
1992 NumberOperationHint::kSigned32);
1993 if (rhs_type->Is(type_cache_.kZeroish) &&
1994 hint <= NumberOperationHint::kSigned32 &&
Jarin 2017/02/24 10:56:05 In other places, we say "if (hint == NumberOperati
1995 !truncation.IsUsedAsWord32()) {
1996 // The SignedSmall or Signed32 feedback means that the results that we
1997 // have seen so far were of type Unsigned31. We speculate that this
1998 // will continue to hold. Moreover, since the RHS is 0, the result
1999 // will just be the (converted) LHS.
2000 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
2001 MachineRepresentation::kWord32, Type::Unsigned31());
2002 if (lower()) {
2003 node->RemoveInput(1);
2004 NodeProperties::ChangeOp(node,
2005 simplified()->CheckedUint32ToInt32());
2006 }
2007 return;
2008 }
1989 if (BothInputsAre(node, Type::NumberOrOddball())) { 2009 if (BothInputsAre(node, Type::NumberOrOddball())) {
1990 Type* rhs_type = GetUpperBound(node->InputAt(1));
1991 VisitBinop(node, UseInfo::TruncatingWord32(), 2010 VisitBinop(node, UseInfo::TruncatingWord32(),
1992 UseInfo::TruncatingWord32(), 2011 UseInfo::TruncatingWord32(),
1993 MachineRepresentation::kWord32); 2012 MachineRepresentation::kWord32);
1994 if (lower()) { 2013 if (lower()) {
1995 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); 2014 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
1996 } 2015 }
1997 return; 2016 return;
1998 } 2017 }
1999 NumberOperationHint hint = NumberOperationHintOf(node->op());
2000 Type* rhs_type = GetUpperBound(node->InputAt(1));
2001 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), 2018 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
2002 MachineRepresentation::kWord32, Type::Unsigned32()); 2019 MachineRepresentation::kWord32, Type::Unsigned32());
2003 if (lower()) { 2020 if (lower()) {
2004 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); 2021 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
2005 } 2022 }
2006 return; 2023 return;
2007 } 2024 }
2008 case IrOpcode::kNumberAbs: { 2025 case IrOpcode::kNumberAbs: {
2009 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { 2026 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) {
2010 VisitUnop(node, UseInfo::TruncatingWord32(), 2027 VisitUnop(node, UseInfo::TruncatingWord32(),
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after
3516 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3533 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3517 Operator::kNoProperties); 3534 Operator::kNoProperties);
3518 to_number_operator_.set(common()->Call(desc)); 3535 to_number_operator_.set(common()->Call(desc));
3519 } 3536 }
3520 return to_number_operator_.get(); 3537 return to_number_operator_.get();
3521 } 3538 }
3522 3539
3523 } // namespace compiler 3540 } // namespace compiler
3524 } // namespace internal 3541 } // namespace internal
3525 } // namespace v8 3542 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/shift-shr.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698