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

Side by Side Diff: src/ast.h

Issue 797943002: Consistently use only one of virtual/OVERRIDE/FINAL. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed temporary hack. Created 6 years 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
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ast-this-access-visitor.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 AST_NODE_LIST(DEF_FORWARD_DECLARATION) 134 AST_NODE_LIST(DEF_FORWARD_DECLARATION)
135 #undef DEF_FORWARD_DECLARATION 135 #undef DEF_FORWARD_DECLARATION
136 136
137 137
138 // Typedef only introduced to avoid unreadable code. 138 // Typedef only introduced to avoid unreadable code.
139 // Please do appreciate the required space in "> >". 139 // Please do appreciate the required space in "> >".
140 typedef ZoneList<Handle<String> > ZoneStringList; 140 typedef ZoneList<Handle<String> > ZoneStringList;
141 typedef ZoneList<Handle<Object> > ZoneObjectList; 141 typedef ZoneList<Handle<Object> > ZoneObjectList;
142 142
143 143
144 #define DECLARE_NODE_TYPE(type) \ 144 #define DECLARE_NODE_TYPE(type) \
145 virtual void Accept(AstVisitor* v) OVERRIDE; \ 145 void Accept(AstVisitor* v) OVERRIDE; \
146 virtual AstNode::NodeType node_type() const FINAL OVERRIDE { \ 146 AstNode::NodeType node_type() const FINAL { return AstNode::k##type; } \
147 return AstNode::k##type; \
148 } \
149 friend class AstNodeFactory; 147 friend class AstNodeFactory;
150 148
151 149
152 enum AstPropertiesFlag { 150 enum AstPropertiesFlag {
153 kDontSelfOptimize, 151 kDontSelfOptimize,
154 kDontSoftInline, 152 kDontSoftInline,
155 kDontCache 153 kDontCache
156 }; 154 };
157 155
158 156
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 enum BreakableType { 437 enum BreakableType {
440 TARGET_FOR_ANONYMOUS, 438 TARGET_FOR_ANONYMOUS,
441 TARGET_FOR_NAMED_ONLY 439 TARGET_FOR_NAMED_ONLY
442 }; 440 };
443 441
444 // The labels associated with this statement. May be NULL; 442 // The labels associated with this statement. May be NULL;
445 // if it is != NULL, guaranteed to contain at least one entry. 443 // if it is != NULL, guaranteed to contain at least one entry.
446 ZoneList<const AstRawString*>* labels() const { return labels_; } 444 ZoneList<const AstRawString*>* labels() const { return labels_; }
447 445
448 // Type testing & conversion. 446 // Type testing & conversion.
449 virtual BreakableStatement* AsBreakableStatement() FINAL OVERRIDE { 447 BreakableStatement* AsBreakableStatement() FINAL { return this; }
450 return this;
451 }
452 448
453 // Code generation 449 // Code generation
454 Label* break_target() { return &break_target_; } 450 Label* break_target() { return &break_target_; }
455 451
456 // Testers. 452 // Testers.
457 bool is_target_for_anonymous() const { 453 bool is_target_for_anonymous() const {
458 return breakable_type_ == TARGET_FOR_ANONYMOUS; 454 return breakable_type_ == TARGET_FOR_ANONYMOUS;
459 } 455 }
460 456
461 void set_base_id(int id) { base_id_ = id; } 457 void set_base_id(int id) { base_id_ = id; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 void AddStatement(Statement* statement, Zone* zone) { 492 void AddStatement(Statement* statement, Zone* zone) {
497 statements_.Add(statement, zone); 493 statements_.Add(statement, zone);
498 } 494 }
499 495
500 ZoneList<Statement*>* statements() { return &statements_; } 496 ZoneList<Statement*>* statements() { return &statements_; }
501 bool is_initializer_block() const { return is_initializer_block_; } 497 bool is_initializer_block() const { return is_initializer_block_; }
502 498
503 static int num_ids() { return parent_num_ids() + 1; } 499 static int num_ids() { return parent_num_ids() + 1; }
504 BailoutId DeclsId() const { return BailoutId(local_id(0)); } 500 BailoutId DeclsId() const { return BailoutId(local_id(0)); }
505 501
506 virtual bool IsJump() const OVERRIDE { 502 bool IsJump() const OVERRIDE {
507 return !statements_.is_empty() && statements_.last()->IsJump() 503 return !statements_.is_empty() && statements_.last()->IsJump()
508 && labels() == NULL; // Good enough as an approximation... 504 && labels() == NULL; // Good enough as an approximation...
509 } 505 }
510 506
511 Scope* scope() const { return scope_; } 507 Scope* scope() const { return scope_; }
512 void set_scope(Scope* scope) { scope_ = scope; } 508 void set_scope(Scope* scope) { scope_ = scope; }
513 509
514 protected: 510 protected:
515 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, 511 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
516 bool is_initializer_block, int pos) 512 bool is_initializer_block, int pos)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 546
551 // Nested scope from which the declaration originated. 547 // Nested scope from which the declaration originated.
552 Scope* scope_; 548 Scope* scope_;
553 }; 549 };
554 550
555 551
556 class VariableDeclaration FINAL : public Declaration { 552 class VariableDeclaration FINAL : public Declaration {
557 public: 553 public:
558 DECLARE_NODE_TYPE(VariableDeclaration) 554 DECLARE_NODE_TYPE(VariableDeclaration)
559 555
560 virtual InitializationFlag initialization() const OVERRIDE { 556 InitializationFlag initialization() const OVERRIDE {
561 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; 557 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
562 } 558 }
563 559
564 protected: 560 protected:
565 VariableDeclaration(Zone* zone, 561 VariableDeclaration(Zone* zone,
566 VariableProxy* proxy, 562 VariableProxy* proxy,
567 VariableMode mode, 563 VariableMode mode,
568 Scope* scope, 564 Scope* scope,
569 int pos) 565 int pos)
570 : Declaration(zone, proxy, mode, scope, pos) { 566 : Declaration(zone, proxy, mode, scope, pos) {
571 } 567 }
572 }; 568 };
573 569
574 570
575 class FunctionDeclaration FINAL : public Declaration { 571 class FunctionDeclaration FINAL : public Declaration {
576 public: 572 public:
577 DECLARE_NODE_TYPE(FunctionDeclaration) 573 DECLARE_NODE_TYPE(FunctionDeclaration)
578 574
579 FunctionLiteral* fun() const { return fun_; } 575 FunctionLiteral* fun() const { return fun_; }
580 virtual InitializationFlag initialization() const OVERRIDE { 576 InitializationFlag initialization() const OVERRIDE {
581 return kCreatedInitialized; 577 return kCreatedInitialized;
582 } 578 }
583 virtual bool IsInlineable() const OVERRIDE; 579 bool IsInlineable() const OVERRIDE;
584 580
585 protected: 581 protected:
586 FunctionDeclaration(Zone* zone, 582 FunctionDeclaration(Zone* zone,
587 VariableProxy* proxy, 583 VariableProxy* proxy,
588 VariableMode mode, 584 VariableMode mode,
589 FunctionLiteral* fun, 585 FunctionLiteral* fun,
590 Scope* scope, 586 Scope* scope,
591 int pos) 587 int pos)
592 : Declaration(zone, proxy, mode, scope, pos), 588 : Declaration(zone, proxy, mode, scope, pos),
593 fun_(fun) { 589 fun_(fun) {
594 // At the moment there are no "const functions" in JavaScript... 590 // At the moment there are no "const functions" in JavaScript...
595 DCHECK(mode == VAR || mode == LET); 591 DCHECK(mode == VAR || mode == LET);
596 DCHECK(fun != NULL); 592 DCHECK(fun != NULL);
597 } 593 }
598 594
599 private: 595 private:
600 FunctionLiteral* fun_; 596 FunctionLiteral* fun_;
601 }; 597 };
602 598
603 599
604 class ModuleDeclaration FINAL : public Declaration { 600 class ModuleDeclaration FINAL : public Declaration {
605 public: 601 public:
606 DECLARE_NODE_TYPE(ModuleDeclaration) 602 DECLARE_NODE_TYPE(ModuleDeclaration)
607 603
608 Module* module() const { return module_; } 604 Module* module() const { return module_; }
609 virtual InitializationFlag initialization() const OVERRIDE { 605 InitializationFlag initialization() const OVERRIDE {
610 return kCreatedInitialized; 606 return kCreatedInitialized;
611 } 607 }
612 608
613 protected: 609 protected:
614 ModuleDeclaration(Zone* zone, 610 ModuleDeclaration(Zone* zone,
615 VariableProxy* proxy, 611 VariableProxy* proxy,
616 Module* module, 612 Module* module,
617 Scope* scope, 613 Scope* scope,
618 int pos) 614 int pos)
619 : Declaration(zone, proxy, MODULE, scope, pos), 615 : Declaration(zone, proxy, MODULE, scope, pos),
620 module_(module) { 616 module_(module) {
621 } 617 }
622 618
623 private: 619 private:
624 Module* module_; 620 Module* module_;
625 }; 621 };
626 622
627 623
628 class ImportDeclaration FINAL : public Declaration { 624 class ImportDeclaration FINAL : public Declaration {
629 public: 625 public:
630 DECLARE_NODE_TYPE(ImportDeclaration) 626 DECLARE_NODE_TYPE(ImportDeclaration)
631 627
632 Module* module() const { return module_; } 628 Module* module() const { return module_; }
633 virtual InitializationFlag initialization() const OVERRIDE { 629 InitializationFlag initialization() const OVERRIDE {
634 return kCreatedInitialized; 630 return kCreatedInitialized;
635 } 631 }
636 632
637 protected: 633 protected:
638 ImportDeclaration(Zone* zone, 634 ImportDeclaration(Zone* zone,
639 VariableProxy* proxy, 635 VariableProxy* proxy,
640 Module* module, 636 Module* module,
641 Scope* scope, 637 Scope* scope,
642 int pos) 638 int pos)
643 : Declaration(zone, proxy, LET, scope, pos), 639 : Declaration(zone, proxy, LET, scope, pos),
644 module_(module) { 640 module_(module) {
645 } 641 }
646 642
647 private: 643 private:
648 Module* module_; 644 Module* module_;
649 }; 645 };
650 646
651 647
652 class ExportDeclaration FINAL : public Declaration { 648 class ExportDeclaration FINAL : public Declaration {
653 public: 649 public:
654 DECLARE_NODE_TYPE(ExportDeclaration) 650 DECLARE_NODE_TYPE(ExportDeclaration)
655 651
656 virtual InitializationFlag initialization() const OVERRIDE { 652 InitializationFlag initialization() const OVERRIDE {
657 return kCreatedInitialized; 653 return kCreatedInitialized;
658 } 654 }
659 655
660 protected: 656 protected:
661 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) 657 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos)
662 : Declaration(zone, proxy, LET, scope, pos) {} 658 : Declaration(zone, proxy, LET, scope, pos) {}
663 }; 659 };
664 660
665 661
666 class Module : public AstNode { 662 class Module : public AstNode {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 753
758 private: 754 private:
759 VariableProxy* proxy_; 755 VariableProxy* proxy_;
760 Block* body_; 756 Block* body_;
761 }; 757 };
762 758
763 759
764 class IterationStatement : public BreakableStatement { 760 class IterationStatement : public BreakableStatement {
765 public: 761 public:
766 // Type testing & conversion. 762 // Type testing & conversion.
767 virtual IterationStatement* AsIterationStatement() FINAL OVERRIDE { 763 IterationStatement* AsIterationStatement() FINAL { return this; }
768 return this;
769 }
770 764
771 Statement* body() const { return body_; } 765 Statement* body() const { return body_; }
772 766
773 static int num_ids() { return parent_num_ids() + 1; } 767 static int num_ids() { return parent_num_ids() + 1; }
774 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); } 768 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); }
775 virtual BailoutId ContinueId() const = 0; 769 virtual BailoutId ContinueId() const = 0;
776 virtual BailoutId StackCheckId() const = 0; 770 virtual BailoutId StackCheckId() const = 0;
777 771
778 // Code generation 772 // Code generation
779 Label* continue_target() { return &continue_target_; } 773 Label* continue_target() { return &continue_target_; }
(...skipping 18 matching lines...) Expand all
798 DECLARE_NODE_TYPE(DoWhileStatement) 792 DECLARE_NODE_TYPE(DoWhileStatement)
799 793
800 void Initialize(Expression* cond, Statement* body) { 794 void Initialize(Expression* cond, Statement* body) {
801 IterationStatement::Initialize(body); 795 IterationStatement::Initialize(body);
802 cond_ = cond; 796 cond_ = cond;
803 } 797 }
804 798
805 Expression* cond() const { return cond_; } 799 Expression* cond() const { return cond_; }
806 800
807 static int num_ids() { return parent_num_ids() + 2; } 801 static int num_ids() { return parent_num_ids() + 2; }
808 virtual BailoutId ContinueId() const OVERRIDE { 802 BailoutId ContinueId() const OVERRIDE { return BailoutId(local_id(0)); }
809 return BailoutId(local_id(0)); 803 BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); }
810 }
811 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); }
812 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } 804 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); }
813 805
814 protected: 806 protected:
815 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 807 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
816 : IterationStatement(zone, labels, pos), cond_(NULL) {} 808 : IterationStatement(zone, labels, pos), cond_(NULL) {}
817 static int parent_num_ids() { return IterationStatement::num_ids(); } 809 static int parent_num_ids() { return IterationStatement::num_ids(); }
818 810
819 private: 811 private:
820 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 812 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
821 813
822 Expression* cond_; 814 Expression* cond_;
823 }; 815 };
824 816
825 817
826 class WhileStatement FINAL : public IterationStatement { 818 class WhileStatement FINAL : public IterationStatement {
827 public: 819 public:
828 DECLARE_NODE_TYPE(WhileStatement) 820 DECLARE_NODE_TYPE(WhileStatement)
829 821
830 void Initialize(Expression* cond, Statement* body) { 822 void Initialize(Expression* cond, Statement* body) {
831 IterationStatement::Initialize(body); 823 IterationStatement::Initialize(body);
832 cond_ = cond; 824 cond_ = cond;
833 } 825 }
834 826
835 Expression* cond() const { return cond_; } 827 Expression* cond() const { return cond_; }
836 828
837 static int num_ids() { return parent_num_ids() + 1; } 829 static int num_ids() { return parent_num_ids() + 1; }
838 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 830 BailoutId ContinueId() const OVERRIDE { return EntryId(); }
839 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 831 BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
840 BailoutId BodyId() const { return BailoutId(local_id(0)); } 832 BailoutId BodyId() const { return BailoutId(local_id(0)); }
841 833
842 protected: 834 protected:
843 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 835 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
844 : IterationStatement(zone, labels, pos), cond_(NULL) {} 836 : IterationStatement(zone, labels, pos), cond_(NULL) {}
845 static int parent_num_ids() { return IterationStatement::num_ids(); } 837 static int parent_num_ids() { return IterationStatement::num_ids(); }
846 838
847 private: 839 private:
848 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 840 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
849 841
(...skipping 13 matching lines...) Expand all
863 init_ = init; 855 init_ = init;
864 cond_ = cond; 856 cond_ = cond;
865 next_ = next; 857 next_ = next;
866 } 858 }
867 859
868 Statement* init() const { return init_; } 860 Statement* init() const { return init_; }
869 Expression* cond() const { return cond_; } 861 Expression* cond() const { return cond_; }
870 Statement* next() const { return next_; } 862 Statement* next() const { return next_; }
871 863
872 static int num_ids() { return parent_num_ids() + 2; } 864 static int num_ids() { return parent_num_ids() + 2; }
873 virtual BailoutId ContinueId() const OVERRIDE { 865 BailoutId ContinueId() const OVERRIDE { return BailoutId(local_id(0)); }
874 return BailoutId(local_id(0)); 866 BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
875 }
876 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
877 BailoutId BodyId() const { return BailoutId(local_id(1)); } 867 BailoutId BodyId() const { return BailoutId(local_id(1)); }
878 868
879 protected: 869 protected:
880 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 870 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
881 : IterationStatement(zone, labels, pos), 871 : IterationStatement(zone, labels, pos),
882 init_(NULL), 872 init_(NULL),
883 cond_(NULL), 873 cond_(NULL),
884 next_(NULL) {} 874 next_(NULL) {}
885 static int parent_num_ids() { return IterationStatement::num_ids(); } 875 static int parent_num_ids() { return IterationStatement::num_ids(); }
886 876
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 915
926 Expression* enumerable() const { 916 Expression* enumerable() const {
927 return subject(); 917 return subject();
928 } 918 }
929 919
930 // Type feedback information. 920 // Type feedback information.
931 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 921 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
932 Isolate* isolate) OVERRIDE { 922 Isolate* isolate) OVERRIDE {
933 return FeedbackVectorRequirements(1, 0); 923 return FeedbackVectorRequirements(1, 0);
934 } 924 }
935 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 925 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
936 for_in_feedback_slot_ = slot; 926 for_in_feedback_slot_ = slot;
937 } 927 }
938 928
939 FeedbackVectorSlot ForInFeedbackSlot() { 929 FeedbackVectorSlot ForInFeedbackSlot() {
940 DCHECK(!for_in_feedback_slot_.IsInvalid()); 930 DCHECK(!for_in_feedback_slot_.IsInvalid());
941 return for_in_feedback_slot_; 931 return for_in_feedback_slot_;
942 } 932 }
943 933
944 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 934 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
945 ForInType for_in_type() const { return for_in_type_; } 935 ForInType for_in_type() const { return for_in_type_; }
946 void set_for_in_type(ForInType type) { for_in_type_ = type; } 936 void set_for_in_type(ForInType type) { for_in_type_ = type; }
947 937
948 static int num_ids() { return parent_num_ids() + 4; } 938 static int num_ids() { return parent_num_ids() + 4; }
949 BailoutId BodyId() const { return BailoutId(local_id(0)); } 939 BailoutId BodyId() const { return BailoutId(local_id(0)); }
950 BailoutId PrepareId() const { return BailoutId(local_id(1)); } 940 BailoutId PrepareId() const { return BailoutId(local_id(1)); }
951 BailoutId EnumId() const { return BailoutId(local_id(2)); } 941 BailoutId EnumId() const { return BailoutId(local_id(2)); }
952 BailoutId ToObjectId() const { return BailoutId(local_id(3)); } 942 BailoutId ToObjectId() const { return BailoutId(local_id(3)); }
953 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 943 BailoutId ContinueId() const OVERRIDE { return EntryId(); }
954 virtual BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 944 BailoutId StackCheckId() const OVERRIDE { return BodyId(); }
955 945
956 protected: 946 protected:
957 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 947 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
958 : ForEachStatement(zone, labels, pos), 948 : ForEachStatement(zone, labels, pos),
959 for_in_type_(SLOW_FOR_IN), 949 for_in_type_(SLOW_FOR_IN),
960 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {} 950 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {}
961 static int parent_num_ids() { return ForEachStatement::num_ids(); } 951 static int parent_num_ids() { return ForEachStatement::num_ids(); }
962 952
963 private: 953 private:
964 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 954 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 // result.done 993 // result.done
1004 Expression* result_done() const { 994 Expression* result_done() const {
1005 return result_done_; 995 return result_done_;
1006 } 996 }
1007 997
1008 // each = result.value 998 // each = result.value
1009 Expression* assign_each() const { 999 Expression* assign_each() const {
1010 return assign_each_; 1000 return assign_each_;
1011 } 1001 }
1012 1002
1013 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } 1003 BailoutId ContinueId() const OVERRIDE { return EntryId(); }
1014 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } 1004 BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); }
1015 1005
1016 static int num_ids() { return parent_num_ids() + 1; } 1006 static int num_ids() { return parent_num_ids() + 1; }
1017 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); } 1007 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); }
1018 1008
1019 protected: 1009 protected:
1020 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 1010 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
1021 : ForEachStatement(zone, labels, pos), 1011 : ForEachStatement(zone, labels, pos),
1022 assign_iterator_(NULL), 1012 assign_iterator_(NULL),
1023 next_result_(NULL), 1013 next_result_(NULL),
1024 result_done_(NULL), 1014 result_done_(NULL),
1025 assign_each_(NULL) {} 1015 assign_each_(NULL) {}
1026 static int parent_num_ids() { return ForEachStatement::num_ids(); } 1016 static int parent_num_ids() { return ForEachStatement::num_ids(); }
1027 1017
1028 private: 1018 private:
1029 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1019 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1030 1020
1031 Expression* assign_iterator_; 1021 Expression* assign_iterator_;
1032 Expression* next_result_; 1022 Expression* next_result_;
1033 Expression* result_done_; 1023 Expression* result_done_;
1034 Expression* assign_each_; 1024 Expression* assign_each_;
1035 }; 1025 };
1036 1026
1037 1027
1038 class ExpressionStatement FINAL : public Statement { 1028 class ExpressionStatement FINAL : public Statement {
1039 public: 1029 public:
1040 DECLARE_NODE_TYPE(ExpressionStatement) 1030 DECLARE_NODE_TYPE(ExpressionStatement)
1041 1031
1042 void set_expression(Expression* e) { expression_ = e; } 1032 void set_expression(Expression* e) { expression_ = e; }
1043 Expression* expression() const { return expression_; } 1033 Expression* expression() const { return expression_; }
1044 virtual bool IsJump() const OVERRIDE { return expression_->IsThrow(); } 1034 bool IsJump() const OVERRIDE { return expression_->IsThrow(); }
1045 1035
1046 protected: 1036 protected:
1047 ExpressionStatement(Zone* zone, Expression* expression, int pos) 1037 ExpressionStatement(Zone* zone, Expression* expression, int pos)
1048 : Statement(zone, pos), expression_(expression) { } 1038 : Statement(zone, pos), expression_(expression) { }
1049 1039
1050 private: 1040 private:
1051 Expression* expression_; 1041 Expression* expression_;
1052 }; 1042 };
1053 1043
1054 1044
1055 class JumpStatement : public Statement { 1045 class JumpStatement : public Statement {
1056 public: 1046 public:
1057 virtual bool IsJump() const FINAL OVERRIDE { return true; } 1047 bool IsJump() const FINAL { return true; }
1058 1048
1059 protected: 1049 protected:
1060 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} 1050 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {}
1061 }; 1051 };
1062 1052
1063 1053
1064 class ContinueStatement FINAL : public JumpStatement { 1054 class ContinueStatement FINAL : public JumpStatement {
1065 public: 1055 public:
1066 DECLARE_NODE_TYPE(ContinueStatement) 1056 DECLARE_NODE_TYPE(ContinueStatement)
1067 1057
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 public: 1187 public:
1198 DECLARE_NODE_TYPE(IfStatement) 1188 DECLARE_NODE_TYPE(IfStatement)
1199 1189
1200 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } 1190 bool HasThenStatement() const { return !then_statement()->IsEmpty(); }
1201 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } 1191 bool HasElseStatement() const { return !else_statement()->IsEmpty(); }
1202 1192
1203 Expression* condition() const { return condition_; } 1193 Expression* condition() const { return condition_; }
1204 Statement* then_statement() const { return then_statement_; } 1194 Statement* then_statement() const { return then_statement_; }
1205 Statement* else_statement() const { return else_statement_; } 1195 Statement* else_statement() const { return else_statement_; }
1206 1196
1207 virtual bool IsJump() const OVERRIDE { 1197 bool IsJump() const OVERRIDE {
1208 return HasThenStatement() && then_statement()->IsJump() 1198 return HasThenStatement() && then_statement()->IsJump()
1209 && HasElseStatement() && else_statement()->IsJump(); 1199 && HasElseStatement() && else_statement()->IsJump();
1210 } 1200 }
1211 1201
1212 void set_base_id(int id) { base_id_ = id; } 1202 void set_base_id(int id) { base_id_ = id; }
1213 static int num_ids() { return parent_num_ids() + 3; } 1203 static int num_ids() { return parent_num_ids() + 3; }
1214 BailoutId IfId() const { return BailoutId(local_id(0)); } 1204 BailoutId IfId() const { return BailoutId(local_id(0)); }
1215 BailoutId ThenId() const { return BailoutId(local_id(1)); } 1205 BailoutId ThenId() const { return BailoutId(local_id(1)); }
1216 BailoutId ElseId() const { return BailoutId(local_id(2)); } 1206 BailoutId ElseId() const { return BailoutId(local_id(2)); }
1217 1207
(...skipping 28 matching lines...) Expand all
1246 public: 1236 public:
1247 explicit TargetCollector(Zone* zone) 1237 explicit TargetCollector(Zone* zone)
1248 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { } 1238 : AstNode(RelocInfo::kNoPosition), targets_(0, zone) { }
1249 1239
1250 // Adds a jump target to the collector. The collector stores a pointer not 1240 // Adds a jump target to the collector. The collector stores a pointer not
1251 // a copy of the target to make binding work, so make sure not to pass in 1241 // a copy of the target to make binding work, so make sure not to pass in
1252 // references to something on the stack. 1242 // references to something on the stack.
1253 void AddTarget(Label* target, Zone* zone); 1243 void AddTarget(Label* target, Zone* zone);
1254 1244
1255 // Virtual behaviour. TargetCollectors are never part of the AST. 1245 // Virtual behaviour. TargetCollectors are never part of the AST.
1256 virtual void Accept(AstVisitor* v) OVERRIDE { UNREACHABLE(); } 1246 void Accept(AstVisitor* v) OVERRIDE { UNREACHABLE(); }
1257 virtual NodeType node_type() const OVERRIDE { return kInvalid; } 1247 NodeType node_type() const OVERRIDE { return kInvalid; }
1258 virtual TargetCollector* AsTargetCollector() OVERRIDE { return this; } 1248 TargetCollector* AsTargetCollector() OVERRIDE { return this; }
1259 1249
1260 ZoneList<Label*>* targets() { return &targets_; } 1250 ZoneList<Label*>* targets() { return &targets_; }
1261 1251
1262 private: 1252 private:
1263 ZoneList<Label*> targets_; 1253 ZoneList<Label*> targets_;
1264 }; 1254 };
1265 1255
1266 1256
1267 class TryStatement : public Statement { 1257 class TryStatement : public Statement {
1268 public: 1258 public:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 1357
1368 protected: 1358 protected:
1369 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} 1359 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {}
1370 }; 1360 };
1371 1361
1372 1362
1373 class Literal FINAL : public Expression { 1363 class Literal FINAL : public Expression {
1374 public: 1364 public:
1375 DECLARE_NODE_TYPE(Literal) 1365 DECLARE_NODE_TYPE(Literal)
1376 1366
1377 virtual bool IsPropertyName() const OVERRIDE { 1367 bool IsPropertyName() const OVERRIDE { return value_->IsPropertyName(); }
1378 return value_->IsPropertyName();
1379 }
1380 1368
1381 Handle<String> AsPropertyName() { 1369 Handle<String> AsPropertyName() {
1382 DCHECK(IsPropertyName()); 1370 DCHECK(IsPropertyName());
1383 return Handle<String>::cast(value()); 1371 return Handle<String>::cast(value());
1384 } 1372 }
1385 1373
1386 const AstRawString* AsRawPropertyName() { 1374 const AstRawString* AsRawPropertyName() {
1387 DCHECK(IsPropertyName()); 1375 DCHECK(IsPropertyName());
1388 return value_->AsString(); 1376 return value_->AsString();
1389 } 1377 }
1390 1378
1391 virtual bool ToBooleanIsTrue() const OVERRIDE { 1379 bool ToBooleanIsTrue() const OVERRIDE { return value()->BooleanValue(); }
1392 return value()->BooleanValue(); 1380 bool ToBooleanIsFalse() const OVERRIDE { return !value()->BooleanValue(); }
1393 }
1394 virtual bool ToBooleanIsFalse() const OVERRIDE {
1395 return !value()->BooleanValue();
1396 }
1397 1381
1398 Handle<Object> value() const { return value_->value(); } 1382 Handle<Object> value() const { return value_->value(); }
1399 const AstValue* raw_value() const { return value_; } 1383 const AstValue* raw_value() const { return value_; }
1400 1384
1401 // Support for using Literal as a HashMap key. NOTE: Currently, this works 1385 // Support for using Literal as a HashMap key. NOTE: Currently, this works
1402 // only for string and number literals! 1386 // only for string and number literals!
1403 uint32_t Hash(); 1387 uint32_t Hash();
1404 static bool Match(void* literal1, void* literal2); 1388 static bool Match(void* literal1, void* literal2);
1405 1389
1406 static int num_ids() { return parent_num_ids() + 1; } 1390 static int num_ids() { return parent_num_ids() + 1; }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 1641
1658 Handle<FixedArray> constant_elements_; 1642 Handle<FixedArray> constant_elements_;
1659 ZoneList<Expression*>* values_; 1643 ZoneList<Expression*>* values_;
1660 }; 1644 };
1661 1645
1662 1646
1663 class VariableProxy FINAL : public Expression { 1647 class VariableProxy FINAL : public Expression {
1664 public: 1648 public:
1665 DECLARE_NODE_TYPE(VariableProxy) 1649 DECLARE_NODE_TYPE(VariableProxy)
1666 1650
1667 virtual bool IsValidReferenceExpression() const OVERRIDE { 1651 bool IsValidReferenceExpression() const OVERRIDE {
1668 return !is_resolved() || var()->IsValidReference(); 1652 return !is_resolved() || var()->IsValidReference();
1669 } 1653 }
1670 1654
1671 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } 1655 bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
1672 1656
1673 Handle<String> name() const { return raw_name()->string(); } 1657 Handle<String> name() const { return raw_name()->string(); }
1674 const AstRawString* raw_name() const { 1658 const AstRawString* raw_name() const {
1675 return is_resolved() ? var_->raw_name() : raw_name_; 1659 return is_resolved() ? var_->raw_name() : raw_name_;
1676 } 1660 }
1677 1661
(...skipping 26 matching lines...) Expand all
1704 1688
1705 bool UsesVariableFeedbackSlot() const { 1689 bool UsesVariableFeedbackSlot() const {
1706 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot()); 1690 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot());
1707 } 1691 }
1708 1692
1709 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1693 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1710 Isolate* isolate) OVERRIDE { 1694 Isolate* isolate) OVERRIDE {
1711 return FeedbackVectorRequirements(0, UsesVariableFeedbackSlot() ? 1 : 0); 1695 return FeedbackVectorRequirements(0, UsesVariableFeedbackSlot() ? 1 : 0);
1712 } 1696 }
1713 1697
1714 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1698 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1715 variable_feedback_slot_ = slot; 1699 variable_feedback_slot_ = slot;
1716 } 1700 }
1717 virtual Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 1701 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
1718 return Code::LOAD_IC;
1719 }
1720 FeedbackVectorICSlot VariableFeedbackSlot() { 1702 FeedbackVectorICSlot VariableFeedbackSlot() {
1721 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); 1703 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid());
1722 return variable_feedback_slot_; 1704 return variable_feedback_slot_;
1723 } 1705 }
1724 1706
1725 protected: 1707 protected:
1726 VariableProxy(Zone* zone, Variable* var, int position); 1708 VariableProxy(Zone* zone, Variable* var, int position);
1727 1709
1728 VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 1710 VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
1729 Interface* interface, int position); 1711 Interface* interface, int position);
(...skipping 11 matching lines...) Expand all
1741 Variable* var_; // if is_resolved_ 1723 Variable* var_; // if is_resolved_
1742 }; 1724 };
1743 Interface* interface_; 1725 Interface* interface_;
1744 }; 1726 };
1745 1727
1746 1728
1747 class Property FINAL : public Expression { 1729 class Property FINAL : public Expression {
1748 public: 1730 public:
1749 DECLARE_NODE_TYPE(Property) 1731 DECLARE_NODE_TYPE(Property)
1750 1732
1751 virtual bool IsValidReferenceExpression() const OVERRIDE { return true; } 1733 bool IsValidReferenceExpression() const OVERRIDE { return true; }
1752 1734
1753 Expression* obj() const { return obj_; } 1735 Expression* obj() const { return obj_; }
1754 Expression* key() const { return key_; } 1736 Expression* key() const { return key_; }
1755 1737
1756 static int num_ids() { return parent_num_ids() + 2; } 1738 static int num_ids() { return parent_num_ids() + 2; }
1757 BailoutId LoadId() const { return BailoutId(local_id(0)); } 1739 BailoutId LoadId() const { return BailoutId(local_id(0)); }
1758 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); } 1740 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); }
1759 1741
1760 bool IsStringAccess() const { 1742 bool IsStringAccess() const {
1761 return IsStringAccessField::decode(bit_field_); 1743 return IsStringAccessField::decode(bit_field_);
1762 } 1744 }
1763 1745
1764 // Type feedback information. 1746 // Type feedback information.
1765 virtual bool IsMonomorphic() OVERRIDE { 1747 bool IsMonomorphic() OVERRIDE { return receiver_types_.length() == 1; }
1766 return receiver_types_.length() == 1; 1748 SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; }
1767 } 1749 KeyedAccessStoreMode GetStoreMode() const OVERRIDE { return STANDARD_STORE; }
1768 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 1750 IcCheckType GetKeyType() const OVERRIDE {
1769 return &receiver_types_;
1770 }
1771 virtual KeyedAccessStoreMode GetStoreMode() const OVERRIDE {
1772 return STANDARD_STORE;
1773 }
1774 virtual IcCheckType GetKeyType() const OVERRIDE {
1775 // PROPERTY key types currently aren't implemented for KeyedLoadICs. 1751 // PROPERTY key types currently aren't implemented for KeyedLoadICs.
1776 return ELEMENT; 1752 return ELEMENT;
1777 } 1753 }
1778 bool IsUninitialized() const { 1754 bool IsUninitialized() const {
1779 return !is_for_call() && HasNoTypeInformation(); 1755 return !is_for_call() && HasNoTypeInformation();
1780 } 1756 }
1781 bool HasNoTypeInformation() const { 1757 bool HasNoTypeInformation() const {
1782 return IsUninitializedField::decode(bit_field_); 1758 return IsUninitializedField::decode(bit_field_);
1783 } 1759 }
1784 void set_is_uninitialized(bool b) { 1760 void set_is_uninitialized(bool b) {
1785 bit_field_ = IsUninitializedField::update(bit_field_, b); 1761 bit_field_ = IsUninitializedField::update(bit_field_, b);
1786 } 1762 }
1787 void set_is_string_access(bool b) { 1763 void set_is_string_access(bool b) {
1788 bit_field_ = IsStringAccessField::update(bit_field_, b); 1764 bit_field_ = IsStringAccessField::update(bit_field_, b);
1789 } 1765 }
1790 void mark_for_call() { 1766 void mark_for_call() {
1791 bit_field_ = IsForCallField::update(bit_field_, true); 1767 bit_field_ = IsForCallField::update(bit_field_, true);
1792 } 1768 }
1793 bool is_for_call() const { return IsForCallField::decode(bit_field_); } 1769 bool is_for_call() const { return IsForCallField::decode(bit_field_); }
1794 1770
1795 bool IsSuperAccess() { 1771 bool IsSuperAccess() {
1796 return obj()->IsSuperReference(); 1772 return obj()->IsSuperReference();
1797 } 1773 }
1798 1774
1799 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1775 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1800 Isolate* isolate) OVERRIDE { 1776 Isolate* isolate) OVERRIDE {
1801 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1777 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1802 } 1778 }
1803 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1779 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1804 property_feedback_slot_ = slot; 1780 property_feedback_slot_ = slot;
1805 } 1781 }
1806 virtual Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 1782 Code::Kind FeedbackICSlotKind(int index) OVERRIDE {
1807 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; 1783 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC;
1808 } 1784 }
1809 1785
1810 FeedbackVectorICSlot PropertyFeedbackSlot() const { 1786 FeedbackVectorICSlot PropertyFeedbackSlot() const {
1811 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid()); 1787 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid());
1812 return property_feedback_slot_; 1788 return property_feedback_slot_;
1813 } 1789 }
1814 1790
1815 protected: 1791 protected:
1816 Property(Zone* zone, Expression* obj, Expression* key, int pos) 1792 Property(Zone* zone, Expression* obj, Expression* key, int pos)
(...skipping 23 matching lines...) Expand all
1840 class Call FINAL : public Expression { 1816 class Call FINAL : public Expression {
1841 public: 1817 public:
1842 DECLARE_NODE_TYPE(Call) 1818 DECLARE_NODE_TYPE(Call)
1843 1819
1844 Expression* expression() const { return expression_; } 1820 Expression* expression() const { return expression_; }
1845 ZoneList<Expression*>* arguments() const { return arguments_; } 1821 ZoneList<Expression*>* arguments() const { return arguments_; }
1846 1822
1847 // Type feedback information. 1823 // Type feedback information.
1848 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1824 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1849 Isolate* isolate) OVERRIDE; 1825 Isolate* isolate) OVERRIDE;
1850 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 1826 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
1851 call_feedback_slot_ = slot; 1827 call_feedback_slot_ = slot;
1852 } 1828 }
1853 virtual Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 1829 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::CALL_IC; }
1854 return Code::CALL_IC;
1855 }
1856 1830
1857 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); } 1831 bool HasCallFeedbackSlot() const { return !call_feedback_slot_.IsInvalid(); }
1858 FeedbackVectorICSlot CallFeedbackSlot() const { 1832 FeedbackVectorICSlot CallFeedbackSlot() const {
1859 DCHECK(!call_feedback_slot_.IsInvalid()); 1833 DCHECK(!call_feedback_slot_.IsInvalid());
1860 return call_feedback_slot_; 1834 return call_feedback_slot_;
1861 } 1835 }
1862 1836
1863 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 1837 SmallMapList* GetReceiverTypes() OVERRIDE {
1864 if (expression()->IsProperty()) { 1838 if (expression()->IsProperty()) {
1865 return expression()->AsProperty()->GetReceiverTypes(); 1839 return expression()->AsProperty()->GetReceiverTypes();
1866 } 1840 }
1867 return NULL; 1841 return NULL;
1868 } 1842 }
1869 1843
1870 virtual bool IsMonomorphic() OVERRIDE { 1844 bool IsMonomorphic() OVERRIDE {
1871 if (expression()->IsProperty()) { 1845 if (expression()->IsProperty()) {
1872 return expression()->AsProperty()->IsMonomorphic(); 1846 return expression()->AsProperty()->IsMonomorphic();
1873 } 1847 }
1874 return !target_.is_null(); 1848 return !target_.is_null();
1875 } 1849 }
1876 1850
1877 bool global_call() const { 1851 bool global_call() const {
1878 VariableProxy* proxy = expression_->AsVariableProxy(); 1852 VariableProxy* proxy = expression_->AsVariableProxy();
1879 return proxy != NULL && proxy->var()->IsUnallocated(); 1853 return proxy != NULL && proxy->var()->IsUnallocated();
1880 } 1854 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 DECLARE_NODE_TYPE(CallNew) 1931 DECLARE_NODE_TYPE(CallNew)
1958 1932
1959 Expression* expression() const { return expression_; } 1933 Expression* expression() const { return expression_; }
1960 ZoneList<Expression*>* arguments() const { return arguments_; } 1934 ZoneList<Expression*>* arguments() const { return arguments_; }
1961 1935
1962 // Type feedback information. 1936 // Type feedback information.
1963 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1937 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1964 Isolate* isolate) OVERRIDE { 1938 Isolate* isolate) OVERRIDE {
1965 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); 1939 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0);
1966 } 1940 }
1967 virtual void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1941 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE {
1968 callnew_feedback_slot_ = slot; 1942 callnew_feedback_slot_ = slot;
1969 } 1943 }
1970 1944
1971 FeedbackVectorSlot CallNewFeedbackSlot() { 1945 FeedbackVectorSlot CallNewFeedbackSlot() {
1972 DCHECK(!callnew_feedback_slot_.IsInvalid()); 1946 DCHECK(!callnew_feedback_slot_.IsInvalid());
1973 return callnew_feedback_slot_; 1947 return callnew_feedback_slot_;
1974 } 1948 }
1975 FeedbackVectorSlot AllocationSiteFeedbackSlot() { 1949 FeedbackVectorSlot AllocationSiteFeedbackSlot() {
1976 DCHECK(FLAG_pretenuring_call_new); 1950 DCHECK(FLAG_pretenuring_call_new);
1977 return CallNewFeedbackSlot().next(); 1951 return CallNewFeedbackSlot().next();
1978 } 1952 }
1979 1953
1980 void RecordTypeFeedback(TypeFeedbackOracle* oracle); 1954 void RecordTypeFeedback(TypeFeedbackOracle* oracle);
1981 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } 1955 bool IsMonomorphic() OVERRIDE { return is_monomorphic_; }
1982 Handle<JSFunction> target() const { return target_; } 1956 Handle<JSFunction> target() const { return target_; }
1983 Handle<AllocationSite> allocation_site() const { 1957 Handle<AllocationSite> allocation_site() const {
1984 return allocation_site_; 1958 return allocation_site_;
1985 } 1959 }
1986 1960
1987 static int num_ids() { return parent_num_ids() + 1; } 1961 static int num_ids() { return parent_num_ids() + 1; }
1988 static int feedback_slots() { return 1; } 1962 static int feedback_slots() { return 1; }
1989 BailoutId ReturnId() const { return BailoutId(local_id(0)); } 1963 BailoutId ReturnId() const { return BailoutId(local_id(0)); }
1990 1964
1991 protected: 1965 protected:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 bool is_jsruntime() const { return function_ == NULL; } 2000 bool is_jsruntime() const { return function_ == NULL; }
2027 2001
2028 // Type feedback information. 2002 // Type feedback information.
2029 bool HasCallRuntimeFeedbackSlot() const { 2003 bool HasCallRuntimeFeedbackSlot() const {
2030 return FLAG_vector_ics && is_jsruntime(); 2004 return FLAG_vector_ics && is_jsruntime();
2031 } 2005 }
2032 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2006 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2033 Isolate* isolate) OVERRIDE { 2007 Isolate* isolate) OVERRIDE {
2034 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); 2008 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0);
2035 } 2009 }
2036 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2010 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2037 callruntime_feedback_slot_ = slot; 2011 callruntime_feedback_slot_ = slot;
2038 } 2012 }
2039 virtual Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 2013 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
2040 return Code::LOAD_IC;
2041 }
2042 2014
2043 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 2015 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
2044 DCHECK(!HasCallRuntimeFeedbackSlot() || 2016 DCHECK(!HasCallRuntimeFeedbackSlot() ||
2045 !callruntime_feedback_slot_.IsInvalid()); 2017 !callruntime_feedback_slot_.IsInvalid());
2046 return callruntime_feedback_slot_; 2018 return callruntime_feedback_slot_;
2047 } 2019 }
2048 2020
2049 static int num_ids() { return parent_num_ids() + 1; } 2021 static int num_ids() { return parent_num_ids() + 1; }
2050 TypeFeedbackId CallRuntimeFeedbackId() const { 2022 TypeFeedbackId CallRuntimeFeedbackId() const {
2051 return TypeFeedbackId(local_id(0)); 2023 return TypeFeedbackId(local_id(0));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 2072
2101 Token::Value op_; 2073 Token::Value op_;
2102 Expression* expression_; 2074 Expression* expression_;
2103 }; 2075 };
2104 2076
2105 2077
2106 class BinaryOperation FINAL : public Expression { 2078 class BinaryOperation FINAL : public Expression {
2107 public: 2079 public:
2108 DECLARE_NODE_TYPE(BinaryOperation) 2080 DECLARE_NODE_TYPE(BinaryOperation)
2109 2081
2110 virtual bool ResultOverwriteAllowed() const OVERRIDE; 2082 bool ResultOverwriteAllowed() const OVERRIDE;
2111 2083
2112 Token::Value op() const { return static_cast<Token::Value>(op_); } 2084 Token::Value op() const { return static_cast<Token::Value>(op_); }
2113 Expression* left() const { return left_; } 2085 Expression* left() const { return left_; }
2114 Expression* right() const { return right_; } 2086 Expression* right() const { return right_; }
2115 Handle<AllocationSite> allocation_site() const { return allocation_site_; } 2087 Handle<AllocationSite> allocation_site() const { return allocation_site_; }
2116 void set_allocation_site(Handle<AllocationSite> allocation_site) { 2088 void set_allocation_site(Handle<AllocationSite> allocation_site) {
2117 allocation_site_ = allocation_site; 2089 allocation_site_ = allocation_site;
2118 } 2090 }
2119 2091
2120 // The short-circuit logical operations need an AST ID for their 2092 // The short-circuit logical operations need an AST ID for their
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 bool is_prefix() const { return IsPrefixField::decode(bit_field_); } 2143 bool is_prefix() const { return IsPrefixField::decode(bit_field_); }
2172 bool is_postfix() const { return !is_prefix(); } 2144 bool is_postfix() const { return !is_prefix(); }
2173 2145
2174 Token::Value op() const { return TokenField::decode(bit_field_); } 2146 Token::Value op() const { return TokenField::decode(bit_field_); }
2175 Token::Value binary_op() { 2147 Token::Value binary_op() {
2176 return (op() == Token::INC) ? Token::ADD : Token::SUB; 2148 return (op() == Token::INC) ? Token::ADD : Token::SUB;
2177 } 2149 }
2178 2150
2179 Expression* expression() const { return expression_; } 2151 Expression* expression() const { return expression_; }
2180 2152
2181 virtual bool IsMonomorphic() OVERRIDE { 2153 bool IsMonomorphic() OVERRIDE { return receiver_types_.length() == 1; }
2182 return receiver_types_.length() == 1; 2154 SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; }
2183 } 2155 IcCheckType GetKeyType() const OVERRIDE {
2184 virtual SmallMapList* GetReceiverTypes() OVERRIDE {
2185 return &receiver_types_;
2186 }
2187 virtual IcCheckType GetKeyType() const OVERRIDE {
2188 return KeyTypeField::decode(bit_field_); 2156 return KeyTypeField::decode(bit_field_);
2189 } 2157 }
2190 virtual KeyedAccessStoreMode GetStoreMode() const OVERRIDE { 2158 KeyedAccessStoreMode GetStoreMode() const OVERRIDE {
2191 return StoreModeField::decode(bit_field_); 2159 return StoreModeField::decode(bit_field_);
2192 } 2160 }
2193 Type* type() const { return type_; } 2161 Type* type() const { return type_; }
2194 void set_key_type(IcCheckType type) { 2162 void set_key_type(IcCheckType type) {
2195 bit_field_ = KeyTypeField::update(bit_field_, type); 2163 bit_field_ = KeyTypeField::update(bit_field_, type);
2196 } 2164 }
2197 void set_store_mode(KeyedAccessStoreMode mode) { 2165 void set_store_mode(KeyedAccessStoreMode mode) {
2198 bit_field_ = StoreModeField::update(bit_field_, mode); 2166 bit_field_ = StoreModeField::update(bit_field_, mode);
2199 } 2167 }
2200 void set_type(Type* type) { type_ = type; } 2168 void set_type(Type* type) { type_ = type; }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 BinaryOperation* binary_operation() const { return binary_operation_; } 2293 BinaryOperation* binary_operation() const { return binary_operation_; }
2326 2294
2327 // This check relies on the definition order of token in token.h. 2295 // This check relies on the definition order of token in token.h.
2328 bool is_compound() const { return op() > Token::ASSIGN; } 2296 bool is_compound() const { return op() > Token::ASSIGN; }
2329 2297
2330 static int num_ids() { return parent_num_ids() + 2; } 2298 static int num_ids() { return parent_num_ids() + 2; }
2331 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } 2299 BailoutId AssignmentId() const { return BailoutId(local_id(0)); }
2332 2300
2333 // Type feedback information. 2301 // Type feedback information.
2334 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } 2302 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); }
2335 virtual bool IsMonomorphic() OVERRIDE { 2303 bool IsMonomorphic() OVERRIDE { return receiver_types_.length() == 1; }
2336 return receiver_types_.length() == 1;
2337 }
2338 bool IsUninitialized() const { 2304 bool IsUninitialized() const {
2339 return IsUninitializedField::decode(bit_field_); 2305 return IsUninitializedField::decode(bit_field_);
2340 } 2306 }
2341 bool HasNoTypeInformation() { 2307 bool HasNoTypeInformation() {
2342 return IsUninitializedField::decode(bit_field_); 2308 return IsUninitializedField::decode(bit_field_);
2343 } 2309 }
2344 virtual SmallMapList* GetReceiverTypes() OVERRIDE { 2310 SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; }
2345 return &receiver_types_; 2311 IcCheckType GetKeyType() const OVERRIDE {
2346 }
2347 virtual IcCheckType GetKeyType() const OVERRIDE {
2348 return KeyTypeField::decode(bit_field_); 2312 return KeyTypeField::decode(bit_field_);
2349 } 2313 }
2350 virtual KeyedAccessStoreMode GetStoreMode() const OVERRIDE { 2314 KeyedAccessStoreMode GetStoreMode() const OVERRIDE {
2351 return StoreModeField::decode(bit_field_); 2315 return StoreModeField::decode(bit_field_);
2352 } 2316 }
2353 void set_is_uninitialized(bool b) { 2317 void set_is_uninitialized(bool b) {
2354 bit_field_ = IsUninitializedField::update(bit_field_, b); 2318 bit_field_ = IsUninitializedField::update(bit_field_, b);
2355 } 2319 }
2356 void set_key_type(IcCheckType key_type) { 2320 void set_key_type(IcCheckType key_type) {
2357 bit_field_ = KeyTypeField::update(bit_field_, key_type); 2321 bit_field_ = KeyTypeField::update(bit_field_, key_type);
2358 } 2322 }
2359 void set_store_mode(KeyedAccessStoreMode mode) { 2323 void set_store_mode(KeyedAccessStoreMode mode) {
2360 bit_field_ = StoreModeField::update(bit_field_, mode); 2324 bit_field_ = StoreModeField::update(bit_field_, mode);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 } 2375 }
2412 2376
2413 // Type feedback information. 2377 // Type feedback information.
2414 bool HasFeedbackSlots() const { 2378 bool HasFeedbackSlots() const {
2415 return FLAG_vector_ics && (yield_kind() == kDelegating); 2379 return FLAG_vector_ics && (yield_kind() == kDelegating);
2416 } 2380 }
2417 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2381 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2418 Isolate* isolate) OVERRIDE { 2382 Isolate* isolate) OVERRIDE {
2419 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); 2383 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0);
2420 } 2384 }
2421 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2385 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2422 yield_first_feedback_slot_ = slot; 2386 yield_first_feedback_slot_ = slot;
2423 } 2387 }
2424 virtual Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 2388 Code::Kind FeedbackICSlotKind(int index) OVERRIDE {
2425 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; 2389 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC;
2426 } 2390 }
2427 2391
2428 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { 2392 FeedbackVectorICSlot KeyedLoadFeedbackSlot() {
2429 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); 2393 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid());
2430 return yield_first_feedback_slot_; 2394 return yield_first_feedback_slot_;
2431 } 2395 }
2432 2396
2433 FeedbackVectorICSlot DoneFeedbackSlot() { 2397 FeedbackVectorICSlot DoneFeedbackSlot() {
2434 return KeyedLoadFeedbackSlot().next(); 2398 return KeyedLoadFeedbackSlot().next();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2751 VariableProxy* this_var() const { return this_var_; } 2715 VariableProxy* this_var() const { return this_var_; }
2752 2716
2753 static int num_ids() { return parent_num_ids() + 1; } 2717 static int num_ids() { return parent_num_ids() + 1; }
2754 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } 2718 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
2755 2719
2756 // Type feedback information. 2720 // Type feedback information.
2757 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2721 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2758 Isolate* isolate) OVERRIDE { 2722 Isolate* isolate) OVERRIDE {
2759 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 2723 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
2760 } 2724 }
2761 virtual void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE { 2725 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot) OVERRIDE {
2762 homeobject_feedback_slot_ = slot; 2726 homeobject_feedback_slot_ = slot;
2763 } 2727 }
2764 virtual Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 2728 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; }
2765 return Code::LOAD_IC;
2766 }
2767 2729
2768 FeedbackVectorICSlot HomeObjectFeedbackSlot() { 2730 FeedbackVectorICSlot HomeObjectFeedbackSlot() {
2769 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); 2731 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid());
2770 return homeobject_feedback_slot_; 2732 return homeobject_feedback_slot_;
2771 } 2733 }
2772 2734
2773 protected: 2735 protected:
2774 SuperReference(Zone* zone, VariableProxy* this_var, int pos) 2736 SuperReference(Zone* zone, VariableProxy* this_var, int pos)
2775 : Expression(zone, pos), 2737 : Expression(zone, pos),
2776 this_var_(this_var), 2738 this_var_(this_var),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2825 virtual RegExp##Name* As##Name(); \ 2787 virtual RegExp##Name* As##Name(); \
2826 virtual bool Is##Name(); 2788 virtual bool Is##Name();
2827 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) 2789 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE)
2828 #undef MAKE_ASTYPE 2790 #undef MAKE_ASTYPE
2829 }; 2791 };
2830 2792
2831 2793
2832 class RegExpDisjunction FINAL : public RegExpTree { 2794 class RegExpDisjunction FINAL : public RegExpTree {
2833 public: 2795 public:
2834 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); 2796 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
2835 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2797 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
2836 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2798 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2837 RegExpNode* on_success) OVERRIDE; 2799 RegExpNode* on_success) OVERRIDE;
2838 virtual RegExpDisjunction* AsDisjunction() OVERRIDE; 2800 RegExpDisjunction* AsDisjunction() OVERRIDE;
2839 virtual Interval CaptureRegisters() OVERRIDE; 2801 Interval CaptureRegisters() OVERRIDE;
2840 virtual bool IsDisjunction() OVERRIDE; 2802 bool IsDisjunction() OVERRIDE;
2841 virtual bool IsAnchoredAtStart() OVERRIDE; 2803 bool IsAnchoredAtStart() OVERRIDE;
2842 virtual bool IsAnchoredAtEnd() OVERRIDE; 2804 bool IsAnchoredAtEnd() OVERRIDE;
2843 virtual int min_match() OVERRIDE { return min_match_; } 2805 int min_match() OVERRIDE { return min_match_; }
2844 virtual int max_match() OVERRIDE { return max_match_; } 2806 int max_match() OVERRIDE { return max_match_; }
2845 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } 2807 ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
2846 private: 2808 private:
2847 ZoneList<RegExpTree*>* alternatives_; 2809 ZoneList<RegExpTree*>* alternatives_;
2848 int min_match_; 2810 int min_match_;
2849 int max_match_; 2811 int max_match_;
2850 }; 2812 };
2851 2813
2852 2814
2853 class RegExpAlternative FINAL : public RegExpTree { 2815 class RegExpAlternative FINAL : public RegExpTree {
2854 public: 2816 public:
2855 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); 2817 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
2856 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2818 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
2857 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2819 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2858 RegExpNode* on_success) OVERRIDE; 2820 RegExpNode* on_success) OVERRIDE;
2859 virtual RegExpAlternative* AsAlternative() OVERRIDE; 2821 RegExpAlternative* AsAlternative() OVERRIDE;
2860 virtual Interval CaptureRegisters() OVERRIDE; 2822 Interval CaptureRegisters() OVERRIDE;
2861 virtual bool IsAlternative() OVERRIDE; 2823 bool IsAlternative() OVERRIDE;
2862 virtual bool IsAnchoredAtStart() OVERRIDE; 2824 bool IsAnchoredAtStart() OVERRIDE;
2863 virtual bool IsAnchoredAtEnd() OVERRIDE; 2825 bool IsAnchoredAtEnd() OVERRIDE;
2864 virtual int min_match() OVERRIDE { return min_match_; } 2826 int min_match() OVERRIDE { return min_match_; }
2865 virtual int max_match() OVERRIDE { return max_match_; } 2827 int max_match() OVERRIDE { return max_match_; }
2866 ZoneList<RegExpTree*>* nodes() { return nodes_; } 2828 ZoneList<RegExpTree*>* nodes() { return nodes_; }
2867 private: 2829 private:
2868 ZoneList<RegExpTree*>* nodes_; 2830 ZoneList<RegExpTree*>* nodes_;
2869 int min_match_; 2831 int min_match_;
2870 int max_match_; 2832 int max_match_;
2871 }; 2833 };
2872 2834
2873 2835
2874 class RegExpAssertion FINAL : public RegExpTree { 2836 class RegExpAssertion FINAL : public RegExpTree {
2875 public: 2837 public:
2876 enum AssertionType { 2838 enum AssertionType {
2877 START_OF_LINE, 2839 START_OF_LINE,
2878 START_OF_INPUT, 2840 START_OF_INPUT,
2879 END_OF_LINE, 2841 END_OF_LINE,
2880 END_OF_INPUT, 2842 END_OF_INPUT,
2881 BOUNDARY, 2843 BOUNDARY,
2882 NON_BOUNDARY 2844 NON_BOUNDARY
2883 }; 2845 };
2884 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } 2846 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { }
2885 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2847 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
2886 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2848 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2887 RegExpNode* on_success) OVERRIDE; 2849 RegExpNode* on_success) OVERRIDE;
2888 virtual RegExpAssertion* AsAssertion() OVERRIDE; 2850 RegExpAssertion* AsAssertion() OVERRIDE;
2889 virtual bool IsAssertion() OVERRIDE; 2851 bool IsAssertion() OVERRIDE;
2890 virtual bool IsAnchoredAtStart() OVERRIDE; 2852 bool IsAnchoredAtStart() OVERRIDE;
2891 virtual bool IsAnchoredAtEnd() OVERRIDE; 2853 bool IsAnchoredAtEnd() OVERRIDE;
2892 virtual int min_match() OVERRIDE { return 0; } 2854 int min_match() OVERRIDE { return 0; }
2893 virtual int max_match() OVERRIDE { return 0; } 2855 int max_match() OVERRIDE { return 0; }
2894 AssertionType assertion_type() { return assertion_type_; } 2856 AssertionType assertion_type() { return assertion_type_; }
2895 private: 2857 private:
2896 AssertionType assertion_type_; 2858 AssertionType assertion_type_;
2897 }; 2859 };
2898 2860
2899 2861
2900 class CharacterSet FINAL BASE_EMBEDDED { 2862 class CharacterSet FINAL BASE_EMBEDDED {
2901 public: 2863 public:
2902 explicit CharacterSet(uc16 standard_set_type) 2864 explicit CharacterSet(uc16 standard_set_type)
2903 : ranges_(NULL), 2865 : ranges_(NULL),
(...skipping 17 matching lines...) Expand all
2921 2883
2922 2884
2923 class RegExpCharacterClass FINAL : public RegExpTree { 2885 class RegExpCharacterClass FINAL : public RegExpTree {
2924 public: 2886 public:
2925 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) 2887 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
2926 : set_(ranges), 2888 : set_(ranges),
2927 is_negated_(is_negated) { } 2889 is_negated_(is_negated) { }
2928 explicit RegExpCharacterClass(uc16 type) 2890 explicit RegExpCharacterClass(uc16 type)
2929 : set_(type), 2891 : set_(type),
2930 is_negated_(false) { } 2892 is_negated_(false) { }
2931 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2893 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
2932 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2894 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2933 RegExpNode* on_success) OVERRIDE; 2895 RegExpNode* on_success) OVERRIDE;
2934 virtual RegExpCharacterClass* AsCharacterClass() OVERRIDE; 2896 RegExpCharacterClass* AsCharacterClass() OVERRIDE;
2935 virtual bool IsCharacterClass() OVERRIDE; 2897 bool IsCharacterClass() OVERRIDE;
2936 virtual bool IsTextElement() OVERRIDE { return true; } 2898 bool IsTextElement() OVERRIDE { return true; }
2937 virtual int min_match() OVERRIDE { return 1; } 2899 int min_match() OVERRIDE { return 1; }
2938 virtual int max_match() OVERRIDE { return 1; } 2900 int max_match() OVERRIDE { return 1; }
2939 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; 2901 void AppendToText(RegExpText* text, Zone* zone) OVERRIDE;
2940 CharacterSet character_set() { return set_; } 2902 CharacterSet character_set() { return set_; }
2941 // TODO(lrn): Remove need for complex version if is_standard that 2903 // TODO(lrn): Remove need for complex version if is_standard that
2942 // recognizes a mangled standard set and just do { return set_.is_special(); } 2904 // recognizes a mangled standard set and just do { return set_.is_special(); }
2943 bool is_standard(Zone* zone); 2905 bool is_standard(Zone* zone);
2944 // Returns a value representing the standard character set if is_standard() 2906 // Returns a value representing the standard character set if is_standard()
2945 // returns true. 2907 // returns true.
2946 // Currently used values are: 2908 // Currently used values are:
2947 // s : unicode whitespace 2909 // s : unicode whitespace
2948 // S : unicode non-whitespace 2910 // S : unicode non-whitespace
2949 // w : ASCII word character (digit, letter, underscore) 2911 // w : ASCII word character (digit, letter, underscore)
2950 // W : non-ASCII word character 2912 // W : non-ASCII word character
2951 // d : ASCII digit 2913 // d : ASCII digit
2952 // D : non-ASCII digit 2914 // D : non-ASCII digit
2953 // . : non-unicode non-newline 2915 // . : non-unicode non-newline
2954 // * : All characters 2916 // * : All characters
2955 uc16 standard_type() { return set_.standard_set_type(); } 2917 uc16 standard_type() { return set_.standard_set_type(); }
2956 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } 2918 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); }
2957 bool is_negated() { return is_negated_; } 2919 bool is_negated() { return is_negated_; }
2958 2920
2959 private: 2921 private:
2960 CharacterSet set_; 2922 CharacterSet set_;
2961 bool is_negated_; 2923 bool is_negated_;
2962 }; 2924 };
2963 2925
2964 2926
2965 class RegExpAtom FINAL : public RegExpTree { 2927 class RegExpAtom FINAL : public RegExpTree {
2966 public: 2928 public:
2967 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } 2929 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
2968 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2930 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
2969 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2931 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2970 RegExpNode* on_success) OVERRIDE; 2932 RegExpNode* on_success) OVERRIDE;
2971 virtual RegExpAtom* AsAtom() OVERRIDE; 2933 RegExpAtom* AsAtom() OVERRIDE;
2972 virtual bool IsAtom() OVERRIDE; 2934 bool IsAtom() OVERRIDE;
2973 virtual bool IsTextElement() OVERRIDE { return true; } 2935 bool IsTextElement() OVERRIDE { return true; }
2974 virtual int min_match() OVERRIDE { return data_.length(); } 2936 int min_match() OVERRIDE { return data_.length(); }
2975 virtual int max_match() OVERRIDE { return data_.length(); } 2937 int max_match() OVERRIDE { return data_.length(); }
2976 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; 2938 void AppendToText(RegExpText* text, Zone* zone) OVERRIDE;
2977 Vector<const uc16> data() { return data_; } 2939 Vector<const uc16> data() { return data_; }
2978 int length() { return data_.length(); } 2940 int length() { return data_.length(); }
2979 private: 2941 private:
2980 Vector<const uc16> data_; 2942 Vector<const uc16> data_;
2981 }; 2943 };
2982 2944
2983 2945
2984 class RegExpText FINAL : public RegExpTree { 2946 class RegExpText FINAL : public RegExpTree {
2985 public: 2947 public:
2986 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} 2948 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {}
2987 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2949 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
2988 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2950 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2989 RegExpNode* on_success) OVERRIDE; 2951 RegExpNode* on_success) OVERRIDE;
2990 virtual RegExpText* AsText() OVERRIDE; 2952 RegExpText* AsText() OVERRIDE;
2991 virtual bool IsText() OVERRIDE; 2953 bool IsText() OVERRIDE;
2992 virtual bool IsTextElement() OVERRIDE { return true; } 2954 bool IsTextElement() OVERRIDE { return true; }
2993 virtual int min_match() OVERRIDE { return length_; } 2955 int min_match() OVERRIDE { return length_; }
2994 virtual int max_match() OVERRIDE { return length_; } 2956 int max_match() OVERRIDE { return length_; }
2995 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; 2957 void AppendToText(RegExpText* text, Zone* zone) OVERRIDE;
2996 void AddElement(TextElement elm, Zone* zone) { 2958 void AddElement(TextElement elm, Zone* zone) {
2997 elements_.Add(elm, zone); 2959 elements_.Add(elm, zone);
2998 length_ += elm.length(); 2960 length_ += elm.length();
2999 } 2961 }
3000 ZoneList<TextElement>* elements() { return &elements_; } 2962 ZoneList<TextElement>* elements() { return &elements_; }
3001 private: 2963 private:
3002 ZoneList<TextElement> elements_; 2964 ZoneList<TextElement> elements_;
3003 int length_; 2965 int length_;
3004 }; 2966 };
3005 2967
3006 2968
3007 class RegExpQuantifier FINAL : public RegExpTree { 2969 class RegExpQuantifier FINAL : public RegExpTree {
3008 public: 2970 public:
3009 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; 2971 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE };
3010 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) 2972 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body)
3011 : body_(body), 2973 : body_(body),
3012 min_(min), 2974 min_(min),
3013 max_(max), 2975 max_(max),
3014 min_match_(min * body->min_match()), 2976 min_match_(min * body->min_match()),
3015 quantifier_type_(type) { 2977 quantifier_type_(type) {
3016 if (max > 0 && body->max_match() > kInfinity / max) { 2978 if (max > 0 && body->max_match() > kInfinity / max) {
3017 max_match_ = kInfinity; 2979 max_match_ = kInfinity;
3018 } else { 2980 } else {
3019 max_match_ = max * body->max_match(); 2981 max_match_ = max * body->max_match();
3020 } 2982 }
3021 } 2983 }
3022 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2984 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
3023 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2985 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3024 RegExpNode* on_success) OVERRIDE; 2986 RegExpNode* on_success) OVERRIDE;
3025 static RegExpNode* ToNode(int min, 2987 static RegExpNode* ToNode(int min,
3026 int max, 2988 int max,
3027 bool is_greedy, 2989 bool is_greedy,
3028 RegExpTree* body, 2990 RegExpTree* body,
3029 RegExpCompiler* compiler, 2991 RegExpCompiler* compiler,
3030 RegExpNode* on_success, 2992 RegExpNode* on_success,
3031 bool not_at_start = false); 2993 bool not_at_start = false);
3032 virtual RegExpQuantifier* AsQuantifier() OVERRIDE; 2994 RegExpQuantifier* AsQuantifier() OVERRIDE;
3033 virtual Interval CaptureRegisters() OVERRIDE; 2995 Interval CaptureRegisters() OVERRIDE;
3034 virtual bool IsQuantifier() OVERRIDE; 2996 bool IsQuantifier() OVERRIDE;
3035 virtual int min_match() OVERRIDE { return min_match_; } 2997 int min_match() OVERRIDE { return min_match_; }
3036 virtual int max_match() OVERRIDE { return max_match_; } 2998 int max_match() OVERRIDE { return max_match_; }
3037 int min() { return min_; } 2999 int min() { return min_; }
3038 int max() { return max_; } 3000 int max() { return max_; }
3039 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } 3001 bool is_possessive() { return quantifier_type_ == POSSESSIVE; }
3040 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } 3002 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; }
3041 bool is_greedy() { return quantifier_type_ == GREEDY; } 3003 bool is_greedy() { return quantifier_type_ == GREEDY; }
3042 RegExpTree* body() { return body_; } 3004 RegExpTree* body() { return body_; }
3043 3005
3044 private: 3006 private:
3045 RegExpTree* body_; 3007 RegExpTree* body_;
3046 int min_; 3008 int min_;
3047 int max_; 3009 int max_;
3048 int min_match_; 3010 int min_match_;
3049 int max_match_; 3011 int max_match_;
3050 QuantifierType quantifier_type_; 3012 QuantifierType quantifier_type_;
3051 }; 3013 };
3052 3014
3053 3015
3054 class RegExpCapture FINAL : public RegExpTree { 3016 class RegExpCapture FINAL : public RegExpTree {
3055 public: 3017 public:
3056 explicit RegExpCapture(RegExpTree* body, int index) 3018 explicit RegExpCapture(RegExpTree* body, int index)
3057 : body_(body), index_(index) { } 3019 : body_(body), index_(index) { }
3058 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3020 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
3059 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3021 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3060 RegExpNode* on_success) OVERRIDE; 3022 RegExpNode* on_success) OVERRIDE;
3061 static RegExpNode* ToNode(RegExpTree* body, 3023 static RegExpNode* ToNode(RegExpTree* body,
3062 int index, 3024 int index,
3063 RegExpCompiler* compiler, 3025 RegExpCompiler* compiler,
3064 RegExpNode* on_success); 3026 RegExpNode* on_success);
3065 virtual RegExpCapture* AsCapture() OVERRIDE; 3027 RegExpCapture* AsCapture() OVERRIDE;
3066 virtual bool IsAnchoredAtStart() OVERRIDE; 3028 bool IsAnchoredAtStart() OVERRIDE;
3067 virtual bool IsAnchoredAtEnd() OVERRIDE; 3029 bool IsAnchoredAtEnd() OVERRIDE;
3068 virtual Interval CaptureRegisters() OVERRIDE; 3030 Interval CaptureRegisters() OVERRIDE;
3069 virtual bool IsCapture() OVERRIDE; 3031 bool IsCapture() OVERRIDE;
3070 virtual int min_match() OVERRIDE { return body_->min_match(); } 3032 int min_match() OVERRIDE { return body_->min_match(); }
3071 virtual int max_match() OVERRIDE { return body_->max_match(); } 3033 int max_match() OVERRIDE { return body_->max_match(); }
3072 RegExpTree* body() { return body_; } 3034 RegExpTree* body() { return body_; }
3073 int index() { return index_; } 3035 int index() { return index_; }
3074 static int StartRegister(int index) { return index * 2; } 3036 static int StartRegister(int index) { return index * 2; }
3075 static int EndRegister(int index) { return index * 2 + 1; } 3037 static int EndRegister(int index) { return index * 2 + 1; }
3076 3038
3077 private: 3039 private:
3078 RegExpTree* body_; 3040 RegExpTree* body_;
3079 int index_; 3041 int index_;
3080 }; 3042 };
3081 3043
3082 3044
3083 class RegExpLookahead FINAL : public RegExpTree { 3045 class RegExpLookahead FINAL : public RegExpTree {
3084 public: 3046 public:
3085 RegExpLookahead(RegExpTree* body, 3047 RegExpLookahead(RegExpTree* body,
3086 bool is_positive, 3048 bool is_positive,
3087 int capture_count, 3049 int capture_count,
3088 int capture_from) 3050 int capture_from)
3089 : body_(body), 3051 : body_(body),
3090 is_positive_(is_positive), 3052 is_positive_(is_positive),
3091 capture_count_(capture_count), 3053 capture_count_(capture_count),
3092 capture_from_(capture_from) { } 3054 capture_from_(capture_from) { }
3093 3055
3094 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3056 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
3095 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3057 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3096 RegExpNode* on_success) OVERRIDE; 3058 RegExpNode* on_success) OVERRIDE;
3097 virtual RegExpLookahead* AsLookahead() OVERRIDE; 3059 RegExpLookahead* AsLookahead() OVERRIDE;
3098 virtual Interval CaptureRegisters() OVERRIDE; 3060 Interval CaptureRegisters() OVERRIDE;
3099 virtual bool IsLookahead() OVERRIDE; 3061 bool IsLookahead() OVERRIDE;
3100 virtual bool IsAnchoredAtStart() OVERRIDE; 3062 bool IsAnchoredAtStart() OVERRIDE;
3101 virtual int min_match() OVERRIDE { return 0; } 3063 int min_match() OVERRIDE { return 0; }
3102 virtual int max_match() OVERRIDE { return 0; } 3064 int max_match() OVERRIDE { return 0; }
3103 RegExpTree* body() { return body_; } 3065 RegExpTree* body() { return body_; }
3104 bool is_positive() { return is_positive_; } 3066 bool is_positive() { return is_positive_; }
3105 int capture_count() { return capture_count_; } 3067 int capture_count() { return capture_count_; }
3106 int capture_from() { return capture_from_; } 3068 int capture_from() { return capture_from_; }
3107 3069
3108 private: 3070 private:
3109 RegExpTree* body_; 3071 RegExpTree* body_;
3110 bool is_positive_; 3072 bool is_positive_;
3111 int capture_count_; 3073 int capture_count_;
3112 int capture_from_; 3074 int capture_from_;
3113 }; 3075 };
3114 3076
3115 3077
3116 class RegExpBackReference FINAL : public RegExpTree { 3078 class RegExpBackReference FINAL : public RegExpTree {
3117 public: 3079 public:
3118 explicit RegExpBackReference(RegExpCapture* capture) 3080 explicit RegExpBackReference(RegExpCapture* capture)
3119 : capture_(capture) { } 3081 : capture_(capture) { }
3120 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3082 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
3121 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3083 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3122 RegExpNode* on_success) OVERRIDE; 3084 RegExpNode* on_success) OVERRIDE;
3123 virtual RegExpBackReference* AsBackReference() OVERRIDE; 3085 RegExpBackReference* AsBackReference() OVERRIDE;
3124 virtual bool IsBackReference() OVERRIDE; 3086 bool IsBackReference() OVERRIDE;
3125 virtual int min_match() OVERRIDE { return 0; } 3087 int min_match() OVERRIDE { return 0; }
3126 virtual int max_match() OVERRIDE { return capture_->max_match(); } 3088 int max_match() OVERRIDE { return capture_->max_match(); }
3127 int index() { return capture_->index(); } 3089 int index() { return capture_->index(); }
3128 RegExpCapture* capture() { return capture_; } 3090 RegExpCapture* capture() { return capture_; }
3129 private: 3091 private:
3130 RegExpCapture* capture_; 3092 RegExpCapture* capture_;
3131 }; 3093 };
3132 3094
3133 3095
3134 class RegExpEmpty FINAL : public RegExpTree { 3096 class RegExpEmpty FINAL : public RegExpTree {
3135 public: 3097 public:
3136 RegExpEmpty() { } 3098 RegExpEmpty() { }
3137 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3099 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE;
3138 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3100 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3139 RegExpNode* on_success) OVERRIDE; 3101 RegExpNode* on_success) OVERRIDE;
3140 virtual RegExpEmpty* AsEmpty() OVERRIDE; 3102 RegExpEmpty* AsEmpty() OVERRIDE;
3141 virtual bool IsEmpty() OVERRIDE; 3103 bool IsEmpty() OVERRIDE;
3142 virtual int min_match() OVERRIDE { return 0; } 3104 int min_match() OVERRIDE { return 0; }
3143 virtual int max_match() OVERRIDE { return 0; } 3105 int max_match() OVERRIDE { return 0; }
3144 }; 3106 };
3145 3107
3146 3108
3147 // ---------------------------------------------------------------------------- 3109 // ----------------------------------------------------------------------------
3148 // Out-of-line inline constructors (to side-step cyclic dependencies). 3110 // Out-of-line inline constructors (to side-step cyclic dependencies).
3149 3111
3150 inline ModuleVariable::ModuleVariable(Zone* zone, VariableProxy* proxy, int pos) 3112 inline ModuleVariable::ModuleVariable(Zone* zone, VariableProxy* proxy, int pos)
3151 : Module(zone, proxy->interface(), pos), 3113 : Module(zone, proxy->interface(), pos),
3152 proxy_(proxy) { 3114 proxy_(proxy) {
3153 } 3115 }
(...skipping 17 matching lines...) Expand all
3171 virtual void VisitExpressions(ZoneList<Expression*>* expressions); 3133 virtual void VisitExpressions(ZoneList<Expression*>* expressions);
3172 3134
3173 // Individual AST nodes. 3135 // Individual AST nodes.
3174 #define DEF_VISIT(type) \ 3136 #define DEF_VISIT(type) \
3175 virtual void Visit##type(type* node) = 0; 3137 virtual void Visit##type(type* node) = 0;
3176 AST_NODE_LIST(DEF_VISIT) 3138 AST_NODE_LIST(DEF_VISIT)
3177 #undef DEF_VISIT 3139 #undef DEF_VISIT
3178 }; 3140 };
3179 3141
3180 3142
3181 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ 3143 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
3182 public: \ 3144 public: \
3183 virtual void Visit(AstNode* node) FINAL OVERRIDE { \ 3145 void Visit(AstNode* node) FINAL { \
3184 if (!CheckStackOverflow()) node->Accept(this); \ 3146 if (!CheckStackOverflow()) node->Accept(this); \
3185 } \ 3147 } \
3186 \ 3148 \
3187 void SetStackOverflow() { stack_overflow_ = true; } \ 3149 void SetStackOverflow() { stack_overflow_ = true; } \
3188 void ClearStackOverflow() { stack_overflow_ = false; } \ 3150 void ClearStackOverflow() { stack_overflow_ = false; } \
3189 bool HasStackOverflow() const { return stack_overflow_; } \ 3151 bool HasStackOverflow() const { return stack_overflow_; } \
3190 \ 3152 \
3191 bool CheckStackOverflow() { \ 3153 bool CheckStackOverflow() { \
3192 if (stack_overflow_) return true; \ 3154 if (stack_overflow_) return true; \
3193 StackLimitCheck check(zone_->isolate()); \ 3155 StackLimitCheck check(zone_->isolate()); \
3194 if (!check.HasOverflowed()) return false; \ 3156 if (!check.HasOverflowed()) return false; \
3195 return (stack_overflow_ = true); \ 3157 return (stack_overflow_ = true); \
3196 } \ 3158 } \
3197 \ 3159 \
3198 private: \ 3160 private: \
3199 void InitializeAstVisitor(Zone* zone) { \ 3161 void InitializeAstVisitor(Zone* zone) { \
3200 zone_ = zone; \ 3162 zone_ = zone; \
3201 stack_overflow_ = false; \ 3163 stack_overflow_ = false; \
3202 } \ 3164 } \
3203 Zone* zone() { return zone_; } \ 3165 Zone* zone() { return zone_; } \
3204 Isolate* isolate() { return zone_->isolate(); } \ 3166 Isolate* isolate() { return zone_->isolate(); } \
3205 \ 3167 \
3206 Zone* zone_; \ 3168 Zone* zone_; \
3207 bool stack_overflow_ 3169 bool stack_overflow_
3208 3170
3209 3171
3210 // ---------------------------------------------------------------------------- 3172 // ----------------------------------------------------------------------------
3211 // AstNode factory 3173 // AstNode factory
3212 3174
3213 class AstNodeFactory FINAL BASE_EMBEDDED { 3175 class AstNodeFactory FINAL BASE_EMBEDDED {
3214 public: 3176 public:
3215 explicit AstNodeFactory(AstValueFactory* ast_value_factory) 3177 explicit AstNodeFactory(AstValueFactory* ast_value_factory)
3216 : zone_(ast_value_factory->zone()), 3178 : zone_(ast_value_factory->zone()),
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 3542
3581 private: 3543 private:
3582 Zone* zone_; 3544 Zone* zone_;
3583 AstValueFactory* ast_value_factory_; 3545 AstValueFactory* ast_value_factory_;
3584 }; 3546 };
3585 3547
3586 3548
3587 } } // namespace v8::internal 3549 } } // namespace v8::internal
3588 3550
3589 #endif // V8_AST_H_ 3551 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ast-this-access-visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698