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/compiler-source-position-table.h" |
9 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/liveness-analyzer.h" | 11 #include "src/compiler/liveness-analyzer.h" |
11 #include "src/compiler/state-values-utils.h" | 12 #include "src/compiler/state-values-utils.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 | 16 |
16 // Forward declarations. | 17 // Forward declarations. |
17 class BitVector; | 18 class BitVector; |
18 class CompilationInfo; | 19 class CompilationInfo; |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 NodeVector* contexts() { return &contexts_; } | 611 NodeVector* contexts() { return &contexts_; } |
611 LivenessAnalyzerBlock* liveness_block() { return liveness_block_; } | 612 LivenessAnalyzerBlock* liveness_block() { return liveness_block_; } |
612 bool IsLivenessAnalysisEnabled(); | 613 bool IsLivenessAnalysisEnabled(); |
613 bool IsLivenessBlockConsistent(); | 614 bool IsLivenessBlockConsistent(); |
614 | 615 |
615 // Prepare environment to be used as loop header. | 616 // Prepare environment to be used as loop header. |
616 void PrepareForLoop(BitVector* assigned); | 617 void PrepareForLoop(BitVector* assigned); |
617 void PrepareForOsrEntry(); | 618 void PrepareForOsrEntry(); |
618 }; | 619 }; |
619 | 620 |
| 621 class AstGraphBuilderWithPositions final : public AstGraphBuilder { |
| 622 public: |
| 623 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, |
| 624 JSGraph* jsgraph, float invocation_frequency, |
| 625 LoopAssignmentAnalysis* loop_assignment, |
| 626 TypeHintAnalysis* type_hint_analysis, |
| 627 SourcePositionTable* source_positions, |
| 628 int inlining_id = -1); |
| 629 |
| 630 bool CreateGraph(bool stack_check = true) { |
| 631 SourcePositionTable::Scope pos_scope(source_positions_, start_position_); |
| 632 return AstGraphBuilder::CreateGraph(stack_check); |
| 633 } |
| 634 |
| 635 #define DEF_VISIT(type) \ |
| 636 void Visit##type(type* node) override { \ |
| 637 SourcePositionTable::Scope pos( \ |
| 638 source_positions_, SourcePosition(node->position(), inlining_id_)); \ |
| 639 AstGraphBuilder::Visit##type(node); \ |
| 640 } |
| 641 AST_NODE_LIST(DEF_VISIT) |
| 642 #undef DEF_VISIT |
| 643 |
| 644 private: |
| 645 SourcePositionTable* const source_positions_; |
| 646 SourcePosition const start_position_; |
| 647 int inlining_id_; |
| 648 }; |
| 649 |
620 } // namespace compiler | 650 } // namespace compiler |
621 } // namespace internal | 651 } // namespace internal |
622 } // namespace v8 | 652 } // namespace v8 |
623 | 653 |
624 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ | 654 #endif // V8_COMPILER_AST_GRAPH_BUILDER_H_ |
OLD | NEW |