| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 Environment* CopyForConditional() { return builder()->CopyEnvironment(this); } | 199 Environment* CopyForConditional() { return builder()->CopyEnvironment(this); } |
| 197 | 200 |
| 198 // Copies this environment to a potentially unreachable control-flow point. | 201 // Copies this environment to a potentially unreachable control-flow point. |
| 199 Environment* CopyAsUnreachable() { | 202 Environment* CopyAsUnreachable() { |
| 200 Environment* env = builder()->CopyEnvironment(this); | 203 Environment* env = builder()->CopyEnvironment(this); |
| 201 env->MarkAsUnreachable(); | 204 env->MarkAsUnreachable(); |
| 202 return env; | 205 return env; |
| 203 } | 206 } |
| 204 | 207 |
| 205 // Copies this environment at a loop header control-flow point. | 208 // Copies this environment at a loop header control-flow point. |
| 206 Environment* CopyForLoop() { | 209 Environment* CopyForLoop(BitVector* assigned) { |
| 207 PrepareForLoop(); | 210 PrepareForLoop(assigned); |
| 208 return builder()->CopyEnvironment(this); | 211 return builder()->CopyEnvironment(this); |
| 209 } | 212 } |
| 210 | 213 |
| 211 Node* GetContext() { return builder_->current_context(); } | 214 Node* GetContext() { return builder_->current_context(); } |
| 212 | 215 |
| 213 protected: | 216 protected: |
| 214 Zone* zone() const { return builder_->local_zone(); } | 217 Zone* zone() const { return builder_->local_zone(); } |
| 215 Graph* graph() const { return builder_->graph(); } | 218 Graph* graph() const { return builder_->graph(); } |
| 216 StructuredGraphBuilder* builder() const { return builder_; } | 219 StructuredGraphBuilder* builder() const { return builder_; } |
| 217 CommonOperatorBuilder* common() { return builder_->common(); } | 220 CommonOperatorBuilder* common() { return builder_->common(); } |
| 218 NodeVector* values() { return &values_; } | 221 NodeVector* values() { return &values_; } |
| 219 | 222 |
| 220 // Prepare environment to be used as loop header. | 223 // Prepare environment to be used as loop header. |
| 221 void PrepareForLoop(); | 224 void PrepareForLoop(BitVector* assigned); |
| 222 | 225 |
| 223 private: | 226 private: |
| 224 StructuredGraphBuilder* builder_; | 227 StructuredGraphBuilder* builder_; |
| 225 Node* control_dependency_; | 228 Node* control_dependency_; |
| 226 Node* effect_dependency_; | 229 Node* effect_dependency_; |
| 227 NodeVector values_; | 230 NodeVector values_; |
| 228 }; | 231 }; |
| 229 } | 232 } |
| 230 } | 233 } |
| 231 } // namespace v8::internal::compiler | 234 } // namespace v8::internal::compiler |
| 232 | 235 |
| 233 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | 236 #endif // V8_COMPILER_GRAPH_BUILDER_H__ |
| OLD | NEW |