Chromium Code Reviews| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 class Value; | 122 class Value; |
| 123 | 123 |
| 124 | 124 |
| 125 enum Representation { | 125 enum Representation { |
| 126 kTagged, kUnboxedDouble | 126 kTagged, kUnboxedDouble |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 | 129 |
| 130 class Computation : public ZoneAllocated { | 130 class Computation : public ZoneAllocated { |
| 131 public: | 131 public: |
| 132 Computation() : deopt_id_(Isolate::kNoDeoptId), ic_data_(NULL), locs_(NULL) { | 132 Computation() : deopt_id_(Isolate::kNoDeoptId), locs_(NULL) { |
| 133 Isolate* isolate = Isolate::Current(); | 133 Isolate* isolate = Isolate::Current(); |
| 134 deopt_id_ = isolate->GetNextDeoptId(); | 134 deopt_id_ = isolate->GetNextDeoptId(); |
|
srdjan
2012/08/30 18:53:21
No need for variable isolate.
Florian Schneider
2012/09/03 10:33:29
Done.
| |
| 135 ic_data_ = isolate->GetICDataForDeoptId(deopt_id_); | |
| 136 } | 135 } |
| 137 | 136 |
| 138 // Unique id used for deoptimization. | 137 // Unique id used for deoptimization. |
| 139 intptr_t deopt_id() const { | 138 intptr_t deopt_id() const { |
| 140 ASSERT(CanDeoptimize()); | 139 ASSERT(CanDeoptimize()); |
| 141 return deopt_id_; | 140 return deopt_id_; |
| 142 } | 141 } |
| 143 | 142 |
| 144 const ICData* ic_data() const { return ic_data_; } | |
| 145 void set_ic_data(const ICData* value) { ic_data_ = value; } | |
| 146 bool HasICData() const { | |
| 147 return (ic_data() != NULL) && !ic_data()->IsNull(); | |
| 148 } | |
| 149 | |
| 150 // Visiting support. | 143 // Visiting support. |
| 151 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0; | 144 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0; |
| 152 | 145 |
| 153 virtual intptr_t InputCount() const = 0; | 146 virtual intptr_t InputCount() const = 0; |
| 154 virtual Value* InputAt(intptr_t i) const = 0; | 147 virtual Value* InputAt(intptr_t i) const = 0; |
| 155 virtual void SetInputAt(intptr_t i, Value* value) = 0; | 148 virtual void SetInputAt(intptr_t i, Value* value) = 0; |
| 156 | 149 |
| 157 // Call computations override this function and return the | 150 // Call computations override this function and return the |
| 158 // number of pushed arguments. | 151 // number of pushed arguments. |
| 159 virtual intptr_t ArgumentCount() const = 0; | 152 virtual intptr_t ArgumentCount() const = 0; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 inline bool Is##ShortName() const; \ | 243 inline bool Is##ShortName() const; \ |
| 251 inline const ClassName* As##ShortName() const; \ | 244 inline const ClassName* As##ShortName() const; \ |
| 252 inline ClassName* As##ShortName(); | 245 inline ClassName* As##ShortName(); |
| 253 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) | 246 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) |
| 254 #undef DECLARE_PREDICATE | 247 #undef DECLARE_PREDICATE |
| 255 | 248 |
| 256 private: | 249 private: |
| 257 friend class BranchInstr; | 250 friend class BranchInstr; |
| 258 | 251 |
| 259 intptr_t deopt_id_; | 252 intptr_t deopt_id_; |
| 260 const ICData* ic_data_; | |
| 261 LocationSummary* locs_; | 253 LocationSummary* locs_; |
| 262 | 254 |
| 263 DISALLOW_COPY_AND_ASSIGN(Computation); | 255 DISALLOW_COPY_AND_ASSIGN(Computation); |
| 264 }; | 256 }; |
| 265 | 257 |
| 266 | 258 |
| 267 // An embedded container with N elements of type T. Used (with partial | 259 // An embedded container with N elements of type T. Used (with partial |
| 268 // specialization for N=0) because embedded arrays cannot have size 0. | 260 // specialization for N=0) because embedded arrays cannot have size 0. |
| 269 template<typename T, intptr_t N> | 261 template<typename T, intptr_t N> |
| 270 class EmbeddedArray { | 262 class EmbeddedArray { |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 596 | 588 |
| 597 | 589 |
| 598 class InstanceCallComp : public TemplateComputation<0> { | 590 class InstanceCallComp : public TemplateComputation<0> { |
| 599 public: | 591 public: |
| 600 InstanceCallComp(intptr_t token_pos, | 592 InstanceCallComp(intptr_t token_pos, |
| 601 const String& function_name, | 593 const String& function_name, |
| 602 Token::Kind token_kind, | 594 Token::Kind token_kind, |
| 603 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 595 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 604 const Array& argument_names, | 596 const Array& argument_names, |
| 605 intptr_t checked_argument_count) | 597 intptr_t checked_argument_count) |
| 606 : token_pos_(token_pos), | 598 : ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())), |
| 599 token_pos_(token_pos), | |
| 607 function_name_(function_name), | 600 function_name_(function_name), |
| 608 token_kind_(token_kind), | 601 token_kind_(token_kind), |
| 609 arguments_(arguments), | 602 arguments_(arguments), |
| 610 argument_names_(argument_names), | 603 argument_names_(argument_names), |
| 611 checked_argument_count_(checked_argument_count) { | 604 checked_argument_count_(checked_argument_count) { |
| 612 ASSERT(function_name.IsZoneHandle()); | 605 ASSERT(function_name.IsZoneHandle()); |
| 613 ASSERT(!arguments->is_empty()); | 606 ASSERT(!arguments->is_empty()); |
| 614 ASSERT(argument_names.IsZoneHandle()); | 607 ASSERT(argument_names.IsZoneHandle()); |
| 615 ASSERT(Token::IsBinaryToken(token_kind) || | 608 ASSERT(Token::IsBinaryToken(token_kind) || |
| 616 Token::IsUnaryToken(token_kind) || | 609 Token::IsUnaryToken(token_kind) || |
| 617 Token::IsIndexOperator(token_kind) || | 610 Token::IsIndexOperator(token_kind) || |
| 618 token_kind == Token::kGET || | 611 token_kind == Token::kGET || |
| 619 token_kind == Token::kSET || | 612 token_kind == Token::kSET || |
| 620 token_kind == Token::kILLEGAL); | 613 token_kind == Token::kILLEGAL); |
| 621 } | 614 } |
| 622 | 615 |
| 623 DECLARE_CALL_COMPUTATION(InstanceCall) | 616 DECLARE_CALL_COMPUTATION(InstanceCall) |
| 624 | 617 |
| 618 const ICData* ic_data() const { return ic_data_; } | |
| 619 void set_ic_data(const ICData* value) { ic_data_ = value; } | |
|
srdjan
2012/08/30 18:53:21
Is set_ic_data needed at all? (here and in places
Florian Schneider
2012/09/03 10:33:29
Done.
| |
| 620 bool HasICData() const { | |
| 621 return (ic_data() != NULL) && !ic_data()->IsNull(); | |
| 622 } | |
| 623 | |
| 625 intptr_t token_pos() const { return token_pos_; } | 624 intptr_t token_pos() const { return token_pos_; } |
| 626 const String& function_name() const { return function_name_; } | 625 const String& function_name() const { return function_name_; } |
| 627 Token::Kind token_kind() const { return token_kind_; } | 626 Token::Kind token_kind() const { return token_kind_; } |
| 628 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 627 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 629 PushArgumentInstr* ArgumentAt(intptr_t index) const { | 628 PushArgumentInstr* ArgumentAt(intptr_t index) const { |
| 630 return (*arguments_)[index]; | 629 return (*arguments_)[index]; |
| 631 } | 630 } |
| 632 const Array& argument_names() const { return argument_names_; } | 631 const Array& argument_names() const { return argument_names_; } |
| 633 intptr_t checked_argument_count() const { return checked_argument_count_; } | 632 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 634 | 633 |
| 635 virtual void PrintOperandsTo(BufferFormatter* f) const; | 634 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 636 | 635 |
| 637 virtual bool CanDeoptimize() const { return true; } | 636 virtual bool CanDeoptimize() const { return true; } |
| 638 virtual intptr_t ResultCid() const { return kDynamicCid; } | 637 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 639 | 638 |
| 640 private: | 639 private: |
| 640 const ICData* ic_data_; | |
| 641 const intptr_t token_pos_; | 641 const intptr_t token_pos_; |
| 642 const String& function_name_; | 642 const String& function_name_; |
| 643 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 643 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
| 644 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 644 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| 645 const Array& argument_names_; | 645 const Array& argument_names_; |
| 646 const intptr_t checked_argument_count_; | 646 const intptr_t checked_argument_count_; |
| 647 | 647 |
| 648 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 648 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 649 }; | 649 }; |
| 650 | 650 |
| 651 | 651 |
| 652 class PolymorphicInstanceCallComp : public TemplateComputation<0> { | 652 class PolymorphicInstanceCallComp : public TemplateComputation<0> { |
| 653 public: | 653 public: |
| 654 explicit PolymorphicInstanceCallComp(InstanceCallComp* comp, bool with_checks) | 654 explicit PolymorphicInstanceCallComp(InstanceCallComp* comp, |
|
srdjan
2012/08/30 18:53:21
Remove explicit
Florian Schneider
2012/09/03 10:33:29
Done.
| |
| 655 : instance_call_(comp), with_checks_(with_checks) { | 655 const ICData& ic_data, |
| 656 bool with_checks) | |
| 657 : instance_call_(comp), ic_data_(ic_data), with_checks_(with_checks) { | |
| 656 ASSERT(instance_call_ != NULL); | 658 ASSERT(instance_call_ != NULL); |
| 657 } | 659 } |
| 658 | 660 |
| 659 InstanceCallComp* instance_call() const { return instance_call_; } | 661 InstanceCallComp* instance_call() const { return instance_call_; } |
| 660 bool with_checks() const { return with_checks_; } | 662 bool with_checks() const { return with_checks_; } |
| 661 | 663 |
| 662 void PrintTo(BufferFormatter* f) const; | 664 void PrintTo(BufferFormatter* f) const; |
| 663 | 665 |
| 664 virtual intptr_t ArgumentCount() const { | 666 virtual intptr_t ArgumentCount() const { |
| 665 return instance_call()->ArgumentCount(); | 667 return instance_call()->ArgumentCount(); |
| 666 } | 668 } |
| 667 | 669 |
| 668 DECLARE_CALL_COMPUTATION(PolymorphicInstanceCall) | 670 DECLARE_CALL_COMPUTATION(PolymorphicInstanceCall) |
| 669 | 671 |
| 672 const ICData& ic_data() const { return ic_data_; } | |
| 673 | |
| 670 virtual bool CanDeoptimize() const { return true; } | 674 virtual bool CanDeoptimize() const { return true; } |
| 671 virtual intptr_t ResultCid() const { return kDynamicCid; } | 675 virtual intptr_t ResultCid() const { return kDynamicCid; } |
| 672 | 676 |
| 673 private: | 677 private: |
| 674 InstanceCallComp* instance_call_; | 678 InstanceCallComp* instance_call_; |
| 679 const ICData& ic_data_; | |
| 675 const bool with_checks_; | 680 const bool with_checks_; |
| 676 | 681 |
| 677 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp); | 682 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp); |
| 678 }; | 683 }; |
| 679 | 684 |
| 680 | 685 |
| 681 class ComparisonComp : public TemplateComputation<2> { | 686 class ComparisonComp : public TemplateComputation<2> { |
| 682 public: | 687 public: |
| 683 ComparisonComp(Token::Kind kind, Value* left, Value* right) : kind_(kind) { | 688 ComparisonComp(Token::Kind kind, Value* left, Value* right) : kind_(kind) { |
| 684 ASSERT(left != NULL); | 689 ASSERT(left != NULL); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 }; | 729 }; |
| 725 | 730 |
| 726 | 731 |
| 727 class EqualityCompareComp : public ComparisonComp { | 732 class EqualityCompareComp : public ComparisonComp { |
| 728 public: | 733 public: |
| 729 EqualityCompareComp(intptr_t token_pos, | 734 EqualityCompareComp(intptr_t token_pos, |
| 730 Token::Kind kind, | 735 Token::Kind kind, |
| 731 Value* left, | 736 Value* left, |
| 732 Value* right) | 737 Value* right) |
| 733 : ComparisonComp(kind, left, right), | 738 : ComparisonComp(kind, left, right), |
| 739 ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())), | |
| 734 token_pos_(token_pos), | 740 token_pos_(token_pos), |
| 735 receiver_class_id_(kIllegalCid) { | 741 receiver_class_id_(kIllegalCid) { |
| 736 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); | 742 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); |
| 737 } | 743 } |
| 738 | 744 |
| 739 DECLARE_COMPUTATION(EqualityCompare) | 745 DECLARE_COMPUTATION(EqualityCompare) |
| 740 | 746 |
| 747 const ICData* ic_data() const { return ic_data_; } | |
| 748 void set_ic_data(const ICData* value) { ic_data_ = value; } | |
| 749 bool HasICData() const { | |
| 750 return (ic_data() != NULL) && !ic_data()->IsNull(); | |
| 751 } | |
| 752 | |
| 741 intptr_t token_pos() const { return token_pos_; } | 753 intptr_t token_pos() const { return token_pos_; } |
| 742 | 754 |
| 743 // Receiver class id is computed from collected ICData. | 755 // Receiver class id is computed from collected ICData. |
| 744 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } | 756 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } |
| 745 intptr_t receiver_class_id() const { return receiver_class_id_; } | 757 intptr_t receiver_class_id() const { return receiver_class_id_; } |
| 746 | 758 |
| 747 virtual void PrintOperandsTo(BufferFormatter* f) const; | 759 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 748 | 760 |
| 749 virtual bool CanDeoptimize() const { return true; } | 761 virtual bool CanDeoptimize() const { return true; } |
| 750 virtual intptr_t ResultCid() const; | 762 virtual intptr_t ResultCid() const; |
| 751 | 763 |
| 752 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 764 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 753 BranchInstr* branch); | 765 BranchInstr* branch); |
| 754 | 766 |
| 755 private: | 767 private: |
| 768 const ICData* ic_data_; | |
| 756 const intptr_t token_pos_; | 769 const intptr_t token_pos_; |
| 757 intptr_t receiver_class_id_; // Set by optimizer. | 770 intptr_t receiver_class_id_; // Set by optimizer. |
| 758 | 771 |
| 759 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); | 772 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); |
| 760 }; | 773 }; |
| 761 | 774 |
| 762 | 775 |
| 763 class RelationalOpComp : public ComparisonComp { | 776 class RelationalOpComp : public ComparisonComp { |
| 764 public: | 777 public: |
| 765 RelationalOpComp(intptr_t token_pos, | 778 RelationalOpComp(intptr_t token_pos, |
| 766 Token::Kind kind, | 779 Token::Kind kind, |
| 767 Value* left, | 780 Value* left, |
| 768 Value* right) | 781 Value* right) |
| 769 : ComparisonComp(kind, left, right), | 782 : ComparisonComp(kind, left, right), |
| 783 ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())), | |
| 770 token_pos_(token_pos), | 784 token_pos_(token_pos), |
| 771 operands_class_id_(kIllegalCid) { | 785 operands_class_id_(kIllegalCid) { |
| 772 ASSERT(Token::IsRelationalOperator(kind)); | 786 ASSERT(Token::IsRelationalOperator(kind)); |
| 773 } | 787 } |
| 774 | 788 |
| 775 DECLARE_COMPUTATION(RelationalOp) | 789 DECLARE_COMPUTATION(RelationalOp) |
| 776 | 790 |
| 791 const ICData* ic_data() const { return ic_data_; } | |
| 792 void set_ic_data(const ICData* value) { ic_data_ = value; } | |
| 793 bool HasICData() const { | |
| 794 return (ic_data() != NULL) && !ic_data()->IsNull(); | |
| 795 } | |
| 796 | |
| 777 intptr_t token_pos() const { return token_pos_; } | 797 intptr_t token_pos() const { return token_pos_; } |
| 778 | 798 |
| 779 // TODO(srdjan): instead of class-id pass an enum that can differentiate | 799 // TODO(srdjan): instead of class-id pass an enum that can differentiate |
| 780 // between boxed and unboxed doubles and integers. | 800 // between boxed and unboxed doubles and integers. |
| 781 void set_operands_class_id(intptr_t value) { | 801 void set_operands_class_id(intptr_t value) { |
| 782 operands_class_id_ = value; | 802 operands_class_id_ = value; |
| 783 } | 803 } |
| 784 | 804 |
| 785 intptr_t operands_class_id() const { return operands_class_id_; } | 805 intptr_t operands_class_id() const { return operands_class_id_; } |
| 786 | 806 |
| 787 virtual void PrintOperandsTo(BufferFormatter* f) const; | 807 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 788 | 808 |
| 789 virtual bool CanDeoptimize() const { return true; } | 809 virtual bool CanDeoptimize() const { return true; } |
| 790 virtual intptr_t ResultCid() const; | 810 virtual intptr_t ResultCid() const; |
| 791 | 811 |
| 792 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 812 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 793 BranchInstr* branch); | 813 BranchInstr* branch); |
| 794 | 814 |
| 795 private: | 815 private: |
| 816 const ICData* ic_data_; | |
| 796 const intptr_t token_pos_; | 817 const intptr_t token_pos_; |
| 797 intptr_t operands_class_id_; // class id of both operands. | 818 intptr_t operands_class_id_; // class id of both operands. |
| 798 | 819 |
| 799 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); | 820 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); |
| 800 }; | 821 }; |
| 801 | 822 |
| 802 | 823 |
| 803 class StaticCallComp : public TemplateComputation<0> { | 824 class StaticCallComp : public TemplateComputation<0> { |
| 804 public: | 825 public: |
| 805 StaticCallComp(intptr_t token_pos, | 826 StaticCallComp(intptr_t token_pos, |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1699 inputs_[1] = right; | 1720 inputs_[1] = right; |
| 1700 } | 1721 } |
| 1701 | 1722 |
| 1702 Value* left() const { return inputs_[0]; } | 1723 Value* left() const { return inputs_[0]; } |
| 1703 Value* right() const { return inputs_[1]; } | 1724 Value* right() const { return inputs_[1]; } |
| 1704 | 1725 |
| 1705 Token::Kind op_kind() const { return op_kind_; } | 1726 Token::Kind op_kind() const { return op_kind_; } |
| 1706 | 1727 |
| 1707 InstanceCallComp* instance_call() const { return instance_call_; } | 1728 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1708 | 1729 |
| 1730 const ICData* ic_data() const { return instance_call()->ic_data(); } | |
| 1731 | |
| 1709 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1732 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1710 | 1733 |
| 1711 DECLARE_COMPUTATION(BinarySmiOp) | 1734 DECLARE_COMPUTATION(BinarySmiOp) |
| 1712 | 1735 |
| 1713 virtual bool CanDeoptimize() const; | 1736 virtual bool CanDeoptimize() const; |
| 1714 | 1737 |
| 1715 virtual intptr_t ResultCid() const; | 1738 virtual intptr_t ResultCid() const; |
| 1716 | 1739 |
| 1717 private: | 1740 private: |
| 1718 const Token::Kind op_kind_; | 1741 const Token::Kind op_kind_; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1736 inputs_[1] = right; | 1759 inputs_[1] = right; |
| 1737 } | 1760 } |
| 1738 | 1761 |
| 1739 Value* left() const { return inputs_[0]; } | 1762 Value* left() const { return inputs_[0]; } |
| 1740 Value* right() const { return inputs_[1]; } | 1763 Value* right() const { return inputs_[1]; } |
| 1741 | 1764 |
| 1742 Token::Kind op_kind() const { return op_kind_; } | 1765 Token::Kind op_kind() const { return op_kind_; } |
| 1743 | 1766 |
| 1744 InstanceCallComp* instance_call() const { return instance_call_; } | 1767 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1745 | 1768 |
| 1769 const ICData* ic_data() const { return instance_call()->ic_data(); } | |
| 1770 | |
| 1746 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1771 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1747 | 1772 |
| 1748 DECLARE_COMPUTATION(BinaryMintOp) | 1773 DECLARE_COMPUTATION(BinaryMintOp) |
| 1749 | 1774 |
| 1750 virtual bool CanDeoptimize() const { return true; } | 1775 virtual bool CanDeoptimize() const { return true; } |
| 1751 virtual intptr_t ResultCid() const; | 1776 virtual intptr_t ResultCid() const; |
| 1752 | 1777 |
| 1753 private: | 1778 private: |
| 1754 const Token::Kind op_kind_; | 1779 const Token::Kind op_kind_; |
| 1755 InstanceCallComp* instance_call_; | 1780 InstanceCallComp* instance_call_; |
| 1756 | 1781 |
| 1757 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpComp); | 1782 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpComp); |
| 1758 }; | 1783 }; |
| 1759 | 1784 |
| 1760 | 1785 |
| 1761 class BinaryDoubleOpComp : public TemplateComputation<0> { | 1786 class BinaryDoubleOpComp : public TemplateComputation<0> { |
| 1762 public: | 1787 public: |
| 1763 BinaryDoubleOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) | 1788 BinaryDoubleOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) |
| 1764 : op_kind_(op_kind), instance_call_(instance_call) { } | 1789 : op_kind_(op_kind), instance_call_(instance_call) { } |
| 1765 | 1790 |
| 1766 Token::Kind op_kind() const { return op_kind_; } | 1791 Token::Kind op_kind() const { return op_kind_; } |
| 1767 | 1792 |
| 1768 InstanceCallComp* instance_call() const { return instance_call_; } | 1793 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1769 | 1794 |
| 1795 const ICData* ic_data() const { return instance_call()->ic_data(); } | |
| 1796 | |
| 1770 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1797 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1771 | 1798 |
| 1772 DECLARE_CALL_COMPUTATION(BinaryDoubleOp) | 1799 DECLARE_CALL_COMPUTATION(BinaryDoubleOp) |
| 1773 | 1800 |
| 1774 virtual intptr_t ArgumentCount() const { return 2; } | 1801 virtual intptr_t ArgumentCount() const { return 2; } |
| 1775 | 1802 |
| 1776 virtual bool CanDeoptimize() const { return true; } | 1803 virtual bool CanDeoptimize() const { return true; } |
| 1777 virtual intptr_t ResultCid() const; | 1804 virtual intptr_t ResultCid() const; |
| 1778 | 1805 |
| 1779 private: | 1806 private: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1822 NumberNegateComp(InstanceCallComp* instance_call, | 1849 NumberNegateComp(InstanceCallComp* instance_call, |
| 1823 Value* value) : instance_call_(instance_call) { | 1850 Value* value) : instance_call_(instance_call) { |
| 1824 ASSERT(value != NULL); | 1851 ASSERT(value != NULL); |
| 1825 inputs_[0] = value; | 1852 inputs_[0] = value; |
| 1826 } | 1853 } |
| 1827 | 1854 |
| 1828 Value* value() const { return inputs_[0]; } | 1855 Value* value() const { return inputs_[0]; } |
| 1829 | 1856 |
| 1830 InstanceCallComp* instance_call() const { return instance_call_; } | 1857 InstanceCallComp* instance_call() const { return instance_call_; } |
| 1831 | 1858 |
| 1859 const ICData* ic_data() const { return instance_call()->ic_data(); } | |
| 1860 | |
| 1832 DECLARE_COMPUTATION(NumberNegate) | 1861 DECLARE_COMPUTATION(NumberNegate) |
| 1833 | 1862 |
| 1834 virtual bool CanDeoptimize() const { return true; } | 1863 virtual bool CanDeoptimize() const { return true; } |
| 1835 virtual intptr_t ResultCid() const { return kDoubleCid; } | 1864 virtual intptr_t ResultCid() const { return kDoubleCid; } |
| 1836 | 1865 |
| 1837 private: | 1866 private: |
| 1838 InstanceCallComp* instance_call_; | 1867 InstanceCallComp* instance_call_; |
| 1839 | 1868 |
| 1840 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); | 1869 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); |
| 1841 }; | 1870 }; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1900 | 1929 |
| 1901 private: | 1930 private: |
| 1902 InstanceCallComp* instance_call_; | 1931 InstanceCallComp* instance_call_; |
| 1903 | 1932 |
| 1904 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleComp); | 1933 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleComp); |
| 1905 }; | 1934 }; |
| 1906 | 1935 |
| 1907 | 1936 |
| 1908 class CheckClassComp : public TemplateComputation<1> { | 1937 class CheckClassComp : public TemplateComputation<1> { |
| 1909 public: | 1938 public: |
| 1910 CheckClassComp(Value* value, InstanceCallComp* original) | 1939 CheckClassComp(Value* value, |
| 1911 : original_(original) { | 1940 InstanceCallComp* instance_call, |
| 1941 const ICData& unary_checks) | |
| 1942 : instance_call_(instance_call), | |
| 1943 unary_checks_(unary_checks) { | |
| 1912 ASSERT(value != NULL); | 1944 ASSERT(value != NULL); |
| 1913 inputs_[0] = value; | 1945 inputs_[0] = value; |
| 1914 } | 1946 } |
| 1915 | 1947 |
| 1916 DECLARE_COMPUTATION(CheckClass) | 1948 DECLARE_COMPUTATION(CheckClass) |
| 1917 | 1949 |
| 1918 virtual bool CanDeoptimize() const { return true; } | 1950 virtual bool CanDeoptimize() const { return true; } |
| 1919 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1951 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1920 | 1952 |
| 1921 virtual bool AttributesEqual(Computation* other) const; | 1953 virtual bool AttributesEqual(Computation* other) const; |
| 1922 | 1954 |
| 1923 virtual bool HasSideEffect() const { return false; } | 1955 virtual bool HasSideEffect() const { return false; } |
| 1924 | 1956 |
| 1925 Value* value() const { return inputs_[0]; } | 1957 Value* value() const { return inputs_[0]; } |
| 1926 | 1958 |
| 1927 intptr_t deopt_id() const { return original_->deopt_id(); } | 1959 const ICData& unary_checks() const { return unary_checks_; } |
| 1960 | |
| 1961 intptr_t deopt_id() const { return instance_call_->deopt_id(); } | |
| 1928 | 1962 |
| 1929 virtual Definition* TryReplace(BindInstr* instr) const; | 1963 virtual Definition* TryReplace(BindInstr* instr) const; |
| 1930 | 1964 |
| 1931 virtual void PrintOperandsTo(BufferFormatter* f) const; | 1965 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 1932 | 1966 |
| 1933 private: | 1967 private: |
| 1934 InstanceCallComp* original_; | 1968 InstanceCallComp* instance_call_; |
| 1969 const ICData& unary_checks_; | |
| 1935 | 1970 |
| 1936 DISALLOW_COPY_AND_ASSIGN(CheckClassComp); | 1971 DISALLOW_COPY_AND_ASSIGN(CheckClassComp); |
| 1937 }; | 1972 }; |
| 1938 | 1973 |
| 1939 | 1974 |
| 1940 class CheckSmiComp : public TemplateComputation<1> { | 1975 class CheckSmiComp : public TemplateComputation<1> { |
| 1941 public: | 1976 public: |
| 1942 CheckSmiComp(Value* value, InstanceCallComp* original) | 1977 CheckSmiComp(Value* value, InstanceCallComp* instance_call) |
| 1943 : original_(original) { | 1978 : instance_call_(instance_call) { |
| 1944 ASSERT(value != NULL); | 1979 ASSERT(value != NULL); |
| 1945 inputs_[0] = value; | 1980 inputs_[0] = value; |
| 1946 } | 1981 } |
| 1947 | 1982 |
| 1948 DECLARE_COMPUTATION(CheckSmi) | 1983 DECLARE_COMPUTATION(CheckSmi) |
| 1949 | 1984 |
| 1950 virtual bool CanDeoptimize() const { return true; } | 1985 virtual bool CanDeoptimize() const { return true; } |
| 1951 virtual intptr_t ResultCid() const { return kIllegalCid; } | 1986 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1952 | 1987 |
| 1953 virtual bool AttributesEqual(Computation* other) const { return true; } | 1988 virtual bool AttributesEqual(Computation* other) const { return true; } |
| 1954 | 1989 |
| 1955 virtual bool HasSideEffect() const { return false; } | 1990 virtual bool HasSideEffect() const { return false; } |
| 1956 | 1991 |
| 1957 virtual Definition* TryReplace(BindInstr* instr) const; | 1992 virtual Definition* TryReplace(BindInstr* instr) const; |
| 1958 | 1993 |
| 1959 Value* value() const { return inputs_[0]; } | 1994 Value* value() const { return inputs_[0]; } |
| 1960 | 1995 |
| 1961 intptr_t deopt_id() const { return original_->deopt_id(); } | 1996 intptr_t deopt_id() const { return instance_call_->deopt_id(); } |
| 1962 | 1997 |
| 1963 private: | 1998 private: |
| 1964 InstanceCallComp* original_; | 1999 InstanceCallComp* instance_call_; |
| 1965 | 2000 |
| 1966 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp); | 2001 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp); |
| 1967 }; | 2002 }; |
| 1968 | 2003 |
| 1969 | 2004 |
| 1970 class CheckArrayBoundComp : public TemplateComputation<2> { | 2005 class CheckArrayBoundComp : public TemplateComputation<2> { |
| 1971 public: | 2006 public: |
| 1972 CheckArrayBoundComp(Value* array, | 2007 CheckArrayBoundComp(Value* array, |
| 1973 Value* index, | 2008 Value* index, |
| 1974 intptr_t array_type, | 2009 intptr_t array_type, |
| 1975 InstanceCallComp* original) | 2010 InstanceCallComp* instance_call) |
| 1976 : array_type_(array_type), original_(original) { | 2011 : array_type_(array_type), instance_call_(instance_call) { |
| 1977 ASSERT(array != NULL); | 2012 ASSERT(array != NULL); |
| 1978 ASSERT(index != NULL); | 2013 ASSERT(index != NULL); |
| 1979 inputs_[0] = array; | 2014 inputs_[0] = array; |
| 1980 inputs_[1] = index; | 2015 inputs_[1] = index; |
| 1981 } | 2016 } |
| 1982 | 2017 |
| 1983 DECLARE_COMPUTATION(CheckArrayBound) | 2018 DECLARE_COMPUTATION(CheckArrayBound) |
| 1984 | 2019 |
| 1985 virtual bool CanDeoptimize() const { return true; } | 2020 virtual bool CanDeoptimize() const { return true; } |
| 1986 virtual intptr_t ResultCid() const { return kIllegalCid; } | 2021 virtual intptr_t ResultCid() const { return kIllegalCid; } |
| 1987 | 2022 |
| 1988 virtual bool AttributesEqual(Computation* other) const; | 2023 virtual bool AttributesEqual(Computation* other) const; |
| 1989 | 2024 |
| 1990 virtual bool HasSideEffect() const { return false; } | 2025 virtual bool HasSideEffect() const { return false; } |
| 1991 | 2026 |
| 1992 Value* array() const { return inputs_[0]; } | 2027 Value* array() const { return inputs_[0]; } |
| 1993 Value* index() const { return inputs_[1]; } | 2028 Value* index() const { return inputs_[1]; } |
| 1994 | 2029 |
| 1995 intptr_t array_type() const { return array_type_; } | 2030 intptr_t array_type() const { return array_type_; } |
| 1996 | 2031 |
| 1997 intptr_t deopt_id() const { return original_->deopt_id(); } | 2032 intptr_t deopt_id() const { return instance_call_->deopt_id(); } |
| 1998 | 2033 |
| 1999 private: | 2034 private: |
| 2000 intptr_t array_type_; | 2035 intptr_t array_type_; |
| 2001 InstanceCallComp* original_; | 2036 InstanceCallComp* instance_call_; |
| 2002 | 2037 |
| 2003 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp); | 2038 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp); |
| 2004 }; | 2039 }; |
| 2005 | 2040 |
| 2006 | 2041 |
| 2007 #undef DECLARE_COMPUTATION | 2042 #undef DECLARE_COMPUTATION |
| 2008 | 2043 |
| 2009 | 2044 |
| 2010 // Implementation of type testers and cast functins. | 2045 // Implementation of type testers and cast functins. |
| 2011 #define DEFINE_COMPUTATION_PREDICATE(ShortName, ClassName) \ | 2046 #define DEFINE_COMPUTATION_PREDICATE(ShortName, ClassName) \ |
| (...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3182 ForwardInstructionIterator* current_iterator_; | 3217 ForwardInstructionIterator* current_iterator_; |
| 3183 | 3218 |
| 3184 private: | 3219 private: |
| 3185 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 3220 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 3186 }; | 3221 }; |
| 3187 | 3222 |
| 3188 | 3223 |
| 3189 } // namespace dart | 3224 } // namespace dart |
| 3190 | 3225 |
| 3191 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 3226 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |