| 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 if (lower()) { | 905 if (lower()) { |
| 906 // Update the select operator. | 906 // Update the select operator. |
| 907 SelectParameters p = SelectParametersOf(node->op()); | 907 SelectParameters p = SelectParametersOf(node->op()); |
| 908 if (output != p.representation()) { | 908 if (output != p.representation()) { |
| 909 NodeProperties::ChangeOp(node, | 909 NodeProperties::ChangeOp(node, |
| 910 lowering->common()->Select(output, p.hint())); | 910 lowering->common()->Select(output, p.hint())); |
| 911 } | 911 } |
| 912 } | 912 } |
| 913 // Convert inputs to the output representation of this phi, pass the | 913 // Convert inputs to the output representation of this phi, pass the |
| 914 // truncation truncation along. | 914 // truncation truncation along. |
| 915 if (output == MachineRepresentation::kTagged) { |
| 916 truncation = Truncation::Any(); |
| 917 } |
| 915 UseInfo input_use(output, truncation); | 918 UseInfo input_use(output, truncation); |
| 916 ProcessInput(node, 1, input_use); | 919 ProcessInput(node, 1, input_use); |
| 917 ProcessInput(node, 2, input_use); | 920 ProcessInput(node, 2, input_use); |
| 918 } | 921 } |
| 919 | 922 |
| 920 // Helper for handling phis. | 923 // Helper for handling phis. |
| 921 void VisitPhi(Node* node, Truncation truncation, | 924 void VisitPhi(Node* node, Truncation truncation, |
| 922 SimplifiedLowering* lowering) { | 925 SimplifiedLowering* lowering) { |
| 923 MachineRepresentation output = | 926 MachineRepresentation output = |
| 924 GetOutputInfoForPhi(node, TypeOf(node), truncation); | 927 GetOutputInfoForPhi(node, TypeOf(node), truncation); |
| 925 // Only set the output representation if not running with type | 928 // Only set the output representation if not running with type |
| 926 // feedback. (Feedback typing will set the representation.) | 929 // feedback. (Feedback typing will set the representation.) |
| 927 SetOutput(node, output); | 930 SetOutput(node, output); |
| 928 | 931 |
| 929 int values = node->op()->ValueInputCount(); | 932 int values = node->op()->ValueInputCount(); |
| 930 if (lower()) { | 933 if (lower()) { |
| 931 // Update the phi operator. | 934 // Update the phi operator. |
| 932 if (output != PhiRepresentationOf(node->op())) { | 935 if (output != PhiRepresentationOf(node->op())) { |
| 933 NodeProperties::ChangeOp(node, lowering->common()->Phi(output, values)); | 936 NodeProperties::ChangeOp(node, lowering->common()->Phi(output, values)); |
| 934 } | 937 } |
| 935 } | 938 } |
| 936 | 939 |
| 937 // Convert inputs to the output representation of this phi, pass the | 940 // Convert inputs to the output representation of this phi, pass the |
| 938 // truncation along. | 941 // truncation along. |
| 942 if (output == MachineRepresentation::kTagged) { |
| 943 truncation = Truncation::Any(); |
| 944 } |
| 939 UseInfo input_use(output, truncation); | 945 UseInfo input_use(output, truncation); |
| 940 for (int i = 0; i < node->InputCount(); i++) { | 946 for (int i = 0; i < node->InputCount(); i++) { |
| 941 ProcessInput(node, i, i < values ? input_use : UseInfo::None()); | 947 ProcessInput(node, i, i < values ? input_use : UseInfo::None()); |
| 942 } | 948 } |
| 943 } | 949 } |
| 944 | 950 |
| 945 void VisitCall(Node* node, SimplifiedLowering* lowering) { | 951 void VisitCall(Node* node, SimplifiedLowering* lowering) { |
| 946 const CallDescriptor* desc = CallDescriptorOf(node->op()); | 952 const CallDescriptor* desc = CallDescriptorOf(node->op()); |
| 947 int params = static_cast<int>(desc->ParameterCount()); | 953 int params = static_cast<int>(desc->ParameterCount()); |
| 948 int value_input_count = node->op()->ValueInputCount(); | 954 int value_input_count = node->op()->ValueInputCount(); |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2408 return; | 2414 return; |
| 2409 case IrOpcode::kStateValues: | 2415 case IrOpcode::kStateValues: |
| 2410 return VisitStateValues(node); | 2416 return VisitStateValues(node); |
| 2411 case IrOpcode::kTypeGuard: { | 2417 case IrOpcode::kTypeGuard: { |
| 2412 // We just get rid of the sigma here. In principle, it should be | 2418 // We just get rid of the sigma here. In principle, it should be |
| 2413 // possible to refine the truncation and representation based on | 2419 // possible to refine the truncation and representation based on |
| 2414 // the sigma's type. | 2420 // the sigma's type. |
| 2415 MachineRepresentation output = | 2421 MachineRepresentation output = |
| 2416 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); | 2422 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); |
| 2417 | 2423 |
| 2424 if (output == MachineRepresentation::kTagged) { |
| 2425 truncation = Truncation::Any(); |
| 2426 } |
| 2418 VisitUnop(node, UseInfo(output, truncation), output); | 2427 VisitUnop(node, UseInfo(output, truncation), output); |
| 2419 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2428 if (lower()) DeferReplacement(node, node->InputAt(0)); |
| 2420 return; | 2429 return; |
| 2421 } | 2430 } |
| 2422 | 2431 |
| 2423 // Operators with all inputs tagged and no or tagged output have uniform | 2432 // Operators with all inputs tagged and no or tagged output have uniform |
| 2424 // handling. | 2433 // handling. |
| 2425 case IrOpcode::kEnd: | 2434 case IrOpcode::kEnd: |
| 2426 case IrOpcode::kReturn: | 2435 case IrOpcode::kReturn: |
| 2427 case IrOpcode::kIfSuccess: | 2436 case IrOpcode::kIfSuccess: |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3194 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3203 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3195 Operator::kNoProperties); | 3204 Operator::kNoProperties); |
| 3196 to_number_operator_.set(common()->Call(desc)); | 3205 to_number_operator_.set(common()->Call(desc)); |
| 3197 } | 3206 } |
| 3198 return to_number_operator_.get(); | 3207 return to_number_operator_.get(); |
| 3199 } | 3208 } |
| 3200 | 3209 |
| 3201 } // namespace compiler | 3210 } // namespace compiler |
| 3202 } // namespace internal | 3211 } // namespace internal |
| 3203 } // namespace v8 | 3212 } // namespace v8 |
| OLD | NEW |