Chromium Code Reviews| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 DCHECK(node->op()->ControlOutputCount() == 0); | 155 // TODO(mstarzinger): Enable once call-sites are in the right order. |
| 156 // DCHECK(node->op()->HasProperty(Operator::kNoThrow)); | |
| 156 if (!effect && node->op()->EffectInputCount() > 0) { | 157 if (!effect && node->op()->EffectInputCount() > 0) { |
| 157 effect = NodeProperties::GetEffectInput(node); | 158 effect = NodeProperties::GetEffectInput(node); |
| 158 } | 159 } |
| 159 | 160 |
| 160 // Requires distinguishing between value and effect edges. | 161 // Requires distinguishing between value, effect and control edges. |
| 161 for (Edge edge : node->use_edges()) { | 162 for (Edge edge : node->use_edges()) { |
| 162 if (IsEffectEdge(edge)) { | 163 if (IsControlEdge(edge)) { |
|
Benedikt Meurer
2015/02/17 05:58:48
Please add a unit test for this new behavior to no
Michael Starzinger
2015/02/17 10:12:06
Done. Also added unit tests for the existing behav
| |
| 164 DCHECK_EQ(IrOpcode::kIfSuccess, edge.from()->opcode()); | |
| 165 Node* control = NodeProperties::GetControlInput(node); | |
| 166 edge.from()->ReplaceUses(control); | |
| 167 edge.UpdateTo(NULL); | |
| 168 } else if (IsEffectEdge(edge)) { | |
| 163 DCHECK_NOT_NULL(effect); | 169 DCHECK_NOT_NULL(effect); |
| 164 edge.UpdateTo(effect); | 170 edge.UpdateTo(effect); |
| 165 } else { | 171 } else { |
| 166 edge.UpdateTo(value); | 172 edge.UpdateTo(value); |
| 167 } | 173 } |
| 168 } | 174 } |
| 169 } | 175 } |
| 170 | 176 |
| 171 | 177 |
| 172 // static | 178 // static |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 194 // static | 200 // static |
| 195 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { | 201 bool NodeProperties::IsInputRange(Edge edge, int first, int num) { |
| 196 if (num == 0) return false; | 202 if (num == 0) return false; |
| 197 int const index = edge.index(); | 203 int const index = edge.index(); |
| 198 return first <= index && index < first + num; | 204 return first <= index && index < first + num; |
| 199 } | 205 } |
| 200 | 206 |
| 201 } // namespace compiler | 207 } // namespace compiler |
| 202 } // namespace internal | 208 } // namespace internal |
| 203 } // namespace v8 | 209 } // namespace v8 |
| OLD | NEW |