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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return MachineRepresentation::kWord32; | 80 return MachineRepresentation::kWord32; |
81 case kExternalFloat32Array: | 81 case kExternalFloat32Array: |
82 return MachineRepresentation::kFloat32; | 82 return MachineRepresentation::kFloat32; |
83 case kExternalFloat64Array: | 83 case kExternalFloat64Array: |
84 return MachineRepresentation::kFloat64; | 84 return MachineRepresentation::kFloat64; |
85 } | 85 } |
86 UNREACHABLE(); | 86 UNREACHABLE(); |
87 return MachineRepresentation::kNone; | 87 return MachineRepresentation::kNone; |
88 } | 88 } |
89 | 89 |
90 UseInfo CheckedUseInfoAsWord32FromHint(BinaryOperationHints::Hint hint) { | 90 UseInfo CheckedUseInfoAsWord32FromHint(NumberOperationHint hint) { |
91 switch (hint) { | 91 switch (hint) { |
92 case BinaryOperationHints::kSignedSmall: | 92 case NumberOperationHint::kSignedSmall: |
93 return UseInfo::CheckedSignedSmallAsWord32(); | 93 return UseInfo::CheckedSignedSmallAsWord32(); |
94 case BinaryOperationHints::kSigned32: | 94 case NumberOperationHint::kSigned32: |
95 return UseInfo::CheckedSigned32AsWord32(); | 95 return UseInfo::CheckedSigned32AsWord32(); |
96 case BinaryOperationHints::kNumberOrOddball: | 96 case NumberOperationHint::kNumberOrOddball: |
97 return UseInfo::CheckedNumberOrOddballAsWord32(); | 97 return UseInfo::CheckedNumberOrOddballAsWord32(); |
98 case BinaryOperationHints::kNone: | |
99 case BinaryOperationHints::kString: | |
100 case BinaryOperationHints::kAny: | |
101 break; | |
102 } | 98 } |
103 UNREACHABLE(); | 99 UNREACHABLE(); |
104 return UseInfo::None(); | 100 return UseInfo::None(); |
105 } | 101 } |
106 | 102 |
107 UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { | 103 UseInfo TruncatingUseInfoFromRepresentation(MachineRepresentation rep) { |
108 switch (rep) { | 104 switch (rep) { |
109 case MachineRepresentation::kTagged: | 105 case MachineRepresentation::kTagged: |
110 return UseInfo::AnyTagged(); | 106 return UseInfo::AnyTagged(); |
111 case MachineRepresentation::kFloat64: | 107 case MachineRepresentation::kFloat64: |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 Type* restriction_type = Type::Any()) { | 753 Type* restriction_type = Type::Any()) { |
758 VisitBinop(node, input_use, input_use, output, restriction_type); | 754 VisitBinop(node, input_use, input_use, output, restriction_type); |
759 } | 755 } |
760 | 756 |
761 void VisitSpeculativeInt32Binop(Node* node) { | 757 void VisitSpeculativeInt32Binop(Node* node) { |
762 DCHECK_EQ(2, node->op()->ValueInputCount()); | 758 DCHECK_EQ(2, node->op()->ValueInputCount()); |
763 if (BothInputsAre(node, Type::NumberOrOddball())) { | 759 if (BothInputsAre(node, Type::NumberOrOddball())) { |
764 return VisitBinop(node, UseInfo::TruncatingWord32(), | 760 return VisitBinop(node, UseInfo::TruncatingWord32(), |
765 MachineRepresentation::kWord32); | 761 MachineRepresentation::kWord32); |
766 } | 762 } |
767 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 763 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
768 return VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 764 return VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
769 MachineRepresentation::kWord32); | 765 MachineRepresentation::kWord32); |
770 } | 766 } |
771 | 767 |
772 // Helper for unops of the I -> O variety. | 768 // Helper for unops of the I -> O variety. |
773 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) { | 769 void VisitUnop(Node* node, UseInfo input_use, MachineRepresentation output) { |
774 DCHECK_EQ(1, node->op()->ValueInputCount()); | 770 DCHECK_EQ(1, node->op()->ValueInputCount()); |
775 ProcessInput(node, 0, input_use); | 771 ProcessInput(node, 0, input_use); |
776 ProcessRemainingInputs(node, 1); | 772 ProcessRemainingInputs(node, 1); |
777 SetOutput(node, output); | 773 SetOutput(node, output); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) && | 1116 if (BothInputsAre(node, type_cache_.kAdditiveSafeIntegerOrMinusZero) && |
1121 truncation.IsUsedAsWord32()) { | 1117 truncation.IsUsedAsWord32()) { |
1122 // safe-int + safe-int = x (truncated to int32) | 1118 // safe-int + safe-int = x (truncated to int32) |
1123 // => signed Int32Add/Sub (truncated) | 1119 // => signed Int32Add/Sub (truncated) |
1124 VisitWord32TruncatingBinop(node); | 1120 VisitWord32TruncatingBinop(node); |
1125 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1121 if (lower()) ChangeToPureOp(node, Int32Op(node)); |
1126 return; | 1122 return; |
1127 } | 1123 } |
1128 | 1124 |
1129 // Try to use type feedback. | 1125 // Try to use type feedback. |
1130 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1126 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1131 | 1127 |
1132 // Handle the case when no int32 checks on inputs are necessary | 1128 // Handle the case when no int32 checks on inputs are necessary |
1133 // (but an overflow check is needed on the output). | 1129 // (but an overflow check is needed on the output). |
1134 if (BothInputsAre(node, Type::Signed32()) || | 1130 if (BothInputsAre(node, Type::Signed32()) || |
1135 (BothInputsAre(node, Type::Signed32OrMinusZero()) && | 1131 (BothInputsAre(node, Type::Signed32OrMinusZero()) && |
1136 NodeProperties::GetType(node)->Is(type_cache_.kSafeInteger))) { | 1132 NodeProperties::GetType(node)->Is(type_cache_.kSafeInteger))) { |
1137 // If both the inputs the feedback are int32, use the overflow op. | 1133 // If both the inputs the feedback are int32, use the overflow op. |
1138 if (hint == BinaryOperationHints::kSignedSmall || | 1134 if (hint == NumberOperationHint::kSignedSmall || |
1139 hint == BinaryOperationHints::kSigned32) { | 1135 hint == NumberOperationHint::kSigned32) { |
1140 VisitBinop(node, UseInfo::TruncatingWord32(), | 1136 VisitBinop(node, UseInfo::TruncatingWord32(), |
1141 MachineRepresentation::kWord32, Type::Signed32()); | 1137 MachineRepresentation::kWord32, Type::Signed32()); |
1142 if (lower()) ChangeToInt32OverflowOp(node); | 1138 if (lower()) ChangeToInt32OverflowOp(node); |
1143 return; | 1139 return; |
1144 } | 1140 } |
1145 } | 1141 } |
1146 | 1142 |
1147 if (hint == BinaryOperationHints::kSignedSmall || | 1143 if (hint == NumberOperationHint::kSignedSmall || |
1148 hint == BinaryOperationHints::kSigned32) { | 1144 hint == NumberOperationHint::kSigned32) { |
1149 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1145 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1150 MachineRepresentation::kWord32, Type::Signed32()); | 1146 MachineRepresentation::kWord32, Type::Signed32()); |
1151 if (lower()) ChangeToInt32OverflowOp(node); | 1147 if (lower()) ChangeToInt32OverflowOp(node); |
1152 return; | 1148 return; |
1153 } | 1149 } |
1154 | 1150 |
1155 // default case => Float64Add/Sub | 1151 // default case => Float64Add/Sub |
1156 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), | 1152 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), |
1157 MachineRepresentation::kFloat64, Type::Number()); | 1153 MachineRepresentation::kFloat64, Type::Number()); |
1158 if (lower()) { | 1154 if (lower()) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 if (lower()) ChangeToPureOp(node, Uint32Op(node)); | 1339 if (lower()) ChangeToPureOp(node, Uint32Op(node)); |
1344 return; | 1340 return; |
1345 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) && | 1341 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) && |
1346 TypeOf(node->InputAt(1))->Is(Type::Signed32())) { | 1342 TypeOf(node->InputAt(1))->Is(Type::Signed32())) { |
1347 // => signed Int32Cmp | 1343 // => signed Int32Cmp |
1348 VisitInt32Cmp(node); | 1344 VisitInt32Cmp(node); |
1349 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1345 if (lower()) ChangeToPureOp(node, Int32Op(node)); |
1350 return; | 1346 return; |
1351 } | 1347 } |
1352 // Try to use type feedback. | 1348 // Try to use type feedback. |
1353 CompareOperationHints::Hint hint = CompareOperationHintOf(node->op()); | 1349 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1354 | 1350 |
1355 if (hint == CompareOperationHints::kSignedSmall) { | 1351 if (hint == NumberOperationHint::kSignedSmall) { |
1356 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), | 1352 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), |
1357 MachineRepresentation::kBit); | 1353 MachineRepresentation::kBit); |
1358 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1354 if (lower()) ChangeToPureOp(node, Int32Op(node)); |
1359 return; | 1355 return; |
1360 } | 1356 } |
1361 DCHECK_EQ(CompareOperationHints::kNumberOrOddball, hint); | 1357 DCHECK_EQ(NumberOperationHint::kNumberOrOddball, hint); |
1362 // default case => Float64 comparison | 1358 // default case => Float64 comparison |
1363 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), | 1359 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), |
1364 MachineRepresentation::kBit); | 1360 MachineRepresentation::kBit); |
1365 if (lower()) ChangeToPureOp(node, Float64Op(node)); | 1361 if (lower()) ChangeToPureOp(node, Float64Op(node)); |
1366 return; | 1362 return; |
1367 } | 1363 } |
1368 | 1364 |
1369 case IrOpcode::kNumberAdd: | 1365 case IrOpcode::kNumberAdd: |
1370 case IrOpcode::kNumberSubtract: { | 1366 case IrOpcode::kNumberSubtract: { |
1371 if (BothInputsAre(node, Type::Signed32()) && | 1367 if (BothInputsAre(node, Type::Signed32()) && |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 // Multiply reduces to Int32Mul if the inputs are integers, and | 1401 // Multiply reduces to Int32Mul if the inputs are integers, and |
1406 // (a) the output is either known to be Signed32, or | 1402 // (a) the output is either known to be Signed32, or |
1407 // (b) the output is known to be Unsigned32, or | 1403 // (b) the output is known to be Unsigned32, or |
1408 // (c) the uses are truncating and the result is in the safe | 1404 // (c) the uses are truncating and the result is in the safe |
1409 // integer range. | 1405 // integer range. |
1410 VisitWord32TruncatingBinop(node); | 1406 VisitWord32TruncatingBinop(node); |
1411 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1407 if (lower()) ChangeToPureOp(node, Int32Op(node)); |
1412 return; | 1408 return; |
1413 } | 1409 } |
1414 // Try to use type feedback. | 1410 // Try to use type feedback. |
1415 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1411 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1416 Type* input0_type = TypeOf(node->InputAt(0)); | 1412 Type* input0_type = TypeOf(node->InputAt(0)); |
1417 Type* input1_type = TypeOf(node->InputAt(1)); | 1413 Type* input1_type = TypeOf(node->InputAt(1)); |
1418 | 1414 |
1419 // Handle the case when no int32 checks on inputs are necessary | 1415 // Handle the case when no int32 checks on inputs are necessary |
1420 // (but an overflow check is needed on the output). | 1416 // (but an overflow check is needed on the output). |
1421 if (BothInputsAre(node, Type::Signed32())) { | 1417 if (BothInputsAre(node, Type::Signed32())) { |
1422 // If both the inputs the feedback are int32, use the overflow op. | 1418 // If both the inputs the feedback are int32, use the overflow op. |
1423 if (hint == BinaryOperationHints::kSignedSmall || | 1419 if (hint == NumberOperationHint::kSignedSmall || |
1424 hint == BinaryOperationHints::kSigned32) { | 1420 hint == NumberOperationHint::kSigned32) { |
1425 VisitBinop(node, UseInfo::TruncatingWord32(), | 1421 VisitBinop(node, UseInfo::TruncatingWord32(), |
1426 MachineRepresentation::kWord32, Type::Signed32()); | 1422 MachineRepresentation::kWord32, Type::Signed32()); |
1427 if (lower()) { | 1423 if (lower()) { |
1428 LowerToCheckedInt32Mul(node, truncation, input0_type, | 1424 LowerToCheckedInt32Mul(node, truncation, input0_type, |
1429 input1_type); | 1425 input1_type); |
1430 } | 1426 } |
1431 return; | 1427 return; |
1432 } | 1428 } |
1433 } | 1429 } |
1434 | 1430 |
1435 if (hint == BinaryOperationHints::kSignedSmall || | 1431 if (hint == NumberOperationHint::kSignedSmall || |
1436 hint == BinaryOperationHints::kSigned32) { | 1432 hint == NumberOperationHint::kSigned32) { |
1437 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1433 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1438 MachineRepresentation::kWord32, Type::Signed32()); | 1434 MachineRepresentation::kWord32, Type::Signed32()); |
1439 if (lower()) { | 1435 if (lower()) { |
1440 LowerToCheckedInt32Mul(node, truncation, input0_type, input1_type); | 1436 LowerToCheckedInt32Mul(node, truncation, input0_type, input1_type); |
1441 } | 1437 } |
1442 return; | 1438 return; |
1443 } | 1439 } |
1444 | 1440 |
1445 // Checked float64 x float64 => float64 | 1441 // Checked float64 x float64 => float64 |
1446 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), | 1442 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 } | 1488 } |
1493 if (truncation.IsUsedAsWord32()) { | 1489 if (truncation.IsUsedAsWord32()) { |
1494 // => signed Int32Div | 1490 // => signed Int32Div |
1495 VisitWord32TruncatingBinop(node); | 1491 VisitWord32TruncatingBinop(node); |
1496 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); | 1492 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); |
1497 return; | 1493 return; |
1498 } | 1494 } |
1499 } | 1495 } |
1500 | 1496 |
1501 // Try to use type feedback. | 1497 // Try to use type feedback. |
1502 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1498 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1503 | 1499 |
1504 // Handle the case when no uint32 checks on inputs are necessary | 1500 // Handle the case when no uint32 checks on inputs are necessary |
1505 // (but an overflow check is needed on the output). | 1501 // (but an overflow check is needed on the output). |
1506 if (BothInputsAreUnsigned32(node)) { | 1502 if (BothInputsAreUnsigned32(node)) { |
1507 if (hint == BinaryOperationHints::kSignedSmall || | 1503 if (hint == NumberOperationHint::kSignedSmall || |
1508 hint == BinaryOperationHints::kSigned32) { | 1504 hint == NumberOperationHint::kSigned32) { |
1509 VisitBinop(node, UseInfo::TruncatingWord32(), | 1505 VisitBinop(node, UseInfo::TruncatingWord32(), |
1510 MachineRepresentation::kWord32, Type::Unsigned32()); | 1506 MachineRepresentation::kWord32, Type::Unsigned32()); |
1511 if (lower()) ChangeToUint32OverflowOp(node); | 1507 if (lower()) ChangeToUint32OverflowOp(node); |
1512 return; | 1508 return; |
1513 } | 1509 } |
1514 } | 1510 } |
1515 | 1511 |
1516 // Handle the case when no int32 checks on inputs are necessary | 1512 // Handle the case when no int32 checks on inputs are necessary |
1517 // (but an overflow check is needed on the output). | 1513 // (but an overflow check is needed on the output). |
1518 if (BothInputsAreSigned32(node)) { | 1514 if (BothInputsAreSigned32(node)) { |
1519 // If both the inputs the feedback are int32, use the overflow op. | 1515 // If both the inputs the feedback are int32, use the overflow op. |
1520 if (hint == BinaryOperationHints::kSignedSmall || | 1516 if (hint == NumberOperationHint::kSignedSmall || |
1521 hint == BinaryOperationHints::kSigned32) { | 1517 hint == NumberOperationHint::kSigned32) { |
1522 VisitBinop(node, UseInfo::TruncatingWord32(), | 1518 VisitBinop(node, UseInfo::TruncatingWord32(), |
1523 MachineRepresentation::kWord32, Type::Signed32()); | 1519 MachineRepresentation::kWord32, Type::Signed32()); |
1524 if (lower()) ChangeToInt32OverflowOp(node); | 1520 if (lower()) ChangeToInt32OverflowOp(node); |
1525 return; | 1521 return; |
1526 } | 1522 } |
1527 } | 1523 } |
1528 | 1524 |
1529 if (hint == BinaryOperationHints::kSignedSmall || | 1525 if (hint == NumberOperationHint::kSignedSmall || |
1530 hint == BinaryOperationHints::kSigned32) { | 1526 hint == NumberOperationHint::kSigned32) { |
1531 // If the result is truncated, we only need to check the inputs. | 1527 // If the result is truncated, we only need to check the inputs. |
1532 if (truncation.IsUsedAsWord32()) { | 1528 if (truncation.IsUsedAsWord32()) { |
1533 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1529 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1534 MachineRepresentation::kWord32); | 1530 MachineRepresentation::kWord32); |
1535 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); | 1531 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); |
1536 } else { | 1532 } else { |
1537 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1533 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1538 MachineRepresentation::kWord32, Type::Signed32()); | 1534 MachineRepresentation::kWord32, Type::Signed32()); |
1539 if (lower()) ChangeToInt32OverflowOp(node); | 1535 if (lower()) ChangeToInt32OverflowOp(node); |
1540 } | 1536 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 if (BothInputsAre(node, Type::Signed32OrMinusZeroOrNaN()) && | 1596 if (BothInputsAre(node, Type::Signed32OrMinusZeroOrNaN()) && |
1601 (truncation.IsUsedAsWord32() || | 1597 (truncation.IsUsedAsWord32() || |
1602 NodeProperties::GetType(node)->Is(Type::Signed32()))) { | 1598 NodeProperties::GetType(node)->Is(Type::Signed32()))) { |
1603 // => signed Int32Mod | 1599 // => signed Int32Mod |
1604 VisitWord32TruncatingBinop(node); | 1600 VisitWord32TruncatingBinop(node); |
1605 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); | 1601 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); |
1606 return; | 1602 return; |
1607 } | 1603 } |
1608 | 1604 |
1609 // Try to use type feedback. | 1605 // Try to use type feedback. |
1610 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1606 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1611 | 1607 |
1612 // Handle the case when no uint32 checks on inputs are necessary | 1608 // Handle the case when no uint32 checks on inputs are necessary |
1613 // (but an overflow check is needed on the output). | 1609 // (but an overflow check is needed on the output). |
1614 if (BothInputsAreUnsigned32(node)) { | 1610 if (BothInputsAreUnsigned32(node)) { |
1615 if (hint == BinaryOperationHints::kSignedSmall || | 1611 if (hint == NumberOperationHint::kSignedSmall || |
1616 hint == BinaryOperationHints::kSigned32) { | 1612 hint == NumberOperationHint::kSigned32) { |
1617 VisitBinop(node, UseInfo::TruncatingWord32(), | 1613 VisitBinop(node, UseInfo::TruncatingWord32(), |
1618 MachineRepresentation::kWord32, Type::Unsigned32()); | 1614 MachineRepresentation::kWord32, Type::Unsigned32()); |
1619 if (lower()) ChangeToUint32OverflowOp(node); | 1615 if (lower()) ChangeToUint32OverflowOp(node); |
1620 return; | 1616 return; |
1621 } | 1617 } |
1622 } | 1618 } |
1623 | 1619 |
1624 // Handle the case when no int32 checks on inputs are necessary | 1620 // Handle the case when no int32 checks on inputs are necessary |
1625 // (but an overflow check is needed on the output). | 1621 // (but an overflow check is needed on the output). |
1626 if (BothInputsAre(node, Type::Signed32())) { | 1622 if (BothInputsAre(node, Type::Signed32())) { |
1627 // If both the inputs the feedback are int32, use the overflow op. | 1623 // If both the inputs the feedback are int32, use the overflow op. |
1628 if (hint == BinaryOperationHints::kSignedSmall || | 1624 if (hint == NumberOperationHint::kSignedSmall || |
1629 hint == BinaryOperationHints::kSigned32) { | 1625 hint == NumberOperationHint::kSigned32) { |
1630 VisitBinop(node, UseInfo::TruncatingWord32(), | 1626 VisitBinop(node, UseInfo::TruncatingWord32(), |
1631 MachineRepresentation::kWord32, Type::Signed32()); | 1627 MachineRepresentation::kWord32, Type::Signed32()); |
1632 if (lower()) ChangeToInt32OverflowOp(node); | 1628 if (lower()) ChangeToInt32OverflowOp(node); |
1633 return; | 1629 return; |
1634 } | 1630 } |
1635 } | 1631 } |
1636 | 1632 |
1637 if (hint == BinaryOperationHints::kSignedSmall || | 1633 if (hint == NumberOperationHint::kSignedSmall || |
1638 hint == BinaryOperationHints::kSigned32) { | 1634 hint == NumberOperationHint::kSigned32) { |
1639 // If the result is truncated, we only need to check the inputs. | 1635 // If the result is truncated, we only need to check the inputs. |
1640 if (truncation.IsUsedAsWord32()) { | 1636 if (truncation.IsUsedAsWord32()) { |
1641 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1637 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1642 MachineRepresentation::kWord32); | 1638 MachineRepresentation::kWord32); |
1643 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); | 1639 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); |
1644 } else { | 1640 } else { |
1645 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1641 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1646 MachineRepresentation::kWord32, Type::Signed32()); | 1642 MachineRepresentation::kWord32, Type::Signed32()); |
1647 if (lower()) ChangeToInt32OverflowOp(node); | 1643 if (lower()) ChangeToInt32OverflowOp(node); |
1648 } | 1644 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 if (BothInputsAre(node, Type::NumberOrOddball())) { | 1756 if (BothInputsAre(node, Type::NumberOrOddball())) { |
1761 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1757 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
1762 VisitBinop(node, UseInfo::TruncatingWord32(), | 1758 VisitBinop(node, UseInfo::TruncatingWord32(), |
1763 UseInfo::TruncatingWord32(), | 1759 UseInfo::TruncatingWord32(), |
1764 MachineRepresentation::kWord32); | 1760 MachineRepresentation::kWord32); |
1765 if (lower()) { | 1761 if (lower()) { |
1766 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type); | 1762 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type); |
1767 } | 1763 } |
1768 return; | 1764 return; |
1769 } | 1765 } |
1770 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1766 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1771 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1767 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
1772 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1768 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1773 MachineRepresentation::kWord32, Type::Signed32()); | 1769 MachineRepresentation::kWord32, Type::Signed32()); |
1774 if (lower()) { | 1770 if (lower()) { |
1775 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type); | 1771 lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type); |
1776 } | 1772 } |
1777 return; | 1773 return; |
1778 } | 1774 } |
1779 case IrOpcode::kNumberShiftRight: { | 1775 case IrOpcode::kNumberShiftRight: { |
1780 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1776 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
(...skipping 15 matching lines...) Expand all Loading... |
1796 if (BothInputsAre(node, Type::NumberOrOddball())) { | 1792 if (BothInputsAre(node, Type::NumberOrOddball())) { |
1797 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1793 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
1798 VisitBinop(node, UseInfo::TruncatingWord32(), | 1794 VisitBinop(node, UseInfo::TruncatingWord32(), |
1799 UseInfo::TruncatingWord32(), | 1795 UseInfo::TruncatingWord32(), |
1800 MachineRepresentation::kWord32); | 1796 MachineRepresentation::kWord32); |
1801 if (lower()) { | 1797 if (lower()) { |
1802 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type); | 1798 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type); |
1803 } | 1799 } |
1804 return; | 1800 return; |
1805 } | 1801 } |
1806 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1802 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1807 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1803 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
1808 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1804 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1809 MachineRepresentation::kWord32, Type::Signed32()); | 1805 MachineRepresentation::kWord32, Type::Signed32()); |
1810 if (lower()) { | 1806 if (lower()) { |
1811 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type); | 1807 lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type); |
1812 } | 1808 } |
1813 return; | 1809 return; |
1814 } | 1810 } |
1815 case IrOpcode::kNumberShiftRightLogical: { | 1811 case IrOpcode::kNumberShiftRightLogical: { |
1816 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1812 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
(...skipping 15 matching lines...) Expand all Loading... |
1832 if (BothInputsAre(node, Type::NumberOrOddball())) { | 1828 if (BothInputsAre(node, Type::NumberOrOddball())) { |
1833 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1829 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
1834 VisitBinop(node, UseInfo::TruncatingWord32(), | 1830 VisitBinop(node, UseInfo::TruncatingWord32(), |
1835 UseInfo::TruncatingWord32(), | 1831 UseInfo::TruncatingWord32(), |
1836 MachineRepresentation::kWord32); | 1832 MachineRepresentation::kWord32); |
1837 if (lower()) { | 1833 if (lower()) { |
1838 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); | 1834 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); |
1839 } | 1835 } |
1840 return; | 1836 return; |
1841 } | 1837 } |
1842 BinaryOperationHints::Hint hint = BinaryOperationHintOf(node->op()); | 1838 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1843 Type* rhs_type = GetUpperBound(node->InputAt(1)); | 1839 Type* rhs_type = GetUpperBound(node->InputAt(1)); |
1844 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1840 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1845 MachineRepresentation::kWord32, Type::Unsigned32()); | 1841 MachineRepresentation::kWord32, Type::Unsigned32()); |
1846 if (lower()) { | 1842 if (lower()) { |
1847 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); | 1843 lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type); |
1848 } | 1844 } |
1849 return; | 1845 return; |
1850 } | 1846 } |
1851 case IrOpcode::kNumberAbs: { | 1847 case IrOpcode::kNumberAbs: { |
1852 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { | 1848 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3310 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3306 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3311 Operator::kNoProperties); | 3307 Operator::kNoProperties); |
3312 to_number_operator_.set(common()->Call(desc)); | 3308 to_number_operator_.set(common()->Call(desc)); |
3313 } | 3309 } |
3314 return to_number_operator_.get(); | 3310 return to_number_operator_.get(); |
3315 } | 3311 } |
3316 | 3312 |
3317 } // namespace compiler | 3313 } // namespace compiler |
3318 } // namespace internal | 3314 } // namespace internal |
3319 } // namespace v8 | 3315 } // namespace v8 |
OLD | NEW |