OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 #undef DEF_FORWARD_DECLARATION | 159 #undef DEF_FORWARD_DECLARATION |
160 | 160 |
161 | 161 |
162 // Typedef only introduced to avoid unreadable code. | 162 // Typedef only introduced to avoid unreadable code. |
163 // Please do appreciate the required space in "> >". | 163 // Please do appreciate the required space in "> >". |
164 typedef ZoneList<Handle<String> > ZoneStringList; | 164 typedef ZoneList<Handle<String> > ZoneStringList; |
165 typedef ZoneList<Handle<Object> > ZoneObjectList; | 165 typedef ZoneList<Handle<Object> > ZoneObjectList; |
166 | 166 |
167 | 167 |
168 #define DECLARE_NODE_TYPE(type) \ | 168 #define DECLARE_NODE_TYPE(type) \ |
169 virtual void Accept(AstVisitor* v) OVERRIDE; \ | 169 virtual void Accept(AstVisitor* v) V8_OVERRIDE; \ |
170 virtual AstNode::NodeType node_type() const FINAL OVERRIDE { \ | 170 virtual AstNode::NodeType node_type() const V8_FINAL V8_OVERRIDE { \ |
171 return AstNode::k##type; \ | 171 return AstNode::k##type; \ |
172 } \ | 172 } \ |
173 template<class> friend class AstNodeFactory; | 173 template<class> friend class AstNodeFactory; |
174 | 174 |
175 | 175 |
176 enum AstPropertiesFlag { | 176 enum AstPropertiesFlag { |
177 kDontInline, | 177 kDontInline, |
178 kDontOptimize, | 178 kDontOptimize, |
179 kDontSelfOptimize, | 179 kDontSelfOptimize, |
180 kDontSoftInline, | 180 kDontSoftInline, |
181 kDontCache | 181 kDontCache |
182 }; | 182 }; |
183 | 183 |
184 | 184 |
185 class AstProperties FINAL BASE_EMBEDDED { | 185 class AstProperties V8_FINAL BASE_EMBEDDED { |
186 public: | 186 public: |
187 class Flags : public EnumSet<AstPropertiesFlag, int> {}; | 187 class Flags : public EnumSet<AstPropertiesFlag, int> {}; |
188 | 188 |
189 AstProperties() : node_count_(0) { } | 189 AstProperties() : node_count_(0) { } |
190 | 190 |
191 Flags* flags() { return &flags_; } | 191 Flags* flags() { return &flags_; } |
192 int node_count() { return node_count_; } | 192 int node_count() { return node_count_; } |
193 void add_node_count(int count) { node_count_ += count; } | 193 void add_node_count(int count) { node_count_ += count; } |
194 | 194 |
195 private: | 195 private: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 virtual bool IsJump() const { return false; } | 264 virtual bool IsJump() const { return false; } |
265 | 265 |
266 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } | 266 void set_statement_pos(int statement_pos) { statement_pos_ = statement_pos; } |
267 int statement_pos() const { return statement_pos_; } | 267 int statement_pos() const { return statement_pos_; } |
268 | 268 |
269 private: | 269 private: |
270 int statement_pos_; | 270 int statement_pos_; |
271 }; | 271 }; |
272 | 272 |
273 | 273 |
274 class SmallMapList FINAL { | 274 class SmallMapList V8_FINAL { |
275 public: | 275 public: |
276 SmallMapList() {} | 276 SmallMapList() {} |
277 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} | 277 SmallMapList(int capacity, Zone* zone) : list_(capacity, zone) {} |
278 | 278 |
279 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } | 279 void Reserve(int capacity, Zone* zone) { list_.Reserve(capacity, zone); } |
280 void Clear() { list_.Clear(); } | 280 void Clear() { list_.Clear(); } |
281 void Sort() { list_.Sort(); } | 281 void Sort() { list_.Sort(); } |
282 | 282 |
283 bool is_empty() const { return list_.is_empty(); } | 283 bool is_empty() const { return list_.is_empty(); } |
284 int length() const { return list_.length(); } | 284 int length() const { return list_.length(); } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 enum BreakableType { | 410 enum BreakableType { |
411 TARGET_FOR_ANONYMOUS, | 411 TARGET_FOR_ANONYMOUS, |
412 TARGET_FOR_NAMED_ONLY | 412 TARGET_FOR_NAMED_ONLY |
413 }; | 413 }; |
414 | 414 |
415 // The labels associated with this statement. May be NULL; | 415 // The labels associated with this statement. May be NULL; |
416 // if it is != NULL, guaranteed to contain at least one entry. | 416 // if it is != NULL, guaranteed to contain at least one entry. |
417 ZoneStringList* labels() const { return labels_; } | 417 ZoneStringList* labels() const { return labels_; } |
418 | 418 |
419 // Type testing & conversion. | 419 // Type testing & conversion. |
420 virtual BreakableStatement* AsBreakableStatement() FINAL OVERRIDE { | 420 virtual BreakableStatement* AsBreakableStatement() V8_FINAL V8_OVERRIDE { |
421 return this; | 421 return this; |
422 } | 422 } |
423 | 423 |
424 // Code generation | 424 // Code generation |
425 Label* break_target() { return &break_target_; } | 425 Label* break_target() { return &break_target_; } |
426 | 426 |
427 // Testers. | 427 // Testers. |
428 bool is_target_for_anonymous() const { | 428 bool is_target_for_anonymous() const { |
429 return breakable_type_ == TARGET_FOR_ANONYMOUS; | 429 return breakable_type_ == TARGET_FOR_ANONYMOUS; |
430 } | 430 } |
(...skipping 14 matching lines...) Expand all Loading... |
445 | 445 |
446 private: | 446 private: |
447 ZoneStringList* labels_; | 447 ZoneStringList* labels_; |
448 BreakableType breakable_type_; | 448 BreakableType breakable_type_; |
449 Label break_target_; | 449 Label break_target_; |
450 const BailoutId entry_id_; | 450 const BailoutId entry_id_; |
451 const BailoutId exit_id_; | 451 const BailoutId exit_id_; |
452 }; | 452 }; |
453 | 453 |
454 | 454 |
455 class Block FINAL : public BreakableStatement { | 455 class Block V8_FINAL : public BreakableStatement { |
456 public: | 456 public: |
457 DECLARE_NODE_TYPE(Block) | 457 DECLARE_NODE_TYPE(Block) |
458 | 458 |
459 void AddStatement(Statement* statement, Zone* zone) { | 459 void AddStatement(Statement* statement, Zone* zone) { |
460 statements_.Add(statement, zone); | 460 statements_.Add(statement, zone); |
461 } | 461 } |
462 | 462 |
463 ZoneList<Statement*>* statements() { return &statements_; } | 463 ZoneList<Statement*>* statements() { return &statements_; } |
464 bool is_initializer_block() const { return is_initializer_block_; } | 464 bool is_initializer_block() const { return is_initializer_block_; } |
465 | 465 |
466 virtual bool IsJump() const OVERRIDE { | 466 virtual bool IsJump() const V8_OVERRIDE { |
467 return !statements_.is_empty() && statements_.last()->IsJump() | 467 return !statements_.is_empty() && statements_.last()->IsJump() |
468 && labels() == NULL; // Good enough as an approximation... | 468 && labels() == NULL; // Good enough as an approximation... |
469 } | 469 } |
470 | 470 |
471 Scope* scope() const { return scope_; } | 471 Scope* scope() const { return scope_; } |
472 void set_scope(Scope* scope) { scope_ = scope; } | 472 void set_scope(Scope* scope) { scope_ = scope; } |
473 | 473 |
474 protected: | 474 protected: |
475 Block(Isolate* isolate, | 475 Block(Isolate* isolate, |
476 ZoneStringList* labels, | 476 ZoneStringList* labels, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 510 |
511 private: | 511 private: |
512 VariableProxy* proxy_; | 512 VariableProxy* proxy_; |
513 VariableMode mode_; | 513 VariableMode mode_; |
514 | 514 |
515 // Nested scope from which the declaration originated. | 515 // Nested scope from which the declaration originated. |
516 Scope* scope_; | 516 Scope* scope_; |
517 }; | 517 }; |
518 | 518 |
519 | 519 |
520 class VariableDeclaration FINAL : public Declaration { | 520 class VariableDeclaration V8_FINAL : public Declaration { |
521 public: | 521 public: |
522 DECLARE_NODE_TYPE(VariableDeclaration) | 522 DECLARE_NODE_TYPE(VariableDeclaration) |
523 | 523 |
524 virtual InitializationFlag initialization() const OVERRIDE { | 524 virtual InitializationFlag initialization() const V8_OVERRIDE { |
525 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; | 525 return mode() == VAR ? kCreatedInitialized : kNeedsInitialization; |
526 } | 526 } |
527 | 527 |
528 protected: | 528 protected: |
529 VariableDeclaration(VariableProxy* proxy, | 529 VariableDeclaration(VariableProxy* proxy, |
530 VariableMode mode, | 530 VariableMode mode, |
531 Scope* scope) | 531 Scope* scope) |
532 : Declaration(proxy, mode, scope) { | 532 : Declaration(proxy, mode, scope) { |
533 } | 533 } |
534 }; | 534 }; |
535 | 535 |
536 | 536 |
537 class FunctionDeclaration FINAL : public Declaration { | 537 class FunctionDeclaration V8_FINAL : public Declaration { |
538 public: | 538 public: |
539 DECLARE_NODE_TYPE(FunctionDeclaration) | 539 DECLARE_NODE_TYPE(FunctionDeclaration) |
540 | 540 |
541 FunctionLiteral* fun() const { return fun_; } | 541 FunctionLiteral* fun() const { return fun_; } |
542 virtual InitializationFlag initialization() const OVERRIDE { | 542 virtual InitializationFlag initialization() const V8_OVERRIDE { |
543 return kCreatedInitialized; | 543 return kCreatedInitialized; |
544 } | 544 } |
545 virtual bool IsInlineable() const OVERRIDE; | 545 virtual bool IsInlineable() const V8_OVERRIDE; |
546 | 546 |
547 protected: | 547 protected: |
548 FunctionDeclaration(VariableProxy* proxy, | 548 FunctionDeclaration(VariableProxy* proxy, |
549 VariableMode mode, | 549 VariableMode mode, |
550 FunctionLiteral* fun, | 550 FunctionLiteral* fun, |
551 Scope* scope) | 551 Scope* scope) |
552 : Declaration(proxy, mode, scope), | 552 : Declaration(proxy, mode, scope), |
553 fun_(fun) { | 553 fun_(fun) { |
554 // At the moment there are no "const functions" in JavaScript... | 554 // At the moment there are no "const functions" in JavaScript... |
555 ASSERT(mode == VAR || mode == LET); | 555 ASSERT(mode == VAR || mode == LET); |
556 ASSERT(fun != NULL); | 556 ASSERT(fun != NULL); |
557 } | 557 } |
558 | 558 |
559 private: | 559 private: |
560 FunctionLiteral* fun_; | 560 FunctionLiteral* fun_; |
561 }; | 561 }; |
562 | 562 |
563 | 563 |
564 class ModuleDeclaration FINAL : public Declaration { | 564 class ModuleDeclaration V8_FINAL : public Declaration { |
565 public: | 565 public: |
566 DECLARE_NODE_TYPE(ModuleDeclaration) | 566 DECLARE_NODE_TYPE(ModuleDeclaration) |
567 | 567 |
568 Module* module() const { return module_; } | 568 Module* module() const { return module_; } |
569 virtual InitializationFlag initialization() const OVERRIDE { | 569 virtual InitializationFlag initialization() const V8_OVERRIDE { |
570 return kCreatedInitialized; | 570 return kCreatedInitialized; |
571 } | 571 } |
572 | 572 |
573 protected: | 573 protected: |
574 ModuleDeclaration(VariableProxy* proxy, | 574 ModuleDeclaration(VariableProxy* proxy, |
575 Module* module, | 575 Module* module, |
576 Scope* scope) | 576 Scope* scope) |
577 : Declaration(proxy, MODULE, scope), | 577 : Declaration(proxy, MODULE, scope), |
578 module_(module) { | 578 module_(module) { |
579 } | 579 } |
580 | 580 |
581 private: | 581 private: |
582 Module* module_; | 582 Module* module_; |
583 }; | 583 }; |
584 | 584 |
585 | 585 |
586 class ImportDeclaration FINAL : public Declaration { | 586 class ImportDeclaration V8_FINAL : public Declaration { |
587 public: | 587 public: |
588 DECLARE_NODE_TYPE(ImportDeclaration) | 588 DECLARE_NODE_TYPE(ImportDeclaration) |
589 | 589 |
590 Module* module() const { return module_; } | 590 Module* module() const { return module_; } |
591 virtual InitializationFlag initialization() const OVERRIDE { | 591 virtual InitializationFlag initialization() const V8_OVERRIDE { |
592 return kCreatedInitialized; | 592 return kCreatedInitialized; |
593 } | 593 } |
594 | 594 |
595 protected: | 595 protected: |
596 ImportDeclaration(VariableProxy* proxy, | 596 ImportDeclaration(VariableProxy* proxy, |
597 Module* module, | 597 Module* module, |
598 Scope* scope) | 598 Scope* scope) |
599 : Declaration(proxy, LET, scope), | 599 : Declaration(proxy, LET, scope), |
600 module_(module) { | 600 module_(module) { |
601 } | 601 } |
602 | 602 |
603 private: | 603 private: |
604 Module* module_; | 604 Module* module_; |
605 }; | 605 }; |
606 | 606 |
607 | 607 |
608 class ExportDeclaration FINAL : public Declaration { | 608 class ExportDeclaration V8_FINAL : public Declaration { |
609 public: | 609 public: |
610 DECLARE_NODE_TYPE(ExportDeclaration) | 610 DECLARE_NODE_TYPE(ExportDeclaration) |
611 | 611 |
612 virtual InitializationFlag initialization() const OVERRIDE { | 612 virtual InitializationFlag initialization() const V8_OVERRIDE { |
613 return kCreatedInitialized; | 613 return kCreatedInitialized; |
614 } | 614 } |
615 | 615 |
616 protected: | 616 protected: |
617 ExportDeclaration(VariableProxy* proxy, Scope* scope) | 617 ExportDeclaration(VariableProxy* proxy, Scope* scope) |
618 : Declaration(proxy, LET, scope) {} | 618 : Declaration(proxy, LET, scope) {} |
619 }; | 619 }; |
620 | 620 |
621 | 621 |
622 class Module : public AstNode { | 622 class Module : public AstNode { |
623 public: | 623 public: |
624 Interface* interface() const { return interface_; } | 624 Interface* interface() const { return interface_; } |
625 Block* body() const { return body_; } | 625 Block* body() const { return body_; } |
626 | 626 |
627 protected: | 627 protected: |
628 explicit Module(Zone* zone) | 628 explicit Module(Zone* zone) |
629 : interface_(Interface::NewModule(zone)), | 629 : interface_(Interface::NewModule(zone)), |
630 body_(NULL) {} | 630 body_(NULL) {} |
631 explicit Module(Interface* interface, Block* body = NULL) | 631 explicit Module(Interface* interface, Block* body = NULL) |
632 : interface_(interface), | 632 : interface_(interface), |
633 body_(body) {} | 633 body_(body) {} |
634 | 634 |
635 private: | 635 private: |
636 Interface* interface_; | 636 Interface* interface_; |
637 Block* body_; | 637 Block* body_; |
638 }; | 638 }; |
639 | 639 |
640 | 640 |
641 class ModuleLiteral FINAL : public Module { | 641 class ModuleLiteral V8_FINAL : public Module { |
642 public: | 642 public: |
643 DECLARE_NODE_TYPE(ModuleLiteral) | 643 DECLARE_NODE_TYPE(ModuleLiteral) |
644 | 644 |
645 protected: | 645 protected: |
646 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} | 646 ModuleLiteral(Block* body, Interface* interface) : Module(interface, body) {} |
647 }; | 647 }; |
648 | 648 |
649 | 649 |
650 class ModuleVariable FINAL : public Module { | 650 class ModuleVariable V8_FINAL : public Module { |
651 public: | 651 public: |
652 DECLARE_NODE_TYPE(ModuleVariable) | 652 DECLARE_NODE_TYPE(ModuleVariable) |
653 | 653 |
654 VariableProxy* proxy() const { return proxy_; } | 654 VariableProxy* proxy() const { return proxy_; } |
655 | 655 |
656 protected: | 656 protected: |
657 inline explicit ModuleVariable(VariableProxy* proxy); | 657 inline explicit ModuleVariable(VariableProxy* proxy); |
658 | 658 |
659 private: | 659 private: |
660 VariableProxy* proxy_; | 660 VariableProxy* proxy_; |
661 }; | 661 }; |
662 | 662 |
663 | 663 |
664 class ModulePath FINAL : public Module { | 664 class ModulePath V8_FINAL : public Module { |
665 public: | 665 public: |
666 DECLARE_NODE_TYPE(ModulePath) | 666 DECLARE_NODE_TYPE(ModulePath) |
667 | 667 |
668 Module* module() const { return module_; } | 668 Module* module() const { return module_; } |
669 Handle<String> name() const { return name_; } | 669 Handle<String> name() const { return name_; } |
670 | 670 |
671 protected: | 671 protected: |
672 ModulePath(Module* module, Handle<String> name, Zone* zone) | 672 ModulePath(Module* module, Handle<String> name, Zone* zone) |
673 : Module(zone), | 673 : Module(zone), |
674 module_(module), | 674 module_(module), |
675 name_(name) { | 675 name_(name) { |
676 } | 676 } |
677 | 677 |
678 private: | 678 private: |
679 Module* module_; | 679 Module* module_; |
680 Handle<String> name_; | 680 Handle<String> name_; |
681 }; | 681 }; |
682 | 682 |
683 | 683 |
684 class ModuleUrl FINAL : public Module { | 684 class ModuleUrl V8_FINAL : public Module { |
685 public: | 685 public: |
686 DECLARE_NODE_TYPE(ModuleUrl) | 686 DECLARE_NODE_TYPE(ModuleUrl) |
687 | 687 |
688 Handle<String> url() const { return url_; } | 688 Handle<String> url() const { return url_; } |
689 | 689 |
690 protected: | 690 protected: |
691 ModuleUrl(Handle<String> url, Zone* zone) | 691 ModuleUrl(Handle<String> url, Zone* zone) |
692 : Module(zone), url_(url) { | 692 : Module(zone), url_(url) { |
693 } | 693 } |
694 | 694 |
695 private: | 695 private: |
696 Handle<String> url_; | 696 Handle<String> url_; |
697 }; | 697 }; |
698 | 698 |
699 | 699 |
700 class ModuleStatement FINAL : public Statement { | 700 class ModuleStatement V8_FINAL : public Statement { |
701 public: | 701 public: |
702 DECLARE_NODE_TYPE(ModuleStatement) | 702 DECLARE_NODE_TYPE(ModuleStatement) |
703 | 703 |
704 VariableProxy* proxy() const { return proxy_; } | 704 VariableProxy* proxy() const { return proxy_; } |
705 Block* body() const { return body_; } | 705 Block* body() const { return body_; } |
706 | 706 |
707 protected: | 707 protected: |
708 ModuleStatement(VariableProxy* proxy, Block* body) | 708 ModuleStatement(VariableProxy* proxy, Block* body) |
709 : proxy_(proxy), | 709 : proxy_(proxy), |
710 body_(body) { | 710 body_(body) { |
711 } | 711 } |
712 | 712 |
713 private: | 713 private: |
714 VariableProxy* proxy_; | 714 VariableProxy* proxy_; |
715 Block* body_; | 715 Block* body_; |
716 }; | 716 }; |
717 | 717 |
718 | 718 |
719 class IterationStatement : public BreakableStatement { | 719 class IterationStatement : public BreakableStatement { |
720 public: | 720 public: |
721 // Type testing & conversion. | 721 // Type testing & conversion. |
722 virtual IterationStatement* AsIterationStatement() FINAL OVERRIDE { | 722 virtual IterationStatement* AsIterationStatement() V8_FINAL V8_OVERRIDE { |
723 return this; | 723 return this; |
724 } | 724 } |
725 | 725 |
726 Statement* body() const { return body_; } | 726 Statement* body() const { return body_; } |
727 | 727 |
728 BailoutId OsrEntryId() const { return osr_entry_id_; } | 728 BailoutId OsrEntryId() const { return osr_entry_id_; } |
729 virtual BailoutId ContinueId() const = 0; | 729 virtual BailoutId ContinueId() const = 0; |
730 virtual BailoutId StackCheckId() const = 0; | 730 virtual BailoutId StackCheckId() const = 0; |
731 | 731 |
732 // Code generation | 732 // Code generation |
(...skipping 11 matching lines...) Expand all Loading... |
744 } | 744 } |
745 | 745 |
746 private: | 746 private: |
747 Statement* body_; | 747 Statement* body_; |
748 Label continue_target_; | 748 Label continue_target_; |
749 | 749 |
750 const BailoutId osr_entry_id_; | 750 const BailoutId osr_entry_id_; |
751 }; | 751 }; |
752 | 752 |
753 | 753 |
754 class DoWhileStatement FINAL : public IterationStatement { | 754 class DoWhileStatement V8_FINAL : public IterationStatement { |
755 public: | 755 public: |
756 DECLARE_NODE_TYPE(DoWhileStatement) | 756 DECLARE_NODE_TYPE(DoWhileStatement) |
757 | 757 |
758 void Initialize(Expression* cond, Statement* body) { | 758 void Initialize(Expression* cond, Statement* body) { |
759 IterationStatement::Initialize(body); | 759 IterationStatement::Initialize(body); |
760 cond_ = cond; | 760 cond_ = cond; |
761 } | 761 } |
762 | 762 |
763 Expression* cond() const { return cond_; } | 763 Expression* cond() const { return cond_; } |
764 | 764 |
765 // Position where condition expression starts. We need it to make | 765 // Position where condition expression starts. We need it to make |
766 // the loop's condition a breakable location. | 766 // the loop's condition a breakable location. |
767 int condition_position() { return condition_position_; } | 767 int condition_position() { return condition_position_; } |
768 void set_condition_position(int pos) { condition_position_ = pos; } | 768 void set_condition_position(int pos) { condition_position_ = pos; } |
769 | 769 |
770 virtual BailoutId ContinueId() const OVERRIDE { return continue_id_; } | 770 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
771 virtual BailoutId StackCheckId() const OVERRIDE { return back_edge_id_; } | 771 virtual BailoutId StackCheckId() const V8_OVERRIDE { return back_edge_id_; } |
772 BailoutId BackEdgeId() const { return back_edge_id_; } | 772 BailoutId BackEdgeId() const { return back_edge_id_; } |
773 | 773 |
774 protected: | 774 protected: |
775 DoWhileStatement(Isolate* isolate, ZoneStringList* labels) | 775 DoWhileStatement(Isolate* isolate, ZoneStringList* labels) |
776 : IterationStatement(isolate, labels), | 776 : IterationStatement(isolate, labels), |
777 cond_(NULL), | 777 cond_(NULL), |
778 condition_position_(-1), | 778 condition_position_(-1), |
779 continue_id_(GetNextId(isolate)), | 779 continue_id_(GetNextId(isolate)), |
780 back_edge_id_(GetNextId(isolate)) { | 780 back_edge_id_(GetNextId(isolate)) { |
781 } | 781 } |
782 | 782 |
783 private: | 783 private: |
784 Expression* cond_; | 784 Expression* cond_; |
785 | 785 |
786 int condition_position_; | 786 int condition_position_; |
787 | 787 |
788 const BailoutId continue_id_; | 788 const BailoutId continue_id_; |
789 const BailoutId back_edge_id_; | 789 const BailoutId back_edge_id_; |
790 }; | 790 }; |
791 | 791 |
792 | 792 |
793 class WhileStatement FINAL : public IterationStatement { | 793 class WhileStatement V8_FINAL : public IterationStatement { |
794 public: | 794 public: |
795 DECLARE_NODE_TYPE(WhileStatement) | 795 DECLARE_NODE_TYPE(WhileStatement) |
796 | 796 |
797 void Initialize(Expression* cond, Statement* body) { | 797 void Initialize(Expression* cond, Statement* body) { |
798 IterationStatement::Initialize(body); | 798 IterationStatement::Initialize(body); |
799 cond_ = cond; | 799 cond_ = cond; |
800 } | 800 } |
801 | 801 |
802 Expression* cond() const { return cond_; } | 802 Expression* cond() const { return cond_; } |
803 bool may_have_function_literal() const { | 803 bool may_have_function_literal() const { |
804 return may_have_function_literal_; | 804 return may_have_function_literal_; |
805 } | 805 } |
806 void set_may_have_function_literal(bool value) { | 806 void set_may_have_function_literal(bool value) { |
807 may_have_function_literal_ = value; | 807 may_have_function_literal_ = value; |
808 } | 808 } |
809 | 809 |
810 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } | 810 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
811 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } | 811 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
812 BailoutId BodyId() const { return body_id_; } | 812 BailoutId BodyId() const { return body_id_; } |
813 | 813 |
814 protected: | 814 protected: |
815 WhileStatement(Isolate* isolate, ZoneStringList* labels) | 815 WhileStatement(Isolate* isolate, ZoneStringList* labels) |
816 : IterationStatement(isolate, labels), | 816 : IterationStatement(isolate, labels), |
817 cond_(NULL), | 817 cond_(NULL), |
818 may_have_function_literal_(true), | 818 may_have_function_literal_(true), |
819 body_id_(GetNextId(isolate)) { | 819 body_id_(GetNextId(isolate)) { |
820 } | 820 } |
821 | 821 |
822 private: | 822 private: |
823 Expression* cond_; | 823 Expression* cond_; |
824 | 824 |
825 // True if there is a function literal subexpression in the condition. | 825 // True if there is a function literal subexpression in the condition. |
826 bool may_have_function_literal_; | 826 bool may_have_function_literal_; |
827 | 827 |
828 const BailoutId body_id_; | 828 const BailoutId body_id_; |
829 }; | 829 }; |
830 | 830 |
831 | 831 |
832 class ForStatement FINAL : public IterationStatement { | 832 class ForStatement V8_FINAL : public IterationStatement { |
833 public: | 833 public: |
834 DECLARE_NODE_TYPE(ForStatement) | 834 DECLARE_NODE_TYPE(ForStatement) |
835 | 835 |
836 void Initialize(Statement* init, | 836 void Initialize(Statement* init, |
837 Expression* cond, | 837 Expression* cond, |
838 Statement* next, | 838 Statement* next, |
839 Statement* body) { | 839 Statement* body) { |
840 IterationStatement::Initialize(body); | 840 IterationStatement::Initialize(body); |
841 init_ = init; | 841 init_ = init; |
842 cond_ = cond; | 842 cond_ = cond; |
843 next_ = next; | 843 next_ = next; |
844 } | 844 } |
845 | 845 |
846 Statement* init() const { return init_; } | 846 Statement* init() const { return init_; } |
847 Expression* cond() const { return cond_; } | 847 Expression* cond() const { return cond_; } |
848 Statement* next() const { return next_; } | 848 Statement* next() const { return next_; } |
849 | 849 |
850 bool may_have_function_literal() const { | 850 bool may_have_function_literal() const { |
851 return may_have_function_literal_; | 851 return may_have_function_literal_; |
852 } | 852 } |
853 void set_may_have_function_literal(bool value) { | 853 void set_may_have_function_literal(bool value) { |
854 may_have_function_literal_ = value; | 854 may_have_function_literal_ = value; |
855 } | 855 } |
856 | 856 |
857 virtual BailoutId ContinueId() const OVERRIDE { return continue_id_; } | 857 virtual BailoutId ContinueId() const V8_OVERRIDE { return continue_id_; } |
858 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } | 858 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
859 BailoutId BodyId() const { return body_id_; } | 859 BailoutId BodyId() const { return body_id_; } |
860 | 860 |
861 bool is_fast_smi_loop() { return loop_variable_ != NULL; } | 861 bool is_fast_smi_loop() { return loop_variable_ != NULL; } |
862 Variable* loop_variable() { return loop_variable_; } | 862 Variable* loop_variable() { return loop_variable_; } |
863 void set_loop_variable(Variable* var) { loop_variable_ = var; } | 863 void set_loop_variable(Variable* var) { loop_variable_ = var; } |
864 | 864 |
865 protected: | 865 protected: |
866 ForStatement(Isolate* isolate, ZoneStringList* labels) | 866 ForStatement(Isolate* isolate, ZoneStringList* labels) |
867 : IterationStatement(isolate, labels), | 867 : IterationStatement(isolate, labels), |
868 init_(NULL), | 868 init_(NULL), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 each_(NULL), | 910 each_(NULL), |
911 subject_(NULL) { | 911 subject_(NULL) { |
912 } | 912 } |
913 | 913 |
914 private: | 914 private: |
915 Expression* each_; | 915 Expression* each_; |
916 Expression* subject_; | 916 Expression* subject_; |
917 }; | 917 }; |
918 | 918 |
919 | 919 |
920 class ForInStatement FINAL : public ForEachStatement { | 920 class ForInStatement V8_FINAL : public ForEachStatement { |
921 public: | 921 public: |
922 DECLARE_NODE_TYPE(ForInStatement) | 922 DECLARE_NODE_TYPE(ForInStatement) |
923 | 923 |
924 Expression* enumerable() const { | 924 Expression* enumerable() const { |
925 return subject(); | 925 return subject(); |
926 } | 926 } |
927 | 927 |
928 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } | 928 TypeFeedbackId ForInFeedbackId() const { return reuse(PrepareId()); } |
929 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 929 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
930 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; | 930 enum ForInType { FAST_FOR_IN, SLOW_FOR_IN }; |
931 ForInType for_in_type() const { return for_in_type_; } | 931 ForInType for_in_type() const { return for_in_type_; } |
932 | 932 |
933 BailoutId BodyId() const { return body_id_; } | 933 BailoutId BodyId() const { return body_id_; } |
934 BailoutId PrepareId() const { return prepare_id_; } | 934 BailoutId PrepareId() const { return prepare_id_; } |
935 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } | 935 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
936 virtual BailoutId StackCheckId() const OVERRIDE { return body_id_; } | 936 virtual BailoutId StackCheckId() const V8_OVERRIDE { return body_id_; } |
937 | 937 |
938 protected: | 938 protected: |
939 ForInStatement(Isolate* isolate, ZoneStringList* labels) | 939 ForInStatement(Isolate* isolate, ZoneStringList* labels) |
940 : ForEachStatement(isolate, labels), | 940 : ForEachStatement(isolate, labels), |
941 for_in_type_(SLOW_FOR_IN), | 941 for_in_type_(SLOW_FOR_IN), |
942 body_id_(GetNextId(isolate)), | 942 body_id_(GetNextId(isolate)), |
943 prepare_id_(GetNextId(isolate)) { | 943 prepare_id_(GetNextId(isolate)) { |
944 } | 944 } |
945 | 945 |
946 ForInType for_in_type_; | 946 ForInType for_in_type_; |
947 const BailoutId body_id_; | 947 const BailoutId body_id_; |
948 const BailoutId prepare_id_; | 948 const BailoutId prepare_id_; |
949 }; | 949 }; |
950 | 950 |
951 | 951 |
952 class ForOfStatement FINAL : public ForEachStatement { | 952 class ForOfStatement V8_FINAL : public ForEachStatement { |
953 public: | 953 public: |
954 DECLARE_NODE_TYPE(ForOfStatement) | 954 DECLARE_NODE_TYPE(ForOfStatement) |
955 | 955 |
956 void Initialize(Expression* each, | 956 void Initialize(Expression* each, |
957 Expression* subject, | 957 Expression* subject, |
958 Statement* body, | 958 Statement* body, |
959 Expression* assign_iterator, | 959 Expression* assign_iterator, |
960 Expression* next_result, | 960 Expression* next_result, |
961 Expression* result_done, | 961 Expression* result_done, |
962 Expression* assign_each) { | 962 Expression* assign_each) { |
(...skipping 21 matching lines...) Expand all Loading... |
984 // result.done | 984 // result.done |
985 Expression* result_done() const { | 985 Expression* result_done() const { |
986 return result_done_; | 986 return result_done_; |
987 } | 987 } |
988 | 988 |
989 // each = result.value | 989 // each = result.value |
990 Expression* assign_each() const { | 990 Expression* assign_each() const { |
991 return assign_each_; | 991 return assign_each_; |
992 } | 992 } |
993 | 993 |
994 virtual BailoutId ContinueId() const OVERRIDE { return EntryId(); } | 994 virtual BailoutId ContinueId() const V8_OVERRIDE { return EntryId(); } |
995 virtual BailoutId StackCheckId() const OVERRIDE { return BackEdgeId(); } | 995 virtual BailoutId StackCheckId() const V8_OVERRIDE { return BackEdgeId(); } |
996 | 996 |
997 BailoutId BackEdgeId() const { return back_edge_id_; } | 997 BailoutId BackEdgeId() const { return back_edge_id_; } |
998 | 998 |
999 protected: | 999 protected: |
1000 ForOfStatement(Isolate* isolate, ZoneStringList* labels) | 1000 ForOfStatement(Isolate* isolate, ZoneStringList* labels) |
1001 : ForEachStatement(isolate, labels), | 1001 : ForEachStatement(isolate, labels), |
1002 assign_iterator_(NULL), | 1002 assign_iterator_(NULL), |
1003 next_result_(NULL), | 1003 next_result_(NULL), |
1004 result_done_(NULL), | 1004 result_done_(NULL), |
1005 assign_each_(NULL), | 1005 assign_each_(NULL), |
1006 back_edge_id_(GetNextId(isolate)) { | 1006 back_edge_id_(GetNextId(isolate)) { |
1007 } | 1007 } |
1008 | 1008 |
1009 Expression* assign_iterator_; | 1009 Expression* assign_iterator_; |
1010 Expression* next_result_; | 1010 Expression* next_result_; |
1011 Expression* result_done_; | 1011 Expression* result_done_; |
1012 Expression* assign_each_; | 1012 Expression* assign_each_; |
1013 const BailoutId back_edge_id_; | 1013 const BailoutId back_edge_id_; |
1014 }; | 1014 }; |
1015 | 1015 |
1016 | 1016 |
1017 class ExpressionStatement FINAL : public Statement { | 1017 class ExpressionStatement V8_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 virtual bool IsJump() const OVERRIDE { return expression_->IsThrow(); } | 1023 virtual bool IsJump() const V8_OVERRIDE { return expression_->IsThrow(); } |
1024 | 1024 |
1025 protected: | 1025 protected: |
1026 explicit ExpressionStatement(Expression* expression) | 1026 explicit ExpressionStatement(Expression* expression) |
1027 : expression_(expression) { } | 1027 : 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 virtual bool IsJump() const FINAL OVERRIDE { return true; } | 1036 virtual bool IsJump() const V8_FINAL V8_OVERRIDE { return true; } |
1037 | 1037 |
1038 protected: | 1038 protected: |
1039 JumpStatement() {} | 1039 JumpStatement() {} |
1040 }; | 1040 }; |
1041 | 1041 |
1042 | 1042 |
1043 class ContinueStatement FINAL : public JumpStatement { | 1043 class ContinueStatement V8_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(IterationStatement* target) | 1050 explicit ContinueStatement(IterationStatement* target) |
1051 : target_(target) { } | 1051 : 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 V8_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(BreakableStatement* target) | 1065 explicit BreakStatement(BreakableStatement* target) |
1066 : target_(target) { } | 1066 : 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 V8_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(Expression* expression) | 1080 explicit ReturnStatement(Expression* expression) |
1081 : expression_(expression) { } | 1081 : 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 V8_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 protected: | 1096 protected: |
1097 WithStatement(Scope* scope, Expression* expression, Statement* statement) | 1097 WithStatement(Scope* scope, Expression* expression, Statement* statement) |
1098 : scope_(scope), | 1098 : scope_(scope), |
1099 expression_(expression), | 1099 expression_(expression), |
1100 statement_(statement) { } | 1100 statement_(statement) { } |
1101 | 1101 |
1102 private: | 1102 private: |
1103 Scope* scope_; | 1103 Scope* scope_; |
1104 Expression* expression_; | 1104 Expression* expression_; |
1105 Statement* statement_; | 1105 Statement* statement_; |
1106 }; | 1106 }; |
1107 | 1107 |
1108 | 1108 |
1109 class CaseClause FINAL : public ZoneObject { | 1109 class CaseClause V8_FINAL : public ZoneObject { |
1110 public: | 1110 public: |
1111 CaseClause(Isolate* isolate, | 1111 CaseClause(Isolate* isolate, |
1112 Expression* label, | 1112 Expression* label, |
1113 ZoneList<Statement*>* statements, | 1113 ZoneList<Statement*>* statements, |
1114 int pos); | 1114 int pos); |
1115 | 1115 |
1116 bool is_default() const { return label_ == NULL; } | 1116 bool is_default() const { return label_ == NULL; } |
1117 Expression* label() const { | 1117 Expression* label() const { |
1118 CHECK(!is_default()); | 1118 CHECK(!is_default()); |
1119 return label_; | 1119 return label_; |
(...skipping 16 matching lines...) Expand all Loading... |
1136 Label body_target_; | 1136 Label body_target_; |
1137 ZoneList<Statement*>* statements_; | 1137 ZoneList<Statement*>* statements_; |
1138 int position_; | 1138 int position_; |
1139 Handle<Type> compare_type_; | 1139 Handle<Type> compare_type_; |
1140 | 1140 |
1141 const TypeFeedbackId compare_id_; | 1141 const TypeFeedbackId compare_id_; |
1142 const BailoutId entry_id_; | 1142 const BailoutId entry_id_; |
1143 }; | 1143 }; |
1144 | 1144 |
1145 | 1145 |
1146 class SwitchStatement FINAL : public BreakableStatement { | 1146 class SwitchStatement V8_FINAL : public BreakableStatement { |
1147 public: | 1147 public: |
1148 DECLARE_NODE_TYPE(SwitchStatement) | 1148 DECLARE_NODE_TYPE(SwitchStatement) |
1149 | 1149 |
1150 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { | 1150 void Initialize(Expression* tag, ZoneList<CaseClause*>* cases) { |
1151 tag_ = tag; | 1151 tag_ = tag; |
1152 cases_ = cases; | 1152 cases_ = cases; |
1153 switch_type_ = UNKNOWN_SWITCH; | 1153 switch_type_ = UNKNOWN_SWITCH; |
1154 } | 1154 } |
1155 | 1155 |
1156 Expression* tag() const { return tag_; } | 1156 Expression* tag() const { return tag_; } |
(...skipping 14 matching lines...) Expand all Loading... |
1171 ZoneList<CaseClause*>* cases_; | 1171 ZoneList<CaseClause*>* cases_; |
1172 SwitchType switch_type_; | 1172 SwitchType switch_type_; |
1173 }; | 1173 }; |
1174 | 1174 |
1175 | 1175 |
1176 // If-statements always have non-null references to their then- and | 1176 // If-statements always have non-null references to their then- and |
1177 // else-parts. When parsing if-statements with no explicit else-part, | 1177 // else-parts. When parsing if-statements with no explicit else-part, |
1178 // the parser implicitly creates an empty statement. Use the | 1178 // the parser implicitly creates an empty statement. Use the |
1179 // HasThenStatement() and HasElseStatement() functions to check if a | 1179 // HasThenStatement() and HasElseStatement() functions to check if a |
1180 // given if-statement has a then- or an else-part containing code. | 1180 // given if-statement has a then- or an else-part containing code. |
1181 class IfStatement FINAL : public Statement { | 1181 class IfStatement V8_FINAL : public Statement { |
1182 public: | 1182 public: |
1183 DECLARE_NODE_TYPE(IfStatement) | 1183 DECLARE_NODE_TYPE(IfStatement) |
1184 | 1184 |
1185 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } | 1185 bool HasThenStatement() const { return !then_statement()->IsEmpty(); } |
1186 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } | 1186 bool HasElseStatement() const { return !else_statement()->IsEmpty(); } |
1187 | 1187 |
1188 Expression* condition() const { return condition_; } | 1188 Expression* condition() const { return condition_; } |
1189 Statement* then_statement() const { return then_statement_; } | 1189 Statement* then_statement() const { return then_statement_; } |
1190 Statement* else_statement() const { return else_statement_; } | 1190 Statement* else_statement() const { return else_statement_; } |
1191 | 1191 |
1192 virtual bool IsJump() const OVERRIDE { | 1192 virtual bool IsJump() const V8_OVERRIDE { |
1193 return HasThenStatement() && then_statement()->IsJump() | 1193 return HasThenStatement() && then_statement()->IsJump() |
1194 && HasElseStatement() && else_statement()->IsJump(); | 1194 && HasElseStatement() && else_statement()->IsJump(); |
1195 } | 1195 } |
1196 | 1196 |
1197 BailoutId IfId() const { return if_id_; } | 1197 BailoutId IfId() const { return if_id_; } |
1198 BailoutId ThenId() const { return then_id_; } | 1198 BailoutId ThenId() const { return then_id_; } |
1199 BailoutId ElseId() const { return else_id_; } | 1199 BailoutId ElseId() const { return else_id_; } |
1200 | 1200 |
1201 protected: | 1201 protected: |
1202 IfStatement(Isolate* isolate, | 1202 IfStatement(Isolate* isolate, |
(...skipping 13 matching lines...) Expand all Loading... |
1216 Statement* then_statement_; | 1216 Statement* then_statement_; |
1217 Statement* else_statement_; | 1217 Statement* else_statement_; |
1218 const BailoutId if_id_; | 1218 const BailoutId if_id_; |
1219 const BailoutId then_id_; | 1219 const BailoutId then_id_; |
1220 const BailoutId else_id_; | 1220 const BailoutId else_id_; |
1221 }; | 1221 }; |
1222 | 1222 |
1223 | 1223 |
1224 // NOTE: TargetCollectors are represented as nodes to fit in the target | 1224 // NOTE: TargetCollectors are represented as nodes to fit in the target |
1225 // stack in the compiler; this should probably be reworked. | 1225 // stack in the compiler; this should probably be reworked. |
1226 class TargetCollector FINAL : public AstNode { | 1226 class TargetCollector V8_FINAL : public AstNode { |
1227 public: | 1227 public: |
1228 explicit TargetCollector(Zone* zone) : targets_(0, zone) { } | 1228 explicit TargetCollector(Zone* zone) : targets_(0, zone) { } |
1229 | 1229 |
1230 // Adds a jump target to the collector. The collector stores a pointer not | 1230 // Adds a jump target to the collector. The collector stores a pointer not |
1231 // a copy of the target to make binding work, so make sure not to pass in | 1231 // a copy of the target to make binding work, so make sure not to pass in |
1232 // references to something on the stack. | 1232 // references to something on the stack. |
1233 void AddTarget(Label* target, Zone* zone); | 1233 void AddTarget(Label* target, Zone* zone); |
1234 | 1234 |
1235 // Virtual behaviour. TargetCollectors are never part of the AST. | 1235 // Virtual behaviour. TargetCollectors are never part of the AST. |
1236 virtual void Accept(AstVisitor* v) OVERRIDE { UNREACHABLE(); } | 1236 virtual void Accept(AstVisitor* v) V8_OVERRIDE { UNREACHABLE(); } |
1237 virtual NodeType node_type() const OVERRIDE { return kInvalid; } | 1237 virtual NodeType node_type() const V8_OVERRIDE { return kInvalid; } |
1238 virtual TargetCollector* AsTargetCollector() OVERRIDE { return this; } | 1238 virtual TargetCollector* AsTargetCollector() V8_OVERRIDE { return this; } |
1239 | 1239 |
1240 ZoneList<Label*>* targets() { return &targets_; } | 1240 ZoneList<Label*>* targets() { return &targets_; } |
1241 | 1241 |
1242 private: | 1242 private: |
1243 ZoneList<Label*> targets_; | 1243 ZoneList<Label*> targets_; |
1244 }; | 1244 }; |
1245 | 1245 |
1246 | 1246 |
1247 class TryStatement : public Statement { | 1247 class TryStatement : public Statement { |
1248 public: | 1248 public: |
(...skipping 13 matching lines...) Expand all Loading... |
1262 | 1262 |
1263 private: | 1263 private: |
1264 // Unique (per-function) index of this handler. This is not an AST ID. | 1264 // Unique (per-function) index of this handler. This is not an AST ID. |
1265 int index_; | 1265 int index_; |
1266 | 1266 |
1267 Block* try_block_; | 1267 Block* try_block_; |
1268 ZoneList<Label*>* escaping_targets_; | 1268 ZoneList<Label*>* escaping_targets_; |
1269 }; | 1269 }; |
1270 | 1270 |
1271 | 1271 |
1272 class TryCatchStatement FINAL : public TryStatement { | 1272 class TryCatchStatement V8_FINAL : public TryStatement { |
1273 public: | 1273 public: |
1274 DECLARE_NODE_TYPE(TryCatchStatement) | 1274 DECLARE_NODE_TYPE(TryCatchStatement) |
1275 | 1275 |
1276 Scope* scope() { return scope_; } | 1276 Scope* scope() { return scope_; } |
1277 Variable* variable() { return variable_; } | 1277 Variable* variable() { return variable_; } |
1278 Block* catch_block() const { return catch_block_; } | 1278 Block* catch_block() const { return catch_block_; } |
1279 | 1279 |
1280 protected: | 1280 protected: |
1281 TryCatchStatement(int index, | 1281 TryCatchStatement(int index, |
1282 Block* try_block, | 1282 Block* try_block, |
1283 Scope* scope, | 1283 Scope* scope, |
1284 Variable* variable, | 1284 Variable* variable, |
1285 Block* catch_block) | 1285 Block* catch_block) |
1286 : TryStatement(index, try_block), | 1286 : TryStatement(index, try_block), |
1287 scope_(scope), | 1287 scope_(scope), |
1288 variable_(variable), | 1288 variable_(variable), |
1289 catch_block_(catch_block) { | 1289 catch_block_(catch_block) { |
1290 } | 1290 } |
1291 | 1291 |
1292 private: | 1292 private: |
1293 Scope* scope_; | 1293 Scope* scope_; |
1294 Variable* variable_; | 1294 Variable* variable_; |
1295 Block* catch_block_; | 1295 Block* catch_block_; |
1296 }; | 1296 }; |
1297 | 1297 |
1298 | 1298 |
1299 class TryFinallyStatement FINAL : public TryStatement { | 1299 class TryFinallyStatement V8_FINAL : public TryStatement { |
1300 public: | 1300 public: |
1301 DECLARE_NODE_TYPE(TryFinallyStatement) | 1301 DECLARE_NODE_TYPE(TryFinallyStatement) |
1302 | 1302 |
1303 Block* finally_block() const { return finally_block_; } | 1303 Block* finally_block() const { return finally_block_; } |
1304 | 1304 |
1305 protected: | 1305 protected: |
1306 TryFinallyStatement(int index, Block* try_block, Block* finally_block) | 1306 TryFinallyStatement(int index, Block* try_block, Block* finally_block) |
1307 : TryStatement(index, try_block), | 1307 : TryStatement(index, try_block), |
1308 finally_block_(finally_block) { } | 1308 finally_block_(finally_block) { } |
1309 | 1309 |
1310 private: | 1310 private: |
1311 Block* finally_block_; | 1311 Block* finally_block_; |
1312 }; | 1312 }; |
1313 | 1313 |
1314 | 1314 |
1315 class DebuggerStatement FINAL : public Statement { | 1315 class DebuggerStatement V8_FINAL : public Statement { |
1316 public: | 1316 public: |
1317 DECLARE_NODE_TYPE(DebuggerStatement) | 1317 DECLARE_NODE_TYPE(DebuggerStatement) |
1318 | 1318 |
1319 protected: | 1319 protected: |
1320 DebuggerStatement() {} | 1320 DebuggerStatement() {} |
1321 }; | 1321 }; |
1322 | 1322 |
1323 | 1323 |
1324 class EmptyStatement FINAL : public Statement { | 1324 class EmptyStatement V8_FINAL : public Statement { |
1325 public: | 1325 public: |
1326 DECLARE_NODE_TYPE(EmptyStatement) | 1326 DECLARE_NODE_TYPE(EmptyStatement) |
1327 | 1327 |
1328 protected: | 1328 protected: |
1329 EmptyStatement() {} | 1329 EmptyStatement() {} |
1330 }; | 1330 }; |
1331 | 1331 |
1332 | 1332 |
1333 class Literal FINAL : public Expression { | 1333 class Literal V8_FINAL : public Expression { |
1334 public: | 1334 public: |
1335 DECLARE_NODE_TYPE(Literal) | 1335 DECLARE_NODE_TYPE(Literal) |
1336 | 1336 |
1337 virtual bool IsPropertyName() OVERRIDE { | 1337 virtual bool IsPropertyName() V8_OVERRIDE { |
1338 if (value_->IsInternalizedString()) { | 1338 if (value_->IsInternalizedString()) { |
1339 uint32_t ignored; | 1339 uint32_t ignored; |
1340 return !String::cast(*value_)->AsArrayIndex(&ignored); | 1340 return !String::cast(*value_)->AsArrayIndex(&ignored); |
1341 } | 1341 } |
1342 return false; | 1342 return false; |
1343 } | 1343 } |
1344 | 1344 |
1345 Handle<String> AsPropertyName() { | 1345 Handle<String> AsPropertyName() { |
1346 ASSERT(IsPropertyName()); | 1346 ASSERT(IsPropertyName()); |
1347 return Handle<String>::cast(value_); | 1347 return Handle<String>::cast(value_); |
1348 } | 1348 } |
1349 | 1349 |
1350 virtual bool ToBooleanIsTrue() OVERRIDE { return value_->BooleanValue(); } | 1350 virtual bool ToBooleanIsTrue() V8_OVERRIDE { |
1351 virtual bool ToBooleanIsFalse() OVERRIDE { return !value_->BooleanValue(); } | 1351 return value_->BooleanValue(); |
| 1352 } |
| 1353 virtual bool ToBooleanIsFalse() V8_OVERRIDE { |
| 1354 return !value_->BooleanValue(); |
| 1355 } |
1352 | 1356 |
1353 // Identity testers. | 1357 // Identity testers. |
1354 bool IsNull() const { | 1358 bool IsNull() const { |
1355 ASSERT(!value_.is_null()); | 1359 ASSERT(!value_.is_null()); |
1356 return value_->IsNull(); | 1360 return value_->IsNull(); |
1357 } | 1361 } |
1358 bool IsTrue() const { | 1362 bool IsTrue() const { |
1359 ASSERT(!value_.is_null()); | 1363 ASSERT(!value_.is_null()); |
1360 return value_->IsTrue(); | 1364 return value_->IsTrue(); |
1361 } | 1365 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 private: | 1420 private: |
1417 int literal_index_; | 1421 int literal_index_; |
1418 bool is_simple_; | 1422 bool is_simple_; |
1419 int depth_; | 1423 int depth_; |
1420 }; | 1424 }; |
1421 | 1425 |
1422 | 1426 |
1423 // Property is used for passing information | 1427 // Property is used for passing information |
1424 // about an object literal's properties from the parser | 1428 // about an object literal's properties from the parser |
1425 // to the code generator. | 1429 // to the code generator. |
1426 class ObjectLiteralProperty FINAL : public ZoneObject { | 1430 class ObjectLiteralProperty V8_FINAL : public ZoneObject { |
1427 public: | 1431 public: |
1428 enum Kind { | 1432 enum Kind { |
1429 CONSTANT, // Property with constant value (compile time). | 1433 CONSTANT, // Property with constant value (compile time). |
1430 COMPUTED, // Property with computed value (execution time). | 1434 COMPUTED, // Property with computed value (execution time). |
1431 MATERIALIZED_LITERAL, // Property value is a materialized literal. | 1435 MATERIALIZED_LITERAL, // Property value is a materialized literal. |
1432 GETTER, SETTER, // Property is an accessor function. | 1436 GETTER, SETTER, // Property is an accessor function. |
1433 PROTOTYPE // Property is __proto__. | 1437 PROTOTYPE // Property is __proto__. |
1434 }; | 1438 }; |
1435 | 1439 |
1436 ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate); | 1440 ObjectLiteralProperty(Literal* key, Expression* value, Isolate* isolate); |
(...skipping 22 matching lines...) Expand all Loading... |
1459 Literal* key_; | 1463 Literal* key_; |
1460 Expression* value_; | 1464 Expression* value_; |
1461 Kind kind_; | 1465 Kind kind_; |
1462 bool emit_store_; | 1466 bool emit_store_; |
1463 Handle<Map> receiver_type_; | 1467 Handle<Map> receiver_type_; |
1464 }; | 1468 }; |
1465 | 1469 |
1466 | 1470 |
1467 // An object literal has a boilerplate object that is used | 1471 // An object literal has a boilerplate object that is used |
1468 // for minimizing the work when constructing it at runtime. | 1472 // for minimizing the work when constructing it at runtime. |
1469 class ObjectLiteral FINAL : public MaterializedLiteral { | 1473 class ObjectLiteral V8_FINAL : public MaterializedLiteral { |
1470 public: | 1474 public: |
1471 typedef ObjectLiteralProperty Property; | 1475 typedef ObjectLiteralProperty Property; |
1472 | 1476 |
1473 DECLARE_NODE_TYPE(ObjectLiteral) | 1477 DECLARE_NODE_TYPE(ObjectLiteral) |
1474 | 1478 |
1475 Handle<FixedArray> constant_properties() const { | 1479 Handle<FixedArray> constant_properties() const { |
1476 return constant_properties_; | 1480 return constant_properties_; |
1477 } | 1481 } |
1478 ZoneList<Property*>* properties() const { return properties_; } | 1482 ZoneList<Property*>* properties() const { return properties_; } |
1479 bool fast_elements() const { return fast_elements_; } | 1483 bool fast_elements() const { return fast_elements_; } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1517 private: | 1521 private: |
1518 Handle<FixedArray> constant_properties_; | 1522 Handle<FixedArray> constant_properties_; |
1519 ZoneList<Property*>* properties_; | 1523 ZoneList<Property*>* properties_; |
1520 bool fast_elements_; | 1524 bool fast_elements_; |
1521 bool may_store_doubles_; | 1525 bool may_store_doubles_; |
1522 bool has_function_; | 1526 bool has_function_; |
1523 }; | 1527 }; |
1524 | 1528 |
1525 | 1529 |
1526 // Node for capturing a regexp literal. | 1530 // Node for capturing a regexp literal. |
1527 class RegExpLiteral FINAL : public MaterializedLiteral { | 1531 class RegExpLiteral V8_FINAL : public MaterializedLiteral { |
1528 public: | 1532 public: |
1529 DECLARE_NODE_TYPE(RegExpLiteral) | 1533 DECLARE_NODE_TYPE(RegExpLiteral) |
1530 | 1534 |
1531 Handle<String> pattern() const { return pattern_; } | 1535 Handle<String> pattern() const { return pattern_; } |
1532 Handle<String> flags() const { return flags_; } | 1536 Handle<String> flags() const { return flags_; } |
1533 | 1537 |
1534 protected: | 1538 protected: |
1535 RegExpLiteral(Isolate* isolate, | 1539 RegExpLiteral(Isolate* isolate, |
1536 Handle<String> pattern, | 1540 Handle<String> pattern, |
1537 Handle<String> flags, | 1541 Handle<String> flags, |
1538 int literal_index) | 1542 int literal_index) |
1539 : MaterializedLiteral(isolate, literal_index, false, 1), | 1543 : MaterializedLiteral(isolate, literal_index, false, 1), |
1540 pattern_(pattern), | 1544 pattern_(pattern), |
1541 flags_(flags) {} | 1545 flags_(flags) {} |
1542 | 1546 |
1543 private: | 1547 private: |
1544 Handle<String> pattern_; | 1548 Handle<String> pattern_; |
1545 Handle<String> flags_; | 1549 Handle<String> flags_; |
1546 }; | 1550 }; |
1547 | 1551 |
1548 // An array literal has a literals object that is used | 1552 // An array literal has a literals object that is used |
1549 // for minimizing the work when constructing it at runtime. | 1553 // for minimizing the work when constructing it at runtime. |
1550 class ArrayLiteral FINAL : public MaterializedLiteral { | 1554 class ArrayLiteral V8_FINAL : public MaterializedLiteral { |
1551 public: | 1555 public: |
1552 DECLARE_NODE_TYPE(ArrayLiteral) | 1556 DECLARE_NODE_TYPE(ArrayLiteral) |
1553 | 1557 |
1554 Handle<FixedArray> constant_elements() const { return constant_elements_; } | 1558 Handle<FixedArray> constant_elements() const { return constant_elements_; } |
1555 ZoneList<Expression*>* values() const { return values_; } | 1559 ZoneList<Expression*>* values() const { return values_; } |
1556 | 1560 |
1557 // Return an AST id for an element that is used in simulate instructions. | 1561 // Return an AST id for an element that is used in simulate instructions. |
1558 BailoutId GetIdForElement(int i) { | 1562 BailoutId GetIdForElement(int i) { |
1559 return BailoutId(first_element_id_.ToInt() + i); | 1563 return BailoutId(first_element_id_.ToInt() + i); |
1560 } | 1564 } |
(...skipping 10 matching lines...) Expand all Loading... |
1571 values_(values), | 1575 values_(values), |
1572 first_element_id_(ReserveIdRange(isolate, values->length())) {} | 1576 first_element_id_(ReserveIdRange(isolate, values->length())) {} |
1573 | 1577 |
1574 private: | 1578 private: |
1575 Handle<FixedArray> constant_elements_; | 1579 Handle<FixedArray> constant_elements_; |
1576 ZoneList<Expression*>* values_; | 1580 ZoneList<Expression*>* values_; |
1577 const BailoutId first_element_id_; | 1581 const BailoutId first_element_id_; |
1578 }; | 1582 }; |
1579 | 1583 |
1580 | 1584 |
1581 class VariableProxy FINAL : public Expression { | 1585 class VariableProxy V8_FINAL : public Expression { |
1582 public: | 1586 public: |
1583 DECLARE_NODE_TYPE(VariableProxy) | 1587 DECLARE_NODE_TYPE(VariableProxy) |
1584 | 1588 |
1585 virtual bool IsValidLeftHandSide() OVERRIDE { | 1589 virtual bool IsValidLeftHandSide() V8_OVERRIDE { |
1586 return var_ == NULL ? true : var_->IsValidLeftHandSide(); | 1590 return var_ == NULL ? true : var_->IsValidLeftHandSide(); |
1587 } | 1591 } |
1588 | 1592 |
1589 bool IsVariable(Handle<String> n) { | 1593 bool IsVariable(Handle<String> n) { |
1590 return !is_this() && name().is_identical_to(n); | 1594 return !is_this() && name().is_identical_to(n); |
1591 } | 1595 } |
1592 | 1596 |
1593 bool IsArguments() { return var_ != NULL && var_->is_arguments(); } | 1597 bool IsArguments() { return var_ != NULL && var_->is_arguments(); } |
1594 | 1598 |
1595 bool IsLValue() { | 1599 bool IsLValue() { |
(...skipping 27 matching lines...) Expand all Loading... |
1623 bool is_this_; | 1627 bool is_this_; |
1624 bool is_trivial_; | 1628 bool is_trivial_; |
1625 // True if this variable proxy is being used in an assignment | 1629 // True if this variable proxy is being used in an assignment |
1626 // or with a increment/decrement operator. | 1630 // or with a increment/decrement operator. |
1627 bool is_lvalue_; | 1631 bool is_lvalue_; |
1628 int position_; | 1632 int position_; |
1629 Interface* interface_; | 1633 Interface* interface_; |
1630 }; | 1634 }; |
1631 | 1635 |
1632 | 1636 |
1633 class Property FINAL : public Expression { | 1637 class Property V8_FINAL : public Expression { |
1634 public: | 1638 public: |
1635 DECLARE_NODE_TYPE(Property) | 1639 DECLARE_NODE_TYPE(Property) |
1636 | 1640 |
1637 virtual bool IsValidLeftHandSide() OVERRIDE { return true; } | 1641 virtual bool IsValidLeftHandSide() V8_OVERRIDE { return true; } |
1638 | 1642 |
1639 Expression* obj() const { return obj_; } | 1643 Expression* obj() const { return obj_; } |
1640 Expression* key() const { return key_; } | 1644 Expression* key() const { return key_; } |
1641 virtual int position() const OVERRIDE { return pos_; } | 1645 virtual int position() const V8_OVERRIDE { return pos_; } |
1642 | 1646 |
1643 BailoutId LoadId() const { return load_id_; } | 1647 BailoutId LoadId() const { return load_id_; } |
1644 | 1648 |
1645 bool IsStringLength() const { return is_string_length_; } | 1649 bool IsStringLength() const { return is_string_length_; } |
1646 bool IsStringAccess() const { return is_string_access_; } | 1650 bool IsStringAccess() const { return is_string_access_; } |
1647 bool IsFunctionPrototype() const { return is_function_prototype_; } | 1651 bool IsFunctionPrototype() const { return is_function_prototype_; } |
1648 | 1652 |
1649 // Type feedback information. | 1653 // Type feedback information. |
1650 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 1654 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
1651 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } | 1655 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
1652 virtual SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } | 1656 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
1653 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 1657 return &receiver_types_; |
| 1658 } |
| 1659 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
1654 return STANDARD_STORE; | 1660 return STANDARD_STORE; |
1655 } | 1661 } |
1656 bool IsUninitialized() { return is_uninitialized_; } | 1662 bool IsUninitialized() { return is_uninitialized_; } |
1657 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } | 1663 TypeFeedbackId PropertyFeedbackId() { return reuse(id()); } |
1658 | 1664 |
1659 protected: | 1665 protected: |
1660 Property(Isolate* isolate, | 1666 Property(Isolate* isolate, |
1661 Expression* obj, | 1667 Expression* obj, |
1662 Expression* key, | 1668 Expression* key, |
1663 int pos) | 1669 int pos) |
(...skipping 16 matching lines...) Expand all Loading... |
1680 | 1686 |
1681 SmallMapList receiver_types_; | 1687 SmallMapList receiver_types_; |
1682 bool is_monomorphic_ : 1; | 1688 bool is_monomorphic_ : 1; |
1683 bool is_uninitialized_ : 1; | 1689 bool is_uninitialized_ : 1; |
1684 bool is_string_length_ : 1; | 1690 bool is_string_length_ : 1; |
1685 bool is_string_access_ : 1; | 1691 bool is_string_access_ : 1; |
1686 bool is_function_prototype_ : 1; | 1692 bool is_function_prototype_ : 1; |
1687 }; | 1693 }; |
1688 | 1694 |
1689 | 1695 |
1690 class Call FINAL : public Expression { | 1696 class Call V8_FINAL : public Expression { |
1691 public: | 1697 public: |
1692 DECLARE_NODE_TYPE(Call) | 1698 DECLARE_NODE_TYPE(Call) |
1693 | 1699 |
1694 Expression* expression() const { return expression_; } | 1700 Expression* expression() const { return expression_; } |
1695 ZoneList<Expression*>* arguments() const { return arguments_; } | 1701 ZoneList<Expression*>* arguments() const { return arguments_; } |
1696 virtual int position() const FINAL { return pos_; } | 1702 virtual int position() const V8_FINAL { return pos_; } |
1697 | 1703 |
1698 // Type feedback information. | 1704 // Type feedback information. |
1699 TypeFeedbackId CallFeedbackId() const { return reuse(id()); } | 1705 TypeFeedbackId CallFeedbackId() const { return reuse(id()); } |
1700 void RecordTypeFeedback(TypeFeedbackOracle* oracle, CallKind call_kind); | 1706 void RecordTypeFeedback(TypeFeedbackOracle* oracle, CallKind call_kind); |
1701 virtual SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } | 1707 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
1702 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } | 1708 return &receiver_types_; |
| 1709 } |
| 1710 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
1703 CheckType check_type() const { return check_type_; } | 1711 CheckType check_type() const { return check_type_; } |
1704 | 1712 |
1705 void set_string_check(Handle<JSObject> holder) { | 1713 void set_string_check(Handle<JSObject> holder) { |
1706 holder_ = holder; | 1714 holder_ = holder; |
1707 check_type_ = STRING_CHECK; | 1715 check_type_ = STRING_CHECK; |
1708 } | 1716 } |
1709 | 1717 |
1710 void set_number_check(Handle<JSObject> holder) { | 1718 void set_number_check(Handle<JSObject> holder) { |
1711 holder_ = holder; | 1719 holder_ = holder; |
1712 check_type_ = NUMBER_CHECK; | 1720 check_type_ = NUMBER_CHECK; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 CheckType check_type_; | 1771 CheckType check_type_; |
1764 SmallMapList receiver_types_; | 1772 SmallMapList receiver_types_; |
1765 Handle<JSFunction> target_; | 1773 Handle<JSFunction> target_; |
1766 Handle<JSObject> holder_; | 1774 Handle<JSObject> holder_; |
1767 Handle<Cell> cell_; | 1775 Handle<Cell> cell_; |
1768 | 1776 |
1769 const BailoutId return_id_; | 1777 const BailoutId return_id_; |
1770 }; | 1778 }; |
1771 | 1779 |
1772 | 1780 |
1773 class CallNew FINAL : public Expression { | 1781 class CallNew V8_FINAL : public Expression { |
1774 public: | 1782 public: |
1775 DECLARE_NODE_TYPE(CallNew) | 1783 DECLARE_NODE_TYPE(CallNew) |
1776 | 1784 |
1777 Expression* expression() const { return expression_; } | 1785 Expression* expression() const { return expression_; } |
1778 ZoneList<Expression*>* arguments() const { return arguments_; } | 1786 ZoneList<Expression*>* arguments() const { return arguments_; } |
1779 virtual int position() const OVERRIDE { return pos_; } | 1787 virtual int position() const V8_OVERRIDE { return pos_; } |
1780 | 1788 |
1781 // Type feedback information. | 1789 // Type feedback information. |
1782 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } | 1790 TypeFeedbackId CallNewFeedbackId() const { return reuse(id()); } |
1783 void RecordTypeFeedback(TypeFeedbackOracle* oracle); | 1791 void RecordTypeFeedback(TypeFeedbackOracle* oracle); |
1784 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } | 1792 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
1785 Handle<JSFunction> target() const { return target_; } | 1793 Handle<JSFunction> target() const { return target_; } |
1786 ElementsKind elements_kind() const { return elements_kind_; } | 1794 ElementsKind elements_kind() const { return elements_kind_; } |
1787 Handle<Cell> allocation_info_cell() const { | 1795 Handle<Cell> allocation_info_cell() const { |
1788 return allocation_info_cell_; | 1796 return allocation_info_cell_; |
1789 } | 1797 } |
1790 | 1798 |
1791 BailoutId ReturnId() const { return return_id_; } | 1799 BailoutId ReturnId() const { return return_id_; } |
1792 | 1800 |
1793 protected: | 1801 protected: |
1794 CallNew(Isolate* isolate, | 1802 CallNew(Isolate* isolate, |
(...skipping 19 matching lines...) Expand all Loading... |
1814 Handle<Cell> allocation_info_cell_; | 1822 Handle<Cell> allocation_info_cell_; |
1815 | 1823 |
1816 const BailoutId return_id_; | 1824 const BailoutId return_id_; |
1817 }; | 1825 }; |
1818 | 1826 |
1819 | 1827 |
1820 // The CallRuntime class does not represent any official JavaScript | 1828 // The CallRuntime class does not represent any official JavaScript |
1821 // language construct. Instead it is used to call a C or JS function | 1829 // language construct. Instead it is used to call a C or JS function |
1822 // with a set of arguments. This is used from the builtins that are | 1830 // with a set of arguments. This is used from the builtins that are |
1823 // implemented in JavaScript (see "v8natives.js"). | 1831 // implemented in JavaScript (see "v8natives.js"). |
1824 class CallRuntime FINAL : public Expression { | 1832 class CallRuntime V8_FINAL : public Expression { |
1825 public: | 1833 public: |
1826 DECLARE_NODE_TYPE(CallRuntime) | 1834 DECLARE_NODE_TYPE(CallRuntime) |
1827 | 1835 |
1828 Handle<String> name() const { return name_; } | 1836 Handle<String> name() const { return name_; } |
1829 const Runtime::Function* function() const { return function_; } | 1837 const Runtime::Function* function() const { return function_; } |
1830 ZoneList<Expression*>* arguments() const { return arguments_; } | 1838 ZoneList<Expression*>* arguments() const { return arguments_; } |
1831 bool is_jsruntime() const { return function_ == NULL; } | 1839 bool is_jsruntime() const { return function_ == NULL; } |
1832 | 1840 |
1833 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } | 1841 TypeFeedbackId CallRuntimeFeedbackId() const { return reuse(id()); } |
1834 | 1842 |
1835 protected: | 1843 protected: |
1836 CallRuntime(Isolate* isolate, | 1844 CallRuntime(Isolate* isolate, |
1837 Handle<String> name, | 1845 Handle<String> name, |
1838 const Runtime::Function* function, | 1846 const Runtime::Function* function, |
1839 ZoneList<Expression*>* arguments) | 1847 ZoneList<Expression*>* arguments) |
1840 : Expression(isolate), | 1848 : Expression(isolate), |
1841 name_(name), | 1849 name_(name), |
1842 function_(function), | 1850 function_(function), |
1843 arguments_(arguments) { } | 1851 arguments_(arguments) { } |
1844 | 1852 |
1845 private: | 1853 private: |
1846 Handle<String> name_; | 1854 Handle<String> name_; |
1847 const Runtime::Function* function_; | 1855 const Runtime::Function* function_; |
1848 ZoneList<Expression*>* arguments_; | 1856 ZoneList<Expression*>* arguments_; |
1849 }; | 1857 }; |
1850 | 1858 |
1851 | 1859 |
1852 class UnaryOperation FINAL : public Expression { | 1860 class UnaryOperation V8_FINAL : public Expression { |
1853 public: | 1861 public: |
1854 DECLARE_NODE_TYPE(UnaryOperation) | 1862 DECLARE_NODE_TYPE(UnaryOperation) |
1855 | 1863 |
1856 Token::Value op() const { return op_; } | 1864 Token::Value op() const { return op_; } |
1857 Expression* expression() const { return expression_; } | 1865 Expression* expression() const { return expression_; } |
1858 virtual int position() const OVERRIDE { return pos_; } | 1866 virtual int position() const V8_OVERRIDE { return pos_; } |
1859 | 1867 |
1860 BailoutId MaterializeTrueId() { return materialize_true_id_; } | 1868 BailoutId MaterializeTrueId() { return materialize_true_id_; } |
1861 BailoutId MaterializeFalseId() { return materialize_false_id_; } | 1869 BailoutId MaterializeFalseId() { return materialize_false_id_; } |
1862 | 1870 |
1863 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) OVERRIDE; | 1871 virtual void RecordToBooleanTypeFeedback( |
| 1872 TypeFeedbackOracle* oracle) V8_OVERRIDE; |
1864 | 1873 |
1865 protected: | 1874 protected: |
1866 UnaryOperation(Isolate* isolate, | 1875 UnaryOperation(Isolate* isolate, |
1867 Token::Value op, | 1876 Token::Value op, |
1868 Expression* expression, | 1877 Expression* expression, |
1869 int pos) | 1878 int pos) |
1870 : Expression(isolate), | 1879 : Expression(isolate), |
1871 op_(op), | 1880 op_(op), |
1872 expression_(expression), | 1881 expression_(expression), |
1873 pos_(pos), | 1882 pos_(pos), |
1874 materialize_true_id_(GetNextId(isolate)), | 1883 materialize_true_id_(GetNextId(isolate)), |
1875 materialize_false_id_(GetNextId(isolate)) { | 1884 materialize_false_id_(GetNextId(isolate)) { |
1876 ASSERT(Token::IsUnaryOp(op)); | 1885 ASSERT(Token::IsUnaryOp(op)); |
1877 } | 1886 } |
1878 | 1887 |
1879 private: | 1888 private: |
1880 Token::Value op_; | 1889 Token::Value op_; |
1881 Expression* expression_; | 1890 Expression* expression_; |
1882 int pos_; | 1891 int pos_; |
1883 | 1892 |
1884 // For unary not (Token::NOT), the AST ids where true and false will | 1893 // For unary not (Token::NOT), the AST ids where true and false will |
1885 // actually be materialized, respectively. | 1894 // actually be materialized, respectively. |
1886 const BailoutId materialize_true_id_; | 1895 const BailoutId materialize_true_id_; |
1887 const BailoutId materialize_false_id_; | 1896 const BailoutId materialize_false_id_; |
1888 }; | 1897 }; |
1889 | 1898 |
1890 | 1899 |
1891 class BinaryOperation FINAL : public Expression { | 1900 class BinaryOperation V8_FINAL : public Expression { |
1892 public: | 1901 public: |
1893 DECLARE_NODE_TYPE(BinaryOperation) | 1902 DECLARE_NODE_TYPE(BinaryOperation) |
1894 | 1903 |
1895 virtual bool ResultOverwriteAllowed(); | 1904 virtual bool ResultOverwriteAllowed(); |
1896 | 1905 |
1897 Token::Value op() const { return op_; } | 1906 Token::Value op() const { return op_; } |
1898 Expression* left() const { return left_; } | 1907 Expression* left() const { return left_; } |
1899 Expression* right() const { return right_; } | 1908 Expression* right() const { return right_; } |
1900 virtual int position() const OVERRIDE { return pos_; } | 1909 virtual int position() const V8_OVERRIDE { return pos_; } |
1901 | 1910 |
1902 BailoutId RightId() const { return right_id_; } | 1911 BailoutId RightId() const { return right_id_; } |
1903 | 1912 |
1904 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } | 1913 TypeFeedbackId BinaryOperationFeedbackId() const { return reuse(id()); } |
1905 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } | 1914 Maybe<int> fixed_right_arg() const { return fixed_right_arg_; } |
1906 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } | 1915 void set_fixed_right_arg(Maybe<int> arg) { fixed_right_arg_ = arg; } |
1907 | 1916 |
1908 virtual void RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) OVERRIDE; | 1917 virtual void RecordToBooleanTypeFeedback( |
| 1918 TypeFeedbackOracle* oracle) V8_OVERRIDE; |
1909 | 1919 |
1910 protected: | 1920 protected: |
1911 BinaryOperation(Isolate* isolate, | 1921 BinaryOperation(Isolate* isolate, |
1912 Token::Value op, | 1922 Token::Value op, |
1913 Expression* left, | 1923 Expression* left, |
1914 Expression* right, | 1924 Expression* right, |
1915 int pos) | 1925 int pos) |
1916 : Expression(isolate), | 1926 : Expression(isolate), |
1917 op_(op), | 1927 op_(op), |
1918 left_(left), | 1928 left_(left), |
(...skipping 12 matching lines...) Expand all Loading... |
1931 // TODO(rossberg): the fixed arg should probably be represented as a Constant | 1941 // TODO(rossberg): the fixed arg should probably be represented as a Constant |
1932 // type for the RHS. | 1942 // type for the RHS. |
1933 Maybe<int> fixed_right_arg_; | 1943 Maybe<int> fixed_right_arg_; |
1934 | 1944 |
1935 // The short-circuit logical operations need an AST ID for their | 1945 // The short-circuit logical operations need an AST ID for their |
1936 // right-hand subexpression. | 1946 // right-hand subexpression. |
1937 const BailoutId right_id_; | 1947 const BailoutId right_id_; |
1938 }; | 1948 }; |
1939 | 1949 |
1940 | 1950 |
1941 class CountOperation FINAL : public Expression { | 1951 class CountOperation V8_FINAL : public Expression { |
1942 public: | 1952 public: |
1943 DECLARE_NODE_TYPE(CountOperation) | 1953 DECLARE_NODE_TYPE(CountOperation) |
1944 | 1954 |
1945 bool is_prefix() const { return is_prefix_; } | 1955 bool is_prefix() const { return is_prefix_; } |
1946 bool is_postfix() const { return !is_prefix_; } | 1956 bool is_postfix() const { return !is_prefix_; } |
1947 | 1957 |
1948 Token::Value op() const { return op_; } | 1958 Token::Value op() const { return op_; } |
1949 Token::Value binary_op() { | 1959 Token::Value binary_op() { |
1950 return (op() == Token::INC) ? Token::ADD : Token::SUB; | 1960 return (op() == Token::INC) ? Token::ADD : Token::SUB; |
1951 } | 1961 } |
1952 | 1962 |
1953 Expression* expression() const { return expression_; } | 1963 Expression* expression() const { return expression_; } |
1954 virtual int position() const OVERRIDE { return pos_; } | 1964 virtual int position() const V8_OVERRIDE { return pos_; } |
1955 | 1965 |
1956 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); | 1966 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe); |
1957 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } | 1967 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
1958 virtual SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } | 1968 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
1959 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 1969 return &receiver_types_; |
| 1970 } |
| 1971 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
1960 return store_mode_; | 1972 return store_mode_; |
1961 } | 1973 } |
1962 TypeInfo type() const { return type_; } | 1974 TypeInfo type() const { return type_; } |
1963 | 1975 |
1964 BailoutId AssignmentId() const { return assignment_id_; } | 1976 BailoutId AssignmentId() const { return assignment_id_; } |
1965 | 1977 |
1966 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } | 1978 TypeFeedbackId CountBinOpFeedbackId() const { return count_id_; } |
1967 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } | 1979 TypeFeedbackId CountStoreFeedbackId() const { return reuse(id()); } |
1968 | 1980 |
1969 protected: | 1981 protected: |
(...skipping 21 matching lines...) Expand all Loading... |
1991 TypeInfo type_; | 2003 TypeInfo type_; |
1992 | 2004 |
1993 Expression* expression_; | 2005 Expression* expression_; |
1994 int pos_; | 2006 int pos_; |
1995 const BailoutId assignment_id_; | 2007 const BailoutId assignment_id_; |
1996 const TypeFeedbackId count_id_; | 2008 const TypeFeedbackId count_id_; |
1997 SmallMapList receiver_types_; | 2009 SmallMapList receiver_types_; |
1998 }; | 2010 }; |
1999 | 2011 |
2000 | 2012 |
2001 class CompareOperation FINAL : public Expression { | 2013 class CompareOperation V8_FINAL : public Expression { |
2002 public: | 2014 public: |
2003 DECLARE_NODE_TYPE(CompareOperation) | 2015 DECLARE_NODE_TYPE(CompareOperation) |
2004 | 2016 |
2005 Token::Value op() const { return op_; } | 2017 Token::Value op() const { return op_; } |
2006 Expression* left() const { return left_; } | 2018 Expression* left() const { return left_; } |
2007 Expression* right() const { return right_; } | 2019 Expression* right() const { return right_; } |
2008 virtual int position() const OVERRIDE { return pos_; } | 2020 virtual int position() const V8_OVERRIDE { return pos_; } |
2009 | 2021 |
2010 // Type feedback information. | 2022 // Type feedback information. |
2011 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } | 2023 TypeFeedbackId CompareOperationFeedbackId() const { return reuse(id()); } |
2012 Handle<Type> combined_type() const { return combined_type_; } | 2024 Handle<Type> combined_type() const { return combined_type_; } |
2013 void set_combined_type(Handle<Type> type) { combined_type_ = type; } | 2025 void set_combined_type(Handle<Type> type) { combined_type_ = type; } |
2014 | 2026 |
2015 // Match special cases. | 2027 // Match special cases. |
2016 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); | 2028 bool IsLiteralCompareTypeof(Expression** expr, Handle<String>* check); |
2017 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); | 2029 bool IsLiteralCompareUndefined(Expression** expr, Isolate* isolate); |
2018 bool IsLiteralCompareNull(Expression** expr); | 2030 bool IsLiteralCompareNull(Expression** expr); |
(...skipping 15 matching lines...) Expand all Loading... |
2034 private: | 2046 private: |
2035 Token::Value op_; | 2047 Token::Value op_; |
2036 Expression* left_; | 2048 Expression* left_; |
2037 Expression* right_; | 2049 Expression* right_; |
2038 int pos_; | 2050 int pos_; |
2039 | 2051 |
2040 Handle<Type> combined_type_; | 2052 Handle<Type> combined_type_; |
2041 }; | 2053 }; |
2042 | 2054 |
2043 | 2055 |
2044 class Conditional FINAL : public Expression { | 2056 class Conditional V8_FINAL : public Expression { |
2045 public: | 2057 public: |
2046 DECLARE_NODE_TYPE(Conditional) | 2058 DECLARE_NODE_TYPE(Conditional) |
2047 | 2059 |
2048 Expression* condition() const { return condition_; } | 2060 Expression* condition() const { return condition_; } |
2049 Expression* then_expression() const { return then_expression_; } | 2061 Expression* then_expression() const { return then_expression_; } |
2050 Expression* else_expression() const { return else_expression_; } | 2062 Expression* else_expression() const { return else_expression_; } |
2051 | 2063 |
2052 int then_expression_position() const { return then_expression_position_; } | 2064 int then_expression_position() const { return then_expression_position_; } |
2053 int else_expression_position() const { return else_expression_position_; } | 2065 int else_expression_position() const { return else_expression_position_; } |
2054 | 2066 |
(...skipping 20 matching lines...) Expand all Loading... |
2075 Expression* condition_; | 2087 Expression* condition_; |
2076 Expression* then_expression_; | 2088 Expression* then_expression_; |
2077 Expression* else_expression_; | 2089 Expression* else_expression_; |
2078 int then_expression_position_; | 2090 int then_expression_position_; |
2079 int else_expression_position_; | 2091 int else_expression_position_; |
2080 const BailoutId then_id_; | 2092 const BailoutId then_id_; |
2081 const BailoutId else_id_; | 2093 const BailoutId else_id_; |
2082 }; | 2094 }; |
2083 | 2095 |
2084 | 2096 |
2085 class Assignment FINAL : public Expression { | 2097 class Assignment V8_FINAL : public Expression { |
2086 public: | 2098 public: |
2087 DECLARE_NODE_TYPE(Assignment) | 2099 DECLARE_NODE_TYPE(Assignment) |
2088 | 2100 |
2089 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } | 2101 Assignment* AsSimpleAssignment() { return !is_compound() ? this : NULL; } |
2090 | 2102 |
2091 Token::Value binary_op() const; | 2103 Token::Value binary_op() const; |
2092 | 2104 |
2093 Token::Value op() const { return op_; } | 2105 Token::Value op() const { return op_; } |
2094 Expression* target() const { return target_; } | 2106 Expression* target() const { return target_; } |
2095 Expression* value() const { return value_; } | 2107 Expression* value() const { return value_; } |
2096 virtual int position() const OVERRIDE { return pos_; } | 2108 virtual int position() const V8_OVERRIDE { return pos_; } |
2097 BinaryOperation* binary_operation() const { return binary_operation_; } | 2109 BinaryOperation* binary_operation() const { return binary_operation_; } |
2098 | 2110 |
2099 // This check relies on the definition order of token in token.h. | 2111 // This check relies on the definition order of token in token.h. |
2100 bool is_compound() const { return op() > Token::ASSIGN; } | 2112 bool is_compound() const { return op() > Token::ASSIGN; } |
2101 | 2113 |
2102 BailoutId AssignmentId() const { return assignment_id_; } | 2114 BailoutId AssignmentId() const { return assignment_id_; } |
2103 | 2115 |
2104 // Type feedback information. | 2116 // Type feedback information. |
2105 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } | 2117 TypeFeedbackId AssignmentFeedbackId() { return reuse(id()); } |
2106 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); | 2118 void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone); |
2107 virtual bool IsMonomorphic() OVERRIDE { return is_monomorphic_; } | 2119 virtual bool IsMonomorphic() V8_OVERRIDE { return is_monomorphic_; } |
2108 bool IsUninitialized() { return is_uninitialized_; } | 2120 bool IsUninitialized() { return is_uninitialized_; } |
2109 virtual SmallMapList* GetReceiverTypes() OVERRIDE { return &receiver_types_; } | 2121 virtual SmallMapList* GetReceiverTypes() V8_OVERRIDE { |
2110 virtual KeyedAccessStoreMode GetStoreMode() OVERRIDE { | 2122 return &receiver_types_; |
| 2123 } |
| 2124 virtual KeyedAccessStoreMode GetStoreMode() V8_OVERRIDE { |
2111 return store_mode_; | 2125 return store_mode_; |
2112 } | 2126 } |
2113 | 2127 |
2114 protected: | 2128 protected: |
2115 Assignment(Isolate* isolate, | 2129 Assignment(Isolate* isolate, |
2116 Token::Value op, | 2130 Token::Value op, |
2117 Expression* target, | 2131 Expression* target, |
2118 Expression* value, | 2132 Expression* value, |
2119 int pos); | 2133 int pos); |
2120 | 2134 |
(...skipping 15 matching lines...) Expand all Loading... |
2136 const BailoutId assignment_id_; | 2150 const BailoutId assignment_id_; |
2137 | 2151 |
2138 bool is_monomorphic_ : 1; | 2152 bool is_monomorphic_ : 1; |
2139 bool is_uninitialized_ : 1; | 2153 bool is_uninitialized_ : 1; |
2140 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, | 2154 KeyedAccessStoreMode store_mode_ : 5; // Windows treats as signed, |
2141 // must have extra bit. | 2155 // must have extra bit. |
2142 SmallMapList receiver_types_; | 2156 SmallMapList receiver_types_; |
2143 }; | 2157 }; |
2144 | 2158 |
2145 | 2159 |
2146 class Yield FINAL : public Expression { | 2160 class Yield V8_FINAL : public Expression { |
2147 public: | 2161 public: |
2148 DECLARE_NODE_TYPE(Yield) | 2162 DECLARE_NODE_TYPE(Yield) |
2149 | 2163 |
2150 enum Kind { | 2164 enum Kind { |
2151 INITIAL, // The initial yield that returns the unboxed generator object. | 2165 INITIAL, // The initial yield that returns the unboxed generator object. |
2152 SUSPEND, // A normal yield: { value: EXPRESSION, done: false } | 2166 SUSPEND, // A normal yield: { value: EXPRESSION, done: false } |
2153 DELEGATING, // A yield*. | 2167 DELEGATING, // A yield*. |
2154 FINAL // A return: { value: EXPRESSION, done: true } | 2168 FINAL // A return: { value: EXPRESSION, done: true } |
2155 }; | 2169 }; |
2156 | 2170 |
2157 Expression* generator_object() const { return generator_object_; } | 2171 Expression* generator_object() const { return generator_object_; } |
2158 Expression* expression() const { return expression_; } | 2172 Expression* expression() const { return expression_; } |
2159 Kind yield_kind() const { return yield_kind_; } | 2173 Kind yield_kind() const { return yield_kind_; } |
2160 virtual int position() const OVERRIDE { return pos_; } | 2174 virtual int position() const V8_OVERRIDE { return pos_; } |
2161 | 2175 |
2162 // Delegating yield surrounds the "yield" in a "try/catch". This index | 2176 // Delegating yield surrounds the "yield" in a "try/catch". This index |
2163 // locates the catch handler in the handler table, and is equivalent to | 2177 // locates the catch handler in the handler table, and is equivalent to |
2164 // TryCatchStatement::index(). | 2178 // TryCatchStatement::index(). |
2165 int index() const { | 2179 int index() const { |
2166 ASSERT(yield_kind() == DELEGATING); | 2180 ASSERT(yield_kind() == DELEGATING); |
2167 return index_; | 2181 return index_; |
2168 } | 2182 } |
2169 void set_index(int index) { | 2183 void set_index(int index) { |
2170 ASSERT(yield_kind() == DELEGATING); | 2184 ASSERT(yield_kind() == DELEGATING); |
(...skipping 15 matching lines...) Expand all Loading... |
2186 | 2200 |
2187 private: | 2201 private: |
2188 Expression* generator_object_; | 2202 Expression* generator_object_; |
2189 Expression* expression_; | 2203 Expression* expression_; |
2190 Kind yield_kind_; | 2204 Kind yield_kind_; |
2191 int index_; | 2205 int index_; |
2192 int pos_; | 2206 int pos_; |
2193 }; | 2207 }; |
2194 | 2208 |
2195 | 2209 |
2196 class Throw FINAL : public Expression { | 2210 class Throw V8_FINAL : public Expression { |
2197 public: | 2211 public: |
2198 DECLARE_NODE_TYPE(Throw) | 2212 DECLARE_NODE_TYPE(Throw) |
2199 | 2213 |
2200 Expression* exception() const { return exception_; } | 2214 Expression* exception() const { return exception_; } |
2201 virtual int position() const OVERRIDE { return pos_; } | 2215 virtual int position() const V8_OVERRIDE { return pos_; } |
2202 | 2216 |
2203 protected: | 2217 protected: |
2204 Throw(Isolate* isolate, Expression* exception, int pos) | 2218 Throw(Isolate* isolate, Expression* exception, int pos) |
2205 : Expression(isolate), exception_(exception), pos_(pos) {} | 2219 : Expression(isolate), exception_(exception), pos_(pos) {} |
2206 | 2220 |
2207 private: | 2221 private: |
2208 Expression* exception_; | 2222 Expression* exception_; |
2209 int pos_; | 2223 int pos_; |
2210 }; | 2224 }; |
2211 | 2225 |
2212 | 2226 |
2213 class FunctionLiteral FINAL : public Expression { | 2227 class FunctionLiteral V8_FINAL : public Expression { |
2214 public: | 2228 public: |
2215 enum FunctionType { | 2229 enum FunctionType { |
2216 ANONYMOUS_EXPRESSION, | 2230 ANONYMOUS_EXPRESSION, |
2217 NAMED_EXPRESSION, | 2231 NAMED_EXPRESSION, |
2218 DECLARATION | 2232 DECLARATION |
2219 }; | 2233 }; |
2220 | 2234 |
2221 enum ParameterFlag { | 2235 enum ParameterFlag { |
2222 kNoDuplicateParameters = 0, | 2236 kNoDuplicateParameters = 0, |
2223 kHasDuplicateParameters = 1 | 2237 kHasDuplicateParameters = 1 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2353 class IsExpression: public BitField<bool, 0, 1> {}; | 2367 class IsExpression: public BitField<bool, 0, 1> {}; |
2354 class IsAnonymous: public BitField<bool, 1, 1> {}; | 2368 class IsAnonymous: public BitField<bool, 1, 1> {}; |
2355 class Pretenure: public BitField<bool, 2, 1> {}; | 2369 class Pretenure: public BitField<bool, 2, 1> {}; |
2356 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; | 2370 class HasDuplicateParameters: public BitField<ParameterFlag, 3, 1> {}; |
2357 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; | 2371 class IsFunction: public BitField<IsFunctionFlag, 4, 1> {}; |
2358 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; | 2372 class IsParenthesized: public BitField<IsParenthesizedFlag, 5, 1> {}; |
2359 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; | 2373 class IsGenerator: public BitField<IsGeneratorFlag, 6, 1> {}; |
2360 }; | 2374 }; |
2361 | 2375 |
2362 | 2376 |
2363 class SharedFunctionInfoLiteral FINAL : public Expression { | 2377 class SharedFunctionInfoLiteral V8_FINAL : public Expression { |
2364 public: | 2378 public: |
2365 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) | 2379 DECLARE_NODE_TYPE(SharedFunctionInfoLiteral) |
2366 | 2380 |
2367 Handle<SharedFunctionInfo> shared_function_info() const { | 2381 Handle<SharedFunctionInfo> shared_function_info() const { |
2368 return shared_function_info_; | 2382 return shared_function_info_; |
2369 } | 2383 } |
2370 | 2384 |
2371 protected: | 2385 protected: |
2372 SharedFunctionInfoLiteral( | 2386 SharedFunctionInfoLiteral( |
2373 Isolate* isolate, | 2387 Isolate* isolate, |
2374 Handle<SharedFunctionInfo> shared_function_info) | 2388 Handle<SharedFunctionInfo> shared_function_info) |
2375 : Expression(isolate), | 2389 : Expression(isolate), |
2376 shared_function_info_(shared_function_info) { } | 2390 shared_function_info_(shared_function_info) { } |
2377 | 2391 |
2378 private: | 2392 private: |
2379 Handle<SharedFunctionInfo> shared_function_info_; | 2393 Handle<SharedFunctionInfo> shared_function_info_; |
2380 }; | 2394 }; |
2381 | 2395 |
2382 | 2396 |
2383 class ThisFunction FINAL : public Expression { | 2397 class ThisFunction V8_FINAL : public Expression { |
2384 public: | 2398 public: |
2385 DECLARE_NODE_TYPE(ThisFunction) | 2399 DECLARE_NODE_TYPE(ThisFunction) |
2386 | 2400 |
2387 protected: | 2401 protected: |
2388 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} | 2402 explicit ThisFunction(Isolate* isolate): Expression(isolate) {} |
2389 }; | 2403 }; |
2390 | 2404 |
2391 #undef DECLARE_NODE_TYPE | 2405 #undef DECLARE_NODE_TYPE |
2392 | 2406 |
2393 | 2407 |
(...skipping 29 matching lines...) Expand all Loading... |
2423 virtual void AppendToText(RegExpText* text, Zone* zone); | 2437 virtual void AppendToText(RegExpText* text, Zone* zone); |
2424 SmartArrayPointer<const char> ToString(Zone* zone); | 2438 SmartArrayPointer<const char> ToString(Zone* zone); |
2425 #define MAKE_ASTYPE(Name) \ | 2439 #define MAKE_ASTYPE(Name) \ |
2426 virtual RegExp##Name* As##Name(); \ | 2440 virtual RegExp##Name* As##Name(); \ |
2427 virtual bool Is##Name(); | 2441 virtual bool Is##Name(); |
2428 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) | 2442 FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ASTYPE) |
2429 #undef MAKE_ASTYPE | 2443 #undef MAKE_ASTYPE |
2430 }; | 2444 }; |
2431 | 2445 |
2432 | 2446 |
2433 class RegExpDisjunction FINAL : public RegExpTree { | 2447 class RegExpDisjunction V8_FINAL : public RegExpTree { |
2434 public: | 2448 public: |
2435 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); | 2449 explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives); |
2436 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2450 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2437 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2451 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2438 RegExpNode* on_success) OVERRIDE; | 2452 RegExpNode* on_success) V8_OVERRIDE; |
2439 virtual RegExpDisjunction* AsDisjunction() OVERRIDE; | 2453 virtual RegExpDisjunction* AsDisjunction() V8_OVERRIDE; |
2440 virtual Interval CaptureRegisters() OVERRIDE; | 2454 virtual Interval CaptureRegisters() V8_OVERRIDE; |
2441 virtual bool IsDisjunction() OVERRIDE; | 2455 virtual bool IsDisjunction() V8_OVERRIDE; |
2442 virtual bool IsAnchoredAtStart() OVERRIDE; | 2456 virtual bool IsAnchoredAtStart() V8_OVERRIDE; |
2443 virtual bool IsAnchoredAtEnd() OVERRIDE; | 2457 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; |
2444 virtual int min_match() OVERRIDE { return min_match_; } | 2458 virtual int min_match() V8_OVERRIDE { return min_match_; } |
2445 virtual int max_match() OVERRIDE { return max_match_; } | 2459 virtual int max_match() V8_OVERRIDE { return max_match_; } |
2446 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } | 2460 ZoneList<RegExpTree*>* alternatives() { return alternatives_; } |
2447 private: | 2461 private: |
2448 ZoneList<RegExpTree*>* alternatives_; | 2462 ZoneList<RegExpTree*>* alternatives_; |
2449 int min_match_; | 2463 int min_match_; |
2450 int max_match_; | 2464 int max_match_; |
2451 }; | 2465 }; |
2452 | 2466 |
2453 | 2467 |
2454 class RegExpAlternative FINAL : public RegExpTree { | 2468 class RegExpAlternative V8_FINAL : public RegExpTree { |
2455 public: | 2469 public: |
2456 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); | 2470 explicit RegExpAlternative(ZoneList<RegExpTree*>* nodes); |
2457 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2471 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2458 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2472 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2459 RegExpNode* on_success) OVERRIDE; | 2473 RegExpNode* on_success) V8_OVERRIDE; |
2460 virtual RegExpAlternative* AsAlternative() OVERRIDE; | 2474 virtual RegExpAlternative* AsAlternative() V8_OVERRIDE; |
2461 virtual Interval CaptureRegisters() OVERRIDE; | 2475 virtual Interval CaptureRegisters() V8_OVERRIDE; |
2462 virtual bool IsAlternative() OVERRIDE; | 2476 virtual bool IsAlternative() V8_OVERRIDE; |
2463 virtual bool IsAnchoredAtStart() OVERRIDE; | 2477 virtual bool IsAnchoredAtStart() V8_OVERRIDE; |
2464 virtual bool IsAnchoredAtEnd() OVERRIDE; | 2478 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; |
2465 virtual int min_match() OVERRIDE { return min_match_; } | 2479 virtual int min_match() V8_OVERRIDE { return min_match_; } |
2466 virtual int max_match() OVERRIDE { return max_match_; } | 2480 virtual int max_match() V8_OVERRIDE { return max_match_; } |
2467 ZoneList<RegExpTree*>* nodes() { return nodes_; } | 2481 ZoneList<RegExpTree*>* nodes() { return nodes_; } |
2468 private: | 2482 private: |
2469 ZoneList<RegExpTree*>* nodes_; | 2483 ZoneList<RegExpTree*>* nodes_; |
2470 int min_match_; | 2484 int min_match_; |
2471 int max_match_; | 2485 int max_match_; |
2472 }; | 2486 }; |
2473 | 2487 |
2474 | 2488 |
2475 class RegExpAssertion FINAL : public RegExpTree { | 2489 class RegExpAssertion V8_FINAL : public RegExpTree { |
2476 public: | 2490 public: |
2477 enum AssertionType { | 2491 enum AssertionType { |
2478 START_OF_LINE, | 2492 START_OF_LINE, |
2479 START_OF_INPUT, | 2493 START_OF_INPUT, |
2480 END_OF_LINE, | 2494 END_OF_LINE, |
2481 END_OF_INPUT, | 2495 END_OF_INPUT, |
2482 BOUNDARY, | 2496 BOUNDARY, |
2483 NON_BOUNDARY | 2497 NON_BOUNDARY |
2484 }; | 2498 }; |
2485 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } | 2499 explicit RegExpAssertion(AssertionType type) : assertion_type_(type) { } |
2486 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2500 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2487 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2501 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2488 RegExpNode* on_success) OVERRIDE; | 2502 RegExpNode* on_success) V8_OVERRIDE; |
2489 virtual RegExpAssertion* AsAssertion() OVERRIDE; | 2503 virtual RegExpAssertion* AsAssertion() V8_OVERRIDE; |
2490 virtual bool IsAssertion() OVERRIDE; | 2504 virtual bool IsAssertion() V8_OVERRIDE; |
2491 virtual bool IsAnchoredAtStart() OVERRIDE; | 2505 virtual bool IsAnchoredAtStart() V8_OVERRIDE; |
2492 virtual bool IsAnchoredAtEnd() OVERRIDE; | 2506 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; |
2493 virtual int min_match() OVERRIDE { return 0; } | 2507 virtual int min_match() V8_OVERRIDE { return 0; } |
2494 virtual int max_match() OVERRIDE { return 0; } | 2508 virtual int max_match() V8_OVERRIDE { return 0; } |
2495 AssertionType assertion_type() { return assertion_type_; } | 2509 AssertionType assertion_type() { return assertion_type_; } |
2496 private: | 2510 private: |
2497 AssertionType assertion_type_; | 2511 AssertionType assertion_type_; |
2498 }; | 2512 }; |
2499 | 2513 |
2500 | 2514 |
2501 class CharacterSet FINAL BASE_EMBEDDED { | 2515 class CharacterSet V8_FINAL BASE_EMBEDDED { |
2502 public: | 2516 public: |
2503 explicit CharacterSet(uc16 standard_set_type) | 2517 explicit CharacterSet(uc16 standard_set_type) |
2504 : ranges_(NULL), | 2518 : ranges_(NULL), |
2505 standard_set_type_(standard_set_type) {} | 2519 standard_set_type_(standard_set_type) {} |
2506 explicit CharacterSet(ZoneList<CharacterRange>* ranges) | 2520 explicit CharacterSet(ZoneList<CharacterRange>* ranges) |
2507 : ranges_(ranges), | 2521 : ranges_(ranges), |
2508 standard_set_type_(0) {} | 2522 standard_set_type_(0) {} |
2509 ZoneList<CharacterRange>* ranges(Zone* zone); | 2523 ZoneList<CharacterRange>* ranges(Zone* zone); |
2510 uc16 standard_set_type() { return standard_set_type_; } | 2524 uc16 standard_set_type() { return standard_set_type_; } |
2511 void set_standard_set_type(uc16 special_set_type) { | 2525 void set_standard_set_type(uc16 special_set_type) { |
2512 standard_set_type_ = special_set_type; | 2526 standard_set_type_ = special_set_type; |
2513 } | 2527 } |
2514 bool is_standard() { return standard_set_type_ != 0; } | 2528 bool is_standard() { return standard_set_type_ != 0; } |
2515 void Canonicalize(); | 2529 void Canonicalize(); |
2516 private: | 2530 private: |
2517 ZoneList<CharacterRange>* ranges_; | 2531 ZoneList<CharacterRange>* ranges_; |
2518 // If non-zero, the value represents a standard set (e.g., all whitespace | 2532 // If non-zero, the value represents a standard set (e.g., all whitespace |
2519 // characters) without having to expand the ranges. | 2533 // characters) without having to expand the ranges. |
2520 uc16 standard_set_type_; | 2534 uc16 standard_set_type_; |
2521 }; | 2535 }; |
2522 | 2536 |
2523 | 2537 |
2524 class RegExpCharacterClass FINAL : public RegExpTree { | 2538 class RegExpCharacterClass V8_FINAL : public RegExpTree { |
2525 public: | 2539 public: |
2526 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) | 2540 RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated) |
2527 : set_(ranges), | 2541 : set_(ranges), |
2528 is_negated_(is_negated) { } | 2542 is_negated_(is_negated) { } |
2529 explicit RegExpCharacterClass(uc16 type) | 2543 explicit RegExpCharacterClass(uc16 type) |
2530 : set_(type), | 2544 : set_(type), |
2531 is_negated_(false) { } | 2545 is_negated_(false) { } |
2532 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2546 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2533 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2547 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2534 RegExpNode* on_success) OVERRIDE; | 2548 RegExpNode* on_success) V8_OVERRIDE; |
2535 virtual RegExpCharacterClass* AsCharacterClass() OVERRIDE; | 2549 virtual RegExpCharacterClass* AsCharacterClass() V8_OVERRIDE; |
2536 virtual bool IsCharacterClass() OVERRIDE; | 2550 virtual bool IsCharacterClass() V8_OVERRIDE; |
2537 virtual bool IsTextElement() OVERRIDE { return true; } | 2551 virtual bool IsTextElement() V8_OVERRIDE { return true; } |
2538 virtual int min_match() OVERRIDE { return 1; } | 2552 virtual int min_match() V8_OVERRIDE { return 1; } |
2539 virtual int max_match() OVERRIDE { return 1; } | 2553 virtual int max_match() V8_OVERRIDE { return 1; } |
2540 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; | 2554 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE; |
2541 CharacterSet character_set() { return set_; } | 2555 CharacterSet character_set() { return set_; } |
2542 // TODO(lrn): Remove need for complex version if is_standard that | 2556 // TODO(lrn): Remove need for complex version if is_standard that |
2543 // recognizes a mangled standard set and just do { return set_.is_special(); } | 2557 // recognizes a mangled standard set and just do { return set_.is_special(); } |
2544 bool is_standard(Zone* zone); | 2558 bool is_standard(Zone* zone); |
2545 // Returns a value representing the standard character set if is_standard() | 2559 // Returns a value representing the standard character set if is_standard() |
2546 // returns true. | 2560 // returns true. |
2547 // Currently used values are: | 2561 // Currently used values are: |
2548 // s : unicode whitespace | 2562 // s : unicode whitespace |
2549 // S : unicode non-whitespace | 2563 // S : unicode non-whitespace |
2550 // w : ASCII word character (digit, letter, underscore) | 2564 // w : ASCII word character (digit, letter, underscore) |
2551 // W : non-ASCII word character | 2565 // W : non-ASCII word character |
2552 // d : ASCII digit | 2566 // d : ASCII digit |
2553 // D : non-ASCII digit | 2567 // D : non-ASCII digit |
2554 // . : non-unicode non-newline | 2568 // . : non-unicode non-newline |
2555 // * : All characters | 2569 // * : All characters |
2556 uc16 standard_type() { return set_.standard_set_type(); } | 2570 uc16 standard_type() { return set_.standard_set_type(); } |
2557 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } | 2571 ZoneList<CharacterRange>* ranges(Zone* zone) { return set_.ranges(zone); } |
2558 bool is_negated() { return is_negated_; } | 2572 bool is_negated() { return is_negated_; } |
2559 | 2573 |
2560 private: | 2574 private: |
2561 CharacterSet set_; | 2575 CharacterSet set_; |
2562 bool is_negated_; | 2576 bool is_negated_; |
2563 }; | 2577 }; |
2564 | 2578 |
2565 | 2579 |
2566 class RegExpAtom FINAL : public RegExpTree { | 2580 class RegExpAtom V8_FINAL : public RegExpTree { |
2567 public: | 2581 public: |
2568 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } | 2582 explicit RegExpAtom(Vector<const uc16> data) : data_(data) { } |
2569 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2583 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2570 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2584 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2571 RegExpNode* on_success) OVERRIDE; | 2585 RegExpNode* on_success) V8_OVERRIDE; |
2572 virtual RegExpAtom* AsAtom() OVERRIDE; | 2586 virtual RegExpAtom* AsAtom() V8_OVERRIDE; |
2573 virtual bool IsAtom() OVERRIDE; | 2587 virtual bool IsAtom() V8_OVERRIDE; |
2574 virtual bool IsTextElement() OVERRIDE { return true; } | 2588 virtual bool IsTextElement() V8_OVERRIDE { return true; } |
2575 virtual int min_match() OVERRIDE { return data_.length(); } | 2589 virtual int min_match() V8_OVERRIDE { return data_.length(); } |
2576 virtual int max_match() OVERRIDE { return data_.length(); } | 2590 virtual int max_match() V8_OVERRIDE { return data_.length(); } |
2577 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; | 2591 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE; |
2578 Vector<const uc16> data() { return data_; } | 2592 Vector<const uc16> data() { return data_; } |
2579 int length() { return data_.length(); } | 2593 int length() { return data_.length(); } |
2580 private: | 2594 private: |
2581 Vector<const uc16> data_; | 2595 Vector<const uc16> data_; |
2582 }; | 2596 }; |
2583 | 2597 |
2584 | 2598 |
2585 class RegExpText FINAL : public RegExpTree { | 2599 class RegExpText V8_FINAL : public RegExpTree { |
2586 public: | 2600 public: |
2587 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} | 2601 explicit RegExpText(Zone* zone) : elements_(2, zone), length_(0) {} |
2588 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2602 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2589 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2603 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2590 RegExpNode* on_success) OVERRIDE; | 2604 RegExpNode* on_success) V8_OVERRIDE; |
2591 virtual RegExpText* AsText() OVERRIDE; | 2605 virtual RegExpText* AsText() V8_OVERRIDE; |
2592 virtual bool IsText() OVERRIDE; | 2606 virtual bool IsText() V8_OVERRIDE; |
2593 virtual bool IsTextElement() OVERRIDE { return true; } | 2607 virtual bool IsTextElement() V8_OVERRIDE { return true; } |
2594 virtual int min_match() OVERRIDE { return length_; } | 2608 virtual int min_match() V8_OVERRIDE { return length_; } |
2595 virtual int max_match() OVERRIDE { return length_; } | 2609 virtual int max_match() V8_OVERRIDE { return length_; } |
2596 virtual void AppendToText(RegExpText* text, Zone* zone) OVERRIDE; | 2610 virtual void AppendToText(RegExpText* text, Zone* zone) V8_OVERRIDE; |
2597 void AddElement(TextElement elm, Zone* zone) { | 2611 void AddElement(TextElement elm, Zone* zone) { |
2598 elements_.Add(elm, zone); | 2612 elements_.Add(elm, zone); |
2599 length_ += elm.length(); | 2613 length_ += elm.length(); |
2600 } | 2614 } |
2601 ZoneList<TextElement>* elements() { return &elements_; } | 2615 ZoneList<TextElement>* elements() { return &elements_; } |
2602 private: | 2616 private: |
2603 ZoneList<TextElement> elements_; | 2617 ZoneList<TextElement> elements_; |
2604 int length_; | 2618 int length_; |
2605 }; | 2619 }; |
2606 | 2620 |
2607 | 2621 |
2608 class RegExpQuantifier FINAL : public RegExpTree { | 2622 class RegExpQuantifier V8_FINAL : public RegExpTree { |
2609 public: | 2623 public: |
2610 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; | 2624 enum QuantifierType { GREEDY, NON_GREEDY, POSSESSIVE }; |
2611 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) | 2625 RegExpQuantifier(int min, int max, QuantifierType type, RegExpTree* body) |
2612 : body_(body), | 2626 : body_(body), |
2613 min_(min), | 2627 min_(min), |
2614 max_(max), | 2628 max_(max), |
2615 min_match_(min * body->min_match()), | 2629 min_match_(min * body->min_match()), |
2616 quantifier_type_(type) { | 2630 quantifier_type_(type) { |
2617 if (max > 0 && body->max_match() > kInfinity / max) { | 2631 if (max > 0 && body->max_match() > kInfinity / max) { |
2618 max_match_ = kInfinity; | 2632 max_match_ = kInfinity; |
2619 } else { | 2633 } else { |
2620 max_match_ = max * body->max_match(); | 2634 max_match_ = max * body->max_match(); |
2621 } | 2635 } |
2622 } | 2636 } |
2623 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2637 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2624 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2638 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2625 RegExpNode* on_success) OVERRIDE; | 2639 RegExpNode* on_success) V8_OVERRIDE; |
2626 static RegExpNode* ToNode(int min, | 2640 static RegExpNode* ToNode(int min, |
2627 int max, | 2641 int max, |
2628 bool is_greedy, | 2642 bool is_greedy, |
2629 RegExpTree* body, | 2643 RegExpTree* body, |
2630 RegExpCompiler* compiler, | 2644 RegExpCompiler* compiler, |
2631 RegExpNode* on_success, | 2645 RegExpNode* on_success, |
2632 bool not_at_start = false); | 2646 bool not_at_start = false); |
2633 virtual RegExpQuantifier* AsQuantifier() OVERRIDE; | 2647 virtual RegExpQuantifier* AsQuantifier() V8_OVERRIDE; |
2634 virtual Interval CaptureRegisters() OVERRIDE; | 2648 virtual Interval CaptureRegisters() V8_OVERRIDE; |
2635 virtual bool IsQuantifier() OVERRIDE; | 2649 virtual bool IsQuantifier() V8_OVERRIDE; |
2636 virtual int min_match() OVERRIDE { return min_match_; } | 2650 virtual int min_match() V8_OVERRIDE { return min_match_; } |
2637 virtual int max_match() OVERRIDE { return max_match_; } | 2651 virtual int max_match() V8_OVERRIDE { return max_match_; } |
2638 int min() { return min_; } | 2652 int min() { return min_; } |
2639 int max() { return max_; } | 2653 int max() { return max_; } |
2640 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } | 2654 bool is_possessive() { return quantifier_type_ == POSSESSIVE; } |
2641 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } | 2655 bool is_non_greedy() { return quantifier_type_ == NON_GREEDY; } |
2642 bool is_greedy() { return quantifier_type_ == GREEDY; } | 2656 bool is_greedy() { return quantifier_type_ == GREEDY; } |
2643 RegExpTree* body() { return body_; } | 2657 RegExpTree* body() { return body_; } |
2644 | 2658 |
2645 private: | 2659 private: |
2646 RegExpTree* body_; | 2660 RegExpTree* body_; |
2647 int min_; | 2661 int min_; |
2648 int max_; | 2662 int max_; |
2649 int min_match_; | 2663 int min_match_; |
2650 int max_match_; | 2664 int max_match_; |
2651 QuantifierType quantifier_type_; | 2665 QuantifierType quantifier_type_; |
2652 }; | 2666 }; |
2653 | 2667 |
2654 | 2668 |
2655 class RegExpCapture FINAL : public RegExpTree { | 2669 class RegExpCapture V8_FINAL : public RegExpTree { |
2656 public: | 2670 public: |
2657 explicit RegExpCapture(RegExpTree* body, int index) | 2671 explicit RegExpCapture(RegExpTree* body, int index) |
2658 : body_(body), index_(index) { } | 2672 : body_(body), index_(index) { } |
2659 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2673 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2660 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2674 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2661 RegExpNode* on_success) OVERRIDE; | 2675 RegExpNode* on_success) V8_OVERRIDE; |
2662 static RegExpNode* ToNode(RegExpTree* body, | 2676 static RegExpNode* ToNode(RegExpTree* body, |
2663 int index, | 2677 int index, |
2664 RegExpCompiler* compiler, | 2678 RegExpCompiler* compiler, |
2665 RegExpNode* on_success); | 2679 RegExpNode* on_success); |
2666 virtual RegExpCapture* AsCapture() OVERRIDE; | 2680 virtual RegExpCapture* AsCapture() V8_OVERRIDE; |
2667 virtual bool IsAnchoredAtStart() OVERRIDE; | 2681 virtual bool IsAnchoredAtStart() V8_OVERRIDE; |
2668 virtual bool IsAnchoredAtEnd() OVERRIDE; | 2682 virtual bool IsAnchoredAtEnd() V8_OVERRIDE; |
2669 virtual Interval CaptureRegisters() OVERRIDE; | 2683 virtual Interval CaptureRegisters() V8_OVERRIDE; |
2670 virtual bool IsCapture() OVERRIDE; | 2684 virtual bool IsCapture() V8_OVERRIDE; |
2671 virtual int min_match() OVERRIDE { return body_->min_match(); } | 2685 virtual int min_match() V8_OVERRIDE { return body_->min_match(); } |
2672 virtual int max_match() OVERRIDE { return body_->max_match(); } | 2686 virtual int max_match() V8_OVERRIDE { return body_->max_match(); } |
2673 RegExpTree* body() { return body_; } | 2687 RegExpTree* body() { return body_; } |
2674 int index() { return index_; } | 2688 int index() { return index_; } |
2675 static int StartRegister(int index) { return index * 2; } | 2689 static int StartRegister(int index) { return index * 2; } |
2676 static int EndRegister(int index) { return index * 2 + 1; } | 2690 static int EndRegister(int index) { return index * 2 + 1; } |
2677 | 2691 |
2678 private: | 2692 private: |
2679 RegExpTree* body_; | 2693 RegExpTree* body_; |
2680 int index_; | 2694 int index_; |
2681 }; | 2695 }; |
2682 | 2696 |
2683 | 2697 |
2684 class RegExpLookahead FINAL : public RegExpTree { | 2698 class RegExpLookahead V8_FINAL : public RegExpTree { |
2685 public: | 2699 public: |
2686 RegExpLookahead(RegExpTree* body, | 2700 RegExpLookahead(RegExpTree* body, |
2687 bool is_positive, | 2701 bool is_positive, |
2688 int capture_count, | 2702 int capture_count, |
2689 int capture_from) | 2703 int capture_from) |
2690 : body_(body), | 2704 : body_(body), |
2691 is_positive_(is_positive), | 2705 is_positive_(is_positive), |
2692 capture_count_(capture_count), | 2706 capture_count_(capture_count), |
2693 capture_from_(capture_from) { } | 2707 capture_from_(capture_from) { } |
2694 | 2708 |
2695 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2709 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2696 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2710 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2697 RegExpNode* on_success) OVERRIDE; | 2711 RegExpNode* on_success) V8_OVERRIDE; |
2698 virtual RegExpLookahead* AsLookahead() OVERRIDE; | 2712 virtual RegExpLookahead* AsLookahead() V8_OVERRIDE; |
2699 virtual Interval CaptureRegisters() OVERRIDE; | 2713 virtual Interval CaptureRegisters() V8_OVERRIDE; |
2700 virtual bool IsLookahead() OVERRIDE; | 2714 virtual bool IsLookahead() V8_OVERRIDE; |
2701 virtual bool IsAnchoredAtStart() OVERRIDE; | 2715 virtual bool IsAnchoredAtStart() V8_OVERRIDE; |
2702 virtual int min_match() OVERRIDE { return 0; } | 2716 virtual int min_match() V8_OVERRIDE { return 0; } |
2703 virtual int max_match() OVERRIDE { return 0; } | 2717 virtual int max_match() V8_OVERRIDE { return 0; } |
2704 RegExpTree* body() { return body_; } | 2718 RegExpTree* body() { return body_; } |
2705 bool is_positive() { return is_positive_; } | 2719 bool is_positive() { return is_positive_; } |
2706 int capture_count() { return capture_count_; } | 2720 int capture_count() { return capture_count_; } |
2707 int capture_from() { return capture_from_; } | 2721 int capture_from() { return capture_from_; } |
2708 | 2722 |
2709 private: | 2723 private: |
2710 RegExpTree* body_; | 2724 RegExpTree* body_; |
2711 bool is_positive_; | 2725 bool is_positive_; |
2712 int capture_count_; | 2726 int capture_count_; |
2713 int capture_from_; | 2727 int capture_from_; |
2714 }; | 2728 }; |
2715 | 2729 |
2716 | 2730 |
2717 class RegExpBackReference FINAL : public RegExpTree { | 2731 class RegExpBackReference V8_FINAL : public RegExpTree { |
2718 public: | 2732 public: |
2719 explicit RegExpBackReference(RegExpCapture* capture) | 2733 explicit RegExpBackReference(RegExpCapture* capture) |
2720 : capture_(capture) { } | 2734 : capture_(capture) { } |
2721 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2735 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2722 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2736 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2723 RegExpNode* on_success) OVERRIDE; | 2737 RegExpNode* on_success) V8_OVERRIDE; |
2724 virtual RegExpBackReference* AsBackReference() OVERRIDE; | 2738 virtual RegExpBackReference* AsBackReference() V8_OVERRIDE; |
2725 virtual bool IsBackReference() OVERRIDE; | 2739 virtual bool IsBackReference() V8_OVERRIDE; |
2726 virtual int min_match() OVERRIDE { return 0; } | 2740 virtual int min_match() V8_OVERRIDE { return 0; } |
2727 virtual int max_match() OVERRIDE { return capture_->max_match(); } | 2741 virtual int max_match() V8_OVERRIDE { return capture_->max_match(); } |
2728 int index() { return capture_->index(); } | 2742 int index() { return capture_->index(); } |
2729 RegExpCapture* capture() { return capture_; } | 2743 RegExpCapture* capture() { return capture_; } |
2730 private: | 2744 private: |
2731 RegExpCapture* capture_; | 2745 RegExpCapture* capture_; |
2732 }; | 2746 }; |
2733 | 2747 |
2734 | 2748 |
2735 class RegExpEmpty FINAL : public RegExpTree { | 2749 class RegExpEmpty V8_FINAL : public RegExpTree { |
2736 public: | 2750 public: |
2737 RegExpEmpty() { } | 2751 RegExpEmpty() { } |
2738 virtual void* Accept(RegExpVisitor* visitor, void* data) OVERRIDE; | 2752 virtual void* Accept(RegExpVisitor* visitor, void* data) V8_OVERRIDE; |
2739 virtual RegExpNode* ToNode(RegExpCompiler* compiler, | 2753 virtual RegExpNode* ToNode(RegExpCompiler* compiler, |
2740 RegExpNode* on_success) OVERRIDE; | 2754 RegExpNode* on_success) V8_OVERRIDE; |
2741 virtual RegExpEmpty* AsEmpty() OVERRIDE; | 2755 virtual RegExpEmpty* AsEmpty() V8_OVERRIDE; |
2742 virtual bool IsEmpty() OVERRIDE; | 2756 virtual bool IsEmpty() V8_OVERRIDE; |
2743 virtual int min_match() OVERRIDE { return 0; } | 2757 virtual int min_match() V8_OVERRIDE { return 0; } |
2744 virtual int max_match() OVERRIDE { return 0; } | 2758 virtual int max_match() V8_OVERRIDE { return 0; } |
2745 static RegExpEmpty* GetInstance() { | 2759 static RegExpEmpty* GetInstance() { |
2746 static RegExpEmpty* instance = ::new RegExpEmpty(); | 2760 static RegExpEmpty* instance = ::new RegExpEmpty(); |
2747 return instance; | 2761 return instance; |
2748 } | 2762 } |
2749 }; | 2763 }; |
2750 | 2764 |
2751 | 2765 |
2752 // ---------------------------------------------------------------------------- | 2766 // ---------------------------------------------------------------------------- |
2753 // Out-of-line inline constructors (to side-step cyclic dependencies). | 2767 // Out-of-line inline constructors (to side-step cyclic dependencies). |
2754 | 2768 |
(...skipping 23 matching lines...) Expand all Loading... |
2778 // Individual AST nodes. | 2792 // Individual AST nodes. |
2779 #define DEF_VISIT(type) \ | 2793 #define DEF_VISIT(type) \ |
2780 virtual void Visit##type(type* node) = 0; | 2794 virtual void Visit##type(type* node) = 0; |
2781 AST_NODE_LIST(DEF_VISIT) | 2795 AST_NODE_LIST(DEF_VISIT) |
2782 #undef DEF_VISIT | 2796 #undef DEF_VISIT |
2783 }; | 2797 }; |
2784 | 2798 |
2785 | 2799 |
2786 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ | 2800 #define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ |
2787 public: \ | 2801 public: \ |
2788 virtual void Visit(AstNode* node) FINAL OVERRIDE { \ | 2802 virtual void Visit(AstNode* node) V8_FINAL V8_OVERRIDE { \ |
2789 if (!CheckStackOverflow()) node->Accept(this); \ | 2803 if (!CheckStackOverflow()) node->Accept(this); \ |
2790 } \ | 2804 } \ |
2791 \ | 2805 \ |
2792 void SetStackOverflow() { stack_overflow_ = true; } \ | 2806 void SetStackOverflow() { stack_overflow_ = true; } \ |
2793 void ClearStackOverflow() { stack_overflow_ = false; } \ | 2807 void ClearStackOverflow() { stack_overflow_ = false; } \ |
2794 bool HasStackOverflow() const { return stack_overflow_; } \ | 2808 bool HasStackOverflow() const { return stack_overflow_; } \ |
2795 \ | 2809 \ |
2796 bool CheckStackOverflow() { \ | 2810 bool CheckStackOverflow() { \ |
2797 if (stack_overflow_) return true; \ | 2811 if (stack_overflow_) return true; \ |
2798 StackLimitCheck check(isolate_); \ | 2812 StackLimitCheck check(isolate_); \ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2844 AST_NODE_LIST(DEF_VISIT) | 2858 AST_NODE_LIST(DEF_VISIT) |
2845 #undef DEF_VISIT | 2859 #undef DEF_VISIT |
2846 }; | 2860 }; |
2847 | 2861 |
2848 | 2862 |
2849 | 2863 |
2850 // ---------------------------------------------------------------------------- | 2864 // ---------------------------------------------------------------------------- |
2851 // AstNode factory | 2865 // AstNode factory |
2852 | 2866 |
2853 template<class Visitor> | 2867 template<class Visitor> |
2854 class AstNodeFactory FINAL BASE_EMBEDDED { | 2868 class AstNodeFactory V8_FINAL BASE_EMBEDDED { |
2855 public: | 2869 public: |
2856 AstNodeFactory(Isolate* isolate, Zone* zone) | 2870 AstNodeFactory(Isolate* isolate, Zone* zone) |
2857 : isolate_(isolate), | 2871 : isolate_(isolate), |
2858 zone_(zone) { } | 2872 zone_(zone) { } |
2859 | 2873 |
2860 Visitor* visitor() { return &visitor_; } | 2874 Visitor* visitor() { return &visitor_; } |
2861 | 2875 |
2862 #define VISIT_AND_RETURN(NodeType, node) \ | 2876 #define VISIT_AND_RETURN(NodeType, node) \ |
2863 visitor_.Visit##NodeType((node)); \ | 2877 visitor_.Visit##NodeType((node)); \ |
2864 return node; | 2878 return node; |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3229 private: | 3243 private: |
3230 Isolate* isolate_; | 3244 Isolate* isolate_; |
3231 Zone* zone_; | 3245 Zone* zone_; |
3232 Visitor visitor_; | 3246 Visitor visitor_; |
3233 }; | 3247 }; |
3234 | 3248 |
3235 | 3249 |
3236 } } // namespace v8::internal | 3250 } } // namespace v8::internal |
3237 | 3251 |
3238 #endif // V8_AST_H_ | 3252 #endif // V8_AST_H_ |
OLD | NEW |