| 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/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/ast.h" | 10 #include "src/ast.h" |
| 11 #include "src/compiler/graph-builder.h" | 11 #include "src/compiler/graph-builder.h" |
| 12 #include "src/compiler/js-graph.h" | 12 #include "src/compiler/js-graph.h" |
| 13 | 13 |
| 14 namespace v8 { | 14 namespace v8 { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace compiler { | 16 namespace compiler { |
| 17 | 17 |
| 18 class ControlBuilder; | 18 class ControlBuilder; |
| 19 class Graph; |
| 20 class LoopAssignmentAnalysis; |
| 19 class LoopBuilder; | 21 class LoopBuilder; |
| 20 class Graph; | |
| 21 | 22 |
| 22 // The AstGraphBuilder produces a high-level IR graph, based on an | 23 // The AstGraphBuilder produces a high-level IR graph, based on an |
| 23 // underlying AST. The produced graph can either be compiled into a | 24 // underlying AST. The produced graph can either be compiled into a |
| 24 // stand-alone function or be wired into another graph for the purposes | 25 // stand-alone function or be wired into another graph for the purposes |
| 25 // of function inlining. | 26 // of function inlining. |
| 26 class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { | 27 class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor { |
| 27 public: | 28 public: |
| 28 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph); | 29 AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph); |
| 29 | 30 |
| 30 // Creates a graph by visiting the entire AST. | 31 // Creates a graph by visiting the entire AST. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Stack of breakable statements entered by the visitor. | 129 // Stack of breakable statements entered by the visitor. |
| 129 BreakableScope* breakable_; | 130 BreakableScope* breakable_; |
| 130 | 131 |
| 131 // Stack of context objects pushed onto the chain by the visitor. | 132 // Stack of context objects pushed onto the chain by the visitor. |
| 132 ContextScope* execution_context_; | 133 ContextScope* execution_context_; |
| 133 | 134 |
| 134 // Nodes representing values in the activation record. | 135 // Nodes representing values in the activation record. |
| 135 SetOncePointer<Node> function_closure_; | 136 SetOncePointer<Node> function_closure_; |
| 136 SetOncePointer<Node> function_context_; | 137 SetOncePointer<Node> function_context_; |
| 137 | 138 |
| 139 LoopAssignmentAnalysis* loop_assignment_analysis_; |
| 140 |
| 138 CompilationInfo* info() const { return info_; } | 141 CompilationInfo* info() const { return info_; } |
| 139 inline StrictMode strict_mode() const; | 142 inline StrictMode strict_mode() const; |
| 140 JSGraph* jsgraph() { return jsgraph_; } | 143 JSGraph* jsgraph() { return jsgraph_; } |
| 141 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } | 144 JSOperatorBuilder* javascript() { return jsgraph_->javascript(); } |
| 142 ZoneList<Handle<Object> >* globals() { return &globals_; } | 145 ZoneList<Handle<Object> >* globals() { return &globals_; } |
| 143 | 146 |
| 144 // Current scope during visitation. | 147 // Current scope during visitation. |
| 145 inline Scope* current_scope() const; | 148 inline Scope* current_scope() const; |
| 146 | 149 |
| 147 // Named and keyed loads require a VectorSlotPair for successful lowering. | 150 // Named and keyed loads require a VectorSlotPair for successful lowering. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // Dispatched from VisitForInStatement. | 184 // Dispatched from VisitForInStatement. |
| 182 void VisitForInAssignment(Expression* expr, Node* value); | 185 void VisitForInAssignment(Expression* expr, Node* value); |
| 183 | 186 |
| 184 // Builds deoptimization for a given node. | 187 // Builds deoptimization for a given node. |
| 185 void PrepareFrameState( | 188 void PrepareFrameState( |
| 186 Node* node, BailoutId ast_id, | 189 Node* node, BailoutId ast_id, |
| 187 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()); | 190 OutputFrameStateCombine combine = OutputFrameStateCombine::Ignore()); |
| 188 | 191 |
| 189 OutputFrameStateCombine StateCombineFromAstContext(); | 192 OutputFrameStateCombine StateCombineFromAstContext(); |
| 190 | 193 |
| 194 BitVector* GetVariablesAssignedInLoop(IterationStatement* stmt); |
| 195 |
| 191 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 196 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 192 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); | 197 DISALLOW_COPY_AND_ASSIGN(AstGraphBuilder); |
| 193 }; | 198 }; |
| 194 | 199 |
| 195 | 200 |
| 196 // The abstract execution environment for generated code consists of | 201 // The abstract execution environment for generated code consists of |
| 197 // parameter variables, local variables and the operand stack. The | 202 // parameter variables, local variables and the operand stack. The |
| 198 // environment will perform proper SSA-renaming of all tracked nodes | 203 // environment will perform proper SSA-renaming of all tracked nodes |
| 199 // at split and merge points in the control flow. Internally all the | 204 // at split and merge points in the control flow. Internally all the |
| 200 // values are stored in one list using the following layout: | 205 // values are stored in one list using the following layout: |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 }; | 437 }; |
| 433 | 438 |
| 434 Scope* AstGraphBuilder::current_scope() const { | 439 Scope* AstGraphBuilder::current_scope() const { |
| 435 return execution_context_->scope(); | 440 return execution_context_->scope(); |
| 436 } | 441 } |
| 437 } | 442 } |
| 438 } | 443 } |
| 439 } // namespace v8::internal::compiler | 444 } // namespace v8::internal::compiler |
| 440 | 445 |
| 441 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 446 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
| OLD | NEW |