| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
| 6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
| 7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
| 8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 // static | 157 // static |
| 158 void NodeProperties::RemoveNonValueInputs(Node* node) { | 158 void NodeProperties::RemoveNonValueInputs(Node* node) { |
| 159 node->TrimInputCount(node->op()->ValueInputCount()); | 159 node->TrimInputCount(node->op()->ValueInputCount()); |
| 160 } | 160 } |
| 161 | 161 |
| 162 | 162 |
| 163 void NodeProperties::MergeControlToEnd(Graph* graph, | 163 void NodeProperties::MergeControlToEnd(Graph* graph, |
| 164 CommonOperatorBuilder* common, | 164 CommonOperatorBuilder* common, |
| 165 Node* node) { | 165 Node* node) { |
| 166 // Connect the node to the merge exiting the graph. | 166 graph->end()->AppendInput(graph->zone(), node); |
| 167 Node* end_pred = NodeProperties::GetControlInput(graph->end()); | 167 graph->end()->set_op(common->End(graph->end()->InputCount())); |
| 168 if (end_pred->opcode() == IrOpcode::kMerge) { | |
| 169 int inputs = end_pred->op()->ControlInputCount() + 1; | |
| 170 end_pred->AppendInput(graph->zone(), node); | |
| 171 end_pred->set_op(common->Merge(inputs)); | |
| 172 } else { | |
| 173 Node* merge = graph->NewNode(common->Merge(2), end_pred, node); | |
| 174 NodeProperties::ReplaceControlInput(graph->end(), merge); | |
| 175 } | |
| 176 } | 168 } |
| 177 | 169 |
| 178 | 170 |
| 179 // static | 171 // static |
| 180 void NodeProperties::ReplaceWithValue(Node* node, Node* value, Node* effect, | 172 void NodeProperties::ReplaceWithValue(Node* node, Node* value, Node* effect, |
| 181 Node* control) { | 173 Node* control) { |
| 182 if (!effect && node->op()->EffectInputCount() > 0) { | 174 if (!effect && node->op()->EffectInputCount() > 0) { |
| 183 effect = NodeProperties::GetEffectInput(node); | 175 effect = NodeProperties::GetEffectInput(node); |
| 184 } | 176 } |
| 185 if (control == nullptr && node->op()->ControlInputCount() > 0) { | 177 if (control == nullptr && node->op()->ControlInputCount() > 0) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // static | 271 // static |
| 280 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 272 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
| 281 if (num == 0) return false; | 273 if (num == 0) return false; |
| 282 int const index = edge.index(); | 274 int const index = edge.index(); |
| 283 return first <= index && index < first + num; | 275 return first <= index && index < first + num; |
| 284 } | 276 } |
| 285 | 277 |
| 286 } // namespace compiler | 278 } // namespace compiler |
| 287 } // namespace internal | 279 } // namespace internal |
| 288 } // namespace v8 | 280 } // namespace v8 |
| OLD | NEW |