Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_AST_EXPRESSION_VISITOR_H_ | |
| 6 #define V8_AST_EXPRESSION_VISITOR_H_ | |
| 7 | |
| 8 #include "src/allocation.h" | |
| 9 #include "src/ast.h" | |
| 10 #include "src/effects.h" | |
| 11 #include "src/scopes.h" | |
| 12 #include "src/type-info.h" | |
| 13 #include "src/types.h" | |
| 14 #include "src/zone.h" | |
| 15 | |
| 16 namespace v8 { | |
| 17 namespace internal { | |
| 18 | |
| 19 // A Visitor over a CompilationInfo's AST that invokes | |
| 20 // VisitExpression on each expression node. | |
| 21 | |
| 22 class AstExpressionVisitor : public AstVisitor { | |
| 23 public: | |
| 24 explicit AstExpressionVisitor(CompilationInfo* info); | |
| 25 | |
| 26 void* operator new(size_t size, Zone* zone) { return zone->New(size); } | |
|
titzer
2015/08/19 12:06:37
I don't think you want to define your own new here
bradn
2015/08/20 04:01:40
Not groking. But maybe I'm missing something basic
rossberg
2015/08/20 16:34:26
Honestly, I don't know why typing.h does that. Why
| |
| 27 void operator delete(void* pointer, Zone* zone) {} | |
| 28 void operator delete(void* pointer) {} | |
| 29 | |
| 30 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); | |
| 31 | |
| 32 protected: | |
| 33 void VisitAll(); | |
| 34 virtual void VisitExpression(Expression* expression) = 0; | |
| 35 int depth() { return depth_; } | |
| 36 | |
| 37 private: | |
| 38 void VisitDeclarations(ZoneList<Declaration*>* d) override; | |
| 39 void VisitStatements(ZoneList<Statement*>* s) override; | |
| 40 | |
| 41 #define DECLARE_VISIT(type) virtual void Visit##type(type* node) override; | |
| 42 AST_NODE_LIST(DECLARE_VISIT) | |
| 43 #undef DECLARE_VISIT | |
| 44 | |
| 45 CompilationInfo* compilation_info_; | |
| 46 int depth_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(AstExpressionVisitor); | |
| 49 }; | |
| 50 } | |
| 51 } // namespace v8::internal | |
| 52 | |
| 53 #endif // V8_AST_EXPRESSION_VISITOR_H_ | |
| OLD | NEW |