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

Side by Side Diff: src/ast.h

Issue 1088993003: Replace OVERRIDE->override and FINAL->final since we now require C++11. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/assert-scope.cc ('k') | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 #undef DEF_FORWARD_DECLARATION 133 #undef DEF_FORWARD_DECLARATION
134 134
135 135
136 // Typedef only introduced to avoid unreadable code. 136 // Typedef only introduced to avoid unreadable code.
137 // Please do appreciate the required space in "> >". 137 // Please do appreciate the required space in "> >".
138 typedef ZoneList<Handle<String> > ZoneStringList; 138 typedef ZoneList<Handle<String> > ZoneStringList;
139 typedef ZoneList<Handle<Object> > ZoneObjectList; 139 typedef ZoneList<Handle<Object> > ZoneObjectList;
140 140
141 141
142 #define DECLARE_NODE_TYPE(type) \ 142 #define DECLARE_NODE_TYPE(type) \
143 void Accept(AstVisitor* v) OVERRIDE; \ 143 void Accept(AstVisitor* v) override; \
144 AstNode::NodeType node_type() const FINAL { return AstNode::k##type; } \ 144 AstNode::NodeType node_type() const final { return AstNode::k##type; } \
145 friend class AstNodeFactory; 145 friend class AstNodeFactory;
146 146
147 147
148 enum AstPropertiesFlag { 148 enum AstPropertiesFlag {
149 kDontSelfOptimize, 149 kDontSelfOptimize,
150 kDontSoftInline, 150 kDontSoftInline,
151 kDontCache 151 kDontCache
152 }; 152 };
153 153
154 154
155 class FeedbackVectorRequirements { 155 class FeedbackVectorRequirements {
156 public: 156 public:
157 FeedbackVectorRequirements(int slots, int ic_slots) 157 FeedbackVectorRequirements(int slots, int ic_slots)
158 : slots_(slots), ic_slots_(ic_slots) {} 158 : slots_(slots), ic_slots_(ic_slots) {}
159 159
160 int slots() const { return slots_; } 160 int slots() const { return slots_; }
161 int ic_slots() const { return ic_slots_; } 161 int ic_slots() const { return ic_slots_; }
162 162
163 private: 163 private:
164 int slots_; 164 int slots_;
165 int ic_slots_; 165 int ic_slots_;
166 }; 166 };
167 167
168 168
169 class VariableICSlotPair FINAL { 169 class VariableICSlotPair final {
170 public: 170 public:
171 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot) 171 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot)
172 : variable_(variable), slot_(slot) {} 172 : variable_(variable), slot_(slot) {}
173 VariableICSlotPair() 173 VariableICSlotPair()
174 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {} 174 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {}
175 175
176 Variable* variable() const { return variable_; } 176 Variable* variable() const { return variable_; }
177 FeedbackVectorICSlot slot() const { return slot_; } 177 FeedbackVectorICSlot slot() const { return slot_; }
178 178
179 private: 179 private:
180 Variable* variable_; 180 Variable* variable_;
181 FeedbackVectorICSlot slot_; 181 FeedbackVectorICSlot slot_;
182 }; 182 };
183 183
184 184
185 typedef List<VariableICSlotPair> ICSlotCache; 185 typedef List<VariableICSlotPair> ICSlotCache;
186 186
187 187
188 class AstProperties FINAL BASE_EMBEDDED { 188 class AstProperties final BASE_EMBEDDED {
189 public: 189 public:
190 class Flags : public EnumSet<AstPropertiesFlag, int> {}; 190 class Flags : public EnumSet<AstPropertiesFlag, int> {};
191 191
192 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {} 192 explicit AstProperties(Zone* zone) : node_count_(0), spec_(zone) {}
193 193
194 Flags* flags() { return &flags_; } 194 Flags* flags() { return &flags_; }
195 int node_count() { return node_count_; } 195 int node_count() { return node_count_; }
196 void add_node_count(int count) { node_count_ += count; } 196 void add_node_count(int count) { node_count_ += count; }
197 197
198 int slots() const { return spec_.slots(); } 198 int slots() const { return spec_.slots(); }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 class Statement : public AstNode { 277 class Statement : public AstNode {
278 public: 278 public:
279 explicit Statement(Zone* zone, int position) : AstNode(position) {} 279 explicit Statement(Zone* zone, int position) : AstNode(position) {}
280 280
281 bool IsEmpty() { return AsEmptyStatement() != NULL; } 281 bool IsEmpty() { return AsEmptyStatement() != NULL; }
282 virtual bool IsJump() const { return false; } 282 virtual bool IsJump() const { return false; }
283 }; 283 };
284 284
285 285
286 class SmallMapList FINAL { 286 class SmallMapList final {
287 public: 287 public:
288 SmallMapList() {} 288 SmallMapList() {}
289 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} 289 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {}
290 290
291 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } 291 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); }
292 void Clear() { list_.Clear(); } 292 void Clear() { list_.Clear(); }
293 void Sort() { list_.Sort(); } 293 void Sort() { list_.Sort(); }
294 294
295 bool is_empty() const { return list_.is_empty(); } 295 bool is_empty() const { return list_.is_empty(); }
296 int length() const { return list_.length(); } 296 int length() const { return list_.length(); }
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 enum BreakableType { 448 enum BreakableType {
449 TARGET_FOR_ANONYMOUS, 449 TARGET_FOR_ANONYMOUS,
450 TARGET_FOR_NAMED_ONLY 450 TARGET_FOR_NAMED_ONLY
451 }; 451 };
452 452
453 // The labels associated with this statement. May be NULL; 453 // The labels associated with this statement. May be NULL;
454 // if it is != NULL, guaranteed to contain at least one entry. 454 // if it is != NULL, guaranteed to contain at least one entry.
455 ZoneList<const AstRawString*>* labels() const { return labels_; } 455 ZoneList<const AstRawString*>* labels() const { return labels_; }
456 456
457 // Type testing & conversion. 457 // Type testing & conversion.
458 BreakableStatement* AsBreakableStatement() FINAL { return this; } 458 BreakableStatement* AsBreakableStatement() final { return this; }
459 459
460 // Code generation 460 // Code generation
461 Label* break_target() { return &break_target_; } 461 Label* break_target() { return &break_target_; }
462 462
463 // Testers. 463 // Testers.
464 bool is_target_for_anonymous() const { 464 bool is_target_for_anonymous() const {
465 return breakable_type_ == TARGET_FOR_ANONYMOUS; 465 return breakable_type_ == TARGET_FOR_ANONYMOUS;
466 } 466 }
467 467
468 void set_base_id(int id) { base_id_ = id; } 468 void set_base_id(int id) { base_id_ = id; }
(...skipping 20 matching lines...) Expand all
489 private: 489 private:
490 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 490 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
491 491
492 ZoneList<const AstRawString*>* labels_; 492 ZoneList<const AstRawString*>* labels_;
493 BreakableType breakable_type_; 493 BreakableType breakable_type_;
494 Label break_target_; 494 Label break_target_;
495 int base_id_; 495 int base_id_;
496 }; 496 };
497 497
498 498
499 class Block FINAL : public BreakableStatement { 499 class Block final : public BreakableStatement {
500 public: 500 public:
501 DECLARE_NODE_TYPE(Block) 501 DECLARE_NODE_TYPE(Block)
502 502
503 void AddStatement(Statement* statement, Zone* zone) { 503 void AddStatement(Statement* statement, Zone* zone) {
504 statements_.Add(statement, zone); 504 statements_.Add(statement, zone);
505 } 505 }
506 506
507 ZoneList<Statement*>* statements() { return &statements_; } 507 ZoneList<Statement*>* statements() { return &statements_; }
508 bool is_initializer_block() const { return is_initializer_block_; } 508 bool is_initializer_block() const { return is_initializer_block_; }
509 509
510 static int num_ids() { return parent_num_ids() + 1; } 510 static int num_ids() { return parent_num_ids() + 1; }
511 BailoutId DeclsId() const { return BailoutId(local_id(0)); } 511 BailoutId DeclsId() const { return BailoutId(local_id(0)); }
512 512
513 bool IsJump() const OVERRIDE { 513 bool IsJump() const override {
514 return !statements_.is_empty() && statements_.last()->IsJump() 514 return !statements_.is_empty() && statements_.last()->IsJump()
515 && labels() == NULL; // Good enough as an approximation... 515 && labels() == NULL; // Good enough as an approximation...
516 } 516 }
517 517
518 Scope* scope() const { return scope_; } 518 Scope* scope() const { return scope_; }
519 void set_scope(Scope* scope) { scope_ = scope; } 519 void set_scope(Scope* scope) { scope_ = scope; }
520 520
521 protected: 521 protected:
522 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity, 522 Block(Zone* zone, ZoneList<const AstRawString*>* labels, int capacity,
523 bool is_initializer_block, int pos) 523 bool is_initializer_block, int pos)
(...skipping 29 matching lines...) Expand all
553 553
554 private: 554 private:
555 VariableMode mode_; 555 VariableMode mode_;
556 VariableProxy* proxy_; 556 VariableProxy* proxy_;
557 557
558 // Nested scope from which the declaration originated. 558 // Nested scope from which the declaration originated.
559 Scope* scope_; 559 Scope* scope_;
560 }; 560 };
561 561
562 562
563 class VariableDeclaration FINAL : public Declaration { 563 class VariableDeclaration final : public Declaration {
564 public: 564 public:
565 DECLARE_NODE_TYPE(VariableDeclaration) 565 DECLARE_NODE_TYPE(VariableDeclaration)
566 566
567 InitializationFlag initialization() const OVERRIDE { 567 InitializationFlag initialization() const override {
568 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; 568 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization;
569 } 569 }
570 570
571 bool is_class_declaration() const { return is_class_declaration_; } 571 bool is_class_declaration() const { return is_class_declaration_; }
572 572
573 protected: 573 protected:
574 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode, 574 VariableDeclaration(Zone* zone, VariableProxy* proxy, VariableMode mode,
575 Scope* scope, int pos, bool is_class_declaration = false) 575 Scope* scope, int pos, bool is_class_declaration = false)
576 : Declaration(zone, proxy, mode, scope, pos), 576 : Declaration(zone, proxy, mode, scope, pos),
577 is_class_declaration_(is_class_declaration) {} 577 is_class_declaration_(is_class_declaration) {}
578 578
579 bool is_class_declaration_; 579 bool is_class_declaration_;
580 }; 580 };
581 581
582 582
583 class FunctionDeclaration FINAL : public Declaration { 583 class FunctionDeclaration final : public Declaration {
584 public: 584 public:
585 DECLARE_NODE_TYPE(FunctionDeclaration) 585 DECLARE_NODE_TYPE(FunctionDeclaration)
586 586
587 FunctionLiteral* fun() const { return fun_; } 587 FunctionLiteral* fun() const { return fun_; }
588 InitializationFlag initialization() const OVERRIDE { 588 InitializationFlag initialization() const override {
589 return kCreatedInitialized; 589 return kCreatedInitialized;
590 } 590 }
591 bool IsInlineable() const OVERRIDE; 591 bool IsInlineable() const override;
592 592
593 protected: 593 protected:
594 FunctionDeclaration(Zone* zone, 594 FunctionDeclaration(Zone* zone,
595 VariableProxy* proxy, 595 VariableProxy* proxy,
596 VariableMode mode, 596 VariableMode mode,
597 FunctionLiteral* fun, 597 FunctionLiteral* fun,
598 Scope* scope, 598 Scope* scope,
599 int pos) 599 int pos)
600 : Declaration(zone, proxy, mode, scope, pos), 600 : Declaration(zone, proxy, mode, scope, pos),
601 fun_(fun) { 601 fun_(fun) {
602 DCHECK(mode == VAR || mode == LET || mode == CONST); 602 DCHECK(mode == VAR || mode == LET || mode == CONST);
603 DCHECK(fun != NULL); 603 DCHECK(fun != NULL);
604 } 604 }
605 605
606 private: 606 private:
607 FunctionLiteral* fun_; 607 FunctionLiteral* fun_;
608 }; 608 };
609 609
610 610
611 class ModuleDeclaration FINAL : public Declaration { 611 class ModuleDeclaration final : public Declaration {
612 public: 612 public:
613 DECLARE_NODE_TYPE(ModuleDeclaration) 613 DECLARE_NODE_TYPE(ModuleDeclaration)
614 614
615 Module* module() const { return module_; } 615 Module* module() const { return module_; }
616 InitializationFlag initialization() const OVERRIDE { 616 InitializationFlag initialization() const override {
617 return kCreatedInitialized; 617 return kCreatedInitialized;
618 } 618 }
619 619
620 protected: 620 protected:
621 ModuleDeclaration(Zone* zone, VariableProxy* proxy, Module* module, 621 ModuleDeclaration(Zone* zone, VariableProxy* proxy, Module* module,
622 Scope* scope, int pos) 622 Scope* scope, int pos)
623 : Declaration(zone, proxy, CONST, scope, pos), module_(module) {} 623 : Declaration(zone, proxy, CONST, scope, pos), module_(module) {}
624 624
625 private: 625 private:
626 Module* module_; 626 Module* module_;
627 }; 627 };
628 628
629 629
630 class ImportDeclaration FINAL : public Declaration { 630 class ImportDeclaration final : public Declaration {
631 public: 631 public:
632 DECLARE_NODE_TYPE(ImportDeclaration) 632 DECLARE_NODE_TYPE(ImportDeclaration)
633 633
634 const AstRawString* import_name() const { return import_name_; } 634 const AstRawString* import_name() const { return import_name_; }
635 const AstRawString* module_specifier() const { return module_specifier_; } 635 const AstRawString* module_specifier() const { return module_specifier_; }
636 void set_module_specifier(const AstRawString* module_specifier) { 636 void set_module_specifier(const AstRawString* module_specifier) {
637 DCHECK(module_specifier_ == NULL); 637 DCHECK(module_specifier_ == NULL);
638 module_specifier_ = module_specifier; 638 module_specifier_ = module_specifier;
639 } 639 }
640 InitializationFlag initialization() const OVERRIDE { 640 InitializationFlag initialization() const override {
641 return kNeedsInitialization; 641 return kNeedsInitialization;
642 } 642 }
643 643
644 protected: 644 protected:
645 ImportDeclaration(Zone* zone, VariableProxy* proxy, 645 ImportDeclaration(Zone* zone, VariableProxy* proxy,
646 const AstRawString* import_name, 646 const AstRawString* import_name,
647 const AstRawString* module_specifier, Scope* scope, int pos) 647 const AstRawString* module_specifier, Scope* scope, int pos)
648 : Declaration(zone, proxy, IMPORT, scope, pos), 648 : Declaration(zone, proxy, IMPORT, scope, pos),
649 import_name_(import_name), 649 import_name_(import_name),
650 module_specifier_(module_specifier) {} 650 module_specifier_(module_specifier) {}
651 651
652 private: 652 private:
653 const AstRawString* import_name_; 653 const AstRawString* import_name_;
654 const AstRawString* module_specifier_; 654 const AstRawString* module_specifier_;
655 }; 655 };
656 656
657 657
658 class ExportDeclaration FINAL : public Declaration { 658 class ExportDeclaration final : public Declaration {
659 public: 659 public:
660 DECLARE_NODE_TYPE(ExportDeclaration) 660 DECLARE_NODE_TYPE(ExportDeclaration)
661 661
662 InitializationFlag initialization() const OVERRIDE { 662 InitializationFlag initialization() const override {
663 return kCreatedInitialized; 663 return kCreatedInitialized;
664 } 664 }
665 665
666 protected: 666 protected:
667 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos) 667 ExportDeclaration(Zone* zone, VariableProxy* proxy, Scope* scope, int pos)
668 : Declaration(zone, proxy, LET, scope, pos) {} 668 : Declaration(zone, proxy, LET, scope, pos) {}
669 }; 669 };
670 670
671 671
672 class Module : public AstNode { 672 class Module : public AstNode {
673 public: 673 public:
674 ModuleDescriptor* descriptor() const { return descriptor_; } 674 ModuleDescriptor* descriptor() const { return descriptor_; }
675 Block* body() const { return body_; } 675 Block* body() const { return body_; }
676 676
677 protected: 677 protected:
678 Module(Zone* zone, int pos) 678 Module(Zone* zone, int pos)
679 : AstNode(pos), descriptor_(ModuleDescriptor::New(zone)), body_(NULL) {} 679 : AstNode(pos), descriptor_(ModuleDescriptor::New(zone)), body_(NULL) {}
680 Module(Zone* zone, ModuleDescriptor* descriptor, int pos, Block* body = NULL) 680 Module(Zone* zone, ModuleDescriptor* descriptor, int pos, Block* body = NULL)
681 : AstNode(pos), descriptor_(descriptor), body_(body) {} 681 : AstNode(pos), descriptor_(descriptor), body_(body) {}
682 682
683 private: 683 private:
684 ModuleDescriptor* descriptor_; 684 ModuleDescriptor* descriptor_;
685 Block* body_; 685 Block* body_;
686 }; 686 };
687 687
688 688
689 class ModuleLiteral FINAL : public Module { 689 class ModuleLiteral final : public Module {
690 public: 690 public:
691 DECLARE_NODE_TYPE(ModuleLiteral) 691 DECLARE_NODE_TYPE(ModuleLiteral)
692 692
693 protected: 693 protected:
694 ModuleLiteral(Zone* zone, Block* body, ModuleDescriptor* descriptor, int pos) 694 ModuleLiteral(Zone* zone, Block* body, ModuleDescriptor* descriptor, int pos)
695 : Module(zone, descriptor, pos, body) {} 695 : Module(zone, descriptor, pos, body) {}
696 }; 696 };
697 697
698 698
699 class ModulePath FINAL : public Module { 699 class ModulePath final : public Module {
700 public: 700 public:
701 DECLARE_NODE_TYPE(ModulePath) 701 DECLARE_NODE_TYPE(ModulePath)
702 702
703 Module* module() const { return module_; } 703 Module* module() const { return module_; }
704 Handle<String> name() const { return name_->string(); } 704 Handle<String> name() const { return name_->string(); }
705 705
706 protected: 706 protected:
707 ModulePath(Zone* zone, Module* module, const AstRawString* name, int pos) 707 ModulePath(Zone* zone, Module* module, const AstRawString* name, int pos)
708 : Module(zone, pos), module_(module), name_(name) {} 708 : Module(zone, pos), module_(module), name_(name) {}
709 709
710 private: 710 private:
711 Module* module_; 711 Module* module_;
712 const AstRawString* name_; 712 const AstRawString* name_;
713 }; 713 };
714 714
715 715
716 class ModuleUrl FINAL : public Module { 716 class ModuleUrl final : public Module {
717 public: 717 public:
718 DECLARE_NODE_TYPE(ModuleUrl) 718 DECLARE_NODE_TYPE(ModuleUrl)
719 719
720 Handle<String> url() const { return url_; } 720 Handle<String> url() const { return url_; }
721 721
722 protected: 722 protected:
723 ModuleUrl(Zone* zone, Handle<String> url, int pos) 723 ModuleUrl(Zone* zone, Handle<String> url, int pos)
724 : Module(zone, pos), url_(url) { 724 : Module(zone, pos), url_(url) {
725 } 725 }
726 726
727 private: 727 private:
728 Handle<String> url_; 728 Handle<String> url_;
729 }; 729 };
730 730
731 731
732 class ModuleStatement FINAL : public Statement { 732 class ModuleStatement final : public Statement {
733 public: 733 public:
734 DECLARE_NODE_TYPE(ModuleStatement) 734 DECLARE_NODE_TYPE(ModuleStatement)
735 735
736 Block* body() const { return body_; } 736 Block* body() const { return body_; }
737 737
738 protected: 738 protected:
739 ModuleStatement(Zone* zone, Block* body, int pos) 739 ModuleStatement(Zone* zone, Block* body, int pos)
740 : Statement(zone, pos), body_(body) {} 740 : Statement(zone, pos), body_(body) {}
741 741
742 private: 742 private:
743 Block* body_; 743 Block* body_;
744 }; 744 };
745 745
746 746
747 class IterationStatement : public BreakableStatement { 747 class IterationStatement : public BreakableStatement {
748 public: 748 public:
749 // Type testing & conversion. 749 // Type testing & conversion.
750 IterationStatement* AsIterationStatement() FINAL { return this; } 750 IterationStatement* AsIterationStatement() final { return this; }
751 751
752 Statement* body() const { return body_; } 752 Statement* body() const { return body_; }
753 753
754 static int num_ids() { return parent_num_ids() + 1; } 754 static int num_ids() { return parent_num_ids() + 1; }
755 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); } 755 BailoutId OsrEntryId() const { return BailoutId(local_id(0)); }
756 virtual BailoutId ContinueId() const = 0; 756 virtual BailoutId ContinueId() const = 0;
757 virtual BailoutId StackCheckId() const = 0; 757 virtual BailoutId StackCheckId() const = 0;
758 758
759 // Code generation 759 // Code generation
760 Label* continue_target() { return &continue_target_; } 760 Label* continue_target() { return &continue_target_; }
761 761
762 protected: 762 protected:
763 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 763 IterationStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
764 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), 764 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
765 body_(NULL) {} 765 body_(NULL) {}
766 static int parent_num_ids() { return BreakableStatement::num_ids(); } 766 static int parent_num_ids() { return BreakableStatement::num_ids(); }
767 void Initialize(Statement* body) { body_ = body; } 767 void Initialize(Statement* body) { body_ = body; }
768 768
769 private: 769 private:
770 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 770 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
771 771
772 Statement* body_; 772 Statement* body_;
773 Label continue_target_; 773 Label continue_target_;
774 }; 774 };
775 775
776 776
777 class DoWhileStatement FINAL : public IterationStatement { 777 class DoWhileStatement final : public IterationStatement {
778 public: 778 public:
779 DECLARE_NODE_TYPE(DoWhileStatement) 779 DECLARE_NODE_TYPE(DoWhileStatement)
780 780
781 void Initialize(Expression* cond, Statement* body) { 781 void Initialize(Expression* cond, Statement* body) {
782 IterationStatement::Initialize(body); 782 IterationStatement::Initialize(body);
783 cond_ = cond; 783 cond_ = cond;
784 } 784 }
785 785
786 Expression* cond() const { return cond_; } 786 Expression* cond() const { return cond_; }
787 787
788 static int num_ids() { return parent_num_ids() + 2; } 788 static int num_ids() { return parent_num_ids() + 2; }
789 BailoutId ContinueId() const OVERRIDE { return BailoutId(local_id(0)); } 789 BailoutId ContinueId() const override { return BailoutId(local_id(0)); }
790 BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } 790 BailoutId StackCheckId() const override { return BackEdgeId(); }
791 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); } 791 BailoutId BackEdgeId() const { return BailoutId(local_id(1)); }
792 792
793 protected: 793 protected:
794 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 794 DoWhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
795 : IterationStatement(zone, labels, pos), cond_(NULL) {} 795 : IterationStatement(zone, labels, pos), cond_(NULL) {}
796 static int parent_num_ids() { return IterationStatement::num_ids(); } 796 static int parent_num_ids() { return IterationStatement::num_ids(); }
797 797
798 private: 798 private:
799 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 799 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
800 800
801 Expression* cond_; 801 Expression* cond_;
802 }; 802 };
803 803
804 804
805 class WhileStatement FINAL : public IterationStatement { 805 class WhileStatement final : public IterationStatement {
806 public: 806 public:
807 DECLARE_NODE_TYPE(WhileStatement) 807 DECLARE_NODE_TYPE(WhileStatement)
808 808
809 void Initialize(Expression* cond, Statement* body) { 809 void Initialize(Expression* cond, Statement* body) {
810 IterationStatement::Initialize(body); 810 IterationStatement::Initialize(body);
811 cond_ = cond; 811 cond_ = cond;
812 } 812 }
813 813
814 Expression* cond() const { return cond_; } 814 Expression* cond() const { return cond_; }
815 815
816 static int num_ids() { return parent_num_ids() + 1; } 816 static int num_ids() { return parent_num_ids() + 1; }
817 BailoutId ContinueId() const OVERRIDE { return EntryId(); } 817 BailoutId ContinueId() const override { return EntryId(); }
818 BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 818 BailoutId StackCheckId() const override { return BodyId(); }
819 BailoutId BodyId() const { return BailoutId(local_id(0)); } 819 BailoutId BodyId() const { return BailoutId(local_id(0)); }
820 820
821 protected: 821 protected:
822 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 822 WhileStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
823 : IterationStatement(zone, labels, pos), cond_(NULL) {} 823 : IterationStatement(zone, labels, pos), cond_(NULL) {}
824 static int parent_num_ids() { return IterationStatement::num_ids(); } 824 static int parent_num_ids() { return IterationStatement::num_ids(); }
825 825
826 private: 826 private:
827 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 827 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
828 828
829 Expression* cond_; 829 Expression* cond_;
830 }; 830 };
831 831
832 832
833 class ForStatement FINAL : public IterationStatement { 833 class ForStatement final : public IterationStatement {
834 public: 834 public:
835 DECLARE_NODE_TYPE(ForStatement) 835 DECLARE_NODE_TYPE(ForStatement)
836 836
837 void Initialize(Statement* init, 837 void Initialize(Statement* init,
838 Expression* cond, 838 Expression* cond,
839 Statement* next, 839 Statement* next,
840 Statement* body) { 840 Statement* body) {
841 IterationStatement::Initialize(body); 841 IterationStatement::Initialize(body);
842 init_ = init; 842 init_ = init;
843 cond_ = cond; 843 cond_ = cond;
844 next_ = next; 844 next_ = next;
845 } 845 }
846 846
847 Statement* init() const { return init_; } 847 Statement* init() const { return init_; }
848 Expression* cond() const { return cond_; } 848 Expression* cond() const { return cond_; }
849 Statement* next() const { return next_; } 849 Statement* next() const { return next_; }
850 850
851 static int num_ids() { return parent_num_ids() + 2; } 851 static int num_ids() { return parent_num_ids() + 2; }
852 BailoutId ContinueId() const OVERRIDE { return BailoutId(local_id(0)); } 852 BailoutId ContinueId() const override { return BailoutId(local_id(0)); }
853 BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 853 BailoutId StackCheckId() const override { return BodyId(); }
854 BailoutId BodyId() const { return BailoutId(local_id(1)); } 854 BailoutId BodyId() const { return BailoutId(local_id(1)); }
855 855
856 protected: 856 protected:
857 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 857 ForStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
858 : IterationStatement(zone, labels, pos), 858 : IterationStatement(zone, labels, pos),
859 init_(NULL), 859 init_(NULL),
860 cond_(NULL), 860 cond_(NULL),
861 next_(NULL) {} 861 next_(NULL) {}
862 static int parent_num_ids() { return IterationStatement::num_ids(); } 862 static int parent_num_ids() { return IterationStatement::num_ids(); }
863 863
(...skipping 25 matching lines...) Expand all
889 protected: 889 protected:
890 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 890 ForEachStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
891 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {} 891 : IterationStatement(zone, labels, pos), each_(NULL), subject_(NULL) {}
892 892
893 private: 893 private:
894 Expression* each_; 894 Expression* each_;
895 Expression* subject_; 895 Expression* subject_;
896 }; 896 };
897 897
898 898
899 class ForInStatement FINAL : public ForEachStatement { 899 class ForInStatement final : public ForEachStatement {
900 public: 900 public:
901 DECLARE_NODE_TYPE(ForInStatement) 901 DECLARE_NODE_TYPE(ForInStatement)
902 902
903 Expression* enumerable() const { 903 Expression* enumerable() const {
904 return subject(); 904 return subject();
905 } 905 }
906 906
907 // Type feedback information. 907 // Type feedback information.
908 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 908 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
909 Isolate* isolate, const ICSlotCache* cache) OVERRIDE { 909 Isolate* isolate, const ICSlotCache* cache) override {
910 return FeedbackVectorRequirements(1, 0); 910 return FeedbackVectorRequirements(1, 0);
911 } 911 }
912 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 912 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override {
913 for_in_feedback_slot_ = slot; 913 for_in_feedback_slot_ = slot;
914 } 914 }
915 915
916 FeedbackVectorSlot ForInFeedbackSlot() { 916 FeedbackVectorSlot ForInFeedbackSlot() {
917 DCHECK(!for_in_feedback_slot_.IsInvalid()); 917 DCHECK(!for_in_feedback_slot_.IsInvalid());
918 return for_in_feedback_slot_; 918 return for_in_feedback_slot_;
919 } 919 }
920 920
921 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; 921 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN };
922 ForInType for_in_type() const { return for_in_type_; } 922 ForInType for_in_type() const { return for_in_type_; }
923 void set_for_in_type(ForInType type) { for_in_type_ = type; } 923 void set_for_in_type(ForInType type) { for_in_type_ = type; }
924 924
925 static int num_ids() { return parent_num_ids() + 6; } 925 static int num_ids() { return parent_num_ids() + 6; }
926 BailoutId BodyId() const { return BailoutId(local_id(0)); } 926 BailoutId BodyId() const { return BailoutId(local_id(0)); }
927 BailoutId PrepareId() const { return BailoutId(local_id(1)); } 927 BailoutId PrepareId() const { return BailoutId(local_id(1)); }
928 BailoutId EnumId() const { return BailoutId(local_id(2)); } 928 BailoutId EnumId() const { return BailoutId(local_id(2)); }
929 BailoutId ToObjectId() const { return BailoutId(local_id(3)); } 929 BailoutId ToObjectId() const { return BailoutId(local_id(3)); }
930 BailoutId FilterId() const { return BailoutId(local_id(4)); } 930 BailoutId FilterId() const { return BailoutId(local_id(4)); }
931 BailoutId AssignmentId() const { return BailoutId(local_id(5)); } 931 BailoutId AssignmentId() const { return BailoutId(local_id(5)); }
932 BailoutId ContinueId() const OVERRIDE { return EntryId(); } 932 BailoutId ContinueId() const override { return EntryId(); }
933 BailoutId StackCheckId() const OVERRIDE { return BodyId(); } 933 BailoutId StackCheckId() const override { return BodyId(); }
934 934
935 protected: 935 protected:
936 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 936 ForInStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
937 : ForEachStatement(zone, labels, pos), 937 : ForEachStatement(zone, labels, pos),
938 for_in_type_(SLOW_FOR_IN), 938 for_in_type_(SLOW_FOR_IN),
939 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {} 939 for_in_feedback_slot_(FeedbackVectorSlot::Invalid()) {}
940 static int parent_num_ids() { return ForEachStatement::num_ids(); } 940 static int parent_num_ids() { return ForEachStatement::num_ids(); }
941 941
942 private: 942 private:
943 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 943 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
944 944
945 ForInType for_in_type_; 945 ForInType for_in_type_;
946 FeedbackVectorSlot for_in_feedback_slot_; 946 FeedbackVectorSlot for_in_feedback_slot_;
947 }; 947 };
948 948
949 949
950 class ForOfStatement FINAL : public ForEachStatement { 950 class ForOfStatement final : public ForEachStatement {
951 public: 951 public:
952 DECLARE_NODE_TYPE(ForOfStatement) 952 DECLARE_NODE_TYPE(ForOfStatement)
953 953
954 void Initialize(Expression* each, 954 void Initialize(Expression* each,
955 Expression* subject, 955 Expression* subject,
956 Statement* body, 956 Statement* body,
957 Expression* assign_iterator, 957 Expression* assign_iterator,
958 Expression* next_result, 958 Expression* next_result,
959 Expression* result_done, 959 Expression* result_done,
960 Expression* assign_each) { 960 Expression* assign_each) {
(...skipping 21 matching lines...) Expand all
982 // result.done 982 // result.done
983 Expression* result_done() const { 983 Expression* result_done() const {
984 return result_done_; 984 return result_done_;
985 } 985 }
986 986
987 // each = result.value 987 // each = result.value
988 Expression* assign_each() const { 988 Expression* assign_each() const {
989 return assign_each_; 989 return assign_each_;
990 } 990 }
991 991
992 BailoutId ContinueId() const OVERRIDE { return EntryId(); } 992 BailoutId ContinueId() const override { return EntryId(); }
993 BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } 993 BailoutId StackCheckId() const override { return BackEdgeId(); }
994 994
995 static int num_ids() { return parent_num_ids() + 1; } 995 static int num_ids() { return parent_num_ids() + 1; }
996 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); } 996 BailoutId BackEdgeId() const { return BailoutId(local_id(0)); }
997 997
998 protected: 998 protected:
999 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 999 ForOfStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
1000 : ForEachStatement(zone, labels, pos), 1000 : ForEachStatement(zone, labels, pos),
1001 assign_iterator_(NULL), 1001 assign_iterator_(NULL),
1002 next_result_(NULL), 1002 next_result_(NULL),
1003 result_done_(NULL), 1003 result_done_(NULL),
1004 assign_each_(NULL) {} 1004 assign_each_(NULL) {}
1005 static int parent_num_ids() { return ForEachStatement::num_ids(); } 1005 static int parent_num_ids() { return ForEachStatement::num_ids(); }
1006 1006
1007 private: 1007 private:
1008 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1008 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1009 1009
1010 Expression* assign_iterator_; 1010 Expression* assign_iterator_;
1011 Expression* next_result_; 1011 Expression* next_result_;
1012 Expression* result_done_; 1012 Expression* result_done_;
1013 Expression* assign_each_; 1013 Expression* assign_each_;
1014 }; 1014 };
1015 1015
1016 1016
1017 class ExpressionStatement FINAL : public Statement { 1017 class ExpressionStatement final : public Statement {
1018 public: 1018 public:
1019 DECLARE_NODE_TYPE(ExpressionStatement) 1019 DECLARE_NODE_TYPE(ExpressionStatement)
1020 1020
1021 void set_expression(Expression* e) { expression_ = e; } 1021 void set_expression(Expression* e) { expression_ = e; }
1022 Expression* expression() const { return expression_; } 1022 Expression* expression() const { return expression_; }
1023 bool IsJump() const OVERRIDE { return expression_->IsThrow(); } 1023 bool IsJump() const override { return expression_->IsThrow(); }
1024 1024
1025 protected: 1025 protected:
1026 ExpressionStatement(Zone* zone, Expression* expression, int pos) 1026 ExpressionStatement(Zone* zone, Expression* expression, int pos)
1027 : Statement(zone, pos), expression_(expression) { } 1027 : Statement(zone, pos), expression_(expression) { }
1028 1028
1029 private: 1029 private:
1030 Expression* expression_; 1030 Expression* expression_;
1031 }; 1031 };
1032 1032
1033 1033
1034 class JumpStatement : public Statement { 1034 class JumpStatement : public Statement {
1035 public: 1035 public:
1036 bool IsJump() const FINAL { return true; } 1036 bool IsJump() const final { return true; }
1037 1037
1038 protected: 1038 protected:
1039 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {} 1039 explicit JumpStatement(Zone* zone, int pos) : Statement(zone, pos) {}
1040 }; 1040 };
1041 1041
1042 1042
1043 class ContinueStatement FINAL : public JumpStatement { 1043 class ContinueStatement final : public JumpStatement {
1044 public: 1044 public:
1045 DECLARE_NODE_TYPE(ContinueStatement) 1045 DECLARE_NODE_TYPE(ContinueStatement)
1046 1046
1047 IterationStatement* target() const { return target_; } 1047 IterationStatement* target() const { return target_; }
1048 1048
1049 protected: 1049 protected:
1050 explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos) 1050 explicit ContinueStatement(Zone* zone, IterationStatement* target, int pos)
1051 : JumpStatement(zone, pos), target_(target) { } 1051 : JumpStatement(zone, pos), target_(target) { }
1052 1052
1053 private: 1053 private:
1054 IterationStatement* target_; 1054 IterationStatement* target_;
1055 }; 1055 };
1056 1056
1057 1057
1058 class BreakStatement FINAL : public JumpStatement { 1058 class BreakStatement final : public JumpStatement {
1059 public: 1059 public:
1060 DECLARE_NODE_TYPE(BreakStatement) 1060 DECLARE_NODE_TYPE(BreakStatement)
1061 1061
1062 BreakableStatement* target() const { return target_; } 1062 BreakableStatement* target() const { return target_; }
1063 1063
1064 protected: 1064 protected:
1065 explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos) 1065 explicit BreakStatement(Zone* zone, BreakableStatement* target, int pos)
1066 : JumpStatement(zone, pos), target_(target) { } 1066 : JumpStatement(zone, pos), target_(target) { }
1067 1067
1068 private: 1068 private:
1069 BreakableStatement* target_; 1069 BreakableStatement* target_;
1070 }; 1070 };
1071 1071
1072 1072
1073 class ReturnStatement FINAL : public JumpStatement { 1073 class ReturnStatement final : public JumpStatement {
1074 public: 1074 public:
1075 DECLARE_NODE_TYPE(ReturnStatement) 1075 DECLARE_NODE_TYPE(ReturnStatement)
1076 1076
1077 Expression* expression() const { return expression_; } 1077 Expression* expression() const { return expression_; }
1078 1078
1079 protected: 1079 protected:
1080 explicit ReturnStatement(Zone* zone, Expression* expression, int pos) 1080 explicit ReturnStatement(Zone* zone, Expression* expression, int pos)
1081 : JumpStatement(zone, pos), expression_(expression) { } 1081 : JumpStatement(zone, pos), expression_(expression) { }
1082 1082
1083 private: 1083 private:
1084 Expression* expression_; 1084 Expression* expression_;
1085 }; 1085 };
1086 1086
1087 1087
1088 class WithStatement FINAL : public Statement { 1088 class WithStatement final : public Statement {
1089 public: 1089 public:
1090 DECLARE_NODE_TYPE(WithStatement) 1090 DECLARE_NODE_TYPE(WithStatement)
1091 1091
1092 Scope* scope() { return scope_; } 1092 Scope* scope() { return scope_; }
1093 Expression* expression() const { return expression_; } 1093 Expression* expression() const { return expression_; }
1094 Statement* statement() const { return statement_; } 1094 Statement* statement() const { return statement_; }
1095 1095
1096 void set_base_id(int id) { base_id_ = id; } 1096 void set_base_id(int id) { base_id_ = id; }
1097 static int num_ids() { return parent_num_ids() + 1; } 1097 static int num_ids() { return parent_num_ids() + 1; }
1098 BailoutId EntryId() const { return BailoutId(local_id(0)); } 1098 BailoutId EntryId() const { return BailoutId(local_id(0)); }
(...skipping 16 matching lines...) Expand all
1115 private: 1115 private:
1116 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1116 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1117 1117
1118 Scope* scope_; 1118 Scope* scope_;
1119 Expression* expression_; 1119 Expression* expression_;
1120 Statement* statement_; 1120 Statement* statement_;
1121 int base_id_; 1121 int base_id_;
1122 }; 1122 };
1123 1123
1124 1124
1125 class CaseClause FINAL : public Expression { 1125 class CaseClause final : public Expression {
1126 public: 1126 public:
1127 DECLARE_NODE_TYPE(CaseClause) 1127 DECLARE_NODE_TYPE(CaseClause)
1128 1128
1129 bool is_default() const { return label_ == NULL; } 1129 bool is_default() const { return label_ == NULL; }
1130 Expression* label() const { 1130 Expression* label() const {
1131 CHECK(!is_default()); 1131 CHECK(!is_default());
1132 return label_; 1132 return label_;
1133 } 1133 }
1134 Label* body_target() { return &body_target_; } 1134 Label* body_target() { return &body_target_; }
1135 ZoneList<Statement*>* statements() const { return statements_; } 1135 ZoneList<Statement*>* statements() const { return statements_; }
(...skipping 13 matching lines...) Expand all
1149 int pos); 1149 int pos);
1150 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1150 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1151 1151
1152 Expression* label_; 1152 Expression* label_;
1153 Label body_target_; 1153 Label body_target_;
1154 ZoneList<Statement*>* statements_; 1154 ZoneList<Statement*>* statements_;
1155 Type* compare_type_; 1155 Type* compare_type_;
1156 }; 1156 };
1157 1157
1158 1158
1159 class SwitchStatement FINAL : public BreakableStatement { 1159 class SwitchStatement final : public BreakableStatement {
1160 public: 1160 public:
1161 DECLARE_NODE_TYPE(SwitchStatement) 1161 DECLARE_NODE_TYPE(SwitchStatement)
1162 1162
1163 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { 1163 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) {
1164 tag_ = tag; 1164 tag_ = tag;
1165 cases_ = cases; 1165 cases_ = cases;
1166 } 1166 }
1167 1167
1168 Expression* tag() const { return tag_; } 1168 Expression* tag() const { return tag_; }
1169 ZoneList<CaseClause*>* cases() const { return cases_; } 1169 ZoneList<CaseClause*>* cases() const { return cases_; }
1170 1170
1171 protected: 1171 protected:
1172 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos) 1172 SwitchStatement(Zone* zone, ZoneList<const AstRawString*>* labels, int pos)
1173 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos), 1173 : BreakableStatement(zone, labels, TARGET_FOR_ANONYMOUS, pos),
1174 tag_(NULL), 1174 tag_(NULL),
1175 cases_(NULL) {} 1175 cases_(NULL) {}
1176 1176
1177 private: 1177 private:
1178 Expression* tag_; 1178 Expression* tag_;
1179 ZoneList<CaseClause*>* cases_; 1179 ZoneList<CaseClause*>* cases_;
1180 }; 1180 };
1181 1181
1182 1182
1183 // If-statements always have non-null references to their then- and 1183 // If-statements always have non-null references to their then- and
1184 // else-parts. When parsing if-statements with no explicit else-part, 1184 // else-parts. When parsing if-statements with no explicit else-part,
1185 // the parser implicitly creates an empty statement. Use the 1185 // the parser implicitly creates an empty statement. Use the
1186 // HasThenStatement() and HasElseStatement() functions to check if a 1186 // HasThenStatement() and HasElseStatement() functions to check if a
1187 // given if-statement has a then- or an else-part containing code. 1187 // given if-statement has a then- or an else-part containing code.
1188 class IfStatement FINAL : public Statement { 1188 class IfStatement final : public Statement {
1189 public: 1189 public:
1190 DECLARE_NODE_TYPE(IfStatement) 1190 DECLARE_NODE_TYPE(IfStatement)
1191 1191
1192 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } 1192 bool HasThenStatement() const { return !then_statement()->IsEmpty(); }
1193 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } 1193 bool HasElseStatement() const { return !else_statement()->IsEmpty(); }
1194 1194
1195 Expression* condition() const { return condition_; } 1195 Expression* condition() const { return condition_; }
1196 Statement* then_statement() const { return then_statement_; } 1196 Statement* then_statement() const { return then_statement_; }
1197 Statement* else_statement() const { return else_statement_; } 1197 Statement* else_statement() const { return else_statement_; }
1198 1198
1199 bool IsJump() const OVERRIDE { 1199 bool IsJump() const override {
1200 return HasThenStatement() && then_statement()->IsJump() 1200 return HasThenStatement() && then_statement()->IsJump()
1201 && HasElseStatement() && else_statement()->IsJump(); 1201 && HasElseStatement() && else_statement()->IsJump();
1202 } 1202 }
1203 1203
1204 void set_base_id(int id) { base_id_ = id; } 1204 void set_base_id(int id) { base_id_ = id; }
1205 static int num_ids() { return parent_num_ids() + 3; } 1205 static int num_ids() { return parent_num_ids() + 3; }
1206 BailoutId IfId() const { return BailoutId(local_id(0)); } 1206 BailoutId IfId() const { return BailoutId(local_id(0)); }
1207 BailoutId ThenId() const { return BailoutId(local_id(1)); } 1207 BailoutId ThenId() const { return BailoutId(local_id(1)); }
1208 BailoutId ElseId() const { return BailoutId(local_id(2)); } 1208 BailoutId ElseId() const { return BailoutId(local_id(2)); }
1209 1209
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 : Statement(zone, pos), index_(index), try_block_(try_block) {} 1242 : Statement(zone, pos), index_(index), try_block_(try_block) {}
1243 1243
1244 private: 1244 private:
1245 // Unique (per-function) index of this handler. This is not an AST ID. 1245 // Unique (per-function) index of this handler. This is not an AST ID.
1246 int index_; 1246 int index_;
1247 1247
1248 Block* try_block_; 1248 Block* try_block_;
1249 }; 1249 };
1250 1250
1251 1251
1252 class TryCatchStatement FINAL : public TryStatement { 1252 class TryCatchStatement final : public TryStatement {
1253 public: 1253 public:
1254 DECLARE_NODE_TYPE(TryCatchStatement) 1254 DECLARE_NODE_TYPE(TryCatchStatement)
1255 1255
1256 Scope* scope() { return scope_; } 1256 Scope* scope() { return scope_; }
1257 Variable* variable() { return variable_; } 1257 Variable* variable() { return variable_; }
1258 Block* catch_block() const { return catch_block_; } 1258 Block* catch_block() const { return catch_block_; }
1259 1259
1260 protected: 1260 protected:
1261 TryCatchStatement(Zone* zone, 1261 TryCatchStatement(Zone* zone,
1262 int index, 1262 int index,
1263 Block* try_block, 1263 Block* try_block,
1264 Scope* scope, 1264 Scope* scope,
1265 Variable* variable, 1265 Variable* variable,
1266 Block* catch_block, 1266 Block* catch_block,
1267 int pos) 1267 int pos)
1268 : TryStatement(zone, index, try_block, pos), 1268 : TryStatement(zone, index, try_block, pos),
1269 scope_(scope), 1269 scope_(scope),
1270 variable_(variable), 1270 variable_(variable),
1271 catch_block_(catch_block) { 1271 catch_block_(catch_block) {
1272 } 1272 }
1273 1273
1274 private: 1274 private:
1275 Scope* scope_; 1275 Scope* scope_;
1276 Variable* variable_; 1276 Variable* variable_;
1277 Block* catch_block_; 1277 Block* catch_block_;
1278 }; 1278 };
1279 1279
1280 1280
1281 class TryFinallyStatement FINAL : public TryStatement { 1281 class TryFinallyStatement final : public TryStatement {
1282 public: 1282 public:
1283 DECLARE_NODE_TYPE(TryFinallyStatement) 1283 DECLARE_NODE_TYPE(TryFinallyStatement)
1284 1284
1285 Block* finally_block() const { return finally_block_; } 1285 Block* finally_block() const { return finally_block_; }
1286 1286
1287 protected: 1287 protected:
1288 TryFinallyStatement( 1288 TryFinallyStatement(
1289 Zone* zone, int index, Block* try_block, Block* finally_block, int pos) 1289 Zone* zone, int index, Block* try_block, Block* finally_block, int pos)
1290 : TryStatement(zone, index, try_block, pos), 1290 : TryStatement(zone, index, try_block, pos),
1291 finally_block_(finally_block) { } 1291 finally_block_(finally_block) { }
1292 1292
1293 private: 1293 private:
1294 Block* finally_block_; 1294 Block* finally_block_;
1295 }; 1295 };
1296 1296
1297 1297
1298 class DebuggerStatement FINAL : public Statement { 1298 class DebuggerStatement final : public Statement {
1299 public: 1299 public:
1300 DECLARE_NODE_TYPE(DebuggerStatement) 1300 DECLARE_NODE_TYPE(DebuggerStatement)
1301 1301
1302 void set_base_id(int id) { base_id_ = id; } 1302 void set_base_id(int id) { base_id_ = id; }
1303 static int num_ids() { return parent_num_ids() + 1; } 1303 static int num_ids() { return parent_num_ids() + 1; }
1304 BailoutId DebugBreakId() const { return BailoutId(local_id(0)); } 1304 BailoutId DebugBreakId() const { return BailoutId(local_id(0)); }
1305 1305
1306 protected: 1306 protected:
1307 explicit DebuggerStatement(Zone* zone, int pos) 1307 explicit DebuggerStatement(Zone* zone, int pos)
1308 : Statement(zone, pos), base_id_(BailoutId::None().ToInt()) {} 1308 : Statement(zone, pos), base_id_(BailoutId::None().ToInt()) {}
1309 static int parent_num_ids() { return 0; } 1309 static int parent_num_ids() { return 0; }
1310 1310
1311 int base_id() const { 1311 int base_id() const {
1312 DCHECK(!BailoutId(base_id_).IsNone()); 1312 DCHECK(!BailoutId(base_id_).IsNone());
1313 return base_id_; 1313 return base_id_;
1314 } 1314 }
1315 1315
1316 private: 1316 private:
1317 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1317 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1318 1318
1319 int base_id_; 1319 int base_id_;
1320 }; 1320 };
1321 1321
1322 1322
1323 class EmptyStatement FINAL : public Statement { 1323 class EmptyStatement final : public Statement {
1324 public: 1324 public:
1325 DECLARE_NODE_TYPE(EmptyStatement) 1325 DECLARE_NODE_TYPE(EmptyStatement)
1326 1326
1327 protected: 1327 protected:
1328 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {} 1328 explicit EmptyStatement(Zone* zone, int pos): Statement(zone, pos) {}
1329 }; 1329 };
1330 1330
1331 1331
1332 class Literal FINAL : public Expression { 1332 class Literal final : public Expression {
1333 public: 1333 public:
1334 DECLARE_NODE_TYPE(Literal) 1334 DECLARE_NODE_TYPE(Literal)
1335 1335
1336 bool IsPropertyName() const OVERRIDE { return value_->IsPropertyName(); } 1336 bool IsPropertyName() const override { return value_->IsPropertyName(); }
1337 1337
1338 Handle<String> AsPropertyName() { 1338 Handle<String> AsPropertyName() {
1339 DCHECK(IsPropertyName()); 1339 DCHECK(IsPropertyName());
1340 return Handle<String>::cast(value()); 1340 return Handle<String>::cast(value());
1341 } 1341 }
1342 1342
1343 const AstRawString* AsRawPropertyName() { 1343 const AstRawString* AsRawPropertyName() {
1344 DCHECK(IsPropertyName()); 1344 DCHECK(IsPropertyName());
1345 return value_->AsString(); 1345 return value_->AsString();
1346 } 1346 }
1347 1347
1348 bool ToBooleanIsTrue() const OVERRIDE { return value()->BooleanValue(); } 1348 bool ToBooleanIsTrue() const override { return value()->BooleanValue(); }
1349 bool ToBooleanIsFalse() const OVERRIDE { return !value()->BooleanValue(); } 1349 bool ToBooleanIsFalse() const override { return !value()->BooleanValue(); }
1350 1350
1351 Handle<Object> value() const { return value_->value(); } 1351 Handle<Object> value() const { return value_->value(); }
1352 const AstValue* raw_value() const { return value_; } 1352 const AstValue* raw_value() const { return value_; }
1353 1353
1354 // Support for using Literal as a HashMap key. NOTE: Currently, this works 1354 // Support for using Literal as a HashMap key. NOTE: Currently, this works
1355 // only for string and number literals! 1355 // only for string and number literals!
1356 uint32_t Hash(); 1356 uint32_t Hash();
1357 static bool Match(void* literal1, void* literal2); 1357 static bool Match(void* literal1, void* literal2);
1358 1358
1359 static int num_ids() { return parent_num_ids() + 1; } 1359 static int num_ids() { return parent_num_ids() + 1; }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 private: 1419 private:
1420 int literal_index_; 1420 int literal_index_;
1421 bool is_simple_; 1421 bool is_simple_;
1422 int depth_; 1422 int depth_;
1423 }; 1423 };
1424 1424
1425 1425
1426 // Property is used for passing information 1426 // Property is used for passing information
1427 // about an object literal's properties from the parser 1427 // about an object literal's properties from the parser
1428 // to the code generator. 1428 // to the code generator.
1429 class ObjectLiteralProperty FINAL : public ZoneObject { 1429 class ObjectLiteralProperty final : public ZoneObject {
1430 public: 1430 public:
1431 enum Kind { 1431 enum Kind {
1432 CONSTANT, // Property with constant value (compile time). 1432 CONSTANT, // Property with constant value (compile time).
1433 COMPUTED, // Property with computed value (execution time). 1433 COMPUTED, // Property with computed value (execution time).
1434 MATERIALIZED_LITERAL, // Property value is a materialized literal. 1434 MATERIALIZED_LITERAL, // Property value is a materialized literal.
1435 GETTER, SETTER, // Property is an accessor function. 1435 GETTER, SETTER, // Property is an accessor function.
1436 PROTOTYPE // Property is __proto__. 1436 PROTOTYPE // Property is __proto__.
1437 }; 1437 };
1438 1438
1439 Expression* key() { return key_; } 1439 Expression* key() { return key_; }
(...skipping 29 matching lines...) Expand all
1469 Kind kind_; 1469 Kind kind_;
1470 bool emit_store_; 1470 bool emit_store_;
1471 bool is_static_; 1471 bool is_static_;
1472 bool is_computed_name_; 1472 bool is_computed_name_;
1473 Handle<Map> receiver_type_; 1473 Handle<Map> receiver_type_;
1474 }; 1474 };
1475 1475
1476 1476
1477 // An object literal has a boilerplate object that is used 1477 // An object literal has a boilerplate object that is used
1478 // for minimizing the work when constructing it at runtime. 1478 // for minimizing the work when constructing it at runtime.
1479 class ObjectLiteral FINAL : public MaterializedLiteral { 1479 class ObjectLiteral final : public MaterializedLiteral {
1480 public: 1480 public:
1481 typedef ObjectLiteralProperty Property; 1481 typedef ObjectLiteralProperty Property;
1482 1482
1483 DECLARE_NODE_TYPE(ObjectLiteral) 1483 DECLARE_NODE_TYPE(ObjectLiteral)
1484 1484
1485 Handle<FixedArray> constant_properties() const { 1485 Handle<FixedArray> constant_properties() const {
1486 return constant_properties_; 1486 return constant_properties_;
1487 } 1487 }
1488 int properties_count() const { return constant_properties_->length() / 2; } 1488 int properties_count() const { return constant_properties_->length() / 2; }
1489 ZoneList<Property*>* properties() const { return properties_; } 1489 ZoneList<Property*>* properties() const { return properties_; }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 ZoneList<Property*>* properties_; 1553 ZoneList<Property*>* properties_;
1554 int boilerplate_properties_; 1554 int boilerplate_properties_;
1555 bool fast_elements_; 1555 bool fast_elements_;
1556 bool has_elements_; 1556 bool has_elements_;
1557 bool may_store_doubles_; 1557 bool may_store_doubles_;
1558 bool has_function_; 1558 bool has_function_;
1559 }; 1559 };
1560 1560
1561 1561
1562 // Node for capturing a regexp literal. 1562 // Node for capturing a regexp literal.
1563 class RegExpLiteral FINAL : public MaterializedLiteral { 1563 class RegExpLiteral final : public MaterializedLiteral {
1564 public: 1564 public:
1565 DECLARE_NODE_TYPE(RegExpLiteral) 1565 DECLARE_NODE_TYPE(RegExpLiteral)
1566 1566
1567 Handle<String> pattern() const { return pattern_->string(); } 1567 Handle<String> pattern() const { return pattern_->string(); }
1568 Handle<String> flags() const { return flags_->string(); } 1568 Handle<String> flags() const { return flags_->string(); }
1569 1569
1570 protected: 1570 protected:
1571 RegExpLiteral(Zone* zone, const AstRawString* pattern, 1571 RegExpLiteral(Zone* zone, const AstRawString* pattern,
1572 const AstRawString* flags, int literal_index, int pos) 1572 const AstRawString* flags, int literal_index, int pos)
1573 : MaterializedLiteral(zone, literal_index, pos), 1573 : MaterializedLiteral(zone, literal_index, pos),
1574 pattern_(pattern), 1574 pattern_(pattern),
1575 flags_(flags) { 1575 flags_(flags) {
1576 set_depth(1); 1576 set_depth(1);
1577 } 1577 }
1578 1578
1579 private: 1579 private:
1580 const AstRawString* pattern_; 1580 const AstRawString* pattern_;
1581 const AstRawString* flags_; 1581 const AstRawString* flags_;
1582 }; 1582 };
1583 1583
1584 1584
1585 // An array literal has a literals object that is used 1585 // An array literal has a literals object that is used
1586 // for minimizing the work when constructing it at runtime. 1586 // for minimizing the work when constructing it at runtime.
1587 class ArrayLiteral FINAL : public MaterializedLiteral { 1587 class ArrayLiteral final : public MaterializedLiteral {
1588 public: 1588 public:
1589 DECLARE_NODE_TYPE(ArrayLiteral) 1589 DECLARE_NODE_TYPE(ArrayLiteral)
1590 1590
1591 Handle<FixedArray> constant_elements() const { return constant_elements_; } 1591 Handle<FixedArray> constant_elements() const { return constant_elements_; }
1592 ElementsKind constant_elements_kind() const { 1592 ElementsKind constant_elements_kind() const {
1593 DCHECK_EQ(2, constant_elements_->length()); 1593 DCHECK_EQ(2, constant_elements_->length());
1594 return static_cast<ElementsKind>( 1594 return static_cast<ElementsKind>(
1595 Smi::cast(constant_elements_->get(0))->value()); 1595 Smi::cast(constant_elements_->get(0))->value());
1596 } 1596 }
1597 1597
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 static int parent_num_ids() { return MaterializedLiteral::num_ids(); } 1631 static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
1632 1632
1633 private: 1633 private:
1634 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 1634 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
1635 1635
1636 Handle<FixedArray> constant_elements_; 1636 Handle<FixedArray> constant_elements_;
1637 ZoneList<Expression*>* values_; 1637 ZoneList<Expression*>* values_;
1638 }; 1638 };
1639 1639
1640 1640
1641 class VariableProxy FINAL : public Expression { 1641 class VariableProxy final : public Expression {
1642 public: 1642 public:
1643 DECLARE_NODE_TYPE(VariableProxy) 1643 DECLARE_NODE_TYPE(VariableProxy)
1644 1644
1645 bool IsValidReferenceExpression() const OVERRIDE { return !is_this(); } 1645 bool IsValidReferenceExpression() const override { return !is_this(); }
1646 1646
1647 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } 1647 bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
1648 1648
1649 Handle<String> name() const { return raw_name()->string(); } 1649 Handle<String> name() const { return raw_name()->string(); }
1650 const AstRawString* raw_name() const { 1650 const AstRawString* raw_name() const {
1651 return is_resolved() ? var_->raw_name() : raw_name_; 1651 return is_resolved() ? var_->raw_name() : raw_name_;
1652 } 1652 }
1653 1653
1654 Variable* var() const { 1654 Variable* var() const {
1655 DCHECK(is_resolved()); 1655 DCHECK(is_resolved());
(...skipping 20 matching lines...) Expand all
1676 int end_position() const { return end_position_; } 1676 int end_position() const { return end_position_; }
1677 1677
1678 // Bind this proxy to the variable var. 1678 // Bind this proxy to the variable var.
1679 void BindTo(Variable* var); 1679 void BindTo(Variable* var);
1680 1680
1681 bool UsesVariableFeedbackSlot() const { 1681 bool UsesVariableFeedbackSlot() const {
1682 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot()); 1682 return FLAG_vector_ics && (var()->IsUnallocated() || var()->IsLookupSlot());
1683 } 1683 }
1684 1684
1685 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1685 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1686 Isolate* isolate, const ICSlotCache* cache) OVERRIDE; 1686 Isolate* isolate, const ICSlotCache* cache) override;
1687 1687
1688 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 1688 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
1689 ICSlotCache* cache) OVERRIDE; 1689 ICSlotCache* cache) override;
1690 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 1690 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
1691 FeedbackVectorICSlot VariableFeedbackSlot() { 1691 FeedbackVectorICSlot VariableFeedbackSlot() {
1692 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid()); 1692 DCHECK(!UsesVariableFeedbackSlot() || !variable_feedback_slot_.IsInvalid());
1693 return variable_feedback_slot_; 1693 return variable_feedback_slot_;
1694 } 1694 }
1695 1695
1696 protected: 1696 protected:
1697 VariableProxy(Zone* zone, Variable* var, int start_position, 1697 VariableProxy(Zone* zone, Variable* var, int start_position,
1698 int end_position); 1698 int end_position);
1699 1699
1700 VariableProxy(Zone* zone, const AstRawString* name, 1700 VariableProxy(Zone* zone, const AstRawString* name,
(...skipping 12 matching lines...) Expand all
1713 const AstRawString* raw_name_; // if !is_resolved_ 1713 const AstRawString* raw_name_; // if !is_resolved_
1714 Variable* var_; // if is_resolved_ 1714 Variable* var_; // if is_resolved_
1715 }; 1715 };
1716 // Position is stored in the AstNode superclass, but VariableProxy needs to 1716 // Position is stored in the AstNode superclass, but VariableProxy needs to
1717 // know its end position too (for error messages). It cannot be inferred from 1717 // know its end position too (for error messages). It cannot be inferred from
1718 // the variable name length because it can contain escapes. 1718 // the variable name length because it can contain escapes.
1719 int end_position_; 1719 int end_position_;
1720 }; 1720 };
1721 1721
1722 1722
1723 class Property FINAL : public Expression { 1723 class Property final : public Expression {
1724 public: 1724 public:
1725 DECLARE_NODE_TYPE(Property) 1725 DECLARE_NODE_TYPE(Property)
1726 1726
1727 bool IsValidReferenceExpression() const OVERRIDE { return true; } 1727 bool IsValidReferenceExpression() const override { return true; }
1728 1728
1729 Expression* obj() const { return obj_; } 1729 Expression* obj() const { return obj_; }
1730 Expression* key() const { return key_; } 1730 Expression* key() const { return key_; }
1731 1731
1732 static int num_ids() { return parent_num_ids() + 2; } 1732 static int num_ids() { return parent_num_ids() + 2; }
1733 BailoutId LoadId() const { return BailoutId(local_id(0)); } 1733 BailoutId LoadId() const { return BailoutId(local_id(0)); }
1734 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); } 1734 TypeFeedbackId PropertyFeedbackId() { return TypeFeedbackId(local_id(1)); }
1735 1735
1736 bool IsStringAccess() const { 1736 bool IsStringAccess() const {
1737 return IsStringAccessField::decode(bit_field_); 1737 return IsStringAccessField::decode(bit_field_);
1738 } 1738 }
1739 1739
1740 // Type feedback information. 1740 // Type feedback information.
1741 bool IsMonomorphic() OVERRIDE { return receiver_types_.length() == 1; } 1741 bool IsMonomorphic() override { return receiver_types_.length() == 1; }
1742 SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } 1742 SmallMapList* GetReceiverTypes() override { return &receiver_types_; }
1743 KeyedAccessStoreMode GetStoreMode() const OVERRIDE { return STANDARD_STORE; } 1743 KeyedAccessStoreMode GetStoreMode() const override { return STANDARD_STORE; }
1744 IcCheckType GetKeyType() const OVERRIDE { 1744 IcCheckType GetKeyType() const override {
1745 return KeyTypeField::decode(bit_field_); 1745 return KeyTypeField::decode(bit_field_);
1746 } 1746 }
1747 bool IsUninitialized() const { 1747 bool IsUninitialized() const {
1748 return !is_for_call() && HasNoTypeInformation(); 1748 return !is_for_call() && HasNoTypeInformation();
1749 } 1749 }
1750 bool HasNoTypeInformation() const { 1750 bool HasNoTypeInformation() const {
1751 return GetInlineCacheState() == UNINITIALIZED; 1751 return GetInlineCacheState() == UNINITIALIZED;
1752 } 1752 }
1753 InlineCacheState GetInlineCacheState() const { 1753 InlineCacheState GetInlineCacheState() const {
1754 return InlineCacheStateField::decode(bit_field_); 1754 return InlineCacheStateField::decode(bit_field_);
(...skipping 10 matching lines...) Expand all
1765 void mark_for_call() { 1765 void mark_for_call() {
1766 bit_field_ = IsForCallField::update(bit_field_, true); 1766 bit_field_ = IsForCallField::update(bit_field_, true);
1767 } 1767 }
1768 bool is_for_call() const { return IsForCallField::decode(bit_field_); } 1768 bool is_for_call() const { return IsForCallField::decode(bit_field_); }
1769 1769
1770 bool IsSuperAccess() { 1770 bool IsSuperAccess() {
1771 return obj()->IsSuperReference(); 1771 return obj()->IsSuperReference();
1772 } 1772 }
1773 1773
1774 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1774 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1775 Isolate* isolate, const ICSlotCache* cache) OVERRIDE { 1775 Isolate* isolate, const ICSlotCache* cache) override {
1776 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 1776 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
1777 } 1777 }
1778 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 1778 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
1779 ICSlotCache* cache) OVERRIDE { 1779 ICSlotCache* cache) override {
1780 property_feedback_slot_ = slot; 1780 property_feedback_slot_ = slot;
1781 } 1781 }
1782 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 1782 Code::Kind FeedbackICSlotKind(int index) override {
1783 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC; 1783 return key()->IsPropertyName() ? Code::LOAD_IC : Code::KEYED_LOAD_IC;
1784 } 1784 }
1785 1785
1786 FeedbackVectorICSlot PropertyFeedbackSlot() const { 1786 FeedbackVectorICSlot PropertyFeedbackSlot() const {
1787 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid()); 1787 DCHECK(!FLAG_vector_ics || !property_feedback_slot_.IsInvalid());
1788 return property_feedback_slot_; 1788 return property_feedback_slot_;
1789 } 1789 }
1790 1790
1791 protected: 1791 protected:
1792 Property(Zone* zone, Expression* obj, Expression* key, int pos) 1792 Property(Zone* zone, Expression* obj, Expression* key, int pos)
(...skipping 14 matching lines...) Expand all
1807 class KeyTypeField : public BitField8<IcCheckType, 2, 1> {}; 1807 class KeyTypeField : public BitField8<IcCheckType, 2, 1> {};
1808 class InlineCacheStateField : public BitField8<InlineCacheState, 3, 4> {}; 1808 class InlineCacheStateField : public BitField8<InlineCacheState, 3, 4> {};
1809 uint8_t bit_field_; 1809 uint8_t bit_field_;
1810 FeedbackVectorICSlot property_feedback_slot_; 1810 FeedbackVectorICSlot property_feedback_slot_;
1811 Expression* obj_; 1811 Expression* obj_;
1812 Expression* key_; 1812 Expression* key_;
1813 SmallMapList receiver_types_; 1813 SmallMapList receiver_types_;
1814 }; 1814 };
1815 1815
1816 1816
1817 class Call FINAL : public Expression { 1817 class Call final : public Expression {
1818 public: 1818 public:
1819 DECLARE_NODE_TYPE(Call) 1819 DECLARE_NODE_TYPE(Call)
1820 1820
1821 Expression* expression() const { return expression_; } 1821 Expression* expression() const { return expression_; }
1822 ZoneList<Expression*>* arguments() const { return arguments_; } 1822 ZoneList<Expression*>* arguments() const { return arguments_; }
1823 1823
1824 // Type feedback information. 1824 // Type feedback information.
1825 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1825 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1826 Isolate* isolate, const ICSlotCache* cache) OVERRIDE; 1826 Isolate* isolate, const ICSlotCache* cache) override;
1827 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 1827 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
1828 ICSlotCache* cache) OVERRIDE { 1828 ICSlotCache* cache) override {
1829 ic_slot_or_slot_ = slot.ToInt(); 1829 ic_slot_or_slot_ = slot.ToInt();
1830 } 1830 }
1831 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1831 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override {
1832 ic_slot_or_slot_ = slot.ToInt(); 1832 ic_slot_or_slot_ = slot.ToInt();
1833 } 1833 }
1834 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::CALL_IC; } 1834 Code::Kind FeedbackICSlotKind(int index) override { return Code::CALL_IC; }
1835 1835
1836 FeedbackVectorSlot CallFeedbackSlot() const { 1836 FeedbackVectorSlot CallFeedbackSlot() const {
1837 DCHECK(ic_slot_or_slot_ != FeedbackVectorSlot::Invalid().ToInt()); 1837 DCHECK(ic_slot_or_slot_ != FeedbackVectorSlot::Invalid().ToInt());
1838 return FeedbackVectorSlot(ic_slot_or_slot_); 1838 return FeedbackVectorSlot(ic_slot_or_slot_);
1839 } 1839 }
1840 1840
1841 FeedbackVectorICSlot CallFeedbackICSlot() const { 1841 FeedbackVectorICSlot CallFeedbackICSlot() const {
1842 DCHECK(ic_slot_or_slot_ != FeedbackVectorICSlot::Invalid().ToInt()); 1842 DCHECK(ic_slot_or_slot_ != FeedbackVectorICSlot::Invalid().ToInt());
1843 return FeedbackVectorICSlot(ic_slot_or_slot_); 1843 return FeedbackVectorICSlot(ic_slot_or_slot_);
1844 } 1844 }
1845 1845
1846 SmallMapList* GetReceiverTypes() OVERRIDE { 1846 SmallMapList* GetReceiverTypes() override {
1847 if (expression()->IsProperty()) { 1847 if (expression()->IsProperty()) {
1848 return expression()->AsProperty()->GetReceiverTypes(); 1848 return expression()->AsProperty()->GetReceiverTypes();
1849 } 1849 }
1850 return NULL; 1850 return NULL;
1851 } 1851 }
1852 1852
1853 bool IsMonomorphic() OVERRIDE { 1853 bool IsMonomorphic() override {
1854 if (expression()->IsProperty()) { 1854 if (expression()->IsProperty()) {
1855 return expression()->AsProperty()->IsMonomorphic(); 1855 return expression()->AsProperty()->IsMonomorphic();
1856 } 1856 }
1857 return !target_.is_null(); 1857 return !target_.is_null();
1858 } 1858 }
1859 1859
1860 bool global_call() const { 1860 bool global_call() const {
1861 VariableProxy* proxy = expression_->AsVariableProxy(); 1861 VariableProxy* proxy = expression_->AsVariableProxy();
1862 return proxy != NULL && proxy->var()->IsUnallocated(); 1862 return proxy != NULL && proxy->var()->IsUnallocated();
1863 } 1863 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 int ic_slot_or_slot_; 1931 int ic_slot_or_slot_;
1932 Expression* expression_; 1932 Expression* expression_;
1933 ZoneList<Expression*>* arguments_; 1933 ZoneList<Expression*>* arguments_;
1934 Handle<JSFunction> target_; 1934 Handle<JSFunction> target_;
1935 Handle<AllocationSite> allocation_site_; 1935 Handle<AllocationSite> allocation_site_;
1936 class IsUninitializedField : public BitField8<bool, 0, 1> {}; 1936 class IsUninitializedField : public BitField8<bool, 0, 1> {};
1937 uint8_t bit_field_; 1937 uint8_t bit_field_;
1938 }; 1938 };
1939 1939
1940 1940
1941 class CallNew FINAL : public Expression { 1941 class CallNew final : public Expression {
1942 public: 1942 public:
1943 DECLARE_NODE_TYPE(CallNew) 1943 DECLARE_NODE_TYPE(CallNew)
1944 1944
1945 Expression* expression() const { return expression_; } 1945 Expression* expression() const { return expression_; }
1946 ZoneList<Expression*>* arguments() const { return arguments_; } 1946 ZoneList<Expression*>* arguments() const { return arguments_; }
1947 1947
1948 // Type feedback information. 1948 // Type feedback information.
1949 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 1949 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
1950 Isolate* isolate, const ICSlotCache* cache) OVERRIDE { 1950 Isolate* isolate, const ICSlotCache* cache) override {
1951 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0); 1951 return FeedbackVectorRequirements(FLAG_pretenuring_call_new ? 2 : 1, 0);
1952 } 1952 }
1953 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) OVERRIDE { 1953 void SetFirstFeedbackSlot(FeedbackVectorSlot slot) override {
1954 callnew_feedback_slot_ = slot; 1954 callnew_feedback_slot_ = slot;
1955 } 1955 }
1956 1956
1957 FeedbackVectorSlot CallNewFeedbackSlot() { 1957 FeedbackVectorSlot CallNewFeedbackSlot() {
1958 DCHECK(!callnew_feedback_slot_.IsInvalid()); 1958 DCHECK(!callnew_feedback_slot_.IsInvalid());
1959 return callnew_feedback_slot_; 1959 return callnew_feedback_slot_;
1960 } 1960 }
1961 FeedbackVectorSlot AllocationSiteFeedbackSlot() { 1961 FeedbackVectorSlot AllocationSiteFeedbackSlot() {
1962 DCHECK(FLAG_pretenuring_call_new); 1962 DCHECK(FLAG_pretenuring_call_new);
1963 return CallNewFeedbackSlot().next(); 1963 return CallNewFeedbackSlot().next();
1964 } 1964 }
1965 1965
1966 bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } 1966 bool IsMonomorphic() override { return is_monomorphic_; }
1967 Handle<JSFunction> target() const { return target_; } 1967 Handle<JSFunction> target() const { return target_; }
1968 Handle<AllocationSite> allocation_site() const { 1968 Handle<AllocationSite> allocation_site() const {
1969 return allocation_site_; 1969 return allocation_site_;
1970 } 1970 }
1971 1971
1972 static int num_ids() { return parent_num_ids() + 1; } 1972 static int num_ids() { return parent_num_ids() + 1; }
1973 static int feedback_slots() { return 1; } 1973 static int feedback_slots() { return 1; }
1974 BailoutId ReturnId() const { return BailoutId(local_id(0)); } 1974 BailoutId ReturnId() const { return BailoutId(local_id(0)); }
1975 1975
1976 void set_allocation_site(Handle<AllocationSite> site) { 1976 void set_allocation_site(Handle<AllocationSite> site) {
(...skipping 26 matching lines...) Expand all
2003 Handle<JSFunction> target_; 2003 Handle<JSFunction> target_;
2004 Handle<AllocationSite> allocation_site_; 2004 Handle<AllocationSite> allocation_site_;
2005 FeedbackVectorSlot callnew_feedback_slot_; 2005 FeedbackVectorSlot callnew_feedback_slot_;
2006 }; 2006 };
2007 2007
2008 2008
2009 // The CallRuntime class does not represent any official JavaScript 2009 // The CallRuntime class does not represent any official JavaScript
2010 // language construct. Instead it is used to call a C or JS function 2010 // language construct. Instead it is used to call a C or JS function
2011 // with a set of arguments. This is used from the builtins that are 2011 // with a set of arguments. This is used from the builtins that are
2012 // implemented in JavaScript (see "v8natives.js"). 2012 // implemented in JavaScript (see "v8natives.js").
2013 class CallRuntime FINAL : public Expression { 2013 class CallRuntime final : public Expression {
2014 public: 2014 public:
2015 DECLARE_NODE_TYPE(CallRuntime) 2015 DECLARE_NODE_TYPE(CallRuntime)
2016 2016
2017 Handle<String> name() const { return raw_name_->string(); } 2017 Handle<String> name() const { return raw_name_->string(); }
2018 const AstRawString* raw_name() const { return raw_name_; } 2018 const AstRawString* raw_name() const { return raw_name_; }
2019 const Runtime::Function* function() const { return function_; } 2019 const Runtime::Function* function() const { return function_; }
2020 ZoneList<Expression*>* arguments() const { return arguments_; } 2020 ZoneList<Expression*>* arguments() const { return arguments_; }
2021 bool is_jsruntime() const { return function_ == NULL; } 2021 bool is_jsruntime() const { return function_ == NULL; }
2022 2022
2023 // Type feedback information. 2023 // Type feedback information.
2024 bool HasCallRuntimeFeedbackSlot() const { 2024 bool HasCallRuntimeFeedbackSlot() const {
2025 return FLAG_vector_ics && is_jsruntime(); 2025 return FLAG_vector_ics && is_jsruntime();
2026 } 2026 }
2027 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2027 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2028 Isolate* isolate, const ICSlotCache* cache) OVERRIDE { 2028 Isolate* isolate, const ICSlotCache* cache) override {
2029 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0); 2029 return FeedbackVectorRequirements(0, HasCallRuntimeFeedbackSlot() ? 1 : 0);
2030 } 2030 }
2031 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 2031 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2032 ICSlotCache* cache) OVERRIDE { 2032 ICSlotCache* cache) override {
2033 callruntime_feedback_slot_ = slot; 2033 callruntime_feedback_slot_ = slot;
2034 } 2034 }
2035 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 2035 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
2036 2036
2037 FeedbackVectorICSlot CallRuntimeFeedbackSlot() { 2037 FeedbackVectorICSlot CallRuntimeFeedbackSlot() {
2038 DCHECK(!HasCallRuntimeFeedbackSlot() || 2038 DCHECK(!HasCallRuntimeFeedbackSlot() ||
2039 !callruntime_feedback_slot_.IsInvalid()); 2039 !callruntime_feedback_slot_.IsInvalid());
2040 return callruntime_feedback_slot_; 2040 return callruntime_feedback_slot_;
2041 } 2041 }
2042 2042
2043 static int num_ids() { return parent_num_ids() + 1; } 2043 static int num_ids() { return parent_num_ids() + 1; }
2044 TypeFeedbackId CallRuntimeFeedbackId() const { 2044 TypeFeedbackId CallRuntimeFeedbackId() const {
2045 return TypeFeedbackId(local_id(0)); 2045 return TypeFeedbackId(local_id(0));
(...skipping 13 matching lines...) Expand all
2059 private: 2059 private:
2060 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2060 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2061 2061
2062 const AstRawString* raw_name_; 2062 const AstRawString* raw_name_;
2063 const Runtime::Function* function_; 2063 const Runtime::Function* function_;
2064 ZoneList<Expression*>* arguments_; 2064 ZoneList<Expression*>* arguments_;
2065 FeedbackVectorICSlot callruntime_feedback_slot_; 2065 FeedbackVectorICSlot callruntime_feedback_slot_;
2066 }; 2066 };
2067 2067
2068 2068
2069 class UnaryOperation FINAL : public Expression { 2069 class UnaryOperation final : public Expression {
2070 public: 2070 public:
2071 DECLARE_NODE_TYPE(UnaryOperation) 2071 DECLARE_NODE_TYPE(UnaryOperation)
2072 2072
2073 Token::Value op() const { return op_; } 2073 Token::Value op() const { return op_; }
2074 Expression* expression() const { return expression_; } 2074 Expression* expression() const { return expression_; }
2075 2075
2076 // For unary not (Token::NOT), the AST ids where true and false will 2076 // For unary not (Token::NOT), the AST ids where true and false will
2077 // actually be materialized, respectively. 2077 // actually be materialized, respectively.
2078 static int num_ids() { return parent_num_ids() + 2; } 2078 static int num_ids() { return parent_num_ids() + 2; }
2079 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); } 2079 BailoutId MaterializeTrueId() const { return BailoutId(local_id(0)); }
2080 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); } 2080 BailoutId MaterializeFalseId() const { return BailoutId(local_id(1)); }
2081 2081
2082 virtual void RecordToBooleanTypeFeedback( 2082 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override;
2083 TypeFeedbackOracle* oracle) OVERRIDE;
2084 2083
2085 protected: 2084 protected:
2086 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos) 2085 UnaryOperation(Zone* zone, Token::Value op, Expression* expression, int pos)
2087 : Expression(zone, pos), op_(op), expression_(expression) { 2086 : Expression(zone, pos), op_(op), expression_(expression) {
2088 DCHECK(Token::IsUnaryOp(op)); 2087 DCHECK(Token::IsUnaryOp(op));
2089 } 2088 }
2090 static int parent_num_ids() { return Expression::num_ids(); } 2089 static int parent_num_ids() { return Expression::num_ids(); }
2091 2090
2092 private: 2091 private:
2093 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2092 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2094 2093
2095 Token::Value op_; 2094 Token::Value op_;
2096 Expression* expression_; 2095 Expression* expression_;
2097 }; 2096 };
2098 2097
2099 2098
2100 class BinaryOperation FINAL : public Expression { 2099 class BinaryOperation final : public Expression {
2101 public: 2100 public:
2102 DECLARE_NODE_TYPE(BinaryOperation) 2101 DECLARE_NODE_TYPE(BinaryOperation)
2103 2102
2104 Token::Value op() const { return static_cast<Token::Value>(op_); } 2103 Token::Value op() const { return static_cast<Token::Value>(op_); }
2105 Expression* left() const { return left_; } 2104 Expression* left() const { return left_; }
2106 Expression* right() const { return right_; } 2105 Expression* right() const { return right_; }
2107 Handle<AllocationSite> allocation_site() const { return allocation_site_; } 2106 Handle<AllocationSite> allocation_site() const { return allocation_site_; }
2108 void set_allocation_site(Handle<AllocationSite> allocation_site) { 2107 void set_allocation_site(Handle<AllocationSite> allocation_site) {
2109 allocation_site_ = allocation_site; 2108 allocation_site_ = allocation_site;
2110 } 2109 }
2111 2110
2112 // The short-circuit logical operations need an AST ID for their 2111 // The short-circuit logical operations need an AST ID for their
2113 // right-hand subexpression. 2112 // right-hand subexpression.
2114 static int num_ids() { return parent_num_ids() + 2; } 2113 static int num_ids() { return parent_num_ids() + 2; }
2115 BailoutId RightId() const { return BailoutId(local_id(0)); } 2114 BailoutId RightId() const { return BailoutId(local_id(0)); }
2116 2115
2117 TypeFeedbackId BinaryOperationFeedbackId() const { 2116 TypeFeedbackId BinaryOperationFeedbackId() const {
2118 return TypeFeedbackId(local_id(1)); 2117 return TypeFeedbackId(local_id(1));
2119 } 2118 }
2120 Maybe<int> fixed_right_arg() const { 2119 Maybe<int> fixed_right_arg() const {
2121 return has_fixed_right_arg_ ? Just(fixed_right_arg_value_) : Nothing<int>(); 2120 return has_fixed_right_arg_ ? Just(fixed_right_arg_value_) : Nothing<int>();
2122 } 2121 }
2123 void set_fixed_right_arg(Maybe<int> arg) { 2122 void set_fixed_right_arg(Maybe<int> arg) {
2124 has_fixed_right_arg_ = arg.IsJust(); 2123 has_fixed_right_arg_ = arg.IsJust();
2125 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust(); 2124 if (arg.IsJust()) fixed_right_arg_value_ = arg.FromJust();
2126 } 2125 }
2127 2126
2128 virtual void RecordToBooleanTypeFeedback( 2127 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) override;
2129 TypeFeedbackOracle* oracle) OVERRIDE;
2130 2128
2131 protected: 2129 protected:
2132 BinaryOperation(Zone* zone, Token::Value op, Expression* left, 2130 BinaryOperation(Zone* zone, Token::Value op, Expression* left,
2133 Expression* right, int pos) 2131 Expression* right, int pos)
2134 : Expression(zone, pos), 2132 : Expression(zone, pos),
2135 op_(static_cast<byte>(op)), 2133 op_(static_cast<byte>(op)),
2136 has_fixed_right_arg_(false), 2134 has_fixed_right_arg_(false),
2137 fixed_right_arg_value_(0), 2135 fixed_right_arg_value_(0),
2138 left_(left), 2136 left_(left),
2139 right_(right) { 2137 right_(right) {
2140 DCHECK(Token::IsBinaryOp(op)); 2138 DCHECK(Token::IsBinaryOp(op));
2141 } 2139 }
2142 static int parent_num_ids() { return Expression::num_ids(); } 2140 static int parent_num_ids() { return Expression::num_ids(); }
2143 2141
2144 private: 2142 private:
2145 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2143 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2146 2144
2147 const byte op_; // actually Token::Value 2145 const byte op_; // actually Token::Value
2148 // TODO(rossberg): the fixed arg should probably be represented as a Constant 2146 // TODO(rossberg): the fixed arg should probably be represented as a Constant
2149 // type for the RHS. Currenty it's actually a Maybe<int> 2147 // type for the RHS. Currenty it's actually a Maybe<int>
2150 bool has_fixed_right_arg_; 2148 bool has_fixed_right_arg_;
2151 int fixed_right_arg_value_; 2149 int fixed_right_arg_value_;
2152 Expression* left_; 2150 Expression* left_;
2153 Expression* right_; 2151 Expression* right_;
2154 Handle<AllocationSite> allocation_site_; 2152 Handle<AllocationSite> allocation_site_;
2155 }; 2153 };
2156 2154
2157 2155
2158 class CountOperation FINAL : public Expression { 2156 class CountOperation final : public Expression {
2159 public: 2157 public:
2160 DECLARE_NODE_TYPE(CountOperation) 2158 DECLARE_NODE_TYPE(CountOperation)
2161 2159
2162 bool is_prefix() const { return IsPrefixField::decode(bit_field_); } 2160 bool is_prefix() const { return IsPrefixField::decode(bit_field_); }
2163 bool is_postfix() const { return !is_prefix(); } 2161 bool is_postfix() const { return !is_prefix(); }
2164 2162
2165 Token::Value op() const { return TokenField::decode(bit_field_); } 2163 Token::Value op() const { return TokenField::decode(bit_field_); }
2166 Token::Value binary_op() { 2164 Token::Value binary_op() {
2167 return (op() == Token::INC) ? Token::ADD : Token::SUB; 2165 return (op() == Token::INC) ? Token::ADD : Token::SUB;
2168 } 2166 }
2169 2167
2170 Expression* expression() const { return expression_; } 2168 Expression* expression() const { return expression_; }
2171 2169
2172 bool IsMonomorphic() OVERRIDE { return receiver_types_.length() == 1; } 2170 bool IsMonomorphic() override { return receiver_types_.length() == 1; }
2173 SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } 2171 SmallMapList* GetReceiverTypes() override { return &receiver_types_; }
2174 IcCheckType GetKeyType() const OVERRIDE { 2172 IcCheckType GetKeyType() const override {
2175 return KeyTypeField::decode(bit_field_); 2173 return KeyTypeField::decode(bit_field_);
2176 } 2174 }
2177 KeyedAccessStoreMode GetStoreMode() const OVERRIDE { 2175 KeyedAccessStoreMode GetStoreMode() const override {
2178 return StoreModeField::decode(bit_field_); 2176 return StoreModeField::decode(bit_field_);
2179 } 2177 }
2180 Type* type() const { return type_; } 2178 Type* type() const { return type_; }
2181 void set_key_type(IcCheckType type) { 2179 void set_key_type(IcCheckType type) {
2182 bit_field_ = KeyTypeField::update(bit_field_, type); 2180 bit_field_ = KeyTypeField::update(bit_field_, type);
2183 } 2181 }
2184 void set_store_mode(KeyedAccessStoreMode mode) { 2182 void set_store_mode(KeyedAccessStoreMode mode) {
2185 bit_field_ = StoreModeField::update(bit_field_, mode); 2183 bit_field_ = StoreModeField::update(bit_field_, mode);
2186 } 2184 }
2187 void set_type(Type* type) { type_ = type; } 2185 void set_type(Type* type) { type_ = type; }
(...skipping 30 matching lines...) Expand all
2218 2216
2219 // Starts with 16-bit field, which should get packed together with 2217 // Starts with 16-bit field, which should get packed together with
2220 // Expression's trailing 16-bit field. 2218 // Expression's trailing 16-bit field.
2221 uint16_t bit_field_; 2219 uint16_t bit_field_;
2222 Type* type_; 2220 Type* type_;
2223 Expression* expression_; 2221 Expression* expression_;
2224 SmallMapList receiver_types_; 2222 SmallMapList receiver_types_;
2225 }; 2223 };
2226 2224
2227 2225
2228 class CompareOperation FINAL : public Expression { 2226 class CompareOperation final : public Expression {
2229 public: 2227 public:
2230 DECLARE_NODE_TYPE(CompareOperation) 2228 DECLARE_NODE_TYPE(CompareOperation)
2231 2229
2232 Token::Value op() const { return op_; } 2230 Token::Value op() const { return op_; }
2233 Expression* left() const { return left_; } 2231 Expression* left() const { return left_; }
2234 Expression* right() const { return right_; } 2232 Expression* right() const { return right_; }
2235 2233
2236 // Type feedback information. 2234 // Type feedback information.
2237 static int num_ids() { return parent_num_ids() + 1; } 2235 static int num_ids() { return parent_num_ids() + 1; }
2238 TypeFeedbackId CompareOperationFeedbackId() const { 2236 TypeFeedbackId CompareOperationFeedbackId() const {
(...skipping 23 matching lines...) Expand all
2262 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2260 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2263 2261
2264 Token::Value op_; 2262 Token::Value op_;
2265 Expression* left_; 2263 Expression* left_;
2266 Expression* right_; 2264 Expression* right_;
2267 2265
2268 Type* combined_type_; 2266 Type* combined_type_;
2269 }; 2267 };
2270 2268
2271 2269
2272 class Spread FINAL : public Expression { 2270 class Spread final : public Expression {
2273 public: 2271 public:
2274 DECLARE_NODE_TYPE(Spread) 2272 DECLARE_NODE_TYPE(Spread)
2275 2273
2276 Expression* expression() const { return expression_; } 2274 Expression* expression() const { return expression_; }
2277 2275
2278 static int num_ids() { return parent_num_ids(); } 2276 static int num_ids() { return parent_num_ids(); }
2279 2277
2280 protected: 2278 protected:
2281 Spread(Zone* zone, Expression* expression, int pos) 2279 Spread(Zone* zone, Expression* expression, int pos)
2282 : Expression(zone, pos), expression_(expression) {} 2280 : Expression(zone, pos), expression_(expression) {}
2283 static int parent_num_ids() { return Expression::num_ids(); } 2281 static int parent_num_ids() { return Expression::num_ids(); }
2284 2282
2285 private: 2283 private:
2286 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2284 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2287 2285
2288 Expression* expression_; 2286 Expression* expression_;
2289 }; 2287 };
2290 2288
2291 2289
2292 class Conditional FINAL : public Expression { 2290 class Conditional final : public Expression {
2293 public: 2291 public:
2294 DECLARE_NODE_TYPE(Conditional) 2292 DECLARE_NODE_TYPE(Conditional)
2295 2293
2296 Expression* condition() const { return condition_; } 2294 Expression* condition() const { return condition_; }
2297 Expression* then_expression() const { return then_expression_; } 2295 Expression* then_expression() const { return then_expression_; }
2298 Expression* else_expression() const { return else_expression_; } 2296 Expression* else_expression() const { return else_expression_; }
2299 2297
2300 static int num_ids() { return parent_num_ids() + 2; } 2298 static int num_ids() { return parent_num_ids() + 2; }
2301 BailoutId ThenId() const { return BailoutId(local_id(0)); } 2299 BailoutId ThenId() const { return BailoutId(local_id(0)); }
2302 BailoutId ElseId() const { return BailoutId(local_id(1)); } 2300 BailoutId ElseId() const { return BailoutId(local_id(1)); }
2303 2301
2304 protected: 2302 protected:
2305 Conditional(Zone* zone, Expression* condition, Expression* then_expression, 2303 Conditional(Zone* zone, Expression* condition, Expression* then_expression,
2306 Expression* else_expression, int position) 2304 Expression* else_expression, int position)
2307 : Expression(zone, position), 2305 : Expression(zone, position),
2308 condition_(condition), 2306 condition_(condition),
2309 then_expression_(then_expression), 2307 then_expression_(then_expression),
2310 else_expression_(else_expression) {} 2308 else_expression_(else_expression) {}
2311 static int parent_num_ids() { return Expression::num_ids(); } 2309 static int parent_num_ids() { return Expression::num_ids(); }
2312 2310
2313 private: 2311 private:
2314 int local_id(int n) const { return base_id() + parent_num_ids() + n; } 2312 int local_id(int n) const { return base_id() + parent_num_ids() + n; }
2315 2313
2316 Expression* condition_; 2314 Expression* condition_;
2317 Expression* then_expression_; 2315 Expression* then_expression_;
2318 Expression* else_expression_; 2316 Expression* else_expression_;
2319 }; 2317 };
2320 2318
2321 2319
2322 class Assignment FINAL : public Expression { 2320 class Assignment final : public Expression {
2323 public: 2321 public:
2324 DECLARE_NODE_TYPE(Assignment) 2322 DECLARE_NODE_TYPE(Assignment)
2325 2323
2326 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } 2324 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; }
2327 2325
2328 Token::Value binary_op() const; 2326 Token::Value binary_op() const;
2329 2327
2330 Token::Value op() const { return TokenField::decode(bit_field_); } 2328 Token::Value op() const { return TokenField::decode(bit_field_); }
2331 Expression* target() const { return target_; } 2329 Expression* target() const { return target_; }
2332 Expression* value() const { return value_; } 2330 Expression* value() const { return value_; }
2333 BinaryOperation* binary_operation() const { return binary_operation_; } 2331 BinaryOperation* binary_operation() const { return binary_operation_; }
2334 2332
2335 // This check relies on the definition order of token in token.h. 2333 // This check relies on the definition order of token in token.h.
2336 bool is_compound() const { return op() > Token::ASSIGN; } 2334 bool is_compound() const { return op() > Token::ASSIGN; }
2337 2335
2338 static int num_ids() { return parent_num_ids() + 2; } 2336 static int num_ids() { return parent_num_ids() + 2; }
2339 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } 2337 BailoutId AssignmentId() const { return BailoutId(local_id(0)); }
2340 2338
2341 // Type feedback information. 2339 // Type feedback information.
2342 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } 2340 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); }
2343 bool IsMonomorphic() OVERRIDE { return receiver_types_.length() == 1; } 2341 bool IsMonomorphic() override { return receiver_types_.length() == 1; }
2344 bool IsUninitialized() const { 2342 bool IsUninitialized() const {
2345 return IsUninitializedField::decode(bit_field_); 2343 return IsUninitializedField::decode(bit_field_);
2346 } 2344 }
2347 bool HasNoTypeInformation() { 2345 bool HasNoTypeInformation() {
2348 return IsUninitializedField::decode(bit_field_); 2346 return IsUninitializedField::decode(bit_field_);
2349 } 2347 }
2350 SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } 2348 SmallMapList* GetReceiverTypes() override { return &receiver_types_; }
2351 IcCheckType GetKeyType() const OVERRIDE { 2349 IcCheckType GetKeyType() const override {
2352 return KeyTypeField::decode(bit_field_); 2350 return KeyTypeField::decode(bit_field_);
2353 } 2351 }
2354 KeyedAccessStoreMode GetStoreMode() const OVERRIDE { 2352 KeyedAccessStoreMode GetStoreMode() const override {
2355 return StoreModeField::decode(bit_field_); 2353 return StoreModeField::decode(bit_field_);
2356 } 2354 }
2357 void set_is_uninitialized(bool b) { 2355 void set_is_uninitialized(bool b) {
2358 bit_field_ = IsUninitializedField::update(bit_field_, b); 2356 bit_field_ = IsUninitializedField::update(bit_field_, b);
2359 } 2357 }
2360 void set_key_type(IcCheckType key_type) { 2358 void set_key_type(IcCheckType key_type) {
2361 bit_field_ = KeyTypeField::update(bit_field_, key_type); 2359 bit_field_ = KeyTypeField::update(bit_field_, key_type);
2362 } 2360 }
2363 void set_store_mode(KeyedAccessStoreMode mode) { 2361 void set_store_mode(KeyedAccessStoreMode mode) {
2364 bit_field_ = StoreModeField::update(bit_field_, mode); 2362 bit_field_ = StoreModeField::update(bit_field_, mode);
(...skipping 15 matching lines...) Expand all
2380 // Starts with 16-bit field, which should get packed together with 2378 // Starts with 16-bit field, which should get packed together with
2381 // Expression's trailing 16-bit field. 2379 // Expression's trailing 16-bit field.
2382 uint16_t bit_field_; 2380 uint16_t bit_field_;
2383 Expression* target_; 2381 Expression* target_;
2384 Expression* value_; 2382 Expression* value_;
2385 BinaryOperation* binary_operation_; 2383 BinaryOperation* binary_operation_;
2386 SmallMapList receiver_types_; 2384 SmallMapList receiver_types_;
2387 }; 2385 };
2388 2386
2389 2387
2390 class Yield FINAL : public Expression { 2388 class Yield final : public Expression {
2391 public: 2389 public:
2392 DECLARE_NODE_TYPE(Yield) 2390 DECLARE_NODE_TYPE(Yield)
2393 2391
2394 enum Kind { 2392 enum Kind {
2395 kInitial, // The initial yield that returns the unboxed generator object. 2393 kInitial, // The initial yield that returns the unboxed generator object.
2396 kSuspend, // A normal yield: { value: EXPRESSION, done: false } 2394 kSuspend, // A normal yield: { value: EXPRESSION, done: false }
2397 kDelegating, // A yield*. 2395 kDelegating, // A yield*.
2398 kFinal // A return: { value: EXPRESSION, done: true } 2396 kFinal // A return: { value: EXPRESSION, done: true }
2399 }; 2397 };
2400 2398
(...skipping 11 matching lines...) Expand all
2412 void set_index(int index) { 2410 void set_index(int index) {
2413 DCHECK_EQ(kDelegating, yield_kind()); 2411 DCHECK_EQ(kDelegating, yield_kind());
2414 index_ = index; 2412 index_ = index;
2415 } 2413 }
2416 2414
2417 // Type feedback information. 2415 // Type feedback information.
2418 bool HasFeedbackSlots() const { 2416 bool HasFeedbackSlots() const {
2419 return FLAG_vector_ics && (yield_kind() == kDelegating); 2417 return FLAG_vector_ics && (yield_kind() == kDelegating);
2420 } 2418 }
2421 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2419 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2422 Isolate* isolate, const ICSlotCache* cache) OVERRIDE { 2420 Isolate* isolate, const ICSlotCache* cache) override {
2423 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0); 2421 return FeedbackVectorRequirements(0, HasFeedbackSlots() ? 3 : 0);
2424 } 2422 }
2425 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 2423 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2426 ICSlotCache* cache) OVERRIDE { 2424 ICSlotCache* cache) override {
2427 yield_first_feedback_slot_ = slot; 2425 yield_first_feedback_slot_ = slot;
2428 } 2426 }
2429 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { 2427 Code::Kind FeedbackICSlotKind(int index) override {
2430 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC; 2428 return index == 0 ? Code::KEYED_LOAD_IC : Code::LOAD_IC;
2431 } 2429 }
2432 2430
2433 FeedbackVectorICSlot KeyedLoadFeedbackSlot() { 2431 FeedbackVectorICSlot KeyedLoadFeedbackSlot() {
2434 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid()); 2432 DCHECK(!HasFeedbackSlots() || !yield_first_feedback_slot_.IsInvalid());
2435 return yield_first_feedback_slot_; 2433 return yield_first_feedback_slot_;
2436 } 2434 }
2437 2435
2438 FeedbackVectorICSlot DoneFeedbackSlot() { 2436 FeedbackVectorICSlot DoneFeedbackSlot() {
2439 return KeyedLoadFeedbackSlot().next(); 2437 return KeyedLoadFeedbackSlot().next();
(...skipping 13 matching lines...) Expand all
2453 2451
2454 private: 2452 private:
2455 Expression* generator_object_; 2453 Expression* generator_object_;
2456 Expression* expression_; 2454 Expression* expression_;
2457 Kind yield_kind_; 2455 Kind yield_kind_;
2458 int index_; 2456 int index_;
2459 FeedbackVectorICSlot yield_first_feedback_slot_; 2457 FeedbackVectorICSlot yield_first_feedback_slot_;
2460 }; 2458 };
2461 2459
2462 2460
2463 class Throw FINAL : public Expression { 2461 class Throw final : public Expression {
2464 public: 2462 public:
2465 DECLARE_NODE_TYPE(Throw) 2463 DECLARE_NODE_TYPE(Throw)
2466 2464
2467 Expression* exception() const { return exception_; } 2465 Expression* exception() const { return exception_; }
2468 2466
2469 protected: 2467 protected:
2470 Throw(Zone* zone, Expression* exception, int pos) 2468 Throw(Zone* zone, Expression* exception, int pos)
2471 : Expression(zone, pos), exception_(exception) {} 2469 : Expression(zone, pos), exception_(exception) {}
2472 2470
2473 private: 2471 private:
2474 Expression* exception_; 2472 Expression* exception_;
2475 }; 2473 };
2476 2474
2477 2475
2478 class FunctionLiteral FINAL : public Expression { 2476 class FunctionLiteral final : public Expression {
2479 public: 2477 public:
2480 enum FunctionType { 2478 enum FunctionType {
2481 ANONYMOUS_EXPRESSION, 2479 ANONYMOUS_EXPRESSION,
2482 NAMED_EXPRESSION, 2480 NAMED_EXPRESSION,
2483 DECLARATION 2481 DECLARATION
2484 }; 2482 };
2485 2483
2486 enum ParameterFlag { 2484 enum ParameterFlag {
2487 kNoDuplicateParameters = 0, 2485 kNoDuplicateParameters = 0,
2488 kHasDuplicateParameters = 1 2486 kHasDuplicateParameters = 1
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 class IsExpression : public BitField<bool, 0, 1> {}; 2660 class IsExpression : public BitField<bool, 0, 1> {};
2663 class IsAnonymous : public BitField<bool, 1, 1> {}; 2661 class IsAnonymous : public BitField<bool, 1, 1> {};
2664 class Pretenure : public BitField<bool, 2, 1> {}; 2662 class Pretenure : public BitField<bool, 2, 1> {};
2665 class HasDuplicateParameters : public BitField<ParameterFlag, 3, 1> {}; 2663 class HasDuplicateParameters : public BitField<ParameterFlag, 3, 1> {};
2666 class IsFunction : public BitField<IsFunctionFlag, 4, 1> {}; 2664 class IsFunction : public BitField<IsFunctionFlag, 4, 1> {};
2667 class IsParenthesized : public BitField<IsParenthesizedFlag, 5, 1> {}; 2665 class IsParenthesized : public BitField<IsParenthesizedFlag, 5, 1> {};
2668 class FunctionKindBits : public BitField<FunctionKind, 6, 8> {}; 2666 class FunctionKindBits : public BitField<FunctionKind, 6, 8> {};
2669 }; 2667 };
2670 2668
2671 2669
2672 class ClassLiteral FINAL : public Expression { 2670 class ClassLiteral final : public Expression {
2673 public: 2671 public:
2674 typedef ObjectLiteralProperty Property; 2672 typedef ObjectLiteralProperty Property;
2675 2673
2676 DECLARE_NODE_TYPE(ClassLiteral) 2674 DECLARE_NODE_TYPE(ClassLiteral)
2677 2675
2678 Handle<String> name() const { return raw_name_->string(); } 2676 Handle<String> name() const { return raw_name_->string(); }
2679 const AstRawString* raw_name() const { return raw_name_; } 2677 const AstRawString* raw_name() const { return raw_name_; }
2680 Scope* scope() const { return scope_; } 2678 Scope* scope() const { return scope_; }
2681 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; } 2679 VariableProxy* class_variable_proxy() const { return class_variable_proxy_; }
2682 Expression* extends() const { return extends_; } 2680 Expression* extends() const { return extends_; }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2717 const AstRawString* raw_name_; 2715 const AstRawString* raw_name_;
2718 Scope* scope_; 2716 Scope* scope_;
2719 VariableProxy* class_variable_proxy_; 2717 VariableProxy* class_variable_proxy_;
2720 Expression* extends_; 2718 Expression* extends_;
2721 FunctionLiteral* constructor_; 2719 FunctionLiteral* constructor_;
2722 ZoneList<Property*>* properties_; 2720 ZoneList<Property*>* properties_;
2723 int end_position_; 2721 int end_position_;
2724 }; 2722 };
2725 2723
2726 2724
2727 class NativeFunctionLiteral FINAL : public Expression { 2725 class NativeFunctionLiteral final : public Expression {
2728 public: 2726 public:
2729 DECLARE_NODE_TYPE(NativeFunctionLiteral) 2727 DECLARE_NODE_TYPE(NativeFunctionLiteral)
2730 2728
2731 Handle<String> name() const { return name_->string(); } 2729 Handle<String> name() const { return name_->string(); }
2732 v8::Extension* extension() const { return extension_; } 2730 v8::Extension* extension() const { return extension_; }
2733 2731
2734 protected: 2732 protected:
2735 NativeFunctionLiteral(Zone* zone, const AstRawString* name, 2733 NativeFunctionLiteral(Zone* zone, const AstRawString* name,
2736 v8::Extension* extension, int pos) 2734 v8::Extension* extension, int pos)
2737 : Expression(zone, pos), name_(name), extension_(extension) {} 2735 : Expression(zone, pos), name_(name), extension_(extension) {}
2738 2736
2739 private: 2737 private:
2740 const AstRawString* name_; 2738 const AstRawString* name_;
2741 v8::Extension* extension_; 2739 v8::Extension* extension_;
2742 }; 2740 };
2743 2741
2744 2742
2745 class ThisFunction FINAL : public Expression { 2743 class ThisFunction final : public Expression {
2746 public: 2744 public:
2747 DECLARE_NODE_TYPE(ThisFunction) 2745 DECLARE_NODE_TYPE(ThisFunction)
2748 2746
2749 protected: 2747 protected:
2750 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {} 2748 ThisFunction(Zone* zone, int pos) : Expression(zone, pos) {}
2751 }; 2749 };
2752 2750
2753 2751
2754 class SuperReference FINAL : public Expression { 2752 class SuperReference final : public Expression {
2755 public: 2753 public:
2756 DECLARE_NODE_TYPE(SuperReference) 2754 DECLARE_NODE_TYPE(SuperReference)
2757 2755
2758 VariableProxy* this_var() const { return this_var_; } 2756 VariableProxy* this_var() const { return this_var_; }
2759 2757
2760 static int num_ids() { return parent_num_ids() + 1; } 2758 static int num_ids() { return parent_num_ids() + 1; }
2761 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); } 2759 TypeFeedbackId HomeObjectFeedbackId() { return TypeFeedbackId(local_id(0)); }
2762 2760
2763 // Type feedback information. 2761 // Type feedback information.
2764 virtual FeedbackVectorRequirements ComputeFeedbackRequirements( 2762 virtual FeedbackVectorRequirements ComputeFeedbackRequirements(
2765 Isolate* isolate, const ICSlotCache* cache) OVERRIDE { 2763 Isolate* isolate, const ICSlotCache* cache) override {
2766 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0); 2764 return FeedbackVectorRequirements(0, FLAG_vector_ics ? 1 : 0);
2767 } 2765 }
2768 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 2766 void SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
2769 ICSlotCache* cache) OVERRIDE { 2767 ICSlotCache* cache) override {
2770 homeobject_feedback_slot_ = slot; 2768 homeobject_feedback_slot_ = slot;
2771 } 2769 }
2772 Code::Kind FeedbackICSlotKind(int index) OVERRIDE { return Code::LOAD_IC; } 2770 Code::Kind FeedbackICSlotKind(int index) override { return Code::LOAD_IC; }
2773 2771
2774 FeedbackVectorICSlot HomeObjectFeedbackSlot() { 2772 FeedbackVectorICSlot HomeObjectFeedbackSlot() {
2775 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid()); 2773 DCHECK(!FLAG_vector_ics || !homeobject_feedback_slot_.IsInvalid());
2776 return homeobject_feedback_slot_; 2774 return homeobject_feedback_slot_;
2777 } 2775 }
2778 2776
2779 protected: 2777 protected:
2780 SuperReference(Zone* zone, VariableProxy* this_var, int pos) 2778 SuperReference(Zone* zone, VariableProxy* this_var, int pos)
2781 : Expression(zone, pos), 2779 : Expression(zone, pos),
2782 this_var_(this_var), 2780 this_var_(this_var),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 virtual void AppendToText(RegExpText* text, Zone* zone); 2826 virtual void AppendToText(RegExpText* text, Zone* zone);
2829 std::ostream& Print(std::ostream& os, Zone* zone); // NOLINT 2827 std::ostream& Print(std::ostream& os, Zone* zone); // NOLINT
2830 #define MAKE_ASTYPE(Name) \ 2828 #define MAKE_ASTYPE(Name) \
2831 virtual RegExp##Name* As##Name(); \ 2829 virtual RegExp##Name* As##Name(); \
2832 virtual bool Is##Name(); 2830 virtual bool Is##Name();
2833 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) 2831 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE)
2834 #undef MAKE_ASTYPE 2832 #undef MAKE_ASTYPE
2835 }; 2833 };
2836 2834
2837 2835
2838 class RegExpDisjunction FINAL : public RegExpTree { 2836 class RegExpDisjunction final : public RegExpTree {
2839 public: 2837 public:
2840 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); 2838 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives);
2841 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2839 void* Accept(RegExpVisitor* visitor, void* data) override;
2842 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2840 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2843 RegExpNode* on_success) OVERRIDE; 2841 RegExpNode* on_success) override;
2844 RegExpDisjunction* AsDisjunction() OVERRIDE; 2842 RegExpDisjunction* AsDisjunction() override;
2845 Interval CaptureRegisters() OVERRIDE; 2843 Interval CaptureRegisters() override;
2846 bool IsDisjunction() OVERRIDE; 2844 bool IsDisjunction() override;
2847 bool IsAnchoredAtStart() OVERRIDE; 2845 bool IsAnchoredAtStart() override;
2848 bool IsAnchoredAtEnd() OVERRIDE; 2846 bool IsAnchoredAtEnd() override;
2849 int min_match() OVERRIDE { return min_match_; } 2847 int min_match() override { return min_match_; }
2850 int max_match() OVERRIDE { return max_match_; } 2848 int max_match() override { return max_match_; }
2851 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } 2849 ZoneList<RegExpTree*>* alternatives() { return alternatives_; }
2852 private: 2850 private:
2853 ZoneList<RegExpTree*>* alternatives_; 2851 ZoneList<RegExpTree*>* alternatives_;
2854 int min_match_; 2852 int min_match_;
2855 int max_match_; 2853 int max_match_;
2856 }; 2854 };
2857 2855
2858 2856
2859 class RegExpAlternative FINAL : public RegExpTree { 2857 class RegExpAlternative final : public RegExpTree {
2860 public: 2858 public:
2861 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); 2859 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes);
2862 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2860 void* Accept(RegExpVisitor* visitor, void* data) override;
2863 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2861 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2864 RegExpNode* on_success) OVERRIDE; 2862 RegExpNode* on_success) override;
2865 RegExpAlternative* AsAlternative() OVERRIDE; 2863 RegExpAlternative* AsAlternative() override;
2866 Interval CaptureRegisters() OVERRIDE; 2864 Interval CaptureRegisters() override;
2867 bool IsAlternative() OVERRIDE; 2865 bool IsAlternative() override;
2868 bool IsAnchoredAtStart() OVERRIDE; 2866 bool IsAnchoredAtStart() override;
2869 bool IsAnchoredAtEnd() OVERRIDE; 2867 bool IsAnchoredAtEnd() override;
2870 int min_match() OVERRIDE { return min_match_; } 2868 int min_match() override { return min_match_; }
2871 int max_match() OVERRIDE { return max_match_; } 2869 int max_match() override { return max_match_; }
2872 ZoneList<RegExpTree*>* nodes() { return nodes_; } 2870 ZoneList<RegExpTree*>* nodes() { return nodes_; }
2873 private: 2871 private:
2874 ZoneList<RegExpTree*>* nodes_; 2872 ZoneList<RegExpTree*>* nodes_;
2875 int min_match_; 2873 int min_match_;
2876 int max_match_; 2874 int max_match_;
2877 }; 2875 };
2878 2876
2879 2877
2880 class RegExpAssertion FINAL : public RegExpTree { 2878 class RegExpAssertion final : public RegExpTree {
2881 public: 2879 public:
2882 enum AssertionType { 2880 enum AssertionType {
2883 START_OF_LINE, 2881 START_OF_LINE,
2884 START_OF_INPUT, 2882 START_OF_INPUT,
2885 END_OF_LINE, 2883 END_OF_LINE,
2886 END_OF_INPUT, 2884 END_OF_INPUT,
2887 BOUNDARY, 2885 BOUNDARY,
2888 NON_BOUNDARY 2886 NON_BOUNDARY
2889 }; 2887 };
2890 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } 2888 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { }
2891 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2889 void* Accept(RegExpVisitor* visitor, void* data) override;
2892 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2890 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2893 RegExpNode* on_success) OVERRIDE; 2891 RegExpNode* on_success) override;
2894 RegExpAssertion* AsAssertion() OVERRIDE; 2892 RegExpAssertion* AsAssertion() override;
2895 bool IsAssertion() OVERRIDE; 2893 bool IsAssertion() override;
2896 bool IsAnchoredAtStart() OVERRIDE; 2894 bool IsAnchoredAtStart() override;
2897 bool IsAnchoredAtEnd() OVERRIDE; 2895 bool IsAnchoredAtEnd() override;
2898 int min_match() OVERRIDE { return 0; } 2896 int min_match() override { return 0; }
2899 int max_match() OVERRIDE { return 0; } 2897 int max_match() override { return 0; }
2900 AssertionType assertion_type() { return assertion_type_; } 2898 AssertionType assertion_type() { return assertion_type_; }
2901 private: 2899 private:
2902 AssertionType assertion_type_; 2900 AssertionType assertion_type_;
2903 }; 2901 };
2904 2902
2905 2903
2906 class CharacterSet FINAL BASE_EMBEDDED { 2904 class CharacterSet final BASE_EMBEDDED {
2907 public: 2905 public:
2908 explicit CharacterSet(uc16 standard_set_type) 2906 explicit CharacterSet(uc16 standard_set_type)
2909 : ranges_(NULL), 2907 : ranges_(NULL),
2910 standard_set_type_(standard_set_type) {} 2908 standard_set_type_(standard_set_type) {}
2911 explicit CharacterSet(ZoneList<CharacterRange>* ranges) 2909 explicit CharacterSet(ZoneList<CharacterRange>* ranges)
2912 : ranges_(ranges), 2910 : ranges_(ranges),
2913 standard_set_type_(0) {} 2911 standard_set_type_(0) {}
2914 ZoneList<CharacterRange>* ranges(Zone* zone); 2912 ZoneList<CharacterRange>* ranges(Zone* zone);
2915 uc16 standard_set_type() { return standard_set_type_; } 2913 uc16 standard_set_type() { return standard_set_type_; }
2916 void set_standard_set_type(uc16 special_set_type) { 2914 void set_standard_set_type(uc16 special_set_type) {
2917 standard_set_type_ = special_set_type; 2915 standard_set_type_ = special_set_type;
2918 } 2916 }
2919 bool is_standard() { return standard_set_type_ != 0; } 2917 bool is_standard() { return standard_set_type_ != 0; }
2920 void Canonicalize(); 2918 void Canonicalize();
2921 private: 2919 private:
2922 ZoneList<CharacterRange>* ranges_; 2920 ZoneList<CharacterRange>* ranges_;
2923 // If non-zero, the value represents a standard set (e.g., all whitespace 2921 // If non-zero, the value represents a standard set (e.g., all whitespace
2924 // characters) without having to expand the ranges. 2922 // characters) without having to expand the ranges.
2925 uc16 standard_set_type_; 2923 uc16 standard_set_type_;
2926 }; 2924 };
2927 2925
2928 2926
2929 class RegExpCharacterClass FINAL : public RegExpTree { 2927 class RegExpCharacterClass final : public RegExpTree {
2930 public: 2928 public:
2931 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) 2929 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
2932 : set_(ranges), 2930 : set_(ranges),
2933 is_negated_(is_negated) { } 2931 is_negated_(is_negated) { }
2934 explicit RegExpCharacterClass(uc16 type) 2932 explicit RegExpCharacterClass(uc16 type)
2935 : set_(type), 2933 : set_(type),
2936 is_negated_(false) { } 2934 is_negated_(false) { }
2937 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2935 void* Accept(RegExpVisitor* visitor, void* data) override;
2938 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2936 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2939 RegExpNode* on_success) OVERRIDE; 2937 RegExpNode* on_success) override;
2940 RegExpCharacterClass* AsCharacterClass() OVERRIDE; 2938 RegExpCharacterClass* AsCharacterClass() override;
2941 bool IsCharacterClass() OVERRIDE; 2939 bool IsCharacterClass() override;
2942 bool IsTextElement() OVERRIDE { return true; } 2940 bool IsTextElement() override { return true; }
2943 int min_match() OVERRIDE { return 1; } 2941 int min_match() override { return 1; }
2944 int max_match() OVERRIDE { return 1; } 2942 int max_match() override { return 1; }
2945 void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; 2943 void AppendToText(RegExpText* text, Zone* zone) override;
2946 CharacterSet character_set() { return set_; } 2944 CharacterSet character_set() { return set_; }
2947 // TODO(lrn): Remove need for complex version if is_standard that 2945 // TODO(lrn): Remove need for complex version if is_standard that
2948 // recognizes a mangled standard set and just do { return set_.is_special(); } 2946 // recognizes a mangled standard set and just do { return set_.is_special(); }
2949 bool is_standard(Zone* zone); 2947 bool is_standard(Zone* zone);
2950 // Returns a value representing the standard character set if is_standard() 2948 // Returns a value representing the standard character set if is_standard()
2951 // returns true. 2949 // returns true.
2952 // Currently used values are: 2950 // Currently used values are:
2953 // s : unicode whitespace 2951 // s : unicode whitespace
2954 // S : unicode non-whitespace 2952 // S : unicode non-whitespace
2955 // w : ASCII word character (digit, letter, underscore) 2953 // w : ASCII word character (digit, letter, underscore)
2956 // W : non-ASCII word character 2954 // W : non-ASCII word character
2957 // d : ASCII digit 2955 // d : ASCII digit
2958 // D : non-ASCII digit 2956 // D : non-ASCII digit
2959 // . : non-unicode non-newline 2957 // . : non-unicode non-newline
2960 // * : All characters 2958 // * : All characters
2961 uc16 standard_type() { return set_.standard_set_type(); } 2959 uc16 standard_type() { return set_.standard_set_type(); }
2962 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } 2960 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); }
2963 bool is_negated() { return is_negated_; } 2961 bool is_negated() { return is_negated_; }
2964 2962
2965 private: 2963 private:
2966 CharacterSet set_; 2964 CharacterSet set_;
2967 bool is_negated_; 2965 bool is_negated_;
2968 }; 2966 };
2969 2967
2970 2968
2971 class RegExpAtom FINAL : public RegExpTree { 2969 class RegExpAtom final : public RegExpTree {
2972 public: 2970 public:
2973 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } 2971 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { }
2974 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2972 void* Accept(RegExpVisitor* visitor, void* data) override;
2975 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2973 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2976 RegExpNode* on_success) OVERRIDE; 2974 RegExpNode* on_success) override;
2977 RegExpAtom* AsAtom() OVERRIDE; 2975 RegExpAtom* AsAtom() override;
2978 bool IsAtom() OVERRIDE; 2976 bool IsAtom() override;
2979 bool IsTextElement() OVERRIDE { return true; } 2977 bool IsTextElement() override { return true; }
2980 int min_match() OVERRIDE { return data_.length(); } 2978 int min_match() override { return data_.length(); }
2981 int max_match() OVERRIDE { return data_.length(); } 2979 int max_match() override { return data_.length(); }
2982 void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; 2980 void AppendToText(RegExpText* text, Zone* zone) override;
2983 Vector<const uc16> data() { return data_; } 2981 Vector<const uc16> data() { return data_; }
2984 int length() { return data_.length(); } 2982 int length() { return data_.length(); }
2985 private: 2983 private:
2986 Vector<const uc16> data_; 2984 Vector<const uc16> data_;
2987 }; 2985 };
2988 2986
2989 2987
2990 class RegExpText FINAL : public RegExpTree { 2988 class RegExpText final : public RegExpTree {
2991 public: 2989 public:
2992 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} 2990 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {}
2993 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 2991 void* Accept(RegExpVisitor* visitor, void* data) override;
2994 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 2992 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
2995 RegExpNode* on_success) OVERRIDE; 2993 RegExpNode* on_success) override;
2996 RegExpText* AsText() OVERRIDE; 2994 RegExpText* AsText() override;
2997 bool IsText() OVERRIDE; 2995 bool IsText() override;
2998 bool IsTextElement() OVERRIDE { return true; } 2996 bool IsTextElement() override { return true; }
2999 int min_match() OVERRIDE { return length_; } 2997 int min_match() override { return length_; }
3000 int max_match() OVERRIDE { return length_; } 2998 int max_match() override { return length_; }
3001 void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; 2999 void AppendToText(RegExpText* text, Zone* zone) override;
3002 void AddElement(TextElement elm, Zone* zone) { 3000 void AddElement(TextElement elm, Zone* zone) {
3003 elements_.Add(elm, zone); 3001 elements_.Add(elm, zone);
3004 length_ += elm.length(); 3002 length_ += elm.length();
3005 } 3003 }
3006 ZoneList<TextElement>* elements() { return &elements_; } 3004 ZoneList<TextElement>* elements() { return &elements_; }
3007 private: 3005 private:
3008 ZoneList<TextElement> elements_; 3006 ZoneList<TextElement> elements_;
3009 int length_; 3007 int length_;
3010 }; 3008 };
3011 3009
3012 3010
3013 class RegExpQuantifier FINAL : public RegExpTree { 3011 class RegExpQuantifier final : public RegExpTree {
3014 public: 3012 public:
3015 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; 3013 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE };
3016 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) 3014 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body)
3017 : body_(body), 3015 : body_(body),
3018 min_(min), 3016 min_(min),
3019 max_(max), 3017 max_(max),
3020 min_match_(min * body->min_match()), 3018 min_match_(min * body->min_match()),
3021 quantifier_type_(type) { 3019 quantifier_type_(type) {
3022 if (max > 0 && body->max_match() > kInfinity / max) { 3020 if (max > 0 && body->max_match() > kInfinity / max) {
3023 max_match_ = kInfinity; 3021 max_match_ = kInfinity;
3024 } else { 3022 } else {
3025 max_match_ = max * body->max_match(); 3023 max_match_ = max * body->max_match();
3026 } 3024 }
3027 } 3025 }
3028 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3026 void* Accept(RegExpVisitor* visitor, void* data) override;
3029 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3027 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3030 RegExpNode* on_success) OVERRIDE; 3028 RegExpNode* on_success) override;
3031 static RegExpNode* ToNode(int min, 3029 static RegExpNode* ToNode(int min,
3032 int max, 3030 int max,
3033 bool is_greedy, 3031 bool is_greedy,
3034 RegExpTree* body, 3032 RegExpTree* body,
3035 RegExpCompiler* compiler, 3033 RegExpCompiler* compiler,
3036 RegExpNode* on_success, 3034 RegExpNode* on_success,
3037 bool not_at_start = false); 3035 bool not_at_start = false);
3038 RegExpQuantifier* AsQuantifier() OVERRIDE; 3036 RegExpQuantifier* AsQuantifier() override;
3039 Interval CaptureRegisters() OVERRIDE; 3037 Interval CaptureRegisters() override;
3040 bool IsQuantifier() OVERRIDE; 3038 bool IsQuantifier() override;
3041 int min_match() OVERRIDE { return min_match_; } 3039 int min_match() override { return min_match_; }
3042 int max_match() OVERRIDE { return max_match_; } 3040 int max_match() override { return max_match_; }
3043 int min() { return min_; } 3041 int min() { return min_; }
3044 int max() { return max_; } 3042 int max() { return max_; }
3045 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } 3043 bool is_possessive() { return quantifier_type_ == POSSESSIVE; }
3046 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } 3044 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; }
3047 bool is_greedy() { return quantifier_type_ == GREEDY; } 3045 bool is_greedy() { return quantifier_type_ == GREEDY; }
3048 RegExpTree* body() { return body_; } 3046 RegExpTree* body() { return body_; }
3049 3047
3050 private: 3048 private:
3051 RegExpTree* body_; 3049 RegExpTree* body_;
3052 int min_; 3050 int min_;
3053 int max_; 3051 int max_;
3054 int min_match_; 3052 int min_match_;
3055 int max_match_; 3053 int max_match_;
3056 QuantifierType quantifier_type_; 3054 QuantifierType quantifier_type_;
3057 }; 3055 };
3058 3056
3059 3057
3060 class RegExpCapture FINAL : public RegExpTree { 3058 class RegExpCapture final : public RegExpTree {
3061 public: 3059 public:
3062 explicit RegExpCapture(RegExpTree* body, int index) 3060 explicit RegExpCapture(RegExpTree* body, int index)
3063 : body_(body), index_(index) { } 3061 : body_(body), index_(index) { }
3064 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3062 void* Accept(RegExpVisitor* visitor, void* data) override;
3065 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3063 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3066 RegExpNode* on_success) OVERRIDE; 3064 RegExpNode* on_success) override;
3067 static RegExpNode* ToNode(RegExpTree* body, 3065 static RegExpNode* ToNode(RegExpTree* body,
3068 int index, 3066 int index,
3069 RegExpCompiler* compiler, 3067 RegExpCompiler* compiler,
3070 RegExpNode* on_success); 3068 RegExpNode* on_success);
3071 RegExpCapture* AsCapture() OVERRIDE; 3069 RegExpCapture* AsCapture() override;
3072 bool IsAnchoredAtStart() OVERRIDE; 3070 bool IsAnchoredAtStart() override;
3073 bool IsAnchoredAtEnd() OVERRIDE; 3071 bool IsAnchoredAtEnd() override;
3074 Interval CaptureRegisters() OVERRIDE; 3072 Interval CaptureRegisters() override;
3075 bool IsCapture() OVERRIDE; 3073 bool IsCapture() override;
3076 int min_match() OVERRIDE { return body_->min_match(); } 3074 int min_match() override { return body_->min_match(); }
3077 int max_match() OVERRIDE { return body_->max_match(); } 3075 int max_match() override { return body_->max_match(); }
3078 RegExpTree* body() { return body_; } 3076 RegExpTree* body() { return body_; }
3079 int index() { return index_; } 3077 int index() { return index_; }
3080 static int StartRegister(int index) { return index * 2; } 3078 static int StartRegister(int index) { return index * 2; }
3081 static int EndRegister(int index) { return index * 2 + 1; } 3079 static int EndRegister(int index) { return index * 2 + 1; }
3082 3080
3083 private: 3081 private:
3084 RegExpTree* body_; 3082 RegExpTree* body_;
3085 int index_; 3083 int index_;
3086 }; 3084 };
3087 3085
3088 3086
3089 class RegExpLookahead FINAL : public RegExpTree { 3087 class RegExpLookahead final : public RegExpTree {
3090 public: 3088 public:
3091 RegExpLookahead(RegExpTree* body, 3089 RegExpLookahead(RegExpTree* body,
3092 bool is_positive, 3090 bool is_positive,
3093 int capture_count, 3091 int capture_count,
3094 int capture_from) 3092 int capture_from)
3095 : body_(body), 3093 : body_(body),
3096 is_positive_(is_positive), 3094 is_positive_(is_positive),
3097 capture_count_(capture_count), 3095 capture_count_(capture_count),
3098 capture_from_(capture_from) { } 3096 capture_from_(capture_from) { }
3099 3097
3100 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3098 void* Accept(RegExpVisitor* visitor, void* data) override;
3101 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3099 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3102 RegExpNode* on_success) OVERRIDE; 3100 RegExpNode* on_success) override;
3103 RegExpLookahead* AsLookahead() OVERRIDE; 3101 RegExpLookahead* AsLookahead() override;
3104 Interval CaptureRegisters() OVERRIDE; 3102 Interval CaptureRegisters() override;
3105 bool IsLookahead() OVERRIDE; 3103 bool IsLookahead() override;
3106 bool IsAnchoredAtStart() OVERRIDE; 3104 bool IsAnchoredAtStart() override;
3107 int min_match() OVERRIDE { return 0; } 3105 int min_match() override { return 0; }
3108 int max_match() OVERRIDE { return 0; } 3106 int max_match() override { return 0; }
3109 RegExpTree* body() { return body_; } 3107 RegExpTree* body() { return body_; }
3110 bool is_positive() { return is_positive_; } 3108 bool is_positive() { return is_positive_; }
3111 int capture_count() { return capture_count_; } 3109 int capture_count() { return capture_count_; }
3112 int capture_from() { return capture_from_; } 3110 int capture_from() { return capture_from_; }
3113 3111
3114 private: 3112 private:
3115 RegExpTree* body_; 3113 RegExpTree* body_;
3116 bool is_positive_; 3114 bool is_positive_;
3117 int capture_count_; 3115 int capture_count_;
3118 int capture_from_; 3116 int capture_from_;
3119 }; 3117 };
3120 3118
3121 3119
3122 class RegExpBackReference FINAL : public RegExpTree { 3120 class RegExpBackReference final : public RegExpTree {
3123 public: 3121 public:
3124 explicit RegExpBackReference(RegExpCapture* capture) 3122 explicit RegExpBackReference(RegExpCapture* capture)
3125 : capture_(capture) { } 3123 : capture_(capture) { }
3126 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3124 void* Accept(RegExpVisitor* visitor, void* data) override;
3127 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3125 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3128 RegExpNode* on_success) OVERRIDE; 3126 RegExpNode* on_success) override;
3129 RegExpBackReference* AsBackReference() OVERRIDE; 3127 RegExpBackReference* AsBackReference() override;
3130 bool IsBackReference() OVERRIDE; 3128 bool IsBackReference() override;
3131 int min_match() OVERRIDE { return 0; } 3129 int min_match() override { return 0; }
3132 int max_match() OVERRIDE { return capture_->max_match(); } 3130 int max_match() override { return capture_->max_match(); }
3133 int index() { return capture_->index(); } 3131 int index() { return capture_->index(); }
3134 RegExpCapture* capture() { return capture_; } 3132 RegExpCapture* capture() { return capture_; }
3135 private: 3133 private:
3136 RegExpCapture* capture_; 3134 RegExpCapture* capture_;
3137 }; 3135 };
3138 3136
3139 3137
3140 class RegExpEmpty FINAL : public RegExpTree { 3138 class RegExpEmpty final : public RegExpTree {
3141 public: 3139 public:
3142 RegExpEmpty() { } 3140 RegExpEmpty() { }
3143 void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; 3141 void* Accept(RegExpVisitor* visitor, void* data) override;
3144 virtual RegExpNode* ToNode(RegExpCompiler* compiler, 3142 virtual RegExpNode* ToNode(RegExpCompiler* compiler,
3145 RegExpNode* on_success) OVERRIDE; 3143 RegExpNode* on_success) override;
3146 RegExpEmpty* AsEmpty() OVERRIDE; 3144 RegExpEmpty* AsEmpty() override;
3147 bool IsEmpty() OVERRIDE; 3145 bool IsEmpty() override;
3148 int min_match() OVERRIDE { return 0; } 3146 int min_match() override { return 0; }
3149 int max_match() OVERRIDE { return 0; } 3147 int max_match() override { return 0; }
3150 }; 3148 };
3151 3149
3152 3150
3153 // ---------------------------------------------------------------------------- 3151 // ----------------------------------------------------------------------------
3154 // Basic visitor 3152 // Basic visitor
3155 // - leaf node visitors are abstract. 3153 // - leaf node visitors are abstract.
3156 3154
3157 class AstVisitor BASE_EMBEDDED { 3155 class AstVisitor BASE_EMBEDDED {
3158 public: 3156 public:
3159 AstVisitor() {} 3157 AstVisitor() {}
(...skipping 10 matching lines...) Expand all
3170 // Individual AST nodes. 3168 // Individual AST nodes.
3171 #define DEF_VISIT(type) \ 3169 #define DEF_VISIT(type) \
3172 virtual void Visit##type(type* node) = 0; 3170 virtual void Visit##type(type* node) = 0;
3173 AST_NODE_LIST(DEF_VISIT) 3171 AST_NODE_LIST(DEF_VISIT)
3174 #undef DEF_VISIT 3172 #undef DEF_VISIT
3175 }; 3173 };
3176 3174
3177 3175
3178 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ 3176 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \
3179 public: \ 3177 public: \
3180 void Visit(AstNode* node) FINAL { \ 3178 void Visit(AstNode* node) final { \
3181 if (!CheckStackOverflow()) node->Accept(this); \ 3179 if (!CheckStackOverflow()) node->Accept(this); \
3182 } \ 3180 } \
3183 \ 3181 \
3184 void SetStackOverflow() { stack_overflow_ = true; } \ 3182 void SetStackOverflow() { stack_overflow_ = true; } \
3185 void ClearStackOverflow() { stack_overflow_ = false; } \ 3183 void ClearStackOverflow() { stack_overflow_ = false; } \
3186 bool HasStackOverflow() const { return stack_overflow_; } \ 3184 bool HasStackOverflow() const { return stack_overflow_; } \
3187 \ 3185 \
3188 bool CheckStackOverflow() { \ 3186 bool CheckStackOverflow() { \
3189 if (stack_overflow_) return true; \ 3187 if (stack_overflow_) return true; \
3190 StackLimitCheck check(isolate_); \ 3188 StackLimitCheck check(isolate_); \
(...skipping 12 matching lines...) Expand all
3203 Isolate* isolate() { return isolate_; } \ 3201 Isolate* isolate() { return isolate_; } \
3204 \ 3202 \
3205 Isolate* isolate_; \ 3203 Isolate* isolate_; \
3206 Zone* zone_; \ 3204 Zone* zone_; \
3207 bool stack_overflow_ 3205 bool stack_overflow_
3208 3206
3209 3207
3210 // ---------------------------------------------------------------------------- 3208 // ----------------------------------------------------------------------------
3211 // AstNode factory 3209 // AstNode factory
3212 3210
3213 class AstNodeFactory FINAL BASE_EMBEDDED { 3211 class AstNodeFactory final BASE_EMBEDDED {
3214 public: 3212 public:
3215 explicit AstNodeFactory(AstValueFactory* ast_value_factory) 3213 explicit AstNodeFactory(AstValueFactory* ast_value_factory)
3216 : zone_(ast_value_factory->zone()), 3214 : zone_(ast_value_factory->zone()),
3217 ast_value_factory_(ast_value_factory) {} 3215 ast_value_factory_(ast_value_factory) {}
3218 3216
3219 VariableDeclaration* NewVariableDeclaration( 3217 VariableDeclaration* NewVariableDeclaration(
3220 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos, 3218 VariableProxy* proxy, VariableMode mode, Scope* scope, int pos,
3221 bool is_class_declaration = false) { 3219 bool is_class_declaration = false) {
3222 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos, 3220 return new (zone_) VariableDeclaration(zone_, proxy, mode, scope, pos,
3223 is_class_declaration); 3221 is_class_declaration);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 3580
3583 private: 3581 private:
3584 Zone* zone_; 3582 Zone* zone_;
3585 AstValueFactory* ast_value_factory_; 3583 AstValueFactory* ast_value_factory_;
3586 }; 3584 };
3587 3585
3588 3586
3589 } } // namespace v8::internal 3587 } } // namespace v8::internal
3590 3588
3591 #endif // V8_AST_H_ 3589 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assert-scope.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698