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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 void VisitLeaf(Node* node, MachineRepresentation output) { | 800 void VisitLeaf(Node* node, MachineRepresentation output) { |
801 DCHECK_EQ(0, node->InputCount()); | 801 DCHECK_EQ(0, node->InputCount()); |
802 SetOutput(node, output); | 802 SetOutput(node, output); |
803 } | 803 } |
804 | 804 |
805 // Helpers for specific types of binops. | 805 // Helpers for specific types of binops. |
806 void VisitFloat64Binop(Node* node) { | 806 void VisitFloat64Binop(Node* node) { |
807 VisitBinop(node, UseInfo::TruncatingFloat64(), | 807 VisitBinop(node, UseInfo::TruncatingFloat64(), |
808 MachineRepresentation::kFloat64); | 808 MachineRepresentation::kFloat64); |
809 } | 809 } |
810 void VisitInt32Binop(Node* node) { | |
811 VisitBinop(node, UseInfo::TruncatingWord32(), | |
812 MachineRepresentation::kWord32); | |
813 } | |
814 void VisitWord32TruncatingBinop(Node* node) { | 810 void VisitWord32TruncatingBinop(Node* node) { |
815 VisitBinop(node, UseInfo::TruncatingWord32(), | 811 VisitBinop(node, UseInfo::TruncatingWord32(), |
816 MachineRepresentation::kWord32); | 812 MachineRepresentation::kWord32); |
817 } | 813 } |
818 void VisitUint32Binop(Node* node) { | |
819 VisitBinop(node, UseInfo::TruncatingWord32(), | |
820 MachineRepresentation::kWord32); | |
821 } | |
822 void VisitInt64Binop(Node* node) { | |
823 VisitBinop(node, UseInfo::TruncatingWord64(), | |
824 MachineRepresentation::kWord64); | |
825 } | |
826 void VisitUint64Binop(Node* node) { | |
827 VisitBinop(node, UseInfo::TruncatingWord64(), | |
828 MachineRepresentation::kWord64); | |
829 } | |
830 void VisitFloat64Cmp(Node* node) { | |
831 VisitBinop(node, UseInfo::TruncatingFloat64(), MachineRepresentation::kBit); | |
832 } | |
833 void VisitInt32Cmp(Node* node) { | |
834 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit); | |
835 } | |
836 void VisitUint32Cmp(Node* node) { | |
837 VisitBinop(node, UseInfo::TruncatingWord32(), MachineRepresentation::kBit); | |
838 } | |
839 void VisitInt64Cmp(Node* node) { | |
840 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit); | |
841 } | |
842 void VisitUint64Cmp(Node* node) { | |
843 VisitBinop(node, UseInfo::TruncatingWord64(), MachineRepresentation::kBit); | |
844 } | |
845 | 814 |
846 // Infer representation for phi-like nodes. | 815 // Infer representation for phi-like nodes. |
847 // The {node} parameter is only used to decide on the int64 representation. | 816 // The {node} parameter is only used to decide on the int64 representation. |
848 // Once the type system supports an external pointer type, the {node} | 817 // Once the type system supports an external pointer type, the {node} |
849 // parameter can be removed. | 818 // parameter can be removed. |
850 MachineRepresentation GetOutputInfoForPhi(Node* node, Type* type, | 819 MachineRepresentation GetOutputInfoForPhi(Node* node, Type* type, |
851 Truncation use) { | 820 Truncation use) { |
852 // Compute the representation. | 821 // Compute the representation. |
853 if (type->Is(Type::None())) { | 822 if (type->Is(Type::None())) { |
854 return MachineRepresentation::kNone; | 823 return MachineRepresentation::kNone; |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 } | 1270 } |
1302 switch (node->opcode()) { | 1271 switch (node->opcode()) { |
1303 //------------------------------------------------------------------ | 1272 //------------------------------------------------------------------ |
1304 // Common operators. | 1273 // Common operators. |
1305 //------------------------------------------------------------------ | 1274 //------------------------------------------------------------------ |
1306 case IrOpcode::kStart: | 1275 case IrOpcode::kStart: |
1307 // We use Start as a terminator for the frame state chain, so even | 1276 // We use Start as a terminator for the frame state chain, so even |
1308 // tho Start doesn't really produce a value, we have to say Tagged | 1277 // tho Start doesn't really produce a value, we have to say Tagged |
1309 // here, otherwise the input conversion will fail. | 1278 // here, otherwise the input conversion will fail. |
1310 return VisitLeaf(node, MachineRepresentation::kTagged); | 1279 return VisitLeaf(node, MachineRepresentation::kTagged); |
1311 case IrOpcode::kParameter: { | 1280 case IrOpcode::kParameter: |
1312 // TODO(titzer): use representation from linkage. | 1281 // TODO(titzer): use representation from linkage. |
1313 ProcessInput(node, 0, UseInfo::None()); | 1282 return VisitUnop(node, UseInfo::None(), MachineRepresentation::kTagged); |
1314 SetOutput(node, MachineRepresentation::kTagged); | |
1315 return; | |
1316 } | |
1317 case IrOpcode::kInt32Constant: | 1283 case IrOpcode::kInt32Constant: |
1318 return VisitLeaf(node, MachineRepresentation::kWord32); | 1284 return VisitLeaf(node, MachineRepresentation::kWord32); |
1319 case IrOpcode::kInt64Constant: | 1285 case IrOpcode::kInt64Constant: |
1320 return VisitLeaf(node, MachineRepresentation::kWord64); | 1286 return VisitLeaf(node, MachineRepresentation::kWord64); |
1321 case IrOpcode::kExternalConstant: | 1287 case IrOpcode::kExternalConstant: |
1322 return VisitLeaf(node, MachineType::PointerRepresentation()); | 1288 return VisitLeaf(node, MachineType::PointerRepresentation()); |
1323 case IrOpcode::kNumberConstant: | 1289 case IrOpcode::kNumberConstant: |
1324 return VisitLeaf(node, MachineRepresentation::kTagged); | 1290 return VisitLeaf(node, MachineRepresentation::kTagged); |
1325 case IrOpcode::kHeapConstant: | 1291 case IrOpcode::kHeapConstant: |
1326 return VisitLeaf(node, MachineRepresentation::kTagged); | 1292 return VisitLeaf(node, MachineRepresentation::kTagged); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 // Simplified operators. | 1340 // Simplified operators. |
1375 //------------------------------------------------------------------ | 1341 //------------------------------------------------------------------ |
1376 case IrOpcode::kBooleanNot: { | 1342 case IrOpcode::kBooleanNot: { |
1377 if (lower()) { | 1343 if (lower()) { |
1378 NodeInfo* input_info = GetInfo(node->InputAt(0)); | 1344 NodeInfo* input_info = GetInfo(node->InputAt(0)); |
1379 if (input_info->representation() == MachineRepresentation::kBit) { | 1345 if (input_info->representation() == MachineRepresentation::kBit) { |
1380 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) | 1346 // BooleanNot(x: kRepBit) => Word32Equal(x, #0) |
1381 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); | 1347 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); |
1382 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); | 1348 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); |
1383 } else { | 1349 } else { |
| 1350 DCHECK_EQ(input_info->representation(), |
| 1351 MachineRepresentation::kTagged); |
1384 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) | 1352 // BooleanNot(x: kRepTagged) => WordEqual(x, #false) |
1385 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant()); | 1353 node->AppendInput(jsgraph_->zone(), jsgraph_->FalseConstant()); |
1386 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); | 1354 NodeProperties::ChangeOp(node, lowering->machine()->WordEqual()); |
1387 } | 1355 } |
1388 } else { | 1356 } else { |
1389 // No input representation requirement; adapt during lowering. | 1357 // No input representation requirement; adapt during lowering. |
1390 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool()); | 1358 ProcessInput(node, 0, UseInfo::AnyTruncatingToBool()); |
1391 SetOutput(node, MachineRepresentation::kBit); | 1359 SetOutput(node, MachineRepresentation::kBit); |
1392 } | 1360 } |
1393 return; | 1361 return; |
1394 } | 1362 } |
1395 case IrOpcode::kNumberEqual: { | 1363 case IrOpcode::kNumberEqual: { |
1396 Type* const lhs_type = TypeOf(node->InputAt(0)); | 1364 Type* const lhs_type = TypeOf(node->InputAt(0)); |
1397 Type* const rhs_type = TypeOf(node->InputAt(1)); | 1365 Type* const rhs_type = TypeOf(node->InputAt(1)); |
1398 // Number comparisons reduce to integer comparisons for integer inputs. | 1366 // Number comparisons reduce to integer comparisons for integer inputs. |
1399 if ((lhs_type->Is(Type::Unsigned32()) && | 1367 if ((lhs_type->Is(Type::Unsigned32()) && |
1400 rhs_type->Is(Type::Unsigned32())) || | 1368 rhs_type->Is(Type::Unsigned32())) || |
1401 (lhs_type->Is(Type::Unsigned32OrMinusZeroOrNaN()) && | 1369 (lhs_type->Is(Type::Unsigned32OrMinusZeroOrNaN()) && |
1402 rhs_type->Is(Type::Unsigned32OrMinusZeroOrNaN()) && | 1370 rhs_type->Is(Type::Unsigned32OrMinusZeroOrNaN()) && |
1403 OneInputCannotBe(node, type_cache_.kZeroish))) { | 1371 OneInputCannotBe(node, type_cache_.kZeroish))) { |
1404 // => unsigned Int32Cmp | 1372 // => unsigned Int32Cmp |
1405 VisitUint32Cmp(node); | 1373 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1374 MachineRepresentation::kBit); |
1406 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); | 1375 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
1407 return; | 1376 return; |
1408 } | 1377 } |
1409 if ((lhs_type->Is(Type::Signed32()) && | 1378 if ((lhs_type->Is(Type::Signed32()) && |
1410 rhs_type->Is(Type::Signed32())) || | 1379 rhs_type->Is(Type::Signed32())) || |
1411 (lhs_type->Is(Type::Signed32OrMinusZeroOrNaN()) && | 1380 (lhs_type->Is(Type::Signed32OrMinusZeroOrNaN()) && |
1412 rhs_type->Is(Type::Signed32OrMinusZeroOrNaN()) && | 1381 rhs_type->Is(Type::Signed32OrMinusZeroOrNaN()) && |
1413 OneInputCannotBe(node, type_cache_.kZeroish))) { | 1382 OneInputCannotBe(node, type_cache_.kZeroish))) { |
1414 // => signed Int32Cmp | 1383 // => signed Int32Cmp |
1415 VisitInt32Cmp(node); | 1384 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1385 MachineRepresentation::kBit); |
1416 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); | 1386 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
1417 return; | 1387 return; |
1418 } | 1388 } |
1419 // => Float64Cmp | 1389 // => Float64Cmp |
1420 VisitFloat64Cmp(node); | 1390 VisitBinop(node, UseInfo::TruncatingFloat64(), |
| 1391 MachineRepresentation::kBit); |
1421 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 1392 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
1422 return; | 1393 return; |
1423 } | 1394 } |
1424 case IrOpcode::kNumberLessThan: | 1395 case IrOpcode::kNumberLessThan: |
1425 case IrOpcode::kNumberLessThanOrEqual: { | 1396 case IrOpcode::kNumberLessThanOrEqual: { |
1426 // Number comparisons reduce to integer comparisons for integer inputs. | 1397 // Number comparisons reduce to integer comparisons for integer inputs. |
1427 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32()) && | 1398 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32()) && |
1428 TypeOf(node->InputAt(1))->Is(Type::Unsigned32())) { | 1399 TypeOf(node->InputAt(1))->Is(Type::Unsigned32())) { |
1429 // => unsigned Int32Cmp | 1400 // => unsigned Int32Cmp |
1430 VisitUint32Cmp(node); | 1401 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1402 MachineRepresentation::kBit); |
1431 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); | 1403 if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node)); |
1432 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) && | 1404 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) && |
1433 TypeOf(node->InputAt(1))->Is(Type::Signed32())) { | 1405 TypeOf(node->InputAt(1))->Is(Type::Signed32())) { |
1434 // => signed Int32Cmp | 1406 // => signed Int32Cmp |
1435 VisitInt32Cmp(node); | 1407 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1408 MachineRepresentation::kBit); |
1436 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); | 1409 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
1437 } else { | 1410 } else { |
1438 // => Float64Cmp | 1411 // => Float64Cmp |
1439 VisitFloat64Cmp(node); | 1412 VisitBinop(node, UseInfo::TruncatingFloat64(), |
| 1413 MachineRepresentation::kBit); |
1440 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 1414 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
1441 } | 1415 } |
1442 return; | 1416 return; |
1443 } | 1417 } |
1444 | 1418 |
1445 case IrOpcode::kSpeculativeNumberAdd: | 1419 case IrOpcode::kSpeculativeNumberAdd: |
1446 case IrOpcode::kSpeculativeNumberSubtract: | 1420 case IrOpcode::kSpeculativeNumberSubtract: |
1447 return VisitSpeculativeAdditiveOp(node, truncation, lowering); | 1421 return VisitSpeculativeAdditiveOp(node, truncation, lowering); |
1448 | 1422 |
1449 case IrOpcode::kSpeculativeNumberLessThan: | 1423 case IrOpcode::kSpeculativeNumberLessThan: |
1450 case IrOpcode::kSpeculativeNumberLessThanOrEqual: | 1424 case IrOpcode::kSpeculativeNumberLessThanOrEqual: |
1451 case IrOpcode::kSpeculativeNumberEqual: { | 1425 case IrOpcode::kSpeculativeNumberEqual: { |
1452 // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we | 1426 // ToNumber(x) can throw if x is either a Receiver or a Symbol, so we |
1453 // can only eliminate an unused speculative number operation if we know | 1427 // can only eliminate an unused speculative number operation if we know |
1454 // that the inputs are PlainPrimitive, which excludes everything that's | 1428 // that the inputs are PlainPrimitive, which excludes everything that's |
1455 // might have side effects or throws during a ToNumber conversion. | 1429 // might have side effects or throws during a ToNumber conversion. |
1456 if (BothInputsAre(node, Type::PlainPrimitive())) { | 1430 if (BothInputsAre(node, Type::PlainPrimitive())) { |
1457 if (truncation.IsUnused()) return VisitUnused(node); | 1431 if (truncation.IsUnused()) return VisitUnused(node); |
1458 } | 1432 } |
1459 // Number comparisons reduce to integer comparisons for integer inputs. | 1433 // Number comparisons reduce to integer comparisons for integer inputs. |
1460 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32()) && | 1434 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32()) && |
1461 TypeOf(node->InputAt(1))->Is(Type::Unsigned32())) { | 1435 TypeOf(node->InputAt(1))->Is(Type::Unsigned32())) { |
1462 // => unsigned Int32Cmp | 1436 // => unsigned Int32Cmp |
1463 VisitUint32Cmp(node); | 1437 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1438 MachineRepresentation::kBit); |
1464 if (lower()) ChangeToPureOp(node, Uint32Op(node)); | 1439 if (lower()) ChangeToPureOp(node, Uint32Op(node)); |
1465 return; | 1440 return; |
1466 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) && | 1441 } else if (TypeOf(node->InputAt(0))->Is(Type::Signed32()) && |
1467 TypeOf(node->InputAt(1))->Is(Type::Signed32())) { | 1442 TypeOf(node->InputAt(1))->Is(Type::Signed32())) { |
1468 // => signed Int32Cmp | 1443 // => signed Int32Cmp |
1469 VisitInt32Cmp(node); | 1444 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 1445 MachineRepresentation::kBit); |
1470 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1446 if (lower()) ChangeToPureOp(node, Int32Op(node)); |
1471 return; | 1447 return; |
1472 } | 1448 } |
1473 // Try to use type feedback. | 1449 // Try to use type feedback. |
1474 NumberOperationHint hint = NumberOperationHintOf(node->op()); | 1450 NumberOperationHint hint = NumberOperationHintOf(node->op()); |
1475 switch (hint) { | 1451 switch (hint) { |
1476 case NumberOperationHint::kSignedSmall: | 1452 case NumberOperationHint::kSignedSmall: |
1477 case NumberOperationHint::kSigned32: | 1453 case NumberOperationHint::kSigned32: |
1478 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1454 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1479 MachineRepresentation::kBit); | 1455 MachineRepresentation::kBit); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 } | 1573 } |
1598 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) { | 1574 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) { |
1599 // => unsigned Uint32Div | 1575 // => unsigned Uint32Div |
1600 VisitWord32TruncatingBinop(node); | 1576 VisitWord32TruncatingBinop(node); |
1601 if (lower()) DeferReplacement(node, lowering->Uint32Div(node)); | 1577 if (lower()) DeferReplacement(node, lowering->Uint32Div(node)); |
1602 return; | 1578 return; |
1603 } | 1579 } |
1604 if (BothInputsAreSigned32(node)) { | 1580 if (BothInputsAreSigned32(node)) { |
1605 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { | 1581 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { |
1606 // => signed Int32Div | 1582 // => signed Int32Div |
1607 VisitInt32Binop(node); | 1583 VisitWord32TruncatingBinop(node); |
1608 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); | 1584 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); |
1609 return; | 1585 return; |
1610 } | 1586 } |
1611 if (truncation.IsUsedAsWord32()) { | 1587 if (truncation.IsUsedAsWord32()) { |
1612 // => signed Int32Div | 1588 // => signed Int32Div |
1613 VisitWord32TruncatingBinop(node); | 1589 VisitWord32TruncatingBinop(node); |
1614 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); | 1590 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); |
1615 return; | 1591 return; |
1616 } | 1592 } |
1617 } | 1593 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 case IrOpcode::kNumberDivide: { | 1644 case IrOpcode::kNumberDivide: { |
1669 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) { | 1645 if (BothInputsAreUnsigned32(node) && truncation.IsUsedAsWord32()) { |
1670 // => unsigned Uint32Div | 1646 // => unsigned Uint32Div |
1671 VisitWord32TruncatingBinop(node); | 1647 VisitWord32TruncatingBinop(node); |
1672 if (lower()) DeferReplacement(node, lowering->Uint32Div(node)); | 1648 if (lower()) DeferReplacement(node, lowering->Uint32Div(node)); |
1673 return; | 1649 return; |
1674 } | 1650 } |
1675 if (BothInputsAreSigned32(node)) { | 1651 if (BothInputsAreSigned32(node)) { |
1676 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { | 1652 if (NodeProperties::GetType(node)->Is(Type::Signed32())) { |
1677 // => signed Int32Div | 1653 // => signed Int32Div |
1678 VisitInt32Binop(node); | 1654 VisitWord32TruncatingBinop(node); |
1679 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); | 1655 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); |
1680 return; | 1656 return; |
1681 } | 1657 } |
1682 if (truncation.IsUsedAsWord32()) { | 1658 if (truncation.IsUsedAsWord32()) { |
1683 // => signed Int32Div | 1659 // => signed Int32Div |
1684 VisitWord32TruncatingBinop(node); | 1660 VisitWord32TruncatingBinop(node); |
1685 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); | 1661 if (lower()) DeferReplacement(node, lowering->Int32Div(node)); |
1686 return; | 1662 return; |
1687 } | 1663 } |
1688 } | 1664 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1735 return; | 1711 return; |
1736 } | 1712 } |
1737 // default case => Float64Mod | 1713 // default case => Float64Mod |
1738 VisitFloat64Binop(node); | 1714 VisitFloat64Binop(node); |
1739 if (lower()) ChangeToPureOp(node, Float64Op(node)); | 1715 if (lower()) ChangeToPureOp(node, Float64Op(node)); |
1740 return; | 1716 return; |
1741 } | 1717 } |
1742 case IrOpcode::kNumberBitwiseOr: | 1718 case IrOpcode::kNumberBitwiseOr: |
1743 case IrOpcode::kNumberBitwiseXor: | 1719 case IrOpcode::kNumberBitwiseXor: |
1744 case IrOpcode::kNumberBitwiseAnd: { | 1720 case IrOpcode::kNumberBitwiseAnd: { |
1745 VisitInt32Binop(node); | 1721 VisitWord32TruncatingBinop(node); |
1746 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); | 1722 if (lower()) NodeProperties::ChangeOp(node, Int32Op(node)); |
1747 return; | 1723 return; |
1748 } | 1724 } |
1749 case IrOpcode::kSpeculativeNumberBitwiseOr: | 1725 case IrOpcode::kSpeculativeNumberBitwiseOr: |
1750 case IrOpcode::kSpeculativeNumberBitwiseXor: | 1726 case IrOpcode::kSpeculativeNumberBitwiseXor: |
1751 case IrOpcode::kSpeculativeNumberBitwiseAnd: | 1727 case IrOpcode::kSpeculativeNumberBitwiseAnd: |
1752 VisitSpeculativeInt32Binop(node); | 1728 VisitSpeculativeInt32Binop(node); |
1753 if (lower()) { | 1729 if (lower()) { |
1754 ChangeToPureOp(node, Int32Op(node)); | 1730 ChangeToPureOp(node, Int32Op(node)); |
1755 } | 1731 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 } | 1873 } |
1898 case IrOpcode::kNumberFround: { | 1874 case IrOpcode::kNumberFround: { |
1899 VisitUnop(node, UseInfo::TruncatingFloat64(), | 1875 VisitUnop(node, UseInfo::TruncatingFloat64(), |
1900 MachineRepresentation::kFloat32); | 1876 MachineRepresentation::kFloat32); |
1901 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 1877 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
1902 return; | 1878 return; |
1903 } | 1879 } |
1904 case IrOpcode::kNumberMax: { | 1880 case IrOpcode::kNumberMax: { |
1905 // TODO(turbofan): We should consider feedback types here as well. | 1881 // TODO(turbofan): We should consider feedback types here as well. |
1906 if (BothInputsAreUnsigned32(node)) { | 1882 if (BothInputsAreUnsigned32(node)) { |
1907 VisitUint32Binop(node); | 1883 VisitWord32TruncatingBinop(node); |
1908 if (lower()) { | 1884 if (lower()) { |
1909 lowering->DoMax(node, lowering->machine()->Uint32LessThan(), | 1885 lowering->DoMax(node, lowering->machine()->Uint32LessThan(), |
1910 MachineRepresentation::kWord32); | 1886 MachineRepresentation::kWord32); |
1911 } | 1887 } |
1912 } else if (BothInputsAreSigned32(node)) { | 1888 } else if (BothInputsAreSigned32(node)) { |
1913 VisitInt32Binop(node); | 1889 VisitWord32TruncatingBinop(node); |
1914 if (lower()) { | 1890 if (lower()) { |
1915 lowering->DoMax(node, lowering->machine()->Int32LessThan(), | 1891 lowering->DoMax(node, lowering->machine()->Int32LessThan(), |
1916 MachineRepresentation::kWord32); | 1892 MachineRepresentation::kWord32); |
1917 } | 1893 } |
1918 } else if (BothInputsAre(node, Type::PlainNumber())) { | 1894 } else if (BothInputsAre(node, Type::PlainNumber())) { |
1919 VisitFloat64Binop(node); | 1895 VisitFloat64Binop(node); |
1920 if (lower()) { | 1896 if (lower()) { |
1921 lowering->DoMax(node, lowering->machine()->Float64LessThan(), | 1897 lowering->DoMax(node, lowering->machine()->Float64LessThan(), |
1922 MachineRepresentation::kFloat64); | 1898 MachineRepresentation::kFloat64); |
1923 } | 1899 } |
1924 } else { | 1900 } else { |
1925 VisitFloat64Binop(node); | 1901 VisitFloat64Binop(node); |
1926 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 1902 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
1927 } | 1903 } |
1928 return; | 1904 return; |
1929 } | 1905 } |
1930 case IrOpcode::kNumberMin: { | 1906 case IrOpcode::kNumberMin: { |
1931 // TODO(turbofan): We should consider feedback types here as well. | 1907 // TODO(turbofan): We should consider feedback types here as well. |
1932 if (BothInputsAreUnsigned32(node)) { | 1908 if (BothInputsAreUnsigned32(node)) { |
1933 VisitUint32Binop(node); | 1909 VisitWord32TruncatingBinop(node); |
1934 if (lower()) { | 1910 if (lower()) { |
1935 lowering->DoMin(node, lowering->machine()->Uint32LessThan(), | 1911 lowering->DoMin(node, lowering->machine()->Uint32LessThan(), |
1936 MachineRepresentation::kWord32); | 1912 MachineRepresentation::kWord32); |
1937 } | 1913 } |
1938 } else if (BothInputsAreSigned32(node)) { | 1914 } else if (BothInputsAreSigned32(node)) { |
1939 VisitInt32Binop(node); | 1915 VisitWord32TruncatingBinop(node); |
1940 if (lower()) { | 1916 if (lower()) { |
1941 lowering->DoMin(node, lowering->machine()->Int32LessThan(), | 1917 lowering->DoMin(node, lowering->machine()->Int32LessThan(), |
1942 MachineRepresentation::kWord32); | 1918 MachineRepresentation::kWord32); |
1943 } | 1919 } |
1944 } else if (BothInputsAre(node, Type::PlainNumber())) { | 1920 } else if (BothInputsAre(node, Type::PlainNumber())) { |
1945 VisitFloat64Binop(node); | 1921 VisitFloat64Binop(node); |
1946 if (lower()) { | 1922 if (lower()) { |
1947 lowering->DoMin(node, lowering->machine()->Float64LessThan(), | 1923 lowering->DoMin(node, lowering->machine()->Float64LessThan(), |
1948 MachineRepresentation::kFloat64); | 1924 MachineRepresentation::kFloat64); |
1949 } | 1925 } |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3249 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3225 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3250 Operator::kNoProperties); | 3226 Operator::kNoProperties); |
3251 to_number_operator_.set(common()->Call(desc)); | 3227 to_number_operator_.set(common()->Call(desc)); |
3252 } | 3228 } |
3253 return to_number_operator_.get(); | 3229 return to_number_operator_.get(); |
3254 } | 3230 } |
3255 | 3231 |
3256 } // namespace compiler | 3232 } // namespace compiler |
3257 } // namespace internal | 3233 } // namespace internal |
3258 } // namespace v8 | 3234 } // namespace v8 |
OLD | NEW |