| 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/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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // The AstGraphBuilder produces a high-level IR graph, based on an | 31 // The AstGraphBuilder produces a high-level IR graph, based on an |
| 32 // underlying AST. The produced graph can either be compiled into a | 32 // underlying AST. The produced graph can either be compiled into a |
| 33 // stand-alone function or be wired into another graph for the purposes | 33 // stand-alone function or be wired into another graph for the purposes |
| 34 // of function inlining. | 34 // of function inlining. |
| 35 // This AstVistor is not final, and provides the AstVisitor methods as virtual | 35 // This AstVistor is not final, and provides the AstVisitor methods as virtual |
| 36 // methods so they can be specialized by subclasses. | 36 // methods so they can be specialized by subclasses. |
| 37 class AstGraphBuilder : public AstVisitor<AstGraphBuilder> { | 37 class AstGraphBuilder : public AstVisitor<AstGraphBuilder> { |
| 38 public: | 38 public: |
| 39 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, | 39 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, |
| 40 float invocation_frequency, |
| 40 LoopAssignmentAnalysis* loop_assignment = nullptr, | 41 LoopAssignmentAnalysis* loop_assignment = nullptr, |
| 41 TypeHintAnalysis* type_hint_analysis = nullptr); | 42 TypeHintAnalysis* type_hint_analysis = nullptr); |
| 42 virtual ~AstGraphBuilder() {} | 43 virtual ~AstGraphBuilder() {} |
| 43 | 44 |
| 44 // Creates a graph by visiting the entire AST. | 45 // Creates a graph by visiting the entire AST. |
| 45 bool CreateGraph(bool stack_check = true); | 46 bool CreateGraph(bool stack_check = true); |
| 46 | 47 |
| 47 // Helpers to create new control nodes. | 48 // Helpers to create new control nodes. |
| 48 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } | 49 Node* NewIfTrue() { return NewNode(common()->IfTrue()); } |
| 49 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } | 50 Node* NewIfFalse() { return NewNode(common()->IfFalse()); } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 class ControlScopeForIteration; | 74 class ControlScopeForIteration; |
| 74 class ControlScopeForCatch; | 75 class ControlScopeForCatch; |
| 75 class ControlScopeForFinally; | 76 class ControlScopeForFinally; |
| 76 class Environment; | 77 class Environment; |
| 77 friend class ControlBuilder; | 78 friend class ControlBuilder; |
| 78 | 79 |
| 79 Isolate* isolate_; | 80 Isolate* isolate_; |
| 80 Zone* local_zone_; | 81 Zone* local_zone_; |
| 81 CompilationInfo* info_; | 82 CompilationInfo* info_; |
| 82 JSGraph* jsgraph_; | 83 JSGraph* jsgraph_; |
| 84 float const invocation_frequency_; |
| 83 Environment* environment_; | 85 Environment* environment_; |
| 84 AstContext* ast_context_; | 86 AstContext* ast_context_; |
| 85 | 87 |
| 86 // List of global declarations for functions and variables. | 88 // List of global declarations for functions and variables. |
| 87 ZoneVector<Handle<Object>> globals_; | 89 ZoneVector<Handle<Object>> globals_; |
| 88 | 90 |
| 89 // Stack of control scopes currently entered by the visitor. | 91 // Stack of control scopes currently entered by the visitor. |
| 90 ControlScope* execution_control_; | 92 ControlScope* execution_control_; |
| 91 | 93 |
| 92 // Stack of context objects pushed onto the chain by the visitor. | 94 // Stack of context objects pushed onto the chain by the visitor. |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 609 |
| 608 // Prepare environment to be used as loop header. | 610 // Prepare environment to be used as loop header. |
| 609 void PrepareForLoop(BitVector* assigned, bool is_osr = false); | 611 void PrepareForLoop(BitVector* assigned, bool is_osr = false); |
| 610 }; | 612 }; |
| 611 | 613 |
| 612 } // namespace compiler | 614 } // namespace compiler |
| 613 } // namespace internal | 615 } // namespace internal |
| 614 } // namespace v8 | 616 } // namespace v8 |
| 615 | 617 |
| 616 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 618 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |