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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 #define DECLARE_NODE_TYPE(type) \ | 159 #define DECLARE_NODE_TYPE(type) \ |
160 virtual void Accept(AstVisitor* v); \ | 160 virtual void Accept(AstVisitor* v); \ |
161 virtual AstNode::Type node_type() const { return AstNode::k##type; } | 161 virtual AstNode::Type node_type() const { return AstNode::k##type; } |
162 | 162 |
163 | 163 |
164 enum AstPropertiesFlag { | 164 enum AstPropertiesFlag { |
165 kDontInline, | 165 kDontInline, |
166 kDontOptimize, | 166 kDontOptimize, |
167 kDontSelfOptimize, | 167 kDontSelfOptimize, |
168 kDontSoftInline | 168 kDontSoftInline, |
| 169 kDontCache |
169 }; | 170 }; |
170 | 171 |
171 | 172 |
172 class AstProperties BASE_EMBEDDED { | 173 class AstProperties BASE_EMBEDDED { |
173 public: | 174 public: |
174 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 175 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
175 | 176 |
176 AstProperties() : node_count_(0) { } | 177 AstProperties() : node_count_(0) { } |
177 | 178 |
178 Flags* flags() { return &flags_; } | 179 Flags* flags() { return &flags_; } |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 public: | 580 public: |
580 DECLARE_NODE_TYPE(ExportDeclaration) | 581 DECLARE_NODE_TYPE(ExportDeclaration) |
581 | 582 |
582 virtual InitializationFlag initialization() const { | 583 virtual InitializationFlag initialization() const { |
583 return kCreatedInitialized; | 584 return kCreatedInitialized; |
584 } | 585 } |
585 | 586 |
586 protected: | 587 protected: |
587 template<class> friend class AstNodeFactory; | 588 template<class> friend class AstNodeFactory; |
588 | 589 |
589 ExportDeclaration(VariableProxy* proxy, | 590 ExportDeclaration(VariableProxy* proxy, Scope* scope) |
590 Scope* scope) | 591 : Declaration(proxy, LET, scope) {} |
591 : Declaration(proxy, LET, scope) { | |
592 } | |
593 }; | 592 }; |
594 | 593 |
595 | 594 |
596 class Module: public AstNode { | 595 class Module: public AstNode { |
597 public: | 596 public: |
598 Interface* interface() const { return interface_; } | 597 Interface* interface() const { return interface_; } |
| 598 Block* body() const { return body_; } |
599 | 599 |
600 protected: | 600 protected: |
601 explicit Module(Zone* zone) : interface_(Interface::NewModule(zone)) {} | 601 explicit Module(Zone* zone) |
602 explicit Module(Interface* interface) : interface_(interface) {} | 602 : interface_(Interface::NewModule(zone)), |
| 603 body_(NULL) {} |
| 604 explicit Module(Interface* interface, Block* body = NULL) |
| 605 : interface_(interface), |
| 606 body_(body) {} |
603 | 607 |
604 private: | 608 private: |
605 Interface* interface_; | 609 Interface* interface_; |
| 610 Block* body_; |
606 }; | 611 }; |
607 | 612 |
608 | 613 |
609 class ModuleLiteral: public Module { | 614 class ModuleLiteral: public Module { |
610 public: | 615 public: |
611 DECLARE_NODE_TYPE(ModuleLiteral) | 616 DECLARE_NODE_TYPE(ModuleLiteral) |
612 | 617 |
613 Block* body() const { return body_; } | |
614 Handle<Context> context() const { return context_; } | |
615 | |
616 protected: | 618 protected: |
617 template<class> friend class AstNodeFactory; | 619 template<class> friend class AstNodeFactory; |
618 | 620 |
619 ModuleLiteral(Block* body, Interface* interface) | 621 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} |
620 : Module(interface), | |
621 body_(body) { | |
622 } | |
623 | |
624 private: | |
625 Block* body_; | |
626 Handle<Context> context_; | |
627 }; | 622 }; |
628 | 623 |
629 | 624 |
630 class ModuleVariable: public Module { | 625 class ModuleVariable: public Module { |
631 public: | 626 public: |
632 DECLARE_NODE_TYPE(ModuleVariable) | 627 DECLARE_NODE_TYPE(ModuleVariable) |
633 | 628 |
634 VariableProxy* proxy() const { return proxy_; } | 629 VariableProxy* proxy() const { return proxy_; } |
635 | 630 |
636 protected: | 631 protected: |
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 private: | 2979 private: |
2985 Isolate* isolate_; | 2980 Isolate* isolate_; |
2986 Zone* zone_; | 2981 Zone* zone_; |
2987 Visitor visitor_; | 2982 Visitor visitor_; |
2988 }; | 2983 }; |
2989 | 2984 |
2990 | 2985 |
2991 } } // namespace v8::internal | 2986 } } // namespace v8::internal |
2992 | 2987 |
2993 #endif // V8_AST_H_ | 2988 #endif // V8_AST_H_ |
OLD | NEW |