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

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

Issue 2191883002: [turbofan] Adds speculative opcodes for shift right. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Really fix the merge conflicts. Created 4 years, 4 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 | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('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 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1685 } 1685 }
1686 case IrOpcode::kNumberShiftRight: { 1686 case IrOpcode::kNumberShiftRight: {
1687 Type* rhs_type = GetUpperBound(node->InputAt(1)); 1687 Type* rhs_type = GetUpperBound(node->InputAt(1));
1688 VisitBinop(node, UseInfo::TruncatingWord32(), 1688 VisitBinop(node, UseInfo::TruncatingWord32(),
1689 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32); 1689 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32);
1690 if (lower()) { 1690 if (lower()) {
1691 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type); 1691 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
1692 } 1692 }
1693 return; 1693 return;
1694 } 1694 }
1695 case IrOpcode::kSpeculativeNumberShiftRight: {
1696 // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we
1697 // can only eliminate an unused speculative number operation if we know
1698 // that the inputs are PlainPrimitive, which excludes everything that's
1699 // might have side effects or throws during a ToNumber conversion.
1700 if (BothInputsAre(node, Type::PlainPrimitive())) {
1701 if (truncation.IsUnused()) return VisitUnused(node);
1702 }
1703 if (BothInputsAre(node, Type::NumberOrOddball())) {
1704 Type* rhs_type = GetUpperBound(node->InputAt(1));
1705 VisitBinop(node, UseInfo::TruncatingWord32(),
1706 UseInfo::TruncatingWord32(),
1707 MachineRepresentation::kWord32);
1708 if (lower()) {
1709 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
1710 }
1711 return;
1712 }
1713 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1714 Type* rhs_type = GetUpperBound(node->InputAt(1));
1715 VisitBinop(node, hint == BinaryOperationHints::kNumberOrOddball
1716 ? UseInfo::CheckedNumberOrOddballAsWord32()
1717 : UseInfo::CheckedSigned32AsWord32(),
1718 MachineRepresentation::kWord32, Type::Signed32());
1719 if (lower()) {
1720 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
1721 }
1722 return;
1723 }
1695 case IrOpcode::kNumberShiftRightLogical: { 1724 case IrOpcode::kNumberShiftRightLogical: {
1696 Type* rhs_type = GetUpperBound(node->InputAt(1)); 1725 Type* rhs_type = GetUpperBound(node->InputAt(1));
1697 VisitBinop(node, UseInfo::TruncatingWord32(), 1726 VisitBinop(node, UseInfo::TruncatingWord32(),
1698 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32); 1727 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32);
1699 if (lower()) { 1728 if (lower()) {
1700 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); 1729 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
1701 } 1730 }
1702 return; 1731 return;
1703 } 1732 }
1733 case IrOpcode::kSpeculativeNumberShiftRightLogical: {
1734 // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we
1735 // can only eliminate an unused speculative number operation if we know
1736 // that the inputs are PlainPrimitive, which excludes everything that's
1737 // might have side effects or throws during a ToNumber conversion.
1738 if (BothInputsAre(node, Type::PlainPrimitive())) {
1739 if (truncation.IsUnused()) return VisitUnused(node);
1740 }
1741 if (BothInputsAre(node, Type::NumberOrOddball())) {
1742 Type* rhs_type = GetUpperBound(node->InputAt(1));
1743 VisitBinop(node, UseInfo::TruncatingWord32(),
1744 UseInfo::TruncatingWord32(),
1745 MachineRepresentation::kWord32);
1746 if (lower()) {
1747 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
1748 }
1749 return;
1750 }
1751 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
1752 Type* rhs_type = GetUpperBound(node->InputAt(1));
1753 VisitBinop(node, hint == BinaryOperationHints::kNumberOrOddball
1754 ? UseInfo::CheckedNumberOrOddballAsWord32()
1755 : UseInfo::CheckedSigned32AsWord32(),
1756 MachineRepresentation::kWord32, Type::Unsigned32());
1757 if (lower()) {
1758 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
1759 }
1760 return;
1761 }
1704 case IrOpcode::kNumberAbs: { 1762 case IrOpcode::kNumberAbs: {
1705 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { 1763 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) {
1706 VisitUnop(node, UseInfo::TruncatingWord32(), 1764 VisitUnop(node, UseInfo::TruncatingWord32(),
1707 MachineRepresentation::kWord32); 1765 MachineRepresentation::kWord32);
1708 if (lower()) DeferReplacement(node, node->InputAt(0)); 1766 if (lower()) DeferReplacement(node, node->InputAt(0));
1709 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32())) { 1767 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32())) {
1710 VisitUnop(node, UseInfo::TruncatingWord32(), 1768 VisitUnop(node, UseInfo::TruncatingWord32(),
1711 MachineRepresentation::kWord32); 1769 MachineRepresentation::kWord32);
1712 if (lower()) DeferReplacement(node, lowering->Int32Abs(node)); 1770 if (lower()) DeferReplacement(node, lowering->Int32Abs(node));
1713 } else if (TypeOf(node->InputAt(0)) 1771 } else if (TypeOf(node->InputAt(0))
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3572 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3515 Operator::kNoProperties); 3573 Operator::kNoProperties);
3516 to_number_operator_.set(common()->Call(desc)); 3574 to_number_operator_.set(common()->Call(desc));
3517 } 3575 }
3518 return to_number_operator_.get(); 3576 return to_number_operator_.get();
3519 } 3577 }
3520 3578
3521 } // namespace compiler 3579 } // namespace compiler
3522 } // namespace internal 3580 } // namespace internal
3523 } // namespace v8 3581 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698