OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 | 148 |
149 // Typedef only introduced to avoid unreadable code. | 149 // Typedef only introduced to avoid unreadable code. |
150 // Please do appreciate the required space in "> >". | 150 // Please do appreciate the required space in "> >". |
151 typedef ZoneList<Handle<String> > ZoneStringList; | 151 typedef ZoneList<Handle<String> > ZoneStringList; |
152 typedef ZoneList<Handle<Object> > ZoneObjectList; | 152 typedef ZoneList<Handle<Object> > ZoneObjectList; |
153 | 153 |
154 | 154 |
155 #define DECLARE_NODE_TYPE(type) \ | 155 #define DECLARE_NODE_TYPE(type) \ |
156 virtual void Accept(AstVisitor* v); \ | 156 virtual void Accept(AstVisitor* v); \ |
157 virtual AstNode::Type node_type() const { return AstNode::k##type; } \ | 157 virtual AstNode::Type node_type() const { return AstNode::k##type; } |
158 | 158 |
159 | 159 |
160 enum AstPropertiesFlag { | 160 enum AstPropertiesFlag { |
161 kDontInline, | 161 kDontInline, |
162 kDontOptimize, | 162 kDontOptimize, |
163 kDontSelfOptimize, | 163 kDontSelfOptimize, |
164 kDontSoftInline | 164 kDontSoftInline |
165 }; | 165 }; |
166 | 166 |
167 | 167 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 private: | 239 private: |
240 // Hidden to prevent accidental usage. It would have to load the | 240 // Hidden to prevent accidental usage. It would have to load the |
241 // current zone from the TLS. | 241 // current zone from the TLS. |
242 void* operator new(size_t size); | 242 void* operator new(size_t size); |
243 | 243 |
244 friend class CaseClause; // Generates AST IDs. | 244 friend class CaseClause; // Generates AST IDs. |
245 }; | 245 }; |
246 | 246 |
247 | 247 |
248 #define DECLARE_NODE_TYPE(type) \ | |
249 virtual void Accept(AstVisitor* v); \ | |
250 virtual AstNode::Type node_type() const { return AstNode::k##type; } \ | |
251 | |
252 | |
253 class Statement: public AstNode { | 248 class Statement: public AstNode { |
254 public: | 249 public: |
255 Statement() : statement_pos_(RelocInfo::kNoPosition) {} | 250 Statement() : statement_pos_(RelocInfo::kNoPosition) {} |
256 | 251 |
257 virtual Statement* AsStatement() { return this; } | 252 virtual Statement* AsStatement() { return this; } |
258 | 253 |
259 bool IsEmpty() { return AsEmptyStatement() != NULL; } | 254 bool IsEmpty() { return AsEmptyStatement() != NULL; } |
260 | 255 |
261 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } | 256 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } |
262 int statement_pos() const { return statement_pos_; } | 257 int statement_pos() const { return statement_pos_; } |
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 class ThisFunction: public Expression { | 2038 class ThisFunction: public Expression { |
2044 public: | 2039 public: |
2045 DECLARE_NODE_TYPE(ThisFunction) | 2040 DECLARE_NODE_TYPE(ThisFunction) |
2046 | 2041 |
2047 protected: | 2042 protected: |
2048 template<class> friend class AstNodeFactory; | 2043 template<class> friend class AstNodeFactory; |
2049 | 2044 |
2050 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} | 2045 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} |
2051 }; | 2046 }; |
2052 | 2047 |
| 2048 #undef DECLARE_NODE_TYPE |
| 2049 |
2053 | 2050 |
2054 // ---------------------------------------------------------------------------- | 2051 // ---------------------------------------------------------------------------- |
2055 // Regular expressions | 2052 // Regular expressions |
2056 | 2053 |
2057 | 2054 |
2058 class RegExpVisitor BASE_EMBEDDED { | 2055 class RegExpVisitor BASE_EMBEDDED { |
2059 public: | 2056 public: |
2060 virtual ~RegExpVisitor() { } | 2057 virtual ~RegExpVisitor() { } |
2061 #define MAKE_CASE(Name) \ | 2058 #define MAKE_CASE(Name) \ |
2062 virtual void* Visit##Name(RegExp##Name*, void* data) = 0; | 2059 virtual void* Visit##Name(RegExp##Name*, void* data) = 0; |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 private: | 2809 private: |
2813 Isolate* isolate_; | 2810 Isolate* isolate_; |
2814 Zone* zone_; | 2811 Zone* zone_; |
2815 Visitor visitor_; | 2812 Visitor visitor_; |
2816 }; | 2813 }; |
2817 | 2814 |
2818 | 2815 |
2819 } } // namespace v8::internal | 2816 } } // namespace v8::internal |
2820 | 2817 |
2821 #endif // V8_AST_H_ | 2818 #endif // V8_AST_H_ |
OLD | NEW |