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_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_GRAPH_BUILDER_H_ |
6 #define V8_COMPILER_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
11 #include "src/compiler/common-operator.h" | 11 #include "src/compiler/common-operator.h" |
12 #include "src/compiler/graph.h" | 12 #include "src/compiler/graph.h" |
13 #include "src/unique.h" | 13 #include "src/unique.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
| 17 |
| 18 class BitVector; |
| 19 |
17 namespace compiler { | 20 namespace compiler { |
18 | 21 |
19 class Node; | 22 class Node; |
20 | 23 |
21 // A common base class for anything that creates nodes in a graph. | 24 // A common base class for anything that creates nodes in a graph. |
22 class GraphBuilder { | 25 class GraphBuilder { |
23 public: | 26 public: |
24 explicit GraphBuilder(Graph* graph) : graph_(graph) {} | 27 explicit GraphBuilder(Graph* graph) : graph_(graph) {} |
25 virtual ~GraphBuilder() {} | 28 virtual ~GraphBuilder() {} |
26 | 29 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 Environment* CopyForConditional() { return builder()->CopyEnvironment(this); } | 211 Environment* CopyForConditional() { return builder()->CopyEnvironment(this); } |
209 | 212 |
210 // Copies this environment to a potentially unreachable control-flow point. | 213 // Copies this environment to a potentially unreachable control-flow point. |
211 Environment* CopyAsUnreachable() { | 214 Environment* CopyAsUnreachable() { |
212 Environment* env = builder()->CopyEnvironment(this); | 215 Environment* env = builder()->CopyEnvironment(this); |
213 env->MarkAsUnreachable(); | 216 env->MarkAsUnreachable(); |
214 return env; | 217 return env; |
215 } | 218 } |
216 | 219 |
217 // Copies this environment at a loop header control-flow point. | 220 // Copies this environment at a loop header control-flow point. |
218 Environment* CopyForLoop() { | 221 Environment* CopyForLoop(BitVector* assigned) { |
219 PrepareForLoop(); | 222 PrepareForLoop(assigned); |
220 return builder()->CopyEnvironment(this); | 223 return builder()->CopyEnvironment(this); |
221 } | 224 } |
222 | 225 |
223 Node* GetContext() { return builder_->current_context(); } | 226 Node* GetContext() { return builder_->current_context(); } |
224 | 227 |
225 protected: | 228 protected: |
226 Zone* zone() const { return builder_->local_zone(); } | 229 Zone* zone() const { return builder_->local_zone(); } |
227 Graph* graph() const { return builder_->graph(); } | 230 Graph* graph() const { return builder_->graph(); } |
228 StructuredGraphBuilder* builder() const { return builder_; } | 231 StructuredGraphBuilder* builder() const { return builder_; } |
229 CommonOperatorBuilder* common() { return builder_->common(); } | 232 CommonOperatorBuilder* common() { return builder_->common(); } |
230 NodeVector* values() { return &values_; } | 233 NodeVector* values() { return &values_; } |
231 | 234 |
232 // Prepare environment to be used as loop header. | 235 // Prepare environment to be used as loop header. |
233 void PrepareForLoop(); | 236 void PrepareForLoop(BitVector* assigned); |
234 | 237 |
235 private: | 238 private: |
236 StructuredGraphBuilder* builder_; | 239 StructuredGraphBuilder* builder_; |
237 Node* control_dependency_; | 240 Node* control_dependency_; |
238 Node* effect_dependency_; | 241 Node* effect_dependency_; |
239 NodeVector values_; | 242 NodeVector values_; |
240 }; | 243 }; |
241 } | 244 } |
242 } | 245 } |
243 } // namespace v8::internal::compiler | 246 } // namespace v8::internal::compiler |
244 | 247 |
245 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | 248 #endif // V8_COMPILER_GRAPH_BUILDER_H__ |
OLD | NEW |