Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: src/ast/ast.h

Issue 2004363002: Refactor duplicate logic in Ast{Traversal,Expression}Visitor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undefine utility macros Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_AST_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/modules.h" 10 #include "src/ast/modules.h"
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 } while (false) 3049 } while (false)
3050 3050
3051 3051
3052 // ---------------------------------------------------------------------------- 3052 // ----------------------------------------------------------------------------
3053 // Traversing visitor 3053 // Traversing visitor
3054 // - fully traverses the entire AST. 3054 // - fully traverses the entire AST.
3055 3055
3056 class AstTraversalVisitor : public AstVisitor { 3056 class AstTraversalVisitor : public AstVisitor {
3057 public: 3057 public:
3058 explicit AstTraversalVisitor(Isolate* isolate); 3058 explicit AstTraversalVisitor(Isolate* isolate);
3059 explicit AstTraversalVisitor(uintptr_t stack_limit);
3059 virtual ~AstTraversalVisitor() {} 3060 virtual ~AstTraversalVisitor() {}
3060 3061
3061 // Iteration left-to-right. 3062 // Iteration left-to-right.
3062 void VisitDeclarations(ZoneList<Declaration*>* declarations) override; 3063 void VisitDeclarations(ZoneList<Declaration*>* declarations) override;
3063 void VisitStatements(ZoneList<Statement*>* statements) override; 3064 void VisitStatements(ZoneList<Statement*>* statements) override;
3064 void VisitExpressions(ZoneList<Expression*>* expressions) override;
3065 3065
3066 // Individual nodes 3066 // Individual nodes
3067 #define DECLARE_VISIT(type) void Visit##type(type* node) override; 3067 #define DECLARE_VISIT(type) void Visit##type(type* node) override;
3068 AST_NODE_LIST(DECLARE_VISIT) 3068 AST_NODE_LIST(DECLARE_VISIT)
3069 #undef DECLARE_VISIT 3069 #undef DECLARE_VISIT
3070 3070
3071 protected:
3072 int depth() { return depth_; }
3073
3071 private: 3074 private:
3072 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 3075 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
3076
3077 int depth_;
3078
3073 DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor); 3079 DISALLOW_COPY_AND_ASSIGN(AstTraversalVisitor);
3074 }; 3080 };
3075 3081
3076 // ---------------------------------------------------------------------------- 3082 // ----------------------------------------------------------------------------
3077 // AstNode factory 3083 // AstNode factory
3078 3084
3079 class AstNodeFactory final BASE_EMBEDDED { 3085 class AstNodeFactory final BASE_EMBEDDED {
3080 public: 3086 public:
3081 explicit AstNodeFactory(AstValueFactory* ast_value_factory) 3087 explicit AstNodeFactory(AstValueFactory* ast_value_factory)
3082 : local_zone_(ast_value_factory->zone()), 3088 : local_zone_(ast_value_factory->zone()),
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3571 : NULL; \ 3577 : NULL; \
3572 } 3578 }
3573 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3579 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3574 #undef DECLARE_NODE_FUNCTIONS 3580 #undef DECLARE_NODE_FUNCTIONS
3575 3581
3576 3582
3577 } // namespace internal 3583 } // namespace internal
3578 } // namespace v8 3584 } // namespace v8
3579 3585
3580 #endif // V8_AST_AST_H_ 3586 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698