| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_COMPILER_NODE_PROPERTIES_INL_H_ | 5 #ifndef V8_COMPILER_NODE_PROPERTIES_INL_H_ |
| 6 #define V8_COMPILER_NODE_PROPERTIES_INL_H_ | 6 #define V8_COMPILER_NODE_PROPERTIES_INL_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 int index) { | 141 int index) { |
| 142 DCHECK(index < OperatorProperties::GetEffectInputCount(node->op())); | 142 DCHECK(index < OperatorProperties::GetEffectInputCount(node->op())); |
| 143 return node->ReplaceInput(FirstEffectIndex(node) + index, effect); | 143 return node->ReplaceInput(FirstEffectIndex(node) + index, effect); |
| 144 } | 144 } |
| 145 | 145 |
| 146 inline void NodeProperties::RemoveNonValueInputs(Node* node) { | 146 inline void NodeProperties::RemoveNonValueInputs(Node* node) { |
| 147 node->TrimInputCount(OperatorProperties::GetValueInputCount(node->op())); | 147 node->TrimInputCount(OperatorProperties::GetValueInputCount(node->op())); |
| 148 } | 148 } |
| 149 | 149 |
| 150 | 150 |
| 151 // Replace value uses of {node} with {value} and effect uses of {node} with | |
| 152 // {effect}. If {effect == NULL}, then use the effect input to {node}. | |
| 153 inline void NodeProperties::ReplaceWithValue(Node* node, Node* value, | |
| 154 Node* effect) { | |
| 155 DCHECK(!OperatorProperties::HasControlOutput(node->op())); | |
| 156 if (effect == NULL && OperatorProperties::HasEffectInput(node->op())) { | |
| 157 effect = NodeProperties::GetEffectInput(node); | |
| 158 } | |
| 159 | |
| 160 // Requires distinguishing between value and effect edges. | |
| 161 UseIter iter = node->uses().begin(); | |
| 162 while (iter != node->uses().end()) { | |
| 163 if (NodeProperties::IsEffectEdge(iter.edge())) { | |
| 164 DCHECK_NE(NULL, effect); | |
| 165 iter = iter.UpdateToAndIncrement(effect); | |
| 166 } else { | |
| 167 iter = iter.UpdateToAndIncrement(value); | |
| 168 } | |
| 169 } | |
| 170 } | |
| 171 | |
| 172 | |
| 173 // ----------------------------------------------------------------------------- | 151 // ----------------------------------------------------------------------------- |
| 174 // Type Bounds. | 152 // Type Bounds. |
| 175 | 153 |
| 176 inline Bounds NodeProperties::GetBounds(Node* node) { return node->bounds(); } | 154 inline Bounds NodeProperties::GetBounds(Node* node) { return node->bounds(); } |
| 177 | 155 |
| 178 inline void NodeProperties::SetBounds(Node* node, Bounds b) { | 156 inline void NodeProperties::SetBounds(Node* node, Bounds b) { |
| 179 node->set_bounds(b); | 157 node->set_bounds(b); |
| 180 } | 158 } |
| 181 | 159 |
| 182 | 160 |
| 183 } | 161 } |
| 184 } | 162 } |
| 185 } // namespace v8::internal::compiler | 163 } // namespace v8::internal::compiler |
| 186 | 164 |
| 187 #endif // V8_COMPILER_NODE_PROPERTIES_INL_H_ | 165 #endif // V8_COMPILER_NODE_PROPERTIES_INL_H_ |
| OLD | NEW |