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_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/ast/ast-value-factory.h" | 8 #include "src/ast/ast-value-factory.h" |
9 #include "src/ast/modules.h" | 9 #include "src/ast/modules.h" |
10 #include "src/ast/variables.h" | 10 #include "src/ast/variables.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int node_count_; | 184 int node_count_; |
185 FeedbackVectorSpec spec_; | 185 FeedbackVectorSpec spec_; |
186 }; | 186 }; |
187 | 187 |
188 DEFINE_OPERATORS_FOR_FLAGS(AstProperties::Flags) | 188 DEFINE_OPERATORS_FOR_FLAGS(AstProperties::Flags) |
189 | 189 |
190 | 190 |
191 class AstNode: public ZoneObject { | 191 class AstNode: public ZoneObject { |
192 public: | 192 public: |
193 #define DECLARE_TYPE_ENUM(type) k##type, | 193 #define DECLARE_TYPE_ENUM(type) k##type, |
194 enum NodeType : uint8_t { kModule = 0, AST_NODE_LIST(DECLARE_TYPE_ENUM) }; | 194 enum NodeType : uint8_t { AST_NODE_LIST(DECLARE_TYPE_ENUM) }; |
195 #undef DECLARE_TYPE_ENUM | 195 #undef DECLARE_TYPE_ENUM |
196 | 196 |
197 void* operator new(size_t size, Zone* zone) { return zone->New(size); } | 197 void* operator new(size_t size, Zone* zone) { return zone->New(size); } |
198 | 198 |
199 NodeType node_type() const { return node_type_; } | 199 NodeType node_type() const { return node_type_; } |
200 int position() const { return position_; } | 200 int position() const { return position_; } |
201 | 201 |
202 #ifdef DEBUG | 202 #ifdef DEBUG |
203 void Print(Isolate* isolate); | 203 void Print(Isolate* isolate); |
204 #endif // DEBUG | 204 #endif // DEBUG |
(...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2925 Subclass* impl() { return static_cast<Subclass*>(this); } | 2925 Subclass* impl() { return static_cast<Subclass*>(this); } |
2926 }; | 2926 }; |
2927 | 2927 |
2928 #define GENERATE_VISIT_CASE(NodeType) \ | 2928 #define GENERATE_VISIT_CASE(NodeType) \ |
2929 case AstNode::k##NodeType: \ | 2929 case AstNode::k##NodeType: \ |
2930 return this->impl()->Visit##NodeType(static_cast<NodeType*>(node)); | 2930 return this->impl()->Visit##NodeType(static_cast<NodeType*>(node)); |
2931 | 2931 |
2932 #define GENERATE_AST_VISITOR_SWITCH() \ | 2932 #define GENERATE_AST_VISITOR_SWITCH() \ |
2933 switch (node->node_type()) { \ | 2933 switch (node->node_type()) { \ |
2934 AST_NODE_LIST(GENERATE_VISIT_CASE) \ | 2934 AST_NODE_LIST(GENERATE_VISIT_CASE) \ |
2935 case AstNode::kModule: \ | |
2936 UNREACHABLE(); \ | |
2937 } | 2935 } |
2938 | 2936 |
2939 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ | 2937 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ |
2940 public: \ | 2938 public: \ |
2941 void Visit(AstNode* node) { \ | 2939 void Visit(AstNode* node) { \ |
2942 if (CheckStackOverflow()) return; \ | 2940 if (CheckStackOverflow()) return; \ |
2943 GENERATE_AST_VISITOR_SWITCH() \ | 2941 GENERATE_AST_VISITOR_SWITCH() \ |
2944 } \ | 2942 } \ |
2945 \ | 2943 \ |
2946 void SetStackOverflow() { stack_overflow_ = true; } \ | 2944 void SetStackOverflow() { stack_overflow_ = true; } \ |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3530 : NULL; \ | 3528 : NULL; \ |
3531 } | 3529 } |
3532 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3530 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
3533 #undef DECLARE_NODE_FUNCTIONS | 3531 #undef DECLARE_NODE_FUNCTIONS |
3534 | 3532 |
3535 | 3533 |
3536 } // namespace internal | 3534 } // namespace internal |
3537 } // namespace v8 | 3535 } // namespace v8 |
3538 | 3536 |
3539 #endif // V8_AST_AST_H_ | 3537 #endif // V8_AST_AST_H_ |
OLD | NEW |