| 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 #include "src/compiler/graph-builder.h" | 5 #include "src/compiler/graph-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/compiler/generic-graph.h" | 8 #include "src/compiler/generic-graph.h" |
| 9 #include "src/compiler/generic-node.h" | 9 #include "src/compiler/generic-node.h" |
| 10 #include "src/compiler/generic-node-inl.h" | 10 #include "src/compiler/generic-node-inl.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // Create a merge of the effect dependencies of both environments and update | 139 // Create a merge of the effect dependencies of both environments and update |
| 140 // the current environment's effect dependency accordingly. | 140 // the current environment's effect dependency accordingly. |
| 141 Node* effect = builder_->MergeEffect(this->GetEffectDependency(), | 141 Node* effect = builder_->MergeEffect(this->GetEffectDependency(), |
| 142 other->GetEffectDependency(), control); | 142 other->GetEffectDependency(), control); |
| 143 UpdateEffectDependency(effect); | 143 UpdateEffectDependency(effect); |
| 144 | 144 |
| 145 // Introduce Phi nodes for values that have differing input at merge points, | 145 // Introduce Phi nodes for values that have differing input at merge points, |
| 146 // potentially extending an existing Phi node if possible. | 146 // potentially extending an existing Phi node if possible. |
| 147 for (int i = 0; i < static_cast<int>(values_.size()); ++i) { | 147 for (int i = 0; i < static_cast<int>(values_.size()); ++i) { |
| 148 if (values_[i] == NULL) continue; | |
| 149 values_[i] = builder_->MergeValue(values_[i], other->values_[i], control); | 148 values_[i] = builder_->MergeValue(values_[i], other->values_[i], control); |
| 150 } | 149 } |
| 151 } | 150 } |
| 152 | 151 |
| 153 | 152 |
| 154 void StructuredGraphBuilder::Environment::PrepareForLoop() { | 153 void StructuredGraphBuilder::Environment::PrepareForLoop() { |
| 155 Node* control = GetControlDependency(); | 154 Node* control = GetControlDependency(); |
| 156 for (int i = 0; i < static_cast<int>(values()->size()); ++i) { | 155 for (int i = 0; i < static_cast<int>(values()->size()); ++i) { |
| 157 if (values()->at(i) == NULL) continue; | |
| 158 Node* phi = builder_->NewPhi(1, values()->at(i), control); | 156 Node* phi = builder_->NewPhi(1, values()->at(i), control); |
| 159 values()->at(i) = phi; | 157 values()->at(i) = phi; |
| 160 } | 158 } |
| 161 Node* effect = builder_->NewEffectPhi(1, GetEffectDependency(), control); | 159 Node* effect = builder_->NewEffectPhi(1, GetEffectDependency(), control); |
| 162 UpdateEffectDependency(effect); | 160 UpdateEffectDependency(effect); |
| 163 } | 161 } |
| 164 | 162 |
| 165 | 163 |
| 166 Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) { | 164 Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) { |
| 167 Operator* phi_op = common()->Phi(count); | 165 Operator* phi_op = common()->Phi(count); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!dead_control_.is_set()) { | 242 if (!dead_control_.is_set()) { |
| 245 Node* dead_node = graph()->NewNode(common_->Dead()); | 243 Node* dead_node = graph()->NewNode(common_->Dead()); |
| 246 dead_control_.set(dead_node); | 244 dead_control_.set(dead_node); |
| 247 return dead_node; | 245 return dead_node; |
| 248 } | 246 } |
| 249 return dead_control_.get(); | 247 return dead_control_.get(); |
| 250 } | 248 } |
| 251 } | 249 } |
| 252 } | 250 } |
| 253 } // namespace v8::internal::compiler | 251 } // namespace v8::internal::compiler |
| OLD | NEW |