| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 protected: | 102 protected: |
| 103 class Environment; | 103 class Environment; |
| 104 friend class ControlBuilder; | 104 friend class ControlBuilder; |
| 105 | 105 |
| 106 // The following method creates a new node having the specified operator and | 106 // The following method creates a new node having the specified operator and |
| 107 // ensures effect and control dependencies are wired up. The dependencies | 107 // ensures effect and control dependencies are wired up. The dependencies |
| 108 // tracked by the environment might be mutated. | 108 // tracked by the environment might be mutated. |
| 109 virtual Node* MakeNode(Operator* op, int value_input_count, | 109 virtual Node* MakeNode(Operator* op, int value_input_count, |
| 110 Node** value_inputs); | 110 Node** value_inputs); |
| 111 | 111 |
| 112 Environment* environment_internal() const { return environment_; } | 112 Environment* environment() const { return environment_; } |
| 113 void set_environment(Environment* env) { environment_ = env; } | 113 void set_environment(Environment* env) { environment_ = env; } |
| 114 | 114 |
| 115 Node* current_context() const { return current_context_; } | 115 Node* current_context() const { return current_context_; } |
| 116 void set_current_context(Node* context) { current_context_ = context; } | 116 void set_current_context(Node* context) { current_context_ = context; } |
| 117 | 117 |
| 118 Node* exit_control() const { return exit_control_; } | 118 Node* exit_control() const { return exit_control_; } |
| 119 void set_exit_control(Node* node) { exit_control_ = node; } | 119 void set_exit_control(Node* node) { exit_control_ = node; } |
| 120 | 120 |
| 121 Node* dead_control(); | 121 Node* dead_control(); |
| 122 | 122 |
| 123 // TODO(mstarzinger): Use phase-local zone instead! | 123 // TODO(mstarzinger): Use phase-local zone instead! |
| 124 Zone* zone() const { return graph()->zone(); } | 124 Zone* zone() const { return graph()->zone(); } |
| 125 Isolate* isolate() const { return zone()->isolate(); } | 125 Isolate* isolate() const { return zone()->isolate(); } |
| 126 CommonOperatorBuilder* common() const { return common_; } | 126 CommonOperatorBuilder* common() const { return common_; } |
| 127 | 127 |
| 128 // Helper to wrap a Handle<T> into a Unique<T>. | 128 // Helper to wrap a Handle<T> into a Unique<T>. |
| 129 template <class T> | 129 template <class T> |
| 130 PrintableUnique<T> MakeUnique(Handle<T> object) { | 130 PrintableUnique<T> MakeUnique(Handle<T> object) { |
| 131 return PrintableUnique<T>::CreateUninitialized(zone(), object); | 131 return PrintableUnique<T>::CreateUninitialized(zone(), object); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Support for control flow builders. The concrete type of the environment | 134 // Support for control flow builders. The concrete type of the environment |
| 135 // depends on the graph builder, but environments themselves are not virtual. | 135 // depends on the graph builder, but environments themselves are not virtual. |
| 136 virtual Environment* CopyEnvironment(Environment* env); | 136 virtual Environment* CopyEnvironment(Environment* env); |
| 137 | 137 |
| 138 // Helper when creating node that depends on control. | |
| 139 Node* GetControlDependency(); | |
| 140 | |
| 141 // Helper when creating node that updates control. | |
| 142 void UpdateControlDependency(Node* new_control); | |
| 143 | |
| 144 // Helper to indicate a node exits the function body. | 138 // Helper to indicate a node exits the function body. |
| 145 void UpdateControlDependencyToLeaveFunction(Node* exit); | 139 void UpdateControlDependencyToLeaveFunction(Node* exit); |
| 146 | 140 |
| 147 private: | 141 private: |
| 148 CommonOperatorBuilder* common_; | 142 CommonOperatorBuilder* common_; |
| 149 Environment* environment_; | 143 Environment* environment_; |
| 150 | 144 |
| 151 // Node representing the control dependency for dead code. | 145 // Node representing the control dependency for dead code. |
| 152 SetOncePointer<Node> dead_control_; | 146 SetOncePointer<Node> dead_control_; |
| 153 | 147 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 StructuredGraphBuilder* builder_; | 217 StructuredGraphBuilder* builder_; |
| 224 Node* control_dependency_; | 218 Node* control_dependency_; |
| 225 Node* effect_dependency_; | 219 Node* effect_dependency_; |
| 226 NodeVector values_; | 220 NodeVector values_; |
| 227 }; | 221 }; |
| 228 } | 222 } |
| 229 } | 223 } |
| 230 } // namespace v8::internal::compiler | 224 } // namespace v8::internal::compiler |
| 231 | 225 |
| 232 #endif // V8_COMPILER_GRAPH_BUILDER_H__ | 226 #endif // V8_COMPILER_GRAPH_BUILDER_H__ |
| OLD | NEW |