| 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_; |
| 91 | 92 |
| 92 // Tracks how many try-blocks are currently entered. | 93 // Tracks how many try-blocks are currently entered. |
| 93 int try_catch_nesting_level_; | 94 int try_catch_nesting_level_; |
| 94 int try_nesting_level_; | 95 int try_nesting_level_; |
| 95 | 96 |
| 96 // Temporary storage for building node input lists. | 97 // Temporary storage for building node input lists. |
| 97 int input_buffer_size_; | 98 int input_buffer_size_; |
| 98 Node** input_buffer_; | 99 Node** input_buffer_; |
| 99 | 100 |
| 100 // Control nodes that exit the function body. | 101 // Control nodes that exit the function body. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 141 |
| 141 // Create the main graph body by visiting the AST. | 142 // Create the main graph body by visiting the AST. |
| 142 void CreateGraphBody(bool stack_check); | 143 void CreateGraphBody(bool stack_check); |
| 143 | 144 |
| 144 // Create the node that represents the outer context of the function. | 145 // Create the node that represents the outer context of the function. |
| 145 void CreateFunctionContext(bool constant_context); | 146 void CreateFunctionContext(bool constant_context); |
| 146 | 147 |
| 147 // Get or create the node that represents the outer function closure. | 148 // Get or create the node that represents the outer function closure. |
| 148 Node* GetFunctionClosure(); | 149 Node* GetFunctionClosure(); |
| 149 | 150 |
| 151 // Get or create the node that represents the functions type feedback vector. |
| 152 Node* GetFeedbackVector(); |
| 153 |
| 150 // Node creation helpers. | 154 // Node creation helpers. |
| 151 Node* NewNode(const Operator* op, bool incomplete = false) { | 155 Node* NewNode(const Operator* op, bool incomplete = false) { |
| 152 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); | 156 return MakeNode(op, 0, static_cast<Node**>(NULL), incomplete); |
| 153 } | 157 } |
| 154 | 158 |
| 155 Node* NewNode(const Operator* op, Node* n1) { | 159 Node* NewNode(const Operator* op, Node* n1) { |
| 156 return MakeNode(op, 1, &n1, false); | 160 return MakeNode(op, 1, &n1, false); |
| 157 } | 161 } |
| 158 | 162 |
| 159 Node* NewNode(const Operator* op, Node* n1, Node* n2) { | 163 Node* NewNode(const Operator* op, Node* n1, Node* n2) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void ClearNonLiveSlotsInFrameStates(); | 228 void ClearNonLiveSlotsInFrameStates(); |
| 225 | 229 |
| 226 // Helper to wrap a Handle<T> into a Unique<T>. | 230 // Helper to wrap a Handle<T> into a Unique<T>. |
| 227 template <class T> | 231 template <class T> |
| 228 Unique<T> MakeUnique(Handle<T> object) { | 232 Unique<T> MakeUnique(Handle<T> object) { |
| 229 return Unique<T>::CreateUninitialized(object); | 233 return Unique<T>::CreateUninitialized(object); |
| 230 } | 234 } |
| 231 | 235 |
| 232 Node** EnsureInputBufferSize(int size); | 236 Node** EnsureInputBufferSize(int size); |
| 233 | 237 |
| 234 // Named and keyed loads require a VectorSlotPair for successful lowering. | 238 // Named and keyed loads require a ResolvedFeedbackSlot for successful |
| 235 VectorSlotPair CreateVectorSlotPair(FeedbackVectorICSlot slot) const; | 239 // lowering. |
| 240 ResolvedFeedbackSlot ResolveFeedbackSlot(FeedbackVectorICSlot slot) const; |
| 236 | 241 |
| 237 // Determine which contexts need to be checked for extension objects that | 242 // Determine which contexts need to be checked for extension objects that |
| 238 // might shadow the optimistic declaration of dynamic lookup variables. | 243 // might shadow the optimistic declaration of dynamic lookup variables. |
| 239 uint32_t ComputeBitsetForDynamicGlobal(Variable* variable); | 244 uint32_t ComputeBitsetForDynamicGlobal(Variable* variable); |
| 240 uint32_t ComputeBitsetForDynamicContext(Variable* variable); | 245 uint32_t ComputeBitsetForDynamicContext(Variable* variable); |
| 241 | 246 |
| 242 // =========================================================================== | 247 // =========================================================================== |
| 243 // The following build methods all generate graph fragments and return one | 248 // The following build methods all generate graph fragments and return one |
| 244 // resulting node. The operand stack height remains the same, variables and | 249 // resulting node. The operand stack height remains the same, variables and |
| 245 // other dependencies tracked by the environment might be mutated though. | 250 // other dependencies tracked by the environment might be mutated though. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 264 // Builders for variable load and assignment. | 269 // Builders for variable load and assignment. |
| 265 Node* BuildVariableAssignment(Variable* variable, Node* value, | 270 Node* BuildVariableAssignment(Variable* variable, Node* value, |
| 266 Token::Value op, BailoutId bailout_id, | 271 Token::Value op, BailoutId bailout_id, |
| 267 FrameStateBeforeAndAfter& states, | 272 FrameStateBeforeAndAfter& states, |
| 268 OutputFrameStateCombine framestate_combine = | 273 OutputFrameStateCombine framestate_combine = |
| 269 OutputFrameStateCombine::Ignore()); | 274 OutputFrameStateCombine::Ignore()); |
| 270 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, | 275 Node* BuildVariableDelete(Variable* variable, BailoutId bailout_id, |
| 271 OutputFrameStateCombine framestate_combine); | 276 OutputFrameStateCombine framestate_combine); |
| 272 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, | 277 Node* BuildVariableLoad(Variable* variable, BailoutId bailout_id, |
| 273 FrameStateBeforeAndAfter& states, | 278 FrameStateBeforeAndAfter& states, |
| 274 const VectorSlotPair& feedback, | 279 const ResolvedFeedbackSlot& feedback, |
| 275 OutputFrameStateCombine framestate_combine, | 280 OutputFrameStateCombine framestate_combine, |
| 276 ContextualMode mode = CONTEXTUAL); | 281 ContextualMode mode = CONTEXTUAL); |
| 277 | 282 |
| 278 // Builders for property loads and stores. | 283 // Builders for property loads and stores. |
| 279 Node* BuildKeyedLoad(Node* receiver, Node* key, | 284 Node* BuildKeyedLoad(Node* receiver, Node* key, |
| 280 const VectorSlotPair& feedback); | 285 const ResolvedFeedbackSlot& feedback); |
| 281 Node* BuildNamedLoad(Node* receiver, Handle<Name> name, | 286 Node* BuildNamedLoad(Node* receiver, Handle<Name> name, |
| 282 const VectorSlotPair& feedback, | 287 const ResolvedFeedbackSlot& feedback, |
| 283 ContextualMode mode = NOT_CONTEXTUAL); | 288 ContextualMode mode = NOT_CONTEXTUAL); |
| 284 Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, | 289 Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, |
| 285 TypeFeedbackId id); | 290 TypeFeedbackId id); |
| 286 Node* BuildNamedStore(Node* receiver, Handle<Name>, Node* value, | 291 Node* BuildNamedStore(Node* receiver, Handle<Name>, Node* value, |
| 287 TypeFeedbackId id); | 292 TypeFeedbackId id); |
| 288 | 293 |
| 289 // Builders for super property loads and stores. | 294 // Builders for super property loads and stores. |
| 290 Node* BuildKeyedSuperStore(Node* receiver, Node* home_object, Node* key, | 295 Node* BuildKeyedSuperStore(Node* receiver, Node* home_object, Node* key, |
| 291 Node* value, TypeFeedbackId id); | 296 Node* value, TypeFeedbackId id); |
| 292 Node* BuildNamedSuperStore(Node* receiver, Node* home_object, | 297 Node* BuildNamedSuperStore(Node* receiver, Node* home_object, |
| 293 Handle<Name> name, Node* value, TypeFeedbackId id); | 298 Handle<Name> name, Node* value, TypeFeedbackId id); |
| 294 Node* BuildNamedSuperLoad(Node* receiver, Node* home_object, | 299 Node* BuildNamedSuperLoad(Node* receiver, Node* home_object, |
| 295 Handle<Name> name, const VectorSlotPair& feedback); | 300 Handle<Name> name, |
| 301 const ResolvedFeedbackSlot& feedback); |
| 296 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, | 302 Node* BuildKeyedSuperLoad(Node* receiver, Node* home_object, Node* key, |
| 297 const VectorSlotPair& feedback); | 303 const ResolvedFeedbackSlot& feedback); |
| 298 | 304 |
| 299 // Builders for accessing the function context. | 305 // Builders for accessing the function context. |
| 300 Node* BuildLoadBuiltinsObject(); | 306 Node* BuildLoadBuiltinsObject(); |
| 301 Node* BuildLoadGlobalObject(); | 307 Node* BuildLoadGlobalObject(); |
| 302 Node* BuildLoadGlobalProxy(); | 308 Node* BuildLoadGlobalProxy(); |
| 303 Node* BuildLoadClosure(); | 309 Node* BuildLoadClosure(); |
| 304 Node* BuildLoadObjectField(Node* object, int offset); | 310 Node* BuildLoadObjectField(Node* object, int offset); |
| 305 | 311 |
| 306 // Builders for accessing external references. | 312 // Builders for accessing external references. |
| 307 Node* BuildLoadExternal(ExternalReference ref, MachineType type); | 313 Node* BuildLoadExternal(ExternalReference ref, MachineType type); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 532 |
| 527 // Prepare environment to be used as loop header. | 533 // Prepare environment to be used as loop header. |
| 528 void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 534 void PrepareForLoop(BitVector* assigned, bool is_osr = false); |
| 529 }; | 535 }; |
| 530 | 536 |
| 531 } // namespace compiler | 537 } // namespace compiler |
| 532 } // namespace internal | 538 } // namespace internal |
| 533 } // namespace v8 | 539 } // namespace v8 |
| 534 | 540 |
| 535 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 541 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |