| OLD | NEW |
| 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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 Node* is_tagged = jsgraph_->graph()->NewNode( | 912 Node* is_tagged = jsgraph_->graph()->NewNode( |
| 913 jsgraph_->machine()->WordAnd(), node->InputAt(0), | 913 jsgraph_->machine()->WordAnd(), node->InputAt(0), |
| 914 jsgraph_->IntPtrConstant(kSmiTagMask)); | 914 jsgraph_->IntPtrConstant(kSmiTagMask)); |
| 915 Node* is_smi = jsgraph_->graph()->NewNode( | 915 Node* is_smi = jsgraph_->graph()->NewNode( |
| 916 jsgraph_->machine()->WordEqual(), is_tagged, | 916 jsgraph_->machine()->WordEqual(), is_tagged, |
| 917 jsgraph_->IntPtrConstant(kSmiTag)); | 917 jsgraph_->IntPtrConstant(kSmiTag)); |
| 918 DeferReplacement(node, is_smi); | 918 DeferReplacement(node, is_smi); |
| 919 } | 919 } |
| 920 break; | 920 break; |
| 921 } | 921 } |
| 922 case IrOpcode::kObjectIsNonNegativeSmi: { | |
| 923 ProcessInput(node, 0, kMachAnyTagged); | |
| 924 SetOutput(node, kRepBit | kTypeBool); | |
| 925 if (lower()) { | |
| 926 Node* is_tagged = jsgraph_->graph()->NewNode( | |
| 927 jsgraph_->machine()->WordAnd(), node->InputAt(0), | |
| 928 jsgraph_->IntPtrConstant(kSmiTagMask)); | |
| 929 Node* is_smi = jsgraph_->graph()->NewNode( | |
| 930 jsgraph_->machine()->WordEqual(), is_tagged, | |
| 931 jsgraph_->IntPtrConstant(kSmiTag)); | |
| 932 Node* is_non_neg = jsgraph_->graph()->NewNode( | |
| 933 jsgraph_->machine()->IntLessThanOrEqual(), | |
| 934 jsgraph_->IntPtrConstant(0), node->InputAt(0)); | |
| 935 Node* is_non_neg_smi = jsgraph_->graph()->NewNode( | |
| 936 jsgraph_->machine()->Word32And(), is_smi, is_non_neg); | |
| 937 DeferReplacement(node, is_non_neg_smi); | |
| 938 } | |
| 939 break; | |
| 940 } | |
| 941 | 922 |
| 942 //------------------------------------------------------------------ | 923 //------------------------------------------------------------------ |
| 943 // Machine-level operators. | 924 // Machine-level operators. |
| 944 //------------------------------------------------------------------ | 925 //------------------------------------------------------------------ |
| 945 case IrOpcode::kLoad: { | 926 case IrOpcode::kLoad: { |
| 946 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 927 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
| 947 MachineTypeUnion tBase = kRepTagged | kMachPtr; | 928 MachineTypeUnion tBase = kRepTagged | kMachPtr; |
| 948 LoadRepresentation rep = OpParameter<LoadRepresentation>(node); | 929 LoadRepresentation rep = OpParameter<LoadRepresentation>(node); |
| 949 ProcessInput(node, 0, tBase); // pointer or object | 930 ProcessInput(node, 0, tBase); // pointer or object |
| 950 ProcessInput(node, 1, kMachIntPtr); // index | 931 ProcessInput(node, 1, kMachIntPtr); // index |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1657 | 1638 |
| 1658 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1639 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
| 1659 node->set_op(machine()->IntLessThanOrEqual()); | 1640 node->set_op(machine()->IntLessThanOrEqual()); |
| 1660 node->ReplaceInput(0, StringComparison(node, true)); | 1641 node->ReplaceInput(0, StringComparison(node, true)); |
| 1661 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1642 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
| 1662 } | 1643 } |
| 1663 | 1644 |
| 1664 } // namespace compiler | 1645 } // namespace compiler |
| 1665 } // namespace internal | 1646 } // namespace internal |
| 1666 } // namespace v8 | 1647 } // namespace v8 |
| OLD | NEW |