| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 virtual intptr_t ResultCid() const; | 524 virtual intptr_t ResultCid() const; |
| 525 | 525 |
| 526 private: | 526 private: |
| 527 ConstantVal* constant_val_; | 527 ConstantVal* constant_val_; |
| 528 }; | 528 }; |
| 529 | 529 |
| 530 | 530 |
| 531 class AssertAssignableComp : public TemplateComputation<3> { | 531 class AssertAssignableComp : public TemplateComputation<3> { |
| 532 public: | 532 public: |
| 533 AssertAssignableComp(intptr_t token_pos, | 533 AssertAssignableComp(intptr_t token_pos, |
| 534 intptr_t try_index, | |
| 535 Value* value, | 534 Value* value, |
| 536 Value* instantiator, | 535 Value* instantiator, |
| 537 Value* instantiator_type_arguments, | 536 Value* instantiator_type_arguments, |
| 538 const AbstractType& dst_type, | 537 const AbstractType& dst_type, |
| 539 const String& dst_name) | 538 const String& dst_name) |
| 540 : token_pos_(token_pos), | 539 : token_pos_(token_pos), |
| 541 try_index_(try_index), | |
| 542 dst_type_(dst_type), | 540 dst_type_(dst_type), |
| 543 dst_name_(dst_name), | 541 dst_name_(dst_name), |
| 544 is_eliminated_(false) { | 542 is_eliminated_(false) { |
| 545 ASSERT(value != NULL); | 543 ASSERT(value != NULL); |
| 546 ASSERT(instantiator != NULL); | 544 ASSERT(instantiator != NULL); |
| 547 ASSERT(instantiator_type_arguments != NULL); | 545 ASSERT(instantiator_type_arguments != NULL); |
| 548 ASSERT(!dst_type.IsNull()); | 546 ASSERT(!dst_type.IsNull()); |
| 549 ASSERT(!dst_name.IsNull()); | 547 ASSERT(!dst_name.IsNull()); |
| 550 inputs_[0] = value; | 548 inputs_[0] = value; |
| 551 inputs_[1] = instantiator; | 549 inputs_[1] = instantiator; |
| 552 inputs_[2] = instantiator_type_arguments; | 550 inputs_[2] = instantiator_type_arguments; |
| 553 } | 551 } |
| 554 | 552 |
| 555 DECLARE_COMPUTATION(AssertAssignable) | 553 DECLARE_COMPUTATION(AssertAssignable) |
| 556 | 554 |
| 557 Value* value() const { return inputs_[0]; } | 555 Value* value() const { return inputs_[0]; } |
| 558 Value* instantiator() const { return inputs_[1]; } | 556 Value* instantiator() const { return inputs_[1]; } |
| 559 Value* instantiator_type_arguments() const { return inputs_[2]; } | 557 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 560 | 558 |
| 561 intptr_t token_pos() const { return token_pos_; } | 559 intptr_t token_pos() const { return token_pos_; } |
| 562 intptr_t try_index() const { return try_index_; } | |
| 563 const AbstractType& dst_type() const { return dst_type_; } | 560 const AbstractType& dst_type() const { return dst_type_; } |
| 564 const String& dst_name() const { return dst_name_; } | 561 const String& dst_name() const { return dst_name_; } |
| 565 | 562 |
| 566 bool is_eliminated() const { | 563 bool is_eliminated() const { |
| 567 return is_eliminated_; | 564 return is_eliminated_; |
| 568 } | 565 } |
| 569 void eliminate() { | 566 void eliminate() { |
| 570 ASSERT(!is_eliminated_); | 567 ASSERT(!is_eliminated_); |
| 571 is_eliminated_ = true; | 568 is_eliminated_ = true; |
| 572 } | 569 } |
| 573 | 570 |
| 574 virtual void PrintOperandsTo(BufferFormatter* f) const; | 571 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 575 | 572 |
| 576 virtual bool CanDeoptimize() const { return true; } | 573 virtual bool CanDeoptimize() const { return true; } |
| 577 virtual intptr_t ResultCid() const { return kDynamicCid; } | 574 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 578 | 575 |
| 579 private: | 576 private: |
| 580 const intptr_t token_pos_; | 577 const intptr_t token_pos_; |
| 581 const intptr_t try_index_; | |
| 582 const AbstractType& dst_type_; | 578 const AbstractType& dst_type_; |
| 583 const String& dst_name_; | 579 const String& dst_name_; |
| 584 bool is_eliminated_; | 580 bool is_eliminated_; |
| 585 | 581 |
| 586 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); | 582 DISALLOW_COPY_AND_ASSIGN(AssertAssignableComp); |
| 587 }; | 583 }; |
| 588 | 584 |
| 589 | 585 |
| 590 class AssertBooleanComp : public TemplateComputation<1> { | 586 class AssertBooleanComp : public TemplateComputation<1> { |
| 591 public: | 587 public: |
| 592 AssertBooleanComp(intptr_t token_pos, | 588 AssertBooleanComp(intptr_t token_pos, |
| 593 intptr_t try_index, | |
| 594 Value* value) | 589 Value* value) |
| 595 : token_pos_(token_pos), | 590 : token_pos_(token_pos), |
| 596 try_index_(try_index), | |
| 597 is_eliminated_(false) { | 591 is_eliminated_(false) { |
| 598 ASSERT(value != NULL); | 592 ASSERT(value != NULL); |
| 599 inputs_[0] = value; | 593 inputs_[0] = value; |
| 600 } | 594 } |
| 601 | 595 |
| 602 DECLARE_COMPUTATION(AssertBoolean) | 596 DECLARE_COMPUTATION(AssertBoolean) |
| 603 | 597 |
| 604 intptr_t token_pos() const { return token_pos_; } | 598 intptr_t token_pos() const { return token_pos_; } |
| 605 intptr_t try_index() const { return try_index_; } | |
| 606 Value* value() const { return inputs_[0]; } | 599 Value* value() const { return inputs_[0]; } |
| 607 | 600 |
| 608 bool is_eliminated() const { | 601 bool is_eliminated() const { |
| 609 return is_eliminated_; | 602 return is_eliminated_; |
| 610 } | 603 } |
| 611 void eliminate() { | 604 void eliminate() { |
| 612 ASSERT(!is_eliminated_); | 605 ASSERT(!is_eliminated_); |
| 613 is_eliminated_ = true; | 606 is_eliminated_ = true; |
| 614 } | 607 } |
| 615 | 608 |
| 616 virtual void PrintOperandsTo(BufferFormatter* f) const; | 609 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 617 | 610 |
| 618 virtual bool CanDeoptimize() const { return true; } | 611 virtual bool CanDeoptimize() const { return true; } |
| 619 virtual intptr_t ResultCid() const { return kBoolCid; } | 612 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 620 | 613 |
| 621 private: | 614 private: |
| 622 const intptr_t token_pos_; | 615 const intptr_t token_pos_; |
| 623 const intptr_t try_index_; | |
| 624 bool is_eliminated_; | 616 bool is_eliminated_; |
| 625 | 617 |
| 626 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); | 618 DISALLOW_COPY_AND_ASSIGN(AssertBooleanComp); |
| 627 }; | 619 }; |
| 628 | 620 |
| 629 | 621 |
| 630 // Denotes the current context, normally held in a register. This is | 622 // Denotes the current context, normally held in a register. This is |
| 631 // a computation, not a value, because it's mutable. | 623 // a computation, not a value, because it's mutable. |
| 632 class CurrentContextComp : public TemplateComputation<0> { | 624 class CurrentContextComp : public TemplateComputation<0> { |
| 633 public: | 625 public: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 658 virtual intptr_t ResultCid() const { return kIllegalCid; } | 650 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 659 | 651 |
| 660 private: | 652 private: |
| 661 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); | 653 DISALLOW_COPY_AND_ASSIGN(StoreContextComp); |
| 662 }; | 654 }; |
| 663 | 655 |
| 664 | 656 |
| 665 class ClosureCallComp : public TemplateComputation<0> { | 657 class ClosureCallComp : public TemplateComputation<0> { |
| 666 public: | 658 public: |
| 667 ClosureCallComp(ClosureCallNode* node, | 659 ClosureCallComp(ClosureCallNode* node, |
| 668 intptr_t try_index, | |
| 669 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 660 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 670 : ast_node_(*node), | 661 : ast_node_(*node), |
| 671 try_index_(try_index), | |
| 672 arguments_(arguments) { } | 662 arguments_(arguments) { } |
| 673 | 663 |
| 674 DECLARE_CALL_COMPUTATION(ClosureCall) | 664 DECLARE_CALL_COMPUTATION(ClosureCall) |
| 675 | 665 |
| 676 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 666 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
| 677 intptr_t token_pos() const { return ast_node_.token_pos(); } | 667 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 678 intptr_t try_index() const { return try_index_; } | |
| 679 | 668 |
| 680 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 669 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 681 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 670 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| 682 return (*arguments_)[index]; | 671 return (*arguments_)[index]; |
| 683 } | 672 } |
| 684 | 673 |
| 685 virtual void PrintOperandsTo(BufferFormatter* f) const; | 674 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 686 | 675 |
| 687 virtual bool CanDeoptimize() const { return false; } | 676 virtual bool CanDeoptimize() const { return false; } |
| 688 virtual intptr_t ResultCid() const { return kDynamicCid; } | 677 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 689 | 678 |
| 690 private: | 679 private: |
| 691 const ClosureCallNode& ast_node_; | 680 const ClosureCallNode& ast_node_; |
| 692 const intptr_t try_index_; | |
| 693 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 681 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 694 | 682 |
| 695 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); | 683 DISALLOW_COPY_AND_ASSIGN(ClosureCallComp); |
| 696 }; | 684 }; |
| 697 | 685 |
| 698 | 686 |
| 699 class InstanceCallComp : public TemplateComputation<0> { | 687 class InstanceCallComp : public TemplateComputation<0> { |
| 700 public: | 688 public: |
| 701 InstanceCallComp(intptr_t token_pos, | 689 InstanceCallComp(intptr_t token_pos, |
| 702 intptr_t try_index, | |
| 703 const String& function_name, | 690 const String& function_name, |
| 704 Token::Kind token_kind, | 691 Token::Kind token_kind, |
| 705 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 692 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 706 const Array& argument_names, | 693 const Array& argument_names, |
| 707 intptr_t checked_argument_count) | 694 intptr_t checked_argument_count) |
| 708 : token_pos_(token_pos), | 695 : token_pos_(token_pos), |
| 709 try_index_(try_index), | |
| 710 function_name_(function_name), | 696 function_name_(function_name), |
| 711 token_kind_(token_kind), | 697 token_kind_(token_kind), |
| 712 arguments_(arguments), | 698 arguments_(arguments), |
| 713 argument_names_(argument_names), | 699 argument_names_(argument_names), |
| 714 checked_argument_count_(checked_argument_count) { | 700 checked_argument_count_(checked_argument_count) { |
| 715 ASSERT(function_name.IsZoneHandle()); | 701 ASSERT(function_name.IsZoneHandle()); |
| 716 ASSERT(!arguments->is_empty()); | 702 ASSERT(!arguments->is_empty()); |
| 717 ASSERT(argument_names.IsZoneHandle()); | 703 ASSERT(argument_names.IsZoneHandle()); |
| 718 ASSERT(Token::IsBinaryToken(token_kind) || | 704 ASSERT(Token::IsBinaryToken(token_kind) || |
| 719 Token::IsUnaryToken(token_kind) || | 705 Token::IsUnaryToken(token_kind) || |
| 720 Token::IsIndexOperator(token_kind) || | 706 Token::IsIndexOperator(token_kind) || |
| 721 token_kind == Token::kGET || | 707 token_kind == Token::kGET || |
| 722 token_kind == Token::kSET || | 708 token_kind == Token::kSET || |
| 723 token_kind == Token::kILLEGAL); | 709 token_kind == Token::kILLEGAL); |
| 724 } | 710 } |
| 725 | 711 |
| 726 DECLARE_CALL_COMPUTATION(InstanceCall) | 712 DECLARE_CALL_COMPUTATION(InstanceCall) |
| 727 | 713 |
| 728 intptr_t token_pos() const { return token_pos_; } | 714 intptr_t token_pos() const { return token_pos_; } |
| 729 intptr_t try_index() const { return try_index_; } | |
| 730 const String& function_name() const { return function_name_; } | 715 const String& function_name() const { return function_name_; } |
| 731 Token::Kind token_kind() const { return token_kind_; } | 716 Token::Kind token_kind() const { return token_kind_; } |
| 732 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 717 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 733 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 718 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| 734 return (*arguments_)[index]; | 719 return (*arguments_)[index]; |
| 735 } | 720 } |
| 736 const Array& argument_names() const { return argument_names_; } | 721 const Array& argument_names() const { return argument_names_; } |
| 737 intptr_t checked_argument_count() const { return checked_argument_count_; } | 722 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 738 | 723 |
| 739 virtual void PrintOperandsTo(BufferFormatter* f) const; | 724 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 740 | 725 |
| 741 virtual bool CanDeoptimize() const { return true; } | 726 virtual bool CanDeoptimize() const { return true; } |
| 742 virtual intptr_t ResultCid() const { return kDynamicCid; } | 727 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 743 | 728 |
| 744 private: | 729 private: |
| 745 const intptr_t token_pos_; | 730 const intptr_t token_pos_; |
| 746 const intptr_t try_index_; | |
| 747 const String& function_name_; | 731 const String& function_name_; |
| 748 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 732 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
| 749 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 733 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| 750 const Array& argument_names_; | 734 const Array& argument_names_; |
| 751 const intptr_t checked_argument_count_; | 735 const intptr_t checked_argument_count_; |
| 752 | 736 |
| 753 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 737 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 754 }; | 738 }; |
| 755 | 739 |
| 756 | 740 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 BranchInstr* branch); | 809 BranchInstr* branch); |
| 826 | 810 |
| 827 private: | 811 private: |
| 828 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); | 812 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); |
| 829 }; | 813 }; |
| 830 | 814 |
| 831 | 815 |
| 832 class EqualityCompareComp : public ComparisonComp { | 816 class EqualityCompareComp : public ComparisonComp { |
| 833 public: | 817 public: |
| 834 EqualityCompareComp(intptr_t token_pos, | 818 EqualityCompareComp(intptr_t token_pos, |
| 835 intptr_t try_index, | |
| 836 Token::Kind kind, | 819 Token::Kind kind, |
| 837 Value* left, | 820 Value* left, |
| 838 Value* right) | 821 Value* right) |
| 839 : ComparisonComp(kind, left, right), | 822 : ComparisonComp(kind, left, right), |
| 840 token_pos_(token_pos), | 823 token_pos_(token_pos), |
| 841 try_index_(try_index), | |
| 842 receiver_class_id_(kIllegalCid) { | 824 receiver_class_id_(kIllegalCid) { |
| 843 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); | 825 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); |
| 844 } | 826 } |
| 845 | 827 |
| 846 DECLARE_COMPUTATION(EqualityCompare) | 828 DECLARE_COMPUTATION(EqualityCompare) |
| 847 | 829 |
| 848 intptr_t token_pos() const { return token_pos_; } | 830 intptr_t token_pos() const { return token_pos_; } |
| 849 intptr_t try_index() const { return try_index_; } | |
| 850 | 831 |
| 851 // Receiver class id is computed from collected ICData. | 832 // Receiver class id is computed from collected ICData. |
| 852 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } | 833 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } |
| 853 intptr_t receiver_class_id() const { return receiver_class_id_; } | 834 intptr_t receiver_class_id() const { return receiver_class_id_; } |
| 854 | 835 |
| 855 virtual void PrintOperandsTo(BufferFormatter* f) const; | 836 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 856 | 837 |
| 857 virtual bool CanDeoptimize() const { return true; } | 838 virtual bool CanDeoptimize() const { return true; } |
| 858 virtual intptr_t ResultCid() const; | 839 virtual intptr_t ResultCid() const; |
| 859 | 840 |
| 860 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 841 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 861 BranchInstr* branch); | 842 BranchInstr* branch); |
| 862 | 843 |
| 863 private: | 844 private: |
| 864 const intptr_t token_pos_; | 845 const intptr_t token_pos_; |
| 865 const intptr_t try_index_; | |
| 866 intptr_t receiver_class_id_; // Set by optimizer. | 846 intptr_t receiver_class_id_; // Set by optimizer. |
| 867 | 847 |
| 868 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); | 848 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); |
| 869 }; | 849 }; |
| 870 | 850 |
| 871 | 851 |
| 872 class RelationalOpComp : public ComparisonComp { | 852 class RelationalOpComp : public ComparisonComp { |
| 873 public: | 853 public: |
| 874 RelationalOpComp(intptr_t token_pos, | 854 RelationalOpComp(intptr_t token_pos, |
| 875 intptr_t try_index, | |
| 876 Token::Kind kind, | 855 Token::Kind kind, |
| 877 Value* left, | 856 Value* left, |
| 878 Value* right) | 857 Value* right) |
| 879 : ComparisonComp(kind, left, right), | 858 : ComparisonComp(kind, left, right), |
| 880 token_pos_(token_pos), | 859 token_pos_(token_pos), |
| 881 try_index_(try_index), | |
| 882 operands_class_id_(kIllegalCid) { | 860 operands_class_id_(kIllegalCid) { |
| 883 ASSERT(Token::IsRelationalOperator(kind)); | 861 ASSERT(Token::IsRelationalOperator(kind)); |
| 884 } | 862 } |
| 885 | 863 |
| 886 DECLARE_COMPUTATION(RelationalOp) | 864 DECLARE_COMPUTATION(RelationalOp) |
| 887 | 865 |
| 888 intptr_t token_pos() const { return token_pos_; } | 866 intptr_t token_pos() const { return token_pos_; } |
| 889 intptr_t try_index() const { return try_index_; } | |
| 890 | 867 |
| 891 // TODO(srdjan): instead of class-id pass an enum that can differentiate | 868 // TODO(srdjan): instead of class-id pass an enum that can differentiate |
| 892 // between boxed and unboxed doubles and integers. | 869 // between boxed and unboxed doubles and integers. |
| 893 void set_operands_class_id(intptr_t value) { | 870 void set_operands_class_id(intptr_t value) { |
| 894 operands_class_id_ = value; | 871 operands_class_id_ = value; |
| 895 } | 872 } |
| 896 | 873 |
| 897 intptr_t operands_class_id() const { return operands_class_id_; } | 874 intptr_t operands_class_id() const { return operands_class_id_; } |
| 898 | 875 |
| 899 virtual void PrintOperandsTo(BufferFormatter* f) const; | 876 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 900 | 877 |
| 901 virtual bool CanDeoptimize() const { return true; } | 878 virtual bool CanDeoptimize() const { return true; } |
| 902 virtual intptr_t ResultCid() const; | 879 virtual intptr_t ResultCid() const; |
| 903 | 880 |
| 904 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 881 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 905 BranchInstr* branch); | 882 BranchInstr* branch); |
| 906 | 883 |
| 907 private: | 884 private: |
| 908 const intptr_t token_pos_; | 885 const intptr_t token_pos_; |
| 909 const intptr_t try_index_; | |
| 910 intptr_t operands_class_id_; // class id of both operands. | 886 intptr_t operands_class_id_; // class id of both operands. |
| 911 | 887 |
| 912 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); | 888 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); |
| 913 }; | 889 }; |
| 914 | 890 |
| 915 | 891 |
| 916 class StaticCallComp : public TemplateComputation<0> { | 892 class StaticCallComp : public TemplateComputation<0> { |
| 917 public: | 893 public: |
| 918 StaticCallComp(intptr_t token_pos, | 894 StaticCallComp(intptr_t token_pos, |
| 919 intptr_t try_index, | |
| 920 const Function& function, | 895 const Function& function, |
| 921 const Array& argument_names, | 896 const Array& argument_names, |
| 922 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 897 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 923 : token_pos_(token_pos), | 898 : token_pos_(token_pos), |
| 924 try_index_(try_index), | |
| 925 function_(function), | 899 function_(function), |
| 926 argument_names_(argument_names), | 900 argument_names_(argument_names), |
| 927 arguments_(arguments), | 901 arguments_(arguments), |
| 928 recognized_(MethodRecognizer::kUnknown) { | 902 recognized_(MethodRecognizer::kUnknown) { |
| 929 ASSERT(function.IsZoneHandle()); | 903 ASSERT(function.IsZoneHandle()); |
| 930 ASSERT(argument_names.IsZoneHandle()); | 904 ASSERT(argument_names.IsZoneHandle()); |
| 931 } | 905 } |
| 932 | 906 |
| 933 DECLARE_CALL_COMPUTATION(StaticCall) | 907 DECLARE_CALL_COMPUTATION(StaticCall) |
| 934 | 908 |
| 935 // Accessors forwarded to the AST node. | 909 // Accessors forwarded to the AST node. |
| 936 const Function& function() const { return function_; } | 910 const Function& function() const { return function_; } |
| 937 const Array& argument_names() const { return argument_names_; } | 911 const Array& argument_names() const { return argument_names_; } |
| 938 intptr_t token_pos() const { return token_pos_; } | 912 intptr_t token_pos() const { return token_pos_; } |
| 939 intptr_t try_index() const { return try_index_; } | |
| 940 | 913 |
| 941 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 914 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 942 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 915 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| 943 return (*arguments_)[index]; | 916 return (*arguments_)[index]; |
| 944 } | 917 } |
| 945 | 918 |
| 946 MethodRecognizer::Kind recognized() const { return recognized_; } | 919 MethodRecognizer::Kind recognized() const { return recognized_; } |
| 947 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; } | 920 void set_recognized(MethodRecognizer::Kind kind) { recognized_ = kind; } |
| 948 | 921 |
| 949 virtual void PrintOperandsTo(BufferFormatter* f) const; | 922 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 950 | 923 |
| 951 virtual bool CanDeoptimize() const { return true; } | 924 virtual bool CanDeoptimize() const { return true; } |
| 952 virtual intptr_t ResultCid() const { return kDynamicCid; } | 925 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 953 | 926 |
| 954 private: | 927 private: |
| 955 const intptr_t token_pos_; | 928 const intptr_t token_pos_; |
| 956 const intptr_t try_index_; | |
| 957 const Function& function_; | 929 const Function& function_; |
| 958 const Array& argument_names_; | 930 const Array& argument_names_; |
| 959 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 931 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 960 MethodRecognizer::Kind recognized_; | 932 MethodRecognizer::Kind recognized_; |
| 961 | 933 |
| 962 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); | 934 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| 963 }; | 935 }; |
| 964 | 936 |
| 965 | 937 |
| 966 class LoadLocalComp : public TemplateComputation<0> { | 938 class LoadLocalComp : public TemplateComputation<0> { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 private: | 987 private: |
| 1016 const LocalVariable& local_; | 988 const LocalVariable& local_; |
| 1017 const intptr_t context_level_; | 989 const intptr_t context_level_; |
| 1018 | 990 |
| 1019 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); | 991 DISALLOW_COPY_AND_ASSIGN(StoreLocalComp); |
| 1020 }; | 992 }; |
| 1021 | 993 |
| 1022 | 994 |
| 1023 class NativeCallComp : public TemplateComputation<0> { | 995 class NativeCallComp : public TemplateComputation<0> { |
| 1024 public: | 996 public: |
| 1025 NativeCallComp(NativeBodyNode* node, intptr_t try_index) | 997 explicit NativeCallComp(NativeBodyNode* node) |
| 1026 : ast_node_(*node), try_index_(try_index) {} | 998 : ast_node_(*node) {} |
| 1027 | 999 |
| 1028 DECLARE_COMPUTATION(NativeCall) | 1000 DECLARE_COMPUTATION(NativeCall) |
| 1029 | 1001 |
| 1030 intptr_t token_pos() const { return ast_node_.token_pos(); } | 1002 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1031 intptr_t try_index() const { return try_index_; } | |
| 1032 | 1003 |
| 1033 const String& native_name() const { | 1004 const String& native_name() const { |
| 1034 return ast_node_.native_c_function_name(); | 1005 return ast_node_.native_c_function_name(); |
| 1035 } | 1006 } |
| 1036 | 1007 |
| 1037 NativeFunction native_c_function() const { | 1008 NativeFunction native_c_function() const { |
| 1038 return ast_node_.native_c_function(); | 1009 return ast_node_.native_c_function(); |
| 1039 } | 1010 } |
| 1040 | 1011 |
| 1041 intptr_t argument_count() const { return ast_node_.argument_count(); } | 1012 intptr_t argument_count() const { return ast_node_.argument_count(); } |
| 1042 | 1013 |
| 1043 bool has_optional_parameters() const { | 1014 bool has_optional_parameters() const { |
| 1044 return ast_node_.has_optional_parameters(); | 1015 return ast_node_.has_optional_parameters(); |
| 1045 } | 1016 } |
| 1046 | 1017 |
| 1047 bool is_native_instance_closure() const { | 1018 bool is_native_instance_closure() const { |
| 1048 return ast_node_.is_native_instance_closure(); | 1019 return ast_node_.is_native_instance_closure(); |
| 1049 } | 1020 } |
| 1050 | 1021 |
| 1051 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1022 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1052 | 1023 |
| 1053 virtual bool CanDeoptimize() const { return false; } | 1024 virtual bool CanDeoptimize() const { return false; } |
| 1054 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1025 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1055 | 1026 |
| 1056 private: | 1027 private: |
| 1057 const NativeBodyNode& ast_node_; | 1028 const NativeBodyNode& ast_node_; |
| 1058 const intptr_t try_index_; | |
| 1059 | 1029 |
| 1060 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); | 1030 DISALLOW_COPY_AND_ASSIGN(NativeCallComp); |
| 1061 }; | 1031 }; |
| 1062 | 1032 |
| 1063 | 1033 |
| 1064 class LoadInstanceFieldComp : public TemplateComputation<1> { | 1034 class LoadInstanceFieldComp : public TemplateComputation<1> { |
| 1065 public: | 1035 public: |
| 1066 LoadInstanceFieldComp(const Field& field, Value* instance) : field_(field) { | 1036 LoadInstanceFieldComp(const Field& field, Value* instance) : field_(field) { |
| 1067 ASSERT(instance != NULL); | 1037 ASSERT(instance != NULL); |
| 1068 inputs_[0] = instance; | 1038 inputs_[0] = instance; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 virtual intptr_t ResultCid() const { return kBoolCid; } | 1210 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 1241 | 1211 |
| 1242 private: | 1212 private: |
| 1243 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); | 1213 DISALLOW_COPY_AND_ASSIGN(BooleanNegateComp); |
| 1244 }; | 1214 }; |
| 1245 | 1215 |
| 1246 | 1216 |
| 1247 class InstanceOfComp : public TemplateComputation<3> { | 1217 class InstanceOfComp : public TemplateComputation<3> { |
| 1248 public: | 1218 public: |
| 1249 InstanceOfComp(intptr_t token_pos, | 1219 InstanceOfComp(intptr_t token_pos, |
| 1250 intptr_t try_index, | |
| 1251 Value* value, | 1220 Value* value, |
| 1252 Value* instantiator, | 1221 Value* instantiator, |
| 1253 Value* instantiator_type_arguments, | 1222 Value* instantiator_type_arguments, |
| 1254 const AbstractType& type, | 1223 const AbstractType& type, |
| 1255 bool negate_result) | 1224 bool negate_result) |
| 1256 : token_pos_(token_pos), | 1225 : token_pos_(token_pos), |
| 1257 try_index_(try_index), | |
| 1258 type_(type), | 1226 type_(type), |
| 1259 negate_result_(negate_result) { | 1227 negate_result_(negate_result) { |
| 1260 ASSERT(value != NULL); | 1228 ASSERT(value != NULL); |
| 1261 ASSERT(instantiator != NULL); | 1229 ASSERT(instantiator != NULL); |
| 1262 ASSERT(instantiator_type_arguments != NULL); | 1230 ASSERT(instantiator_type_arguments != NULL); |
| 1263 ASSERT(!type.IsNull()); | 1231 ASSERT(!type.IsNull()); |
| 1264 inputs_[0] = value; | 1232 inputs_[0] = value; |
| 1265 inputs_[1] = instantiator; | 1233 inputs_[1] = instantiator; |
| 1266 inputs_[2] = instantiator_type_arguments; | 1234 inputs_[2] = instantiator_type_arguments; |
| 1267 } | 1235 } |
| 1268 | 1236 |
| 1269 DECLARE_COMPUTATION(InstanceOf) | 1237 DECLARE_COMPUTATION(InstanceOf) |
| 1270 | 1238 |
| 1271 Value* value() const { return inputs_[0]; } | 1239 Value* value() const { return inputs_[0]; } |
| 1272 Value* instantiator() const { return inputs_[1]; } | 1240 Value* instantiator() const { return inputs_[1]; } |
| 1273 Value* instantiator_type_arguments() const { return inputs_[2]; } | 1241 Value* instantiator_type_arguments() const { return inputs_[2]; } |
| 1274 | 1242 |
| 1275 bool negate_result() const { return negate_result_; } | 1243 bool negate_result() const { return negate_result_; } |
| 1276 const AbstractType& type() const { return type_; } | 1244 const AbstractType& type() const { return type_; } |
| 1277 intptr_t token_pos() const { return token_pos_; } | 1245 intptr_t token_pos() const { return token_pos_; } |
| 1278 intptr_t try_index() const { return try_index_; } | |
| 1279 | 1246 |
| 1280 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1247 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1281 | 1248 |
| 1282 virtual bool CanDeoptimize() const { return true; } | 1249 virtual bool CanDeoptimize() const { return true; } |
| 1283 virtual intptr_t ResultCid() const { return kBoolCid; } | 1250 virtual intptr_t ResultCid() const { return kBoolCid; } |
| 1284 | 1251 |
| 1285 private: | 1252 private: |
| 1286 const intptr_t token_pos_; | 1253 const intptr_t token_pos_; |
| 1287 const intptr_t try_index_; | |
| 1288 Value* value_; | 1254 Value* value_; |
| 1289 Value* instantiator_; | 1255 Value* instantiator_; |
| 1290 Value* type_arguments_; | 1256 Value* type_arguments_; |
| 1291 const AbstractType& type_; | 1257 const AbstractType& type_; |
| 1292 const bool negate_result_; | 1258 const bool negate_result_; |
| 1293 | 1259 |
| 1294 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); | 1260 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); |
| 1295 }; | 1261 }; |
| 1296 | 1262 |
| 1297 | 1263 |
| 1298 class AllocateObjectComp : public TemplateComputation<0> { | 1264 class AllocateObjectComp : public TemplateComputation<0> { |
| 1299 public: | 1265 public: |
| 1300 AllocateObjectComp(ConstructorCallNode* node, | 1266 AllocateObjectComp(ConstructorCallNode* node, |
| 1301 intptr_t try_index, | |
| 1302 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 1267 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 1303 : ast_node_(*node), try_index_(try_index), arguments_(arguments) { | 1268 : ast_node_(*node), arguments_(arguments) { |
| 1304 // Either no arguments or one type-argument and one instantiator. | 1269 // Either no arguments or one type-argument and one instantiator. |
| 1305 ASSERT(arguments->is_empty() || (arguments->length() == 2)); | 1270 ASSERT(arguments->is_empty() || (arguments->length() == 2)); |
| 1306 } | 1271 } |
| 1307 | 1272 |
| 1308 DECLARE_CALL_COMPUTATION(AllocateObject) | 1273 DECLARE_CALL_COMPUTATION(AllocateObject) |
| 1309 | 1274 |
| 1310 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 1275 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 1311 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 1276 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| 1312 return (*arguments_)[index]; | 1277 return (*arguments_)[index]; |
| 1313 } | 1278 } |
| 1314 | 1279 |
| 1315 const Function& constructor() const { return ast_node_.constructor(); } | 1280 const Function& constructor() const { return ast_node_.constructor(); } |
| 1316 intptr_t token_pos() const { return ast_node_.token_pos(); } | 1281 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1317 intptr_t try_index() const { return try_index_; } | |
| 1318 | 1282 |
| 1319 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1283 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1320 | 1284 |
| 1321 virtual bool CanDeoptimize() const { return false; } | 1285 virtual bool CanDeoptimize() const { return false; } |
| 1322 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1286 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1323 | 1287 |
| 1324 private: | 1288 private: |
| 1325 const ConstructorCallNode& ast_node_; | 1289 const ConstructorCallNode& ast_node_; |
| 1326 const intptr_t try_index_; | |
| 1327 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 1290 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| 1328 | 1291 |
| 1329 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); | 1292 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp); |
| 1330 }; | 1293 }; |
| 1331 | 1294 |
| 1332 | 1295 |
| 1333 class AllocateObjectWithBoundsCheckComp : public TemplateComputation<2> { | 1296 class AllocateObjectWithBoundsCheckComp : public TemplateComputation<2> { |
| 1334 public: | 1297 public: |
| 1335 AllocateObjectWithBoundsCheckComp(ConstructorCallNode* node, | 1298 AllocateObjectWithBoundsCheckComp(ConstructorCallNode* node, |
| 1336 intptr_t try_index, | |
| 1337 Value* type_arguments, | 1299 Value* type_arguments, |
| 1338 Value* instantiator) | 1300 Value* instantiator) |
| 1339 : ast_node_(*node), try_index_(try_index) { | 1301 : ast_node_(*node) { |
| 1340 ASSERT(type_arguments != NULL); | 1302 ASSERT(type_arguments != NULL); |
| 1341 ASSERT(instantiator != NULL); | 1303 ASSERT(instantiator != NULL); |
| 1342 inputs_[0] = type_arguments; | 1304 inputs_[0] = type_arguments; |
| 1343 inputs_[1] = instantiator; | 1305 inputs_[1] = instantiator; |
| 1344 } | 1306 } |
| 1345 | 1307 |
| 1346 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) | 1308 DECLARE_COMPUTATION(AllocateObjectWithBoundsCheck) |
| 1347 | 1309 |
| 1348 const Function& constructor() const { return ast_node_.constructor(); } | 1310 const Function& constructor() const { return ast_node_.constructor(); } |
| 1349 intptr_t token_pos() const { return ast_node_.token_pos(); } | 1311 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1350 intptr_t try_index() const { return try_index_; } | |
| 1351 | 1312 |
| 1352 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1313 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1353 | 1314 |
| 1354 virtual bool CanDeoptimize() const { return true; } | 1315 virtual bool CanDeoptimize() const { return true; } |
| 1355 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1316 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1356 | 1317 |
| 1357 private: | 1318 private: |
| 1358 const ConstructorCallNode& ast_node_; | 1319 const ConstructorCallNode& ast_node_; |
| 1359 const intptr_t try_index_; | |
| 1360 | 1320 |
| 1361 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); | 1321 DISALLOW_COPY_AND_ASSIGN(AllocateObjectWithBoundsCheckComp); |
| 1362 }; | 1322 }; |
| 1363 | 1323 |
| 1364 | 1324 |
| 1365 class CreateArrayComp : public TemplateComputation<1> { | 1325 class CreateArrayComp : public TemplateComputation<1> { |
| 1366 public: | 1326 public: |
| 1367 CreateArrayComp(intptr_t token_pos, | 1327 CreateArrayComp(intptr_t token_pos, |
| 1368 intptr_t try_index, | |
| 1369 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 1328 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 1370 const AbstractType& type, | 1329 const AbstractType& type, |
| 1371 Value* element_type) | 1330 Value* element_type) |
| 1372 : token_pos_(token_pos), | 1331 : token_pos_(token_pos), |
| 1373 try_index_(try_index), | |
| 1374 arguments_(arguments), | 1332 arguments_(arguments), |
| 1375 type_(type) { | 1333 type_(type) { |
| 1376 #if defined(DEBUG) | 1334 #if defined(DEBUG) |
| 1377 for (int i = 0; i < ArgumentCount(); ++i) { | 1335 for (int i = 0; i < ArgumentCount(); ++i) { |
| 1378 ASSERT(ArgumentAt(i) != NULL); | 1336 ASSERT(ArgumentAt(i) != NULL); |
| 1379 } | 1337 } |
| 1380 ASSERT(element_type != NULL); | 1338 ASSERT(element_type != NULL); |
| 1381 ASSERT(type_.IsZoneHandle()); | 1339 ASSERT(type_.IsZoneHandle()); |
| 1382 ASSERT(!type_.IsNull()); | 1340 ASSERT(!type_.IsNull()); |
| 1383 ASSERT(type_.IsFinalized()); | 1341 ASSERT(type_.IsFinalized()); |
| 1384 #endif | 1342 #endif |
| 1385 inputs_[0] = element_type; | 1343 inputs_[0] = element_type; |
| 1386 } | 1344 } |
| 1387 | 1345 |
| 1388 DECLARE_CALL_COMPUTATION(CreateArray) | 1346 DECLARE_CALL_COMPUTATION(CreateArray) |
| 1389 | 1347 |
| 1390 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 1348 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 1391 | 1349 |
| 1392 intptr_t token_pos() const { return token_pos_; } | 1350 intptr_t token_pos() const { return token_pos_; } |
| 1393 intptr_t try_index() const { return try_index_; } | |
| 1394 PushArgumentInstr* ArgumentAt(intptr_t i) const { return (*arguments_)[i]; } | 1351 PushArgumentInstr* ArgumentAt(intptr_t i) const { return (*arguments_)[i]; } |
| 1395 const AbstractType& type() const { return type_; } | 1352 const AbstractType& type() const { return type_; } |
| 1396 Value* element_type() const { return inputs_[0]; } | 1353 Value* element_type() const { return inputs_[0]; } |
| 1397 | 1354 |
| 1398 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1355 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1399 | 1356 |
| 1400 virtual bool CanDeoptimize() const { return false; } | 1357 virtual bool CanDeoptimize() const { return false; } |
| 1401 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1358 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1402 | 1359 |
| 1403 private: | 1360 private: |
| 1404 const intptr_t token_pos_; | 1361 const intptr_t token_pos_; |
| 1405 const intptr_t try_index_; | |
| 1406 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 1362 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| 1407 const AbstractType& type_; | 1363 const AbstractType& type_; |
| 1408 | 1364 |
| 1409 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); | 1365 DISALLOW_COPY_AND_ASSIGN(CreateArrayComp); |
| 1410 }; | 1366 }; |
| 1411 | 1367 |
| 1412 | 1368 |
| 1413 class CreateClosureComp : public TemplateComputation<0> { | 1369 class CreateClosureComp : public TemplateComputation<0> { |
| 1414 public: | 1370 public: |
| 1415 CreateClosureComp(ClosureNode* node, | 1371 CreateClosureComp(ClosureNode* node, |
| 1416 intptr_t try_index, | |
| 1417 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 1372 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 1418 : ast_node_(*node), | 1373 : ast_node_(*node), |
| 1419 try_index_(try_index), | |
| 1420 arguments_(arguments) { } | 1374 arguments_(arguments) { } |
| 1421 | 1375 |
| 1422 DECLARE_CALL_COMPUTATION(CreateClosure) | 1376 DECLARE_CALL_COMPUTATION(CreateClosure) |
| 1423 | 1377 |
| 1424 intptr_t token_pos() const { return ast_node_.token_pos(); } | 1378 intptr_t token_pos() const { return ast_node_.token_pos(); } |
| 1425 intptr_t try_index() const { return try_index_; } | |
| 1426 const Function& function() const { return ast_node_.function(); } | 1379 const Function& function() const { return ast_node_.function(); } |
| 1427 | 1380 |
| 1428 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 1381 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 1429 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 1382 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| 1430 return (*arguments_)[index]; | 1383 return (*arguments_)[index]; |
| 1431 } | 1384 } |
| 1432 | 1385 |
| 1433 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1386 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1434 | 1387 |
| 1435 virtual bool CanDeoptimize() const { return false; } | 1388 virtual bool CanDeoptimize() const { return false; } |
| 1436 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1389 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1437 | 1390 |
| 1438 private: | 1391 private: |
| 1439 const ClosureNode& ast_node_; | 1392 const ClosureNode& ast_node_; |
| 1440 const intptr_t try_index_; | |
| 1441 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 1393 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 1442 | 1394 |
| 1443 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); | 1395 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); |
| 1444 }; | 1396 }; |
| 1445 | 1397 |
| 1446 | 1398 |
| 1447 class LoadVMFieldComp : public TemplateComputation<1> { | 1399 class LoadVMFieldComp : public TemplateComputation<1> { |
| 1448 public: | 1400 public: |
| 1449 LoadVMFieldComp(Value* value, | 1401 LoadVMFieldComp(Value* value, |
| 1450 intptr_t offset_in_bytes, | 1402 intptr_t offset_in_bytes, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 const intptr_t offset_in_bytes_; | 1465 const intptr_t offset_in_bytes_; |
| 1514 const AbstractType& type_; | 1466 const AbstractType& type_; |
| 1515 | 1467 |
| 1516 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldComp); | 1468 DISALLOW_COPY_AND_ASSIGN(StoreVMFieldComp); |
| 1517 }; | 1469 }; |
| 1518 | 1470 |
| 1519 | 1471 |
| 1520 class InstantiateTypeArgumentsComp : public TemplateComputation<1> { | 1472 class InstantiateTypeArgumentsComp : public TemplateComputation<1> { |
| 1521 public: | 1473 public: |
| 1522 InstantiateTypeArgumentsComp(intptr_t token_pos, | 1474 InstantiateTypeArgumentsComp(intptr_t token_pos, |
| 1523 intptr_t try_index, | |
| 1524 const AbstractTypeArguments& type_arguments, | 1475 const AbstractTypeArguments& type_arguments, |
| 1525 Value* instantiator) | 1476 Value* instantiator) |
| 1526 : token_pos_(token_pos), | 1477 : token_pos_(token_pos), |
| 1527 try_index_(try_index), | |
| 1528 type_arguments_(type_arguments) { | 1478 type_arguments_(type_arguments) { |
| 1529 ASSERT(type_arguments.IsZoneHandle()); | 1479 ASSERT(type_arguments.IsZoneHandle()); |
| 1530 ASSERT(instantiator != NULL); | 1480 ASSERT(instantiator != NULL); |
| 1531 inputs_[0] = instantiator; | 1481 inputs_[0] = instantiator; |
| 1532 } | 1482 } |
| 1533 | 1483 |
| 1534 DECLARE_COMPUTATION(InstantiateTypeArguments) | 1484 DECLARE_COMPUTATION(InstantiateTypeArguments) |
| 1535 | 1485 |
| 1536 Value* instantiator() const { return inputs_[0]; } | 1486 Value* instantiator() const { return inputs_[0]; } |
| 1537 const AbstractTypeArguments& type_arguments() const { | 1487 const AbstractTypeArguments& type_arguments() const { |
| 1538 return type_arguments_; | 1488 return type_arguments_; |
| 1539 } | 1489 } |
| 1540 intptr_t token_pos() const { return token_pos_; } | 1490 intptr_t token_pos() const { return token_pos_; } |
| 1541 intptr_t try_index() const { return try_index_; } | |
| 1542 | 1491 |
| 1543 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1492 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1544 | 1493 |
| 1545 virtual bool CanDeoptimize() const { return true; } | 1494 virtual bool CanDeoptimize() const { return true; } |
| 1546 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1495 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1547 | 1496 |
| 1548 private: | 1497 private: |
| 1549 const intptr_t token_pos_; | 1498 const intptr_t token_pos_; |
| 1550 const intptr_t try_index_; | |
| 1551 const AbstractTypeArguments& type_arguments_; | 1499 const AbstractTypeArguments& type_arguments_; |
| 1552 | 1500 |
| 1553 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); | 1501 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsComp); |
| 1554 }; | 1502 }; |
| 1555 | 1503 |
| 1556 | 1504 |
| 1557 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> { | 1505 class ExtractConstructorTypeArgumentsComp : public TemplateComputation<1> { |
| 1558 public: | 1506 public: |
| 1559 ExtractConstructorTypeArgumentsComp( | 1507 ExtractConstructorTypeArgumentsComp( |
| 1560 intptr_t token_pos, | 1508 intptr_t token_pos, |
| 1561 intptr_t try_index, | |
| 1562 const AbstractTypeArguments& type_arguments, | 1509 const AbstractTypeArguments& type_arguments, |
| 1563 Value* instantiator) | 1510 Value* instantiator) |
| 1564 : token_pos_(token_pos), | 1511 : token_pos_(token_pos), |
| 1565 try_index_(try_index), | |
| 1566 type_arguments_(type_arguments) { | 1512 type_arguments_(type_arguments) { |
| 1567 ASSERT(instantiator != NULL); | 1513 ASSERT(instantiator != NULL); |
| 1568 inputs_[0] = instantiator; | 1514 inputs_[0] = instantiator; |
| 1569 } | 1515 } |
| 1570 | 1516 |
| 1571 DECLARE_COMPUTATION(ExtractConstructorTypeArguments) | 1517 DECLARE_COMPUTATION(ExtractConstructorTypeArguments) |
| 1572 | 1518 |
| 1573 Value* instantiator() const { return inputs_[0]; } | 1519 Value* instantiator() const { return inputs_[0]; } |
| 1574 const AbstractTypeArguments& type_arguments() const { | 1520 const AbstractTypeArguments& type_arguments() const { |
| 1575 return type_arguments_; | 1521 return type_arguments_; |
| 1576 } | 1522 } |
| 1577 intptr_t token_pos() const { return token_pos_; } | 1523 intptr_t token_pos() const { return token_pos_; } |
| 1578 intptr_t try_index() const { return try_index_; } | |
| 1579 | 1524 |
| 1580 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1525 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1581 | 1526 |
| 1582 virtual bool CanDeoptimize() const { return false; } | 1527 virtual bool CanDeoptimize() const { return false; } |
| 1583 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1528 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1584 | 1529 |
| 1585 private: | 1530 private: |
| 1586 const intptr_t token_pos_; | 1531 const intptr_t token_pos_; |
| 1587 const intptr_t try_index_; | |
| 1588 const AbstractTypeArguments& type_arguments_; | 1532 const AbstractTypeArguments& type_arguments_; |
| 1589 | 1533 |
| 1590 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); | 1534 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorTypeArgumentsComp); |
| 1591 }; | 1535 }; |
| 1592 | 1536 |
| 1593 | 1537 |
| 1594 class ExtractConstructorInstantiatorComp : public TemplateComputation<1> { | 1538 class ExtractConstructorInstantiatorComp : public TemplateComputation<1> { |
| 1595 public: | 1539 public: |
| 1596 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, | 1540 ExtractConstructorInstantiatorComp(ConstructorCallNode* ast_node, |
| 1597 Value* instantiator) | 1541 Value* instantiator) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1615 private: | 1559 private: |
| 1616 const ConstructorCallNode& ast_node_; | 1560 const ConstructorCallNode& ast_node_; |
| 1617 | 1561 |
| 1618 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); | 1562 DISALLOW_COPY_AND_ASSIGN(ExtractConstructorInstantiatorComp); |
| 1619 }; | 1563 }; |
| 1620 | 1564 |
| 1621 | 1565 |
| 1622 class AllocateContextComp : public TemplateComputation<0> { | 1566 class AllocateContextComp : public TemplateComputation<0> { |
| 1623 public: | 1567 public: |
| 1624 AllocateContextComp(intptr_t token_pos, | 1568 AllocateContextComp(intptr_t token_pos, |
| 1625 intptr_t try_index, | |
| 1626 intptr_t num_context_variables) | 1569 intptr_t num_context_variables) |
| 1627 : token_pos_(token_pos), | 1570 : token_pos_(token_pos), |
| 1628 try_index_(try_index), | |
| 1629 num_context_variables_(num_context_variables) {} | 1571 num_context_variables_(num_context_variables) {} |
| 1630 | 1572 |
| 1631 DECLARE_COMPUTATION(AllocateContext); | 1573 DECLARE_COMPUTATION(AllocateContext); |
| 1632 | 1574 |
| 1633 intptr_t token_pos() const { return token_pos_; } | 1575 intptr_t token_pos() const { return token_pos_; } |
| 1634 intptr_t try_index() const { return try_index_; } | |
| 1635 intptr_t num_context_variables() const { return num_context_variables_; } | 1576 intptr_t num_context_variables() const { return num_context_variables_; } |
| 1636 | 1577 |
| 1637 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1578 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1638 | 1579 |
| 1639 virtual bool CanDeoptimize() const { return false; } | 1580 virtual bool CanDeoptimize() const { return false; } |
| 1640 virtual intptr_t ResultCid() const { return kDynamicCid; } | 1581 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 1641 | 1582 |
| 1642 private: | 1583 private: |
| 1643 const intptr_t token_pos_; | 1584 const intptr_t token_pos_; |
| 1644 const intptr_t try_index_; | |
| 1645 const intptr_t num_context_variables_; | 1585 const intptr_t num_context_variables_; |
| 1646 | 1586 |
| 1647 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); | 1587 DISALLOW_COPY_AND_ASSIGN(AllocateContextComp); |
| 1648 }; | 1588 }; |
| 1649 | 1589 |
| 1650 | 1590 |
| 1651 class ChainContextComp : public TemplateComputation<1> { | 1591 class ChainContextComp : public TemplateComputation<1> { |
| 1652 public: | 1592 public: |
| 1653 explicit ChainContextComp(Value* context_value) { | 1593 explicit ChainContextComp(Value* context_value) { |
| 1654 ASSERT(context_value != NULL); | 1594 ASSERT(context_value != NULL); |
| 1655 inputs_[0] = context_value; | 1595 inputs_[0] = context_value; |
| 1656 } | 1596 } |
| 1657 | 1597 |
| 1658 DECLARE_COMPUTATION(ChainContext) | 1598 DECLARE_COMPUTATION(ChainContext) |
| 1659 | 1599 |
| 1660 Value* context_value() const { return inputs_[0]; } | 1600 Value* context_value() const { return inputs_[0]; } |
| 1661 | 1601 |
| 1662 virtual bool CanDeoptimize() const { return false; } | 1602 virtual bool CanDeoptimize() const { return false; } |
| 1663 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1603 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1664 | 1604 |
| 1665 private: | 1605 private: |
| 1666 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); | 1606 DISALLOW_COPY_AND_ASSIGN(ChainContextComp); |
| 1667 }; | 1607 }; |
| 1668 | 1608 |
| 1669 | 1609 |
| 1670 class CloneContextComp : public TemplateComputation<1> { | 1610 class CloneContextComp : public TemplateComputation<1> { |
| 1671 public: | 1611 public: |
| 1672 CloneContextComp(intptr_t token_pos, | 1612 CloneContextComp(intptr_t token_pos, |
| 1673 intptr_t try_index, | |
| 1674 Value* context_value) | 1613 Value* context_value) |
| 1675 : token_pos_(token_pos), | 1614 : token_pos_(token_pos) { |
| 1676 try_index_(try_index) { | |
| 1677 ASSERT(context_value != NULL); | 1615 ASSERT(context_value != NULL); |
| 1678 inputs_[0] = context_value; | 1616 inputs_[0] = context_value; |
| 1679 } | 1617 } |
| 1680 | 1618 |
| 1681 intptr_t token_pos() const { return token_pos_; } | 1619 intptr_t token_pos() const { return token_pos_; } |
| 1682 intptr_t try_index() const { return try_index_; } | |
| 1683 Value* context_value() const { return inputs_[0]; } | 1620 Value* context_value() const { return inputs_[0]; } |
| 1684 | 1621 |
| 1685 DECLARE_COMPUTATION(CloneContext) | 1622 DECLARE_COMPUTATION(CloneContext) |
| 1686 | 1623 |
| 1687 virtual bool CanDeoptimize() const { return true; } | 1624 virtual bool CanDeoptimize() const { return true; } |
| 1688 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1625 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1689 | 1626 |
| 1690 private: | 1627 private: |
| 1691 const intptr_t token_pos_; | 1628 const intptr_t token_pos_; |
| 1692 const intptr_t try_index_; | |
| 1693 | 1629 |
| 1694 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); | 1630 DISALLOW_COPY_AND_ASSIGN(CloneContextComp); |
| 1695 }; | 1631 }; |
| 1696 | 1632 |
| 1697 | 1633 |
| 1698 class CatchEntryComp : public TemplateComputation<0> { | 1634 class CatchEntryComp : public TemplateComputation<0> { |
| 1699 public: | 1635 public: |
| 1700 CatchEntryComp(const LocalVariable& exception_var, | 1636 CatchEntryComp(const LocalVariable& exception_var, |
| 1701 const LocalVariable& stacktrace_var) | 1637 const LocalVariable& stacktrace_var) |
| 1702 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} | 1638 : exception_var_(exception_var), stacktrace_var_(stacktrace_var) {} |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 | 1930 |
| 1995 private: | 1931 private: |
| 1996 InstanceCallComp* instance_call_; | 1932 InstanceCallComp* instance_call_; |
| 1997 | 1933 |
| 1998 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); | 1934 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); |
| 1999 }; | 1935 }; |
| 2000 | 1936 |
| 2001 | 1937 |
| 2002 class CheckStackOverflowComp : public TemplateComputation<0> { | 1938 class CheckStackOverflowComp : public TemplateComputation<0> { |
| 2003 public: | 1939 public: |
| 2004 CheckStackOverflowComp(intptr_t token_pos, intptr_t try_index) | 1940 explicit CheckStackOverflowComp(intptr_t token_pos) |
| 2005 : token_pos_(token_pos), | 1941 : token_pos_(token_pos) {} |
| 2006 try_index_(try_index) {} | |
| 2007 | 1942 |
| 2008 intptr_t token_pos() const { return token_pos_; } | 1943 intptr_t token_pos() const { return token_pos_; } |
| 2009 intptr_t try_index() const { return try_index_; } | |
| 2010 | 1944 |
| 2011 DECLARE_COMPUTATION(CheckStackOverflow) | 1945 DECLARE_COMPUTATION(CheckStackOverflow) |
| 2012 | 1946 |
| 2013 virtual bool CanDeoptimize() const { return true; } | 1947 virtual bool CanDeoptimize() const { return true; } |
| 2014 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1948 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 2015 | 1949 |
| 2016 private: | 1950 private: |
| 2017 const intptr_t token_pos_; | 1951 const intptr_t token_pos_; |
| 2018 const intptr_t try_index_; | |
| 2019 | 1952 |
| 2020 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); | 1953 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowComp); |
| 2021 }; | 1954 }; |
| 2022 | 1955 |
| 2023 | 1956 |
| 2024 class DoubleToDoubleComp : public TemplateComputation<1> { | 1957 class DoubleToDoubleComp : public TemplateComputation<1> { |
| 2025 public: | 1958 public: |
| 2026 DoubleToDoubleComp(Value* value, InstanceCallComp* instance_call) | 1959 DoubleToDoubleComp(Value* value, InstanceCallComp* instance_call) |
| 2027 : instance_call_(instance_call) { | 1960 : instance_call_(instance_call) { |
| 2028 ASSERT(value != NULL); | 1961 ASSERT(value != NULL); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 virtual bool CanDeoptimize() const { return true; } | 2012 virtual bool CanDeoptimize() const { return true; } |
| 2080 virtual intptr_t ResultCid() const { return kIllegalCid; } | 2013 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 2081 | 2014 |
| 2082 virtual bool AttributesEqual(Computation* other) const; | 2015 virtual bool AttributesEqual(Computation* other) const; |
| 2083 | 2016 |
| 2084 virtual bool HasSideEffect() const { return false; } | 2017 virtual bool HasSideEffect() const { return false; } |
| 2085 | 2018 |
| 2086 Value* value() const { return inputs_[0]; } | 2019 Value* value() const { return inputs_[0]; } |
| 2087 | 2020 |
| 2088 intptr_t deopt_id() const { return original_->deopt_id(); } | 2021 intptr_t deopt_id() const { return original_->deopt_id(); } |
| 2089 intptr_t try_index() const { return original_->try_index(); } | |
| 2090 | 2022 |
| 2091 virtual Definition* TryReplace(BindInstr* instr) const; | 2023 virtual Definition* TryReplace(BindInstr* instr) const; |
| 2092 | 2024 |
| 2093 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2025 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2094 | 2026 |
| 2095 private: | 2027 private: |
| 2096 InstanceCallComp* original_; | 2028 InstanceCallComp* original_; |
| 2097 | 2029 |
| 2098 DISALLOW_COPY_AND_ASSIGN(CheckClassComp); | 2030 DISALLOW_COPY_AND_ASSIGN(CheckClassComp); |
| 2099 }; | 2031 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2114 | 2046 |
| 2115 virtual bool AttributesEqual(Computation* other) const { return true; } | 2047 virtual bool AttributesEqual(Computation* other) const { return true; } |
| 2116 | 2048 |
| 2117 virtual bool HasSideEffect() const { return false; } | 2049 virtual bool HasSideEffect() const { return false; } |
| 2118 | 2050 |
| 2119 virtual Definition* TryReplace(BindInstr* instr) const; | 2051 virtual Definition* TryReplace(BindInstr* instr) const; |
| 2120 | 2052 |
| 2121 Value* value() const { return inputs_[0]; } | 2053 Value* value() const { return inputs_[0]; } |
| 2122 | 2054 |
| 2123 intptr_t deopt_id() const { return original_->deopt_id(); } | 2055 intptr_t deopt_id() const { return original_->deopt_id(); } |
| 2124 intptr_t try_index() const { return original_->try_index(); } | |
| 2125 | 2056 |
| 2126 private: | 2057 private: |
| 2127 InstanceCallComp* original_; | 2058 InstanceCallComp* original_; |
| 2128 | 2059 |
| 2129 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp); | 2060 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp); |
| 2130 }; | 2061 }; |
| 2131 | 2062 |
| 2132 | 2063 |
| 2133 class CheckArrayBoundComp : public TemplateComputation<2> { | 2064 class CheckArrayBoundComp : public TemplateComputation<2> { |
| 2134 public: | 2065 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2151 virtual bool AttributesEqual(Computation* other) const; | 2082 virtual bool AttributesEqual(Computation* other) const; |
| 2152 | 2083 |
| 2153 virtual bool HasSideEffect() const { return false; } | 2084 virtual bool HasSideEffect() const { return false; } |
| 2154 | 2085 |
| 2155 Value* array() const { return inputs_[0]; } | 2086 Value* array() const { return inputs_[0]; } |
| 2156 Value* index() const { return inputs_[1]; } | 2087 Value* index() const { return inputs_[1]; } |
| 2157 | 2088 |
| 2158 intptr_t array_type() const { return array_type_; } | 2089 intptr_t array_type() const { return array_type_; } |
| 2159 | 2090 |
| 2160 intptr_t deopt_id() const { return original_->deopt_id(); } | 2091 intptr_t deopt_id() const { return original_->deopt_id(); } |
| 2161 intptr_t try_index() const { return original_->try_index(); } | |
| 2162 | 2092 |
| 2163 private: | 2093 private: |
| 2164 intptr_t array_type_; | 2094 intptr_t array_type_; |
| 2165 InstanceCallComp* original_; | 2095 InstanceCallComp* original_; |
| 2166 | 2096 |
| 2167 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp); | 2097 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp); |
| 2168 }; | 2098 }; |
| 2169 | 2099 |
| 2170 | 2100 |
| 2171 #undef DECLARE_COMPUTATION | 2101 #undef DECLARE_COMPUTATION |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2568 virtual Value* InputAt(intptr_t i) const { | 2498 virtual Value* InputAt(intptr_t i) const { |
| 2569 UNREACHABLE(); | 2499 UNREACHABLE(); |
| 2570 return NULL; | 2500 return NULL; |
| 2571 } | 2501 } |
| 2572 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 2502 virtual void SetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
| 2573 | 2503 |
| 2574 virtual intptr_t ArgumentCount() const { return 0; } | 2504 virtual intptr_t ArgumentCount() const { return 0; } |
| 2575 | 2505 |
| 2576 virtual bool CanDeoptimize() const { return false; } | 2506 virtual bool CanDeoptimize() const { return false; } |
| 2577 | 2507 |
| 2508 intptr_t try_index() const { return try_index_; } |
| 2509 |
| 2578 protected: | 2510 protected: |
| 2579 BlockEntryInstr() | 2511 explicit BlockEntryInstr(intptr_t try_index) |
| 2580 : preorder_number_(-1), | 2512 : try_index_(try_index), |
| 2513 preorder_number_(-1), |
| 2581 postorder_number_(-1), | 2514 postorder_number_(-1), |
| 2582 block_id_(-1), | 2515 block_id_(-1), |
| 2583 dominator_(NULL), | 2516 dominator_(NULL), |
| 2584 dominated_blocks_(1), | 2517 dominated_blocks_(1), |
| 2585 last_instruction_(NULL), | 2518 last_instruction_(NULL), |
| 2586 parallel_move_(NULL) { } | 2519 parallel_move_(NULL) { } |
| 2587 | 2520 |
| 2588 private: | 2521 private: |
| 2522 const intptr_t try_index_; |
| 2589 intptr_t preorder_number_; | 2523 intptr_t preorder_number_; |
| 2590 intptr_t postorder_number_; | 2524 intptr_t postorder_number_; |
| 2591 // Starting and ending lifetime positions for this block. Used by | 2525 // Starting and ending lifetime positions for this block. Used by |
| 2592 // the linear scan register allocator. | 2526 // the linear scan register allocator. |
| 2593 intptr_t block_id_; | 2527 intptr_t block_id_; |
| 2594 intptr_t start_pos_; | 2528 intptr_t start_pos_; |
| 2595 intptr_t end_pos_; | 2529 intptr_t end_pos_; |
| 2596 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. | 2530 BlockEntryInstr* dominator_; // Immediate dominator, NULL for graph entry. |
| 2597 // TODO(fschneider): Optimize the case of one child to save space. | 2531 // TODO(fschneider): Optimize the case of one child to save space. |
| 2598 GrowableArray<BlockEntryInstr*> dominated_blocks_; | 2532 GrowableArray<BlockEntryInstr*> dominated_blocks_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 | 2584 |
| 2651 private: | 2585 private: |
| 2652 BlockEntryInstr* block_entry_; | 2586 BlockEntryInstr* block_entry_; |
| 2653 Instruction* current_; | 2587 Instruction* current_; |
| 2654 }; | 2588 }; |
| 2655 | 2589 |
| 2656 | 2590 |
| 2657 class GraphEntryInstr : public BlockEntryInstr { | 2591 class GraphEntryInstr : public BlockEntryInstr { |
| 2658 public: | 2592 public: |
| 2659 explicit GraphEntryInstr(TargetEntryInstr* normal_entry) | 2593 explicit GraphEntryInstr(TargetEntryInstr* normal_entry) |
| 2660 : BlockEntryInstr(), | 2594 : BlockEntryInstr(CatchClauseNode::kInvalidTryIndex), |
| 2661 normal_entry_(normal_entry), | 2595 normal_entry_(normal_entry), |
| 2662 catch_entries_(), | 2596 catch_entries_(), |
| 2663 start_env_(NULL), | 2597 start_env_(NULL), |
| 2664 spill_slot_count_(0) { } | 2598 spill_slot_count_(0) { } |
| 2665 | 2599 |
| 2666 DECLARE_INSTRUCTION(GraphEntry) | 2600 DECLARE_INSTRUCTION(GraphEntry) |
| 2667 | 2601 |
| 2668 virtual intptr_t PredecessorCount() const { return 0; } | 2602 virtual intptr_t PredecessorCount() const { return 0; } |
| 2669 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 2603 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 2670 UNREACHABLE(); | 2604 UNREACHABLE(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2702 GrowableArray<TargetEntryInstr*> catch_entries_; | 2636 GrowableArray<TargetEntryInstr*> catch_entries_; |
| 2703 Environment* start_env_; | 2637 Environment* start_env_; |
| 2704 intptr_t spill_slot_count_; | 2638 intptr_t spill_slot_count_; |
| 2705 | 2639 |
| 2706 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); | 2640 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); |
| 2707 }; | 2641 }; |
| 2708 | 2642 |
| 2709 | 2643 |
| 2710 class JoinEntryInstr : public BlockEntryInstr { | 2644 class JoinEntryInstr : public BlockEntryInstr { |
| 2711 public: | 2645 public: |
| 2712 JoinEntryInstr() | 2646 explicit JoinEntryInstr(intptr_t try_index) |
| 2713 : BlockEntryInstr(), | 2647 : BlockEntryInstr(try_index), |
| 2714 predecessors_(2), // Two is the assumed to be the common case. | 2648 predecessors_(2), // Two is the assumed to be the common case. |
| 2715 phis_(NULL), | 2649 phis_(NULL), |
| 2716 phi_count_(0) { } | 2650 phi_count_(0) { } |
| 2717 | 2651 |
| 2718 DECLARE_INSTRUCTION(JoinEntry) | 2652 DECLARE_INSTRUCTION(JoinEntry) |
| 2719 | 2653 |
| 2720 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } | 2654 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } |
| 2721 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 2655 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 2722 return predecessors_[index]; | 2656 return predecessors_[index]; |
| 2723 } | 2657 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2741 GrowableArray<BlockEntryInstr*> predecessors_; | 2675 GrowableArray<BlockEntryInstr*> predecessors_; |
| 2742 ZoneGrowableArray<PhiInstr*>* phis_; | 2676 ZoneGrowableArray<PhiInstr*>* phis_; |
| 2743 intptr_t phi_count_; | 2677 intptr_t phi_count_; |
| 2744 | 2678 |
| 2745 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); | 2679 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); |
| 2746 }; | 2680 }; |
| 2747 | 2681 |
| 2748 | 2682 |
| 2749 class TargetEntryInstr : public BlockEntryInstr { | 2683 class TargetEntryInstr : public BlockEntryInstr { |
| 2750 public: | 2684 public: |
| 2751 TargetEntryInstr() | 2685 explicit TargetEntryInstr(intptr_t try_index) |
| 2752 : BlockEntryInstr(), | 2686 : BlockEntryInstr(try_index), |
| 2753 predecessor_(NULL), | 2687 predecessor_(NULL), |
| 2754 try_index_(CatchClauseNode::kInvalidTryIndex) { } | 2688 catch_try_index_(CatchClauseNode::kInvalidTryIndex) { } |
| 2755 | 2689 |
| 2756 // Used for exception catch entries. | 2690 // Used for exception catch entries. |
| 2757 explicit TargetEntryInstr(intptr_t try_index) | 2691 explicit TargetEntryInstr(intptr_t try_index, intptr_t catch_try_index) |
| 2758 : BlockEntryInstr(), | 2692 : BlockEntryInstr(try_index), |
| 2759 predecessor_(NULL), | 2693 predecessor_(NULL), |
| 2760 try_index_(try_index) { } | 2694 catch_try_index_(catch_try_index) { } |
| 2761 | 2695 |
| 2762 DECLARE_INSTRUCTION(TargetEntry) | 2696 DECLARE_INSTRUCTION(TargetEntry) |
| 2763 | 2697 |
| 2764 virtual intptr_t PredecessorCount() const { | 2698 virtual intptr_t PredecessorCount() const { |
| 2765 return (predecessor_ == NULL) ? 0 : 1; | 2699 return (predecessor_ == NULL) ? 0 : 1; |
| 2766 } | 2700 } |
| 2767 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 2701 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
| 2768 ASSERT((index == 0) && (predecessor_ != NULL)); | 2702 ASSERT((index == 0) && (predecessor_ != NULL)); |
| 2769 return predecessor_; | 2703 return predecessor_; |
| 2770 } | 2704 } |
| 2771 virtual void AddPredecessor(BlockEntryInstr* predecessor) { | 2705 virtual void AddPredecessor(BlockEntryInstr* predecessor) { |
| 2772 ASSERT(predecessor_ == NULL); | 2706 ASSERT(predecessor_ == NULL); |
| 2773 predecessor_ = predecessor; | 2707 predecessor_ = predecessor; |
| 2774 } | 2708 } |
| 2775 | 2709 |
| 2776 bool HasTryIndex() const { | 2710 // Returns true if this Block is an entry of a catch handler. |
| 2777 return try_index_ != CatchClauseNode::kInvalidTryIndex; | 2711 bool IsCatchEntry() const { |
| 2712 return catch_try_index_ != CatchClauseNode::kInvalidTryIndex; |
| 2778 } | 2713 } |
| 2779 | 2714 |
| 2780 intptr_t try_index() const { | 2715 // Returns try index for the try block to which this catch handler |
| 2781 ASSERT(HasTryIndex()); | 2716 // corresponds. |
| 2782 return try_index_; | 2717 intptr_t catch_try_index() const { |
| 2718 ASSERT(IsCatchEntry()); |
| 2719 return catch_try_index_; |
| 2783 } | 2720 } |
| 2784 | 2721 |
| 2785 virtual void PrepareEntry(FlowGraphCompiler* compiler); | 2722 virtual void PrepareEntry(FlowGraphCompiler* compiler); |
| 2786 | 2723 |
| 2787 private: | 2724 private: |
| 2788 BlockEntryInstr* predecessor_; | 2725 BlockEntryInstr* predecessor_; |
| 2789 const intptr_t try_index_; | 2726 const intptr_t catch_try_index_; |
| 2790 | 2727 |
| 2791 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); | 2728 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); |
| 2792 }; | 2729 }; |
| 2793 | 2730 |
| 2794 | 2731 |
| 2795 // Abstract super-class of all instructions that define a value (Bind, Phi). | 2732 // Abstract super-class of all instructions that define a value (Bind, Phi). |
| 2796 class Definition : public Instruction { | 2733 class Definition : public Instruction { |
| 2797 public: | 2734 public: |
| 2798 Definition() | 2735 Definition() |
| 2799 : temp_index_(-1), | 2736 : temp_index_(-1), |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3083 private: | 3020 private: |
| 3084 const intptr_t deopt_id_; | 3021 const intptr_t deopt_id_; |
| 3085 const intptr_t token_pos_; | 3022 const intptr_t token_pos_; |
| 3086 | 3023 |
| 3087 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 3024 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
| 3088 }; | 3025 }; |
| 3089 | 3026 |
| 3090 | 3027 |
| 3091 class ThrowInstr : public TemplateInstruction<0> { | 3028 class ThrowInstr : public TemplateInstruction<0> { |
| 3092 public: | 3029 public: |
| 3093 ThrowInstr(intptr_t token_pos, intptr_t try_index) | 3030 explicit ThrowInstr(intptr_t token_pos) |
| 3094 : deopt_id_(Isolate::Current()->GetNextDeoptId()), | 3031 : deopt_id_(Isolate::Current()->GetNextDeoptId()), |
| 3095 token_pos_(token_pos), | 3032 token_pos_(token_pos) { } |
| 3096 try_index_(try_index) { } | |
| 3097 | 3033 |
| 3098 DECLARE_INSTRUCTION(Throw) | 3034 DECLARE_INSTRUCTION(Throw) |
| 3099 | 3035 |
| 3100 virtual intptr_t ArgumentCount() const { return 1; } | 3036 virtual intptr_t ArgumentCount() const { return 1; } |
| 3101 | 3037 |
| 3102 intptr_t deopt_id() const { return deopt_id_; } | 3038 intptr_t deopt_id() const { return deopt_id_; } |
| 3103 intptr_t token_pos() const { return token_pos_; } | 3039 intptr_t token_pos() const { return token_pos_; } |
| 3104 intptr_t try_index() const { return try_index_; } | |
| 3105 | 3040 |
| 3106 virtual LocationSummary* MakeLocationSummary() const; | 3041 virtual LocationSummary* MakeLocationSummary() const; |
| 3107 | 3042 |
| 3108 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 3043 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 3109 | 3044 |
| 3110 virtual bool CanDeoptimize() const { return false; } | 3045 virtual bool CanDeoptimize() const { return false; } |
| 3111 | 3046 |
| 3112 private: | 3047 private: |
| 3113 const intptr_t deopt_id_; | 3048 const intptr_t deopt_id_; |
| 3114 const intptr_t token_pos_; | 3049 const intptr_t token_pos_; |
| 3115 const intptr_t try_index_; | |
| 3116 | 3050 |
| 3117 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 3051 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
| 3118 }; | 3052 }; |
| 3119 | 3053 |
| 3120 | 3054 |
| 3121 class ReThrowInstr : public TemplateInstruction<0> { | 3055 class ReThrowInstr : public TemplateInstruction<0> { |
| 3122 public: | 3056 public: |
| 3123 ReThrowInstr(intptr_t token_pos, | 3057 explicit ReThrowInstr(intptr_t token_pos) |
| 3124 intptr_t try_index) | |
| 3125 : deopt_id_(Isolate::Current()->GetNextDeoptId()), | 3058 : deopt_id_(Isolate::Current()->GetNextDeoptId()), |
| 3126 token_pos_(token_pos), | 3059 token_pos_(token_pos) { } |
| 3127 try_index_(try_index) { } | |
| 3128 | 3060 |
| 3129 DECLARE_INSTRUCTION(ReThrow) | 3061 DECLARE_INSTRUCTION(ReThrow) |
| 3130 | 3062 |
| 3131 virtual intptr_t ArgumentCount() const { return 2; } | 3063 virtual intptr_t ArgumentCount() const { return 2; } |
| 3132 | 3064 |
| 3133 intptr_t deopt_id() const { return deopt_id_; } | 3065 intptr_t deopt_id() const { return deopt_id_; } |
| 3134 intptr_t token_pos() const { return token_pos_; } | 3066 intptr_t token_pos() const { return token_pos_; } |
| 3135 intptr_t try_index() const { return try_index_; } | |
| 3136 | 3067 |
| 3137 virtual LocationSummary* MakeLocationSummary() const; | 3068 virtual LocationSummary* MakeLocationSummary() const; |
| 3138 | 3069 |
| 3139 virtual void EmitNativeCode(FlowGraphCompiler* compiler); | 3070 virtual void EmitNativeCode(FlowGraphCompiler* compiler); |
| 3140 | 3071 |
| 3141 virtual bool CanDeoptimize() const { return false; } | 3072 virtual bool CanDeoptimize() const { return false; } |
| 3142 | 3073 |
| 3143 private: | 3074 private: |
| 3144 const intptr_t deopt_id_; | 3075 const intptr_t deopt_id_; |
| 3145 const intptr_t token_pos_; | 3076 const intptr_t token_pos_; |
| 3146 const intptr_t try_index_; | |
| 3147 | 3077 |
| 3148 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 3078 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
| 3149 }; | 3079 }; |
| 3150 | 3080 |
| 3151 | 3081 |
| 3152 class GotoInstr : public TemplateInstruction<0> { | 3082 class GotoInstr : public TemplateInstruction<0> { |
| 3153 public: | 3083 public: |
| 3154 explicit GotoInstr(JoinEntryInstr* entry) | 3084 explicit GotoInstr(JoinEntryInstr* entry) |
| 3155 : successor_(entry), | 3085 : successor_(entry), |
| 3156 parallel_move_(NULL) { } | 3086 parallel_move_(NULL) { } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3362 ForwardInstructionIterator* current_iterator_; | 3292 ForwardInstructionIterator* current_iterator_; |
| 3363 | 3293 |
| 3364 private: | 3294 private: |
| 3365 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3295 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3366 }; | 3296 }; |
| 3367 | 3297 |
| 3368 | 3298 |
| 3369 } // namespace dart | 3299 } // namespace dart |
| 3370 | 3300 |
| 3371 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3301 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |