| Index: src/compiler/graph-builder.h
|
| diff --git a/src/compiler/graph-builder.h b/src/compiler/graph-builder.h
|
| index 8374675ab62f9ea5b842a87a3cf4e301cad95d8b..947c576d020da45db7e9720d538377d709aab4ed 100644
|
| --- a/src/compiler/graph-builder.h
|
| +++ b/src/compiler/graph-builder.h
|
| @@ -15,13 +15,8 @@
|
|
|
| namespace v8 {
|
| namespace internal {
|
| -
|
| -class BitVector;
|
| -
|
| namespace compiler {
|
|
|
| -class Node;
|
| -
|
| // A common base class for anything that creates nodes in a graph.
|
| class GraphBuilder {
|
| public:
|
| @@ -82,168 +77,6 @@ class GraphBuilder {
|
| Graph* graph_;
|
| };
|
|
|
| -
|
| -// The StructuredGraphBuilder produces a high-level IR graph. It is used as the
|
| -// base class for concrete implementations (e.g the AstGraphBuilder or the
|
| -// StubGraphBuilder).
|
| -class StructuredGraphBuilder : public GraphBuilder {
|
| - public:
|
| - StructuredGraphBuilder(Isolate* isolate, Zone* zone, Graph* graph,
|
| - CommonOperatorBuilder* common);
|
| - ~StructuredGraphBuilder() OVERRIDE {}
|
| -
|
| - // Creates a new Phi node having {count} input values.
|
| - Node* NewPhi(int count, Node* input, Node* control);
|
| - Node* NewEffectPhi(int count, Node* input, Node* control);
|
| -
|
| - // Helpers for merging control, effect or value dependencies.
|
| - Node* MergeControl(Node* control, Node* other);
|
| - Node* MergeEffect(Node* value, Node* other, Node* control);
|
| - Node* MergeValue(Node* value, Node* other, Node* control);
|
| -
|
| - // Helpers to create new control nodes.
|
| - Node* NewIfTrue() { return NewNode(common()->IfTrue()); }
|
| - Node* NewIfFalse() { return NewNode(common()->IfFalse()); }
|
| - Node* NewMerge() { return NewNode(common()->Merge(1), true); }
|
| - Node* NewLoop() { return NewNode(common()->Loop(1), true); }
|
| - Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) {
|
| - return NewNode(common()->Branch(hint), condition);
|
| - }
|
| -
|
| - protected:
|
| - class Environment;
|
| - friend class Environment;
|
| - friend class ControlBuilder;
|
| -
|
| - // The following method creates a new node having the specified operator and
|
| - // ensures effect and control dependencies are wired up. The dependencies
|
| - // tracked by the environment might be mutated.
|
| - Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs,
|
| - bool incomplete) FINAL;
|
| -
|
| - Environment* environment() const { return environment_; }
|
| - void set_environment(Environment* env) { environment_ = env; }
|
| -
|
| - Node* current_context() const { return current_context_; }
|
| - void set_current_context(Node* context) { current_context_ = context; }
|
| -
|
| - Node* exit_control() const { return exit_control_; }
|
| - void set_exit_control(Node* node) { exit_control_ = node; }
|
| -
|
| - Node* dead_control();
|
| -
|
| - Zone* graph_zone() const { return graph()->zone(); }
|
| - Zone* local_zone() const { return local_zone_; }
|
| - CommonOperatorBuilder* common() const { return common_; }
|
| -
|
| - // Helper to wrap a Handle<T> into a Unique<T>.
|
| - template <class T>
|
| - Unique<T> MakeUnique(Handle<T> object) {
|
| - return Unique<T>::CreateUninitialized(object);
|
| - }
|
| -
|
| - // Support for control flow builders. The concrete type of the environment
|
| - // depends on the graph builder, but environments themselves are not virtual.
|
| - virtual Environment* CopyEnvironment(Environment* env);
|
| -
|
| - // Helper to indicate a node exits the function body.
|
| - void UpdateControlDependencyToLeaveFunction(Node* exit);
|
| -
|
| - private:
|
| - CommonOperatorBuilder* common_;
|
| - Environment* environment_;
|
| -
|
| - // Zone local to the builder for data not leaking into the graph.
|
| - Zone* local_zone_;
|
| -
|
| - // Temporary storage for building node input lists.
|
| - int input_buffer_size_;
|
| - Node** input_buffer_;
|
| -
|
| - // Node representing the control dependency for dead code.
|
| - SetOncePointer<Node> dead_control_;
|
| -
|
| - // Node representing the current context within the function body.
|
| - Node* current_context_;
|
| -
|
| - // Merge of all control nodes that exit the function body.
|
| - Node* exit_control_;
|
| -
|
| - // Growth increment for the temporary buffer used to construct input lists to
|
| - // new nodes.
|
| - static const int kInputBufferSizeIncrement = 64;
|
| -
|
| - Node** EnsureInputBufferSize(int size);
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(StructuredGraphBuilder);
|
| -};
|
| -
|
| -
|
| -// The abstract execution environment contains static knowledge about
|
| -// execution state at arbitrary control-flow points. It allows for
|
| -// simulation of the control-flow at compile time.
|
| -class StructuredGraphBuilder::Environment : public ZoneObject {
|
| - public:
|
| - Environment(StructuredGraphBuilder* builder, Node* control_dependency);
|
| - Environment(const Environment& copy);
|
| -
|
| - // Control dependency tracked by this environment.
|
| - Node* GetControlDependency() { return control_dependency_; }
|
| - void UpdateControlDependency(Node* dependency) {
|
| - control_dependency_ = dependency;
|
| - }
|
| -
|
| - // Effect dependency tracked by this environment.
|
| - Node* GetEffectDependency() { return effect_dependency_; }
|
| - void UpdateEffectDependency(Node* dependency) {
|
| - effect_dependency_ = dependency;
|
| - }
|
| -
|
| - // Mark this environment as being unreachable.
|
| - void MarkAsUnreachable() {
|
| - UpdateControlDependency(builder()->dead_control());
|
| - }
|
| - bool IsMarkedAsUnreachable() {
|
| - return GetControlDependency()->opcode() == IrOpcode::kDead;
|
| - }
|
| -
|
| - // Merge another environment into this one.
|
| - void Merge(Environment* other);
|
| -
|
| - // Copies this environment at a control-flow split point.
|
| - Environment* CopyForConditional() { return builder()->CopyEnvironment(this); }
|
| -
|
| - // Copies this environment to a potentially unreachable control-flow point.
|
| - Environment* CopyAsUnreachable() {
|
| - Environment* env = builder()->CopyEnvironment(this);
|
| - env->MarkAsUnreachable();
|
| - return env;
|
| - }
|
| -
|
| - // Copies this environment at a loop header control-flow point.
|
| - Environment* CopyForLoop(BitVector* assigned, bool is_osr = false) {
|
| - PrepareForLoop(assigned, is_osr);
|
| - return builder()->CopyEnvironment(this);
|
| - }
|
| -
|
| - Node* GetContext() { return builder_->current_context(); }
|
| -
|
| - protected:
|
| - Zone* zone() const { return builder_->local_zone(); }
|
| - Graph* graph() const { return builder_->graph(); }
|
| - StructuredGraphBuilder* builder() const { return builder_; }
|
| - CommonOperatorBuilder* common() { return builder_->common(); }
|
| - NodeVector* values() { return &values_; }
|
| -
|
| - // Prepare environment to be used as loop header.
|
| - void PrepareForLoop(BitVector* assigned, bool is_osr = false);
|
| -
|
| - private:
|
| - StructuredGraphBuilder* builder_;
|
| - Node* control_dependency_;
|
| - Node* effect_dependency_;
|
| - NodeVector values_;
|
| -};
|
| }
|
| }
|
| } // namespace v8::internal::compiler
|
|
|