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 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); | 1395 if (lower()) DeferReplacement(node, lowering->Int32Mod(node)); |
1396 return; | 1396 return; |
1397 } | 1397 } |
1398 // default case => Float64Mod | 1398 // default case => Float64Mod |
1399 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), | 1399 VisitBinop(node, UseInfo::CheckedNumberOrOddballAsFloat64(), |
1400 MachineRepresentation::kFloat64, Type::Number()); | 1400 MachineRepresentation::kFloat64, Type::Number()); |
1401 if (lower()) ChangeToPureOp(node, Float64Op(node)); | 1401 if (lower()) ChangeToPureOp(node, Float64Op(node)); |
1402 return; | 1402 return; |
1403 } | 1403 } |
1404 | 1404 |
1405 void VisitOsrGuard(Node* node) { | |
1406 VisitInputs(node); | |
1407 | |
1408 // Insert a dynamic check for the OSR value type if necessary. | |
1409 switch (OsrGuardTypeOf(node->op())) { | |
1410 case OsrGuardType::kUninitialized: | |
1411 // At this point, we should always have a type for the OsrValue. | |
1412 UNREACHABLE(); | |
1413 break; | |
1414 case OsrGuardType::kSignedSmall: | |
1415 if (lower()) { | |
1416 NodeProperties::ChangeOp(node, | |
1417 simplified()->CheckedTaggedToTaggedSigned()); | |
1418 } | |
1419 return SetOutput(node, MachineRepresentation::kTaggedSigned); | |
1420 case OsrGuardType::kAny: // Nothing to check. | |
1421 if (lower()) { | |
1422 DeferReplacement(node, node->InputAt(0)); | |
1423 } | |
1424 return SetOutput(node, MachineRepresentation::kTagged); | |
1425 } | |
1426 UNREACHABLE(); | |
1427 } | |
1428 | |
1429 // Dispatching routine for visiting the node {node} with the usage {use}. | 1405 // Dispatching routine for visiting the node {node} with the usage {use}. |
1430 // Depending on the operator, propagate new usage info to the inputs. | 1406 // Depending on the operator, propagate new usage info to the inputs. |
1431 void VisitNode(Node* node, Truncation truncation, | 1407 void VisitNode(Node* node, Truncation truncation, |
1432 SimplifiedLowering* lowering) { | 1408 SimplifiedLowering* lowering) { |
1433 // Unconditionally eliminate unused pure nodes (only relevant if there's | 1409 // Unconditionally eliminate unused pure nodes (only relevant if there's |
1434 // a pure operation in between two effectful ones, where the last one | 1410 // a pure operation in between two effectful ones, where the last one |
1435 // is unused). | 1411 // is unused). |
1436 // Note: We must not do this for constants, as they are cached and we | 1412 // Note: We must not do this for constants, as they are cached and we |
1437 // would thus kill the cached {node} during lowering (i.e. replace all | 1413 // would thus kill the cached {node} during lowering (i.e. replace all |
1438 // uses with Dead), but at that point some node lowering might have | 1414 // uses with Dead), but at that point some node lowering might have |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 // We just get rid of the sigma here. In principle, it should be | 2755 // We just get rid of the sigma here. In principle, it should be |
2780 // possible to refine the truncation and representation based on | 2756 // possible to refine the truncation and representation based on |
2781 // the sigma's type. | 2757 // the sigma's type. |
2782 MachineRepresentation output = | 2758 MachineRepresentation output = |
2783 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); | 2759 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); |
2784 VisitUnop(node, UseInfo(output, truncation), output); | 2760 VisitUnop(node, UseInfo(output, truncation), output); |
2785 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2761 if (lower()) DeferReplacement(node, node->InputAt(0)); |
2786 return; | 2762 return; |
2787 } | 2763 } |
2788 | 2764 |
2789 case IrOpcode::kOsrGuard: | |
2790 return VisitOsrGuard(node); | |
2791 | |
2792 case IrOpcode::kFinishRegion: | 2765 case IrOpcode::kFinishRegion: |
2793 VisitInputs(node); | 2766 VisitInputs(node); |
2794 // Assume the output is tagged pointer. | 2767 // Assume the output is tagged pointer. |
2795 return SetOutput(node, MachineRepresentation::kTaggedPointer); | 2768 return SetOutput(node, MachineRepresentation::kTaggedPointer); |
2796 | 2769 |
2797 case IrOpcode::kReturn: | 2770 case IrOpcode::kReturn: |
2798 VisitReturn(node); | 2771 VisitReturn(node); |
2799 // Assume the output is tagged. | 2772 // Assume the output is tagged. |
2800 return SetOutput(node, MachineRepresentation::kTagged); | 2773 return SetOutput(node, MachineRepresentation::kTagged); |
2801 | 2774 |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3675 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3648 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3676 Operator::kNoProperties); | 3649 Operator::kNoProperties); |
3677 to_number_operator_.set(common()->Call(desc)); | 3650 to_number_operator_.set(common()->Call(desc)); |
3678 } | 3651 } |
3679 return to_number_operator_.get(); | 3652 return to_number_operator_.get(); |
3680 } | 3653 } |
3681 | 3654 |
3682 } // namespace compiler | 3655 } // namespace compiler |
3683 } // namespace internal | 3656 } // namespace internal |
3684 } // namespace v8 | 3657 } // namespace v8 |
OLD | NEW |