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

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

Issue 2201073002: [turbofan] Adds speculative operator for bitwise and, or and xor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Handles kSigned32 feedback. 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/representation-change.cc ('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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 769 }
770 SetOutput(node, output, restriction_type); 770 SetOutput(node, output, restriction_type);
771 } 771 }
772 772
773 // Helper for binops of the I x I -> O variety. 773 // Helper for binops of the I x I -> O variety.
774 void VisitBinop(Node* node, UseInfo input_use, MachineRepresentation output, 774 void VisitBinop(Node* node, UseInfo input_use, MachineRepresentation output,
775 Type* restriction_type = Type::Any()) { 775 Type* restriction_type = Type::Any()) {
776 VisitBinop(node, input_use, input_use, output, restriction_type); 776 VisitBinop(node, input_use, input_use, output, restriction_type);
777 } 777 }
778 778
779 void VisitSpeculativeInt32Binop(Node* node) {
780 DCHECK_EQ(2, node->op()->ValueInputCount());
781 if (BothInputsAre(node, Type::NumberOrOddball())) {
782 return VisitBinop(node, UseInfo::TruncatingWord32(),
783 MachineRepresentation::kWord32);
784 }
785 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op());
786 if (hint == BinaryOperationHints::kSignedSmall ||
787 hint == BinaryOperationHints::kSigned32) {
788 return VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
789 MachineRepresentation::kWord32);
790 }
791 DCHECK_EQ(BinaryOperationHints::kNumberOrOddball, hint);
792 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsWord32(),
793 MachineRepresentation::kWord32, Type::Signed32());
794 }
795
779 // Helper for unops of the I -> O variety. 796 // Helper for unops of the I -> O variety.
780 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) { 797 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) {
781 DCHECK_EQ(1, node->op()->ValueInputCount()); 798 DCHECK_EQ(1, node->op()->ValueInputCount());
782 ProcessInput(node, 0, input_use); 799 ProcessInput(node, 0, input_use);
783 ProcessRemainingInputs(node, 1); 800 ProcessRemainingInputs(node, 1);
784 SetOutput(node, output); 801 SetOutput(node, output);
785 } 802 }
786 803
787 // Helper for leaf nodes. 804 // Helper for leaf nodes.
788 void VisitLeaf(Node* node, MachineRepresentation output) { 805 void VisitLeaf(Node* node, MachineRepresentation output) {
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1676 if (lower()) ChangeToPureOp(node, Float64Op(node));
1660 return; 1677 return;
1661 } 1678 }
1662 case IrOpcode::kNumberBitwiseOr: 1679 case IrOpcode::kNumberBitwiseOr:
1663 case IrOpcode::kNumberBitwiseXor: 1680 case IrOpcode::kNumberBitwiseXor:
1664 case IrOpcode::kNumberBitwiseAnd: { 1681 case IrOpcode::kNumberBitwiseAnd: {
1665 VisitInt32Binop(node); 1682 VisitInt32Binop(node);
1666 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); 1683 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
1667 return; 1684 return;
1668 } 1685 }
1686 case IrOpcode::kSpeculativeNumberBitwiseOr:
1687 case IrOpcode::kSpeculativeNumberBitwiseXor:
1688 case IrOpcode::kSpeculativeNumberBitwiseAnd:
1689 VisitSpeculativeInt32Binop(node);
1690 if (lower()) {
1691 ChangeToPureOp(node, Int32Op(node));
1692 }
1693 return;
1669 case IrOpcode::kNumberShiftLeft: { 1694 case IrOpcode::kNumberShiftLeft: {
1670 Type* rhs_type = GetUpperBound(node->InputAt(1)); 1695 Type* rhs_type = GetUpperBound(node->InputAt(1));
1671 VisitBinop(node, UseInfo::TruncatingWord32(), 1696 VisitBinop(node, UseInfo::TruncatingWord32(),
1672 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32); 1697 UseInfo::TruncatingWord32(), MachineRepresentation::kWord32);
1673 if (lower()) { 1698 if (lower()) {
1674 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type); 1699 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type);
1675 } 1700 }
1676 return; 1701 return;
1677 } 1702 }
1678 case IrOpcode::kSpeculativeNumberShiftLeft: { 1703 case IrOpcode::kSpeculativeNumberShiftLeft: {
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after
3617 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3642 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3618 Operator::kNoProperties); 3643 Operator::kNoProperties);
3619 to_number_operator_.set(common()->Call(desc)); 3644 to_number_operator_.set(common()->Call(desc));
3620 } 3645 }
3621 return to_number_operator_.get(); 3646 return to_number_operator_.get();
3622 } 3647 }
3623 3648
3624 } // namespace compiler 3649 } // namespace compiler
3625 } // namespace internal 3650 } // namespace internal
3626 } // namespace v8 3651 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698