| OLD | NEW |
| 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_H_ | 5 #ifndef V8_AST_H_ |
| 6 #define V8_AST_H_ | 6 #define V8_AST_H_ |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/assembler.h" | 10 #include "src/assembler.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 class AstNode: public ZoneObject { | 194 class AstNode: public ZoneObject { |
| 195 public: | 195 public: |
| 196 #define DECLARE_TYPE_ENUM(type) k##type, | 196 #define DECLARE_TYPE_ENUM(type) k##type, |
| 197 enum NodeType { | 197 enum NodeType { |
| 198 AST_NODE_LIST(DECLARE_TYPE_ENUM) | 198 AST_NODE_LIST(DECLARE_TYPE_ENUM) |
| 199 kInvalid = -1 | 199 kInvalid = -1 |
| 200 }; | 200 }; |
| 201 #undef DECLARE_TYPE_ENUM | 201 #undef DECLARE_TYPE_ENUM |
| 202 | 202 |
| 203 void* operator new(size_t size, Zone* zone) { | 203 void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
| 204 return zone->New(static_cast<int>(size)); | |
| 205 } | |
| 206 | 204 |
| 207 explicit AstNode(int position): position_(position) {} | 205 explicit AstNode(int position): position_(position) {} |
| 208 virtual ~AstNode() {} | 206 virtual ~AstNode() {} |
| 209 | 207 |
| 210 virtual void Accept(AstVisitor* v) = 0; | 208 virtual void Accept(AstVisitor* v) = 0; |
| 211 virtual NodeType node_type() const = 0; | 209 virtual NodeType node_type() const = 0; |
| 212 int position() const { return position_; } | 210 int position() const { return position_; } |
| 213 | 211 |
| 214 // Type testing & conversion functions overridden by concrete subclasses. | 212 // Type testing & conversion functions overridden by concrete subclasses. |
| 215 #define DECLARE_NODE_FUNCTIONS(type) \ | 213 #define DECLARE_NODE_FUNCTIONS(type) \ |
| (...skipping 3324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3540 | 3538 |
| 3541 private: | 3539 private: |
| 3542 Zone* zone_; | 3540 Zone* zone_; |
| 3543 AstValueFactory* ast_value_factory_; | 3541 AstValueFactory* ast_value_factory_; |
| 3544 }; | 3542 }; |
| 3545 | 3543 |
| 3546 | 3544 |
| 3547 } } // namespace v8::internal | 3545 } } // namespace v8::internal |
| 3548 | 3546 |
| 3549 #endif // V8_AST_H_ | 3547 #endif // V8_AST_H_ |
| OLD | NEW |