OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_AST_GRAPH_BUILDER_H_ | 5 #ifndef V8_COMPILER_AST_GRAPH_BUILDER_H_ |
6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ | 6 #define V8_COMPILER_AST_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 SetOncePointer<Node> function_closure_; | 91 SetOncePointer<Node> function_closure_; |
92 SetOncePointer<Node> function_context_; | 92 SetOncePointer<Node> function_context_; |
93 | 93 |
94 // Temporary storage for building node input lists. | 94 // Temporary storage for building node input lists. |
95 int input_buffer_size_; | 95 int input_buffer_size_; |
96 Node** input_buffer_; | 96 Node** input_buffer_; |
97 | 97 |
98 // Node representing the control dependency for dead code. | 98 // Node representing the control dependency for dead code. |
99 SetOncePointer<Node> dead_control_; | 99 SetOncePointer<Node> dead_control_; |
100 | 100 |
101 // Node representing the current context within the function body. | |
102 Node* current_context_; | |
103 | |
104 // Merge of all control nodes that exit the function body. | 101 // Merge of all control nodes that exit the function body. |
105 Node* exit_control_; | 102 Node* exit_control_; |
106 | 103 |
107 // Result of loop assignment analysis performed before graph creation. | 104 // Result of loop assignment analysis performed before graph creation. |
108 LoopAssignmentAnalysis* loop_assignment_analysis_; | 105 LoopAssignmentAnalysis* loop_assignment_analysis_; |
109 | 106 |
110 // Growth increment for the temporary buffer used to construct input lists to | 107 // Growth increment for the temporary buffer used to construct input lists to |
111 // new nodes. | 108 // new nodes. |
112 static const int kInputBufferSizeIncrement = 64; | 109 static const int kInputBufferSizeIncrement = 64; |
113 | 110 |
114 Zone* local_zone() const { return local_zone_; } | 111 Zone* local_zone() const { return local_zone_; } |
115 Environment* environment() { return environment_; } | 112 Environment* environment() { return environment_; } |
116 AstContext* ast_context() const { return ast_context_; } | 113 AstContext* ast_context() const { return ast_context_; } |
117 ControlScope* execution_control() const { return execution_control_; } | 114 ControlScope* execution_control() const { return execution_control_; } |
118 ContextScope* execution_context() const { return execution_context_; } | 115 ContextScope* execution_context() const { return execution_context_; } |
119 CommonOperatorBuilder* common() const { return jsgraph_->common(); } | 116 CommonOperatorBuilder* common() const { return jsgraph_->common(); } |
120 CompilationInfo* info() const { return info_; } | 117 CompilationInfo* info() const { return info_; } |
121 StrictMode strict_mode() const; | 118 StrictMode strict_mode() const; |
122 JSGraph* jsgraph() { return jsgraph_; } | 119 JSGraph* jsgraph() { return jsgraph_; } |
123 Graph* graph() { return jsgraph_->graph(); } | 120 Graph* graph() { return jsgraph_->graph(); } |
124 Zone* graph_zone() { return graph()->zone(); } | 121 Zone* graph_zone() { return graph()->zone(); } |
125 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } | 122 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } |
126 ZoneVector<Handle<Object>>* globals() { return &globals_; } | 123 ZoneVector<Handle<Object>>* globals() { return &globals_; } |
127 Scope* current_scope() const; | 124 Scope* current_scope() const; |
128 Node* current_context() const { return current_context_; } | 125 Node* current_context() const; |
129 Node* dead_control(); | 126 Node* dead_control(); |
130 Node* exit_control() const { return exit_control_; } | 127 Node* exit_control() const { return exit_control_; } |
131 | 128 |
132 void set_environment(Environment* env) { environment_ = env; } | 129 void set_environment(Environment* env) { environment_ = env; } |
133 void set_ast_context(AstContext* ctx) { ast_context_ = ctx; } | 130 void set_ast_context(AstContext* ctx) { ast_context_ = ctx; } |
134 void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; } | 131 void set_execution_control(ControlScope* ctrl) { execution_control_ = ctrl; } |
135 void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; } | 132 void set_execution_context(ContextScope* ctx) { execution_context_ = ctx; } |
136 void set_current_context(Node* ctx) { current_context_ = ctx; } | |
137 void set_exit_control(Node* exit) { exit_control_ = exit; } | 133 void set_exit_control(Node* exit) { exit_control_ = exit; } |
138 | 134 |
139 // Node creation helpers. | 135 // Node creation helpers. |
140 Node* NewNode(const Operator* op, bool incomplete = false) { | 136 Node* NewNode(const Operator* op, bool incomplete = false) { |
141 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); | 137 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); |
142 } | 138 } |
143 | 139 |
144 Node* NewNode(const Operator* op, Node* n1) { | 140 Node* NewNode(const Operator* op, Node* n1) { |
145 return MakeNode(op, 1, &n1, false); | 141 return MakeNode(op, 1, &n1, false); |
146 } | 142 } |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 451 |
456 // Prepare environment to be used as loop header. | 452 // Prepare environment to be used as loop header. |
457 void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 453 void PrepareForLoop(BitVector* assigned, bool is_osr = false); |
458 }; | 454 }; |
459 | 455 |
460 } // namespace compiler | 456 } // namespace compiler |
461 } // namespace internal | 457 } // namespace internal |
462 } // namespace v8 | 458 } // namespace v8 |
463 | 459 |
464 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 460 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |