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/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 //------------------------------------------------------------------ | 1524 //------------------------------------------------------------------ |
1525 // Simplified operators. | 1525 // Simplified operators. |
1526 //------------------------------------------------------------------ | 1526 //------------------------------------------------------------------ |
1527 case IrOpcode::kBooleanNot: { | 1527 case IrOpcode::kBooleanNot: { |
1528 if (lower()) { | 1528 if (lower()) { |
1529 NodeInfo* input_info = GetInfo(node->InputAt(0)); | 1529 NodeInfo* input_info = GetInfo(node->InputAt(0)); |
1530 if (input_info->representation() == MachineRepresentation::kBit) { | 1530 if (input_info->representation() == MachineRepresentation::kBit) { |
1531 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) | 1531 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) |
1532 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); | 1532 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); |
1533 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); | 1533 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); |
1534 } else if (CanBeTaggedPointer(input_info->representation())) { | 1534 } else { |
| 1535 DCHECK(CanBeTaggedPointer(input_info->representation())); |
1535 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) | 1536 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) |
1536 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant()); | 1537 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant()); |
1537 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); | 1538 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); |
1538 } else { | |
1539 DCHECK_EQ(MachineRepresentation::kNone, | |
1540 input_info->representation()); | |
1541 DeferReplacement(node, lowering->jsgraph()->Int32Constant(0)); | |
1542 } | 1539 } |
1543 } else { | 1540 } else { |
1544 // No input representation requirement; adapt during lowering. | 1541 // No input representation requirement; adapt during lowering. |
1545 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool()); | 1542 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool()); |
1546 SetOutput(node, MachineRepresentation::kBit); | 1543 SetOutput(node, MachineRepresentation::kBit); |
1547 } | 1544 } |
1548 return; | 1545 return; |
1549 } | 1546 } |
1550 case IrOpcode::kNumberEqual: { | 1547 case IrOpcode::kNumberEqual: { |
1551 Type* const lhs_type = TypeOf(node->InputAt(0)); | 1548 Type* const lhs_type = TypeOf(node->InputAt(0)); |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 2772 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
2776 return; | 2773 return; |
2777 case IrOpcode::kStateValues: | 2774 case IrOpcode::kStateValues: |
2778 return VisitStateValues(node); | 2775 return VisitStateValues(node); |
2779 case IrOpcode::kObjectState: | 2776 case IrOpcode::kObjectState: |
2780 return VisitObjectState(node); | 2777 return VisitObjectState(node); |
2781 case IrOpcode::kTypeGuard: { | 2778 case IrOpcode::kTypeGuard: { |
2782 // We just get rid of the sigma here. In principle, it should be | 2779 // We just get rid of the sigma here. In principle, it should be |
2783 // possible to refine the truncation and representation based on | 2780 // possible to refine the truncation and representation based on |
2784 // the sigma's type. | 2781 // the sigma's type. |
2785 | |
2786 // For now, we just handle specially the impossible case. | |
2787 MachineRepresentation output = | 2782 MachineRepresentation output = |
2788 TypeOf(node)->IsInhabited() | 2783 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); |
2789 ? GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), | |
2790 truncation) | |
2791 : MachineRepresentation::kNone; | |
2792 VisitUnop(node, UseInfo(output, truncation), output); | 2784 VisitUnop(node, UseInfo(output, truncation), output); |
2793 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2785 if (lower()) DeferReplacement(node, node->InputAt(0)); |
2794 return; | 2786 return; |
2795 } | 2787 } |
2796 | 2788 |
2797 case IrOpcode::kOsrGuard: | 2789 case IrOpcode::kOsrGuard: |
2798 return VisitOsrGuard(node); | 2790 return VisitOsrGuard(node); |
2799 | 2791 |
2800 case IrOpcode::kFinishRegion: | 2792 case IrOpcode::kFinishRegion: |
2801 VisitInputs(node); | 2793 VisitInputs(node); |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3683 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3675 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3684 Operator::kNoProperties); | 3676 Operator::kNoProperties); |
3685 to_number_operator_.set(common()->Call(desc)); | 3677 to_number_operator_.set(common()->Call(desc)); |
3686 } | 3678 } |
3687 return to_number_operator_.get(); | 3679 return to_number_operator_.get(); |
3688 } | 3680 } |
3689 | 3681 |
3690 } // namespace compiler | 3682 } // namespace compiler |
3691 } // namespace internal | 3683 } // namespace internal |
3692 } // namespace v8 | 3684 } // namespace v8 |
OLD | NEW |