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

Side by Side Diff: runtime/vm/ast_printer.h

Issue 2327693002: Add --parse-all option in order to benchmark and measure the scanner/parser performance. (Closed)
Patch Set: Address review comments. Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_AST_PRINTER_H_ 5 #ifndef VM_AST_PRINTER_H_
6 #define VM_AST_PRINTER_H_ 6 #define VM_AST_PRINTER_H_
7 7
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 // Forward declaration. 13 // Forward declaration.
14 class ParsedFunction; 14 class ParsedFunction;
15 class Log;
15 16
16 class AstPrinter : public AstNodeVisitor { 17 class AstPrinter : public AstNodeVisitor {
17 public: 18 public:
18 static void PrintNode(AstNode* node); 19 explicit AstPrinter(bool log = true);
19 static void PrintFunctionScope(const ParsedFunction& parsed_function); 20 ~AstPrinter();
20 static void PrintFunctionNodes(const ParsedFunction& parsed_function); 21
22 void PrintNode(AstNode* node);
23 void PrintFunctionScope(const ParsedFunction& parsed_function);
24 void PrintFunctionNodes(const ParsedFunction& parsed_function);
21 25
22 #define DECLARE_VISITOR_FUNCTION(BaseName) \ 26 #define DECLARE_VISITOR_FUNCTION(BaseName) \
23 virtual void Visit##BaseName##Node(BaseName##Node* node); 27 virtual void Visit##BaseName##Node(BaseName##Node* node);
24 28
25 FOR_EACH_NODE(DECLARE_VISITOR_FUNCTION) 29 FOR_EACH_NODE(DECLARE_VISITOR_FUNCTION)
26 #undef DECLARE_VISITOR_FUNCTION 30 #undef DECLARE_VISITOR_FUNCTION
27 31
28 private: 32 private:
29 AstPrinter();
30 ~AstPrinter();
31
32 static const int kScopeIndent = 2; 33 static const int kScopeIndent = 2;
33 34
34 static void PrintLocalScopeVariable(const LocalScope* scope, 35 void IndentN(int count);
35 LocalVariable* var, 36 void PrintLocalScopeVariable(const LocalScope* scope,
36 int indent = 0); 37 LocalVariable* var,
37 static void PrintLocalScope(const LocalScope* scope, 38 int indent = 0);
38 int variable_index, 39 void PrintLocalScope(const LocalScope* scope,
39 int indent = 0); 40 int variable_index,
41 int indent = 0);
40 42
41 void VisitGenericAstNode(AstNode* node); 43 void VisitGenericAstNode(AstNode* node);
42 void VisitGenericLocalNode(AstNode* node, const LocalVariable& local); 44 void VisitGenericLocalNode(AstNode* node, const LocalVariable& local);
43 void VisitGenericFieldNode(AstNode* node, const Field& field); 45 void VisitGenericFieldNode(AstNode* node, const Field& field);
44 46
45 intptr_t indent_; 47 intptr_t indent_;
48 Log* logger_;
46 49
47 DISALLOW_COPY_AND_ASSIGN(AstPrinter); 50 DISALLOW_COPY_AND_ASSIGN(AstPrinter);
48 }; 51 };
49 52
50 } // namespace dart 53 } // namespace dart
51 54
52 #endif // VM_AST_PRINTER_H_ 55 #endif // VM_AST_PRINTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698