| 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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 if (lower()) { | 922 if (lower()) { |
| 923 // Update the select operator. | 923 // Update the select operator. |
| 924 SelectParameters p = SelectParametersOf(node->op()); | 924 SelectParameters p = SelectParametersOf(node->op()); |
| 925 if (output != p.representation()) { | 925 if (output != p.representation()) { |
| 926 NodeProperties::ChangeOp(node, | 926 NodeProperties::ChangeOp(node, |
| 927 lowering->common()->Select(output, p.hint())); | 927 lowering->common()->Select(output, p.hint())); |
| 928 } | 928 } |
| 929 } | 929 } |
| 930 // Convert inputs to the output representation of this phi, pass the | 930 // Convert inputs to the output representation of this phi, pass the |
| 931 // truncation truncation along. | 931 // truncation truncation along. |
| 932 if (output == MachineRepresentation::kTagged) { | |
| 933 truncation = Truncation::Any(); | |
| 934 } | |
| 935 UseInfo input_use(output, truncation); | 932 UseInfo input_use(output, truncation); |
| 936 ProcessInput(node, 1, input_use); | 933 ProcessInput(node, 1, input_use); |
| 937 ProcessInput(node, 2, input_use); | 934 ProcessInput(node, 2, input_use); |
| 938 } | 935 } |
| 939 | 936 |
| 940 // Helper for handling phis. | 937 // Helper for handling phis. |
| 941 void VisitPhi(Node* node, Truncation truncation, | 938 void VisitPhi(Node* node, Truncation truncation, |
| 942 SimplifiedLowering* lowering) { | 939 SimplifiedLowering* lowering) { |
| 943 MachineRepresentation output = | 940 MachineRepresentation output = |
| 944 GetOutputInfoForPhi(node, TypeOf(node), truncation); | 941 GetOutputInfoForPhi(node, TypeOf(node), truncation); |
| 945 // Only set the output representation if not running with type | 942 // Only set the output representation if not running with type |
| 946 // feedback. (Feedback typing will set the representation.) | 943 // feedback. (Feedback typing will set the representation.) |
| 947 SetOutput(node, output); | 944 SetOutput(node, output); |
| 948 | 945 |
| 949 int values = node->op()->ValueInputCount(); | 946 int values = node->op()->ValueInputCount(); |
| 950 if (lower()) { | 947 if (lower()) { |
| 951 // Update the phi operator. | 948 // Update the phi operator. |
| 952 if (output != PhiRepresentationOf(node->op())) { | 949 if (output != PhiRepresentationOf(node->op())) { |
| 953 NodeProperties::ChangeOp(node, lowering->common()->Phi(output, values)); | 950 NodeProperties::ChangeOp(node, lowering->common()->Phi(output, values)); |
| 954 } | 951 } |
| 955 } | 952 } |
| 956 | 953 |
| 957 // Convert inputs to the output representation of this phi, pass the | 954 // Convert inputs to the output representation of this phi, pass the |
| 958 // truncation along. | 955 // truncation along. |
| 959 if (output == MachineRepresentation::kTagged) { | |
| 960 truncation = Truncation::Any(); | |
| 961 } | |
| 962 UseInfo input_use(output, truncation); | 956 UseInfo input_use(output, truncation); |
| 963 for (int i = 0; i < node->InputCount(); i++) { | 957 for (int i = 0; i < node->InputCount(); i++) { |
| 964 ProcessInput(node, i, i < values ? input_use : UseInfo::None()); | 958 ProcessInput(node, i, i < values ? input_use : UseInfo::None()); |
| 965 } | 959 } |
| 966 } | 960 } |
| 967 | 961 |
| 968 void VisitCall(Node* node, SimplifiedLowering* lowering) { | 962 void VisitCall(Node* node, SimplifiedLowering* lowering) { |
| 969 const CallDescriptor* desc = CallDescriptorOf(node->op()); | 963 const CallDescriptor* desc = CallDescriptorOf(node->op()); |
| 970 int params = static_cast<int>(desc->ParameterCount()); | 964 int params = static_cast<int>(desc->ParameterCount()); |
| 971 int value_input_count = node->op()->ValueInputCount(); | 965 int value_input_count = node->op()->ValueInputCount(); |
| (...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 2433 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
| 2440 return; | 2434 return; |
| 2441 case IrOpcode::kStateValues: | 2435 case IrOpcode::kStateValues: |
| 2442 return VisitStateValues(node); | 2436 return VisitStateValues(node); |
| 2443 case IrOpcode::kTypeGuard: { | 2437 case IrOpcode::kTypeGuard: { |
| 2444 // We just get rid of the sigma here. In principle, it should be | 2438 // We just get rid of the sigma here. In principle, it should be |
| 2445 // possible to refine the truncation and representation based on | 2439 // possible to refine the truncation and representation based on |
| 2446 // the sigma's type. | 2440 // the sigma's type. |
| 2447 MachineRepresentation output = | 2441 MachineRepresentation output = |
| 2448 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); | 2442 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); |
| 2449 | |
| 2450 if (output == MachineRepresentation::kTagged) { | |
| 2451 truncation = Truncation::Any(); | |
| 2452 } | |
| 2453 VisitUnop(node, UseInfo(output, truncation), output); | 2443 VisitUnop(node, UseInfo(output, truncation), output); |
| 2454 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2444 if (lower()) DeferReplacement(node, node->InputAt(0)); |
| 2455 return; | 2445 return; |
| 2456 } | 2446 } |
| 2457 | 2447 |
| 2458 // Operators with all inputs tagged and no or tagged output have uniform | 2448 // Operators with all inputs tagged and no or tagged output have uniform |
| 2459 // handling. | 2449 // handling. |
| 2460 case IrOpcode::kEnd: | 2450 case IrOpcode::kEnd: |
| 2461 case IrOpcode::kReturn: | 2451 case IrOpcode::kReturn: |
| 2462 case IrOpcode::kIfSuccess: | 2452 case IrOpcode::kIfSuccess: |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3257 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3247 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3258 Operator::kNoProperties); | 3248 Operator::kNoProperties); |
| 3259 to_number_operator_.set(common()->Call(desc)); | 3249 to_number_operator_.set(common()->Call(desc)); |
| 3260 } | 3250 } |
| 3261 return to_number_operator_.get(); | 3251 return to_number_operator_.get(); |
| 3262 } | 3252 } |
| 3263 | 3253 |
| 3264 } // namespace compiler | 3254 } // namespace compiler |
| 3265 } // namespace internal | 3255 } // namespace internal |
| 3266 } // namespace v8 | 3256 } // namespace v8 |
| OLD | NEW |