| 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/int64-lowering.h" | 5 #include "src/compiler/int64-lowering.h" |
| 6 #include "src/compiler/common-operator.h" | 6 #include "src/compiler/common-operator.h" |
| 7 #include "src/compiler/diamond.h" | 7 #include "src/compiler/diamond.h" |
| 8 #include "src/compiler/graph.h" | 8 #include "src/compiler/graph.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } else { | 230 } else { |
| 231 high_node = graph()->NewNode(store_op, base, index_high, | 231 high_node = graph()->NewNode(store_op, base, index_high, |
| 232 GetReplacementHigh(value)); | 232 GetReplacementHigh(value)); |
| 233 } | 233 } |
| 234 | 234 |
| 235 node->ReplaceInput(1, index_low); | 235 node->ReplaceInput(1, index_low); |
| 236 node->ReplaceInput(2, GetReplacementLow(value)); | 236 node->ReplaceInput(2, GetReplacementLow(value)); |
| 237 NodeProperties::ChangeOp(node, store_op); | 237 NodeProperties::ChangeOp(node, store_op); |
| 238 ReplaceNode(node, node, high_node); | 238 ReplaceNode(node, node, high_node); |
| 239 } else { | 239 } else { |
| 240 DefaultLowering(node); | 240 DefaultLowering(node, true); |
| 241 } | 241 } |
| 242 break; | 242 break; |
| 243 } | 243 } |
| 244 case IrOpcode::kStart: { | 244 case IrOpcode::kStart: { |
| 245 int parameter_count = GetParameterCountAfterLowering(signature()); | 245 int parameter_count = GetParameterCountAfterLowering(signature()); |
| 246 // Only exchange the node if the parameter count actually changed. | 246 // Only exchange the node if the parameter count actually changed. |
| 247 if (parameter_count != static_cast<int>(signature()->parameter_count())) { | 247 if (parameter_count != static_cast<int>(signature()->parameter_count())) { |
| 248 int delta = | 248 int delta = |
| 249 parameter_count - static_cast<int>(signature()->parameter_count()); | 249 parameter_count - static_cast<int>(signature()->parameter_count()); |
| 250 int new_output_count = node->op()->ValueOutputCount() + delta; | 250 int new_output_count = node->op()->ValueOutputCount() + delta; |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 graph()->NewNode( | 819 graph()->NewNode( |
| 820 machine()->Word32And(), | 820 machine()->Word32And(), |
| 821 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(left), | 821 graph()->NewNode(machine()->Word32Equal(), GetReplacementHigh(left), |
| 822 GetReplacementHigh(right)), | 822 GetReplacementHigh(right)), |
| 823 graph()->NewNode(low_word_op, GetReplacementLow(left), | 823 graph()->NewNode(low_word_op, GetReplacementLow(left), |
| 824 GetReplacementLow(right)))); | 824 GetReplacementLow(right)))); |
| 825 | 825 |
| 826 ReplaceNode(node, replacement, nullptr); | 826 ReplaceNode(node, replacement, nullptr); |
| 827 } | 827 } |
| 828 | 828 |
| 829 bool Int64Lowering::DefaultLowering(Node* node) { | 829 bool Int64Lowering::DefaultLowering(Node* node, bool low_word_only) { |
| 830 bool something_changed = false; | 830 bool something_changed = false; |
| 831 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) { | 831 for (int i = NodeProperties::PastValueIndex(node) - 1; i >= 0; i--) { |
| 832 Node* input = node->InputAt(i); | 832 Node* input = node->InputAt(i); |
| 833 if (HasReplacementLow(input)) { | 833 if (HasReplacementLow(input)) { |
| 834 something_changed = true; | 834 something_changed = true; |
| 835 node->ReplaceInput(i, GetReplacementLow(input)); | 835 node->ReplaceInput(i, GetReplacementLow(input)); |
| 836 } | 836 } |
| 837 if (HasReplacementHigh(input)) { | 837 if (!low_word_only && HasReplacementHigh(input)) { |
| 838 something_changed = true; | 838 something_changed = true; |
| 839 node->InsertInput(zone(), i + 1, GetReplacementHigh(input)); | 839 node->InsertInput(zone(), i + 1, GetReplacementHigh(input)); |
| 840 } | 840 } |
| 841 } | 841 } |
| 842 return something_changed; | 842 return something_changed; |
| 843 } | 843 } |
| 844 | 844 |
| 845 void Int64Lowering::ReplaceNode(Node* old, Node* new_low, Node* new_high) { | 845 void Int64Lowering::ReplaceNode(Node* old, Node* new_low, Node* new_high) { |
| 846 // if new_low == nullptr, then also new_high == nullptr. | 846 // if new_low == nullptr, then also new_high == nullptr. |
| 847 DCHECK(new_low != nullptr || new_high == nullptr); | 847 DCHECK(new_low != nullptr || new_high == nullptr); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 common()->Phi(MachineRepresentation::kWord32, value_count), | 890 common()->Phi(MachineRepresentation::kWord32, value_count), |
| 891 value_count + 1, inputs_low, false), | 891 value_count + 1, inputs_low, false), |
| 892 graph()->NewNode( | 892 graph()->NewNode( |
| 893 common()->Phi(MachineRepresentation::kWord32, value_count), | 893 common()->Phi(MachineRepresentation::kWord32, value_count), |
| 894 value_count + 1, inputs_high, false)); | 894 value_count + 1, inputs_high, false)); |
| 895 } | 895 } |
| 896 } | 896 } |
| 897 } // namespace compiler | 897 } // namespace compiler |
| 898 } // namespace internal | 898 } // namespace internal |
| 899 } // namespace v8 | 899 } // namespace v8 |
| OLD | NEW |