| 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_LOOP_ASSIGNMENT_ANALYZER_H_ | 5 #ifndef V8_COMPILER_AST_LOOP_ASSIGNMENT_ANALYZER_H_ |
| 6 #define V8_COMPILER_AST_LOOP_ASSIGNMENT_ANALYZER_H_ | 6 #define V8_COMPILER_AST_LOOP_ASSIGNMENT_ANALYZER_H_ |
| 7 | 7 |
| 8 #include "src/ast.h" | 8 #include "src/ast.h" |
| 9 #include "src/bit-vector.h" | 9 #include "src/bit-vector.h" |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 | 41 |
| 42 // The class that performs loop assignment analysis by walking the AST. | 42 // The class that performs loop assignment analysis by walking the AST. |
| 43 class AstLoopAssignmentAnalyzer : public AstVisitor { | 43 class AstLoopAssignmentAnalyzer : public AstVisitor { |
| 44 public: | 44 public: |
| 45 AstLoopAssignmentAnalyzer(Zone* zone, CompilationInfo* info); | 45 AstLoopAssignmentAnalyzer(Zone* zone, CompilationInfo* info); |
| 46 | 46 |
| 47 LoopAssignmentAnalysis* Analyze(); | 47 LoopAssignmentAnalysis* Analyze(); |
| 48 | 48 |
| 49 #define DECLARE_VISIT(type) virtual void Visit##type(type* node); | 49 #define DECLARE_VISIT(type) void Visit##type(type* node) OVERRIDE; |
| 50 AST_NODE_LIST(DECLARE_VISIT) | 50 AST_NODE_LIST(DECLARE_VISIT) |
| 51 #undef DECLARE_VISIT | 51 #undef DECLARE_VISIT |
| 52 | 52 |
| 53 static int GetVariableIndex(Scope* scope, Variable* var); | 53 static int GetVariableIndex(Scope* scope, Variable* var); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 CompilationInfo* info_; | 56 CompilationInfo* info_; |
| 57 ZoneDeque<BitVector*> loop_stack_; | 57 ZoneDeque<BitVector*> loop_stack_; |
| 58 LoopAssignmentAnalysis* result_; | 58 LoopAssignmentAnalysis* result_; |
| 59 | 59 |
| 60 CompilationInfo* info() { return info_; } | 60 CompilationInfo* info() { return info_; } |
| 61 | 61 |
| 62 void Enter(IterationStatement* loop); | 62 void Enter(IterationStatement* loop); |
| 63 void Exit(IterationStatement* loop); | 63 void Exit(IterationStatement* loop); |
| 64 | 64 |
| 65 void VisitIfNotNull(AstNode* node) { | 65 void VisitIfNotNull(AstNode* node) { |
| 66 if (node != NULL) Visit(node); | 66 if (node != NULL) Visit(node); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void AnalyzeAssignment(Variable* var); | 69 void AnalyzeAssignment(Variable* var); |
| 70 | 70 |
| 71 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | 71 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); |
| 72 DISALLOW_COPY_AND_ASSIGN(AstLoopAssignmentAnalyzer); | 72 DISALLOW_COPY_AND_ASSIGN(AstLoopAssignmentAnalyzer); |
| 73 }; | 73 }; |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 } // namespace v8::internal::compiler | 76 } // namespace v8::internal::compiler |
| 77 | 77 |
| 78 #endif // V8_COMPILER_AST_LOOP_ASSIGNMENT_ANALYZER_H_ | 78 #endif // V8_COMPILER_AST_LOOP_ASSIGNMENT_ANALYZER_H_ |
| OLD | NEW |