| 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" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } | 94 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } |
| 95 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } | 95 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } |
| 96 Node* NewMerge() { return NewNode(common()->Merge(1)); } | 96 Node* NewMerge() { return NewNode(common()->Merge(1)); } |
| 97 Node* NewLoop() { return NewNode(common()->Loop(1)); } | 97 Node* NewLoop() { return NewNode(common()->Loop(1)); } |
| 98 Node* NewBranch(Node* condition) { | 98 Node* NewBranch(Node* condition) { |
| 99 return NewNode(common()->Branch(), condition); | 99 return NewNode(common()->Branch(), condition); |
| 100 } | 100 } |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 class Environment; | 103 class Environment; |
| 104 friend class Environment; |
| 104 friend class ControlBuilder; | 105 friend class ControlBuilder; |
| 105 | 106 |
| 106 // The following method creates a new node having the specified operator and | 107 // The following method creates a new node having the specified operator and |
| 107 // ensures effect and control dependencies are wired up. The dependencies | 108 // ensures effect and control dependencies are wired up. The dependencies |
| 108 // tracked by the environment might be mutated. | 109 // tracked by the environment might be mutated. |
| 109 virtual Node* MakeNode(Operator* op, int value_input_count, | 110 virtual Node* MakeNode(Operator* op, int value_input_count, |
| 110 Node** value_inputs); | 111 Node** value_inputs); |
| 111 | 112 |
| 112 Environment* environment() const { return environment_; } | 113 Environment* environment() const { return environment_; } |
| 113 void set_environment(Environment* env) { environment_ = env; } | 114 void set_environment(Environment* env) { environment_ = env; } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 env->MarkAsUnreachable(); | 196 env->MarkAsUnreachable(); |
| 196 return env; | 197 return env; |
| 197 } | 198 } |
| 198 | 199 |
| 199 // Copies this environment at a loop header control-flow point. | 200 // Copies this environment at a loop header control-flow point. |
| 200 Environment* CopyForLoop() { | 201 Environment* CopyForLoop() { |
| 201 PrepareForLoop(); | 202 PrepareForLoop(); |
| 202 return builder()->CopyEnvironment(this); | 203 return builder()->CopyEnvironment(this); |
| 203 } | 204 } |
| 204 | 205 |
| 206 Node* GetContext() { return builder_->current_context(); } |
| 207 |
| 205 protected: | 208 protected: |
| 206 // TODO(mstarzinger): Use phase-local zone instead! | 209 // TODO(mstarzinger): Use phase-local zone instead! |
| 207 Zone* zone() const { return graph()->zone(); } | 210 Zone* zone() const { return graph()->zone(); } |
| 208 Graph* graph() const { return builder_->graph(); } | 211 Graph* graph() const { return builder_->graph(); } |
| 209 StructuredGraphBuilder* builder() const { return builder_; } | 212 StructuredGraphBuilder* builder() const { return builder_; } |
| 210 CommonOperatorBuilder* common() { return builder_->common(); } | 213 CommonOperatorBuilder* common() { return builder_->common(); } |
| 211 NodeVector* values() { return &values_; } | 214 NodeVector* values() { return &values_; } |
| 212 | 215 |
| 213 // Prepare environment to be used as loop header. | 216 // Prepare environment to be used as loop header. |
| 214 void PrepareForLoop(); | 217 void PrepareForLoop(); |
| 215 | 218 |
| 216 private: | 219 private: |
| 217 StructuredGraphBuilder* builder_; | 220 StructuredGraphBuilder* builder_; |
| 218 Node* control_dependency_; | 221 Node* control_dependency_; |
| 219 Node* effect_dependency_; | 222 Node* effect_dependency_; |
| 220 NodeVector values_; | 223 NodeVector values_; |
| 221 }; | 224 }; |
| 222 } | 225 } |
| 223 } | 226 } |
| 224 } // namespace v8::internal::compiler | 227 } // namespace v8::internal::compiler |
| 225 | 228 |
| 226 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | 229 #endif // V8_COMPILER_GRAPH_BUILDER_H__ |
| OLD | NEW |