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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 : builder_(builder), | 118 : builder_(builder), |
119 control_dependency_(control_dependency), | 119 control_dependency_(control_dependency), |
120 effect_dependency_(control_dependency), | 120 effect_dependency_(control_dependency), |
121 values_(zone()) {} | 121 values_(zone()) {} |
122 | 122 |
123 | 123 |
124 StructuredGraphBuilder::Environment::Environment(const Environment& copy) | 124 StructuredGraphBuilder::Environment::Environment(const Environment& copy) |
125 : builder_(copy.builder()), | 125 : builder_(copy.builder()), |
126 control_dependency_(copy.control_dependency_), | 126 control_dependency_(copy.control_dependency_), |
127 effect_dependency_(copy.effect_dependency_), | 127 effect_dependency_(copy.effect_dependency_), |
128 values_(copy.values_) {} | 128 values_(copy.zone()) { |
| 129 const size_t kStackEstimate = 7; // optimum from experimentation! |
| 130 values_.reserve(copy.values_.size() + kStackEstimate); |
| 131 values_.insert(values_.begin(), copy.values_.begin(), copy.values_.end()); |
| 132 } |
129 | 133 |
130 | 134 |
131 void StructuredGraphBuilder::Environment::Merge(Environment* other) { | 135 void StructuredGraphBuilder::Environment::Merge(Environment* other) { |
132 DCHECK(values_.size() == other->values_.size()); | 136 DCHECK(values_.size() == other->values_.size()); |
133 | 137 |
134 // Nothing to do if the other environment is dead. | 138 // Nothing to do if the other environment is dead. |
135 if (other->IsMarkedAsUnreachable()) return; | 139 if (other->IsMarkedAsUnreachable()) return; |
136 | 140 |
137 // Resurrect a dead environment by copying the contents of the other one and | 141 // Resurrect a dead environment by copying the contents of the other one and |
138 // placing a singleton merge as the new control dependency. | 142 // placing a singleton merge as the new control dependency. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (!dead_control_.is_set()) { | 272 if (!dead_control_.is_set()) { |
269 Node* dead_node = graph()->NewNode(common_->Dead()); | 273 Node* dead_node = graph()->NewNode(common_->Dead()); |
270 dead_control_.set(dead_node); | 274 dead_control_.set(dead_node); |
271 return dead_node; | 275 return dead_node; |
272 } | 276 } |
273 return dead_control_.get(); | 277 return dead_control_.get(); |
274 } | 278 } |
275 } | 279 } |
276 } | 280 } |
277 } // namespace v8::internal::compiler | 281 } // namespace v8::internal::compiler |
OLD | NEW |