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

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 10910003: Only store IC data with instructions that collect type feedback. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (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
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()
133 Isolate* isolate = Isolate::Current(); 133 : deopt_id_(Isolate::Current()->GetNextDeoptId()), locs_(NULL) { }
134 deopt_id_ = isolate->GetNextDeoptId();
135 ic_data_ = isolate->GetICDataForDeoptId(deopt_id_);
136 }
137 134
138 // Unique id used for deoptimization. 135 // Unique id used for deoptimization.
139 intptr_t deopt_id() const { 136 intptr_t deopt_id() const {
140 ASSERT(CanDeoptimize()); 137 ASSERT(CanDeoptimize());
141 return deopt_id_; 138 return deopt_id_;
142 } 139 }
143 140
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. 141 // Visiting support.
151 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0; 142 virtual void Accept(FlowGraphVisitor* visitor, BindInstr* instr) = 0;
152 143
153 virtual intptr_t InputCount() const = 0; 144 virtual intptr_t InputCount() const = 0;
154 virtual Value* InputAt(intptr_t i) const = 0; 145 virtual Value* InputAt(intptr_t i) const = 0;
155 virtual void SetInputAt(intptr_t i, Value* value) = 0; 146 virtual void SetInputAt(intptr_t i, Value* value) = 0;
156 147
157 // Call computations override this function and return the 148 // Call computations override this function and return the
158 // number of pushed arguments. 149 // number of pushed arguments.
159 virtual intptr_t ArgumentCount() const = 0; 150 virtual intptr_t ArgumentCount() const = 0;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 inline bool Is##ShortName() const; \ 241 inline bool Is##ShortName() const; \
251 inline const ClassName* As##ShortName() const; \ 242 inline const ClassName* As##ShortName() const; \
252 inline ClassName* As##ShortName(); 243 inline ClassName* As##ShortName();
253 FOR_EACH_COMPUTATION(DECLARE_PREDICATE) 244 FOR_EACH_COMPUTATION(DECLARE_PREDICATE)
254 #undef DECLARE_PREDICATE 245 #undef DECLARE_PREDICATE
255 246
256 private: 247 private:
257 friend class BranchInstr; 248 friend class BranchInstr;
258 249
259 intptr_t deopt_id_; 250 intptr_t deopt_id_;
260 const ICData* ic_data_;
261 LocationSummary* locs_; 251 LocationSummary* locs_;
262 252
263 DISALLOW_COPY_AND_ASSIGN(Computation); 253 DISALLOW_COPY_AND_ASSIGN(Computation);
264 }; 254 };
265 255
266 256
267 // An embedded container with N elements of type T. Used (with partial 257 // An embedded container with N elements of type T. Used (with partial
268 // specialization for N=0) because embedded arrays cannot have size 0. 258 // specialization for N=0) because embedded arrays cannot have size 0.
269 template<typename T, intptr_t N> 259 template<typename T, intptr_t N>
270 class EmbeddedArray { 260 class EmbeddedArray {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 586
597 587
598 class InstanceCallComp : public TemplateComputation<0> { 588 class InstanceCallComp : public TemplateComputation<0> {
599 public: 589 public:
600 InstanceCallComp(intptr_t token_pos, 590 InstanceCallComp(intptr_t token_pos,
601 const String& function_name, 591 const String& function_name,
602 Token::Kind token_kind, 592 Token::Kind token_kind,
603 ZoneGrowableArray<PushArgumentInstr*>* arguments, 593 ZoneGrowableArray<PushArgumentInstr*>* arguments,
604 const Array& argument_names, 594 const Array& argument_names,
605 intptr_t checked_argument_count) 595 intptr_t checked_argument_count)
606 : token_pos_(token_pos), 596 : ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())),
597 token_pos_(token_pos),
607 function_name_(function_name), 598 function_name_(function_name),
608 token_kind_(token_kind), 599 token_kind_(token_kind),
609 arguments_(arguments), 600 arguments_(arguments),
610 argument_names_(argument_names), 601 argument_names_(argument_names),
611 checked_argument_count_(checked_argument_count) { 602 checked_argument_count_(checked_argument_count) {
612 ASSERT(function_name.IsZoneHandle()); 603 ASSERT(function_name.IsZoneHandle());
613 ASSERT(!arguments->is_empty()); 604 ASSERT(!arguments->is_empty());
614 ASSERT(argument_names.IsZoneHandle()); 605 ASSERT(argument_names.IsZoneHandle());
615 ASSERT(Token::IsBinaryToken(token_kind) || 606 ASSERT(Token::IsBinaryToken(token_kind) ||
616 Token::IsUnaryToken(token_kind) || 607 Token::IsUnaryToken(token_kind) ||
617 Token::IsIndexOperator(token_kind) || 608 Token::IsIndexOperator(token_kind) ||
618 token_kind == Token::kGET || 609 token_kind == Token::kGET ||
619 token_kind == Token::kSET || 610 token_kind == Token::kSET ||
620 token_kind == Token::kILLEGAL); 611 token_kind == Token::kILLEGAL);
621 } 612 }
622 613
623 DECLARE_CALL_COMPUTATION(InstanceCall) 614 DECLARE_CALL_COMPUTATION(InstanceCall)
624 615
616 const ICData* ic_data() const { return ic_data_; }
617 bool HasICData() const {
618 return (ic_data() != NULL) && !ic_data()->IsNull();
619 }
620
625 intptr_t token_pos() const { return token_pos_; } 621 intptr_t token_pos() const { return token_pos_; }
626 const String& function_name() const { return function_name_; } 622 const String& function_name() const { return function_name_; }
627 Token::Kind token_kind() const { return token_kind_; } 623 Token::Kind token_kind() const { return token_kind_; }
628 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 624 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
629 PushArgumentInstr* ArgumentAt(intptr_t index) const { 625 PushArgumentInstr* ArgumentAt(intptr_t index) const {
630 return (*arguments_)[index]; 626 return (*arguments_)[index];
631 } 627 }
632 const Array& argument_names() const { return argument_names_; } 628 const Array& argument_names() const { return argument_names_; }
633 intptr_t checked_argument_count() const { return checked_argument_count_; } 629 intptr_t checked_argument_count() const { return checked_argument_count_; }
634 630
635 virtual void PrintOperandsTo(BufferFormatter* f) const; 631 virtual void PrintOperandsTo(BufferFormatter* f) const;
636 632
637 virtual bool CanDeoptimize() const { return true; } 633 virtual bool CanDeoptimize() const { return true; }
638 virtual intptr_t ResultCid() const { return kDynamicCid; } 634 virtual intptr_t ResultCid() const { return kDynamicCid; }
639 635
640 private: 636 private:
637 const ICData* ic_data_;
641 const intptr_t token_pos_; 638 const intptr_t token_pos_;
642 const String& function_name_; 639 const String& function_name_;
643 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. 640 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL.
644 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 641 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
645 const Array& argument_names_; 642 const Array& argument_names_;
646 const intptr_t checked_argument_count_; 643 const intptr_t checked_argument_count_;
647 644
648 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); 645 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp);
649 }; 646 };
650 647
651 648
652 class PolymorphicInstanceCallComp : public TemplateComputation<0> { 649 class PolymorphicInstanceCallComp : public TemplateComputation<0> {
653 public: 650 public:
654 explicit PolymorphicInstanceCallComp(InstanceCallComp* comp, bool with_checks) 651 PolymorphicInstanceCallComp(InstanceCallComp* comp,
655 : instance_call_(comp), with_checks_(with_checks) { 652 const ICData& ic_data,
653 bool with_checks)
654 : instance_call_(comp), ic_data_(ic_data), with_checks_(with_checks) {
656 ASSERT(instance_call_ != NULL); 655 ASSERT(instance_call_ != NULL);
657 } 656 }
658 657
659 InstanceCallComp* instance_call() const { return instance_call_; } 658 InstanceCallComp* instance_call() const { return instance_call_; }
660 bool with_checks() const { return with_checks_; } 659 bool with_checks() const { return with_checks_; }
661 660
662 void PrintTo(BufferFormatter* f) const; 661 void PrintTo(BufferFormatter* f) const;
663 662
664 virtual intptr_t ArgumentCount() const { 663 virtual intptr_t ArgumentCount() const {
665 return instance_call()->ArgumentCount(); 664 return instance_call()->ArgumentCount();
666 } 665 }
667 666
668 DECLARE_CALL_COMPUTATION(PolymorphicInstanceCall) 667 DECLARE_CALL_COMPUTATION(PolymorphicInstanceCall)
669 668
669 const ICData& ic_data() const { return ic_data_; }
670
670 virtual bool CanDeoptimize() const { return true; } 671 virtual bool CanDeoptimize() const { return true; }
671 virtual intptr_t ResultCid() const { return kDynamicCid; } 672 virtual intptr_t ResultCid() const { return kDynamicCid; }
672 673
673 private: 674 private:
674 InstanceCallComp* instance_call_; 675 InstanceCallComp* instance_call_;
676 const ICData& ic_data_;
675 const bool with_checks_; 677 const bool with_checks_;
676 678
677 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp); 679 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallComp);
678 }; 680 };
679 681
680 682
681 class ComparisonComp : public TemplateComputation<2> { 683 class ComparisonComp : public TemplateComputation<2> {
682 public: 684 public:
683 ComparisonComp(Token::Kind kind, Value* left, Value* right) : kind_(kind) { 685 ComparisonComp(Token::Kind kind, Value* left, Value* right) : kind_(kind) {
684 ASSERT(left != NULL); 686 ASSERT(left != NULL);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 }; 726 };
725 727
726 728
727 class EqualityCompareComp : public ComparisonComp { 729 class EqualityCompareComp : public ComparisonComp {
728 public: 730 public:
729 EqualityCompareComp(intptr_t token_pos, 731 EqualityCompareComp(intptr_t token_pos,
730 Token::Kind kind, 732 Token::Kind kind,
731 Value* left, 733 Value* left,
732 Value* right) 734 Value* right)
733 : ComparisonComp(kind, left, right), 735 : ComparisonComp(kind, left, right),
736 ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())),
734 token_pos_(token_pos), 737 token_pos_(token_pos),
735 receiver_class_id_(kIllegalCid) { 738 receiver_class_id_(kIllegalCid) {
736 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); 739 ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
737 } 740 }
738 741
739 DECLARE_COMPUTATION(EqualityCompare) 742 DECLARE_COMPUTATION(EqualityCompare)
740 743
744 const ICData* ic_data() const { return ic_data_; }
745 bool HasICData() const {
746 return (ic_data() != NULL) && !ic_data()->IsNull();
747 }
748
741 intptr_t token_pos() const { return token_pos_; } 749 intptr_t token_pos() const { return token_pos_; }
742 750
743 // Receiver class id is computed from collected ICData. 751 // Receiver class id is computed from collected ICData.
744 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } 752 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; }
745 intptr_t receiver_class_id() const { return receiver_class_id_; } 753 intptr_t receiver_class_id() const { return receiver_class_id_; }
746 754
747 virtual void PrintOperandsTo(BufferFormatter* f) const; 755 virtual void PrintOperandsTo(BufferFormatter* f) const;
748 756
749 virtual bool CanDeoptimize() const { return true; } 757 virtual bool CanDeoptimize() const { return true; }
750 virtual intptr_t ResultCid() const; 758 virtual intptr_t ResultCid() const;
751 759
752 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 760 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
753 BranchInstr* branch); 761 BranchInstr* branch);
754 762
755 private: 763 private:
764 const ICData* ic_data_;
756 const intptr_t token_pos_; 765 const intptr_t token_pos_;
757 intptr_t receiver_class_id_; // Set by optimizer. 766 intptr_t receiver_class_id_; // Set by optimizer.
758 767
759 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp); 768 DISALLOW_COPY_AND_ASSIGN(EqualityCompareComp);
760 }; 769 };
761 770
762 771
763 class RelationalOpComp : public ComparisonComp { 772 class RelationalOpComp : public ComparisonComp {
764 public: 773 public:
765 RelationalOpComp(intptr_t token_pos, 774 RelationalOpComp(intptr_t token_pos,
766 Token::Kind kind, 775 Token::Kind kind,
767 Value* left, 776 Value* left,
768 Value* right) 777 Value* right)
769 : ComparisonComp(kind, left, right), 778 : ComparisonComp(kind, left, right),
779 ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())),
770 token_pos_(token_pos), 780 token_pos_(token_pos),
771 operands_class_id_(kIllegalCid) { 781 operands_class_id_(kIllegalCid) {
772 ASSERT(Token::IsRelationalOperator(kind)); 782 ASSERT(Token::IsRelationalOperator(kind));
773 } 783 }
774 784
775 DECLARE_COMPUTATION(RelationalOp) 785 DECLARE_COMPUTATION(RelationalOp)
776 786
787 const ICData* ic_data() const { return ic_data_; }
788 bool HasICData() const {
789 return (ic_data() != NULL) && !ic_data()->IsNull();
790 }
791
777 intptr_t token_pos() const { return token_pos_; } 792 intptr_t token_pos() const { return token_pos_; }
778 793
779 // TODO(srdjan): instead of class-id pass an enum that can differentiate 794 // TODO(srdjan): instead of class-id pass an enum that can differentiate
780 // between boxed and unboxed doubles and integers. 795 // between boxed and unboxed doubles and integers.
781 void set_operands_class_id(intptr_t value) { 796 void set_operands_class_id(intptr_t value) {
782 operands_class_id_ = value; 797 operands_class_id_ = value;
783 } 798 }
784 799
785 intptr_t operands_class_id() const { return operands_class_id_; } 800 intptr_t operands_class_id() const { return operands_class_id_; }
786 801
787 virtual void PrintOperandsTo(BufferFormatter* f) const; 802 virtual void PrintOperandsTo(BufferFormatter* f) const;
788 803
789 virtual bool CanDeoptimize() const { return true; } 804 virtual bool CanDeoptimize() const { return true; }
790 virtual intptr_t ResultCid() const; 805 virtual intptr_t ResultCid() const;
791 806
792 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 807 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
793 BranchInstr* branch); 808 BranchInstr* branch);
794 809
795 private: 810 private:
811 const ICData* ic_data_;
796 const intptr_t token_pos_; 812 const intptr_t token_pos_;
797 intptr_t operands_class_id_; // class id of both operands. 813 intptr_t operands_class_id_; // class id of both operands.
798 814
799 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp); 815 DISALLOW_COPY_AND_ASSIGN(RelationalOpComp);
800 }; 816 };
801 817
802 818
803 class StaticCallComp : public TemplateComputation<0> { 819 class StaticCallComp : public TemplateComputation<0> {
804 public: 820 public:
805 StaticCallComp(intptr_t token_pos, 821 StaticCallComp(intptr_t token_pos,
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 inputs_[1] = right; 1715 inputs_[1] = right;
1700 } 1716 }
1701 1717
1702 Value* left() const { return inputs_[0]; } 1718 Value* left() const { return inputs_[0]; }
1703 Value* right() const { return inputs_[1]; } 1719 Value* right() const { return inputs_[1]; }
1704 1720
1705 Token::Kind op_kind() const { return op_kind_; } 1721 Token::Kind op_kind() const { return op_kind_; }
1706 1722
1707 InstanceCallComp* instance_call() const { return instance_call_; } 1723 InstanceCallComp* instance_call() const { return instance_call_; }
1708 1724
1725 const ICData* ic_data() const { return instance_call()->ic_data(); }
1726
1709 virtual void PrintOperandsTo(BufferFormatter* f) const; 1727 virtual void PrintOperandsTo(BufferFormatter* f) const;
1710 1728
1711 DECLARE_COMPUTATION(BinarySmiOp) 1729 DECLARE_COMPUTATION(BinarySmiOp)
1712 1730
1713 virtual bool CanDeoptimize() const; 1731 virtual bool CanDeoptimize() const;
1714 1732
1715 virtual intptr_t ResultCid() const; 1733 virtual intptr_t ResultCid() const;
1716 1734
1717 private: 1735 private:
1718 const Token::Kind op_kind_; 1736 const Token::Kind op_kind_;
(...skipping 17 matching lines...) Expand all
1736 inputs_[1] = right; 1754 inputs_[1] = right;
1737 } 1755 }
1738 1756
1739 Value* left() const { return inputs_[0]; } 1757 Value* left() const { return inputs_[0]; }
1740 Value* right() const { return inputs_[1]; } 1758 Value* right() const { return inputs_[1]; }
1741 1759
1742 Token::Kind op_kind() const { return op_kind_; } 1760 Token::Kind op_kind() const { return op_kind_; }
1743 1761
1744 InstanceCallComp* instance_call() const { return instance_call_; } 1762 InstanceCallComp* instance_call() const { return instance_call_; }
1745 1763
1764 const ICData* ic_data() const { return instance_call()->ic_data(); }
1765
1746 virtual void PrintOperandsTo(BufferFormatter* f) const; 1766 virtual void PrintOperandsTo(BufferFormatter* f) const;
1747 1767
1748 DECLARE_COMPUTATION(BinaryMintOp) 1768 DECLARE_COMPUTATION(BinaryMintOp)
1749 1769
1750 virtual bool CanDeoptimize() const { return true; } 1770 virtual bool CanDeoptimize() const { return true; }
1751 virtual intptr_t ResultCid() const; 1771 virtual intptr_t ResultCid() const;
1752 1772
1753 private: 1773 private:
1754 const Token::Kind op_kind_; 1774 const Token::Kind op_kind_;
1755 InstanceCallComp* instance_call_; 1775 InstanceCallComp* instance_call_;
1756 1776
1757 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpComp); 1777 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpComp);
1758 }; 1778 };
1759 1779
1760 1780
1761 class BinaryDoubleOpComp : public TemplateComputation<0> { 1781 class BinaryDoubleOpComp : public TemplateComputation<0> {
1762 public: 1782 public:
1763 BinaryDoubleOpComp(Token::Kind op_kind, InstanceCallComp* instance_call) 1783 BinaryDoubleOpComp(Token::Kind op_kind, InstanceCallComp* instance_call)
1764 : op_kind_(op_kind), instance_call_(instance_call) { } 1784 : op_kind_(op_kind), instance_call_(instance_call) { }
1765 1785
1766 Token::Kind op_kind() const { return op_kind_; } 1786 Token::Kind op_kind() const { return op_kind_; }
1767 1787
1768 InstanceCallComp* instance_call() const { return instance_call_; } 1788 InstanceCallComp* instance_call() const { return instance_call_; }
1769 1789
1790 const ICData* ic_data() const { return instance_call()->ic_data(); }
1791
1770 virtual void PrintOperandsTo(BufferFormatter* f) const; 1792 virtual void PrintOperandsTo(BufferFormatter* f) const;
1771 1793
1772 DECLARE_CALL_COMPUTATION(BinaryDoubleOp) 1794 DECLARE_CALL_COMPUTATION(BinaryDoubleOp)
1773 1795
1774 virtual intptr_t ArgumentCount() const { return 2; } 1796 virtual intptr_t ArgumentCount() const { return 2; }
1775 1797
1776 virtual bool CanDeoptimize() const { return true; } 1798 virtual bool CanDeoptimize() const { return true; }
1777 virtual intptr_t ResultCid() const; 1799 virtual intptr_t ResultCid() const;
1778 1800
1779 private: 1801 private:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 NumberNegateComp(InstanceCallComp* instance_call, 1844 NumberNegateComp(InstanceCallComp* instance_call,
1823 Value* value) : instance_call_(instance_call) { 1845 Value* value) : instance_call_(instance_call) {
1824 ASSERT(value != NULL); 1846 ASSERT(value != NULL);
1825 inputs_[0] = value; 1847 inputs_[0] = value;
1826 } 1848 }
1827 1849
1828 Value* value() const { return inputs_[0]; } 1850 Value* value() const { return inputs_[0]; }
1829 1851
1830 InstanceCallComp* instance_call() const { return instance_call_; } 1852 InstanceCallComp* instance_call() const { return instance_call_; }
1831 1853
1854 const ICData* ic_data() const { return instance_call()->ic_data(); }
1855
1832 DECLARE_COMPUTATION(NumberNegate) 1856 DECLARE_COMPUTATION(NumberNegate)
1833 1857
1834 virtual bool CanDeoptimize() const { return true; } 1858 virtual bool CanDeoptimize() const { return true; }
1835 virtual intptr_t ResultCid() const { return kDoubleCid; } 1859 virtual intptr_t ResultCid() const { return kDoubleCid; }
1836 1860
1837 private: 1861 private:
1838 InstanceCallComp* instance_call_; 1862 InstanceCallComp* instance_call_;
1839 1863
1840 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp); 1864 DISALLOW_COPY_AND_ASSIGN(NumberNegateComp);
1841 }; 1865 };
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 1924
1901 private: 1925 private:
1902 InstanceCallComp* instance_call_; 1926 InstanceCallComp* instance_call_;
1903 1927
1904 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleComp); 1928 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleComp);
1905 }; 1929 };
1906 1930
1907 1931
1908 class CheckClassComp : public TemplateComputation<1> { 1932 class CheckClassComp : public TemplateComputation<1> {
1909 public: 1933 public:
1910 CheckClassComp(Value* value, InstanceCallComp* original) 1934 CheckClassComp(Value* value,
1911 : original_(original) { 1935 InstanceCallComp* instance_call,
1936 const ICData& unary_checks)
1937 : instance_call_(instance_call),
1938 unary_checks_(unary_checks) {
1912 ASSERT(value != NULL); 1939 ASSERT(value != NULL);
1913 inputs_[0] = value; 1940 inputs_[0] = value;
1914 } 1941 }
1915 1942
1916 DECLARE_COMPUTATION(CheckClass) 1943 DECLARE_COMPUTATION(CheckClass)
1917 1944
1918 virtual bool CanDeoptimize() const { return true; } 1945 virtual bool CanDeoptimize() const { return true; }
1919 virtual intptr_t ResultCid() const { return kIllegalCid; } 1946 virtual intptr_t ResultCid() const { return kIllegalCid; }
1920 1947
1921 virtual bool AttributesEqual(Computation* other) const; 1948 virtual bool AttributesEqual(Computation* other) const;
1922 1949
1923 virtual bool HasSideEffect() const { return false; } 1950 virtual bool HasSideEffect() const { return false; }
1924 1951
1925 Value* value() const { return inputs_[0]; } 1952 Value* value() const { return inputs_[0]; }
1926 1953
1927 intptr_t deopt_id() const { return original_->deopt_id(); } 1954 const ICData& unary_checks() const { return unary_checks_; }
1955
1956 intptr_t deopt_id() const { return instance_call_->deopt_id(); }
1928 1957
1929 virtual Definition* TryReplace(BindInstr* instr) const; 1958 virtual Definition* TryReplace(BindInstr* instr) const;
1930 1959
1931 virtual void PrintOperandsTo(BufferFormatter* f) const; 1960 virtual void PrintOperandsTo(BufferFormatter* f) const;
1932 1961
1933 private: 1962 private:
1934 InstanceCallComp* original_; 1963 InstanceCallComp* instance_call_;
1964 const ICData& unary_checks_;
1935 1965
1936 DISALLOW_COPY_AND_ASSIGN(CheckClassComp); 1966 DISALLOW_COPY_AND_ASSIGN(CheckClassComp);
1937 }; 1967 };
1938 1968
1939 1969
1940 class CheckSmiComp : public TemplateComputation<1> { 1970 class CheckSmiComp : public TemplateComputation<1> {
1941 public: 1971 public:
1942 CheckSmiComp(Value* value, InstanceCallComp* original) 1972 CheckSmiComp(Value* value, InstanceCallComp* instance_call)
1943 : original_(original) { 1973 : instance_call_(instance_call) {
1944 ASSERT(value != NULL); 1974 ASSERT(value != NULL);
1945 inputs_[0] = value; 1975 inputs_[0] = value;
1946 } 1976 }
1947 1977
1948 DECLARE_COMPUTATION(CheckSmi) 1978 DECLARE_COMPUTATION(CheckSmi)
1949 1979
1950 virtual bool CanDeoptimize() const { return true; } 1980 virtual bool CanDeoptimize() const { return true; }
1951 virtual intptr_t ResultCid() const { return kIllegalCid; } 1981 virtual intptr_t ResultCid() const { return kIllegalCid; }
1952 1982
1953 virtual bool AttributesEqual(Computation* other) const { return true; } 1983 virtual bool AttributesEqual(Computation* other) const { return true; }
1954 1984
1955 virtual bool HasSideEffect() const { return false; } 1985 virtual bool HasSideEffect() const { return false; }
1956 1986
1957 virtual Definition* TryReplace(BindInstr* instr) const; 1987 virtual Definition* TryReplace(BindInstr* instr) const;
1958 1988
1959 Value* value() const { return inputs_[0]; } 1989 Value* value() const { return inputs_[0]; }
1960 1990
1961 intptr_t deopt_id() const { return original_->deopt_id(); } 1991 intptr_t deopt_id() const { return instance_call_->deopt_id(); }
1962 1992
1963 private: 1993 private:
1964 InstanceCallComp* original_; 1994 InstanceCallComp* instance_call_;
1965 1995
1966 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp); 1996 DISALLOW_COPY_AND_ASSIGN(CheckSmiComp);
1967 }; 1997 };
1968 1998
1969 1999
1970 class CheckArrayBoundComp : public TemplateComputation<2> { 2000 class CheckArrayBoundComp : public TemplateComputation<2> {
1971 public: 2001 public:
1972 CheckArrayBoundComp(Value* array, 2002 CheckArrayBoundComp(Value* array,
1973 Value* index, 2003 Value* index,
1974 intptr_t array_type, 2004 intptr_t array_type,
1975 InstanceCallComp* original) 2005 InstanceCallComp* instance_call)
1976 : array_type_(array_type), original_(original) { 2006 : array_type_(array_type), instance_call_(instance_call) {
1977 ASSERT(array != NULL); 2007 ASSERT(array != NULL);
1978 ASSERT(index != NULL); 2008 ASSERT(index != NULL);
1979 inputs_[0] = array; 2009 inputs_[0] = array;
1980 inputs_[1] = index; 2010 inputs_[1] = index;
1981 } 2011 }
1982 2012
1983 DECLARE_COMPUTATION(CheckArrayBound) 2013 DECLARE_COMPUTATION(CheckArrayBound)
1984 2014
1985 virtual bool CanDeoptimize() const { return true; } 2015 virtual bool CanDeoptimize() const { return true; }
1986 virtual intptr_t ResultCid() const { return kIllegalCid; } 2016 virtual intptr_t ResultCid() const { return kIllegalCid; }
1987 2017
1988 virtual bool AttributesEqual(Computation* other) const; 2018 virtual bool AttributesEqual(Computation* other) const;
1989 2019
1990 virtual bool HasSideEffect() const { return false; } 2020 virtual bool HasSideEffect() const { return false; }
1991 2021
1992 Value* array() const { return inputs_[0]; } 2022 Value* array() const { return inputs_[0]; }
1993 Value* index() const { return inputs_[1]; } 2023 Value* index() const { return inputs_[1]; }
1994 2024
1995 intptr_t array_type() const { return array_type_; } 2025 intptr_t array_type() const { return array_type_; }
1996 2026
1997 intptr_t deopt_id() const { return original_->deopt_id(); } 2027 intptr_t deopt_id() const { return instance_call_->deopt_id(); }
1998 2028
1999 private: 2029 private:
2000 intptr_t array_type_; 2030 intptr_t array_type_;
2001 InstanceCallComp* original_; 2031 InstanceCallComp* instance_call_;
2002 2032
2003 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp); 2033 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundComp);
2004 }; 2034 };
2005 2035
2006 2036
2007 #undef DECLARE_COMPUTATION 2037 #undef DECLARE_COMPUTATION
2008 2038
2009 2039
2010 // Implementation of type testers and cast functins. 2040 // Implementation of type testers and cast functins.
2011 #define DEFINE_COMPUTATION_PREDICATE(ShortName, ClassName) \ 2041 #define DEFINE_COMPUTATION_PREDICATE(ShortName, ClassName) \
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 2602
2573 2603
2574 class TargetEntryInstr : public BlockEntryInstr { 2604 class TargetEntryInstr : public BlockEntryInstr {
2575 public: 2605 public:
2576 explicit TargetEntryInstr(intptr_t try_index) 2606 explicit TargetEntryInstr(intptr_t try_index)
2577 : BlockEntryInstr(try_index), 2607 : BlockEntryInstr(try_index),
2578 predecessor_(NULL), 2608 predecessor_(NULL),
2579 catch_try_index_(CatchClauseNode::kInvalidTryIndex) { } 2609 catch_try_index_(CatchClauseNode::kInvalidTryIndex) { }
2580 2610
2581 // Used for exception catch entries. 2611 // Used for exception catch entries.
2582 explicit TargetEntryInstr(intptr_t try_index, intptr_t catch_try_index) 2612 TargetEntryInstr(intptr_t try_index, intptr_t catch_try_index)
2583 : BlockEntryInstr(try_index), 2613 : BlockEntryInstr(try_index),
2584 predecessor_(NULL), 2614 predecessor_(NULL),
2585 catch_try_index_(catch_try_index) { } 2615 catch_try_index_(catch_try_index) { }
2586 2616
2587 DECLARE_INSTRUCTION(TargetEntry) 2617 DECLARE_INSTRUCTION(TargetEntry)
2588 2618
2589 virtual intptr_t PredecessorCount() const { 2619 virtual intptr_t PredecessorCount() const {
2590 return (predecessor_ == NULL) ? 0 : 1; 2620 return (predecessor_ == NULL) ? 0 : 1;
2591 } 2621 }
2592 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 2622 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 ForwardInstructionIterator* current_iterator_; 3212 ForwardInstructionIterator* current_iterator_;
3183 3213
3184 private: 3214 private:
3185 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 3215 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
3186 }; 3216 };
3187 3217
3188 3218
3189 } // namespace dart 3219 } // namespace dart
3190 3220
3191 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 3221 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698