| 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" | 
|   11 #include "src/compiler/state-values-utils.h" |   11 #include "src/compiler/state-values-utils.h" | 
|   12  |   12  | 
|   13 namespace v8 { |   13 namespace v8 { | 
|   14 namespace internal { |   14 namespace internal { | 
|   15  |   15  | 
|   16 class BitVector; |   16 class BitVector; | 
|   17  |   17  | 
|   18 namespace compiler { |   18 namespace compiler { | 
|   19  |   19  | 
|   20 class ControlBuilder; |   20 class ControlBuilder; | 
|   21 class Graph; |   21 class Graph; | 
 |   22 class JSTypeFeedbackTable; | 
|   22 class LoopAssignmentAnalysis; |   23 class LoopAssignmentAnalysis; | 
|   23 class LoopBuilder; |   24 class LoopBuilder; | 
|   24 class Node; |   25 class Node; | 
|   25  |   26  | 
|   26 // The AstGraphBuilder produces a high-level IR graph, based on an |   27 // The AstGraphBuilder produces a high-level IR graph, based on an | 
|   27 // underlying AST. The produced graph can either be compiled into a |   28 // underlying AST. The produced graph can either be compiled into a | 
|   28 // stand-alone function or be wired into another graph for the purposes |   29 // stand-alone function or be wired into another graph for the purposes | 
|   29 // of function inlining. |   30 // of function inlining. | 
|   30 class AstGraphBuilder : public AstVisitor { |   31 class AstGraphBuilder : public AstVisitor { | 
|   31  public: |   32  public: | 
|   32   AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, |   33   AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, | 
|   33                   LoopAssignmentAnalysis* loop_assignment = NULL); |   34                   LoopAssignmentAnalysis* loop_assignment = NULL, | 
 |   35                   JSTypeFeedbackTable* js_type_feedback = NULL); | 
|   34  |   36  | 
|   35   // Creates a graph by visiting the entire AST. |   37   // Creates a graph by visiting the entire AST. | 
|   36   bool CreateGraph(bool constant_context, bool stack_check = true); |   38   bool CreateGraph(bool constant_context, bool stack_check = true); | 
|   37  |   39  | 
|   38   // Helpers to create new control nodes. |   40   // Helpers to create new control nodes. | 
|   39   Node* NewIfTrue() { return NewNode(common()->IfTrue()); } |   41   Node* NewIfTrue() { return NewNode(common()->IfTrue()); } | 
|   40   Node* NewIfFalse() { return NewNode(common()->IfFalse()); } |   42   Node* NewIfFalse() { return NewNode(common()->IfFalse()); } | 
|   41   Node* NewMerge() { return NewNode(common()->Merge(1), true); } |   43   Node* NewMerge() { return NewNode(common()->Merge(1), true); } | 
|   42   Node* NewLoop() { return NewNode(common()->Loop(1), true); } |   44   Node* NewLoop() { return NewNode(common()->Loop(1), true); } | 
|   43   Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) { |   45   Node* NewBranch(Node* condition, BranchHint hint = BranchHint::kNone) { | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   98  |  100  | 
|   99   // Result of loop assignment analysis performed before graph creation. |  101   // Result of loop assignment analysis performed before graph creation. | 
|  100   LoopAssignmentAnalysis* loop_assignment_analysis_; |  102   LoopAssignmentAnalysis* loop_assignment_analysis_; | 
|  101  |  103  | 
|  102   // Cache for StateValues nodes for frame states. |  104   // Cache for StateValues nodes for frame states. | 
|  103   StateValuesCache state_values_cache_; |  105   StateValuesCache state_values_cache_; | 
|  104  |  106  | 
|  105   // Analyzer of local variable liveness. |  107   // Analyzer of local variable liveness. | 
|  106   LivenessAnalyzer liveness_analyzer_; |  108   LivenessAnalyzer liveness_analyzer_; | 
|  107  |  109  | 
 |  110   // Type feedback table. | 
 |  111   JSTypeFeedbackTable* js_type_feedback_; | 
 |  112  | 
|  108   // Growth increment for the temporary buffer used to construct input lists to |  113   // Growth increment for the temporary buffer used to construct input lists to | 
|  109   // new nodes. |  114   // new nodes. | 
|  110   static const int kInputBufferSizeIncrement = 64; |  115   static const int kInputBufferSizeIncrement = 64; | 
|  111  |  116  | 
|  112   Zone* local_zone() const { return local_zone_; } |  117   Zone* local_zone() const { return local_zone_; } | 
|  113   Environment* environment() const { return environment_; } |  118   Environment* environment() const { return environment_; } | 
|  114   AstContext* ast_context() const { return ast_context_; } |  119   AstContext* ast_context() const { return ast_context_; } | 
|  115   ControlScope* execution_control() const { return execution_control_; } |  120   ControlScope* execution_control() const { return execution_control_; } | 
|  116   ContextScope* execution_context() const { return execution_context_; } |  121   ContextScope* execution_context() const { return execution_context_; } | 
|  117   CommonOperatorBuilder* common() const { return jsgraph_->common(); } |  122   CommonOperatorBuilder* common() const { return jsgraph_->common(); } | 
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  256                                 OutputFrameStateCombine state_combine = |  261                                 OutputFrameStateCombine state_combine = | 
|  257                                     OutputFrameStateCombine::Ignore()); |  262                                     OutputFrameStateCombine::Ignore()); | 
|  258   Node* BuildVariableDelete(Variable* var, BailoutId bailout_id, |  263   Node* BuildVariableDelete(Variable* var, BailoutId bailout_id, | 
|  259                             OutputFrameStateCombine state_combine); |  264                             OutputFrameStateCombine state_combine); | 
|  260   Node* BuildVariableLoad(Variable* var, BailoutId bailout_id, |  265   Node* BuildVariableLoad(Variable* var, BailoutId bailout_id, | 
|  261                           const VectorSlotPair& feedback, |  266                           const VectorSlotPair& feedback, | 
|  262                           ContextualMode mode = CONTEXTUAL); |  267                           ContextualMode mode = CONTEXTUAL); | 
|  263  |  268  | 
|  264   // Builders for property loads and stores. |  269   // Builders for property loads and stores. | 
|  265   Node* BuildKeyedLoad(Node* receiver, Node* key, |  270   Node* BuildKeyedLoad(Node* receiver, Node* key, | 
|  266                        const VectorSlotPair& feedback); |  271                        const VectorSlotPair& feedback, TypeFeedbackId id); | 
|  267   Node* BuildNamedLoad(Node* receiver, Handle<Name> name, |  272   Node* BuildNamedLoad(Node* receiver, Handle<Name> name, | 
|  268                        const VectorSlotPair& feedback, |  273                        const VectorSlotPair& feedback, TypeFeedbackId id, | 
|  269                        ContextualMode mode = NOT_CONTEXTUAL); |  274                        ContextualMode mode = NOT_CONTEXTUAL); | 
|  270   Node* BuildKeyedStore(Node* receiver, Node* key, Node* value); |  275   Node* BuildKeyedStore(Node* receiver, Node* key, Node* value, | 
|  271   Node* BuildNamedStore(Node* receiver, Handle<Name>, Node* value); |  276                         TypeFeedbackId id); | 
 |  277   Node* BuildNamedStore(Node* receiver, Handle<Name>, Node* value, | 
 |  278                         TypeFeedbackId id); | 
|  272  |  279  | 
|  273   // Builders for accessing the function context. |  280   // Builders for accessing the function context. | 
|  274   Node* BuildLoadBuiltinsObject(); |  281   Node* BuildLoadBuiltinsObject(); | 
|  275   Node* BuildLoadGlobalObject(); |  282   Node* BuildLoadGlobalObject(); | 
|  276   Node* BuildLoadGlobalProxy(); |  283   Node* BuildLoadGlobalProxy(); | 
|  277   Node* BuildLoadClosure(); |  284   Node* BuildLoadClosure(); | 
|  278   Node* BuildLoadObjectField(Node* object, int offset); |  285   Node* BuildLoadObjectField(Node* object, int offset); | 
|  279  |  286  | 
|  280   // Builders for accessing external references. |  287   // Builders for accessing external references. | 
|  281   Node* BuildLoadExternal(ExternalReference ref, MachineType type); |  288   Node* BuildLoadExternal(ExternalReference ref, MachineType type); | 
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  500  |  507  | 
|  501   // Prepare environment to be used as loop header. |  508   // Prepare environment to be used as loop header. | 
|  502   void PrepareForLoop(BitVector* assigned, bool is_osr = false); |  509   void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 
|  503 }; |  510 }; | 
|  504  |  511  | 
|  505 }  // namespace compiler |  512 }  // namespace compiler | 
|  506 }  // namespace internal |  513 }  // namespace internal | 
|  507 }  // namespace v8 |  514 }  // namespace v8 | 
|  508  |  515  | 
|  509 #endif  // V8_COMPILER_AST_GRAPH_BUILDER_H_ |  516 #endif  // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 
| OLD | NEW |