| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 private: | 72 private: |
| 73 Graph* graph_; | 73 Graph* graph_; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 | 76 |
| 77 // The StructuredGraphBuilder produces a high-level IR graph. It is used as the | 77 // The StructuredGraphBuilder produces a high-level IR graph. It is used as the |
| 78 // base class for concrete implementations (e.g the AstGraphBuilder or the | 78 // base class for concrete implementations (e.g the AstGraphBuilder or the |
| 79 // StubGraphBuilder). | 79 // StubGraphBuilder). |
| 80 class StructuredGraphBuilder : public GraphBuilder { | 80 class StructuredGraphBuilder : public GraphBuilder { |
| 81 public: | 81 public: |
| 82 StructuredGraphBuilder(Graph* graph, CommonOperatorBuilder* common); | 82 StructuredGraphBuilder(Zone* zone, Graph* graph, |
| 83 CommonOperatorBuilder* common); |
| 83 virtual ~StructuredGraphBuilder() {} | 84 virtual ~StructuredGraphBuilder() {} |
| 84 | 85 |
| 85 // Creates a new Phi node having {count} input values. | 86 // Creates a new Phi node having {count} input values. |
| 86 Node* NewPhi(int count, Node* input, Node* control); | 87 Node* NewPhi(int count, Node* input, Node* control); |
| 87 Node* NewEffectPhi(int count, Node* input, Node* control); | 88 Node* NewEffectPhi(int count, Node* input, Node* control); |
| 88 | 89 |
| 89 // Helpers for merging control, effect or value dependencies. | 90 // Helpers for merging control, effect or value dependencies. |
| 90 Node* MergeControl(Node* control, Node* other); | 91 Node* MergeControl(Node* control, Node* other); |
| 91 Node* MergeEffect(Node* value, Node* other, Node* control); | 92 Node* MergeEffect(Node* value, Node* other, Node* control); |
| 92 Node* MergeValue(Node* value, Node* other, Node* control); | 93 Node* MergeValue(Node* value, Node* other, Node* control); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 116 | 117 |
| 117 Node* current_context() const { return current_context_; } | 118 Node* current_context() const { return current_context_; } |
| 118 void set_current_context(Node* context) { current_context_ = context; } | 119 void set_current_context(Node* context) { current_context_ = context; } |
| 119 | 120 |
| 120 Node* exit_control() const { return exit_control_; } | 121 Node* exit_control() const { return exit_control_; } |
| 121 void set_exit_control(Node* node) { exit_control_ = node; } | 122 void set_exit_control(Node* node) { exit_control_ = node; } |
| 122 | 123 |
| 123 Node* dead_control(); | 124 Node* dead_control(); |
| 124 | 125 |
| 125 Zone* graph_zone() const { return graph()->zone(); } | 126 Zone* graph_zone() const { return graph()->zone(); } |
| 126 Zone* local_zone() { return &local_zone_; } | 127 Zone* local_zone() const { return local_zone_; } |
| 127 Isolate* isolate() const { return graph_zone()->isolate(); } | 128 Isolate* isolate() const { return graph_zone()->isolate(); } |
| 128 CommonOperatorBuilder* common() const { return common_; } | 129 CommonOperatorBuilder* common() const { return common_; } |
| 129 | 130 |
| 130 // Helper to wrap a Handle<T> into a Unique<T>. | 131 // Helper to wrap a Handle<T> into a Unique<T>. |
| 131 template <class T> | 132 template <class T> |
| 132 Unique<T> MakeUnique(Handle<T> object) { | 133 Unique<T> MakeUnique(Handle<T> object) { |
| 133 return Unique<T>::CreateUninitialized(object); | 134 return Unique<T>::CreateUninitialized(object); |
| 134 } | 135 } |
| 135 | 136 |
| 136 // Support for control flow builders. The concrete type of the environment | 137 // Support for control flow builders. The concrete type of the environment |
| 137 // depends on the graph builder, but environments themselves are not virtual. | 138 // depends on the graph builder, but environments themselves are not virtual. |
| 138 virtual Environment* CopyEnvironment(Environment* env); | 139 virtual Environment* CopyEnvironment(Environment* env); |
| 139 | 140 |
| 140 // Helper to indicate a node exits the function body. | 141 // Helper to indicate a node exits the function body. |
| 141 void UpdateControlDependencyToLeaveFunction(Node* exit); | 142 void UpdateControlDependencyToLeaveFunction(Node* exit); |
| 142 | 143 |
| 143 private: | 144 private: |
| 144 CommonOperatorBuilder* common_; | 145 CommonOperatorBuilder* common_; |
| 145 Environment* environment_; | 146 Environment* environment_; |
| 146 | 147 |
| 147 // Zone local to the builder for data not leaking into the graph. | 148 // Zone local to the builder for data not leaking into the graph. |
| 148 Zone local_zone_; | 149 Zone* local_zone_; |
| 149 | 150 |
| 150 // Node representing the control dependency for dead code. | 151 // Node representing the control dependency for dead code. |
| 151 SetOncePointer<Node> dead_control_; | 152 SetOncePointer<Node> dead_control_; |
| 152 | 153 |
| 153 // Node representing the current context within the function body. | 154 // Node representing the current context within the function body. |
| 154 Node* current_context_; | 155 Node* current_context_; |
| 155 | 156 |
| 156 // Merge of all control nodes that exit the function body. | 157 // Merge of all control nodes that exit the function body. |
| 157 Node* exit_control_; | 158 Node* exit_control_; |
| 158 | 159 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 StructuredGraphBuilder* builder_; | 224 StructuredGraphBuilder* builder_; |
| 224 Node* control_dependency_; | 225 Node* control_dependency_; |
| 225 Node* effect_dependency_; | 226 Node* effect_dependency_; |
| 226 NodeVector values_; | 227 NodeVector values_; |
| 227 }; | 228 }; |
| 228 } | 229 } |
| 229 } | 230 } |
| 230 } // namespace v8::internal::compiler | 231 } // namespace v8::internal::compiler |
| 231 | 232 |
| 232 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | 233 #endif // V8_COMPILER_GRAPH_BUILDER_H__ |
| OLD | NEW |