| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/simd-scalar-lowering.h" | 5 #include "src/compiler/simd-scalar-lowering.h" |
| 6 #include "src/compiler/diamond.h" | 6 #include "src/compiler/diamond.h" |
| 7 #include "src/compiler/linkage.h" | 7 #include "src/compiler/linkage.h" |
| 8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
| 9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
| 10 | 10 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 return result; | 131 return result; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void SimdScalarLowering::LowerNode(Node* node) { | 134 void SimdScalarLowering::LowerNode(Node* node) { |
| 135 SimdType rep_type = ReplacementType(node); | 135 SimdType rep_type = ReplacementType(node); |
| 136 switch (node->opcode()) { | 136 switch (node->opcode()) { |
| 137 case IrOpcode::kStart: { | 137 case IrOpcode::kStart: { |
| 138 int parameter_count = GetParameterCountAfterLowering(); | 138 int parameter_count = GetParameterCountAfterLowering(); |
| 139 // Only exchange the node if the parameter count actually changed. | 139 // Only exchange the node if the parameter count actually changed. |
| 140 if (parameter_count != signature()->parameter_count()) { | 140 if (parameter_count != static_cast<int>(signature()->parameter_count())) { |
| 141 int delta = | 141 int delta = |
| 142 parameter_count - static_cast<int>(signature()->parameter_count()); | 142 parameter_count - static_cast<int>(signature()->parameter_count()); |
| 143 int new_output_count = node->op()->ValueOutputCount() + delta; | 143 int new_output_count = node->op()->ValueOutputCount() + delta; |
| 144 NodeProperties::ChangeOp(node, common()->Start(new_output_count)); | 144 NodeProperties::ChangeOp(node, common()->Start(new_output_count)); |
| 145 } | 145 } |
| 146 break; | 146 break; |
| 147 } | 147 } |
| 148 case IrOpcode::kParameter: { | 148 case IrOpcode::kParameter: { |
| 149 DCHECK(node->InputCount() == 1); | 149 DCHECK(node->InputCount() == 1); |
| 150 // Only exchange the node if the parameter count actually changed. We do | 150 // Only exchange the node if the parameter count actually changed. We do |
| 151 // not even have to do the default lowering because the the start node, | 151 // not even have to do the default lowering because the the start node, |
| 152 // the only input of a parameter node, only changes if the parameter count | 152 // the only input of a parameter node, only changes if the parameter count |
| 153 // changes. | 153 // changes. |
| 154 if (GetParameterCountAfterLowering() != signature()->parameter_count()) { | 154 if (GetParameterCountAfterLowering() != |
| 155 static_cast<int>(signature()->parameter_count())) { |
| 155 int old_index = ParameterIndexOf(node->op()); | 156 int old_index = ParameterIndexOf(node->op()); |
| 156 int new_index = GetParameterIndexAfterLowering(signature(), old_index); | 157 int new_index = GetParameterIndexAfterLowering(signature(), old_index); |
| 157 if (old_index == new_index) { | 158 if (old_index == new_index) { |
| 158 NodeProperties::ChangeOp(node, common()->Parameter(new_index)); | 159 NodeProperties::ChangeOp(node, common()->Parameter(new_index)); |
| 159 | 160 |
| 160 Node* new_node[kMaxLanes]; | 161 Node* new_node[kMaxLanes]; |
| 161 for (int i = 0; i < kMaxLanes; i++) { | 162 for (int i = 0; i < kMaxLanes; i++) { |
| 162 new_node[i] = nullptr; | 163 new_node[i] = nullptr; |
| 163 } | 164 } |
| 164 new_node[0] = node; | 165 new_node[0] = node; |
| 165 if (signature()->GetParam(old_index) == | 166 if (signature()->GetParam(old_index) == |
| 166 MachineRepresentation::kSimd128) { | 167 MachineRepresentation::kSimd128) { |
| 167 for (int i = 1; i < kMaxLanes; i++) { | 168 for (int i = 1; i < kMaxLanes; i++) { |
| 168 new_node[i] = graph()->NewNode(common()->Parameter(new_index + i), | 169 new_node[i] = graph()->NewNode(common()->Parameter(new_index + i), |
| 169 graph()->start()); | 170 graph()->start()); |
| 170 } | 171 } |
| 171 } | 172 } |
| 172 ReplaceNode(node, new_node); | 173 ReplaceNode(node, new_node); |
| 173 } | 174 } |
| 174 } | 175 } |
| 175 break; | 176 break; |
| 176 } | 177 } |
| 177 case IrOpcode::kReturn: { | 178 case IrOpcode::kReturn: { |
| 178 DefaultLowering(node); | 179 DefaultLowering(node); |
| 179 int new_return_count = GetReturnCountAfterLowering(signature()); | 180 int new_return_count = GetReturnCountAfterLowering(signature()); |
| 180 if (signature()->return_count() != new_return_count) { | 181 if (static_cast<int>(signature()->return_count()) != new_return_count) { |
| 181 NodeProperties::ChangeOp(node, common()->Return(new_return_count)); | 182 NodeProperties::ChangeOp(node, common()->Return(new_return_count)); |
| 182 } | 183 } |
| 183 break; | 184 break; |
| 184 } | 185 } |
| 185 case IrOpcode::kCall: { | 186 case IrOpcode::kCall: { |
| 186 // TODO(turbofan): Make WASM code const-correct wrt. CallDescriptor. | 187 // TODO(turbofan): Make WASM code const-correct wrt. CallDescriptor. |
| 187 CallDescriptor* descriptor = | 188 CallDescriptor* descriptor = |
| 188 const_cast<CallDescriptor*>(CallDescriptorOf(node->op())); | 189 const_cast<CallDescriptor*>(CallDescriptorOf(node->op())); |
| 189 if (DefaultLowering(node) || | 190 if (DefaultLowering(node) || |
| 190 (descriptor->ReturnCount() == 1 && | 191 (descriptor->ReturnCount() == 1 && |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } else { | 401 } else { |
| 401 UNREACHABLE(); | 402 UNREACHABLE(); |
| 402 } | 403 } |
| 403 } | 404 } |
| 404 ReplaceNode(phi, rep_nodes); | 405 ReplaceNode(phi, rep_nodes); |
| 405 } | 406 } |
| 406 } | 407 } |
| 407 } // namespace compiler | 408 } // namespace compiler |
| 408 } // namespace internal | 409 } // namespace internal |
| 409 } // namespace v8 | 410 } // namespace v8 |
| OLD | NEW |