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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 ElementAccess access = ElementAccessOf(node->op()); | 692 ElementAccess access = ElementAccessOf(node->op()); |
693 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); | 693 ProcessInput(node, 0, changer_->TypeForBasePointer(access)); |
694 ProcessInput(node, 1, kMachInt32); // element index | 694 ProcessInput(node, 1, kMachInt32); // element index |
695 ProcessInput(node, 2, kMachInt32); // length | 695 ProcessInput(node, 2, kMachInt32); // length |
696 ProcessInput(node, 3, access.machine_type); | 696 ProcessInput(node, 3, access.machine_type); |
697 ProcessRemainingInputs(node, 4); | 697 ProcessRemainingInputs(node, 4); |
698 SetOutput(node, 0); | 698 SetOutput(node, 0); |
699 if (lower()) lowering->DoStoreElement(node); | 699 if (lower()) lowering->DoStoreElement(node); |
700 break; | 700 break; |
701 } | 701 } |
| 702 case IrOpcode::kObjectIsSmi: { |
| 703 ProcessInput(node, 0, kMachAnyTagged); |
| 704 SetOutput(node, kRepBit | kTypeBool); |
| 705 if (lower()) { |
| 706 Node* is_tagged = jsgraph_->graph()->NewNode( |
| 707 jsgraph_->machine()->WordAnd(), node->InputAt(0), |
| 708 jsgraph_->Int32Constant(static_cast<int>(kSmiTagMask))); |
| 709 Node* is_smi = jsgraph_->graph()->NewNode( |
| 710 jsgraph_->machine()->WordEqual(), is_tagged, |
| 711 jsgraph_->Int32Constant(kSmiTag)); |
| 712 DeferReplacement(node, is_smi); |
| 713 } |
| 714 break; |
| 715 } |
| 716 case IrOpcode::kObjectIsNonNegativeSmi: { |
| 717 ProcessInput(node, 0, kMachAnyTagged); |
| 718 SetOutput(node, kRepBit | kTypeBool); |
| 719 if (lower()) { |
| 720 Node* is_tagged = jsgraph_->graph()->NewNode( |
| 721 jsgraph_->machine()->WordAnd(), node->InputAt(0), |
| 722 jsgraph_->Int32Constant(static_cast<int>(kSmiTagMask))); |
| 723 Node* is_smi = jsgraph_->graph()->NewNode( |
| 724 jsgraph_->machine()->WordEqual(), is_tagged, |
| 725 jsgraph_->Int32Constant(kSmiTag)); |
| 726 Node* is_non_neg = jsgraph_->graph()->NewNode( |
| 727 jsgraph_->machine()->IntLessThanOrEqual(), |
| 728 jsgraph_->Int32Constant(0), node->InputAt(0)); |
| 729 Node* is_non_neg_smi = jsgraph_->graph()->NewNode( |
| 730 jsgraph_->machine()->Word32And(), is_smi, is_non_neg); |
| 731 DeferReplacement(node, is_non_neg_smi); |
| 732 } |
| 733 break; |
| 734 } |
702 | 735 |
703 //------------------------------------------------------------------ | 736 //------------------------------------------------------------------ |
704 // Machine-level operators. | 737 // Machine-level operators. |
705 //------------------------------------------------------------------ | 738 //------------------------------------------------------------------ |
706 case IrOpcode::kLoad: { | 739 case IrOpcode::kLoad: { |
707 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? | 740 // TODO(titzer): machine loads/stores need to know BaseTaggedness!? |
708 MachineTypeUnion tBase = kRepTagged | kMachPtr; | 741 MachineTypeUnion tBase = kRepTagged | kMachPtr; |
709 LoadRepresentation rep = OpParameter<LoadRepresentation>(node); | 742 LoadRepresentation rep = OpParameter<LoadRepresentation>(node); |
710 ProcessInput(node, 0, tBase); // pointer or object | 743 ProcessInput(node, 0, tBase); // pointer or object |
711 ProcessInput(node, 1, kMachInt32); // index | 744 ProcessInput(node, 1, kMachInt32); // index |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { | 1166 void SimplifiedLowering::DoStringLessThanOrEqual(Node* node) { |
1134 node->set_op(machine()->IntLessThanOrEqual()); | 1167 node->set_op(machine()->IntLessThanOrEqual()); |
1135 node->ReplaceInput(0, StringComparison(node, true)); | 1168 node->ReplaceInput(0, StringComparison(node, true)); |
1136 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); | 1169 node->ReplaceInput(1, jsgraph()->SmiConstant(EQUAL)); |
1137 } | 1170 } |
1138 | 1171 |
1139 | 1172 |
1140 } // namespace compiler | 1173 } // namespace compiler |
1141 } // namespace internal | 1174 } // namespace internal |
1142 } // namespace v8 | 1175 } // namespace v8 |
OLD | NEW |