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 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 if (lower()) DeferReplacement(node, node->InputAt(0)); | 1439 if (lower()) DeferReplacement(node, node->InputAt(0)); |
1440 return; | 1440 return; |
1441 } | 1441 } |
1442 case IrOpcode::kNumberToUint32: { | 1442 case IrOpcode::kNumberToUint32: { |
1443 // Just change representation if necessary. | 1443 // Just change representation if necessary. |
1444 VisitUnop(node, UseInfo::TruncatingWord32(), | 1444 VisitUnop(node, UseInfo::TruncatingWord32(), |
1445 MachineRepresentation::kWord32); | 1445 MachineRepresentation::kWord32); |
1446 if (lower()) DeferReplacement(node, node->InputAt(0)); | 1446 if (lower()) DeferReplacement(node, node->InputAt(0)); |
1447 return; | 1447 return; |
1448 } | 1448 } |
1449 case IrOpcode::kNumberIsHoleNaN: { | |
1450 VisitUnop(node, UseInfo::TruncatingFloat64(), | |
1451 MachineRepresentation::kBit); | |
1452 if (lower()) { | |
1453 // NumberIsHoleNaN(x) => Word32Equal(Float64ExtractHighWord32(x), | |
1454 // #HoleNanUpper32) | |
1455 node->ReplaceInput( | |
1456 0, jsgraph_->graph()->NewNode( | |
1457 lowering->machine()->Float64ExtractHighWord32(), | |
1458 node->InputAt(0))); | |
1459 node->AppendInput(jsgraph_->zone(), | |
1460 jsgraph_->Int32Constant(kHoleNanUpper32)); | |
1461 NodeProperties::ChangeOp(node, jsgraph_->machine()->Word32Equal()); | |
1462 } | |
1463 return; | |
1464 } | |
1465 case IrOpcode::kNumberConvertHoleNaN: { | |
1466 if (truncation.TruncatesToFloat64()) { | |
1467 // NumberConvertHoleNaN(x) => x | |
1468 VisitUnop(node, UseInfo::TruncatingFloat64(), | |
1469 MachineRepresentation::kFloat64); | |
1470 if (lower()) DeferReplacement(node, node->InputAt(0)); | |
1471 } else { | |
1472 VisitUnop(node, UseInfo::TruncatingFloat64(), | |
1473 MachineRepresentation::kTagged); | |
1474 if (lower()) { | |
1475 // NumberConvertHoleNaN(x) => | |
1476 // Select(Word32Equal(Float64ExtractHighWord32(x), | |
1477 // #HoleNanUpper32), | |
1478 // #Undefined, | |
1479 // ChangeFloat64ToTagged(x)) | |
1480 Node* value = node->InputAt(0); | |
1481 node->ReplaceInput( | |
1482 0, | |
1483 jsgraph_->graph()->NewNode( | |
1484 jsgraph_->machine()->Word32Equal(), | |
1485 jsgraph_->graph()->NewNode( | |
1486 jsgraph_->machine()->Float64ExtractHighWord32(), value), | |
1487 jsgraph_->Int32Constant(kHoleNanUpper32))); | |
1488 node->AppendInput(jsgraph_->zone(), jsgraph_->UndefinedConstant()); | |
1489 node->AppendInput( | |
1490 jsgraph_->zone(), | |
1491 jsgraph_->graph()->NewNode( | |
1492 jsgraph_->simplified()->ChangeFloat64ToTagged(), value)); | |
1493 NodeProperties::ChangeOp( | |
1494 node, jsgraph_->common()->Select(MachineRepresentation::kTagged, | |
1495 BranchHint::kFalse)); | |
1496 } | |
1497 } | |
1498 return; | |
1499 } | |
1500 case IrOpcode::kReferenceEqual: { | 1449 case IrOpcode::kReferenceEqual: { |
1501 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); | 1450 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); |
1502 if (lower()) { | 1451 if (lower()) { |
1503 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); | 1452 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); |
1504 } | 1453 } |
1505 return; | 1454 return; |
1506 } | 1455 } |
1507 case IrOpcode::kStringEqual: { | 1456 case IrOpcode::kStringEqual: { |
1508 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); | 1457 VisitBinop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); |
1509 if (lower()) { | 1458 if (lower()) { |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 case IrOpcode::kObjectIsCallable: | 1680 case IrOpcode::kObjectIsCallable: |
1732 case IrOpcode::kObjectIsNumber: | 1681 case IrOpcode::kObjectIsNumber: |
1733 case IrOpcode::kObjectIsReceiver: | 1682 case IrOpcode::kObjectIsReceiver: |
1734 case IrOpcode::kObjectIsSmi: | 1683 case IrOpcode::kObjectIsSmi: |
1735 case IrOpcode::kObjectIsString: | 1684 case IrOpcode::kObjectIsString: |
1736 case IrOpcode::kObjectIsUndetectable: { | 1685 case IrOpcode::kObjectIsUndetectable: { |
1737 ProcessInput(node, 0, UseInfo::AnyTagged()); | 1686 ProcessInput(node, 0, UseInfo::AnyTagged()); |
1738 SetOutput(node, MachineRepresentation::kBit); | 1687 SetOutput(node, MachineRepresentation::kBit); |
1739 return; | 1688 return; |
1740 } | 1689 } |
| 1690 case IrOpcode::kCheckFloat64Hole: { |
| 1691 CheckFloat64HoleMode mode = CheckFloat64HoleModeOf(node->op()); |
| 1692 ProcessInput(node, 0, UseInfo::TruncatingFloat64()); |
| 1693 ProcessRemainingInputs(node, 1); |
| 1694 SetOutput(node, MachineRepresentation::kFloat64); |
| 1695 if (truncation.TruncatesToFloat64() && |
| 1696 mode == CheckFloat64HoleMode::kAllowReturnHole) { |
| 1697 if (lower()) DeferReplacement(node, node->InputAt(0)); |
| 1698 } |
| 1699 return; |
| 1700 } |
| 1701 case IrOpcode::kCheckTaggedHole: { |
| 1702 ProcessInput(node, 0, UseInfo::AnyTagged()); |
| 1703 ProcessRemainingInputs(node, 1); |
| 1704 SetOutput(node, MachineRepresentation::kTagged); |
| 1705 return; |
| 1706 } |
1741 | 1707 |
1742 //------------------------------------------------------------------ | 1708 //------------------------------------------------------------------ |
1743 // Machine-level operators. | 1709 // Machine-level operators. |
1744 //------------------------------------------------------------------ | 1710 //------------------------------------------------------------------ |
1745 case IrOpcode::kLoad: { | 1711 case IrOpcode::kLoad: { |
1746 // TODO(jarin) Eventually, we should get rid of all machine stores | 1712 // TODO(jarin) Eventually, we should get rid of all machine stores |
1747 // from the high-level phases, then this becomes UNREACHABLE. | 1713 // from the high-level phases, then this becomes UNREACHABLE. |
1748 LoadRepresentation rep = LoadRepresentationOf(node->op()); | 1714 LoadRepresentation rep = LoadRepresentationOf(node->op()); |
1749 ProcessInput(node, 0, UseInfo::AnyTagged()); // tagged pointer | 1715 ProcessInput(node, 0, UseInfo::AnyTagged()); // tagged pointer |
1750 ProcessInput(node, 1, UseInfo::PointerInt()); // index | 1716 ProcessInput(node, 1, UseInfo::PointerInt()); // index |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2918 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 2884 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
2919 Operator::kNoProperties); | 2885 Operator::kNoProperties); |
2920 to_number_operator_.set(common()->Call(desc)); | 2886 to_number_operator_.set(common()->Call(desc)); |
2921 } | 2887 } |
2922 return to_number_operator_.get(); | 2888 return to_number_operator_.get(); |
2923 } | 2889 } |
2924 | 2890 |
2925 } // namespace compiler | 2891 } // namespace compiler |
2926 } // namespace internal | 2892 } // namespace internal |
2927 } // namespace v8 | 2893 } // namespace v8 |
OLD | NEW |