Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: src/ast.h

Issue 10690043: Implement proper module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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) :
Michael Starzinger 2012/07/06 10:53:22 The colon should be on the next line.
rossberg 2012/07/06 15:39:28 Done.
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_; }
599 598
Michael Starzinger 2012/07/06 10:53:22 For consistency we should drop this empty newline.
rossberg 2012/07/06 15:39:28 Done.
599 Block* body() const { return body_; }
600
600 protected: 601 protected:
601 explicit Module(Zone* zone) : interface_(Interface::NewModule(zone)) {} 602 explicit Module(Zone* zone) :
Michael Starzinger 2012/07/06 10:53:22 The colon should be on the next line.
rossberg 2012/07/06 15:39:28 Done.
602 explicit Module(Interface* interface) : interface_(interface) {} 603 interface_(Interface::NewModule(zone)),
604 body_(NULL) {}
605 explicit Module(Interface* interface, Block* body = NULL) :
Michael Starzinger 2012/07/06 10:53:22 The colon should be on the next line.
rossberg 2012/07/06 15:39:28 Done.
606 interface_(interface),
607 body_(body) {}
603 608
604 private: 609 private:
605 Interface* interface_; 610 Interface* interface_;
611 Block* body_;
606 }; 612 };
607 613
608 614
609 class ModuleLiteral: public Module { 615 class ModuleLiteral: public Module {
610 public: 616 public:
611 DECLARE_NODE_TYPE(ModuleLiteral) 617 DECLARE_NODE_TYPE(ModuleLiteral)
612 618
613 Block* body() const { return body_; }
614 Handle<Context> context() const { return context_; }
615
616 protected: 619 protected:
617 template<class> friend class AstNodeFactory; 620 template<class> friend class AstNodeFactory;
618 621
619 ModuleLiteral(Block* body, Interface* interface) 622 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 }; 623 };
628 624
629 625
630 class ModuleVariable: public Module { 626 class ModuleVariable: public Module {
631 public: 627 public:
632 DECLARE_NODE_TYPE(ModuleVariable) 628 DECLARE_NODE_TYPE(ModuleVariable)
633 629
634 VariableProxy* proxy() const { return proxy_; } 630 VariableProxy* proxy() const { return proxy_; }
635 631
636 protected: 632 protected:
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 private: 2980 private:
2985 Isolate* isolate_; 2981 Isolate* isolate_;
2986 Zone* zone_; 2982 Zone* zone_;
2987 Visitor visitor_; 2983 Visitor visitor_;
2988 }; 2984 };
2989 2985
2990 2986
2991 } } // namespace v8::internal 2987 } } // namespace v8::internal
2992 2988
2993 #endif // V8_AST_H_ 2989 #endif // V8_AST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698