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

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

Issue 15741002: Use a uniform way to emit code for all instructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 FOR_EACH_INSTRUCTION(DECLARE_TAG) 630 FOR_EACH_INSTRUCTION(DECLARE_TAG)
631 }; 631 };
632 #undef DECLARE_TAG 632 #undef DECLARE_TAG
633 633
634 Instruction() 634 Instruction()
635 : deopt_id_(Isolate::Current()->GetNextDeoptId()), 635 : deopt_id_(Isolate::Current()->GetNextDeoptId()),
636 lifetime_position_(-1), 636 lifetime_position_(-1),
637 previous_(NULL), 637 previous_(NULL),
638 next_(NULL), 638 next_(NULL),
639 env_(NULL), 639 env_(NULL),
640 expr_id_(kNoExprId) { } 640 expr_id_(kNoExprId),
641 locs_(NULL) { }
641 642
642 virtual Tag tag() const = 0; 643 virtual Tag tag() const = 0;
643 644
644 intptr_t deopt_id() const { 645 intptr_t deopt_id() const {
645 ASSERT(CanDeoptimize() || CanBeDeoptimizationTarget()); 646 ASSERT(CanDeoptimize() || CanBeDeoptimizationTarget());
646 return deopt_id_; 647 return deopt_id_;
647 } 648 }
648 649
649 ICData* GetICData(const Array& ic_data_array) const; 650 ICData* GetICData(const Array& ic_data_array) const;
650 651
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 virtual void PrintOperandsTo(BufferFormatter* f) const; 733 virtual void PrintOperandsTo(BufferFormatter* f) const;
733 734
734 #define INSTRUCTION_TYPE_CHECK(type) \ 735 #define INSTRUCTION_TYPE_CHECK(type) \
735 bool Is##type() { return (As##type() != NULL); } \ 736 bool Is##type() { return (As##type() != NULL); } \
736 virtual type##Instr* As##type() { return NULL; } 737 virtual type##Instr* As##type() { return NULL; }
737 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK) 738 FOR_EACH_INSTRUCTION(INSTRUCTION_TYPE_CHECK)
738 #undef INSTRUCTION_TYPE_CHECK 739 #undef INSTRUCTION_TYPE_CHECK
739 740
740 // Returns structure describing location constraints required 741 // Returns structure describing location constraints required
741 // to emit native code for this instruction. 742 // to emit native code for this instruction.
742 virtual LocationSummary* locs() { 743 LocationSummary* locs() {
743 // TODO(vegorov): This should be pure virtual method. 744 if (locs_ == NULL) {
744 // However we are temporary using NULL for instructions that 745 locs_ = MakeLocationSummary();
745 // were not converted to the location based code generation yet. 746 }
746 return NULL; 747 return locs_;
747 } 748 }
748 749
749 virtual LocationSummary* MakeLocationSummary() const = 0; 750 virtual LocationSummary* MakeLocationSummary() const = 0;
750 751
751 static LocationSummary* MakeCallSummary(); 752 static LocationSummary* MakeCallSummary();
752 753
753 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { 754 virtual void EmitNativeCode(FlowGraphCompiler* compiler) {
754 UNIMPLEMENTED(); 755 UNIMPLEMENTED();
755 } 756 }
756 757
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 enum { 921 enum {
921 kNoExprId = -1 922 kNoExprId = -1
922 }; 923 };
923 924
924 intptr_t deopt_id_; 925 intptr_t deopt_id_;
925 intptr_t lifetime_position_; // Position used by register allocator. 926 intptr_t lifetime_position_; // Position used by register allocator.
926 Instruction* previous_; 927 Instruction* previous_;
927 Instruction* next_; 928 Instruction* next_;
928 Environment* env_; 929 Environment* env_;
929 intptr_t expr_id_; 930 intptr_t expr_id_;
931 LocationSummary* locs_;
Florian Schneider 2013/05/22 15:56:15 I'd prefer to have this member only on those that
Kevin Millikin (Google) 2013/05/23 09:09:49 Good: all instructions need a location summary ---
Florian Schneider 2013/05/23 19:12:36 Fine with me, if there is no visible impact on com
930 932
931 DISALLOW_COPY_AND_ASSIGN(Instruction); 933 DISALLOW_COPY_AND_ASSIGN(Instruction);
932 }; 934 };
933 935
934 936
935 template<intptr_t N> 937 template<intptr_t N>
936 class TemplateInstruction: public Instruction { 938 class TemplateInstruction: public Instruction {
937 public: 939 public:
938 TemplateInstruction<N>() : locs_(NULL) { }
939
940 virtual intptr_t InputCount() const { return N; } 940 virtual intptr_t InputCount() const { return N; }
941 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 941 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
942 942
943 virtual LocationSummary* locs() {
944 if (locs_ == NULL) {
945 locs_ = MakeLocationSummary();
946 }
947 return locs_;
948 }
949
950 protected: 943 protected:
951 EmbeddedArray<Value*, N> inputs_; 944 EmbeddedArray<Value*, N> inputs_;
952 945
953 private: 946 private:
954 virtual void RawSetInputAt(intptr_t i, Value* value) { 947 virtual void RawSetInputAt(intptr_t i, Value* value) {
955 inputs_[i] = value; 948 inputs_[i] = value;
956 } 949 }
957
958 LocationSummary* locs_;
959 }; 950 };
960 951
961 952
962 class MoveOperands : public ZoneAllocated { 953 class MoveOperands : public ZoneAllocated {
963 public: 954 public:
964 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { } 955 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) { }
965 956
966 Location src() const { return src_; } 957 Location src() const { return src_; }
967 Location dest() const { return dest_; } 958 Location dest() const { return dest_; }
968 959
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 intptr_t fixed_parameter_count); 1131 intptr_t fixed_parameter_count);
1141 1132
1142 virtual intptr_t InputCount() const { return 0; } 1133 virtual intptr_t InputCount() const { return 0; }
1143 virtual Value* InputAt(intptr_t i) const { 1134 virtual Value* InputAt(intptr_t i) const {
1144 UNREACHABLE(); 1135 UNREACHABLE();
1145 return NULL; 1136 return NULL;
1146 } 1137 }
1147 1138
1148 virtual intptr_t ArgumentCount() const { return 0; } 1139 virtual intptr_t ArgumentCount() const { return 0; }
1149 1140
1150 virtual bool CanBeDeoptimizationTarget() const {
1151 // BlockEntry environment is copied to Goto and Branch instructions
1152 // when we insert new blocks targeting this block.
1153 return true;
1154 }
1155
1156 virtual bool CanDeoptimize() const { return false; } 1141 virtual bool CanDeoptimize() const { return false; }
1157 1142
1158 virtual EffectSet Effects() const { return EffectSet::None(); } 1143 virtual EffectSet Effects() const { return EffectSet::None(); }
1159 virtual EffectSet Dependencies() const { return EffectSet::None(); } 1144 virtual EffectSet Dependencies() const { return EffectSet::None(); }
1160 1145
1161 virtual bool MayThrow() const { return false; } 1146 virtual bool MayThrow() const { return false; }
1162 1147
1163 intptr_t try_index() const { return try_index_; } 1148 intptr_t try_index() const { return try_index_; }
1164 1149
1165 // True for blocks inside a try { } region. 1150 // True for blocks inside a try { } region.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 void InsertPhi(intptr_t var_index, intptr_t var_count); 1346 void InsertPhi(intptr_t var_index, intptr_t var_count);
1362 void RemoveDeadPhis(Definition* replacement); 1347 void RemoveDeadPhis(Definition* replacement);
1363 1348
1364 void InsertPhi(PhiInstr* phi); 1349 void InsertPhi(PhiInstr* phi);
1365 1350
1366 virtual void PrintTo(BufferFormatter* f) const; 1351 virtual void PrintTo(BufferFormatter* f) const;
1367 1352
1368 virtual EffectSet Effects() const { return EffectSet::None(); } 1353 virtual EffectSet Effects() const { return EffectSet::None(); }
1369 virtual EffectSet Dependencies() const { return EffectSet::None(); } 1354 virtual EffectSet Dependencies() const { return EffectSet::None(); }
1370 1355
1356 virtual bool CanBeDeoptimizationTarget() const {
1357 // The JoinEntry's environment is copied to Goto and Branch instructions
1358 // when we insert new blocks targeting this block.
1359 return true;
1360 }
1361
1371 private: 1362 private:
1372 // Classes that have access to predecessors_ when inlining. 1363 // Classes that have access to predecessors_ when inlining.
1373 friend class BlockEntryInstr; 1364 friend class BlockEntryInstr;
1374 friend class InlineExitCollector; 1365 friend class InlineExitCollector;
1375 friend class PolymorphicInliner; 1366 friend class PolymorphicInliner;
1376 1367
1377 // Direct access to phis_ in order to resize it due to phi elimination. 1368 // Direct access to phis_ in order to resize it due to phi elimination.
1378 friend class ConstantPropagator; 1369 friend class ConstantPropagator;
1379 1370
1380 virtual void ClearPredecessors() { predecessors_.Clear(); } 1371 virtual void ClearPredecessors() { predecessors_.Clear(); }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 virtual intptr_t PredecessorCount() const { 1412 virtual intptr_t PredecessorCount() const {
1422 return (predecessor_ == NULL) ? 0 : 1; 1413 return (predecessor_ == NULL) ? 0 : 1;
1423 } 1414 }
1424 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { 1415 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const {
1425 ASSERT((index == 0) && (predecessor_ != NULL)); 1416 ASSERT((index == 0) && (predecessor_ != NULL));
1426 return predecessor_; 1417 return predecessor_;
1427 } 1418 }
1428 1419
1429 virtual void PrintTo(BufferFormatter* f) const; 1420 virtual void PrintTo(BufferFormatter* f) const;
1430 1421
1422 virtual bool CanBeDeoptimizationTarget() const {
1423 // The TargetEntry's environment is copied to Goto and Branch
1424 // instructions when we insert new blocks targeting this block.
1425 return true;
1426 }
1427
1431 private: 1428 private:
1432 friend class BlockEntryInstr; // Access to predecessor_ when inlining. 1429 friend class BlockEntryInstr; // Access to predecessor_ when inlining.
1433 1430
1434 virtual void ClearPredecessors() { predecessor_ = NULL; } 1431 virtual void ClearPredecessors() { predecessor_ = NULL; }
1435 virtual void AddPredecessor(BlockEntryInstr* predecessor) { 1432 virtual void AddPredecessor(BlockEntryInstr* predecessor) {
1436 ASSERT(predecessor_ == NULL); 1433 ASSERT(predecessor_ == NULL);
1437 predecessor_ = predecessor; 1434 predecessor_ = predecessor;
1438 } 1435 }
1439 1436
1440 BlockEntryInstr* predecessor_; 1437 BlockEntryInstr* predecessor_;
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 private: 1772 private:
1776 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 1773 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1777 1774
1778 const intptr_t index_; 1775 const intptr_t index_;
1779 BlockEntryInstr* block_; 1776 BlockEntryInstr* block_;
1780 1777
1781 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 1778 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
1782 }; 1779 };
1783 1780
1784 1781
1785 class PushArgumentInstr : public Definition { 1782 class PushArgumentInstr : public Definition {
Florian Schneider 2013/05/22 15:56:15 Can't PushArgument just inherit from TemplateDefin
1786 public: 1783 public:
1787 explicit PushArgumentInstr(Value* value) : locs_(NULL) { 1784 explicit PushArgumentInstr(Value* value) {
1788 SetInputAt(0, value); 1785 SetInputAt(0, value);
1789 set_use_kind(kEffect); // Override the default. 1786 set_use_kind(kEffect); // Override the default.
1790 } 1787 }
1791 1788
1792 DECLARE_INSTRUCTION(PushArgument) 1789 DECLARE_INSTRUCTION(PushArgument)
1793 1790
1794 intptr_t InputCount() const { return 1; } 1791 intptr_t InputCount() const { return 1; }
1795 Value* InputAt(intptr_t i) const { 1792 Value* InputAt(intptr_t i) const {
1796 ASSERT(i == 0); 1793 ASSERT(i == 0);
1797 return value_; 1794 return value_;
1798 } 1795 }
1799 1796
1800 virtual intptr_t ArgumentCount() const { return 0; } 1797 virtual intptr_t ArgumentCount() const { return 0; }
1801 1798
1802 virtual CompileType ComputeType() const; 1799 virtual CompileType ComputeType() const;
1803 1800
1804 Value* value() const { return value_; } 1801 Value* value() const { return value_; }
1805 1802
1806 virtual LocationSummary* locs() {
1807 if (locs_ == NULL) {
1808 locs_ = MakeLocationSummary();
1809 }
1810 return locs_;
1811 }
1812
1813 virtual intptr_t Hashcode() const { 1803 virtual intptr_t Hashcode() const {
1814 UNREACHABLE(); 1804 UNREACHABLE();
1815 return 0; 1805 return 0;
1816 } 1806 }
1817 1807
1818 virtual bool CanDeoptimize() const { return false; } 1808 virtual bool CanDeoptimize() const { return false; }
1819 1809
1820 virtual EffectSet Effects() const { return EffectSet::None(); } 1810 virtual EffectSet Effects() const { return EffectSet::None(); }
1821 1811
1822 virtual void PrintOperandsTo(BufferFormatter* f) const; 1812 virtual void PrintOperandsTo(BufferFormatter* f) const;
1823 1813
1824 virtual bool MayThrow() const { return false; } 1814 virtual bool MayThrow() const { return false; }
1825 1815
1826 private: 1816 private:
1827 virtual void RawSetInputAt(intptr_t i, Value* value) { 1817 virtual void RawSetInputAt(intptr_t i, Value* value) {
1828 ASSERT(i == 0); 1818 ASSERT(i == 0);
1829 value_ = value; 1819 value_ = value;
1830 } 1820 }
1831 1821
1832 Value* value_; 1822 Value* value_;
1833 LocationSummary* locs_;
1834 1823
1835 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 1824 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
1836 }; 1825 };
1837 1826
1838 1827
1839 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 1828 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
1840 return PushArgumentAt(index)->value()->definition(); 1829 return PushArgumentAt(index)->value()->definition();
1841 } 1830 }
1842 1831
1843 1832
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 virtual bool CanDeoptimize() const; 2002 virtual bool CanDeoptimize() const;
2014 virtual bool CanBeDeoptimizationTarget() const; 2003 virtual bool CanBeDeoptimizationTarget() const;
2015 2004
2016 virtual EffectSet Effects() const; 2005 virtual EffectSet Effects() const;
2017 2006
2018 ComparisonInstr* comparison() const { return comparison_; } 2007 ComparisonInstr* comparison() const { return comparison_; }
2019 void SetComparison(ComparisonInstr* comp); 2008 void SetComparison(ComparisonInstr* comp);
2020 2009
2021 bool is_checked() const { return is_checked_; } 2010 bool is_checked() const { return is_checked_; }
2022 2011
2023 virtual LocationSummary* locs();
2024 virtual intptr_t DeoptimizationTarget() const; 2012 virtual intptr_t DeoptimizationTarget() const;
2025 virtual Representation RequiredInputRepresentation(intptr_t i) const; 2013 virtual Representation RequiredInputRepresentation(intptr_t i) const;
2026 2014
2027 // A misleadingly named function for use in template functions that also 2015 // A misleadingly named function for use in template functions that also
2028 // replace definitions. In this case, leave the branch intact and replace 2016 // replace definitions. In this case, leave the branch intact and replace
2029 // its comparison with another comparison that has been removed from the 2017 // its comparison with another comparison that has been removed from the
2030 // graph but still has uses properly linked into their definition's use 2018 // graph but still has uses properly linked into their definition's use
2031 // list. 2019 // list.
2032 void ReplaceWith(ComparisonInstr* other, 2020 void ReplaceWith(ComparisonInstr* other,
2033 ForwardInstructionIterator* ignored); 2021 ForwardInstructionIterator* ignored);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 virtual bool MayThrow() const { return false; } 2081 virtual bool MayThrow() const { return false; }
2094 2082
2095 private: 2083 private:
2096 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 2084 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
2097 }; 2085 };
2098 2086
2099 2087
2100 template<intptr_t N> 2088 template<intptr_t N>
2101 class TemplateDefinition : public Definition { 2089 class TemplateDefinition : public Definition {
2102 public: 2090 public:
2103 TemplateDefinition<N>() : locs_(NULL) { } 2091 TemplateDefinition<N>() { }
2104 2092
2105 virtual intptr_t InputCount() const { return N; } 2093 virtual intptr_t InputCount() const { return N; }
2106 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 2094 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
2107 2095
2108 // Returns a structure describing the location constraints required
2109 // to emit native code for this definition.
2110 LocationSummary* locs() {
2111 if (locs_ == NULL) {
2112 locs_ = MakeLocationSummary();
2113 }
2114 return locs_;
2115 }
2116
2117 protected: 2096 protected:
2118 EmbeddedArray<Value*, N> inputs_; 2097 EmbeddedArray<Value*, N> inputs_;
2119 2098
2120 private: 2099 private:
2121 friend class BranchInstr; 2100 friend class BranchInstr;
2122 2101
2123 virtual void RawSetInputAt(intptr_t i, Value* value) { 2102 virtual void RawSetInputAt(intptr_t i, Value* value) {
2124 inputs_[i] = value; 2103 inputs_[i] = value;
2125 } 2104 }
2126
2127 LocationSummary* locs_;
2128 }; 2105 };
2129 2106
2130 2107
2131 class RedefinitionInstr : public TemplateDefinition<1> { 2108 class RedefinitionInstr : public TemplateDefinition<1> {
2132 public: 2109 public:
2133 explicit RedefinitionInstr(Value* value) { 2110 explicit RedefinitionInstr(Value* value) {
2134 SetInputAt(0, value); 2111 SetInputAt(0, value);
2135 } 2112 }
2136 2113
2137 DECLARE_INSTRUCTION(Redefinition) 2114 DECLARE_INSTRUCTION(Redefinition)
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 inline bool BranchInstr::CanBeDeoptimizationTarget() const { 2733 inline bool BranchInstr::CanBeDeoptimizationTarget() const {
2757 return comparison()->CanBeDeoptimizationTarget(); 2734 return comparison()->CanBeDeoptimizationTarget();
2758 } 2735 }
2759 2736
2760 2737
2761 inline EffectSet BranchInstr::Effects() const { 2738 inline EffectSet BranchInstr::Effects() const {
2762 return comparison()->Effects(); 2739 return comparison()->Effects();
2763 } 2740 }
2764 2741
2765 2742
2766 inline LocationSummary* BranchInstr::locs() {
2767 if (comparison()->locs_ == NULL) {
2768 LocationSummary* summary = comparison()->MakeLocationSummary();
2769 // Branches don't produce a result.
2770 summary->set_out(Location::NoLocation());
2771 comparison()->locs_ = summary;
2772 }
2773 return comparison()->locs_;
2774 }
2775
2776
2777 inline intptr_t BranchInstr::DeoptimizationTarget() const { 2743 inline intptr_t BranchInstr::DeoptimizationTarget() const {
2778 return comparison()->DeoptimizationTarget(); 2744 return comparison()->DeoptimizationTarget();
2779 } 2745 }
2780 2746
2781 2747
2782 inline Representation BranchInstr::RequiredInputRepresentation( 2748 inline Representation BranchInstr::RequiredInputRepresentation(
2783 intptr_t i) const { 2749 intptr_t i) const {
2784 return comparison()->RequiredInputRepresentation(i); 2750 return comparison()->RequiredInputRepresentation(i);
2785 } 2751 }
2786 2752
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
3682 return values_->length(); 3648 return values_->length();
3683 } 3649 }
3684 3650
3685 virtual Value* InputAt(intptr_t i) const { 3651 virtual Value* InputAt(intptr_t i) const {
3686 return (*values_)[i]; 3652 return (*values_)[i];
3687 } 3653 }
3688 3654
3689 virtual bool CanDeoptimize() const { return false; } 3655 virtual bool CanDeoptimize() const { return false; }
3690 virtual EffectSet Effects() const { return EffectSet::None(); } 3656 virtual EffectSet Effects() const { return EffectSet::None(); }
3691 3657
3692 LocationSummary* locs() {
3693 UNREACHABLE();
3694 return NULL;
3695 }
3696
3697 Location* locations() { return locations_; } 3658 Location* locations() { return locations_; }
3698 void set_locations(Location* locations) { locations_ = locations; } 3659 void set_locations(Location* locations) { locations_ = locations; }
3699 3660
3700 virtual bool MayThrow() const { return false; } 3661 virtual bool MayThrow() const { return false; }
3701 3662
3702 private: 3663 private:
3703 virtual void RawSetInputAt(intptr_t i, Value* value) { 3664 virtual void RawSetInputAt(intptr_t i, Value* value) {
3704 (*values_)[i] = value; 3665 (*values_)[i] = value;
3705 } 3666 }
3706 3667
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
6027 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 5988 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; }
6028 5989
6029 virtual intptr_t InputCount() const { 5990 virtual intptr_t InputCount() const {
6030 return inputs_->length(); 5991 return inputs_->length();
6031 } 5992 }
6032 5993
6033 virtual Value* InputAt(intptr_t i) const { 5994 virtual Value* InputAt(intptr_t i) const {
6034 return (*inputs_)[i]; 5995 return (*inputs_)[i];
6035 } 5996 }
6036 5997
6037 // Returns a structure describing the location constraints required
6038 // to emit native code for this definition.
6039 LocationSummary* locs() {
6040 if (locs_ == NULL) {
6041 locs_ = MakeLocationSummary();
6042 }
6043 return locs_;
6044 }
6045
6046 virtual bool AllowsCSE() const { return true; } 5998 virtual bool AllowsCSE() const { return true; }
6047 virtual EffectSet Effects() const { return EffectSet::None(); } 5999 virtual EffectSet Effects() const { return EffectSet::None(); }
6048 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6000 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6049 virtual bool AttributesEqual(Instruction* other) const { 6001 virtual bool AttributesEqual(Instruction* other) const {
6050 InvokeMathCFunctionInstr* other_invoke = other->AsInvokeMathCFunction(); 6002 InvokeMathCFunctionInstr* other_invoke = other->AsInvokeMathCFunction();
6051 return other_invoke->recognized_kind() == recognized_kind(); 6003 return other_invoke->recognized_kind() == recognized_kind();
6052 } 6004 }
6053 6005
6054 virtual bool MayThrow() const { return false; } 6006 virtual bool MayThrow() const { return false; }
6055 6007
6056 private: 6008 private:
6057 virtual void RawSetInputAt(intptr_t i, Value* value) { 6009 virtual void RawSetInputAt(intptr_t i, Value* value) {
6058 (*inputs_)[i] = value; 6010 (*inputs_)[i] = value;
6059 } 6011 }
6060 6012
6061 ZoneGrowableArray<Value*>* inputs_; 6013 ZoneGrowableArray<Value*>* inputs_;
6062 6014
6063 LocationSummary* locs_;
6064
6065 const MethodRecognizer::Kind recognized_kind_; 6015 const MethodRecognizer::Kind recognized_kind_;
6066 6016
6067 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 6017 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
6068 }; 6018 };
6069 6019
6070 6020
6071 class CheckClassInstr : public TemplateInstruction<1> { 6021 class CheckClassInstr : public TemplateInstruction<1> {
6072 public: 6022 public:
6073 CheckClassInstr(Value* value, 6023 CheckClassInstr(Value* value,
6074 intptr_t deopt_id, 6024 intptr_t deopt_id,
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
6406 ForwardInstructionIterator* current_iterator_; 6356 ForwardInstructionIterator* current_iterator_;
6407 6357
6408 private: 6358 private:
6409 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6359 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6410 }; 6360 };
6411 6361
6412 6362
6413 } // namespace dart 6363 } // namespace dart
6414 6364
6415 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6365 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698