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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 | 152 |
153 // Typedef only introduced to avoid unreadable code. | 153 // Typedef only introduced to avoid unreadable code. |
154 // Please do appreciate the required space in "> >". | 154 // Please do appreciate the required space in "> >". |
155 typedef ZoneList<Handle<String> > ZoneStringList; | 155 typedef ZoneList<Handle<String> > ZoneStringList; |
156 typedef ZoneList<Handle<Object> > ZoneObjectList; | 156 typedef ZoneList<Handle<Object> > ZoneObjectList; |
157 | 157 |
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 template<class> friend class AstNodeFactory; |
162 | 163 |
163 | 164 |
164 enum AstPropertiesFlag { | 165 enum AstPropertiesFlag { |
165 kDontInline, | 166 kDontInline, |
166 kDontOptimize, | 167 kDontOptimize, |
167 kDontSelfOptimize, | 168 kDontSelfOptimize, |
168 kDontSoftInline, | 169 kDontSoftInline, |
169 kDontCache | 170 kDontCache |
170 }; | 171 }; |
171 | 172 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 statements_.Add(statement, zone); | 413 statements_.Add(statement, zone); |
413 } | 414 } |
414 | 415 |
415 ZoneList<Statement*>* statements() { return &statements_; } | 416 ZoneList<Statement*>* statements() { return &statements_; } |
416 bool is_initializer_block() const { return is_initializer_block_; } | 417 bool is_initializer_block() const { return is_initializer_block_; } |
417 | 418 |
418 Scope* scope() const { return scope_; } | 419 Scope* scope() const { return scope_; } |
419 void set_scope(Scope* scope) { scope_ = scope; } | 420 void set_scope(Scope* scope) { scope_ = scope; } |
420 | 421 |
421 protected: | 422 protected: |
422 template<class> friend class AstNodeFactory; | |
423 | |
424 Block(Isolate* isolate, | 423 Block(Isolate* isolate, |
425 ZoneStringList* labels, | 424 ZoneStringList* labels, |
426 int capacity, | 425 int capacity, |
427 bool is_initializer_block, | 426 bool is_initializer_block, |
428 Zone* zone) | 427 Zone* zone) |
429 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), | 428 : BreakableStatement(isolate, labels, TARGET_FOR_NAMED_ONLY), |
430 statements_(capacity, zone), | 429 statements_(capacity, zone), |
431 is_initializer_block_(is_initializer_block), | 430 is_initializer_block_(is_initializer_block), |
432 scope_(NULL) { | 431 scope_(NULL) { |
433 } | 432 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 470 |
472 class VariableDeclaration: public Declaration { | 471 class VariableDeclaration: public Declaration { |
473 public: | 472 public: |
474 DECLARE_NODE_TYPE(VariableDeclaration) | 473 DECLARE_NODE_TYPE(VariableDeclaration) |
475 | 474 |
476 virtual InitializationFlag initialization() const { | 475 virtual InitializationFlag initialization() const { |
477 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; | 476 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; |
478 } | 477 } |
479 | 478 |
480 protected: | 479 protected: |
481 template<class> friend class AstNodeFactory; | |
482 | |
483 VariableDeclaration(VariableProxy* proxy, | 480 VariableDeclaration(VariableProxy* proxy, |
484 VariableMode mode, | 481 VariableMode mode, |
485 Scope* scope) | 482 Scope* scope) |
486 : Declaration(proxy, mode, scope) { | 483 : Declaration(proxy, mode, scope) { |
487 } | 484 } |
488 }; | 485 }; |
489 | 486 |
490 | 487 |
491 class FunctionDeclaration: public Declaration { | 488 class FunctionDeclaration: public Declaration { |
492 public: | 489 public: |
493 DECLARE_NODE_TYPE(FunctionDeclaration) | 490 DECLARE_NODE_TYPE(FunctionDeclaration) |
494 | 491 |
495 FunctionLiteral* fun() const { return fun_; } | 492 FunctionLiteral* fun() const { return fun_; } |
496 virtual InitializationFlag initialization() const { | 493 virtual InitializationFlag initialization() const { |
497 return kCreatedInitialized; | 494 return kCreatedInitialized; |
498 } | 495 } |
499 virtual bool IsInlineable() const; | 496 virtual bool IsInlineable() const; |
500 | 497 |
501 protected: | 498 protected: |
502 template<class> friend class AstNodeFactory; | |
503 | |
504 FunctionDeclaration(VariableProxy* proxy, | 499 FunctionDeclaration(VariableProxy* proxy, |
505 VariableMode mode, | 500 VariableMode mode, |
506 FunctionLiteral* fun, | 501 FunctionLiteral* fun, |
507 Scope* scope) | 502 Scope* scope) |
508 : Declaration(proxy, mode, scope), | 503 : Declaration(proxy, mode, scope), |
509 fun_(fun) { | 504 fun_(fun) { |
510 // At the moment there are no "const functions" in JavaScript... | 505 // At the moment there are no "const functions" in JavaScript... |
511 ASSERT(mode == VAR || mode == LET); | 506 ASSERT(mode == VAR || mode == LET); |
512 ASSERT(fun != NULL); | 507 ASSERT(fun != NULL); |
513 } | 508 } |
514 | 509 |
515 private: | 510 private: |
516 FunctionLiteral* fun_; | 511 FunctionLiteral* fun_; |
517 }; | 512 }; |
518 | 513 |
519 | 514 |
520 class ModuleDeclaration: public Declaration { | 515 class ModuleDeclaration: public Declaration { |
521 public: | 516 public: |
522 DECLARE_NODE_TYPE(ModuleDeclaration) | 517 DECLARE_NODE_TYPE(ModuleDeclaration) |
523 | 518 |
524 Module* module() const { return module_; } | 519 Module* module() const { return module_; } |
525 virtual InitializationFlag initialization() const { | 520 virtual InitializationFlag initialization() const { |
526 return kCreatedInitialized; | 521 return kCreatedInitialized; |
527 } | 522 } |
528 | 523 |
529 protected: | 524 protected: |
530 template<class> friend class AstNodeFactory; | |
531 | |
532 ModuleDeclaration(VariableProxy* proxy, | 525 ModuleDeclaration(VariableProxy* proxy, |
533 Module* module, | 526 Module* module, |
534 Scope* scope) | 527 Scope* scope) |
535 : Declaration(proxy, LET, scope), | 528 : Declaration(proxy, LET, scope), |
536 module_(module) { | 529 module_(module) { |
537 } | 530 } |
538 | 531 |
539 private: | 532 private: |
540 Module* module_; | 533 Module* module_; |
541 }; | 534 }; |
542 | 535 |
543 | 536 |
544 class ImportDeclaration: public Declaration { | 537 class ImportDeclaration: public Declaration { |
545 public: | 538 public: |
546 DECLARE_NODE_TYPE(ImportDeclaration) | 539 DECLARE_NODE_TYPE(ImportDeclaration) |
547 | 540 |
548 Module* module() const { return module_; } | 541 Module* module() const { return module_; } |
549 virtual InitializationFlag initialization() const { | 542 virtual InitializationFlag initialization() const { |
550 return kCreatedInitialized; | 543 return kCreatedInitialized; |
551 } | 544 } |
552 | 545 |
553 protected: | 546 protected: |
554 template<class> friend class AstNodeFactory; | |
555 | |
556 ImportDeclaration(VariableProxy* proxy, | 547 ImportDeclaration(VariableProxy* proxy, |
557 Module* module, | 548 Module* module, |
558 Scope* scope) | 549 Scope* scope) |
559 : Declaration(proxy, LET, scope), | 550 : Declaration(proxy, LET, scope), |
560 module_(module) { | 551 module_(module) { |
561 } | 552 } |
562 | 553 |
563 private: | 554 private: |
564 Module* module_; | 555 Module* module_; |
565 }; | 556 }; |
566 | 557 |
567 | 558 |
568 class ExportDeclaration: public Declaration { | 559 class ExportDeclaration: public Declaration { |
569 public: | 560 public: |
570 DECLARE_NODE_TYPE(ExportDeclaration) | 561 DECLARE_NODE_TYPE(ExportDeclaration) |
571 | 562 |
572 virtual InitializationFlag initialization() const { | 563 virtual InitializationFlag initialization() const { |
573 return kCreatedInitialized; | 564 return kCreatedInitialized; |
574 } | 565 } |
575 | 566 |
576 protected: | 567 protected: |
577 template<class> friend class AstNodeFactory; | |
578 | |
579 ExportDeclaration(VariableProxy* proxy, Scope* scope) | 568 ExportDeclaration(VariableProxy* proxy, Scope* scope) |
580 : Declaration(proxy, LET, scope) {} | 569 : Declaration(proxy, LET, scope) {} |
581 }; | 570 }; |
582 | 571 |
583 | 572 |
584 class Module: public AstNode { | 573 class Module: public AstNode { |
585 public: | 574 public: |
586 Interface* interface() const { return interface_; } | 575 Interface* interface() const { return interface_; } |
587 Block* body() const { return body_; } | 576 Block* body() const { return body_; } |
588 | 577 |
589 protected: | 578 protected: |
590 explicit Module(Zone* zone) | 579 explicit Module(Zone* zone) |
591 : interface_(Interface::NewModule(zone)), | 580 : interface_(Interface::NewModule(zone)), |
592 body_(NULL) {} | 581 body_(NULL) {} |
593 explicit Module(Interface* interface, Block* body = NULL) | 582 explicit Module(Interface* interface, Block* body = NULL) |
594 : interface_(interface), | 583 : interface_(interface), |
595 body_(body) {} | 584 body_(body) {} |
596 | 585 |
597 private: | 586 private: |
598 Interface* interface_; | 587 Interface* interface_; |
599 Block* body_; | 588 Block* body_; |
600 }; | 589 }; |
601 | 590 |
602 | 591 |
603 class ModuleLiteral: public Module { | 592 class ModuleLiteral: public Module { |
604 public: | 593 public: |
605 DECLARE_NODE_TYPE(ModuleLiteral) | 594 DECLARE_NODE_TYPE(ModuleLiteral) |
606 | 595 |
607 protected: | 596 protected: |
608 template<class> friend class AstNodeFactory; | |
609 | |
610 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} | 597 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} |
611 }; | 598 }; |
612 | 599 |
613 | 600 |
614 class ModuleVariable: public Module { | 601 class ModuleVariable: public Module { |
615 public: | 602 public: |
616 DECLARE_NODE_TYPE(ModuleVariable) | 603 DECLARE_NODE_TYPE(ModuleVariable) |
617 | 604 |
618 VariableProxy* proxy() const { return proxy_; } | 605 VariableProxy* proxy() const { return proxy_; } |
619 | 606 |
620 protected: | 607 protected: |
621 template<class> friend class AstNodeFactory; | |
622 | |
623 inline explicit ModuleVariable(VariableProxy* proxy); | 608 inline explicit ModuleVariable(VariableProxy* proxy); |
624 | 609 |
625 private: | 610 private: |
626 VariableProxy* proxy_; | 611 VariableProxy* proxy_; |
627 }; | 612 }; |
628 | 613 |
629 | 614 |
630 class ModulePath: public Module { | 615 class ModulePath: public Module { |
631 public: | 616 public: |
632 DECLARE_NODE_TYPE(ModulePath) | 617 DECLARE_NODE_TYPE(ModulePath) |
633 | 618 |
634 Module* module() const { return module_; } | 619 Module* module() const { return module_; } |
635 Handle<String> name() const { return name_; } | 620 Handle<String> name() const { return name_; } |
636 | 621 |
637 protected: | 622 protected: |
638 template<class> friend class AstNodeFactory; | |
639 | |
640 ModulePath(Module* module, Handle<String> name, Zone* zone) | 623 ModulePath(Module* module, Handle<String> name, Zone* zone) |
641 : Module(zone), | 624 : Module(zone), |
642 module_(module), | 625 module_(module), |
643 name_(name) { | 626 name_(name) { |
644 } | 627 } |
645 | 628 |
646 private: | 629 private: |
647 Module* module_; | 630 Module* module_; |
648 Handle<String> name_; | 631 Handle<String> name_; |
649 }; | 632 }; |
650 | 633 |
651 | 634 |
652 class ModuleUrl: public Module { | 635 class ModuleUrl: public Module { |
653 public: | 636 public: |
654 DECLARE_NODE_TYPE(ModuleUrl) | 637 DECLARE_NODE_TYPE(ModuleUrl) |
655 | 638 |
656 Handle<String> url() const { return url_; } | 639 Handle<String> url() const { return url_; } |
657 | 640 |
658 protected: | 641 protected: |
659 template<class> friend class AstNodeFactory; | |
660 | |
661 ModuleUrl(Handle<String> url, Zone* zone) | 642 ModuleUrl(Handle<String> url, Zone* zone) |
662 : Module(zone), url_(url) { | 643 : Module(zone), url_(url) { |
663 } | 644 } |
664 | 645 |
665 private: | 646 private: |
666 Handle<String> url_; | 647 Handle<String> url_; |
667 }; | 648 }; |
668 | 649 |
669 | 650 |
670 class IterationStatement: public BreakableStatement { | 651 class IterationStatement: public BreakableStatement { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 // Position where condition expression starts. We need it to make | 694 // Position where condition expression starts. We need it to make |
714 // the loop's condition a breakable location. | 695 // the loop's condition a breakable location. |
715 int condition_position() { return condition_position_; } | 696 int condition_position() { return condition_position_; } |
716 void set_condition_position(int pos) { condition_position_ = pos; } | 697 void set_condition_position(int pos) { condition_position_ = pos; } |
717 | 698 |
718 virtual BailoutId ContinueId() const { return continue_id_; } | 699 virtual BailoutId ContinueId() const { return continue_id_; } |
719 virtual BailoutId StackCheckId() const { return back_edge_id_; } | 700 virtual BailoutId StackCheckId() const { return back_edge_id_; } |
720 BailoutId BackEdgeId() const { return back_edge_id_; } | 701 BailoutId BackEdgeId() const { return back_edge_id_; } |
721 | 702 |
722 protected: | 703 protected: |
723 template<class> friend class AstNodeFactory; | |
724 | |
725 DoWhileStatement(Isolate* isolate, ZoneStringList* labels) | 704 DoWhileStatement(Isolate* isolate, ZoneStringList* labels) |
726 : IterationStatement(isolate, labels), | 705 : IterationStatement(isolate, labels), |
727 cond_(NULL), | 706 cond_(NULL), |
728 condition_position_(-1), | 707 condition_position_(-1), |
729 continue_id_(GetNextId(isolate)), | 708 continue_id_(GetNextId(isolate)), |
730 back_edge_id_(GetNextId(isolate)) { | 709 back_edge_id_(GetNextId(isolate)) { |
731 } | 710 } |
732 | 711 |
733 private: | 712 private: |
734 Expression* cond_; | 713 Expression* cond_; |
(...skipping 18 matching lines...) Expand all Loading... |
753 } | 732 } |
754 void set_may_have_function_literal(bool value) { | 733 void set_may_have_function_literal(bool value) { |
755 may_have_function_literal_ = value; | 734 may_have_function_literal_ = value; |
756 } | 735 } |
757 | 736 |
758 virtual BailoutId ContinueId() const { return EntryId(); } | 737 virtual BailoutId ContinueId() const { return EntryId(); } |
759 virtual BailoutId StackCheckId() const { return body_id_; } | 738 virtual BailoutId StackCheckId() const { return body_id_; } |
760 BailoutId BodyId() const { return body_id_; } | 739 BailoutId BodyId() const { return body_id_; } |
761 | 740 |
762 protected: | 741 protected: |
763 template<class> friend class AstNodeFactory; | |
764 | |
765 WhileStatement(Isolate* isolate, ZoneStringList* labels) | 742 WhileStatement(Isolate* isolate, ZoneStringList* labels) |
766 : IterationStatement(isolate, labels), | 743 : IterationStatement(isolate, labels), |
767 cond_(NULL), | 744 cond_(NULL), |
768 may_have_function_literal_(true), | 745 may_have_function_literal_(true), |
769 body_id_(GetNextId(isolate)) { | 746 body_id_(GetNextId(isolate)) { |
770 } | 747 } |
771 | 748 |
772 private: | 749 private: |
773 Expression* cond_; | 750 Expression* cond_; |
774 // True if there is a function literal subexpression in the condition. | 751 // True if there is a function literal subexpression in the condition. |
(...skipping 29 matching lines...) Expand all Loading... |
804 | 781 |
805 virtual BailoutId ContinueId() const { return continue_id_; } | 782 virtual BailoutId ContinueId() const { return continue_id_; } |
806 virtual BailoutId StackCheckId() const { return body_id_; } | 783 virtual BailoutId StackCheckId() const { return body_id_; } |
807 BailoutId BodyId() const { return body_id_; } | 784 BailoutId BodyId() const { return body_id_; } |
808 | 785 |
809 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 786 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
810 Variable* loop_variable() { return loop_variable_; } | 787 Variable* loop_variable() { return loop_variable_; } |
811 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 788 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
812 | 789 |
813 protected: | 790 protected: |
814 template<class> friend class AstNodeFactory; | |
815 | |
816 ForStatement(Isolate* isolate, ZoneStringList* labels) | 791 ForStatement(Isolate* isolate, ZoneStringList* labels) |
817 : IterationStatement(isolate, labels), | 792 : IterationStatement(isolate, labels), |
818 init_(NULL), | 793 init_(NULL), |
819 cond_(NULL), | 794 cond_(NULL), |
820 next_(NULL), | 795 next_(NULL), |
821 may_have_function_literal_(true), | 796 may_have_function_literal_(true), |
822 loop_variable_(NULL), | 797 loop_variable_(NULL), |
823 continue_id_(GetNextId(isolate)), | 798 continue_id_(GetNextId(isolate)), |
824 body_id_(GetNextId(isolate)) { | 799 body_id_(GetNextId(isolate)) { |
825 } | 800 } |
(...skipping 24 matching lines...) Expand all Loading... |
850 Expression* enumerable() const { return enumerable_; } | 825 Expression* enumerable() const { return enumerable_; } |
851 | 826 |
852 virtual BailoutId ContinueId() const { return EntryId(); } | 827 virtual BailoutId ContinueId() const { return EntryId(); } |
853 virtual BailoutId StackCheckId() const { return body_id_; } | 828 virtual BailoutId StackCheckId() const { return body_id_; } |
854 BailoutId BodyId() const { return body_id_; } | 829 BailoutId BodyId() const { return body_id_; } |
855 BailoutId PrepareId() const { return prepare_id_; } | 830 BailoutId PrepareId() const { return prepare_id_; } |
856 | 831 |
857 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } | 832 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } |
858 | 833 |
859 protected: | 834 protected: |
860 template<class> friend class AstNodeFactory; | |
861 | |
862 ForInStatement(Isolate* isolate, ZoneStringList* labels) | 835 ForInStatement(Isolate* isolate, ZoneStringList* labels) |
863 : IterationStatement(isolate, labels), | 836 : IterationStatement(isolate, labels), |
864 each_(NULL), | 837 each_(NULL), |
865 enumerable_(NULL), | 838 enumerable_(NULL), |
866 body_id_(GetNextId(isolate)), | 839 body_id_(GetNextId(isolate)), |
867 prepare_id_(GetNextId(isolate)) { | 840 prepare_id_(GetNextId(isolate)) { |
868 } | 841 } |
869 | 842 |
870 private: | 843 private: |
871 Expression* each_; | 844 Expression* each_; |
872 Expression* enumerable_; | 845 Expression* enumerable_; |
873 const BailoutId body_id_; | 846 const BailoutId body_id_; |
874 const BailoutId prepare_id_; | 847 const BailoutId prepare_id_; |
875 }; | 848 }; |
876 | 849 |
877 | 850 |
878 class ExpressionStatement: public Statement { | 851 class ExpressionStatement: public Statement { |
879 public: | 852 public: |
880 DECLARE_NODE_TYPE(ExpressionStatement) | 853 DECLARE_NODE_TYPE(ExpressionStatement) |
881 | 854 |
882 void set_expression(Expression* e) { expression_ = e; } | 855 void set_expression(Expression* e) { expression_ = e; } |
883 Expression* expression() const { return expression_; } | 856 Expression* expression() const { return expression_; } |
884 | 857 |
885 protected: | 858 protected: |
886 template<class> friend class AstNodeFactory; | |
887 | |
888 explicit ExpressionStatement(Expression* expression) | 859 explicit ExpressionStatement(Expression* expression) |
889 : expression_(expression) { } | 860 : expression_(expression) { } |
890 | 861 |
891 private: | 862 private: |
892 Expression* expression_; | 863 Expression* expression_; |
893 }; | 864 }; |
894 | 865 |
895 | 866 |
896 class ContinueStatement: public Statement { | 867 class ContinueStatement: public Statement { |
897 public: | 868 public: |
898 DECLARE_NODE_TYPE(ContinueStatement) | 869 DECLARE_NODE_TYPE(ContinueStatement) |
899 | 870 |
900 IterationStatement* target() const { return target_; } | 871 IterationStatement* target() const { return target_; } |
901 | 872 |
902 protected: | 873 protected: |
903 template<class> friend class AstNodeFactory; | |
904 | |
905 explicit ContinueStatement(IterationStatement* target) | 874 explicit ContinueStatement(IterationStatement* target) |
906 : target_(target) { } | 875 : target_(target) { } |
907 | 876 |
908 private: | 877 private: |
909 IterationStatement* target_; | 878 IterationStatement* target_; |
910 }; | 879 }; |
911 | 880 |
912 | 881 |
913 class BreakStatement: public Statement { | 882 class BreakStatement: public Statement { |
914 public: | 883 public: |
915 DECLARE_NODE_TYPE(BreakStatement) | 884 DECLARE_NODE_TYPE(BreakStatement) |
916 | 885 |
917 BreakableStatement* target() const { return target_; } | 886 BreakableStatement* target() const { return target_; } |
918 | 887 |
919 protected: | 888 protected: |
920 template<class> friend class AstNodeFactory; | |
921 | |
922 explicit BreakStatement(BreakableStatement* target) | 889 explicit BreakStatement(BreakableStatement* target) |
923 : target_(target) { } | 890 : target_(target) { } |
924 | 891 |
925 private: | 892 private: |
926 BreakableStatement* target_; | 893 BreakableStatement* target_; |
927 }; | 894 }; |
928 | 895 |
929 | 896 |
930 class ReturnStatement: public Statement { | 897 class ReturnStatement: public Statement { |
931 public: | 898 public: |
932 DECLARE_NODE_TYPE(ReturnStatement) | 899 DECLARE_NODE_TYPE(ReturnStatement) |
933 | 900 |
934 Expression* expression() const { return expression_; } | 901 Expression* expression() const { return expression_; } |
935 | 902 |
936 protected: | 903 protected: |
937 template<class> friend class AstNodeFactory; | |
938 | |
939 explicit ReturnStatement(Expression* expression) | 904 explicit ReturnStatement(Expression* expression) |
940 : expression_(expression) { } | 905 : expression_(expression) { } |
941 | 906 |
942 private: | 907 private: |
943 Expression* expression_; | 908 Expression* expression_; |
944 }; | 909 }; |
945 | 910 |
946 | 911 |
947 class WithStatement: public Statement { | 912 class WithStatement: public Statement { |
948 public: | 913 public: |
949 DECLARE_NODE_TYPE(WithStatement) | 914 DECLARE_NODE_TYPE(WithStatement) |
950 | 915 |
951 Expression* expression() const { return expression_; } | 916 Expression* expression() const { return expression_; } |
952 Statement* statement() const { return statement_; } | 917 Statement* statement() const { return statement_; } |
953 | 918 |
954 protected: | 919 protected: |
955 template<class> friend class AstNodeFactory; | |
956 | |
957 WithStatement(Expression* expression, Statement* statement) | 920 WithStatement(Expression* expression, Statement* statement) |
958 : expression_(expression), | 921 : expression_(expression), |
959 statement_(statement) { } | 922 statement_(statement) { } |
960 | 923 |
961 private: | 924 private: |
962 Expression* expression_; | 925 Expression* expression_; |
963 Statement* statement_; | 926 Statement* statement_; |
964 }; | 927 }; |
965 | 928 |
966 | 929 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 | 979 |
1017 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 980 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
1018 tag_ = tag; | 981 tag_ = tag; |
1019 cases_ = cases; | 982 cases_ = cases; |
1020 } | 983 } |
1021 | 984 |
1022 Expression* tag() const { return tag_; } | 985 Expression* tag() const { return tag_; } |
1023 ZoneList<CaseClause*>* cases() const { return cases_; } | 986 ZoneList<CaseClause*>* cases() const { return cases_; } |
1024 | 987 |
1025 protected: | 988 protected: |
1026 template<class> friend class AstNodeFactory; | |
1027 | |
1028 SwitchStatement(Isolate* isolate, ZoneStringList* labels) | 989 SwitchStatement(Isolate* isolate, ZoneStringList* labels) |
1029 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), | 990 : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS), |
1030 tag_(NULL), | 991 tag_(NULL), |
1031 cases_(NULL) { } | 992 cases_(NULL) { } |
1032 | 993 |
1033 private: | 994 private: |
1034 Expression* tag_; | 995 Expression* tag_; |
1035 ZoneList<CaseClause*>* cases_; | 996 ZoneList<CaseClause*>* cases_; |
1036 }; | 997 }; |
1037 | 998 |
(...skipping 12 matching lines...) Expand all Loading... |
1050 | 1011 |
1051 Expression* condition() const { return condition_; } | 1012 Expression* condition() const { return condition_; } |
1052 Statement* then_statement() const { return then_statement_; } | 1013 Statement* then_statement() const { return then_statement_; } |
1053 Statement* else_statement() const { return else_statement_; } | 1014 Statement* else_statement() const { return else_statement_; } |
1054 | 1015 |
1055 BailoutId IfId() const { return if_id_; } | 1016 BailoutId IfId() const { return if_id_; } |
1056 BailoutId ThenId() const { return then_id_; } | 1017 BailoutId ThenId() const { return then_id_; } |
1057 BailoutId ElseId() const { return else_id_; } | 1018 BailoutId ElseId() const { return else_id_; } |
1058 | 1019 |
1059 protected: | 1020 protected: |
1060 template<class> friend class AstNodeFactory; | |
1061 | |
1062 IfStatement(Isolate* isolate, | 1021 IfStatement(Isolate* isolate, |
1063 Expression* condition, | 1022 Expression* condition, |
1064 Statement* then_statement, | 1023 Statement* then_statement, |
1065 Statement* else_statement) | 1024 Statement* else_statement) |
1066 : condition_(condition), | 1025 : condition_(condition), |
1067 then_statement_(then_statement), | 1026 then_statement_(then_statement), |
1068 else_statement_(else_statement), | 1027 else_statement_(else_statement), |
1069 if_id_(GetNextId(isolate)), | 1028 if_id_(GetNextId(isolate)), |
1070 then_id_(GetNextId(isolate)), | 1029 then_id_(GetNextId(isolate)), |
1071 else_id_(GetNextId(isolate)) { | 1030 else_id_(GetNextId(isolate)) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 | 1090 |
1132 class TryCatchStatement: public TryStatement { | 1091 class TryCatchStatement: public TryStatement { |
1133 public: | 1092 public: |
1134 DECLARE_NODE_TYPE(TryCatchStatement) | 1093 DECLARE_NODE_TYPE(TryCatchStatement) |
1135 | 1094 |
1136 Scope* scope() { return scope_; } | 1095 Scope* scope() { return scope_; } |
1137 Variable* variable() { return variable_; } | 1096 Variable* variable() { return variable_; } |
1138 Block* catch_block() const { return catch_block_; } | 1097 Block* catch_block() const { return catch_block_; } |
1139 | 1098 |
1140 protected: | 1099 protected: |
1141 template<class> friend class AstNodeFactory; | |
1142 | |
1143 TryCatchStatement(int index, | 1100 TryCatchStatement(int index, |
1144 Block* try_block, | 1101 Block* try_block, |
1145 Scope* scope, | 1102 Scope* scope, |
1146 Variable* variable, | 1103 Variable* variable, |
1147 Block* catch_block) | 1104 Block* catch_block) |
1148 : TryStatement(index, try_block), | 1105 : TryStatement(index, try_block), |
1149 scope_(scope), | 1106 scope_(scope), |
1150 variable_(variable), | 1107 variable_(variable), |
1151 catch_block_(catch_block) { | 1108 catch_block_(catch_block) { |
1152 } | 1109 } |
1153 | 1110 |
1154 private: | 1111 private: |
1155 Scope* scope_; | 1112 Scope* scope_; |
1156 Variable* variable_; | 1113 Variable* variable_; |
1157 Block* catch_block_; | 1114 Block* catch_block_; |
1158 }; | 1115 }; |
1159 | 1116 |
1160 | 1117 |
1161 class TryFinallyStatement: public TryStatement { | 1118 class TryFinallyStatement: public TryStatement { |
1162 public: | 1119 public: |
1163 DECLARE_NODE_TYPE(TryFinallyStatement) | 1120 DECLARE_NODE_TYPE(TryFinallyStatement) |
1164 | 1121 |
1165 Block* finally_block() const { return finally_block_; } | 1122 Block* finally_block() const { return finally_block_; } |
1166 | 1123 |
1167 protected: | 1124 protected: |
1168 template<class> friend class AstNodeFactory; | |
1169 | |
1170 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 1125 TryFinallyStatement(int index, Block* try_block, Block* finally_block) |
1171 : TryStatement(index, try_block), | 1126 : TryStatement(index, try_block), |
1172 finally_block_(finally_block) { } | 1127 finally_block_(finally_block) { } |
1173 | 1128 |
1174 private: | 1129 private: |
1175 Block* finally_block_; | 1130 Block* finally_block_; |
1176 }; | 1131 }; |
1177 | 1132 |
1178 | 1133 |
1179 class DebuggerStatement: public Statement { | 1134 class DebuggerStatement: public Statement { |
1180 public: | 1135 public: |
1181 DECLARE_NODE_TYPE(DebuggerStatement) | 1136 DECLARE_NODE_TYPE(DebuggerStatement) |
1182 | 1137 |
1183 protected: | 1138 protected: |
1184 template<class> friend class AstNodeFactory; | |
1185 | |
1186 DebuggerStatement() {} | 1139 DebuggerStatement() {} |
1187 }; | 1140 }; |
1188 | 1141 |
1189 | 1142 |
1190 class EmptyStatement: public Statement { | 1143 class EmptyStatement: public Statement { |
1191 public: | 1144 public: |
1192 DECLARE_NODE_TYPE(EmptyStatement) | 1145 DECLARE_NODE_TYPE(EmptyStatement) |
1193 | 1146 |
1194 protected: | 1147 protected: |
1195 template<class> friend class AstNodeFactory; | |
1196 | |
1197 EmptyStatement() {} | 1148 EmptyStatement() {} |
1198 }; | 1149 }; |
1199 | 1150 |
1200 | 1151 |
1201 class Literal: public Expression { | 1152 class Literal: public Expression { |
1202 public: | 1153 public: |
1203 DECLARE_NODE_TYPE(Literal) | 1154 DECLARE_NODE_TYPE(Literal) |
1204 | 1155 |
1205 virtual bool IsPropertyName() { | 1156 virtual bool IsPropertyName() { |
1206 if (handle_->IsSymbol()) { | 1157 if (handle_->IsSymbol()) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 | 1191 |
1241 static bool Match(void* literal1, void* literal2) { | 1192 static bool Match(void* literal1, void* literal2) { |
1242 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); | 1193 Handle<String> s1 = static_cast<Literal*>(literal1)->ToString(); |
1243 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); | 1194 Handle<String> s2 = static_cast<Literal*>(literal2)->ToString(); |
1244 return s1->Equals(*s2); | 1195 return s1->Equals(*s2); |
1245 } | 1196 } |
1246 | 1197 |
1247 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } | 1198 TypeFeedbackId LiteralFeedbackId() const { return reuse(id()); } |
1248 | 1199 |
1249 protected: | 1200 protected: |
1250 template<class> friend class AstNodeFactory; | |
1251 | |
1252 Literal(Isolate* isolate, Handle<Object> handle) | 1201 Literal(Isolate* isolate, Handle<Object> handle) |
1253 : Expression(isolate), | 1202 : Expression(isolate), |
1254 handle_(handle) { } | 1203 handle_(handle) { } |
1255 | 1204 |
1256 private: | 1205 private: |
1257 Handle<String> ToString(); | 1206 Handle<String> ToString(); |
1258 | 1207 |
1259 Handle<Object> handle_; | 1208 Handle<Object> handle_; |
1260 }; | 1209 }; |
1261 | 1210 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 kHasFunction = 1 << 1 | 1308 kHasFunction = 1 << 1 |
1360 }; | 1309 }; |
1361 | 1310 |
1362 struct Accessors: public ZoneObject { | 1311 struct Accessors: public ZoneObject { |
1363 Accessors() : getter(NULL), setter(NULL) { } | 1312 Accessors() : getter(NULL), setter(NULL) { } |
1364 Expression* getter; | 1313 Expression* getter; |
1365 Expression* setter; | 1314 Expression* setter; |
1366 }; | 1315 }; |
1367 | 1316 |
1368 protected: | 1317 protected: |
1369 template<class> friend class AstNodeFactory; | |
1370 | |
1371 ObjectLiteral(Isolate* isolate, | 1318 ObjectLiteral(Isolate* isolate, |
1372 Handle<FixedArray> constant_properties, | 1319 Handle<FixedArray> constant_properties, |
1373 ZoneList<Property*>* properties, | 1320 ZoneList<Property*>* properties, |
1374 int literal_index, | 1321 int literal_index, |
1375 bool is_simple, | 1322 bool is_simple, |
1376 bool fast_elements, | 1323 bool fast_elements, |
1377 int depth, | 1324 int depth, |
1378 bool has_function) | 1325 bool has_function) |
1379 : MaterializedLiteral(isolate, literal_index, is_simple, depth), | 1326 : MaterializedLiteral(isolate, literal_index, is_simple, depth), |
1380 constant_properties_(constant_properties), | 1327 constant_properties_(constant_properties), |
(...skipping 11 matching lines...) Expand all Loading... |
1392 | 1339 |
1393 // Node for capturing a regexp literal. | 1340 // Node for capturing a regexp literal. |
1394 class RegExpLiteral: public MaterializedLiteral { | 1341 class RegExpLiteral: public MaterializedLiteral { |
1395 public: | 1342 public: |
1396 DECLARE_NODE_TYPE(RegExpLiteral) | 1343 DECLARE_NODE_TYPE(RegExpLiteral) |
1397 | 1344 |
1398 Handle<String> pattern() const { return pattern_; } | 1345 Handle<String> pattern() const { return pattern_; } |
1399 Handle<String> flags() const { return flags_; } | 1346 Handle<String> flags() const { return flags_; } |
1400 | 1347 |
1401 protected: | 1348 protected: |
1402 template<class> friend class AstNodeFactory; | |
1403 | |
1404 RegExpLiteral(Isolate* isolate, | 1349 RegExpLiteral(Isolate* isolate, |
1405 Handle<String> pattern, | 1350 Handle<String> pattern, |
1406 Handle<String> flags, | 1351 Handle<String> flags, |
1407 int literal_index) | 1352 int literal_index) |
1408 : MaterializedLiteral(isolate, literal_index, false, 1), | 1353 : MaterializedLiteral(isolate, literal_index, false, 1), |
1409 pattern_(pattern), | 1354 pattern_(pattern), |
1410 flags_(flags) {} | 1355 flags_(flags) {} |
1411 | 1356 |
1412 private: | 1357 private: |
1413 Handle<String> pattern_; | 1358 Handle<String> pattern_; |
1414 Handle<String> flags_; | 1359 Handle<String> flags_; |
1415 }; | 1360 }; |
1416 | 1361 |
1417 // An array literal has a literals object that is used | 1362 // An array literal has a literals object that is used |
1418 // for minimizing the work when constructing it at runtime. | 1363 // for minimizing the work when constructing it at runtime. |
1419 class ArrayLiteral: public MaterializedLiteral { | 1364 class ArrayLiteral: public MaterializedLiteral { |
1420 public: | 1365 public: |
1421 DECLARE_NODE_TYPE(ArrayLiteral) | 1366 DECLARE_NODE_TYPE(ArrayLiteral) |
1422 | 1367 |
1423 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1368 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
1424 ZoneList<Expression*>* values() const { return values_; } | 1369 ZoneList<Expression*>* values() const { return values_; } |
1425 | 1370 |
1426 // Return an AST id for an element that is used in simulate instructions. | 1371 // Return an AST id for an element that is used in simulate instructions. |
1427 BailoutId GetIdForElement(int i) { | 1372 BailoutId GetIdForElement(int i) { |
1428 return BailoutId(first_element_id_.ToInt() + i); | 1373 return BailoutId(first_element_id_.ToInt() + i); |
1429 } | 1374 } |
1430 | 1375 |
1431 protected: | 1376 protected: |
1432 template<class> friend class AstNodeFactory; | |
1433 | |
1434 ArrayLiteral(Isolate* isolate, | 1377 ArrayLiteral(Isolate* isolate, |
1435 Handle<FixedArray> constant_elements, | 1378 Handle<FixedArray> constant_elements, |
1436 ZoneList<Expression*>* values, | 1379 ZoneList<Expression*>* values, |
1437 int literal_index, | 1380 int literal_index, |
1438 bool is_simple, | 1381 bool is_simple, |
1439 int depth) | 1382 int depth) |
1440 : MaterializedLiteral(isolate, literal_index, is_simple, depth), | 1383 : MaterializedLiteral(isolate, literal_index, is_simple, depth), |
1441 constant_elements_(constant_elements), | 1384 constant_elements_(constant_elements), |
1442 values_(values), | 1385 values_(values), |
1443 first_element_id_(ReserveIdRange(isolate, values->length())) {} | 1386 first_element_id_(ReserveIdRange(isolate, values->length())) {} |
(...skipping 30 matching lines...) Expand all Loading... |
1474 Interface* interface() const { return interface_; } | 1417 Interface* interface() const { return interface_; } |
1475 | 1418 |
1476 | 1419 |
1477 void MarkAsTrivial() { is_trivial_ = true; } | 1420 void MarkAsTrivial() { is_trivial_ = true; } |
1478 void MarkAsLValue() { is_lvalue_ = true; } | 1421 void MarkAsLValue() { is_lvalue_ = true; } |
1479 | 1422 |
1480 // Bind this proxy to the variable var. | 1423 // Bind this proxy to the variable var. |
1481 void BindTo(Variable* var); | 1424 void BindTo(Variable* var); |
1482 | 1425 |
1483 protected: | 1426 protected: |
1484 template<class> friend class AstNodeFactory; | |
1485 | |
1486 VariableProxy(Isolate* isolate, Variable* var); | 1427 VariableProxy(Isolate* isolate, Variable* var); |
1487 | 1428 |
1488 VariableProxy(Isolate* isolate, | 1429 VariableProxy(Isolate* isolate, |
1489 Handle<String> name, | 1430 Handle<String> name, |
1490 bool is_this, | 1431 bool is_this, |
1491 Interface* interface, | 1432 Interface* interface, |
1492 int position); | 1433 int position); |
1493 | 1434 |
1494 Handle<String> name_; | 1435 Handle<String> name_; |
1495 Variable* var_; // resolved variable, or NULL | 1436 Variable* var_; // resolved variable, or NULL |
(...skipping 25 matching lines...) Expand all Loading... |
1521 | 1462 |
1522 // Type feedback information. | 1463 // Type feedback information. |
1523 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1464 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
1524 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1465 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1525 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1466 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1526 bool IsArrayLength() { return is_array_length_; } | 1467 bool IsArrayLength() { return is_array_length_; } |
1527 bool IsUninitialized() { return is_uninitialized_; } | 1468 bool IsUninitialized() { return is_uninitialized_; } |
1528 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1469 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
1529 | 1470 |
1530 protected: | 1471 protected: |
1531 template<class> friend class AstNodeFactory; | |
1532 | |
1533 Property(Isolate* isolate, | 1472 Property(Isolate* isolate, |
1534 Expression* obj, | 1473 Expression* obj, |
1535 Expression* key, | 1474 Expression* key, |
1536 int pos) | 1475 int pos) |
1537 : Expression(isolate), | 1476 : Expression(isolate), |
1538 obj_(obj), | 1477 obj_(obj), |
1539 key_(key), | 1478 key_(key), |
1540 pos_(pos), | 1479 pos_(pos), |
1541 load_id_(GetNextId(isolate)), | 1480 load_id_(GetNextId(isolate)), |
1542 is_monomorphic_(false), | 1481 is_monomorphic_(false), |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); | 1528 bool ComputeGlobalTarget(Handle<GlobalObject> global, LookupResult* lookup); |
1590 | 1529 |
1591 BailoutId ReturnId() const { return return_id_; } | 1530 BailoutId ReturnId() const { return return_id_; } |
1592 | 1531 |
1593 #ifdef DEBUG | 1532 #ifdef DEBUG |
1594 // Used to assert that the FullCodeGenerator records the return site. | 1533 // Used to assert that the FullCodeGenerator records the return site. |
1595 bool return_is_recorded_; | 1534 bool return_is_recorded_; |
1596 #endif | 1535 #endif |
1597 | 1536 |
1598 protected: | 1537 protected: |
1599 template<class> friend class AstNodeFactory; | |
1600 | |
1601 Call(Isolate* isolate, | 1538 Call(Isolate* isolate, |
1602 Expression* expression, | 1539 Expression* expression, |
1603 ZoneList<Expression*>* arguments, | 1540 ZoneList<Expression*>* arguments, |
1604 int pos) | 1541 int pos) |
1605 : Expression(isolate), | 1542 : Expression(isolate), |
1606 expression_(expression), | 1543 expression_(expression), |
1607 arguments_(arguments), | 1544 arguments_(arguments), |
1608 pos_(pos), | 1545 pos_(pos), |
1609 is_monomorphic_(false), | 1546 is_monomorphic_(false), |
1610 check_type_(RECEIVER_MAP_CHECK), | 1547 check_type_(RECEIVER_MAP_CHECK), |
(...skipping 25 matching lines...) Expand all Loading... |
1636 | 1573 |
1637 // Type feedback information. | 1574 // Type feedback information. |
1638 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } | 1575 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } |
1639 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1576 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1640 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1577 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1641 Handle<JSFunction> target() { return target_; } | 1578 Handle<JSFunction> target() { return target_; } |
1642 | 1579 |
1643 BailoutId ReturnId() const { return return_id_; } | 1580 BailoutId ReturnId() const { return return_id_; } |
1644 | 1581 |
1645 protected: | 1582 protected: |
1646 template<class> friend class AstNodeFactory; | |
1647 | |
1648 CallNew(Isolate* isolate, | 1583 CallNew(Isolate* isolate, |
1649 Expression* expression, | 1584 Expression* expression, |
1650 ZoneList<Expression*>* arguments, | 1585 ZoneList<Expression*>* arguments, |
1651 int pos) | 1586 int pos) |
1652 : Expression(isolate), | 1587 : Expression(isolate), |
1653 expression_(expression), | 1588 expression_(expression), |
1654 arguments_(arguments), | 1589 arguments_(arguments), |
1655 pos_(pos), | 1590 pos_(pos), |
1656 is_monomorphic_(false), | 1591 is_monomorphic_(false), |
1657 return_id_(GetNextId(isolate)) { } | 1592 return_id_(GetNextId(isolate)) { } |
(...skipping 19 matching lines...) Expand all Loading... |
1677 DECLARE_NODE_TYPE(CallRuntime) | 1612 DECLARE_NODE_TYPE(CallRuntime) |
1678 | 1613 |
1679 Handle<String> name() const { return name_; } | 1614 Handle<String> name() const { return name_; } |
1680 const Runtime::Function* function() const { return function_; } | 1615 const Runtime::Function* function() const { return function_; } |
1681 ZoneList<Expression*>* arguments() const { return arguments_; } | 1616 ZoneList<Expression*>* arguments() const { return arguments_; } |
1682 bool is_jsruntime() const { return function_ == NULL; } | 1617 bool is_jsruntime() const { return function_ == NULL; } |
1683 | 1618 |
1684 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1619 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
1685 | 1620 |
1686 protected: | 1621 protected: |
1687 template<class> friend class AstNodeFactory; | |
1688 | |
1689 CallRuntime(Isolate* isolate, | 1622 CallRuntime(Isolate* isolate, |
1690 Handle<String> name, | 1623 Handle<String> name, |
1691 const Runtime::Function* function, | 1624 const Runtime::Function* function, |
1692 ZoneList<Expression*>* arguments) | 1625 ZoneList<Expression*>* arguments) |
1693 : Expression(isolate), | 1626 : Expression(isolate), |
1694 name_(name), | 1627 name_(name), |
1695 function_(function), | 1628 function_(function), |
1696 arguments_(arguments) { } | 1629 arguments_(arguments) { } |
1697 | 1630 |
1698 private: | 1631 private: |
(...skipping 12 matching lines...) Expand all Loading... |
1711 Token::Value op() const { return op_; } | 1644 Token::Value op() const { return op_; } |
1712 Expression* expression() const { return expression_; } | 1645 Expression* expression() const { return expression_; } |
1713 virtual int position() const { return pos_; } | 1646 virtual int position() const { return pos_; } |
1714 | 1647 |
1715 BailoutId MaterializeTrueId() { return materialize_true_id_; } | 1648 BailoutId MaterializeTrueId() { return materialize_true_id_; } |
1716 BailoutId MaterializeFalseId() { return materialize_false_id_; } | 1649 BailoutId MaterializeFalseId() { return materialize_false_id_; } |
1717 | 1650 |
1718 TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); } | 1651 TypeFeedbackId UnaryOperationFeedbackId() const { return reuse(id()); } |
1719 | 1652 |
1720 protected: | 1653 protected: |
1721 template<class> friend class AstNodeFactory; | |
1722 | |
1723 UnaryOperation(Isolate* isolate, | 1654 UnaryOperation(Isolate* isolate, |
1724 Token::Value op, | 1655 Token::Value op, |
1725 Expression* expression, | 1656 Expression* expression, |
1726 int pos) | 1657 int pos) |
1727 : Expression(isolate), | 1658 : Expression(isolate), |
1728 op_(op), | 1659 op_(op), |
1729 expression_(expression), | 1660 expression_(expression), |
1730 pos_(pos), | 1661 pos_(pos), |
1731 materialize_true_id_(GetNextId(isolate)), | 1662 materialize_true_id_(GetNextId(isolate)), |
1732 materialize_false_id_(GetNextId(isolate)) { | 1663 materialize_false_id_(GetNextId(isolate)) { |
(...skipping 21 matching lines...) Expand all Loading... |
1754 Token::Value op() const { return op_; } | 1685 Token::Value op() const { return op_; } |
1755 Expression* left() const { return left_; } | 1686 Expression* left() const { return left_; } |
1756 Expression* right() const { return right_; } | 1687 Expression* right() const { return right_; } |
1757 virtual int position() const { return pos_; } | 1688 virtual int position() const { return pos_; } |
1758 | 1689 |
1759 BailoutId RightId() const { return right_id_; } | 1690 BailoutId RightId() const { return right_id_; } |
1760 | 1691 |
1761 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } | 1692 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } |
1762 | 1693 |
1763 protected: | 1694 protected: |
1764 template<class> friend class AstNodeFactory; | |
1765 | |
1766 BinaryOperation(Isolate* isolate, | 1695 BinaryOperation(Isolate* isolate, |
1767 Token::Value op, | 1696 Token::Value op, |
1768 Expression* left, | 1697 Expression* left, |
1769 Expression* right, | 1698 Expression* right, |
1770 int pos) | 1699 int pos) |
1771 : Expression(isolate), | 1700 : Expression(isolate), |
1772 op_(op), | 1701 op_(op), |
1773 left_(left), | 1702 left_(left), |
1774 right_(right), | 1703 right_(right), |
1775 pos_(pos), | 1704 pos_(pos), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); | 1737 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); |
1809 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1738 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1810 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1739 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1811 | 1740 |
1812 BailoutId AssignmentId() const { return assignment_id_; } | 1741 BailoutId AssignmentId() const { return assignment_id_; } |
1813 | 1742 |
1814 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 1743 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
1815 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 1744 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
1816 | 1745 |
1817 protected: | 1746 protected: |
1818 template<class> friend class AstNodeFactory; | |
1819 | |
1820 CountOperation(Isolate* isolate, | 1747 CountOperation(Isolate* isolate, |
1821 Token::Value op, | 1748 Token::Value op, |
1822 bool is_prefix, | 1749 bool is_prefix, |
1823 Expression* expr, | 1750 Expression* expr, |
1824 int pos) | 1751 int pos) |
1825 : Expression(isolate), | 1752 : Expression(isolate), |
1826 op_(op), | 1753 op_(op), |
1827 is_prefix_(is_prefix), | 1754 is_prefix_(is_prefix), |
1828 expression_(expr), | 1755 expression_(expr), |
1829 pos_(pos), | 1756 pos_(pos), |
(...skipping 26 matching lines...) Expand all Loading... |
1856 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1783 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1857 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } | 1784 bool IsSmiCompare() { return compare_type_ == SMI_ONLY; } |
1858 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } | 1785 bool IsObjectCompare() { return compare_type_ == OBJECT_ONLY; } |
1859 | 1786 |
1860 // Match special cases. | 1787 // Match special cases. |
1861 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 1788 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
1862 bool IsLiteralCompareUndefined(Expression** expr); | 1789 bool IsLiteralCompareUndefined(Expression** expr); |
1863 bool IsLiteralCompareNull(Expression** expr); | 1790 bool IsLiteralCompareNull(Expression** expr); |
1864 | 1791 |
1865 protected: | 1792 protected: |
1866 template<class> friend class AstNodeFactory; | |
1867 | |
1868 CompareOperation(Isolate* isolate, | 1793 CompareOperation(Isolate* isolate, |
1869 Token::Value op, | 1794 Token::Value op, |
1870 Expression* left, | 1795 Expression* left, |
1871 Expression* right, | 1796 Expression* right, |
1872 int pos) | 1797 int pos) |
1873 : Expression(isolate), | 1798 : Expression(isolate), |
1874 op_(op), | 1799 op_(op), |
1875 left_(left), | 1800 left_(left), |
1876 right_(right), | 1801 right_(right), |
1877 pos_(pos), | 1802 pos_(pos), |
(...skipping 20 matching lines...) Expand all Loading... |
1898 Expression* then_expression() const { return then_expression_; } | 1823 Expression* then_expression() const { return then_expression_; } |
1899 Expression* else_expression() const { return else_expression_; } | 1824 Expression* else_expression() const { return else_expression_; } |
1900 | 1825 |
1901 int then_expression_position() const { return then_expression_position_; } | 1826 int then_expression_position() const { return then_expression_position_; } |
1902 int else_expression_position() const { return else_expression_position_; } | 1827 int else_expression_position() const { return else_expression_position_; } |
1903 | 1828 |
1904 BailoutId ThenId() const { return then_id_; } | 1829 BailoutId ThenId() const { return then_id_; } |
1905 BailoutId ElseId() const { return else_id_; } | 1830 BailoutId ElseId() const { return else_id_; } |
1906 | 1831 |
1907 protected: | 1832 protected: |
1908 template<class> friend class AstNodeFactory; | |
1909 | |
1910 Conditional(Isolate* isolate, | 1833 Conditional(Isolate* isolate, |
1911 Expression* condition, | 1834 Expression* condition, |
1912 Expression* then_expression, | 1835 Expression* then_expression, |
1913 Expression* else_expression, | 1836 Expression* else_expression, |
1914 int then_expression_position, | 1837 int then_expression_position, |
1915 int else_expression_position) | 1838 int else_expression_position) |
1916 : Expression(isolate), | 1839 : Expression(isolate), |
1917 condition_(condition), | 1840 condition_(condition), |
1918 then_expression_(then_expression), | 1841 then_expression_(then_expression), |
1919 else_expression_(else_expression), | 1842 else_expression_(else_expression), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 | 1884 |
1962 BailoutId AssignmentId() const { return assignment_id_; } | 1885 BailoutId AssignmentId() const { return assignment_id_; } |
1963 | 1886 |
1964 // Type feedback information. | 1887 // Type feedback information. |
1965 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } | 1888 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } |
1966 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1889 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
1967 virtual bool IsMonomorphic() { return is_monomorphic_; } | 1890 virtual bool IsMonomorphic() { return is_monomorphic_; } |
1968 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } | 1891 virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; } |
1969 | 1892 |
1970 protected: | 1893 protected: |
1971 template<class> friend class AstNodeFactory; | |
1972 | |
1973 Assignment(Isolate* isolate, | 1894 Assignment(Isolate* isolate, |
1974 Token::Value op, | 1895 Token::Value op, |
1975 Expression* target, | 1896 Expression* target, |
1976 Expression* value, | 1897 Expression* value, |
1977 int pos); | 1898 int pos); |
1978 | 1899 |
1979 template<class Visitor> | 1900 template<class Visitor> |
1980 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { | 1901 void Init(Isolate* isolate, AstNodeFactory<Visitor>* factory) { |
1981 ASSERT(Token::IsAssignmentOp(op_)); | 1902 ASSERT(Token::IsAssignmentOp(op_)); |
1982 if (is_compound()) { | 1903 if (is_compound()) { |
(...skipping 19 matching lines...) Expand all Loading... |
2002 | 1923 |
2003 | 1924 |
2004 class Throw: public Expression { | 1925 class Throw: public Expression { |
2005 public: | 1926 public: |
2006 DECLARE_NODE_TYPE(Throw) | 1927 DECLARE_NODE_TYPE(Throw) |
2007 | 1928 |
2008 Expression* exception() const { return exception_; } | 1929 Expression* exception() const { return exception_; } |
2009 virtual int position() const { return pos_; } | 1930 virtual int position() const { return pos_; } |
2010 | 1931 |
2011 protected: | 1932 protected: |
2012 template<class> friend class AstNodeFactory; | |
2013 | |
2014 Throw(Isolate* isolate, Expression* exception, int pos) | 1933 Throw(Isolate* isolate, Expression* exception, int pos) |
2015 : Expression(isolate), exception_(exception), pos_(pos) {} | 1934 : Expression(isolate), exception_(exception), pos_(pos) {} |
2016 | 1935 |
2017 private: | 1936 private: |
2018 Expression* exception_; | 1937 Expression* exception_; |
2019 int pos_; | 1938 int pos_; |
2020 }; | 1939 }; |
2021 | 1940 |
2022 | 1941 |
2023 class FunctionLiteral: public Expression { | 1942 class FunctionLiteral: public Expression { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized); | 2022 bitfield_ = IsParenthesized::update(bitfield_, kIsParenthesized); |
2104 } | 2023 } |
2105 | 2024 |
2106 int ast_node_count() { return ast_properties_.node_count(); } | 2025 int ast_node_count() { return ast_properties_.node_count(); } |
2107 AstProperties::Flags* flags() { return ast_properties_.flags(); } | 2026 AstProperties::Flags* flags() { return ast_properties_.flags(); } |
2108 void set_ast_properties(AstProperties* ast_properties) { | 2027 void set_ast_properties(AstProperties* ast_properties) { |
2109 ast_properties_ = *ast_properties; | 2028 ast_properties_ = *ast_properties; |
2110 } | 2029 } |
2111 | 2030 |
2112 protected: | 2031 protected: |
2113 template<class> friend class AstNodeFactory; | |
2114 | |
2115 FunctionLiteral(Isolate* isolate, | 2032 FunctionLiteral(Isolate* isolate, |
2116 Handle<String> name, | 2033 Handle<String> name, |
2117 Scope* scope, | 2034 Scope* scope, |
2118 ZoneList<Statement*>* body, | 2035 ZoneList<Statement*>* body, |
2119 int materialized_literal_count, | 2036 int materialized_literal_count, |
2120 int expected_property_count, | 2037 int expected_property_count, |
2121 int handler_count, | 2038 int handler_count, |
2122 bool has_only_simple_this_property_assignments, | 2039 bool has_only_simple_this_property_assignments, |
2123 Handle<FixedArray> this_property_assignments, | 2040 Handle<FixedArray> this_property_assignments, |
2124 int parameter_count, | 2041 int parameter_count, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 | 2092 |
2176 class SharedFunctionInfoLiteral: public Expression { | 2093 class SharedFunctionInfoLiteral: public Expression { |
2177 public: | 2094 public: |
2178 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) | 2095 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) |
2179 | 2096 |
2180 Handle<SharedFunctionInfo> shared_function_info() const { | 2097 Handle<SharedFunctionInfo> shared_function_info() const { |
2181 return shared_function_info_; | 2098 return shared_function_info_; |
2182 } | 2099 } |
2183 | 2100 |
2184 protected: | 2101 protected: |
2185 template<class> friend class AstNodeFactory; | |
2186 | |
2187 SharedFunctionInfoLiteral( | 2102 SharedFunctionInfoLiteral( |
2188 Isolate* isolate, | 2103 Isolate* isolate, |
2189 Handle<SharedFunctionInfo> shared_function_info) | 2104 Handle<SharedFunctionInfo> shared_function_info) |
2190 : Expression(isolate), | 2105 : Expression(isolate), |
2191 shared_function_info_(shared_function_info) { } | 2106 shared_function_info_(shared_function_info) { } |
2192 | 2107 |
2193 private: | 2108 private: |
2194 Handle<SharedFunctionInfo> shared_function_info_; | 2109 Handle<SharedFunctionInfo> shared_function_info_; |
2195 }; | 2110 }; |
2196 | 2111 |
2197 | 2112 |
2198 class ThisFunction: public Expression { | 2113 class ThisFunction: public Expression { |
2199 public: | 2114 public: |
2200 DECLARE_NODE_TYPE(ThisFunction) | 2115 DECLARE_NODE_TYPE(ThisFunction) |
2201 | 2116 |
2202 protected: | 2117 protected: |
2203 template<class> friend class AstNodeFactory; | |
2204 | |
2205 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} | 2118 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} |
2206 }; | 2119 }; |
2207 | 2120 |
2208 #undef DECLARE_NODE_TYPE | 2121 #undef DECLARE_NODE_TYPE |
2209 | 2122 |
2210 | 2123 |
2211 // ---------------------------------------------------------------------------- | 2124 // ---------------------------------------------------------------------------- |
2212 // Regular expressions | 2125 // Regular expressions |
2213 | 2126 |
2214 | 2127 |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 private: | 2918 private: |
3006 Isolate* isolate_; | 2919 Isolate* isolate_; |
3007 Zone* zone_; | 2920 Zone* zone_; |
3008 Visitor visitor_; | 2921 Visitor visitor_; |
3009 }; | 2922 }; |
3010 | 2923 |
3011 | 2924 |
3012 } } // namespace v8::internal | 2925 } } // namespace v8::internal |
3013 | 2926 |
3014 #endif // V8_AST_H_ | 2927 #endif // V8_AST_H_ |
OLD | NEW |