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

Side by Side Diff: src/ast.h

Issue 11093074: Get rid of static module allocation, do it in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed last comments; added other back-ends Created 8 years, 1 month 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
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 V(ExportDeclaration) \ 68 V(ExportDeclaration) \
69 69
70 #define MODULE_NODE_LIST(V) \ 70 #define MODULE_NODE_LIST(V) \
71 V(ModuleLiteral) \ 71 V(ModuleLiteral) \
72 V(ModuleVariable) \ 72 V(ModuleVariable) \
73 V(ModulePath) \ 73 V(ModulePath) \
74 V(ModuleUrl) 74 V(ModuleUrl)
75 75
76 #define STATEMENT_NODE_LIST(V) \ 76 #define STATEMENT_NODE_LIST(V) \
77 V(Block) \ 77 V(Block) \
78 V(ModuleStatement) \
78 V(ExpressionStatement) \ 79 V(ExpressionStatement) \
79 V(EmptyStatement) \ 80 V(EmptyStatement) \
80 V(IfStatement) \ 81 V(IfStatement) \
81 V(ContinueStatement) \ 82 V(ContinueStatement) \
82 V(BreakStatement) \ 83 V(BreakStatement) \
83 V(ReturnStatement) \ 84 V(ReturnStatement) \
84 V(WithStatement) \ 85 V(WithStatement) \
85 V(SwitchStatement) \ 86 V(SwitchStatement) \
86 V(DoWhileStatement) \ 87 V(DoWhileStatement) \
87 V(WhileStatement) \ 88 V(WhileStatement) \
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 516
516 Module* module() const { return module_; } 517 Module* module() const { return module_; }
517 virtual InitializationFlag initialization() const { 518 virtual InitializationFlag initialization() const {
518 return kCreatedInitialized; 519 return kCreatedInitialized;
519 } 520 }
520 521
521 protected: 522 protected:
522 ModuleDeclaration(VariableProxy* proxy, 523 ModuleDeclaration(VariableProxy* proxy,
523 Module* module, 524 Module* module,
524 Scope* scope) 525 Scope* scope)
525 : Declaration(proxy, LET, scope), 526 : Declaration(proxy, MODULE, scope),
526 module_(module) { 527 module_(module) {
527 } 528 }
528 529
529 private: 530 private:
530 Module* module_; 531 Module* module_;
531 }; 532 };
532 533
533 534
534 class ImportDeclaration: public Declaration { 535 class ImportDeclaration: public Declaration {
535 public: 536 public:
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 protected: 639 protected:
639 ModuleUrl(Handle<String> url, Zone* zone) 640 ModuleUrl(Handle<String> url, Zone* zone)
640 : Module(zone), url_(url) { 641 : Module(zone), url_(url) {
641 } 642 }
642 643
643 private: 644 private:
644 Handle<String> url_; 645 Handle<String> url_;
645 }; 646 };
646 647
647 648
649 class ModuleStatement: public Statement {
650 public:
651 DECLARE_NODE_TYPE(ModuleStatement)
652
653 VariableProxy* proxy() const { return proxy_; }
654 Block* body() const { return body_; }
655
656 protected:
657 ModuleStatement(VariableProxy* proxy, Block* body)
658 : proxy_(proxy),
659 body_(body) {
660 }
661
662 private:
663 VariableProxy* proxy_;
664 Block* body_;
665 };
666
667
648 class IterationStatement: public BreakableStatement { 668 class IterationStatement: public BreakableStatement {
649 public: 669 public:
650 // Type testing & conversion. 670 // Type testing & conversion.
651 virtual IterationStatement* AsIterationStatement() { return this; } 671 virtual IterationStatement* AsIterationStatement() { return this; }
652 672
653 Statement* body() const { return body_; } 673 Statement* body() const { return body_; }
654 674
655 BailoutId OsrEntryId() const { return osr_entry_id_; } 675 BailoutId OsrEntryId() const { return osr_entry_id_; }
656 virtual BailoutId ContinueId() const = 0; 676 virtual BailoutId ContinueId() const = 0;
657 virtual BailoutId StackCheckId() const = 0; 677 virtual BailoutId StackCheckId() const = 0;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 Handle<String> name() const { return name_; } 1430 Handle<String> name() const { return name_; }
1411 Variable* var() const { return var_; } 1431 Variable* var() const { return var_; }
1412 bool is_this() const { return is_this_; } 1432 bool is_this() const { return is_this_; }
1413 int position() const { return position_; } 1433 int position() const { return position_; }
1414 Interface* interface() const { return interface_; } 1434 Interface* interface() const { return interface_; }
1415 1435
1416 1436
1417 void MarkAsTrivial() { is_trivial_ = true; } 1437 void MarkAsTrivial() { is_trivial_ = true; }
1418 void MarkAsLValue() { is_lvalue_ = true; } 1438 void MarkAsLValue() { is_lvalue_ = true; }
1419 1439
1420 // Bind this proxy to the variable var. 1440 // Bind this proxy to the variable var. Interfaces must match.
1421 void BindTo(Variable* var); 1441 void BindTo(Variable* var);
1422 1442
1423 protected: 1443 protected:
1424 VariableProxy(Isolate* isolate, Variable* var); 1444 VariableProxy(Isolate* isolate, Variable* var);
1425 1445
1426 VariableProxy(Isolate* isolate, 1446 VariableProxy(Isolate* isolate,
1427 Handle<String> name, 1447 Handle<String> name,
1428 bool is_this, 1448 bool is_this,
1429 Interface* interface, 1449 Interface* interface,
1430 int position); 1450 int position);
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \ 2660 NodeType* stmt = new(zone_) NodeType(isolate_, labels); \
2641 VISIT_AND_RETURN(NodeType, stmt); \ 2661 VISIT_AND_RETURN(NodeType, stmt); \
2642 } 2662 }
2643 STATEMENT_WITH_LABELS(DoWhileStatement) 2663 STATEMENT_WITH_LABELS(DoWhileStatement)
2644 STATEMENT_WITH_LABELS(WhileStatement) 2664 STATEMENT_WITH_LABELS(WhileStatement)
2645 STATEMENT_WITH_LABELS(ForStatement) 2665 STATEMENT_WITH_LABELS(ForStatement)
2646 STATEMENT_WITH_LABELS(ForInStatement) 2666 STATEMENT_WITH_LABELS(ForInStatement)
2647 STATEMENT_WITH_LABELS(SwitchStatement) 2667 STATEMENT_WITH_LABELS(SwitchStatement)
2648 #undef STATEMENT_WITH_LABELS 2668 #undef STATEMENT_WITH_LABELS
2649 2669
2670 ModuleStatement* NewModuleStatement(VariableProxy* proxy, Block* body) {
2671 ModuleStatement* stmt = new(zone_) ModuleStatement(proxy, body);
2672 VISIT_AND_RETURN(ModuleStatement, stmt)
2673 }
2674
2650 ExpressionStatement* NewExpressionStatement(Expression* expression) { 2675 ExpressionStatement* NewExpressionStatement(Expression* expression) {
2651 ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression); 2676 ExpressionStatement* stmt = new(zone_) ExpressionStatement(expression);
2652 VISIT_AND_RETURN(ExpressionStatement, stmt) 2677 VISIT_AND_RETURN(ExpressionStatement, stmt)
2653 } 2678 }
2654 2679
2655 ContinueStatement* NewContinueStatement(IterationStatement* target) { 2680 ContinueStatement* NewContinueStatement(IterationStatement* target) {
2656 ContinueStatement* stmt = new(zone_) ContinueStatement(target); 2681 ContinueStatement* stmt = new(zone_) ContinueStatement(target);
2657 VISIT_AND_RETURN(ContinueStatement, stmt) 2682 VISIT_AND_RETURN(ContinueStatement, stmt)
2658 } 2683 }
2659 2684
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2903 private: 2928 private:
2904 Isolate* isolate_; 2929 Isolate* isolate_;
2905 Zone* zone_; 2930 Zone* zone_;
2906 Visitor visitor_; 2931 Visitor visitor_;
2907 }; 2932 };
2908 2933
2909 2934
2910 } } // namespace v8::internal 2935 } } // namespace v8::internal
2911 2936
2912 #endif // V8_AST_H_ 2937 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698