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/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/compiler/compiler-source-position-table.h" | 9 #include "src/compiler/compiler-source-position-table.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Stack of control scopes currently entered by the visitor. | 88 // Stack of control scopes currently entered by the visitor. |
89 ControlScope* execution_control_; | 89 ControlScope* execution_control_; |
90 | 90 |
91 // Stack of context objects pushed onto the chain by the visitor. | 91 // Stack of context objects pushed onto the chain by the visitor. |
92 ContextScope* execution_context_; | 92 ContextScope* execution_context_; |
93 | 93 |
94 // Nodes representing values in the activation record. | 94 // Nodes representing values in the activation record. |
95 SetOncePointer<Node> function_closure_; | 95 SetOncePointer<Node> function_closure_; |
96 SetOncePointer<Node> function_context_; | 96 SetOncePointer<Node> function_context_; |
97 SetOncePointer<Node> new_target_; | |
98 | 97 |
99 // Temporary storage for building node input lists. | 98 // Temporary storage for building node input lists. |
100 int input_buffer_size_; | 99 int input_buffer_size_; |
101 Node** input_buffer_; | 100 Node** input_buffer_; |
102 | 101 |
103 // Optimization to cache loaded feedback vector. | 102 // Optimization to cache loaded feedback vector. |
104 SetOncePointer<Node> feedback_vector_; | 103 SetOncePointer<Node> feedback_vector_; |
105 | 104 |
106 // Optimization to cache empty frame state. | 105 // Optimization to cache empty frame state. |
107 SetOncePointer<Node> empty_frame_state_; | 106 SetOncePointer<Node> empty_frame_state_; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // Create the main graph body by visiting the AST. | 153 // Create the main graph body by visiting the AST. |
155 void CreateGraphBody(bool stack_check); | 154 void CreateGraphBody(bool stack_check); |
156 | 155 |
157 // Get or create the node that represents the incoming function closure. | 156 // Get or create the node that represents the incoming function closure. |
158 Node* GetFunctionClosureForContext(); | 157 Node* GetFunctionClosureForContext(); |
159 Node* GetFunctionClosure(); | 158 Node* GetFunctionClosure(); |
160 | 159 |
161 // Get or create the node that represents the incoming function context. | 160 // Get or create the node that represents the incoming function context. |
162 Node* GetFunctionContext(); | 161 Node* GetFunctionContext(); |
163 | 162 |
164 // Get or create the node that represents the incoming new target value. | |
165 Node* GetNewTarget(); | |
166 | |
167 // Get or create the node that represents the empty frame state. | 163 // Get or create the node that represents the empty frame state. |
168 Node* GetEmptyFrameState(); | 164 Node* GetEmptyFrameState(); |
169 | 165 |
170 // Node creation helpers. | 166 // Node creation helpers. |
171 Node* NewNode(const Operator* op, bool incomplete = false) { | 167 Node* NewNode(const Operator* op, bool incomplete = false) { |
172 return MakeNode(op, 0, static_cast<Node**>(nullptr), incomplete); | 168 return MakeNode(op, 0, static_cast<Node**>(nullptr), incomplete); |
173 } | 169 } |
174 | 170 |
175 Node* NewNode(const Operator* op, Node* n1) { | 171 Node* NewNode(const Operator* op, Node* n1) { |
176 return MakeNode(op, 1, &n1, false); | 172 return MakeNode(op, 1, &n1, false); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 258 |
263 // Builders to create local function, script and block contexts. | 259 // Builders to create local function, script and block contexts. |
264 Node* BuildLocalActivationContext(Node* context); | 260 Node* BuildLocalActivationContext(Node* context); |
265 Node* BuildLocalFunctionContext(Scope* scope); | 261 Node* BuildLocalFunctionContext(Scope* scope); |
266 Node* BuildLocalScriptContext(Scope* scope); | 262 Node* BuildLocalScriptContext(Scope* scope); |
267 Node* BuildLocalBlockContext(Scope* scope); | 263 Node* BuildLocalBlockContext(Scope* scope); |
268 | 264 |
269 // Builder to create an arguments object if it is used. | 265 // Builder to create an arguments object if it is used. |
270 Node* BuildArgumentsObject(Variable* arguments); | 266 Node* BuildArgumentsObject(Variable* arguments); |
271 | 267 |
272 // Builder to create an array of rest parameters if used. | |
273 Node* BuildRestArgumentsArray(Variable* rest); | |
274 | |
275 // Builder that assigns to the {.this_function} internal variable if needed. | |
276 Node* BuildThisFunctionVariable(Variable* this_function_var); | |
277 | |
278 // Builder that assigns to the {new.target} internal variable if needed. | |
279 Node* BuildNewTargetVariable(Variable* new_target_var); | |
280 | |
281 // Builders for variable load and assignment. | 268 // Builders for variable load and assignment. |
282 Node* BuildVariableAssignment(Variable* variable, Node* value, | 269 Node* BuildVariableAssignment(Variable* variable, Node* value, |
283 Token::Value op, const VectorSlotPair& slot, | 270 Token::Value op, const VectorSlotPair& slot, |
284 BailoutId bailout_id, | 271 BailoutId bailout_id, |
285 OutputFrameStateCombine framestate_combine = | 272 OutputFrameStateCombine framestate_combine = |
286 OutputFrameStateCombine::Ignore()); | 273 OutputFrameStateCombine::Ignore()); |
287 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, | 274 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, |
288 OutputFrameStateCombine framestate_combine); | 275 OutputFrameStateCombine framestate_combine); |
289 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, | 276 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, |
290 const VectorSlotPair& feedback, | 277 const VectorSlotPair& feedback, |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 private: | 599 private: |
613 SourcePositionTable* const source_positions_; | 600 SourcePositionTable* const source_positions_; |
614 SourcePosition const start_position_; | 601 SourcePosition const start_position_; |
615 }; | 602 }; |
616 | 603 |
617 } // namespace compiler | 604 } // namespace compiler |
618 } // namespace internal | 605 } // namespace internal |
619 } // namespace v8 | 606 } // namespace v8 |
620 | 607 |
621 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 608 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |