| 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/node-properties.h" | 5 #include "src/compiler/node-properties.h" |
| 6 | 6 |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/operator-properties.h" | 8 #include "src/compiler/operator-properties.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 | 146 |
| 147 // static | 147 // static |
| 148 void NodeProperties::RemoveNonValueInputs(Node* node) { | 148 void NodeProperties::RemoveNonValueInputs(Node* node) { |
| 149 node->TrimInputCount(node->op()->ValueInputCount()); | 149 node->TrimInputCount(node->op()->ValueInputCount()); |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 // static | 153 // static |
| 154 void NodeProperties::ReplaceWithValue(Node* node, Node* value, Node* effect) { | 154 void NodeProperties::ReplaceWithValue(Node* node, Node* value, Node* effect, |
| 155 Node* control) { |
| 155 if (!effect && node->op()->EffectInputCount() > 0) { | 156 if (!effect && node->op()->EffectInputCount() > 0) { |
| 156 effect = NodeProperties::GetEffectInput(node); | 157 effect = NodeProperties::GetEffectInput(node); |
| 157 } | 158 } |
| 159 if (control == nullptr && node->op()->ControlInputCount() > 0) { |
| 160 control = NodeProperties::GetControlInput(node); |
| 161 } |
| 158 | 162 |
| 159 // Requires distinguishing between value, effect and control edges. | 163 // Requires distinguishing between value, effect and control edges. |
| 160 for (Edge edge : node->use_edges()) { | 164 for (Edge edge : node->use_edges()) { |
| 161 if (IsControlEdge(edge)) { | 165 if (IsControlEdge(edge)) { |
| 162 DCHECK_EQ(IrOpcode::kIfSuccess, edge.from()->opcode()); | 166 DCHECK_EQ(IrOpcode::kIfSuccess, edge.from()->opcode()); |
| 163 Node* control = NodeProperties::GetControlInput(node); | 167 DCHECK_NOT_NULL(control); |
| 164 edge.from()->ReplaceUses(control); | 168 edge.from()->ReplaceUses(control); |
| 165 edge.UpdateTo(NULL); | 169 edge.UpdateTo(NULL); |
| 166 } else if (IsEffectEdge(edge)) { | 170 } else if (IsEffectEdge(edge)) { |
| 167 DCHECK_NOT_NULL(effect); | 171 DCHECK_NOT_NULL(effect); |
| 168 edge.UpdateTo(effect); | 172 edge.UpdateTo(effect); |
| 169 } else { | 173 } else { |
| 170 edge.UpdateTo(value); | 174 edge.UpdateTo(value); |
| 171 } | 175 } |
| 172 } | 176 } |
| 173 } | 177 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 // static | 253 // static |
| 250 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 254 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
| 251 if (num == 0) return false; | 255 if (num == 0) return false; |
| 252 int const index = edge.index(); | 256 int const index = edge.index(); |
| 253 return first <= index && index < first + num; | 257 return first <= index && index < first + num; |
| 254 } | 258 } |
| 255 | 259 |
| 256 } // namespace compiler | 260 } // namespace compiler |
| 257 } // namespace internal | 261 } // namespace internal |
| 258 } // namespace v8 | 262 } // namespace v8 |
| OLD | NEW |