| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 | 81 |
| 82 // The StructuredGraphBuilder produces a high-level IR graph. It is used as the | 82 // The StructuredGraphBuilder produces a high-level IR graph. It is used as the |
| 83 // base class for concrete implementations (e.g the AstGraphBuilder or the | 83 // base class for concrete implementations (e.g the AstGraphBuilder or the |
| 84 // StubGraphBuilder). | 84 // StubGraphBuilder). |
| 85 class StructuredGraphBuilder : public GraphBuilder { | 85 class StructuredGraphBuilder : public GraphBuilder { |
| 86 public: | 86 public: |
| 87 StructuredGraphBuilder(Zone* zone, Graph* graph, | 87 StructuredGraphBuilder(Zone* zone, Graph* graph, |
| 88 CommonOperatorBuilder* common); | 88 CommonOperatorBuilder* common); |
| 89 virtual ~StructuredGraphBuilder() {} | 89 ~StructuredGraphBuilder() OVERRIDE {} |
| 90 | 90 |
| 91 // Creates a new Phi node having {count} input values. | 91 // Creates a new Phi node having {count} input values. |
| 92 Node* NewPhi(int count, Node* input, Node* control); | 92 Node* NewPhi(int count, Node* input, Node* control); |
| 93 Node* NewEffectPhi(int count, Node* input, Node* control); | 93 Node* NewEffectPhi(int count, Node* input, Node* control); |
| 94 | 94 |
| 95 // Helpers for merging control, effect or value dependencies. | 95 // Helpers for merging control, effect or value dependencies. |
| 96 Node* MergeControl(Node* control, Node* other); | 96 Node* MergeControl(Node* control, Node* other); |
| 97 Node* MergeEffect(Node* value, Node* other, Node* control); | 97 Node* MergeEffect(Node* value, Node* other, Node* control); |
| 98 Node* MergeValue(Node* value, Node* other, Node* control); | 98 Node* MergeValue(Node* value, Node* other, Node* control); |
| 99 | 99 |
| 100 // Helpers to create new control nodes. | 100 // Helpers to create new control nodes. |
| 101 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } | 101 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } |
| 102 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } | 102 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } |
| 103 Node* NewMerge() { return NewNode(common()->Merge(1), true); } | 103 Node* NewMerge() { return NewNode(common()->Merge(1), true); } |
| 104 Node* NewLoop() { return NewNode(common()->Loop(1), true); } | 104 Node* NewLoop() { return NewNode(common()->Loop(1), true); } |
| 105 Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) { | 105 Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) { |
| 106 return NewNode(common()->Branch(hint), condition); | 106 return NewNode(common()->Branch(hint), condition); |
| 107 } | 107 } |
| 108 | 108 |
| 109 protected: | 109 protected: |
| 110 class Environment; | 110 class Environment; |
| 111 friend class Environment; | 111 friend class Environment; |
| 112 friend class ControlBuilder; | 112 friend class ControlBuilder; |
| 113 | 113 |
| 114 // The following method creates a new node having the specified operator and | 114 // The following method creates a new node having the specified operator and |
| 115 // ensures effect and control dependencies are wired up. The dependencies | 115 // ensures effect and control dependencies are wired up. The dependencies |
| 116 // tracked by the environment might be mutated. | 116 // tracked by the environment might be mutated. |
| 117 virtual Node* MakeNode(const Operator* op, int value_input_count, | 117 Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs, |
| 118 Node** value_inputs, bool incomplete) FINAL; | 118 bool incomplete) FINAL; |
| 119 | 119 |
| 120 Environment* environment() const { return environment_; } | 120 Environment* environment() const { return environment_; } |
| 121 void set_environment(Environment* env) { environment_ = env; } | 121 void set_environment(Environment* env) { environment_ = env; } |
| 122 | 122 |
| 123 Node* current_context() const { return current_context_; } | 123 Node* current_context() const { return current_context_; } |
| 124 void set_current_context(Node* context) { current_context_ = context; } | 124 void set_current_context(Node* context) { current_context_ = context; } |
| 125 | 125 |
| 126 Node* exit_control() const { return exit_control_; } | 126 Node* exit_control() const { return exit_control_; } |
| 127 void set_exit_control(Node* node) { exit_control_ = node; } | 127 void set_exit_control(Node* node) { exit_control_ = node; } |
| 128 | 128 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 StructuredGraphBuilder* builder_; | 239 StructuredGraphBuilder* builder_; |
| 240 Node* control_dependency_; | 240 Node* control_dependency_; |
| 241 Node* effect_dependency_; | 241 Node* effect_dependency_; |
| 242 NodeVector values_; | 242 NodeVector values_; |
| 243 }; | 243 }; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 } // namespace v8::internal::compiler | 246 } // namespace v8::internal::compiler |
| 247 | 247 |
| 248 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | 248 #endif // V8_COMPILER_GRAPH_BUILDER_H__ |
| OLD | NEW |