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.h" | 8 #include "src/ast.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/liveness-analyzer.h" | 10 #include "src/compiler/liveness-analyzer.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 // Stack of control scopes currently entered by the visitor. | 82 // Stack of control scopes currently entered by the visitor. |
83 ControlScope* execution_control_; | 83 ControlScope* execution_control_; |
84 | 84 |
85 // Stack of context objects pushed onto the chain by the visitor. | 85 // Stack of context objects pushed onto the chain by the visitor. |
86 ContextScope* execution_context_; | 86 ContextScope* execution_context_; |
87 | 87 |
88 // Nodes representing values in the activation record. | 88 // Nodes representing values in the activation record. |
89 SetOncePointer<Node> function_closure_; | 89 SetOncePointer<Node> function_closure_; |
90 SetOncePointer<Node> function_context_; | 90 SetOncePointer<Node> function_context_; |
91 SetOncePointer<Node> feedback_vector_; | |
92 | 91 |
93 // Tracks how many try-blocks are currently entered. | 92 // Tracks how many try-blocks are currently entered. |
94 int try_catch_nesting_level_; | 93 int try_catch_nesting_level_; |
95 int try_nesting_level_; | 94 int try_nesting_level_; |
96 | 95 |
97 // Temporary storage for building node input lists. | 96 // Temporary storage for building node input lists. |
98 int input_buffer_size_; | 97 int input_buffer_size_; |
99 Node** input_buffer_; | 98 Node** input_buffer_; |
100 | 99 |
| 100 // Optimization to cache loaded feedback vector. |
| 101 SetOncePointer<Node> feedback_vector_; |
| 102 |
101 // Control nodes that exit the function body. | 103 // Control nodes that exit the function body. |
102 ZoneVector<Node*> exit_controls_; | 104 ZoneVector<Node*> exit_controls_; |
103 | 105 |
104 // Result of loop assignment analysis performed before graph creation. | 106 // Result of loop assignment analysis performed before graph creation. |
105 LoopAssignmentAnalysis* loop_assignment_analysis_; | 107 LoopAssignmentAnalysis* loop_assignment_analysis_; |
106 | 108 |
107 // Cache for StateValues nodes for frame states. | 109 // Cache for StateValues nodes for frame states. |
108 StateValuesCache state_values_cache_; | 110 StateValuesCache state_values_cache_; |
109 | 111 |
110 // Analyzer of local variable liveness. | 112 // Analyzer of local variable liveness. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Create the main graph body by visiting the AST. | 144 // Create the main graph body by visiting the AST. |
143 void CreateGraphBody(bool stack_check); | 145 void CreateGraphBody(bool stack_check); |
144 | 146 |
145 // Create the node that represents the outer context of the function. | 147 // Create the node that represents the outer context of the function. |
146 void CreateFunctionContext(bool constant_context); | 148 void CreateFunctionContext(bool constant_context); |
147 | 149 |
148 // Get or create the node that represents the outer function closure. | 150 // Get or create the node that represents the outer function closure. |
149 Node* GetFunctionClosureForContext(); | 151 Node* GetFunctionClosureForContext(); |
150 Node* GetFunctionClosure(); | 152 Node* GetFunctionClosure(); |
151 | 153 |
152 // Get or create the node that represents the functions type feedback vector. | |
153 Node* GetFeedbackVector(); | |
154 | |
155 // Node creation helpers. | 154 // Node creation helpers. |
156 Node* NewNode(const Operator* op, bool incomplete = false) { | 155 Node* NewNode(const Operator* op, bool incomplete = false) { |
157 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); | 156 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); |
158 } | 157 } |
159 | 158 |
160 Node* NewNode(const Operator* op, Node* n1) { | 159 Node* NewNode(const Operator* op, Node* n1) { |
161 return MakeNode(op, 1, &n1, false); | 160 return MakeNode(op, 1, &n1, false); |
162 } | 161 } |
163 | 162 |
164 Node* NewNode(const Operator* op, Node* n1, Node* n2) { | 163 Node* NewNode(const Operator* op, Node* n1, Node* n2) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 Handle<Name> name, Node* value, TypeFeedbackId id); | 298 Handle<Name> name, Node* value, TypeFeedbackId id); |
300 Node* BuildNamedSuperLoad(Node* receiver, Node* home_object, | 299 Node* BuildNamedSuperLoad(Node* receiver, Node* home_object, |
301 Handle<Name> name, const VectorSlotPair& feedback); | 300 Handle<Name> name, const VectorSlotPair& feedback); |
302 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, | 301 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, |
303 const VectorSlotPair& feedback); | 302 const VectorSlotPair& feedback); |
304 | 303 |
305 // Builders for accessing the function context. | 304 // Builders for accessing the function context. |
306 Node* BuildLoadBuiltinsObject(); | 305 Node* BuildLoadBuiltinsObject(); |
307 Node* BuildLoadGlobalObject(); | 306 Node* BuildLoadGlobalObject(); |
308 Node* BuildLoadGlobalProxy(); | 307 Node* BuildLoadGlobalProxy(); |
309 Node* BuildLoadClosure(); | 308 Node* BuildLoadFeedbackVector(); |
| 309 |
| 310 // Builder for accessing a (potentially immutable) object field. |
310 Node* BuildLoadObjectField(Node* object, int offset); | 311 Node* BuildLoadObjectField(Node* object, int offset); |
| 312 Node* BuildLoadImmutableObjectField(Node* object, int offset); |
311 | 313 |
312 // Builders for accessing external references. | 314 // Builders for accessing external references. |
313 Node* BuildLoadExternal(ExternalReference ref, MachineType type); | 315 Node* BuildLoadExternal(ExternalReference ref, MachineType type); |
314 Node* BuildStoreExternal(ExternalReference ref, MachineType type, Node* val); | 316 Node* BuildStoreExternal(ExternalReference ref, MachineType type, Node* val); |
315 | 317 |
316 // Builders for automatic type conversion. | 318 // Builders for automatic type conversion. |
317 Node* BuildToBoolean(Node* input); | 319 Node* BuildToBoolean(Node* input); |
318 Node* BuildToName(Node* input, BailoutId bailout_id); | 320 Node* BuildToName(Node* input, BailoutId bailout_id); |
319 Node* BuildToObject(Node* input, BailoutId bailout_id); | 321 Node* BuildToObject(Node* input, BailoutId bailout_id); |
320 | 322 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 537 |
536 // Prepare environment to be used as loop header. | 538 // Prepare environment to be used as loop header. |
537 void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 539 void PrepareForLoop(BitVector* assigned, bool is_osr = false); |
538 }; | 540 }; |
539 | 541 |
540 } // namespace compiler | 542 } // namespace compiler |
541 } // namespace internal | 543 } // namespace internal |
542 } // namespace v8 | 544 } // namespace v8 |
543 | 545 |
544 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 546 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |