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

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

Issue 681713003: Revert "Revert "IR refactoring: reduce duplication related to MayThrow/AllowsCSE."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | 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) 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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 Instruction* previous_; 869 Instruction* previous_;
870 Instruction* next_; 870 Instruction* next_;
871 Environment* env_; 871 Environment* env_;
872 LocationSummary* locs_; 872 LocationSummary* locs_;
873 intptr_t place_id_; 873 intptr_t place_id_;
874 874
875 DISALLOW_COPY_AND_ASSIGN(Instruction); 875 DISALLOW_COPY_AND_ASSIGN(Instruction);
876 }; 876 };
877 877
878 878
879 template<intptr_t N> 879 class PureInstruction : public Instruction {
880 class TemplateInstruction: public Instruction {
881 public: 880 public:
882 explicit TemplateInstruction<N>(intptr_t deopt_id = Isolate::kNoDeoptId) 881 explicit PureInstruction(intptr_t deopt_id)
883 : Instruction(deopt_id), inputs_() { } 882 : Instruction(deopt_id) { }
883
884 virtual bool AllowsCSE() const { return true; }
885 virtual EffectSet Dependencies() const { return EffectSet::None(); }
886
887 virtual EffectSet Effects() const { return EffectSet::None(); }
888 };
889
890
891 // Types to be used as ThrowsTrait for TemplateInstruction/TemplateDefinition.
892 struct Throws {
893 static const bool kCanThrow = true;
894 };
895
896
897 struct NoThrow {
898 static const bool kCanThrow = false;
899 };
900
901
902 // Types to be used as CSETrait for TemplateInstruction/TemplateDefinition.
903 // Pure instructions are those that allow CSE and have no effects and
904 // no dependencies.
905 template<typename DefaultBase, typename PureBase>
906 struct Pure {
907 typedef PureBase Base;
908 };
909
910
911 template<typename DefaultBase, typename PureBase>
912 struct NoCSE {
913 typedef DefaultBase Base;
914 };
915
916
917 template<intptr_t N,
918 typename ThrowsTrait,
919 template<typename Default, typename Pure> class CSETrait = NoCSE>
920 class TemplateInstruction: public CSETrait<Instruction, PureInstruction>::Base {
921 public:
922 explicit TemplateInstruction(intptr_t deopt_id = Isolate::kNoDeoptId)
923 : CSETrait<Instruction, PureInstruction>::Base(deopt_id), inputs_() { }
884 924
885 virtual intptr_t InputCount() const { return N; } 925 virtual intptr_t InputCount() const { return N; }
886 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 926 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
887 927
928 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; }
929
888 protected: 930 protected:
889 EmbeddedArray<Value*, N> inputs_; 931 EmbeddedArray<Value*, N> inputs_;
890 932
891 private: 933 private:
892 virtual void RawSetInputAt(intptr_t i, Value* value) { 934 virtual void RawSetInputAt(intptr_t i, Value* value) {
893 inputs_[i] = value; 935 inputs_[i] = value;
894 } 936 }
895 }; 937 };
896 938
897 939
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 } 988 }
947 989
948 private: 990 private:
949 Location dest_; 991 Location dest_;
950 Location src_; 992 Location src_;
951 993
952 DISALLOW_COPY_AND_ASSIGN(MoveOperands); 994 DISALLOW_COPY_AND_ASSIGN(MoveOperands);
953 }; 995 };
954 996
955 997
956 class ParallelMoveInstr : public TemplateInstruction<0> { 998 class ParallelMoveInstr : public TemplateInstruction<0, NoThrow> {
957 public: 999 public:
958 ParallelMoveInstr() : moves_(4) { } 1000 ParallelMoveInstr() : moves_(4) { }
959 1001
960 DECLARE_INSTRUCTION(ParallelMove) 1002 DECLARE_INSTRUCTION(ParallelMove)
961 1003
962 virtual intptr_t ArgumentCount() const { return 0; } 1004 virtual intptr_t ArgumentCount() const { return 0; }
963 1005
964 virtual bool CanDeoptimize() const { return false; } 1006 virtual bool CanDeoptimize() const { return false; }
965 1007
966 virtual EffectSet Effects() const { 1008 virtual EffectSet Effects() const {
(...skipping 13 matching lines...) Expand all
980 } 1022 }
981 1023
982 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } 1024 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; }
983 1025
984 intptr_t NumMoves() const { return moves_.length(); } 1026 intptr_t NumMoves() const { return moves_.length(); }
985 1027
986 bool IsRedundant() const; 1028 bool IsRedundant() const;
987 1029
988 virtual void PrintTo(BufferFormatter* f) const; 1030 virtual void PrintTo(BufferFormatter* f) const;
989 1031
990 virtual bool MayThrow() const { return false; }
991
992 private: 1032 private:
993 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. 1033 GrowableArray<MoveOperands*> moves_; // Elements cannot be null.
994 1034
995 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); 1035 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr);
996 }; 1036 };
997 1037
998 1038
999 // Basic block entries are administrative nodes. There is a distinguished 1039 // Basic block entries are administrative nodes. There is a distinguished
1000 // graph entry with no predecessor. Joins are the only nodes with multiple 1040 // graph entry with no predecessor. Joins are the only nodes with multiple
1001 // predecessors. Targets are all other basic block entries. The types 1041 // predecessors. Targets are all other basic block entries. The types
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 } 1775 }
1736 1776
1737 1777
1738 inline void Value::BindToEnvironment(Definition* def) { 1778 inline void Value::BindToEnvironment(Definition* def) {
1739 RemoveFromUseList(); 1779 RemoveFromUseList();
1740 set_definition(def); 1780 set_definition(def);
1741 def->AddEnvUse(this); 1781 def->AddEnvUse(this);
1742 } 1782 }
1743 1783
1744 1784
1745 template<intptr_t N> 1785 class PureDefinition : public Definition {
1746 class TemplateDefinition : public Definition {
1747 public: 1786 public:
1748 explicit TemplateDefinition<N>(intptr_t deopt_id = Isolate::kNoDeoptId) 1787 explicit PureDefinition(intptr_t deopt_id)
1749 : Definition(deopt_id), inputs_() { } 1788 : Definition(deopt_id) { }
1789
1790 virtual bool AllowsCSE() const { return true; }
1791 virtual EffectSet Dependencies() const { return EffectSet::None(); }
1792
1793 virtual EffectSet Effects() const { return EffectSet::None(); }
1794 };
1795
1796
1797 template<intptr_t N,
1798 typename ThrowsTrait,
1799 template<typename Impure, typename Pure> class CSETrait = NoCSE>
1800 class TemplateDefinition : public CSETrait<Definition, PureDefinition>::Base {
1801 public:
1802 explicit TemplateDefinition(intptr_t deopt_id = Isolate::kNoDeoptId)
1803 : CSETrait<Definition, PureDefinition>::Base(deopt_id), inputs_() { }
1750 1804
1751 virtual intptr_t InputCount() const { return N; } 1805 virtual intptr_t InputCount() const { return N; }
1752 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 1806 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
1753 1807
1808 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; }
1809
1754 protected: 1810 protected:
1755 EmbeddedArray<Value*, N> inputs_; 1811 EmbeddedArray<Value*, N> inputs_;
1756 1812
1757 private: 1813 private:
1758 friend class BranchInstr; 1814 friend class BranchInstr;
1759 friend class IfThenElseInstr; 1815 friend class IfThenElseInstr;
1760 1816
1761 virtual void RawSetInputAt(intptr_t i, Value* value) { 1817 virtual void RawSetInputAt(intptr_t i, Value* value) {
1762 inputs_[i] = value; 1818 inputs_[i] = value;
1763 } 1819 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 1972 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1917 1973
1918 const intptr_t index_; 1974 const intptr_t index_;
1919 const Register base_reg_; 1975 const Register base_reg_;
1920 BlockEntryInstr* block_; 1976 BlockEntryInstr* block_;
1921 1977
1922 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); 1978 DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
1923 }; 1979 };
1924 1980
1925 1981
1926 class PushArgumentInstr : public TemplateDefinition<1> { 1982 class PushArgumentInstr : public TemplateDefinition<1, NoThrow> {
1927 public: 1983 public:
1928 explicit PushArgumentInstr(Value* value) { 1984 explicit PushArgumentInstr(Value* value) {
1929 SetInputAt(0, value); 1985 SetInputAt(0, value);
1930 } 1986 }
1931 1987
1932 DECLARE_INSTRUCTION(PushArgument) 1988 DECLARE_INSTRUCTION(PushArgument)
1933 1989
1934 virtual intptr_t ArgumentCount() const { return 0; } 1990 virtual intptr_t ArgumentCount() const { return 0; }
1935 1991
1936 virtual CompileType ComputeType() const; 1992 virtual CompileType ComputeType() const;
1937 1993
1938 Value* value() const { return InputAt(0); } 1994 Value* value() const { return InputAt(0); }
1939 1995
1940 virtual bool CanDeoptimize() const { return false; } 1996 virtual bool CanDeoptimize() const { return false; }
1941 1997
1942 virtual EffectSet Effects() const { return EffectSet::None(); } 1998 virtual EffectSet Effects() const { return EffectSet::None(); }
1943 1999
1944 virtual void PrintOperandsTo(BufferFormatter* f) const; 2000 virtual void PrintOperandsTo(BufferFormatter* f) const;
1945 2001
1946 virtual bool MayThrow() const { return false; }
1947
1948 private: 2002 private:
1949 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); 2003 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr);
1950 }; 2004 };
1951 2005
1952 2006
1953 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 2007 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
1954 return PushArgumentAt(index)->value()->definition(); 2008 return PushArgumentAt(index)->value()->definition();
1955 } 2009 }
1956 2010
1957 2011
1958 class ReturnInstr : public TemplateInstruction<1> { 2012 class ReturnInstr : public TemplateInstruction<1, NoThrow> {
1959 public: 2013 public:
1960 ReturnInstr(intptr_t token_pos, Value* value) 2014 ReturnInstr(intptr_t token_pos, Value* value)
1961 : TemplateInstruction<1>(Isolate::Current()->GetNextDeoptId()), 2015 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()),
1962 token_pos_(token_pos) { 2016 token_pos_(token_pos) {
1963 SetInputAt(0, value); 2017 SetInputAt(0, value);
1964 } 2018 }
1965 2019
1966 DECLARE_INSTRUCTION(Return) 2020 DECLARE_INSTRUCTION(Return)
1967 2021
1968 virtual intptr_t ArgumentCount() const { return 0; } 2022 virtual intptr_t ArgumentCount() const { return 0; }
1969 2023
1970 virtual intptr_t token_pos() const { return token_pos_; } 2024 virtual intptr_t token_pos() const { return token_pos_; }
1971 Value* value() const { return inputs_[0]; } 2025 Value* value() const { return inputs_[0]; }
1972 2026
1973 virtual bool CanBecomeDeoptimizationTarget() const { 2027 virtual bool CanBecomeDeoptimizationTarget() const {
1974 // Return instruction might turn into a Goto instruction after inlining. 2028 // Return instruction might turn into a Goto instruction after inlining.
1975 // Every Goto must have an environment. 2029 // Every Goto must have an environment.
1976 return true; 2030 return true;
1977 } 2031 }
1978 2032
1979 virtual bool CanDeoptimize() const { return false; } 2033 virtual bool CanDeoptimize() const { return false; }
1980 2034
1981 virtual EffectSet Effects() const { return EffectSet::None(); } 2035 virtual EffectSet Effects() const { return EffectSet::None(); }
1982 2036
1983 virtual bool MayThrow() const { return false; }
1984
1985 private: 2037 private:
1986 const intptr_t token_pos_; 2038 const intptr_t token_pos_;
1987 2039
1988 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 2040 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
1989 }; 2041 };
1990 2042
1991 2043
1992 class ThrowInstr : public TemplateInstruction<0> { 2044 class ThrowInstr : public TemplateInstruction<0, Throws> {
1993 public: 2045 public:
1994 explicit ThrowInstr(intptr_t token_pos) 2046 explicit ThrowInstr(intptr_t token_pos)
1995 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()), 2047 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()),
1996 token_pos_(token_pos) { 2048 token_pos_(token_pos) {
1997 } 2049 }
1998 2050
1999 DECLARE_INSTRUCTION(Throw) 2051 DECLARE_INSTRUCTION(Throw)
2000 2052
2001 virtual intptr_t ArgumentCount() const { return 1; } 2053 virtual intptr_t ArgumentCount() const { return 1; }
2002 2054
2003 virtual intptr_t token_pos() const { return token_pos_; } 2055 virtual intptr_t token_pos() const { return token_pos_; }
2004 2056
2005 virtual bool CanDeoptimize() const { return true; } 2057 virtual bool CanDeoptimize() const { return true; }
2006 2058
2007 virtual EffectSet Effects() const { return EffectSet::None(); } 2059 virtual EffectSet Effects() const { return EffectSet::None(); }
2008 2060
2009 virtual bool MayThrow() const { return true; }
2010
2011 private: 2061 private:
2012 const intptr_t token_pos_; 2062 const intptr_t token_pos_;
2013 2063
2014 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2064 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2015 }; 2065 };
2016 2066
2017 2067
2018 class ReThrowInstr : public TemplateInstruction<0> { 2068 class ReThrowInstr : public TemplateInstruction<0, Throws> {
2019 public: 2069 public:
2020 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the 2070 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
2021 // rethrow has been artifically generated by the parser. 2071 // rethrow has been artifically generated by the parser.
2022 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index) 2072 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index)
2023 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()), 2073 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()),
2024 token_pos_(token_pos), 2074 token_pos_(token_pos),
2025 catch_try_index_(catch_try_index) { 2075 catch_try_index_(catch_try_index) {
2026 } 2076 }
2027 2077
2028 DECLARE_INSTRUCTION(ReThrow) 2078 DECLARE_INSTRUCTION(ReThrow)
2029 2079
2030 virtual intptr_t ArgumentCount() const { return 2; } 2080 virtual intptr_t ArgumentCount() const { return 2; }
2031 2081
2032 virtual intptr_t token_pos() const { return token_pos_; } 2082 virtual intptr_t token_pos() const { return token_pos_; }
2033 intptr_t catch_try_index() const { return catch_try_index_; } 2083 intptr_t catch_try_index() const { return catch_try_index_; }
2034 2084
2035 virtual bool CanDeoptimize() const { return true; } 2085 virtual bool CanDeoptimize() const { return true; }
2036 2086
2037 virtual EffectSet Effects() const { return EffectSet::None(); } 2087 virtual EffectSet Effects() const { return EffectSet::None(); }
2038 2088
2039 virtual bool MayThrow() const { return true; }
2040
2041 private: 2089 private:
2042 const intptr_t token_pos_; 2090 const intptr_t token_pos_;
2043 const intptr_t catch_try_index_; 2091 const intptr_t catch_try_index_;
2044 2092
2045 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 2093 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
2046 }; 2094 };
2047 2095
2048 2096
2049 class GotoInstr : public TemplateInstruction<0> { 2097 class GotoInstr : public TemplateInstruction<0, NoThrow> {
2050 public: 2098 public:
2051 explicit GotoInstr(JoinEntryInstr* entry) 2099 explicit GotoInstr(JoinEntryInstr* entry)
2052 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()), 2100 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()),
2053 successor_(entry), 2101 successor_(entry),
2054 edge_weight_(0.0), 2102 edge_weight_(0.0),
2055 parallel_move_(NULL) { 2103 parallel_move_(NULL) {
2056 } 2104 }
2057 2105
2058 DECLARE_INSTRUCTION(Goto) 2106 DECLARE_INSTRUCTION(Goto)
2059 2107
2060 virtual intptr_t ArgumentCount() const { return 0; } 2108 virtual intptr_t ArgumentCount() const { return 0; }
2061 2109
2062 JoinEntryInstr* successor() const { return successor_; } 2110 JoinEntryInstr* successor() const { return successor_; }
(...skipping 29 matching lines...) Expand all
2092 2140
2093 ParallelMoveInstr* GetParallelMove() { 2141 ParallelMoveInstr* GetParallelMove() {
2094 if (parallel_move_ == NULL) { 2142 if (parallel_move_ == NULL) {
2095 parallel_move_ = new ParallelMoveInstr(); 2143 parallel_move_ = new ParallelMoveInstr();
2096 } 2144 }
2097 return parallel_move_; 2145 return parallel_move_;
2098 } 2146 }
2099 2147
2100 virtual void PrintTo(BufferFormatter* f) const; 2148 virtual void PrintTo(BufferFormatter* f) const;
2101 2149
2102 virtual bool MayThrow() const { return false; }
2103
2104 private: 2150 private:
2105 JoinEntryInstr* successor_; 2151 JoinEntryInstr* successor_;
2106 double edge_weight_; 2152 double edge_weight_;
2107 2153
2108 // Parallel move that will be used by linear scan register allocator to 2154 // Parallel move that will be used by linear scan register allocator to
2109 // connect live ranges at the end of the block and resolve phis. 2155 // connect live ranges at the end of the block and resolve phis.
2110 ParallelMoveInstr* parallel_move_; 2156 ParallelMoveInstr* parallel_move_;
2111 }; 2157 };
2112 2158
2113 2159
2114 class ComparisonInstr : public TemplateDefinition<2> { 2160 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> {
2115 public: 2161 public:
2116 Value* left() const { return inputs_[0]; } 2162 Value* left() const { return inputs_[0]; }
2117 Value* right() const { return inputs_[1]; } 2163 Value* right() const { return inputs_[1]; }
2118 2164
2119 virtual intptr_t token_pos() const { return token_pos_; } 2165 virtual intptr_t token_pos() const { return token_pos_; }
2120 Token::Kind kind() const { return kind_; } 2166 Token::Kind kind() const { return kind_; }
2121 2167
2122 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; 2168 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0;
2123 2169
2124 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2170 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
(...skipping 10 matching lines...) Expand all
2135 void set_operation_cid(intptr_t value) { operation_cid_ = value; } 2181 void set_operation_cid(intptr_t value) { operation_cid_ = value; }
2136 intptr_t operation_cid() const { return operation_cid_; } 2182 intptr_t operation_cid() const { return operation_cid_; }
2137 2183
2138 void NegateComparison() { 2184 void NegateComparison() {
2139 kind_ = Token::NegateComparison(kind_); 2185 kind_ = Token::NegateComparison(kind_);
2140 } 2186 }
2141 2187
2142 virtual bool CanBecomeDeoptimizationTarget() const { return true; } 2188 virtual bool CanBecomeDeoptimizationTarget() const { return true; }
2143 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 2189 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
2144 2190
2191 virtual bool AttributesEqual(Instruction* other) const {
2192 ComparisonInstr* other_comparison = other->AsComparison();
2193 return kind() == other_comparison->kind() &&
2194 (operation_cid() == other_comparison->operation_cid());
2195 }
2196
2145 DEFINE_INSTRUCTION_TYPE_CHECK(Comparison) 2197 DEFINE_INSTRUCTION_TYPE_CHECK(Comparison)
2146 2198
2147 protected: 2199 protected:
2148 ComparisonInstr(intptr_t token_pos, 2200 ComparisonInstr(intptr_t token_pos,
2149 Token::Kind kind, 2201 Token::Kind kind,
2150 Value* left, 2202 Value* left,
2151 Value* right, 2203 Value* right,
2152 intptr_t deopt_id = Isolate::kNoDeoptId) 2204 intptr_t deopt_id = Isolate::kNoDeoptId)
2153 : TemplateDefinition<2>(deopt_id), 2205 : TemplateDefinition(deopt_id),
2154 token_pos_(token_pos), 2206 token_pos_(token_pos),
2155 kind_(kind), 2207 kind_(kind),
2156 operation_cid_(kIllegalCid) { 2208 operation_cid_(kIllegalCid) {
2157 SetInputAt(0, left); 2209 SetInputAt(0, left);
2158 if (right != NULL) { 2210 if (right != NULL) {
2159 SetInputAt(1, right); 2211 SetInputAt(1, right);
2160 } 2212 }
2161 } 2213 }
2162 2214
2163 private: 2215 private:
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 TargetEntryInstr* false_successor_; 2323 TargetEntryInstr* false_successor_;
2272 ComparisonInstr* comparison_; 2324 ComparisonInstr* comparison_;
2273 bool is_checked_; 2325 bool is_checked_;
2274 ConstrainedCompileType* constrained_type_; 2326 ConstrainedCompileType* constrained_type_;
2275 TargetEntryInstr* constant_target_; 2327 TargetEntryInstr* constant_target_;
2276 2328
2277 DISALLOW_COPY_AND_ASSIGN(BranchInstr); 2329 DISALLOW_COPY_AND_ASSIGN(BranchInstr);
2278 }; 2330 };
2279 2331
2280 2332
2281 class StoreContextInstr : public TemplateInstruction<1> { 2333 class StoreContextInstr : public TemplateInstruction<1, NoThrow> {
2282 public: 2334 public:
2283 explicit StoreContextInstr(Value* value) { 2335 explicit StoreContextInstr(Value* value) {
2284 SetInputAt(kValuePos, value); 2336 SetInputAt(kValuePos, value);
2285 } 2337 }
2286 2338
2287 enum { 2339 enum {
2288 kValuePos = 0 2340 kValuePos = 0
2289 }; 2341 };
2290 2342
2291 DECLARE_INSTRUCTION(StoreContext) 2343 DECLARE_INSTRUCTION(StoreContext)
2292 2344
2293 virtual intptr_t ArgumentCount() const { return 0; } 2345 virtual intptr_t ArgumentCount() const { return 0; }
2294 2346
2295 Value* value() const { return inputs_[kValuePos]; } 2347 Value* value() const { return inputs_[kValuePos]; }
2296 2348
2297 virtual bool CanDeoptimize() const { return false; } 2349 virtual bool CanDeoptimize() const { return false; }
2298 2350
2299 virtual EffectSet Effects() const { return EffectSet::None(); } 2351 virtual EffectSet Effects() const { return EffectSet::None(); }
2300 2352
2301 virtual bool MayThrow() const { return false; }
2302
2303 private: 2353 private:
2304 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 2354 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
2305 }; 2355 };
2306 2356
2307 2357
2308 class DeoptimizeInstr : public TemplateInstruction<0> { 2358 class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> {
2309 public: 2359 public:
2310 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) 2360 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id)
2311 : TemplateInstruction<0>(deopt_id), 2361 : TemplateInstruction(deopt_id),
2312 deopt_reason_(deopt_reason) { 2362 deopt_reason_(deopt_reason) {
2313 } 2363 }
2314 2364
2315 virtual intptr_t ArgumentCount() const { return 0; } 2365 virtual intptr_t ArgumentCount() const { return 0; }
2316 2366
2317 virtual bool CanDeoptimize() const { return true; } 2367 virtual bool CanDeoptimize() const { return true; }
2318 2368
2319 virtual bool AllowsCSE() const { return true; }
2320 virtual EffectSet Effects() const { return EffectSet::None(); }
2321 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2322 virtual bool AttributesEqual(Instruction* other) const { 2369 virtual bool AttributesEqual(Instruction* other) const {
2323 return true; 2370 return true;
2324 } 2371 }
2325 2372
2326 virtual bool MayThrow() const { return false; }
2327
2328 DECLARE_INSTRUCTION(Deoptimize) 2373 DECLARE_INSTRUCTION(Deoptimize)
2329 2374
2330 private: 2375 private:
2331 const ICData::DeoptReasonId deopt_reason_; 2376 const ICData::DeoptReasonId deopt_reason_;
2332 2377
2333 DISALLOW_COPY_AND_ASSIGN(DeoptimizeInstr); 2378 DISALLOW_COPY_AND_ASSIGN(DeoptimizeInstr);
2334 }; 2379 };
2335 2380
2336 2381
2337 class RedefinitionInstr : public TemplateDefinition<1> { 2382 class RedefinitionInstr : public TemplateDefinition<1, NoThrow> {
2338 public: 2383 public:
2339 explicit RedefinitionInstr(Value* value) { 2384 explicit RedefinitionInstr(Value* value) {
2340 SetInputAt(0, value); 2385 SetInputAt(0, value);
2341 } 2386 }
2342 2387
2343 DECLARE_INSTRUCTION(Redefinition) 2388 DECLARE_INSTRUCTION(Redefinition)
2344 2389
2345 Value* value() const { return inputs_[0]; } 2390 Value* value() const { return inputs_[0]; }
2346 2391
2347 virtual CompileType ComputeType() const; 2392 virtual CompileType ComputeType() const;
2348 virtual bool RecomputeType(); 2393 virtual bool RecomputeType();
2349 2394
2350 virtual bool CanDeoptimize() const { return false; } 2395 virtual bool CanDeoptimize() const { return false; }
2351 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2396 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2352 virtual EffectSet Effects() const { return EffectSet::None(); } 2397 virtual EffectSet Effects() const { return EffectSet::None(); }
2353 2398
2354 virtual bool MayThrow() const { return false; }
2355
2356 private: 2399 private:
2357 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); 2400 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr);
2358 }; 2401 };
2359 2402
2360 2403
2361 class ConstraintInstr : public TemplateDefinition<1> { 2404 class ConstraintInstr : public TemplateDefinition<1, NoThrow> {
2362 public: 2405 public:
2363 ConstraintInstr(Value* value, Range* constraint) 2406 ConstraintInstr(Value* value, Range* constraint)
2364 : constraint_(constraint), 2407 : constraint_(constraint),
2365 target_(NULL) { 2408 target_(NULL) {
2366 SetInputAt(0, value); 2409 SetInputAt(0, value);
2367 } 2410 }
2368 2411
2369 DECLARE_INSTRUCTION(Constraint) 2412 DECLARE_INSTRUCTION(Constraint)
2370 2413
2371 virtual CompileType ComputeType() const; 2414 virtual CompileType ComputeType() const;
2372 2415
2373 virtual bool CanDeoptimize() const { return false; } 2416 virtual bool CanDeoptimize() const { return false; }
2374 2417
2375 virtual EffectSet Effects() const { return EffectSet::None(); } 2418 virtual EffectSet Effects() const { return EffectSet::None(); }
2376 2419
2377 virtual bool AttributesEqual(Instruction* other) const { 2420 virtual bool AttributesEqual(Instruction* other) const {
2378 UNREACHABLE(); 2421 UNREACHABLE();
2379 return false; 2422 return false;
2380 } 2423 }
2381 2424
2382 virtual bool MayThrow() const { return false; }
2383
2384 virtual void PrintOperandsTo(BufferFormatter* f) const; 2425 virtual void PrintOperandsTo(BufferFormatter* f) const;
2385 2426
2386 Value* value() const { return inputs_[0]; } 2427 Value* value() const { return inputs_[0]; }
2387 Range* constraint() const { return constraint_; } 2428 Range* constraint() const { return constraint_; }
2388 2429
2389 virtual void InferRange(RangeAnalysis* analysis, Range* range); 2430 virtual void InferRange(RangeAnalysis* analysis, Range* range);
2390 2431
2391 // Constraints for branches have their target block stored in order 2432 // Constraints for branches have their target block stored in order
2392 // to find the the comparsion that generated the constraint: 2433 // to find the the comparsion that generated the constraint:
2393 // target->predecessor->last_instruction->comparison. 2434 // target->predecessor->last_instruction->comparison.
2394 void set_target(TargetEntryInstr* target) { 2435 void set_target(TargetEntryInstr* target) {
2395 target_ = target; 2436 target_ = target;
2396 } 2437 }
2397 TargetEntryInstr* target() const { 2438 TargetEntryInstr* target() const {
2398 return target_; 2439 return target_;
2399 } 2440 }
2400 2441
2401 private: 2442 private:
2402 Range* constraint_; 2443 Range* constraint_;
2403 TargetEntryInstr* target_; 2444 TargetEntryInstr* target_;
2404 2445
2405 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); 2446 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr);
2406 }; 2447 };
2407 2448
2408 2449
2409 class ConstantInstr : public TemplateDefinition<0> { 2450 class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> {
2410 public: 2451 public:
2411 explicit ConstantInstr(const Object& value); 2452 explicit ConstantInstr(const Object& value);
2412 2453
2413 DECLARE_INSTRUCTION(Constant) 2454 DECLARE_INSTRUCTION(Constant)
2414 virtual CompileType ComputeType() const; 2455 virtual CompileType ComputeType() const;
2415 2456
2416 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2457 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2417 2458
2418 const Object& value() const { return value_; } 2459 const Object& value() const { return value_; }
2419 2460
2420 virtual void PrintOperandsTo(BufferFormatter* f) const; 2461 virtual void PrintOperandsTo(BufferFormatter* f) const;
2421 2462
2422 virtual bool CanDeoptimize() const { return false; } 2463 virtual bool CanDeoptimize() const { return false; }
2423 2464
2424 virtual void InferRange(RangeAnalysis* analysis, Range* range); 2465 virtual void InferRange(RangeAnalysis* analysis, Range* range);
2425 2466
2426 virtual bool AllowsCSE() const { return true; }
2427 virtual EffectSet Effects() const { return EffectSet::None(); }
2428 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2429 virtual bool AttributesEqual(Instruction* other) const; 2467 virtual bool AttributesEqual(Instruction* other) const;
2430 2468
2431 virtual bool MayThrow() const { return false; }
2432
2433 private: 2469 private:
2434 const Object& value_; 2470 const Object& value_;
2435 2471
2436 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); 2472 DISALLOW_COPY_AND_ASSIGN(ConstantInstr);
2437 }; 2473 };
2438 2474
2439 2475
2440 // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr. 2476 // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr.
2441 // TODO(srdjan): Implemented currently for doubles only, should implement 2477 // TODO(srdjan): Implemented currently for doubles only, should implement
2442 // for other unboxing instructions. 2478 // for other unboxing instructions.
(...skipping 12 matching lines...) Expand all
2455 DECLARE_INSTRUCTION(UnboxedConstant) 2491 DECLARE_INSTRUCTION(UnboxedConstant)
2456 2492
2457 private: 2493 private:
2458 const Representation representation_; 2494 const Representation representation_;
2459 uword constant_address_; // Either NULL or points to the untagged constant. 2495 uword constant_address_; // Either NULL or points to the untagged constant.
2460 2496
2461 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); 2497 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr);
2462 }; 2498 };
2463 2499
2464 2500
2465 class AssertAssignableInstr : public TemplateDefinition<3> { 2501 class AssertAssignableInstr : public TemplateDefinition<3, Throws, Pure> {
2466 public: 2502 public:
2467 AssertAssignableInstr(intptr_t token_pos, 2503 AssertAssignableInstr(intptr_t token_pos,
2468 Value* value, 2504 Value* value,
2469 Value* instantiator, 2505 Value* instantiator,
2470 Value* instantiator_type_arguments, 2506 Value* instantiator_type_arguments,
2471 const AbstractType& dst_type, 2507 const AbstractType& dst_type,
2472 const String& dst_name, 2508 const String& dst_name,
2473 intptr_t deopt_id) 2509 intptr_t deopt_id)
2474 : TemplateDefinition<3>(deopt_id), 2510 : TemplateDefinition(deopt_id),
2475 token_pos_(token_pos), 2511 token_pos_(token_pos),
2476 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), 2512 dst_type_(AbstractType::ZoneHandle(dst_type.raw())),
2477 dst_name_(dst_name) { 2513 dst_name_(dst_name) {
2478 ASSERT(!dst_type.IsNull()); 2514 ASSERT(!dst_type.IsNull());
2479 ASSERT(!dst_name.IsNull()); 2515 ASSERT(!dst_name.IsNull());
2480 SetInputAt(0, value); 2516 SetInputAt(0, value);
2481 SetInputAt(1, instantiator); 2517 SetInputAt(1, instantiator);
2482 SetInputAt(2, instantiator_type_arguments); 2518 SetInputAt(2, instantiator_type_arguments);
2483 } 2519 }
2484 2520
(...skipping 17 matching lines...) Expand all
2502 virtual bool CanDeoptimize() const { return true; } 2538 virtual bool CanDeoptimize() const { return true; }
2503 2539
2504 virtual bool CanBecomeDeoptimizationTarget() const { 2540 virtual bool CanBecomeDeoptimizationTarget() const {
2505 // AssertAssignable instructions that are specialized by the optimizer 2541 // AssertAssignable instructions that are specialized by the optimizer
2506 // (e.g. replaced with CheckClass) need a deoptimization descriptor before. 2542 // (e.g. replaced with CheckClass) need a deoptimization descriptor before.
2507 return true; 2543 return true;
2508 } 2544 }
2509 2545
2510 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2546 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2511 2547
2512 virtual bool AllowsCSE() const { return true; }
2513 virtual EffectSet Effects() const { return EffectSet::None(); }
2514 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2515 virtual bool AttributesEqual(Instruction* other) const; 2548 virtual bool AttributesEqual(Instruction* other) const;
2516 2549
2517 virtual bool MayThrow() const { return true; }
2518
2519 private: 2550 private:
2520 const intptr_t token_pos_; 2551 const intptr_t token_pos_;
2521 AbstractType& dst_type_; 2552 AbstractType& dst_type_;
2522 const String& dst_name_; 2553 const String& dst_name_;
2523 2554
2524 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2555 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2525 }; 2556 };
2526 2557
2527 2558
2528 class AssertBooleanInstr : public TemplateDefinition<1> { 2559 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> {
2529 public: 2560 public:
2530 AssertBooleanInstr(intptr_t token_pos, Value* value) 2561 AssertBooleanInstr(intptr_t token_pos, Value* value)
2531 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), 2562 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
2532 token_pos_(token_pos) { 2563 token_pos_(token_pos) {
2533 SetInputAt(0, value); 2564 SetInputAt(0, value);
2534 } 2565 }
2535 2566
2536 DECLARE_INSTRUCTION(AssertBoolean) 2567 DECLARE_INSTRUCTION(AssertBoolean)
2537 virtual CompileType ComputeType() const; 2568 virtual CompileType ComputeType() const;
2538 2569
2539 virtual intptr_t token_pos() const { return token_pos_; } 2570 virtual intptr_t token_pos() const { return token_pos_; }
2540 Value* value() const { return inputs_[0]; } 2571 Value* value() const { return inputs_[0]; }
2541 2572
2542 virtual void PrintOperandsTo(BufferFormatter* f) const; 2573 virtual void PrintOperandsTo(BufferFormatter* f) const;
2543 2574
2544 virtual bool CanDeoptimize() const { return true; } 2575 virtual bool CanDeoptimize() const { return true; }
2545 2576
2546 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2577 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2547 2578
2548 virtual bool AllowsCSE() const { return true; }
2549 virtual EffectSet Effects() const { return EffectSet::None(); }
2550 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2551 virtual bool AttributesEqual(Instruction* other) const { return true; } 2579 virtual bool AttributesEqual(Instruction* other) const { return true; }
2552 2580
2553 virtual bool MayThrow() const { return true; }
2554
2555 private: 2581 private:
2556 const intptr_t token_pos_; 2582 const intptr_t token_pos_;
2557 2583
2558 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2584 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2559 }; 2585 };
2560 2586
2561 2587
2562 // Denotes the current context, normally held in a register. This is 2588 // Denotes the current context, normally held in a register. This is
2563 // a computation, not a value, because it's mutable. 2589 // a computation, not a value, because it's mutable.
2564 class CurrentContextInstr : public TemplateDefinition<0> { 2590 class CurrentContextInstr : public TemplateDefinition<0, NoThrow> {
2565 public: 2591 public:
2566 CurrentContextInstr() 2592 CurrentContextInstr()
2567 : TemplateDefinition<0>(Isolate::Current()->GetNextDeoptId()) { 2593 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()) {
2568 } 2594 }
2569 2595
2570 DECLARE_INSTRUCTION(CurrentContext) 2596 DECLARE_INSTRUCTION(CurrentContext)
2571 virtual CompileType ComputeType() const; 2597 virtual CompileType ComputeType() const;
2572 2598
2573 virtual bool CanDeoptimize() const { return false; } 2599 virtual bool CanDeoptimize() const { return false; }
2574 2600
2575 virtual EffectSet Effects() const { return EffectSet::None(); } 2601 virtual EffectSet Effects() const { return EffectSet::None(); }
2576 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2602 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2577 virtual bool AttributesEqual(Instruction* other) const { return true; } 2603 virtual bool AttributesEqual(Instruction* other) const { return true; }
2578 2604
2579 virtual bool MayThrow() const { return false; }
2580
2581 private: 2605 private:
2582 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); 2606 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr);
2583 }; 2607 };
2584 2608
2585 2609
2586 class ClosureCallInstr : public TemplateDefinition<1> { 2610 class ClosureCallInstr : public TemplateDefinition<1, Throws> {
2587 public: 2611 public:
2588 ClosureCallInstr(Value* function, 2612 ClosureCallInstr(Value* function,
2589 ClosureCallNode* node, 2613 ClosureCallNode* node,
2590 ZoneGrowableArray<PushArgumentInstr*>* arguments) 2614 ZoneGrowableArray<PushArgumentInstr*>* arguments)
2591 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), 2615 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
2592 ast_node_(*node), 2616 ast_node_(*node),
2593 arguments_(arguments) { 2617 arguments_(arguments) {
2594 SetInputAt(0, function); 2618 SetInputAt(0, function);
2595 } 2619 }
2596 2620
2597 DECLARE_INSTRUCTION(ClosureCall) 2621 DECLARE_INSTRUCTION(ClosureCall)
2598 2622
2599 const Array& argument_names() const { return ast_node_.arguments()->names(); } 2623 const Array& argument_names() const { return ast_node_.arguments()->names(); }
2600 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } 2624 virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
2601 2625
2602 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2626 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2603 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2627 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
2604 return (*arguments_)[index]; 2628 return (*arguments_)[index];
2605 } 2629 }
2606 2630
2607 // TODO(kmillikin): implement exact call counts for closure calls. 2631 // TODO(kmillikin): implement exact call counts for closure calls.
2608 virtual intptr_t CallCount() const { return 1; } 2632 virtual intptr_t CallCount() const { return 1; }
2609 2633
2610 virtual void PrintOperandsTo(BufferFormatter* f) const; 2634 virtual void PrintOperandsTo(BufferFormatter* f) const;
2611 2635
2612 virtual bool CanDeoptimize() const { return true; } 2636 virtual bool CanDeoptimize() const { return true; }
2613 2637
2614 virtual EffectSet Effects() const { return EffectSet::All(); } 2638 virtual EffectSet Effects() const { return EffectSet::All(); }
2615 2639
2616 virtual bool MayThrow() const { return true; }
2617
2618 private: 2640 private:
2619 const ClosureCallNode& ast_node_; 2641 const ClosureCallNode& ast_node_;
2620 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 2642 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
2621 2643
2622 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); 2644 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr);
2623 }; 2645 };
2624 2646
2625 2647
2626 class InstanceCallInstr : public TemplateDefinition<0> { 2648 class InstanceCallInstr : public TemplateDefinition<0, Throws> {
2627 public: 2649 public:
2628 InstanceCallInstr(intptr_t token_pos, 2650 InstanceCallInstr(intptr_t token_pos,
2629 const String& function_name, 2651 const String& function_name,
2630 Token::Kind token_kind, 2652 Token::Kind token_kind,
2631 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2653 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2632 const Array& argument_names, 2654 const Array& argument_names,
2633 intptr_t checked_argument_count, 2655 intptr_t checked_argument_count,
2634 const ZoneGrowableArray<const ICData*>& ic_data_array) 2656 const ZoneGrowableArray<const ICData*>& ic_data_array)
2635 : TemplateDefinition<0>(Isolate::Current()->GetNextDeoptId()), 2657 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
2636 ic_data_(NULL), 2658 ic_data_(NULL),
2637 token_pos_(token_pos), 2659 token_pos_(token_pos),
2638 function_name_(function_name), 2660 function_name_(function_name),
2639 token_kind_(token_kind), 2661 token_kind_(token_kind),
2640 arguments_(arguments), 2662 arguments_(arguments),
2641 argument_names_(argument_names), 2663 argument_names_(argument_names),
2642 checked_argument_count_(checked_argument_count) { 2664 checked_argument_count_(checked_argument_count) {
2643 ic_data_ = GetICData(ic_data_array); 2665 ic_data_ = GetICData(ic_data_array);
2644 ASSERT(function_name.IsNotTemporaryScopedHandle()); 2666 ASSERT(function_name.IsNotTemporaryScopedHandle());
2645 ASSERT(!arguments->is_empty()); 2667 ASSERT(!arguments->is_empty());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2681 virtual bool CanDeoptimize() const { return true; } 2703 virtual bool CanDeoptimize() const { return true; }
2682 2704
2683 virtual bool CanBecomeDeoptimizationTarget() const { 2705 virtual bool CanBecomeDeoptimizationTarget() const {
2684 // Instance calls that are specialized by the optimizer need a 2706 // Instance calls that are specialized by the optimizer need a
2685 // deoptimization descriptor before the call. 2707 // deoptimization descriptor before the call.
2686 return true; 2708 return true;
2687 } 2709 }
2688 2710
2689 virtual EffectSet Effects() const { return EffectSet::All(); } 2711 virtual EffectSet Effects() const { return EffectSet::All(); }
2690 2712
2691 virtual bool MayThrow() const { return true; }
2692
2693 protected: 2713 protected:
2694 friend class FlowGraphOptimizer; 2714 friend class FlowGraphOptimizer;
2695 void set_ic_data(ICData* value) { ic_data_ = value; } 2715 void set_ic_data(ICData* value) { ic_data_ = value; }
2696 2716
2697 private: 2717 private:
2698 const ICData* ic_data_; 2718 const ICData* ic_data_;
2699 const intptr_t token_pos_; 2719 const intptr_t token_pos_;
2700 const String& function_name_; 2720 const String& function_name_;
2701 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. 2721 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL.
2702 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 2722 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
2703 const Array& argument_names_; 2723 const Array& argument_names_;
2704 const intptr_t checked_argument_count_; 2724 const intptr_t checked_argument_count_;
2705 2725
2706 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); 2726 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr);
2707 }; 2727 };
2708 2728
2709 2729
2710 class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { 2730 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> {
2711 public: 2731 public:
2712 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, 2732 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call,
2713 const ICData& ic_data, 2733 const ICData& ic_data,
2714 bool with_checks) 2734 bool with_checks)
2715 : TemplateDefinition<0>(instance_call->deopt_id()), 2735 : TemplateDefinition(instance_call->deopt_id()),
2716 instance_call_(instance_call), 2736 instance_call_(instance_call),
2717 ic_data_(ic_data), 2737 ic_data_(ic_data),
2718 with_checks_(with_checks) { 2738 with_checks_(with_checks) {
2719 ASSERT(instance_call_ != NULL); 2739 ASSERT(instance_call_ != NULL);
2720 ASSERT(ic_data.NumberOfChecks() > 0); 2740 ASSERT(ic_data.NumberOfChecks() > 0);
2721 } 2741 }
2722 2742
2723 InstanceCallInstr* instance_call() const { return instance_call_; } 2743 InstanceCallInstr* instance_call() const { return instance_call_; }
2724 bool with_checks() const { return with_checks_; } 2744 bool with_checks() const { return with_checks_; }
2725 virtual intptr_t token_pos() const { return instance_call_->token_pos(); } 2745 virtual intptr_t token_pos() const { return instance_call_->token_pos(); }
(...skipping 14 matching lines...) Expand all
2740 DECLARE_INSTRUCTION(PolymorphicInstanceCall) 2760 DECLARE_INSTRUCTION(PolymorphicInstanceCall)
2741 2761
2742 const ICData& ic_data() const { return ic_data_; } 2762 const ICData& ic_data() const { return ic_data_; }
2743 2763
2744 virtual bool CanDeoptimize() const { return true; } 2764 virtual bool CanDeoptimize() const { return true; }
2745 2765
2746 virtual EffectSet Effects() const { return EffectSet::All(); } 2766 virtual EffectSet Effects() const { return EffectSet::All(); }
2747 2767
2748 virtual void PrintOperandsTo(BufferFormatter* f) const; 2768 virtual void PrintOperandsTo(BufferFormatter* f) const;
2749 2769
2750 virtual bool MayThrow() const { return true; }
2751
2752 private: 2770 private:
2753 InstanceCallInstr* instance_call_; 2771 InstanceCallInstr* instance_call_;
2754 const ICData& ic_data_; 2772 const ICData& ic_data_;
2755 const bool with_checks_; 2773 const bool with_checks_;
2756 2774
2757 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 2775 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
2758 }; 2776 };
2759 2777
2760 2778
2761 class StrictCompareInstr : public ComparisonInstr { 2779 class StrictCompareInstr : public ComparisonInstr {
(...skipping 18 matching lines...) Expand all
2780 2798
2781 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2799 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2782 BranchInstr* branch); 2800 BranchInstr* branch);
2783 2801
2784 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2802 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2785 BranchLabels labels); 2803 BranchLabels labels);
2786 2804
2787 bool needs_number_check() const { return needs_number_check_; } 2805 bool needs_number_check() const { return needs_number_check_; }
2788 void set_needs_number_check(bool value) { needs_number_check_ = value; } 2806 void set_needs_number_check(bool value) { needs_number_check_ = value; }
2789 2807
2790 virtual bool AllowsCSE() const { return true; } 2808 bool AttributesEqual(Instruction* other) const;
2791 virtual EffectSet Effects() const { return EffectSet::None(); }
2792 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2793 virtual bool AttributesEqual(Instruction* other) const;
2794
2795 virtual bool MayThrow() const { return false; }
2796 2809
2797 private: 2810 private:
2798 // True if the comparison must check for double, Mint or Bigint and 2811 // True if the comparison must check for double, Mint or Bigint and
2799 // use value comparison instead. 2812 // use value comparison instead.
2800 bool needs_number_check_; 2813 bool needs_number_check_;
2801 2814
2802 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); 2815 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr);
2803 }; 2816 };
2804 2817
2805 2818
(...skipping 11 matching lines...) Expand all
2817 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 2830 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
2818 2831
2819 virtual CompileType ComputeType() const; 2832 virtual CompileType ComputeType() const;
2820 2833
2821 virtual bool CanDeoptimize() const { return false; } 2834 virtual bool CanDeoptimize() const { return false; }
2822 2835
2823 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2836 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2824 return kTagged; 2837 return kTagged;
2825 } 2838 }
2826 2839
2827 virtual EffectSet Effects() const { return EffectSet::None(); }
2828
2829 virtual bool MayThrow() const { return false; }
2830
2831 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2840 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2832 BranchInstr* branch); 2841 BranchInstr* branch);
2833 2842
2834 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2843 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2835 BranchLabels labels); 2844 BranchLabels labels);
2836 2845
2837 private: 2846 private:
2838 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); 2847 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr);
2839 }; 2848 };
2840 2849
(...skipping 28 matching lines...) Expand all
2869 virtual CompileType ComputeType() const; 2878 virtual CompileType ComputeType() const;
2870 2879
2871 virtual bool CanDeoptimize() const { 2880 virtual bool CanDeoptimize() const {
2872 return GetDeoptId() != Isolate::kNoDeoptId; 2881 return GetDeoptId() != Isolate::kNoDeoptId;
2873 } 2882 }
2874 2883
2875 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2884 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2876 return kTagged; 2885 return kTagged;
2877 } 2886 }
2878 2887
2879 virtual EffectSet Effects() const { return EffectSet::None(); }
2880 virtual bool AllowsCSE() const { return true; }
2881 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2882
2883 virtual bool MayThrow() const { return false; }
2884
2885 virtual bool AttributesEqual(Instruction* other) const; 2888 virtual bool AttributesEqual(Instruction* other) const;
2886 2889
2887 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2890 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2888 BranchInstr* branch); 2891 BranchInstr* branch);
2889 2892
2890 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2893 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2891 BranchLabels labels); 2894 BranchLabels labels);
2892 2895
2893 virtual void PrintOperandsTo(BufferFormatter* f) const; 2896 virtual void PrintOperandsTo(BufferFormatter* f) const;
2894 2897
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2927 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2930 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2928 BranchLabels labels); 2931 BranchLabels labels);
2929 2932
2930 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2933 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2931 ASSERT((idx == 0) || (idx == 1)); 2934 ASSERT((idx == 0) || (idx == 1));
2932 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 2935 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
2933 if (operation_cid() == kMintCid) return kUnboxedMint; 2936 if (operation_cid() == kMintCid) return kUnboxedMint;
2934 return kTagged; 2937 return kTagged;
2935 } 2938 }
2936 2939
2937 virtual EffectSet Effects() const { return EffectSet::None(); }
2938
2939 virtual bool MayThrow() const { return false; }
2940
2941 private: 2940 private:
2942 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); 2941 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
2943 }; 2942 };
2944 2943
2945 2944
2946 class RelationalOpInstr : public ComparisonInstr { 2945 class RelationalOpInstr : public ComparisonInstr {
2947 public: 2946 public:
2948 RelationalOpInstr(intptr_t token_pos, 2947 RelationalOpInstr(intptr_t token_pos,
2949 Token::Kind kind, 2948 Token::Kind kind,
2950 Value* left, 2949 Value* left,
(...skipping 21 matching lines...) Expand all
2972 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2971 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2973 BranchLabels labels); 2972 BranchLabels labels);
2974 2973
2975 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2974 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2976 ASSERT((idx == 0) || (idx == 1)); 2975 ASSERT((idx == 0) || (idx == 1));
2977 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 2976 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
2978 if (operation_cid() == kMintCid) return kUnboxedMint; 2977 if (operation_cid() == kMintCid) return kUnboxedMint;
2979 return kTagged; 2978 return kTagged;
2980 } 2979 }
2981 2980
2982 virtual EffectSet Effects() const {
2983 return EffectSet::None();
2984 }
2985
2986 virtual bool MayThrow() const { return false; }
2987
2988 private: 2981 private:
2989 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); 2982 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
2990 }; 2983 };
2991 2984
2992 2985
2993 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for 2986 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for
2994 // materialization of true and false constants. 2987 // materialization of true and false constants.
2995 class IfThenElseInstr : public Definition { 2988 class IfThenElseInstr : public Definition {
2996 public: 2989 public:
2997 IfThenElseInstr(ComparisonInstr* comparison, 2990 IfThenElseInstr(ComparisonInstr* comparison,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 } 3057 }
3065 3058
3066 ComparisonInstr* comparison_; 3059 ComparisonInstr* comparison_;
3067 const intptr_t if_true_; 3060 const intptr_t if_true_;
3068 const intptr_t if_false_; 3061 const intptr_t if_false_;
3069 3062
3070 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); 3063 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr);
3071 }; 3064 };
3072 3065
3073 3066
3074 class StaticCallInstr : public TemplateDefinition<0> { 3067 class StaticCallInstr : public TemplateDefinition<0, Throws> {
3075 public: 3068 public:
3076 StaticCallInstr(intptr_t token_pos, 3069 StaticCallInstr(intptr_t token_pos,
3077 const Function& function, 3070 const Function& function,
3078 const Array& argument_names, 3071 const Array& argument_names,
3079 ZoneGrowableArray<PushArgumentInstr*>* arguments, 3072 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3080 const ZoneGrowableArray<const ICData*>& ic_data_array) 3073 const ZoneGrowableArray<const ICData*>& ic_data_array)
3081 : TemplateDefinition<0>(Isolate::Current()->GetNextDeoptId()), 3074 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
3082 ic_data_(NULL), 3075 ic_data_(NULL),
3083 token_pos_(token_pos), 3076 token_pos_(token_pos),
3084 function_(function), 3077 function_(function),
3085 argument_names_(argument_names), 3078 argument_names_(argument_names),
3086 arguments_(arguments), 3079 arguments_(arguments),
3087 result_cid_(kDynamicCid), 3080 result_cid_(kDynamicCid),
3088 is_known_list_constructor_(false), 3081 is_known_list_constructor_(false),
3089 is_native_list_factory_(false), 3082 is_native_list_factory_(false),
3090 identity_(AliasIdentity::Unknown()) { 3083 identity_(AliasIdentity::Unknown()) {
3091 ic_data_ = GetICData(ic_data_array); 3084 ic_data_ = GetICData(ic_data_array);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3135 3128
3136 bool is_native_list_factory() const { return is_native_list_factory_; } 3129 bool is_native_list_factory() const { return is_native_list_factory_; }
3137 void set_is_native_list_factory(bool value) { 3130 void set_is_native_list_factory(bool value) {
3138 is_native_list_factory_ = value; 3131 is_native_list_factory_ = value;
3139 } 3132 }
3140 3133
3141 bool IsRecognizedFactory() const { 3134 bool IsRecognizedFactory() const {
3142 return is_known_list_constructor() || is_native_list_factory(); 3135 return is_known_list_constructor() || is_native_list_factory();
3143 } 3136 }
3144 3137
3145 virtual bool MayThrow() const { return true; }
3146
3147 virtual AliasIdentity Identity() const { return identity_; } 3138 virtual AliasIdentity Identity() const { return identity_; }
3148 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } 3139 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; }
3149 3140
3150 private: 3141 private:
3151 const ICData* ic_data_; 3142 const ICData* ic_data_;
3152 const intptr_t token_pos_; 3143 const intptr_t token_pos_;
3153 const Function& function_; 3144 const Function& function_;
3154 const Array& argument_names_; 3145 const Array& argument_names_;
3155 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 3146 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
3156 intptr_t result_cid_; // For some library functions we know the result. 3147 intptr_t result_cid_; // For some library functions we know the result.
3157 3148
3158 // 'True' for recognized list constructors. 3149 // 'True' for recognized list constructors.
3159 bool is_known_list_constructor_; 3150 bool is_known_list_constructor_;
3160 bool is_native_list_factory_; 3151 bool is_native_list_factory_;
3161 3152
3162 AliasIdentity identity_; 3153 AliasIdentity identity_;
3163 3154
3164 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); 3155 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
3165 }; 3156 };
3166 3157
3167 3158
3168 class LoadLocalInstr : public TemplateDefinition<0> { 3159 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> {
3169 public: 3160 public:
3170 explicit LoadLocalInstr(const LocalVariable& local) 3161 explicit LoadLocalInstr(const LocalVariable& local)
3171 : local_(local), is_last_(false) { } 3162 : local_(local), is_last_(false) { }
3172 3163
3173 DECLARE_INSTRUCTION(LoadLocal) 3164 DECLARE_INSTRUCTION(LoadLocal)
3174 virtual CompileType ComputeType() const; 3165 virtual CompileType ComputeType() const;
3175 3166
3176 const LocalVariable& local() const { return local_; } 3167 const LocalVariable& local() const { return local_; }
3177 3168
3178 virtual void PrintOperandsTo(BufferFormatter* f) const; 3169 virtual void PrintOperandsTo(BufferFormatter* f) const;
3179 3170
3180 virtual bool CanDeoptimize() const { return false; } 3171 virtual bool CanDeoptimize() const { return false; }
3181 3172
3182 virtual EffectSet Effects() const { 3173 virtual EffectSet Effects() const {
3183 UNREACHABLE(); // Eliminated by SSA construction. 3174 UNREACHABLE(); // Eliminated by SSA construction.
3184 return EffectSet::None(); 3175 return EffectSet::None();
3185 } 3176 }
3186 3177
3187 void mark_last() { is_last_ = true; } 3178 void mark_last() { is_last_ = true; }
3188 bool is_last() const { return is_last_; } 3179 bool is_last() const { return is_last_; }
3189 3180
3190 virtual bool MayThrow() const {
3191 UNREACHABLE();
3192 return false;
3193 }
3194
3195 private: 3181 private:
3196 const LocalVariable& local_; 3182 const LocalVariable& local_;
3197 bool is_last_; 3183 bool is_last_;
3198 3184
3199 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); 3185 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr);
3200 }; 3186 };
3201 3187
3202 3188
3203 class PushTempInstr : public TemplateDefinition<1> { 3189 class PushTempInstr : public TemplateDefinition<1, NoThrow> {
3204 public: 3190 public:
3205 explicit PushTempInstr(Value* value) { 3191 explicit PushTempInstr(Value* value) {
3206 SetInputAt(0, value); 3192 SetInputAt(0, value);
3207 } 3193 }
3208 3194
3209 DECLARE_INSTRUCTION(PushTemp) 3195 DECLARE_INSTRUCTION(PushTemp)
3210 3196
3211 Value* value() const { return inputs_[0]; } 3197 Value* value() const { return inputs_[0]; }
3212 3198
3213 virtual CompileType ComputeType() const; 3199 virtual CompileType ComputeType() const;
3214 3200
3215 virtual bool CanDeoptimize() const { return false; } 3201 virtual bool CanDeoptimize() const { return false; }
3216 3202
3217 virtual EffectSet Effects() const { 3203 virtual EffectSet Effects() const {
3218 UNREACHABLE(); // Eliminated by SSA construction. 3204 UNREACHABLE(); // Eliminated by SSA construction.
3219 return EffectSet::None(); 3205 return EffectSet::None();
3220 } 3206 }
3221 3207
3222 virtual bool MayThrow() const {
3223 UNREACHABLE();
3224 return false;
3225 }
3226
3227 private: 3208 private:
3228 DISALLOW_COPY_AND_ASSIGN(PushTempInstr); 3209 DISALLOW_COPY_AND_ASSIGN(PushTempInstr);
3229 }; 3210 };
3230 3211
3231 3212
3232 class DropTempsInstr : public Definition { 3213 class DropTempsInstr : public Definition {
3233 public: 3214 public:
3234 explicit DropTempsInstr(intptr_t num_temps, Value* value = NULL) 3215 explicit DropTempsInstr(intptr_t num_temps, Value* value = NULL)
3235 : num_temps_(num_temps), value_(NULL) { 3216 : num_temps_(num_temps), value_(NULL) {
3236 if (value != NULL) { 3217 if (value != NULL) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3271 value_ = value; 3252 value_ = value;
3272 } 3253 }
3273 3254
3274 const intptr_t num_temps_; 3255 const intptr_t num_temps_;
3275 Value* value_; 3256 Value* value_;
3276 3257
3277 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); 3258 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr);
3278 }; 3259 };
3279 3260
3280 3261
3281 class StoreLocalInstr : public TemplateDefinition<1> { 3262 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> {
3282 public: 3263 public:
3283 StoreLocalInstr(const LocalVariable& local, Value* value) 3264 StoreLocalInstr(const LocalVariable& local, Value* value)
3284 : local_(local), is_dead_(false), is_last_(false) { 3265 : local_(local), is_dead_(false), is_last_(false) {
3285 SetInputAt(0, value); 3266 SetInputAt(0, value);
3286 } 3267 }
3287 3268
3288 DECLARE_INSTRUCTION(StoreLocal) 3269 DECLARE_INSTRUCTION(StoreLocal)
3289 virtual CompileType* ComputeInitialType() const; 3270 virtual CompileType* ComputeInitialType() const;
3290 3271
3291 const LocalVariable& local() const { return local_; } 3272 const LocalVariable& local() const { return local_; }
3292 Value* value() const { return inputs_[0]; } 3273 Value* value() const { return inputs_[0]; }
3293 3274
3294 virtual void PrintOperandsTo(BufferFormatter* f) const; 3275 virtual void PrintOperandsTo(BufferFormatter* f) const;
3295 3276
3296 virtual bool CanDeoptimize() const { return false; } 3277 virtual bool CanDeoptimize() const { return false; }
3297 3278
3298 void mark_dead() { is_dead_ = true; } 3279 void mark_dead() { is_dead_ = true; }
3299 bool is_dead() const { return is_dead_; } 3280 bool is_dead() const { return is_dead_; }
3300 3281
3301 void mark_last() { is_last_ = true; } 3282 void mark_last() { is_last_ = true; }
3302 bool is_last() const { return is_last_; } 3283 bool is_last() const { return is_last_; }
3303 3284
3304 virtual EffectSet Effects() const { 3285 virtual EffectSet Effects() const {
3305 UNREACHABLE(); // Eliminated by SSA construction. 3286 UNREACHABLE(); // Eliminated by SSA construction.
3306 return EffectSet::None(); 3287 return EffectSet::None();
3307 } 3288 }
3308 3289
3309 virtual bool MayThrow() const {
3310 UNREACHABLE();
3311 return false;
3312 }
3313
3314 private: 3290 private:
3315 const LocalVariable& local_; 3291 const LocalVariable& local_;
3316 bool is_dead_; 3292 bool is_dead_;
3317 bool is_last_; 3293 bool is_last_;
3318 3294
3319 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); 3295 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr);
3320 }; 3296 };
3321 3297
3322 3298
3323 class NativeCallInstr : public TemplateDefinition<0> { 3299 class NativeCallInstr : public TemplateDefinition<0, Throws> {
3324 public: 3300 public:
3325 explicit NativeCallInstr(NativeBodyNode* node) 3301 explicit NativeCallInstr(NativeBodyNode* node)
3326 : ast_node_(*node) {} 3302 : ast_node_(*node) {}
3327 3303
3328 DECLARE_INSTRUCTION(NativeCall) 3304 DECLARE_INSTRUCTION(NativeCall)
3329 3305
3330 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } 3306 virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
3331 3307
3332 const Function& function() const { return ast_node_.function(); } 3308 const Function& function() const { return ast_node_.function(); }
3333 3309
3334 const String& native_name() const { 3310 const String& native_name() const {
3335 return ast_node_.native_c_function_name(); 3311 return ast_node_.native_c_function_name();
3336 } 3312 }
3337 3313
3338 NativeFunction native_c_function() const { 3314 NativeFunction native_c_function() const {
3339 return ast_node_.native_c_function(); 3315 return ast_node_.native_c_function();
3340 } 3316 }
3341 3317
3342 bool is_bootstrap_native() const { 3318 bool is_bootstrap_native() const {
3343 return ast_node_.is_bootstrap_native(); 3319 return ast_node_.is_bootstrap_native();
3344 } 3320 }
3345 3321
3346 virtual void PrintOperandsTo(BufferFormatter* f) const; 3322 virtual void PrintOperandsTo(BufferFormatter* f) const;
3347 3323
3348 virtual bool CanDeoptimize() const { return false; } 3324 virtual bool CanDeoptimize() const { return false; }
3349 3325
3350 virtual EffectSet Effects() const { return EffectSet::All(); } 3326 virtual EffectSet Effects() const { return EffectSet::All(); }
3351 3327
3352 virtual bool MayThrow() const {
3353 UNREACHABLE();
3354 return true;
3355 }
3356
3357 private: 3328 private:
3358 const NativeBodyNode& ast_node_; 3329 const NativeBodyNode& ast_node_;
3359 3330
3360 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); 3331 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr);
3361 }; 3332 };
3362 3333
3363 3334
3364 class DebugStepCheckInstr : public TemplateInstruction<0> { 3335 class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> {
3365 public: 3336 public:
3366 DebugStepCheckInstr(intptr_t token_pos, 3337 DebugStepCheckInstr(intptr_t token_pos,
3367 RawPcDescriptors::Kind stub_kind) 3338 RawPcDescriptors::Kind stub_kind)
3368 : token_pos_(token_pos), 3339 : token_pos_(token_pos),
3369 stub_kind_(stub_kind) { 3340 stub_kind_(stub_kind) {
3370 } 3341 }
3371 3342
3372 DECLARE_INSTRUCTION(DebugStepCheck) 3343 DECLARE_INSTRUCTION(DebugStepCheck)
3373 3344
3374 virtual intptr_t token_pos() const { return token_pos_; } 3345 virtual intptr_t token_pos() const { return token_pos_; }
3375 virtual bool MayThrow() const { return false; }
3376 virtual bool CanDeoptimize() const { return false; } 3346 virtual bool CanDeoptimize() const { return false; }
3377 virtual EffectSet Effects() const { return EffectSet::All(); } 3347 virtual EffectSet Effects() const { return EffectSet::All(); }
3378 virtual intptr_t ArgumentCount() const { return 0; } 3348 virtual intptr_t ArgumentCount() const { return 0; }
3379 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 3349 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
3380 3350
3381 private: 3351 private:
3382 const intptr_t token_pos_; 3352 const intptr_t token_pos_;
3383 const RawPcDescriptors::Kind stub_kind_; 3353 const RawPcDescriptors::Kind stub_kind_;
3384 3354
3385 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); 3355 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr);
3386 }; 3356 };
3387 3357
3388 3358
3389 enum StoreBarrierType { 3359 enum StoreBarrierType {
3390 kNoStoreBarrier, 3360 kNoStoreBarrier,
3391 kEmitStoreBarrier 3361 kEmitStoreBarrier
3392 }; 3362 };
3393 3363
3394 3364
3395 class StoreInstanceFieldInstr : public TemplateDefinition<2> { 3365 class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> {
3396 public: 3366 public:
3397 StoreInstanceFieldInstr(const Field& field, 3367 StoreInstanceFieldInstr(const Field& field,
3398 Value* instance, 3368 Value* instance,
3399 Value* value, 3369 Value* value,
3400 StoreBarrierType emit_store_barrier, 3370 StoreBarrierType emit_store_barrier,
3401 intptr_t token_pos) 3371 intptr_t token_pos)
3402 : field_(field), 3372 : field_(field),
3403 offset_in_bytes_(field.Offset()), 3373 offset_in_bytes_(field.Offset()),
3404 emit_store_barrier_(emit_store_barrier), 3374 emit_store_barrier_(emit_store_barrier),
3405 token_pos_(token_pos), 3375 token_pos_(token_pos),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 // May require a deoptimization target for input conversions. 3423 // May require a deoptimization target for input conversions.
3454 virtual intptr_t DeoptimizationTarget() const { 3424 virtual intptr_t DeoptimizationTarget() const {
3455 return GetDeoptId(); 3425 return GetDeoptId();
3456 } 3426 }
3457 3427
3458 // Currently CSE/LICM don't operate on any instructions that can be affected 3428 // Currently CSE/LICM don't operate on any instructions that can be affected
3459 // by stores/loads. LoadOptimizer handles loads separately. Hence stores 3429 // by stores/loads. LoadOptimizer handles loads separately. Hence stores
3460 // are marked as having no side-effects. 3430 // are marked as having no side-effects.
3461 virtual EffectSet Effects() const { return EffectSet::None(); } 3431 virtual EffectSet Effects() const { return EffectSet::None(); }
3462 3432
3463 virtual bool MayThrow() const { return false; }
3464
3465 bool IsUnboxedStore() const; 3433 bool IsUnboxedStore() const;
3466 3434
3467 bool IsPotentialUnboxedStore() const; 3435 bool IsPotentialUnboxedStore() const;
3468 3436
3469 virtual Representation RequiredInputRepresentation(intptr_t index) const; 3437 virtual Representation RequiredInputRepresentation(intptr_t index) const;
3470 3438
3471 private: 3439 private:
3472 friend class FlowGraphOptimizer; // For ASSERT(initialization_). 3440 friend class FlowGraphOptimizer; // For ASSERT(initialization_).
3473 3441
3474 bool CanValueBeSmi() const { 3442 bool CanValueBeSmi() const {
3475 const intptr_t cid = value()->Type()->ToNullableCid(); 3443 const intptr_t cid = value()->Type()->ToNullableCid();
3476 // Write barrier is skipped for nullable and non-nullable smis. 3444 // Write barrier is skipped for nullable and non-nullable smis.
3477 ASSERT(cid != kSmiCid); 3445 ASSERT(cid != kSmiCid);
3478 return (cid == kDynamicCid); 3446 return (cid == kDynamicCid);
3479 } 3447 }
3480 3448
3481 const Field& field_; 3449 const Field& field_;
3482 intptr_t offset_in_bytes_; 3450 intptr_t offset_in_bytes_;
3483 const StoreBarrierType emit_store_barrier_; 3451 const StoreBarrierType emit_store_barrier_;
3484 const intptr_t token_pos_; 3452 const intptr_t token_pos_;
3485 bool is_initialization_; // Marks stores in the constructor. 3453 bool is_initialization_; // Marks stores in the constructor.
3486 3454
3487 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); 3455 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr);
3488 }; 3456 };
3489 3457
3490 3458
3491 class GuardFieldInstr : public TemplateInstruction<1> { 3459 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> {
3492 public: 3460 public:
3493 GuardFieldInstr(Value* value, 3461 GuardFieldInstr(Value* value,
3494 const Field& field, 3462 const Field& field,
3495 intptr_t deopt_id) 3463 intptr_t deopt_id)
3496 : TemplateInstruction<1>(deopt_id), 3464 : TemplateInstruction(deopt_id),
3497 field_(field) { 3465 field_(field) {
3498 SetInputAt(0, value); 3466 SetInputAt(0, value);
3499 } 3467 }
3500 3468
3501 Value* value() const { return inputs_[0]; } 3469 Value* value() const { return inputs_[0]; }
3502 3470
3503 const Field& field() const { return field_; } 3471 const Field& field() const { return field_; }
3504 3472
3505 virtual intptr_t ArgumentCount() const { return 0; } 3473 virtual intptr_t ArgumentCount() const { return 0; }
3506 3474
3507 virtual bool CanDeoptimize() const { return true; } 3475 virtual bool CanDeoptimize() const { return true; }
3508 virtual bool CanBecomeDeoptimizationTarget() const { 3476 virtual bool CanBecomeDeoptimizationTarget() const {
3509 // Ensure that we record kDeopt PC descriptor in unoptimized code. 3477 // Ensure that we record kDeopt PC descriptor in unoptimized code.
3510 return true; 3478 return true;
3511 } 3479 }
3512 3480
3513 virtual bool AllowsCSE() const { return true; }
3514 virtual EffectSet Effects() const { return EffectSet::None(); }
3515 virtual EffectSet Dependencies() const { return EffectSet::None(); }
3516
3517 virtual bool MayThrow() const { return false; }
3518
3519 virtual void PrintOperandsTo(BufferFormatter* f) const; 3481 virtual void PrintOperandsTo(BufferFormatter* f) const;
3520 3482
3521 private: 3483 private:
3522 const Field& field_; 3484 const Field& field_;
3523 3485
3524 DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr); 3486 DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr);
3525 }; 3487 };
3526 3488
3527 3489
3528 class GuardFieldClassInstr : public GuardFieldInstr { 3490 class GuardFieldClassInstr : public GuardFieldInstr {
(...skipping 25 matching lines...) Expand all
3554 3516
3555 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 3517 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
3556 3518
3557 virtual bool AttributesEqual(Instruction* other) const; 3519 virtual bool AttributesEqual(Instruction* other) const;
3558 3520
3559 private: 3521 private:
3560 DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr); 3522 DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr);
3561 }; 3523 };
3562 3524
3563 3525
3564 class LoadStaticFieldInstr : public TemplateDefinition<1> { 3526 class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> {
3565 public: 3527 public:
3566 explicit LoadStaticFieldInstr(Value* field_value) { 3528 explicit LoadStaticFieldInstr(Value* field_value) {
3567 ASSERT(field_value->BindsToConstant()); 3529 ASSERT(field_value->BindsToConstant());
3568 SetInputAt(0, field_value); 3530 SetInputAt(0, field_value);
3569 } 3531 }
3570 3532
3571 DECLARE_INSTRUCTION(LoadStaticField) 3533 DECLARE_INSTRUCTION(LoadStaticField)
3572 virtual CompileType ComputeType() const; 3534 virtual CompileType ComputeType() const;
3573 3535
3574 const Field& StaticField() const; 3536 const Field& StaticField() const;
3575 3537
3576 Value* field_value() const { return inputs_[0]; } 3538 Value* field_value() const { return inputs_[0]; }
3577 3539
3578 virtual void PrintOperandsTo(BufferFormatter* f) const; 3540 virtual void PrintOperandsTo(BufferFormatter* f) const;
3579 3541
3580 virtual bool CanDeoptimize() const { return false; } 3542 virtual bool CanDeoptimize() const { return false; }
3581 3543
3582 virtual bool AllowsCSE() const { return StaticField().is_final(); } 3544 virtual bool AllowsCSE() const { return StaticField().is_final(); }
3583 virtual EffectSet Effects() const { return EffectSet::None(); } 3545 virtual EffectSet Effects() const { return EffectSet::None(); }
3584 virtual EffectSet Dependencies() const; 3546 virtual EffectSet Dependencies() const;
3585 virtual bool AttributesEqual(Instruction* other) const; 3547 virtual bool AttributesEqual(Instruction* other) const;
3586 3548
3587 virtual bool MayThrow() const { return false; }
3588
3589 private: 3549 private:
3590 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); 3550 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr);
3591 }; 3551 };
3592 3552
3593 3553
3594 class StoreStaticFieldInstr : public TemplateDefinition<1> { 3554 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> {
3595 public: 3555 public:
3596 StoreStaticFieldInstr(const Field& field, Value* value) 3556 StoreStaticFieldInstr(const Field& field, Value* value)
3597 : field_(field) { 3557 : field_(field) {
3598 ASSERT(field.IsZoneHandle()); 3558 ASSERT(field.IsZoneHandle());
3599 SetInputAt(kValuePos, value); 3559 SetInputAt(kValuePos, value);
3600 } 3560 }
3601 3561
3602 enum { 3562 enum {
3603 kValuePos = 0 3563 kValuePos = 0
3604 }; 3564 };
3605 3565
3606 DECLARE_INSTRUCTION(StoreStaticField) 3566 DECLARE_INSTRUCTION(StoreStaticField)
3607 virtual CompileType* ComputeInitialType() const; 3567 virtual CompileType* ComputeInitialType() const;
3608 3568
3609 const Field& field() const { return field_; } 3569 const Field& field() const { return field_; }
3610 Value* value() const { return inputs_[kValuePos]; } 3570 Value* value() const { return inputs_[kValuePos]; }
3611 3571
3612 virtual void PrintOperandsTo(BufferFormatter* f) const; 3572 virtual void PrintOperandsTo(BufferFormatter* f) const;
3613 3573
3614 virtual bool CanDeoptimize() const { return false; } 3574 virtual bool CanDeoptimize() const { return false; }
3615 3575
3616 // Currently CSE/LICM don't operate on any instructions that can be affected 3576 // Currently CSE/LICM don't operate on any instructions that can be affected
3617 // by stores/loads. LoadOptimizer handles loads separately. Hence stores 3577 // by stores/loads. LoadOptimizer handles loads separately. Hence stores
3618 // are marked as having no side-effects. 3578 // are marked as having no side-effects.
3619 virtual EffectSet Effects() const { return EffectSet::None(); } 3579 virtual EffectSet Effects() const { return EffectSet::None(); }
3620 3580
3621 virtual bool MayThrow() const { return false; }
3622
3623 private: 3581 private:
3624 bool CanValueBeSmi() const { 3582 bool CanValueBeSmi() const {
3625 const intptr_t cid = value()->Type()->ToNullableCid(); 3583 const intptr_t cid = value()->Type()->ToNullableCid();
3626 // Write barrier is skipped for nullable and non-nullable smis. 3584 // Write barrier is skipped for nullable and non-nullable smis.
3627 ASSERT(cid != kSmiCid); 3585 ASSERT(cid != kSmiCid);
3628 return (cid == kDynamicCid); 3586 return (cid == kDynamicCid);
3629 } 3587 }
3630 3588
3631 const Field& field_; 3589 const Field& field_;
3632 3590
3633 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr); 3591 DISALLOW_COPY_AND_ASSIGN(StoreStaticFieldInstr);
3634 }; 3592 };
3635 3593
3636 3594
3637 class LoadIndexedInstr : public TemplateDefinition<2> { 3595 class LoadIndexedInstr : public TemplateDefinition<2, NoThrow> {
3638 public: 3596 public:
3639 LoadIndexedInstr(Value* array, 3597 LoadIndexedInstr(Value* array,
3640 Value* index, 3598 Value* index,
3641 intptr_t index_scale, 3599 intptr_t index_scale,
3642 intptr_t class_id, 3600 intptr_t class_id,
3643 intptr_t deopt_id, 3601 intptr_t deopt_id,
3644 intptr_t token_pos) 3602 intptr_t token_pos)
3645 : TemplateDefinition<2>(deopt_id), 3603 : TemplateDefinition(deopt_id),
3646 index_scale_(index_scale), 3604 index_scale_(index_scale),
3647 class_id_(class_id), 3605 class_id_(class_id),
3648 token_pos_(token_pos) { 3606 token_pos_(token_pos) {
3649 SetInputAt(0, array); 3607 SetInputAt(0, array);
3650 SetInputAt(1, index); 3608 SetInputAt(1, index);
3651 } 3609 }
3652 3610
3653 intptr_t token_pos() const { return token_pos_; } 3611 intptr_t token_pos() const { return token_pos_; }
3654 3612
3655 DECLARE_INSTRUCTION(LoadIndexed) 3613 DECLARE_INSTRUCTION(LoadIndexed)
(...skipping 19 matching lines...) Expand all
3675 return GetDeoptId() != Isolate::kNoDeoptId; 3633 return GetDeoptId() != Isolate::kNoDeoptId;
3676 } 3634 }
3677 3635
3678 bool Typed32BitIsSmi() const { 3636 bool Typed32BitIsSmi() const {
3679 return kSmiBits >= 32; 3637 return kSmiBits >= 32;
3680 } 3638 }
3681 3639
3682 virtual Representation representation() const; 3640 virtual Representation representation() const;
3683 virtual void InferRange(RangeAnalysis* analysis, Range* range); 3641 virtual void InferRange(RangeAnalysis* analysis, Range* range);
3684 3642
3685 virtual bool AllowsCSE() const { return false; }
3686 virtual EffectSet Effects() const { return EffectSet::None(); } 3643 virtual EffectSet Effects() const { return EffectSet::None(); }
3687 virtual EffectSet Dependencies() const;
3688 virtual bool AttributesEqual(Instruction* other) const;
3689
3690 virtual bool MayThrow() const { return false; }
3691 3644
3692 private: 3645 private:
3693 const intptr_t index_scale_; 3646 const intptr_t index_scale_;
3694 const intptr_t class_id_; 3647 const intptr_t class_id_;
3695 const intptr_t token_pos_; 3648 const intptr_t token_pos_;
3696 3649
3697 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); 3650 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr);
3698 }; 3651 };
3699 3652
3700 3653
3701 class StringFromCharCodeInstr : public TemplateDefinition<1> { 3654 class StringFromCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> {
3702 public: 3655 public:
3703 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) { 3656 StringFromCharCodeInstr(Value* char_code, intptr_t cid) : cid_(cid) {
3704 ASSERT(char_code != NULL); 3657 ASSERT(char_code != NULL);
3705 ASSERT(char_code->definition()->IsLoadIndexed()); 3658 ASSERT(char_code->definition()->IsLoadIndexed());
3706 ASSERT(char_code->definition()->AsLoadIndexed()->class_id() == 3659 ASSERT(char_code->definition()->AsLoadIndexed()->class_id() ==
3707 kOneByteStringCid); 3660 kOneByteStringCid);
3708 SetInputAt(0, char_code); 3661 SetInputAt(0, char_code);
3709 } 3662 }
3710 3663
3711 DECLARE_INSTRUCTION(StringFromCharCode) 3664 DECLARE_INSTRUCTION(StringFromCharCode)
3712 virtual CompileType ComputeType() const; 3665 virtual CompileType ComputeType() const;
3713 3666
3714 Value* char_code() const { return inputs_[0]; } 3667 Value* char_code() const { return inputs_[0]; }
3715 3668
3716 virtual bool CanDeoptimize() const { return false; } 3669 virtual bool CanDeoptimize() const { return false; }
3717 3670
3718 virtual bool AllowsCSE() const { return true; }
3719 virtual EffectSet Effects() const { return EffectSet::None(); }
3720 virtual EffectSet Dependencies() const { return EffectSet::None(); }
3721 virtual bool AttributesEqual(Instruction* other) const { 3671 virtual bool AttributesEqual(Instruction* other) const {
3722 return other->AsStringFromCharCode()->cid_ == cid_; 3672 return other->AsStringFromCharCode()->cid_ == cid_;
3723 } 3673 }
3724 3674
3725 virtual bool MayThrow() const { return false; }
3726
3727 private: 3675 private:
3728 const intptr_t cid_; 3676 const intptr_t cid_;
3729 3677
3730 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr); 3678 DISALLOW_COPY_AND_ASSIGN(StringFromCharCodeInstr);
3731 }; 3679 };
3732 3680
3733 3681
3734 class StringToCharCodeInstr : public TemplateDefinition<1> { 3682 class StringToCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> {
3735 public: 3683 public:
3736 StringToCharCodeInstr(Value* str, intptr_t cid) : cid_(cid) { 3684 StringToCharCodeInstr(Value* str, intptr_t cid) : cid_(cid) {
3737 ASSERT(str != NULL); 3685 ASSERT(str != NULL);
3738 SetInputAt(0, str); 3686 SetInputAt(0, str);
3739 } 3687 }
3740 3688
3741 DECLARE_INSTRUCTION(StringToCharCode) 3689 DECLARE_INSTRUCTION(StringToCharCode)
3742 virtual CompileType ComputeType() const; 3690 virtual CompileType ComputeType() const;
3743 3691
3744 Value* str() const { return inputs_[0]; } 3692 Value* str() const { return inputs_[0]; }
3745 3693
3746 virtual bool CanDeoptimize() const { return false; } 3694 virtual bool CanDeoptimize() const { return false; }
3747 3695
3748 virtual bool AllowsCSE() const { return true; }
3749 virtual EffectSet Effects() const { return EffectSet::None(); }
3750 virtual EffectSet Dependencies() const { return EffectSet::None(); }
3751 virtual bool AttributesEqual(Instruction* other) const { 3696 virtual bool AttributesEqual(Instruction* other) const {
3752 return other->AsStringToCharCode()->cid_ == cid_; 3697 return other->AsStringToCharCode()->cid_ == cid_;
3753 } 3698 }
3754 3699
3755 virtual bool MayThrow() const { return false; }
3756
3757 private: 3700 private:
3758 const intptr_t cid_; 3701 const intptr_t cid_;
3759 3702
3760 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); 3703 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr);
3761 }; 3704 };
3762 3705
3763 3706
3764 class StringInterpolateInstr : public TemplateDefinition<1> { 3707 class StringInterpolateInstr : public TemplateDefinition<1, Throws> {
3765 public: 3708 public:
3766 StringInterpolateInstr(Value* value, intptr_t token_pos) 3709 StringInterpolateInstr(Value* value, intptr_t token_pos)
3767 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), 3710 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
3768 token_pos_(token_pos), 3711 token_pos_(token_pos),
3769 function_(Function::Handle()) { 3712 function_(Function::Handle()) {
3770 SetInputAt(0, value); 3713 SetInputAt(0, value);
3771 } 3714 }
3772 3715
3773 Value* value() const { return inputs_[0]; } 3716 Value* value() const { return inputs_[0]; }
3774 virtual intptr_t token_pos() const { return token_pos_; } 3717 virtual intptr_t token_pos() const { return token_pos_; }
3775 3718
3776 virtual CompileType ComputeType() const; 3719 virtual CompileType ComputeType() const;
3777 // Issues a static call to Dart code which calls toString on objects. 3720 // Issues a static call to Dart code which calls toString on objects.
3778 virtual EffectSet Effects() const { return EffectSet::All(); } 3721 virtual EffectSet Effects() const { return EffectSet::All(); }
3779 virtual bool CanDeoptimize() const { return true; } 3722 virtual bool CanDeoptimize() const { return true; }
3780 virtual bool MayThrow() const { return true; }
3781 3723
3782 const Function& CallFunction() const; 3724 const Function& CallFunction() const;
3783 3725
3784 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3726 virtual Definition* Canonicalize(FlowGraph* flow_graph);
3785 3727
3786 DECLARE_INSTRUCTION(StringInterpolate) 3728 DECLARE_INSTRUCTION(StringInterpolate)
3787 3729
3788 private: 3730 private:
3789 const intptr_t token_pos_; 3731 const intptr_t token_pos_;
3790 Function& function_; 3732 Function& function_;
3791 3733
3792 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); 3734 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr);
3793 }; 3735 };
3794 3736
3795 3737
3796 class StoreIndexedInstr : public TemplateDefinition<3> { 3738 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> {
3797 public: 3739 public:
3798 StoreIndexedInstr(Value* array, 3740 StoreIndexedInstr(Value* array,
3799 Value* index, 3741 Value* index,
3800 Value* value, 3742 Value* value,
3801 StoreBarrierType emit_store_barrier, 3743 StoreBarrierType emit_store_barrier,
3802 intptr_t index_scale, 3744 intptr_t index_scale,
3803 intptr_t class_id, 3745 intptr_t class_id,
3804 intptr_t deopt_id, 3746 intptr_t deopt_id,
3805 intptr_t token_pos) 3747 intptr_t token_pos)
3806 : TemplateDefinition<3>(deopt_id), 3748 : TemplateDefinition(deopt_id),
3807 emit_store_barrier_(emit_store_barrier), 3749 emit_store_barrier_(emit_store_barrier),
3808 index_scale_(index_scale), 3750 index_scale_(index_scale),
3809 class_id_(class_id), 3751 class_id_(class_id),
3810 token_pos_(token_pos) { 3752 token_pos_(token_pos) {
3811 SetInputAt(kArrayPos, array); 3753 SetInputAt(kArrayPos, array);
3812 SetInputAt(kIndexPos, index); 3754 SetInputAt(kIndexPos, index);
3813 SetInputAt(kValuePos, value); 3755 SetInputAt(kValuePos, value);
3814 } 3756 }
3815 3757
3816 DECLARE_INSTRUCTION(StoreIndexed) 3758 DECLARE_INSTRUCTION(StoreIndexed)
(...skipping 25 matching lines...) Expand all
3842 } 3784 }
3843 3785
3844 virtual intptr_t DeoptimizationTarget() const { 3786 virtual intptr_t DeoptimizationTarget() const {
3845 // Direct access since this instruction cannot deoptimize, and the deopt-id 3787 // Direct access since this instruction cannot deoptimize, and the deopt-id
3846 // was inherited from another instruction that could deoptimize. 3788 // was inherited from another instruction that could deoptimize.
3847 return GetDeoptId(); 3789 return GetDeoptId();
3848 } 3790 }
3849 3791
3850 virtual EffectSet Effects() const { return EffectSet::None(); } 3792 virtual EffectSet Effects() const { return EffectSet::None(); }
3851 3793
3852 virtual bool MayThrow() const { return false; }
3853
3854 private: 3794 private:
3855 const StoreBarrierType emit_store_barrier_; 3795 const StoreBarrierType emit_store_barrier_;
3856 const intptr_t index_scale_; 3796 const intptr_t index_scale_;
3857 const intptr_t class_id_; 3797 const intptr_t class_id_;
3858 const intptr_t token_pos_; 3798 const intptr_t token_pos_;
3859 3799
3860 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); 3800 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr);
3861 }; 3801 };
3862 3802
3863 3803
3864 // Note overrideable, built-in: value ? false : true. 3804 // Note overrideable, built-in: value ? false : true.
3865 class BooleanNegateInstr : public TemplateDefinition<1> { 3805 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> {
3866 public: 3806 public:
3867 explicit BooleanNegateInstr(Value* value) { 3807 explicit BooleanNegateInstr(Value* value) {
3868 SetInputAt(0, value); 3808 SetInputAt(0, value);
3869 } 3809 }
3870 3810
3871 DECLARE_INSTRUCTION(BooleanNegate) 3811 DECLARE_INSTRUCTION(BooleanNegate)
3872 virtual CompileType ComputeType() const; 3812 virtual CompileType ComputeType() const;
3873 3813
3874 Value* value() const { return inputs_[0]; } 3814 Value* value() const { return inputs_[0]; }
3875 3815
3876 virtual bool CanDeoptimize() const { return false; } 3816 virtual bool CanDeoptimize() const { return false; }
3877 3817
3878 virtual EffectSet Effects() const { return EffectSet::None(); } 3818 virtual EffectSet Effects() const { return EffectSet::None(); }
3879 3819
3880 virtual bool MayThrow() const { return false; }
3881
3882 virtual Definition* Canonicalize(FlowGraph* flow_graph); 3820 virtual Definition* Canonicalize(FlowGraph* flow_graph);
3883 3821
3884 private: 3822 private:
3885 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); 3823 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr);
3886 }; 3824 };
3887 3825
3888 3826
3889 class InstanceOfInstr : public TemplateDefinition<3> { 3827 class InstanceOfInstr : public TemplateDefinition<3, Throws> {
3890 public: 3828 public:
3891 InstanceOfInstr(intptr_t token_pos, 3829 InstanceOfInstr(intptr_t token_pos,
3892 Value* value, 3830 Value* value,
3893 Value* instantiator, 3831 Value* instantiator,
3894 Value* instantiator_type_arguments, 3832 Value* instantiator_type_arguments,
3895 const AbstractType& type, 3833 const AbstractType& type,
3896 bool negate_result, 3834 bool negate_result,
3897 intptr_t deopt_id) 3835 intptr_t deopt_id)
3898 : TemplateDefinition<3>(deopt_id), 3836 : TemplateDefinition(deopt_id),
3899 token_pos_(token_pos), 3837 token_pos_(token_pos),
3900 type_(type), 3838 type_(type),
3901 negate_result_(negate_result) { 3839 negate_result_(negate_result) {
3902 ASSERT(!type.IsNull()); 3840 ASSERT(!type.IsNull());
3903 SetInputAt(0, value); 3841 SetInputAt(0, value);
3904 SetInputAt(1, instantiator); 3842 SetInputAt(1, instantiator);
3905 SetInputAt(2, instantiator_type_arguments); 3843 SetInputAt(2, instantiator_type_arguments);
3906 } 3844 }
3907 3845
3908 DECLARE_INSTRUCTION(InstanceOf) 3846 DECLARE_INSTRUCTION(InstanceOf)
3909 virtual CompileType ComputeType() const; 3847 virtual CompileType ComputeType() const;
3910 3848
3911 Value* value() const { return inputs_[0]; } 3849 Value* value() const { return inputs_[0]; }
3912 Value* instantiator() const { return inputs_[1]; } 3850 Value* instantiator() const { return inputs_[1]; }
3913 Value* instantiator_type_arguments() const { return inputs_[2]; } 3851 Value* instantiator_type_arguments() const { return inputs_[2]; }
3914 3852
3915 bool negate_result() const { return negate_result_; } 3853 bool negate_result() const { return negate_result_; }
3916 const AbstractType& type() const { return type_; } 3854 const AbstractType& type() const { return type_; }
3917 virtual intptr_t token_pos() const { return token_pos_; } 3855 virtual intptr_t token_pos() const { return token_pos_; }
3918 3856
3919 virtual void PrintOperandsTo(BufferFormatter* f) const; 3857 virtual void PrintOperandsTo(BufferFormatter* f) const;
3920 3858
3921 virtual bool CanDeoptimize() const { return true; } 3859 virtual bool CanDeoptimize() const { return true; }
3922 3860
3923 virtual EffectSet Effects() const { return EffectSet::None(); } 3861 virtual EffectSet Effects() const { return EffectSet::None(); }
3924 3862
3925 virtual bool MayThrow() const { return true; }
3926
3927 private: 3863 private:
3928 const intptr_t token_pos_; 3864 const intptr_t token_pos_;
3929 Value* value_; 3865 Value* value_;
3930 Value* instantiator_; 3866 Value* instantiator_;
3931 Value* type_arguments_; 3867 Value* type_arguments_;
3932 const AbstractType& type_; 3868 const AbstractType& type_;
3933 const bool negate_result_; 3869 const bool negate_result_;
3934 3870
3935 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); 3871 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr);
3936 }; 3872 };
3937 3873
3938 3874
3939 class AllocateObjectInstr : public TemplateDefinition<0> { 3875 class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> {
3940 public: 3876 public:
3941 AllocateObjectInstr(intptr_t token_pos, 3877 AllocateObjectInstr(intptr_t token_pos,
3942 const Class& cls, 3878 const Class& cls,
3943 ZoneGrowableArray<PushArgumentInstr*>* arguments) 3879 ZoneGrowableArray<PushArgumentInstr*>* arguments)
3944 : token_pos_(token_pos), 3880 : token_pos_(token_pos),
3945 cls_(cls), 3881 cls_(cls),
3946 arguments_(arguments), 3882 arguments_(arguments),
3947 identity_(AliasIdentity::Unknown()), 3883 identity_(AliasIdentity::Unknown()),
3948 closure_function_(Function::ZoneHandle()) { 3884 closure_function_(Function::ZoneHandle()) {
3949 // Either no arguments or one type-argument and one instantiator. 3885 // Either no arguments or one type-argument and one instantiator.
(...skipping 15 matching lines...) Expand all
3965 void set_closure_function(const Function& function) { 3901 void set_closure_function(const Function& function) {
3966 closure_function_ ^= function.raw(); 3902 closure_function_ ^= function.raw();
3967 } 3903 }
3968 3904
3969 virtual void PrintOperandsTo(BufferFormatter* f) const; 3905 virtual void PrintOperandsTo(BufferFormatter* f) const;
3970 3906
3971 virtual bool CanDeoptimize() const { return false; } 3907 virtual bool CanDeoptimize() const { return false; }
3972 3908
3973 virtual EffectSet Effects() const { return EffectSet::None(); } 3909 virtual EffectSet Effects() const { return EffectSet::None(); }
3974 3910
3975 virtual bool MayThrow() const { return false; }
3976
3977 virtual AliasIdentity Identity() const { return identity_; } 3911 virtual AliasIdentity Identity() const { return identity_; }
3978 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } 3912 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; }
3979 3913
3980 private: 3914 private:
3981 const intptr_t token_pos_; 3915 const intptr_t token_pos_;
3982 const Class& cls_; 3916 const Class& cls_;
3983 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; 3917 ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
3984 AliasIdentity identity_; 3918 AliasIdentity identity_;
3985 Function& closure_function_; 3919 Function& closure_function_;
3986 3920
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4070 ZoneGrowableArray<Value*>* values_; 4004 ZoneGrowableArray<Value*>* values_;
4071 Location* locations_; 4005 Location* locations_;
4072 4006
4073 bool visited_for_liveness_; 4007 bool visited_for_liveness_;
4074 bool registers_remapped_; 4008 bool registers_remapped_;
4075 4009
4076 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4010 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4077 }; 4011 };
4078 4012
4079 4013
4080 class CreateArrayInstr : public TemplateDefinition<2> { 4014 class CreateArrayInstr : public TemplateDefinition<2, Throws> {
4081 public: 4015 public:
4082 CreateArrayInstr(intptr_t token_pos, 4016 CreateArrayInstr(intptr_t token_pos,
4083 Value* element_type, 4017 Value* element_type,
4084 Value* num_elements) 4018 Value* num_elements)
4085 : TemplateDefinition<2>(Isolate::Current()->GetNextDeoptId()), 4019 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
4086 token_pos_(token_pos), 4020 token_pos_(token_pos),
4087 identity_(AliasIdentity::Unknown()) { 4021 identity_(AliasIdentity::Unknown()) {
4088 SetInputAt(kElementTypePos, element_type); 4022 SetInputAt(kElementTypePos, element_type);
4089 SetInputAt(kLengthPos, num_elements); 4023 SetInputAt(kLengthPos, num_elements);
4090 } 4024 }
4091 4025
4092 enum { 4026 enum {
4093 kElementTypePos = 0, 4027 kElementTypePos = 0,
4094 kLengthPos = 1 4028 kLengthPos = 1
4095 }; 4029 };
4096 4030
4097 DECLARE_INSTRUCTION(CreateArray) 4031 DECLARE_INSTRUCTION(CreateArray)
4098 virtual CompileType ComputeType() const; 4032 virtual CompileType ComputeType() const;
4099 4033
4100 virtual intptr_t token_pos() const { return token_pos_; } 4034 virtual intptr_t token_pos() const { return token_pos_; }
4101 Value* element_type() const { return inputs_[kElementTypePos]; } 4035 Value* element_type() const { return inputs_[kElementTypePos]; }
4102 Value* num_elements() const { return inputs_[kLengthPos]; } 4036 Value* num_elements() const { return inputs_[kLengthPos]; }
4103 4037
4104 // Throw needs environment, which is created only if instruction can 4038 // Throw needs environment, which is created only if instruction can
4105 // deoptimize. 4039 // deoptimize.
4106 virtual bool CanDeoptimize() const { return MayThrow(); } 4040 virtual bool CanDeoptimize() const { return MayThrow(); }
4107 4041
4108 virtual EffectSet Effects() const { return EffectSet::None(); } 4042 virtual EffectSet Effects() const { return EffectSet::None(); }
4109 4043
4110 // OutOfMemoryError can be called.
4111 virtual bool MayThrow() const { return true; }
4112
4113 virtual AliasIdentity Identity() const { return identity_; } 4044 virtual AliasIdentity Identity() const { return identity_; }
4114 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } 4045 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; }
4115 4046
4116 private: 4047 private:
4117 const intptr_t token_pos_; 4048 const intptr_t token_pos_;
4118 AliasIdentity identity_; 4049 AliasIdentity identity_;
4119 4050
4120 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); 4051 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr);
4121 }; 4052 };
4122 4053
4123 4054
4124 class LoadUntaggedInstr : public TemplateDefinition<1> { 4055 // Note: this instruction must not be moved without the indexed access that
4056 // depends on it (e.g. out of loops). GC may cause collect
4057 // the array while the external data-array is still accessed.
4058 // TODO(vegorov) enable LICMing this instruction by ensuring that array itself
4059 // is kept alive.
4060 class LoadUntaggedInstr : public TemplateDefinition<1, NoThrow> {
4125 public: 4061 public:
4126 LoadUntaggedInstr(Value* object, intptr_t offset) : offset_(offset) { 4062 LoadUntaggedInstr(Value* object, intptr_t offset) : offset_(offset) {
4127 SetInputAt(0, object); 4063 SetInputAt(0, object);
4128 } 4064 }
4129 4065
4130 virtual Representation representation() const { 4066 virtual Representation representation() const {
4131 return kUntagged; 4067 return kUntagged;
4132 } 4068 }
4133 DECLARE_INSTRUCTION(LoadUntagged) 4069 DECLARE_INSTRUCTION(LoadUntagged)
4134 virtual CompileType ComputeType() const; 4070 virtual CompileType ComputeType() const;
4135 4071
4136 Value* object() const { return inputs_[0]; } 4072 Value* object() const { return inputs_[0]; }
4137 intptr_t offset() const { return offset_; } 4073 intptr_t offset() const { return offset_; }
4138 4074
4139 virtual bool CanDeoptimize() const { return false; } 4075 virtual bool CanDeoptimize() const { return false; }
4140 4076
4141 // This instruction must not be moved without the indexed access that
4142 // depends on it (e.g. out of loops). GC may cause collect
4143 // the array while the external data-array is still accessed.
4144 virtual bool AllowsCSE() const { return false; }
4145 virtual EffectSet Effects() const { return EffectSet::None(); } 4077 virtual EffectSet Effects() const { return EffectSet::None(); }
4146 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4147 virtual bool AttributesEqual(Instruction* other) const { return true; } 4078 virtual bool AttributesEqual(Instruction* other) const { return true; }
4148 4079
4149 virtual bool MayThrow() const { return false; }
4150
4151 private: 4080 private:
4152 intptr_t offset_; 4081 intptr_t offset_;
4153 4082
4154 DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr); 4083 DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr);
4155 }; 4084 };
4156 4085
4157 4086
4158 class LoadClassIdInstr : public TemplateDefinition<1> { 4087 class LoadClassIdInstr : public TemplateDefinition<1, NoThrow> {
4159 public: 4088 public:
4160 explicit LoadClassIdInstr(Value* object) { 4089 explicit LoadClassIdInstr(Value* object) {
4161 SetInputAt(0, object); 4090 SetInputAt(0, object);
4162 } 4091 }
4163 4092
4164 virtual Representation representation() const { 4093 virtual Representation representation() const {
4165 return kTagged; 4094 return kTagged;
4166 } 4095 }
4167 DECLARE_INSTRUCTION(LoadClassId) 4096 DECLARE_INSTRUCTION(LoadClassId)
4168 virtual CompileType ComputeType() const; 4097 virtual CompileType ComputeType() const;
4169 4098
4170 Value* object() const { return inputs_[0]; } 4099 Value* object() const { return inputs_[0]; }
4171 4100
4172 virtual bool CanDeoptimize() const { return false; } 4101 virtual bool CanDeoptimize() const { return false; }
4173 4102
4174 virtual bool AllowsCSE() const { return true; } 4103 virtual bool AllowsCSE() const { return true; }
4175 virtual EffectSet Effects() const { return EffectSet::None(); }
4176 virtual EffectSet Dependencies() const { 4104 virtual EffectSet Dependencies() const {
4177 return EffectSet::Externalization(); 4105 return EffectSet::Externalization();
4178 } 4106 }
4107 virtual EffectSet Effects() const { return EffectSet::None(); }
4179 virtual bool AttributesEqual(Instruction* other) const { return true; } 4108 virtual bool AttributesEqual(Instruction* other) const { return true; }
4180 4109
4181 virtual bool MayThrow() const { return false; }
4182
4183 private: 4110 private:
4184 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); 4111 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr);
4185 }; 4112 };
4186 4113
4187 4114
4188 class LoadFieldInstr : public TemplateDefinition<1> { 4115 class LoadFieldInstr : public TemplateDefinition<1, NoThrow> {
4189 public: 4116 public:
4190 LoadFieldInstr(Value* instance, 4117 LoadFieldInstr(Value* instance,
4191 intptr_t offset_in_bytes, 4118 intptr_t offset_in_bytes,
4192 const AbstractType& type, 4119 const AbstractType& type,
4193 intptr_t token_pos) 4120 intptr_t token_pos)
4194 : offset_in_bytes_(offset_in_bytes), 4121 : offset_in_bytes_(offset_in_bytes),
4195 type_(type), 4122 type_(type),
4196 result_cid_(kDynamicCid), 4123 result_cid_(kDynamicCid),
4197 immutable_(false), 4124 immutable_(false),
4198 recognized_kind_(MethodRecognizer::kUnknown), 4125 recognized_kind_(MethodRecognizer::kUnknown),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4259 4186
4260 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid); 4187 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid);
4261 4188
4262 static bool IsFixedLengthArrayCid(intptr_t cid); 4189 static bool IsFixedLengthArrayCid(intptr_t cid);
4263 4190
4264 virtual bool AllowsCSE() const { return immutable_; } 4191 virtual bool AllowsCSE() const { return immutable_; }
4265 virtual EffectSet Effects() const { return EffectSet::None(); } 4192 virtual EffectSet Effects() const { return EffectSet::None(); }
4266 virtual EffectSet Dependencies() const; 4193 virtual EffectSet Dependencies() const;
4267 virtual bool AttributesEqual(Instruction* other) const; 4194 virtual bool AttributesEqual(Instruction* other) const;
4268 4195
4269 virtual bool MayThrow() const { return false; }
4270
4271 private: 4196 private:
4272 const intptr_t offset_in_bytes_; 4197 const intptr_t offset_in_bytes_;
4273 const AbstractType& type_; 4198 const AbstractType& type_;
4274 intptr_t result_cid_; 4199 intptr_t result_cid_;
4275 bool immutable_; 4200 bool immutable_;
4276 4201
4277 MethodRecognizer::Kind recognized_kind_; 4202 MethodRecognizer::Kind recognized_kind_;
4278 const Field* field_; 4203 const Field* field_;
4279 const intptr_t token_pos_; 4204 const intptr_t token_pos_;
4280 4205
4281 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); 4206 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
4282 }; 4207 };
4283 4208
4284 4209
4285 class InstantiateTypeInstr : public TemplateDefinition<1> { 4210 class InstantiateTypeInstr : public TemplateDefinition<1, Throws> {
4286 public: 4211 public:
4287 InstantiateTypeInstr(intptr_t token_pos, 4212 InstantiateTypeInstr(intptr_t token_pos,
4288 const AbstractType& type, 4213 const AbstractType& type,
4289 const Class& instantiator_class, 4214 const Class& instantiator_class,
4290 Value* instantiator) 4215 Value* instantiator)
4291 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), 4216 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
4292 token_pos_(token_pos), 4217 token_pos_(token_pos),
4293 type_(type), 4218 type_(type),
4294 instantiator_class_(instantiator_class) { 4219 instantiator_class_(instantiator_class) {
4295 ASSERT(type.IsZoneHandle()); 4220 ASSERT(type.IsZoneHandle());
4296 SetInputAt(0, instantiator); 4221 SetInputAt(0, instantiator);
4297 } 4222 }
4298 4223
4299 DECLARE_INSTRUCTION(InstantiateType) 4224 DECLARE_INSTRUCTION(InstantiateType)
4300 4225
4301 Value* instantiator() const { return inputs_[0]; } 4226 Value* instantiator() const { return inputs_[0]; }
4302 const AbstractType& type() const { return type_; 4227 const AbstractType& type() const { return type_;
4303 } 4228 }
4304 const Class& instantiator_class() const { return instantiator_class_; } 4229 const Class& instantiator_class() const { return instantiator_class_; }
4305 virtual intptr_t token_pos() const { return token_pos_; } 4230 virtual intptr_t token_pos() const { return token_pos_; }
4306 4231
4307 virtual void PrintOperandsTo(BufferFormatter* f) const; 4232 virtual void PrintOperandsTo(BufferFormatter* f) const;
4308 4233
4309 virtual bool CanDeoptimize() const { return true; } 4234 virtual bool CanDeoptimize() const { return true; }
4310 4235
4311 virtual EffectSet Effects() const { return EffectSet::None(); } 4236 virtual EffectSet Effects() const { return EffectSet::None(); }
4312 4237
4313 virtual bool MayThrow() const { return true; }
4314
4315 private: 4238 private:
4316 const intptr_t token_pos_; 4239 const intptr_t token_pos_;
4317 const AbstractType& type_; 4240 const AbstractType& type_;
4318 const Class& instantiator_class_; 4241 const Class& instantiator_class_;
4319 4242
4320 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); 4243 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr);
4321 }; 4244 };
4322 4245
4323 4246
4324 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { 4247 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1, Throws> {
4325 public: 4248 public:
4326 InstantiateTypeArgumentsInstr(intptr_t token_pos, 4249 InstantiateTypeArgumentsInstr(intptr_t token_pos,
4327 const TypeArguments& type_arguments, 4250 const TypeArguments& type_arguments,
4328 const Class& instantiator_class, 4251 const Class& instantiator_class,
4329 Value* instantiator) 4252 Value* instantiator)
4330 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), 4253 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
4331 token_pos_(token_pos), 4254 token_pos_(token_pos),
4332 type_arguments_(type_arguments), 4255 type_arguments_(type_arguments),
4333 instantiator_class_(instantiator_class) { 4256 instantiator_class_(instantiator_class) {
4334 ASSERT(type_arguments.IsZoneHandle()); 4257 ASSERT(type_arguments.IsZoneHandle());
4335 SetInputAt(0, instantiator); 4258 SetInputAt(0, instantiator);
4336 } 4259 }
4337 4260
4338 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4261 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4339 4262
4340 Value* instantiator() const { return inputs_[0]; } 4263 Value* instantiator() const { return inputs_[0]; }
4341 const TypeArguments& type_arguments() const { 4264 const TypeArguments& type_arguments() const {
4342 return type_arguments_; 4265 return type_arguments_;
4343 } 4266 }
4344 const Class& instantiator_class() const { return instantiator_class_; } 4267 const Class& instantiator_class() const { return instantiator_class_; }
4345 virtual intptr_t token_pos() const { return token_pos_; } 4268 virtual intptr_t token_pos() const { return token_pos_; }
4346 4269
4347 virtual void PrintOperandsTo(BufferFormatter* f) const; 4270 virtual void PrintOperandsTo(BufferFormatter* f) const;
4348 4271
4349 virtual bool CanDeoptimize() const { return true; } 4272 virtual bool CanDeoptimize() const { return true; }
4350 4273
4351 virtual EffectSet Effects() const { return EffectSet::None(); } 4274 virtual EffectSet Effects() const { return EffectSet::None(); }
4352 4275
4353 virtual bool MayThrow() const { return true; }
4354
4355 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4276 virtual Definition* Canonicalize(FlowGraph* flow_graph);
4356 4277
4357 private: 4278 private:
4358 const intptr_t token_pos_; 4279 const intptr_t token_pos_;
4359 const TypeArguments& type_arguments_; 4280 const TypeArguments& type_arguments_;
4360 const Class& instantiator_class_; 4281 const Class& instantiator_class_;
4361 4282
4362 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); 4283 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr);
4363 }; 4284 };
4364 4285
4365 4286
4366 class AllocateContextInstr : public TemplateDefinition<0> { 4287 class AllocateContextInstr : public TemplateDefinition<0, NoThrow> {
4367 public: 4288 public:
4368 AllocateContextInstr(intptr_t token_pos, 4289 AllocateContextInstr(intptr_t token_pos,
4369 intptr_t num_context_variables) 4290 intptr_t num_context_variables)
4370 : token_pos_(token_pos), 4291 : token_pos_(token_pos),
4371 num_context_variables_(num_context_variables) {} 4292 num_context_variables_(num_context_variables) {}
4372 4293
4373 DECLARE_INSTRUCTION(AllocateContext) 4294 DECLARE_INSTRUCTION(AllocateContext)
4374 virtual CompileType ComputeType() const; 4295 virtual CompileType ComputeType() const;
4375 4296
4376 virtual intptr_t token_pos() const { return token_pos_; } 4297 virtual intptr_t token_pos() const { return token_pos_; }
4377 intptr_t num_context_variables() const { return num_context_variables_; } 4298 intptr_t num_context_variables() const { return num_context_variables_; }
4378 4299
4379 virtual void PrintOperandsTo(BufferFormatter* f) const; 4300 virtual void PrintOperandsTo(BufferFormatter* f) const;
4380 4301
4381 virtual bool CanDeoptimize() const { return false; } 4302 virtual bool CanDeoptimize() const { return false; }
4382 4303
4383 virtual EffectSet Effects() const { return EffectSet::None(); } 4304 virtual EffectSet Effects() const { return EffectSet::None(); }
4384 4305
4385 virtual bool MayThrow() const { return false; }
4386
4387 private: 4306 private:
4388 const intptr_t token_pos_; 4307 const intptr_t token_pos_;
4389 const intptr_t num_context_variables_; 4308 const intptr_t num_context_variables_;
4390 4309
4391 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 4310 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
4392 }; 4311 };
4393 4312
4394 4313
4395 class InitStaticFieldInstr : public TemplateInstruction<1> { 4314 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> {
4396 public: 4315 public:
4397 InitStaticFieldInstr(Value* input, const Field& field) 4316 InitStaticFieldInstr(Value* input, const Field& field)
4398 : TemplateInstruction<1>(Isolate::Current()->GetNextDeoptId()), 4317 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()),
4399 field_(field) { 4318 field_(field) {
4400 SetInputAt(0, input); 4319 SetInputAt(0, input);
4401 } 4320 }
4402 4321
4403 virtual intptr_t token_pos() const { return field_.token_pos(); } 4322 virtual intptr_t token_pos() const { return field_.token_pos(); }
4404 const Field& field() const { return field_; } 4323 const Field& field() const { return field_; }
4405 4324
4406 DECLARE_INSTRUCTION(InitStaticField) 4325 DECLARE_INSTRUCTION(InitStaticField)
4407 4326
4408 virtual intptr_t ArgumentCount() const { return 0; } 4327 virtual intptr_t ArgumentCount() const { return 0; }
4409 virtual bool CanDeoptimize() const { return true; } 4328 virtual bool CanDeoptimize() const { return true; }
4410 virtual EffectSet Effects() const { return EffectSet::All(); } 4329 virtual EffectSet Effects() const { return EffectSet::All(); }
4411 virtual bool MayThrow() const { return true; }
4412 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 4330 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
4413 4331
4414 private: 4332 private:
4415 const Field& field_; 4333 const Field& field_;
4416 4334
4417 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); 4335 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr);
4418 }; 4336 };
4419 4337
4420 4338
4421 class AllocateUninitializedContextInstr : public TemplateDefinition<0> { 4339 class AllocateUninitializedContextInstr
4340 : public TemplateDefinition<0, NoThrow> {
4422 public: 4341 public:
4423 AllocateUninitializedContextInstr(intptr_t token_pos, 4342 AllocateUninitializedContextInstr(intptr_t token_pos,
4424 intptr_t num_context_variables) 4343 intptr_t num_context_variables)
4425 : token_pos_(token_pos), 4344 : token_pos_(token_pos),
4426 num_context_variables_(num_context_variables) {} 4345 num_context_variables_(num_context_variables) {}
4427 4346
4428 DECLARE_INSTRUCTION(AllocateUninitializedContext) 4347 DECLARE_INSTRUCTION(AllocateUninitializedContext)
4429 virtual CompileType ComputeType() const; 4348 virtual CompileType ComputeType() const;
4430 4349
4431 virtual intptr_t token_pos() const { return token_pos_; } 4350 virtual intptr_t token_pos() const { return token_pos_; }
4432 intptr_t num_context_variables() const { return num_context_variables_; } 4351 intptr_t num_context_variables() const { return num_context_variables_; }
4433 4352
4434 virtual void PrintOperandsTo(BufferFormatter* f) const; 4353 virtual void PrintOperandsTo(BufferFormatter* f) const;
4435 4354
4436 virtual bool CanDeoptimize() const { return false; } 4355 virtual bool CanDeoptimize() const { return false; }
4437 4356
4438 virtual EffectSet Effects() const { return EffectSet::None(); } 4357 virtual EffectSet Effects() const { return EffectSet::None(); }
4439 4358
4440 virtual bool MayThrow() const { return false; }
4441
4442 private: 4359 private:
4443 const intptr_t token_pos_; 4360 const intptr_t token_pos_;
4444 const intptr_t num_context_variables_; 4361 const intptr_t num_context_variables_;
4445 4362
4446 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); 4363 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr);
4447 }; 4364 };
4448 4365
4449 4366
4450 class CloneContextInstr : public TemplateDefinition<1> { 4367 class CloneContextInstr : public TemplateDefinition<1, NoThrow> {
4451 public: 4368 public:
4452 CloneContextInstr(intptr_t token_pos, Value* context_value) 4369 CloneContextInstr(intptr_t token_pos, Value* context_value)
4453 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), 4370 : TemplateDefinition(Isolate::Current()->GetNextDeoptId()),
4454 token_pos_(token_pos) { 4371 token_pos_(token_pos) {
4455 SetInputAt(0, context_value); 4372 SetInputAt(0, context_value);
4456 } 4373 }
4457 4374
4458 virtual intptr_t token_pos() const { return token_pos_; } 4375 virtual intptr_t token_pos() const { return token_pos_; }
4459 Value* context_value() const { return inputs_[0]; } 4376 Value* context_value() const { return inputs_[0]; }
4460 4377
4461 DECLARE_INSTRUCTION(CloneContext) 4378 DECLARE_INSTRUCTION(CloneContext)
4462 virtual CompileType ComputeType() const; 4379 virtual CompileType ComputeType() const;
4463 4380
4464 virtual bool CanDeoptimize() const { return true; } 4381 virtual bool CanDeoptimize() const { return true; }
4465 4382
4466 virtual EffectSet Effects() const { return EffectSet::None(); } 4383 virtual EffectSet Effects() const { return EffectSet::None(); }
4467 4384
4468 virtual bool MayThrow() const { return false; }
4469
4470 private: 4385 private:
4471 const intptr_t token_pos_; 4386 const intptr_t token_pos_;
4472 4387
4473 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); 4388 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr);
4474 }; 4389 };
4475 4390
4476 4391
4477 class CheckEitherNonSmiInstr : public TemplateInstruction<2> { 4392 class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> {
4478 public: 4393 public:
4479 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) 4394 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id)
4480 : TemplateInstruction<2>(deopt_id), licm_hoisted_(false) { 4395 : TemplateInstruction(deopt_id), licm_hoisted_(false) {
4481 SetInputAt(0, left); 4396 SetInputAt(0, left);
4482 SetInputAt(1, right); 4397 SetInputAt(1, right);
4483 } 4398 }
4484 4399
4485 Value* left() const { return inputs_[0]; } 4400 Value* left() const { return inputs_[0]; }
4486 Value* right() const { return inputs_[1]; } 4401 Value* right() const { return inputs_[1]; }
4487 4402
4488 DECLARE_INSTRUCTION(CheckEitherNonSmi) 4403 DECLARE_INSTRUCTION(CheckEitherNonSmi)
4489 4404
4490 virtual intptr_t ArgumentCount() const { return 0; } 4405 virtual intptr_t ArgumentCount() const { return 0; }
4491 4406
4492 virtual bool CanDeoptimize() const { return true; } 4407 virtual bool CanDeoptimize() const { return true; }
4493 4408
4494 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 4409 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
4495 4410
4496 virtual bool AllowsCSE() const { return true; }
4497 virtual EffectSet Effects() const { return EffectSet::None(); }
4498 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4499 virtual bool AttributesEqual(Instruction* other) const { return true; } 4411 virtual bool AttributesEqual(Instruction* other) const { return true; }
4500 4412
4501 virtual bool MayThrow() const { return false; }
4502
4503 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } 4413 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
4504 4414
4505 private: 4415 private:
4506 bool licm_hoisted_; 4416 bool licm_hoisted_;
4507 4417
4508 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); 4418 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr);
4509 }; 4419 };
4510 4420
4511 4421
4512 class BoxDoubleInstr : public TemplateDefinition<1> { 4422 class BoxDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> {
4513 public: 4423 public:
4514 explicit BoxDoubleInstr(Value* value) { 4424 explicit BoxDoubleInstr(Value* value) {
4515 SetInputAt(0, value); 4425 SetInputAt(0, value);
4516 } 4426 }
4517 4427
4518 Value* value() const { return inputs_[0]; } 4428 Value* value() const { return inputs_[0]; }
4519 4429
4520 DECLARE_INSTRUCTION(BoxDouble) 4430 DECLARE_INSTRUCTION(BoxDouble)
4521 virtual CompileType ComputeType() const; 4431 virtual CompileType ComputeType() const;
4522 4432
4523 virtual bool CanDeoptimize() const { return false; } 4433 virtual bool CanDeoptimize() const { return false; }
4524 4434
4525 virtual intptr_t DeoptimizationTarget() const { 4435 virtual intptr_t DeoptimizationTarget() const {
4526 return Isolate::kNoDeoptId; 4436 return Isolate::kNoDeoptId;
4527 } 4437 }
4528 4438
4529 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4439 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4530 ASSERT(idx == 0); 4440 ASSERT(idx == 0);
4531 return kUnboxedDouble; 4441 return kUnboxedDouble;
4532 } 4442 }
4533 4443
4534 virtual bool AllowsCSE() const { return true; }
4535 virtual EffectSet Effects() const { return EffectSet::None(); }
4536 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4537 virtual bool AttributesEqual(Instruction* other) const { return true; } 4444 virtual bool AttributesEqual(Instruction* other) const { return true; }
4538 4445
4539 virtual bool MayThrow() const { return false; }
4540
4541 Definition* Canonicalize(FlowGraph* flow_graph); 4446 Definition* Canonicalize(FlowGraph* flow_graph);
4542 4447
4543 private: 4448 private:
4544 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr); 4449 DISALLOW_COPY_AND_ASSIGN(BoxDoubleInstr);
4545 }; 4450 };
4546 4451
4547 4452
4548 class BoxFloat32x4Instr : public TemplateDefinition<1> { 4453 class BoxFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
4549 public: 4454 public:
4550 explicit BoxFloat32x4Instr(Value* value) { 4455 explicit BoxFloat32x4Instr(Value* value) {
4551 SetInputAt(0, value); 4456 SetInputAt(0, value);
4552 } 4457 }
4553 4458
4554 Value* value() const { return inputs_[0]; } 4459 Value* value() const { return inputs_[0]; }
4555 4460
4556 virtual bool CanDeoptimize() const { return false; } 4461 virtual bool CanDeoptimize() const { return false; }
4557 4462
4558 virtual intptr_t DeoptimizationTarget() const { 4463 virtual intptr_t DeoptimizationTarget() const {
4559 return Isolate::kNoDeoptId; 4464 return Isolate::kNoDeoptId;
4560 } 4465 }
4561 4466
4562 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4467 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4563 ASSERT(idx == 0); 4468 ASSERT(idx == 0);
4564 return kUnboxedFloat32x4; 4469 return kUnboxedFloat32x4;
4565 } 4470 }
4566 4471
4567 DECLARE_INSTRUCTION(BoxFloat32x4) 4472 DECLARE_INSTRUCTION(BoxFloat32x4)
4568 virtual CompileType ComputeType() const; 4473 virtual CompileType ComputeType() const;
4569 4474
4570 virtual bool AllowsCSE() const { return true; }
4571 virtual EffectSet Effects() const { return EffectSet::None(); }
4572 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4573 virtual bool AttributesEqual(Instruction* other) const { return true; } 4475 virtual bool AttributesEqual(Instruction* other) const { return true; }
4574 4476
4575 virtual bool MayThrow() const { return false; }
4576
4577 Definition* Canonicalize(FlowGraph* flow_graph); 4477 Definition* Canonicalize(FlowGraph* flow_graph);
4578 4478
4579 private: 4479 private:
4580 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr); 4480 DISALLOW_COPY_AND_ASSIGN(BoxFloat32x4Instr);
4581 }; 4481 };
4582 4482
4583 4483
4584 class BoxFloat64x2Instr : public TemplateDefinition<1> { 4484 class BoxFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> {
4585 public: 4485 public:
4586 explicit BoxFloat64x2Instr(Value* value) { 4486 explicit BoxFloat64x2Instr(Value* value) {
4587 SetInputAt(0, value); 4487 SetInputAt(0, value);
4588 } 4488 }
4589 4489
4590 Value* value() const { return inputs_[0]; } 4490 Value* value() const { return inputs_[0]; }
4591 4491
4592 virtual bool CanDeoptimize() const { return false; } 4492 virtual bool CanDeoptimize() const { return false; }
4593 4493
4594 virtual intptr_t DeoptimizationTarget() const { 4494 virtual intptr_t DeoptimizationTarget() const {
4595 return Isolate::kNoDeoptId; 4495 return Isolate::kNoDeoptId;
4596 } 4496 }
4597 4497
4598 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4498 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4599 ASSERT(idx == 0); 4499 ASSERT(idx == 0);
4600 return kUnboxedFloat64x2; 4500 return kUnboxedFloat64x2;
4601 } 4501 }
4602 4502
4603 DECLARE_INSTRUCTION(BoxFloat64x2) 4503 DECLARE_INSTRUCTION(BoxFloat64x2)
4604 virtual CompileType ComputeType() const; 4504 virtual CompileType ComputeType() const;
4605 4505
4606 virtual bool AllowsCSE() const { return true; }
4607 virtual EffectSet Effects() const { return EffectSet::None(); }
4608 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4609 virtual bool AttributesEqual(Instruction* other) const { return true; } 4506 virtual bool AttributesEqual(Instruction* other) const { return true; }
4610 4507
4611 virtual bool MayThrow() const { return false; }
4612
4613 Definition* Canonicalize(FlowGraph* flow_graph); 4508 Definition* Canonicalize(FlowGraph* flow_graph);
4614 4509
4615 private: 4510 private:
4616 DISALLOW_COPY_AND_ASSIGN(BoxFloat64x2Instr); 4511 DISALLOW_COPY_AND_ASSIGN(BoxFloat64x2Instr);
4617 }; 4512 };
4618 4513
4619 4514
4620 4515
4621 class BoxInt32x4Instr : public TemplateDefinition<1> { 4516 class BoxInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
4622 public: 4517 public:
4623 explicit BoxInt32x4Instr(Value* value) { 4518 explicit BoxInt32x4Instr(Value* value) {
4624 SetInputAt(0, value); 4519 SetInputAt(0, value);
4625 } 4520 }
4626 4521
4627 Value* value() const { return inputs_[0]; } 4522 Value* value() const { return inputs_[0]; }
4628 4523
4629 virtual bool CanDeoptimize() const { return false; } 4524 virtual bool CanDeoptimize() const { return false; }
4630 4525
4631 virtual intptr_t DeoptimizationTarget() const { 4526 virtual intptr_t DeoptimizationTarget() const {
4632 return Isolate::kNoDeoptId; 4527 return Isolate::kNoDeoptId;
4633 } 4528 }
4634 4529
4635 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4530 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4636 ASSERT(idx == 0); 4531 ASSERT(idx == 0);
4637 return kUnboxedInt32x4; 4532 return kUnboxedInt32x4;
4638 } 4533 }
4639 4534
4640 DECLARE_INSTRUCTION(BoxInt32x4) 4535 DECLARE_INSTRUCTION(BoxInt32x4)
4641 virtual CompileType ComputeType() const; 4536 virtual CompileType ComputeType() const;
4642 4537
4643 virtual bool AllowsCSE() const { return true; }
4644 virtual EffectSet Effects() const { return EffectSet::None(); }
4645 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4646 virtual bool AttributesEqual(Instruction* other) const { return true; } 4538 virtual bool AttributesEqual(Instruction* other) const { return true; }
4647 4539
4648 virtual bool MayThrow() const { return false; }
4649
4650 Definition* Canonicalize(FlowGraph* flow_graph); 4540 Definition* Canonicalize(FlowGraph* flow_graph);
4651 4541
4652 private: 4542 private:
4653 DISALLOW_COPY_AND_ASSIGN(BoxInt32x4Instr); 4543 DISALLOW_COPY_AND_ASSIGN(BoxInt32x4Instr);
4654 }; 4544 };
4655 4545
4656 4546
4657 class BoxIntegerInstr : public TemplateDefinition<1> { 4547 class BoxIntegerInstr : public TemplateDefinition<1, NoThrow, Pure> {
4658 public: 4548 public:
4659 explicit BoxIntegerInstr(Value* value) : is_smi_(false) { 4549 explicit BoxIntegerInstr(Value* value) : is_smi_(false) {
4660 SetInputAt(0, value); 4550 SetInputAt(0, value);
4661 } 4551 }
4662 4552
4663 Value* value() const { return inputs_[0]; } 4553 Value* value() const { return inputs_[0]; }
4664 4554
4665 bool is_smi() const { return is_smi_; } 4555 bool is_smi() const { return is_smi_; }
4666 void set_is_smi(bool is_smi) { is_smi_ = is_smi; } 4556 void set_is_smi(bool is_smi) { is_smi_ = is_smi; }
4667 4557
4668 virtual bool CanDeoptimize() const { return false; } 4558 virtual bool CanDeoptimize() const { return false; }
4669 4559
4670 virtual intptr_t DeoptimizationTarget() const { 4560 virtual intptr_t DeoptimizationTarget() const {
4671 return Isolate::kNoDeoptId; 4561 return Isolate::kNoDeoptId;
4672 } 4562 }
4673 4563
4674 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4564 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4675 ASSERT(idx == 0); 4565 ASSERT(idx == 0);
4676 return kUnboxedMint; 4566 return kUnboxedMint;
4677 } 4567 }
4678 4568
4679 DECLARE_INSTRUCTION(BoxInteger) 4569 DECLARE_INSTRUCTION(BoxInteger)
4680 virtual CompileType ComputeType() const; 4570 virtual CompileType ComputeType() const;
4681 virtual bool RecomputeType(); 4571 virtual bool RecomputeType();
4682 4572
4683 virtual void InferRange(RangeAnalysis* analysis, Range* range); 4573 virtual void InferRange(RangeAnalysis* analysis, Range* range);
4684 4574
4685 virtual bool AllowsCSE() const { return true; }
4686 virtual EffectSet Effects() const { return EffectSet::None(); }
4687 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4688 virtual bool AttributesEqual(Instruction* other) const { return true; } 4575 virtual bool AttributesEqual(Instruction* other) const { return true; }
4689 4576
4690 virtual bool MayThrow() const { return false; }
4691
4692 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4577 virtual Definition* Canonicalize(FlowGraph* flow_graph);
4693 4578
4694 private: 4579 private:
4695 bool is_smi_; 4580 bool is_smi_;
4696 4581
4697 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); 4582 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr);
4698 }; 4583 };
4699 4584
4700 4585
4701 class UnboxDoubleInstr : public TemplateDefinition<1> { 4586 class UnboxDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> {
4702 public: 4587 public:
4703 UnboxDoubleInstr(Value* value, intptr_t deopt_id) 4588 UnboxDoubleInstr(Value* value, intptr_t deopt_id)
4704 : TemplateDefinition<1>(deopt_id) { 4589 : TemplateDefinition(deopt_id) {
4705 SetInputAt(0, value); 4590 SetInputAt(0, value);
4706 } 4591 }
4707 4592
4708 Value* value() const { return inputs_[0]; } 4593 Value* value() const { return inputs_[0]; }
4709 4594
4710 virtual bool CanDeoptimize() const { 4595 virtual bool CanDeoptimize() const {
4711 return (value()->Type()->ToCid() != kDoubleCid) 4596 return (value()->Type()->ToCid() != kDoubleCid)
4712 && (value()->Type()->ToCid() != kSmiCid); 4597 && (value()->Type()->ToCid() != kSmiCid);
4713 } 4598 }
4714 4599
4715 virtual Representation representation() const { 4600 virtual Representation representation() const {
4716 return kUnboxedDouble; 4601 return kUnboxedDouble;
4717 } 4602 }
4718 4603
4719 DECLARE_INSTRUCTION(UnboxDouble) 4604 DECLARE_INSTRUCTION(UnboxDouble)
4720 virtual CompileType ComputeType() const; 4605 virtual CompileType ComputeType() const;
4721 4606
4722 virtual bool AllowsCSE() const { return true; }
4723 virtual EffectSet Effects() const { return EffectSet::None(); }
4724 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4725 virtual bool AttributesEqual(Instruction* other) const { return true; } 4607 virtual bool AttributesEqual(Instruction* other) const { return true; }
4726 4608
4727 virtual bool MayThrow() const { return false; }
4728
4729 Definition* Canonicalize(FlowGraph* flow_graph); 4609 Definition* Canonicalize(FlowGraph* flow_graph);
4730 4610
4731 private: 4611 private:
4732 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); 4612 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr);
4733 }; 4613 };
4734 4614
4735 4615
4736 class UnboxFloat32x4Instr : public TemplateDefinition<1> { 4616 class UnboxFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
4737 public: 4617 public:
4738 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id) 4618 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id)
4739 : TemplateDefinition<1>(deopt_id) { 4619 : TemplateDefinition(deopt_id) {
4740 SetInputAt(0, value); 4620 SetInputAt(0, value);
4741 } 4621 }
4742 4622
4743 Value* value() const { return inputs_[0]; } 4623 Value* value() const { return inputs_[0]; }
4744 4624
4745 virtual bool CanDeoptimize() const { 4625 virtual bool CanDeoptimize() const {
4746 return (value()->Type()->ToCid() != kFloat32x4Cid); 4626 return (value()->Type()->ToCid() != kFloat32x4Cid);
4747 } 4627 }
4748 4628
4749 virtual Representation representation() const { 4629 virtual Representation representation() const {
4750 return kUnboxedFloat32x4; 4630 return kUnboxedFloat32x4;
4751 } 4631 }
4752 4632
4753 DECLARE_INSTRUCTION(UnboxFloat32x4) 4633 DECLARE_INSTRUCTION(UnboxFloat32x4)
4754 virtual CompileType ComputeType() const; 4634 virtual CompileType ComputeType() const;
4755 4635
4756 virtual bool AllowsCSE() const { return true; }
4757 virtual EffectSet Effects() const { return EffectSet::None(); }
4758 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4759 virtual bool AttributesEqual(Instruction* other) const { return true; } 4636 virtual bool AttributesEqual(Instruction* other) const { return true; }
4760 4637
4761 virtual bool MayThrow() const { return false; }
4762
4763 Definition* Canonicalize(FlowGraph* flow_graph); 4638 Definition* Canonicalize(FlowGraph* flow_graph);
4764 4639
4765 private: 4640 private:
4766 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); 4641 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr);
4767 }; 4642 };
4768 4643
4769 4644
4770 class UnboxFloat64x2Instr : public TemplateDefinition<1> { 4645 class UnboxFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> {
4771 public: 4646 public:
4772 UnboxFloat64x2Instr(Value* value, intptr_t deopt_id) 4647 UnboxFloat64x2Instr(Value* value, intptr_t deopt_id)
4773 : TemplateDefinition<1>(deopt_id) { 4648 : TemplateDefinition(deopt_id) {
4774 SetInputAt(0, value); 4649 SetInputAt(0, value);
4775 } 4650 }
4776 4651
4777 Value* value() const { return inputs_[0]; } 4652 Value* value() const { return inputs_[0]; }
4778 4653
4779 virtual bool CanDeoptimize() const { 4654 virtual bool CanDeoptimize() const {
4780 return (value()->Type()->ToCid() != kFloat64x2Cid); 4655 return (value()->Type()->ToCid() != kFloat64x2Cid);
4781 } 4656 }
4782 4657
4783 virtual Representation representation() const { 4658 virtual Representation representation() const {
4784 return kUnboxedFloat64x2; 4659 return kUnboxedFloat64x2;
4785 } 4660 }
4786 4661
4787 DECLARE_INSTRUCTION(UnboxFloat64x2) 4662 DECLARE_INSTRUCTION(UnboxFloat64x2)
4788 virtual CompileType ComputeType() const; 4663 virtual CompileType ComputeType() const;
4789 4664
4790 virtual bool AllowsCSE() const { return true; }
4791 virtual EffectSet Effects() const { return EffectSet::None(); }
4792 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4793 virtual bool AttributesEqual(Instruction* other) const { return true; } 4665 virtual bool AttributesEqual(Instruction* other) const { return true; }
4794 4666
4795 virtual bool MayThrow() const { return false; }
4796
4797 Definition* Canonicalize(FlowGraph* flow_graph); 4667 Definition* Canonicalize(FlowGraph* flow_graph);
4798 4668
4799 private: 4669 private:
4800 DISALLOW_COPY_AND_ASSIGN(UnboxFloat64x2Instr); 4670 DISALLOW_COPY_AND_ASSIGN(UnboxFloat64x2Instr);
4801 }; 4671 };
4802 4672
4803 4673
4804 class UnboxInt32x4Instr : public TemplateDefinition<1> { 4674 class UnboxInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
4805 public: 4675 public:
4806 UnboxInt32x4Instr(Value* value, intptr_t deopt_id) 4676 UnboxInt32x4Instr(Value* value, intptr_t deopt_id)
4807 : TemplateDefinition<1>(deopt_id) { 4677 : TemplateDefinition(deopt_id) {
4808 SetInputAt(0, value); 4678 SetInputAt(0, value);
4809 } 4679 }
4810 4680
4811 Value* value() const { return inputs_[0]; } 4681 Value* value() const { return inputs_[0]; }
4812 4682
4813 virtual bool CanDeoptimize() const { 4683 virtual bool CanDeoptimize() const {
4814 return (value()->Type()->ToCid() != kInt32x4Cid); 4684 return (value()->Type()->ToCid() != kInt32x4Cid);
4815 } 4685 }
4816 4686
4817 virtual Representation representation() const { 4687 virtual Representation representation() const {
4818 return kUnboxedInt32x4; 4688 return kUnboxedInt32x4;
4819 } 4689 }
4820 4690
4821 virtual bool AllowsCSE() const { return true; }
4822 virtual EffectSet Effects() const { return EffectSet::None(); }
4823 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4824 virtual bool AttributesEqual(Instruction* other) const { return true; } 4691 virtual bool AttributesEqual(Instruction* other) const { return true; }
4825 4692
4826 DECLARE_INSTRUCTION(UnboxInt32x4) 4693 DECLARE_INSTRUCTION(UnboxInt32x4)
4827 virtual CompileType ComputeType() const; 4694 virtual CompileType ComputeType() const;
4828 4695
4829 virtual bool MayThrow() const { return false; }
4830
4831 Definition* Canonicalize(FlowGraph* flow_graph); 4696 Definition* Canonicalize(FlowGraph* flow_graph);
4832 4697
4833 private: 4698 private:
4834 DISALLOW_COPY_AND_ASSIGN(UnboxInt32x4Instr); 4699 DISALLOW_COPY_AND_ASSIGN(UnboxInt32x4Instr);
4835 }; 4700 };
4836 4701
4837 4702
4838 class UnboxIntegerInstr : public TemplateDefinition<1> { 4703 class UnboxIntegerInstr : public TemplateDefinition<1, NoThrow, Pure> {
4839 public: 4704 public:
4840 UnboxIntegerInstr(Value* value, intptr_t deopt_id) 4705 UnboxIntegerInstr(Value* value, intptr_t deopt_id)
4841 : TemplateDefinition<1>(deopt_id) { 4706 : TemplateDefinition(deopt_id) {
4842 SetInputAt(0, value); 4707 SetInputAt(0, value);
4843 } 4708 }
4844 4709
4845 Value* value() const { return inputs_[0]; } 4710 Value* value() const { return inputs_[0]; }
4846 4711
4847 virtual bool CanDeoptimize() const { 4712 virtual bool CanDeoptimize() const {
4848 return (value()->Type()->ToCid() != kSmiCid) 4713 return (value()->Type()->ToCid() != kSmiCid)
4849 && (value()->Type()->ToCid() != kMintCid); 4714 && (value()->Type()->ToCid() != kMintCid);
4850 } 4715 }
4851 4716
4852 virtual Representation representation() const { 4717 virtual Representation representation() const {
4853 return kUnboxedMint; 4718 return kUnboxedMint;
4854 } 4719 }
4855 4720
4856 intptr_t deopt_id() const { return GetDeoptId(); } 4721 intptr_t deopt_id() const { return GetDeoptId(); }
4857 4722
4858 virtual void InferRange(RangeAnalysis* analysis, Range* range); 4723 virtual void InferRange(RangeAnalysis* analysis, Range* range);
4859 4724
4860 DECLARE_INSTRUCTION(UnboxInteger) 4725 DECLARE_INSTRUCTION(UnboxInteger)
4861 virtual CompileType ComputeType() const; 4726 virtual CompileType ComputeType() const;
4862 4727
4863 virtual bool AllowsCSE() const { return true; }
4864 virtual EffectSet Effects() const { return EffectSet::None(); }
4865 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4866 virtual bool AttributesEqual(Instruction* other) const { return true; } 4728 virtual bool AttributesEqual(Instruction* other) const { return true; }
4867 4729
4868 virtual bool MayThrow() const { return false; }
4869
4870 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4730 virtual Definition* Canonicalize(FlowGraph* flow_graph);
4871 4731
4872 private: 4732 private:
4873 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); 4733 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr);
4874 }; 4734 };
4875 4735
4876 4736
4877 class MathUnaryInstr : public TemplateDefinition<1> { 4737 class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> {
4878 public: 4738 public:
4879 enum MathUnaryKind { 4739 enum MathUnaryKind {
4880 kIllegal, 4740 kIllegal,
4881 kSin, 4741 kSin,
4882 kCos, 4742 kCos,
4883 kSqrt, 4743 kSqrt,
4884 kDoubleSquare, 4744 kDoubleSquare,
4885 }; 4745 };
4886 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) 4746 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id)
4887 : TemplateDefinition<1>(deopt_id), kind_(kind) { 4747 : TemplateDefinition(deopt_id), kind_(kind) {
4888 SetInputAt(0, value); 4748 SetInputAt(0, value);
4889 } 4749 }
4890 4750
4891 Value* value() const { return inputs_[0]; } 4751 Value* value() const { return inputs_[0]; }
4892 MathUnaryKind kind() const { return kind_; } 4752 MathUnaryKind kind() const { return kind_; }
4893 const RuntimeEntry& TargetFunction() const; 4753 const RuntimeEntry& TargetFunction() const;
4894 4754
4895 virtual void PrintOperandsTo(BufferFormatter* f) const; 4755 virtual void PrintOperandsTo(BufferFormatter* f) const;
4896 4756
4897 virtual bool CanDeoptimize() const { return false; } 4757 virtual bool CanDeoptimize() const { return false; }
4898 4758
4899 virtual Representation representation() const { 4759 virtual Representation representation() const {
4900 return kUnboxedDouble; 4760 return kUnboxedDouble;
4901 } 4761 }
4902 4762
4903 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4763 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
4904 ASSERT(idx == 0); 4764 ASSERT(idx == 0);
4905 return kUnboxedDouble; 4765 return kUnboxedDouble;
4906 } 4766 }
4907 4767
4908 virtual intptr_t DeoptimizationTarget() const { 4768 virtual intptr_t DeoptimizationTarget() const {
4909 // Direct access since this instruction cannot deoptimize, and the deopt-id 4769 // Direct access since this instruction cannot deoptimize, and the deopt-id
4910 // was inherited from another instruction that could deoptimize. 4770 // was inherited from another instruction that could deoptimize.
4911 return GetDeoptId(); 4771 return GetDeoptId();
4912 } 4772 }
4913 4773
4914 DECLARE_INSTRUCTION(MathUnary) 4774 DECLARE_INSTRUCTION(MathUnary)
4915 virtual CompileType ComputeType() const; 4775 virtual CompileType ComputeType() const;
4916 4776
4917 virtual bool AllowsCSE() const { return true; }
4918 virtual EffectSet Effects() const { return EffectSet::None(); }
4919 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4920 virtual bool AttributesEqual(Instruction* other) const { 4777 virtual bool AttributesEqual(Instruction* other) const {
4921 return kind() == other->AsMathUnary()->kind(); 4778 return kind() == other->AsMathUnary()->kind();
4922 } 4779 }
4923 4780
4924 virtual bool MayThrow() const { return false; }
4925
4926 Definition* Canonicalize(FlowGraph* flow_graph); 4781 Definition* Canonicalize(FlowGraph* flow_graph);
4927 4782
4928 static const char* KindToCString(MathUnaryKind kind); 4783 static const char* KindToCString(MathUnaryKind kind);
4929 4784
4930 private: 4785 private:
4931 const MathUnaryKind kind_; 4786 const MathUnaryKind kind_;
4932 4787
4933 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr); 4788 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr);
4934 }; 4789 };
4935 4790
4936 4791
4937 // Represents Math's static min and max functions. 4792 // Represents Math's static min and max functions.
4938 class MathMinMaxInstr : public TemplateDefinition<2> { 4793 class MathMinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> {
4939 public: 4794 public:
4940 MathMinMaxInstr(MethodRecognizer::Kind op_kind, 4795 MathMinMaxInstr(MethodRecognizer::Kind op_kind,
4941 Value* left_value, 4796 Value* left_value,
4942 Value* right_value, 4797 Value* right_value,
4943 intptr_t deopt_id, 4798 intptr_t deopt_id,
4944 intptr_t result_cid) 4799 intptr_t result_cid)
4945 : TemplateDefinition<2>(deopt_id), 4800 : TemplateDefinition(deopt_id),
4946 op_kind_(op_kind), 4801 op_kind_(op_kind),
4947 result_cid_(result_cid) { 4802 result_cid_(result_cid) {
4948 ASSERT((result_cid == kSmiCid) || (result_cid == kDoubleCid)); 4803 ASSERT((result_cid == kSmiCid) || (result_cid == kDoubleCid));
4949 SetInputAt(0, left_value); 4804 SetInputAt(0, left_value);
4950 SetInputAt(1, right_value); 4805 SetInputAt(1, right_value);
4951 } 4806 }
4952 4807
4953 MethodRecognizer::Kind op_kind() const { return op_kind_; } 4808 MethodRecognizer::Kind op_kind() const { return op_kind_; }
4954 4809
4955 Value* left() const { return inputs_[0]; } 4810 Value* left() const { return inputs_[0]; }
(...skipping 20 matching lines...) Expand all
4976 } 4831 }
4977 4832
4978 virtual intptr_t DeoptimizationTarget() const { 4833 virtual intptr_t DeoptimizationTarget() const {
4979 // Direct access since this instruction cannot deoptimize, and the deopt-id 4834 // Direct access since this instruction cannot deoptimize, and the deopt-id
4980 // was inherited from another instruction that could deoptimize. 4835 // was inherited from another instruction that could deoptimize.
4981 return GetDeoptId(); 4836 return GetDeoptId();
4982 } 4837 }
4983 4838
4984 DECLARE_INSTRUCTION(MathMinMax) 4839 DECLARE_INSTRUCTION(MathMinMax)
4985 virtual CompileType ComputeType() const; 4840 virtual CompileType ComputeType() const;
4986 virtual bool AllowsCSE() const { return true; }
4987 virtual EffectSet Effects() const { return EffectSet::None(); }
4988 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4989 virtual bool AttributesEqual(Instruction* other) const; 4841 virtual bool AttributesEqual(Instruction* other) const;
4990 4842
4991 virtual bool MayThrow() const { return false; }
4992
4993 private: 4843 private:
4994 const MethodRecognizer::Kind op_kind_; 4844 const MethodRecognizer::Kind op_kind_;
4995 const intptr_t result_cid_; 4845 const intptr_t result_cid_;
4996 4846
4997 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); 4847 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr);
4998 }; 4848 };
4999 4849
5000 4850
5001 class BinaryDoubleOpInstr : public TemplateDefinition<2> { 4851 class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> {
5002 public: 4852 public:
5003 BinaryDoubleOpInstr(Token::Kind op_kind, 4853 BinaryDoubleOpInstr(Token::Kind op_kind,
5004 Value* left, 4854 Value* left,
5005 Value* right, 4855 Value* right,
5006 intptr_t deopt_id, 4856 intptr_t deopt_id,
5007 intptr_t token_pos) 4857 intptr_t token_pos)
5008 : TemplateDefinition<2>(deopt_id), 4858 : TemplateDefinition(deopt_id),
5009 op_kind_(op_kind), 4859 op_kind_(op_kind),
5010 token_pos_(token_pos) { 4860 token_pos_(token_pos) {
5011 SetInputAt(0, left); 4861 SetInputAt(0, left);
5012 SetInputAt(1, right); 4862 SetInputAt(1, right);
5013 } 4863 }
5014 4864
5015 Value* left() const { return inputs_[0]; } 4865 Value* left() const { return inputs_[0]; }
5016 Value* right() const { return inputs_[1]; } 4866 Value* right() const { return inputs_[1]; }
5017 4867
5018 Token::Kind op_kind() const { return op_kind_; } 4868 Token::Kind op_kind() const { return op_kind_; }
(...skipping 17 matching lines...) Expand all
5036 // Direct access since this instruction cannot deoptimize, and the deopt-id 4886 // Direct access since this instruction cannot deoptimize, and the deopt-id
5037 // was inherited from another instruction that could deoptimize. 4887 // was inherited from another instruction that could deoptimize.
5038 return GetDeoptId(); 4888 return GetDeoptId();
5039 } 4889 }
5040 4890
5041 DECLARE_INSTRUCTION(BinaryDoubleOp) 4891 DECLARE_INSTRUCTION(BinaryDoubleOp)
5042 virtual CompileType ComputeType() const; 4892 virtual CompileType ComputeType() const;
5043 4893
5044 virtual Definition* Canonicalize(FlowGraph* flow_graph); 4894 virtual Definition* Canonicalize(FlowGraph* flow_graph);
5045 4895
5046 virtual bool AllowsCSE() const { return true; }
5047 virtual EffectSet Effects() const { return EffectSet::None(); }
5048 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5049 virtual bool AttributesEqual(Instruction* other) const { 4896 virtual bool AttributesEqual(Instruction* other) const {
5050 return op_kind() == other->AsBinaryDoubleOp()->op_kind(); 4897 return op_kind() == other->AsBinaryDoubleOp()->op_kind();
5051 } 4898 }
5052 4899
5053 virtual bool MayThrow() const { return false; }
5054
5055 private: 4900 private:
5056 const Token::Kind op_kind_; 4901 const Token::Kind op_kind_;
5057 const intptr_t token_pos_; 4902 const intptr_t token_pos_;
5058 4903
5059 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); 4904 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr);
5060 }; 4905 };
5061 4906
5062 4907
5063 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { 4908 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> {
5064 public: 4909 public:
5065 BinaryFloat32x4OpInstr(Token::Kind op_kind, 4910 BinaryFloat32x4OpInstr(Token::Kind op_kind,
5066 Value* left, 4911 Value* left,
5067 Value* right, 4912 Value* right,
5068 intptr_t deopt_id) 4913 intptr_t deopt_id)
5069 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 4914 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
5070 SetInputAt(0, left); 4915 SetInputAt(0, left);
5071 SetInputAt(1, right); 4916 SetInputAt(1, right);
5072 } 4917 }
5073 4918
5074 Value* left() const { return inputs_[0]; } 4919 Value* left() const { return inputs_[0]; }
5075 Value* right() const { return inputs_[1]; } 4920 Value* right() const { return inputs_[1]; }
5076 4921
5077 Token::Kind op_kind() const { return op_kind_; } 4922 Token::Kind op_kind() const { return op_kind_; }
5078 4923
5079 virtual void PrintOperandsTo(BufferFormatter* f) const; 4924 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 11 matching lines...) Expand all
5091 4936
5092 virtual intptr_t DeoptimizationTarget() const { 4937 virtual intptr_t DeoptimizationTarget() const {
5093 // Direct access since this instruction cannot deoptimize, and the deopt-id 4938 // Direct access since this instruction cannot deoptimize, and the deopt-id
5094 // was inherited from another instruction that could deoptimize. 4939 // was inherited from another instruction that could deoptimize.
5095 return GetDeoptId(); 4940 return GetDeoptId();
5096 } 4941 }
5097 4942
5098 DECLARE_INSTRUCTION(BinaryFloat32x4Op) 4943 DECLARE_INSTRUCTION(BinaryFloat32x4Op)
5099 virtual CompileType ComputeType() const; 4944 virtual CompileType ComputeType() const;
5100 4945
5101 virtual bool AllowsCSE() const { return true; }
5102 virtual EffectSet Effects() const { return EffectSet::None(); }
5103 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5104 virtual bool AttributesEqual(Instruction* other) const { 4946 virtual bool AttributesEqual(Instruction* other) const {
5105 return op_kind() == other->AsBinaryFloat32x4Op()->op_kind(); 4947 return op_kind() == other->AsBinaryFloat32x4Op()->op_kind();
5106 } 4948 }
5107 4949
5108 virtual bool MayThrow() const { return false; }
5109
5110 private: 4950 private:
5111 const Token::Kind op_kind_; 4951 const Token::Kind op_kind_;
5112 4952
5113 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); 4953 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr);
5114 }; 4954 };
5115 4955
5116 4956
5117 class Simd32x4ShuffleInstr : public TemplateDefinition<1> { 4957 class Simd32x4ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> {
5118 public: 4958 public:
5119 Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, Value* value, 4959 Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, Value* value,
5120 intptr_t mask, 4960 intptr_t mask,
5121 intptr_t deopt_id) 4961 intptr_t deopt_id)
5122 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind), mask_(mask) { 4962 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) {
5123 SetInputAt(0, value); 4963 SetInputAt(0, value);
5124 } 4964 }
5125 4965
5126 Value* value() const { return inputs_[0]; } 4966 Value* value() const { return inputs_[0]; }
5127 4967
5128 MethodRecognizer::Kind op_kind() const { return op_kind_; } 4968 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5129 4969
5130 intptr_t mask() const { return mask_; } 4970 intptr_t mask() const { return mask_; }
5131 4971
5132 virtual void PrintOperandsTo(BufferFormatter* f) const; 4972 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 29 matching lines...) Expand all
5162 5002
5163 virtual intptr_t DeoptimizationTarget() const { 5003 virtual intptr_t DeoptimizationTarget() const {
5164 // Direct access since this instruction cannot deoptimize, and the deopt-id 5004 // Direct access since this instruction cannot deoptimize, and the deopt-id
5165 // was inherited from another instruction that could deoptimize. 5005 // was inherited from another instruction that could deoptimize.
5166 return GetDeoptId(); 5006 return GetDeoptId();
5167 } 5007 }
5168 5008
5169 DECLARE_INSTRUCTION(Simd32x4Shuffle) 5009 DECLARE_INSTRUCTION(Simd32x4Shuffle)
5170 virtual CompileType ComputeType() const; 5010 virtual CompileType ComputeType() const;
5171 5011
5172 virtual bool AllowsCSE() const { return true; }
5173 virtual EffectSet Effects() const { return EffectSet::None(); }
5174 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5175 virtual bool AttributesEqual(Instruction* other) const { 5012 virtual bool AttributesEqual(Instruction* other) const {
5176 return (op_kind() == other->AsSimd32x4Shuffle()->op_kind()) && 5013 return (op_kind() == other->AsSimd32x4Shuffle()->op_kind()) &&
5177 (mask() == other->AsSimd32x4Shuffle()->mask()); 5014 (mask() == other->AsSimd32x4Shuffle()->mask());
5178 } 5015 }
5179 5016
5180 virtual bool MayThrow() const { return false; }
5181
5182 private: 5017 private:
5183 const MethodRecognizer::Kind op_kind_; 5018 const MethodRecognizer::Kind op_kind_;
5184 const intptr_t mask_; 5019 const intptr_t mask_;
5185 5020
5186 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr); 5021 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr);
5187 }; 5022 };
5188 5023
5189 5024
5190 class Simd32x4ShuffleMixInstr : public TemplateDefinition<2> { 5025 class Simd32x4ShuffleMixInstr : public TemplateDefinition<2, NoThrow, Pure> {
5191 public: 5026 public:
5192 Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, Value* xy, 5027 Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, Value* xy,
5193 Value* zw, intptr_t mask, intptr_t deopt_id) 5028 Value* zw, intptr_t mask, intptr_t deopt_id)
5194 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind), mask_(mask) { 5029 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) {
5195 SetInputAt(0, xy); 5030 SetInputAt(0, xy);
5196 SetInputAt(1, zw); 5031 SetInputAt(1, zw);
5197 } 5032 }
5198 5033
5199 Value* xy() const { return inputs_[0]; } 5034 Value* xy() const { return inputs_[0]; }
5200 Value* zw() const { return inputs_[1]; } 5035 Value* zw() const { return inputs_[1]; }
5201 5036
5202 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5037 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5203 5038
5204 intptr_t mask() const { return mask_; } 5039 intptr_t mask() const { return mask_; }
(...skipping 21 matching lines...) Expand all
5226 5061
5227 virtual intptr_t DeoptimizationTarget() const { 5062 virtual intptr_t DeoptimizationTarget() const {
5228 // Direct access since this instruction cannot deoptimize, and the deopt-id 5063 // Direct access since this instruction cannot deoptimize, and the deopt-id
5229 // was inherited from another instruction that could deoptimize. 5064 // was inherited from another instruction that could deoptimize.
5230 return GetDeoptId(); 5065 return GetDeoptId();
5231 } 5066 }
5232 5067
5233 DECLARE_INSTRUCTION(Simd32x4ShuffleMix) 5068 DECLARE_INSTRUCTION(Simd32x4ShuffleMix)
5234 virtual CompileType ComputeType() const; 5069 virtual CompileType ComputeType() const;
5235 5070
5236 virtual bool AllowsCSE() const { return true; }
5237 virtual EffectSet Effects() const { return EffectSet::None(); }
5238 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5239 virtual bool AttributesEqual(Instruction* other) const { 5071 virtual bool AttributesEqual(Instruction* other) const {
5240 return (op_kind() == other->AsSimd32x4ShuffleMix()->op_kind()) && 5072 return (op_kind() == other->AsSimd32x4ShuffleMix()->op_kind()) &&
5241 (mask() == other->AsSimd32x4ShuffleMix()->mask()); 5073 (mask() == other->AsSimd32x4ShuffleMix()->mask());
5242 } 5074 }
5243 5075
5244 virtual bool MayThrow() const { return false; }
5245
5246 private: 5076 private:
5247 const MethodRecognizer::Kind op_kind_; 5077 const MethodRecognizer::Kind op_kind_;
5248 const intptr_t mask_; 5078 const intptr_t mask_;
5249 5079
5250 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr); 5080 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr);
5251 }; 5081 };
5252 5082
5253 5083
5254 class Float32x4ConstructorInstr : public TemplateDefinition<4> { 5084 class Float32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> {
5255 public: 5085 public:
5256 Float32x4ConstructorInstr(Value* value0, 5086 Float32x4ConstructorInstr(Value* value0,
5257 Value* value1, 5087 Value* value1,
5258 Value* value2, 5088 Value* value2,
5259 Value* value3, 5089 Value* value3,
5260 intptr_t deopt_id) 5090 intptr_t deopt_id)
5261 : TemplateDefinition<4>(deopt_id) { 5091 : TemplateDefinition(deopt_id) {
5262 SetInputAt(0, value0); 5092 SetInputAt(0, value0);
5263 SetInputAt(1, value1); 5093 SetInputAt(1, value1);
5264 SetInputAt(2, value2); 5094 SetInputAt(2, value2);
5265 SetInputAt(3, value3); 5095 SetInputAt(3, value3);
5266 } 5096 }
5267 5097
5268 Value* value0() const { return inputs_[0]; } 5098 Value* value0() const { return inputs_[0]; }
5269 Value* value1() const { return inputs_[1]; } 5099 Value* value1() const { return inputs_[1]; }
5270 Value* value2() const { return inputs_[2]; } 5100 Value* value2() const { return inputs_[2]; }
5271 Value* value3() const { return inputs_[3]; } 5101 Value* value3() const { return inputs_[3]; }
(...skipping 13 matching lines...) Expand all
5285 5115
5286 virtual intptr_t DeoptimizationTarget() const { 5116 virtual intptr_t DeoptimizationTarget() const {
5287 // Direct access since this instruction cannot deoptimize, and the deopt-id 5117 // Direct access since this instruction cannot deoptimize, and the deopt-id
5288 // was inherited from another instruction that could deoptimize. 5118 // was inherited from another instruction that could deoptimize.
5289 return GetDeoptId(); 5119 return GetDeoptId();
5290 } 5120 }
5291 5121
5292 DECLARE_INSTRUCTION(Float32x4Constructor) 5122 DECLARE_INSTRUCTION(Float32x4Constructor)
5293 virtual CompileType ComputeType() const; 5123 virtual CompileType ComputeType() const;
5294 5124
5295 virtual bool AllowsCSE() const { return true; }
5296 virtual EffectSet Effects() const { return EffectSet::None(); }
5297 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5298 virtual bool AttributesEqual(Instruction* other) const { return true; } 5125 virtual bool AttributesEqual(Instruction* other) const { return true; }
5299 5126
5300 virtual bool MayThrow() const { return false; }
5301
5302 private: 5127 private:
5303 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr); 5128 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr);
5304 }; 5129 };
5305 5130
5306 5131
5307 class Float32x4SplatInstr : public TemplateDefinition<1> { 5132 class Float32x4SplatInstr : public TemplateDefinition<1, NoThrow, Pure> {
5308 public: 5133 public:
5309 Float32x4SplatInstr(Value* value, intptr_t deopt_id) 5134 Float32x4SplatInstr(Value* value, intptr_t deopt_id)
5310 : TemplateDefinition<1>(deopt_id) { 5135 : TemplateDefinition(deopt_id) {
5311 SetInputAt(0, value); 5136 SetInputAt(0, value);
5312 } 5137 }
5313 5138
5314 Value* value() const { return inputs_[0]; } 5139 Value* value() const { return inputs_[0]; }
5315 5140
5316 virtual void PrintOperandsTo(BufferFormatter* f) const; 5141 virtual void PrintOperandsTo(BufferFormatter* f) const;
5317 5142
5318 virtual bool CanDeoptimize() const { return false; } 5143 virtual bool CanDeoptimize() const { return false; }
5319 5144
5320 virtual Representation representation() const { 5145 virtual Representation representation() const {
5321 return kUnboxedFloat32x4; 5146 return kUnboxedFloat32x4;
5322 } 5147 }
5323 5148
5324 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5149 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5325 ASSERT(idx == 0); 5150 ASSERT(idx == 0);
5326 return kUnboxedDouble; 5151 return kUnboxedDouble;
5327 } 5152 }
5328 5153
5329 virtual intptr_t DeoptimizationTarget() const { 5154 virtual intptr_t DeoptimizationTarget() const {
5330 // Direct access since this instruction cannot deoptimize, and the deopt-id 5155 // Direct access since this instruction cannot deoptimize, and the deopt-id
5331 // was inherited from another instruction that could deoptimize. 5156 // was inherited from another instruction that could deoptimize.
5332 return GetDeoptId(); 5157 return GetDeoptId();
5333 } 5158 }
5334 5159
5335 DECLARE_INSTRUCTION(Float32x4Splat) 5160 DECLARE_INSTRUCTION(Float32x4Splat)
5336 virtual CompileType ComputeType() const; 5161 virtual CompileType ComputeType() const;
5337 5162
5338 virtual bool AllowsCSE() const { return true; }
5339 virtual EffectSet Effects() const { return EffectSet::None(); }
5340 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5341 virtual bool AttributesEqual(Instruction* other) const { return true; } 5163 virtual bool AttributesEqual(Instruction* other) const { return true; }
5342 5164
5343 virtual bool MayThrow() const { return false; }
5344
5345 private: 5165 private:
5346 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr); 5166 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr);
5347 }; 5167 };
5348 5168
5349 5169
5350 // TODO(vegorov) replace with UnboxedConstantInstr. 5170 // TODO(vegorov) replace with UnboxedConstantInstr.
5351 class Float32x4ZeroInstr : public TemplateDefinition<0> { 5171 class Float32x4ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> {
5352 public: 5172 public:
5353 Float32x4ZeroInstr() { } 5173 Float32x4ZeroInstr() { }
5354 5174
5355 virtual bool CanDeoptimize() const { return false; } 5175 virtual bool CanDeoptimize() const { return false; }
5356 5176
5357 virtual Representation representation() const { 5177 virtual Representation representation() const {
5358 return kUnboxedFloat32x4; 5178 return kUnboxedFloat32x4;
5359 } 5179 }
5360 5180
5361 DECLARE_INSTRUCTION(Float32x4Zero) 5181 DECLARE_INSTRUCTION(Float32x4Zero)
5362 virtual CompileType ComputeType() const; 5182 virtual CompileType ComputeType() const;
5363 5183
5364 virtual bool AllowsCSE() const { return true; }
5365 virtual EffectSet Effects() const { return EffectSet::None(); }
5366 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5367 virtual bool AttributesEqual(Instruction* other) const { return true; } 5184 virtual bool AttributesEqual(Instruction* other) const { return true; }
5368 5185
5369 virtual bool MayThrow() const { return false; }
5370
5371 private: 5186 private:
5372 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); 5187 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr);
5373 }; 5188 };
5374 5189
5375 5190
5376 class Float32x4ComparisonInstr : public TemplateDefinition<2> { 5191 class Float32x4ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> {
5377 public: 5192 public:
5378 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind, 5193 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind,
5379 Value* left, 5194 Value* left,
5380 Value* right, 5195 Value* right,
5381 intptr_t deopt_id) 5196 intptr_t deopt_id)
5382 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 5197 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
5383 SetInputAt(0, left); 5198 SetInputAt(0, left);
5384 SetInputAt(1, right); 5199 SetInputAt(1, right);
5385 } 5200 }
5386 5201
5387 Value* left() const { return inputs_[0]; } 5202 Value* left() const { return inputs_[0]; }
5388 Value* right() const { return inputs_[1]; } 5203 Value* right() const { return inputs_[1]; }
5389 5204
5390 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5205 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5391 5206
5392 virtual void PrintOperandsTo(BufferFormatter* f) const; 5207 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 11 matching lines...) Expand all
5404 5219
5405 virtual intptr_t DeoptimizationTarget() const { 5220 virtual intptr_t DeoptimizationTarget() const {
5406 // Direct access since this instruction cannot deoptimize, and the deopt-id 5221 // Direct access since this instruction cannot deoptimize, and the deopt-id
5407 // was inherited from another instruction that could deoptimize. 5222 // was inherited from another instruction that could deoptimize.
5408 return GetDeoptId(); 5223 return GetDeoptId();
5409 } 5224 }
5410 5225
5411 DECLARE_INSTRUCTION(Float32x4Comparison) 5226 DECLARE_INSTRUCTION(Float32x4Comparison)
5412 virtual CompileType ComputeType() const; 5227 virtual CompileType ComputeType() const;
5413 5228
5414 virtual bool AllowsCSE() const { return true; }
5415 virtual EffectSet Effects() const { return EffectSet::None(); }
5416 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5417 virtual bool AttributesEqual(Instruction* other) const { 5229 virtual bool AttributesEqual(Instruction* other) const {
5418 return op_kind() == other->AsFloat32x4Comparison()->op_kind(); 5230 return op_kind() == other->AsFloat32x4Comparison()->op_kind();
5419 } 5231 }
5420 5232
5421 virtual bool MayThrow() const { return false; }
5422
5423 private: 5233 private:
5424 const MethodRecognizer::Kind op_kind_; 5234 const MethodRecognizer::Kind op_kind_;
5425 5235
5426 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr); 5236 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr);
5427 }; 5237 };
5428 5238
5429 5239
5430 class Float32x4MinMaxInstr : public TemplateDefinition<2> { 5240 class Float32x4MinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> {
5431 public: 5241 public:
5432 Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind, 5242 Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind,
5433 Value* left, 5243 Value* left,
5434 Value* right, 5244 Value* right,
5435 intptr_t deopt_id) 5245 intptr_t deopt_id)
5436 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 5246 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
5437 SetInputAt(0, left); 5247 SetInputAt(0, left);
5438 SetInputAt(1, right); 5248 SetInputAt(1, right);
5439 } 5249 }
5440 5250
5441 Value* left() const { return inputs_[0]; } 5251 Value* left() const { return inputs_[0]; }
5442 Value* right() const { return inputs_[1]; } 5252 Value* right() const { return inputs_[1]; }
5443 5253
5444 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5254 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5445 5255
5446 virtual void PrintOperandsTo(BufferFormatter* f) const; 5256 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 11 matching lines...) Expand all
5458 5268
5459 virtual intptr_t DeoptimizationTarget() const { 5269 virtual intptr_t DeoptimizationTarget() const {
5460 // Direct access since this instruction cannot deoptimize, and the deopt-id 5270 // Direct access since this instruction cannot deoptimize, and the deopt-id
5461 // was inherited from another instruction that could deoptimize. 5271 // was inherited from another instruction that could deoptimize.
5462 return GetDeoptId(); 5272 return GetDeoptId();
5463 } 5273 }
5464 5274
5465 DECLARE_INSTRUCTION(Float32x4MinMax) 5275 DECLARE_INSTRUCTION(Float32x4MinMax)
5466 virtual CompileType ComputeType() const; 5276 virtual CompileType ComputeType() const;
5467 5277
5468 virtual bool AllowsCSE() const { return true; }
5469 virtual EffectSet Effects() const { return EffectSet::None(); }
5470 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5471 virtual bool AttributesEqual(Instruction* other) const { 5278 virtual bool AttributesEqual(Instruction* other) const {
5472 return op_kind() == other->AsFloat32x4MinMax()->op_kind(); 5279 return op_kind() == other->AsFloat32x4MinMax()->op_kind();
5473 } 5280 }
5474 5281
5475 virtual bool MayThrow() const { return false; }
5476
5477 private: 5282 private:
5478 const MethodRecognizer::Kind op_kind_; 5283 const MethodRecognizer::Kind op_kind_;
5479 5284
5480 DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr); 5285 DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr);
5481 }; 5286 };
5482 5287
5483 5288
5484 class Float32x4ScaleInstr : public TemplateDefinition<2> { 5289 class Float32x4ScaleInstr : public TemplateDefinition<2, NoThrow, Pure> {
5485 public: 5290 public:
5486 Float32x4ScaleInstr(MethodRecognizer::Kind op_kind, 5291 Float32x4ScaleInstr(MethodRecognizer::Kind op_kind,
5487 Value* left, 5292 Value* left,
5488 Value* right, 5293 Value* right,
5489 intptr_t deopt_id) 5294 intptr_t deopt_id)
5490 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 5295 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
5491 SetInputAt(0, left); 5296 SetInputAt(0, left);
5492 SetInputAt(1, right); 5297 SetInputAt(1, right);
5493 } 5298 }
5494 5299
5495 Value* left() const { return inputs_[0]; } 5300 Value* left() const { return inputs_[0]; }
5496 Value* right() const { return inputs_[1]; } 5301 Value* right() const { return inputs_[1]; }
5497 5302
5498 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5303 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5499 5304
5500 virtual void PrintOperandsTo(BufferFormatter* f) const; 5305 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 14 matching lines...) Expand all
5515 5320
5516 virtual intptr_t DeoptimizationTarget() const { 5321 virtual intptr_t DeoptimizationTarget() const {
5517 // Direct access since this instruction cannot deoptimize, and the deopt-id 5322 // Direct access since this instruction cannot deoptimize, and the deopt-id
5518 // was inherited from another instruction that could deoptimize. 5323 // was inherited from another instruction that could deoptimize.
5519 return GetDeoptId(); 5324 return GetDeoptId();
5520 } 5325 }
5521 5326
5522 DECLARE_INSTRUCTION(Float32x4Scale) 5327 DECLARE_INSTRUCTION(Float32x4Scale)
5523 virtual CompileType ComputeType() const; 5328 virtual CompileType ComputeType() const;
5524 5329
5525 virtual bool AllowsCSE() const { return true; }
5526 virtual EffectSet Effects() const { return EffectSet::None(); }
5527 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5528 virtual bool AttributesEqual(Instruction* other) const { 5330 virtual bool AttributesEqual(Instruction* other) const {
5529 return op_kind() == other->AsFloat32x4Scale()->op_kind(); 5331 return op_kind() == other->AsFloat32x4Scale()->op_kind();
5530 } 5332 }
5531 5333
5532 virtual bool MayThrow() const { return false; }
5533
5534 private: 5334 private:
5535 const MethodRecognizer::Kind op_kind_; 5335 const MethodRecognizer::Kind op_kind_;
5536 5336
5537 DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr); 5337 DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr);
5538 }; 5338 };
5539 5339
5540 5340
5541 class Float32x4SqrtInstr : public TemplateDefinition<1> { 5341 class Float32x4SqrtInstr : public TemplateDefinition<1, NoThrow, Pure> {
5542 public: 5342 public:
5543 Float32x4SqrtInstr(MethodRecognizer::Kind op_kind, 5343 Float32x4SqrtInstr(MethodRecognizer::Kind op_kind,
5544 Value* left, 5344 Value* left,
5545 intptr_t deopt_id) 5345 intptr_t deopt_id)
5546 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) { 5346 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
5547 SetInputAt(0, left); 5347 SetInputAt(0, left);
5548 } 5348 }
5549 5349
5550 Value* left() const { return inputs_[0]; } 5350 Value* left() const { return inputs_[0]; }
5551 5351
5552 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5352 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5553 5353
5554 virtual void PrintOperandsTo(BufferFormatter* f) const; 5354 virtual void PrintOperandsTo(BufferFormatter* f) const;
5555 5355
5556 virtual bool CanDeoptimize() const { return false; } 5356 virtual bool CanDeoptimize() const { return false; }
5557 5357
5558 virtual Representation representation() const { 5358 virtual Representation representation() const {
5559 return kUnboxedFloat32x4; 5359 return kUnboxedFloat32x4;
5560 } 5360 }
5561 5361
5562 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5362 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5563 ASSERT(idx == 0); 5363 ASSERT(idx == 0);
5564 return kUnboxedFloat32x4; 5364 return kUnboxedFloat32x4;
5565 } 5365 }
5566 5366
5567 virtual intptr_t DeoptimizationTarget() const { 5367 virtual intptr_t DeoptimizationTarget() const {
5568 // Direct access since this instruction cannot deoptimize, and the deopt-id 5368 // Direct access since this instruction cannot deoptimize, and the deopt-id
5569 // was inherited from another instruction that could deoptimize. 5369 // was inherited from another instruction that could deoptimize.
5570 return GetDeoptId(); 5370 return GetDeoptId();
5571 } 5371 }
5572 5372
5573 DECLARE_INSTRUCTION(Float32x4Sqrt) 5373 DECLARE_INSTRUCTION(Float32x4Sqrt)
5574 virtual CompileType ComputeType() const; 5374 virtual CompileType ComputeType() const;
5575 5375
5576 virtual bool AllowsCSE() const { return true; }
5577 virtual EffectSet Effects() const { return EffectSet::None(); }
5578 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5579 virtual bool AttributesEqual(Instruction* other) const { 5376 virtual bool AttributesEqual(Instruction* other) const {
5580 return op_kind() == other->AsFloat32x4Sqrt()->op_kind(); 5377 return op_kind() == other->AsFloat32x4Sqrt()->op_kind();
5581 } 5378 }
5582 5379
5583 virtual bool MayThrow() const { return false; }
5584
5585 private: 5380 private:
5586 const MethodRecognizer::Kind op_kind_; 5381 const MethodRecognizer::Kind op_kind_;
5587 5382
5588 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr); 5383 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr);
5589 }; 5384 };
5590 5385
5591 5386
5592 // TODO(vegorov) rename to Unary to match naming convention for arithmetic. 5387 // TODO(vegorov) rename to Unary to match naming convention for arithmetic.
5593 class Float32x4ZeroArgInstr : public TemplateDefinition<1> { 5388 class Float32x4ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> {
5594 public: 5389 public:
5595 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind, 5390 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind,
5596 Value* left, 5391 Value* left,
5597 intptr_t deopt_id) 5392 intptr_t deopt_id)
5598 : TemplateDefinition<1>(deopt_id), 5393 : TemplateDefinition(deopt_id),
5599 op_kind_(op_kind) { 5394 op_kind_(op_kind) {
5600 SetInputAt(0, left); 5395 SetInputAt(0, left);
5601 } 5396 }
5602 5397
5603 Value* left() const { return inputs_[0]; } 5398 Value* left() const { return inputs_[0]; }
5604 5399
5605 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5400 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5606 5401
5607 virtual void PrintOperandsTo(BufferFormatter* f) const; 5402 virtual void PrintOperandsTo(BufferFormatter* f) const;
5608 5403
(...skipping 10 matching lines...) Expand all
5619 5414
5620 virtual intptr_t DeoptimizationTarget() const { 5415 virtual intptr_t DeoptimizationTarget() const {
5621 // Direct access since this instruction cannot deoptimize, and the deopt-id 5416 // Direct access since this instruction cannot deoptimize, and the deopt-id
5622 // was inherited from another instruction that could deoptimize. 5417 // was inherited from another instruction that could deoptimize.
5623 return GetDeoptId(); 5418 return GetDeoptId();
5624 } 5419 }
5625 5420
5626 DECLARE_INSTRUCTION(Float32x4ZeroArg) 5421 DECLARE_INSTRUCTION(Float32x4ZeroArg)
5627 virtual CompileType ComputeType() const; 5422 virtual CompileType ComputeType() const;
5628 5423
5629 virtual bool AllowsCSE() const { return true; }
5630 virtual EffectSet Effects() const { return EffectSet::None(); }
5631 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5632 virtual bool AttributesEqual(Instruction* other) const { 5424 virtual bool AttributesEqual(Instruction* other) const {
5633 return op_kind() == other->AsFloat32x4ZeroArg()->op_kind(); 5425 return op_kind() == other->AsFloat32x4ZeroArg()->op_kind();
5634 } 5426 }
5635 5427
5636 virtual bool MayThrow() const { return false; }
5637
5638 private: 5428 private:
5639 const MethodRecognizer::Kind op_kind_; 5429 const MethodRecognizer::Kind op_kind_;
5640 5430
5641 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr); 5431 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr);
5642 }; 5432 };
5643 5433
5644 5434
5645 class Float32x4ClampInstr : public TemplateDefinition<3> { 5435 class Float32x4ClampInstr : public TemplateDefinition<3, NoThrow, Pure> {
5646 public: 5436 public:
5647 Float32x4ClampInstr(Value* left, 5437 Float32x4ClampInstr(Value* left,
5648 Value* lower, 5438 Value* lower,
5649 Value* upper, 5439 Value* upper,
5650 intptr_t deopt_id) 5440 intptr_t deopt_id)
5651 : TemplateDefinition<3>(deopt_id) { 5441 : TemplateDefinition(deopt_id) {
5652 SetInputAt(0, left); 5442 SetInputAt(0, left);
5653 SetInputAt(1, lower); 5443 SetInputAt(1, lower);
5654 SetInputAt(2, upper); 5444 SetInputAt(2, upper);
5655 } 5445 }
5656 5446
5657 Value* left() const { return inputs_[0]; } 5447 Value* left() const { return inputs_[0]; }
5658 Value* lower() const { return inputs_[1]; } 5448 Value* lower() const { return inputs_[1]; }
5659 Value* upper() const { return inputs_[2]; } 5449 Value* upper() const { return inputs_[2]; }
5660 5450
5661 virtual void PrintOperandsTo(BufferFormatter* f) const; 5451 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 11 matching lines...) Expand all
5673 5463
5674 virtual intptr_t DeoptimizationTarget() const { 5464 virtual intptr_t DeoptimizationTarget() const {
5675 // Direct access since this instruction cannot deoptimize, and the deopt-id 5465 // Direct access since this instruction cannot deoptimize, and the deopt-id
5676 // was inherited from another instruction that could deoptimize. 5466 // was inherited from another instruction that could deoptimize.
5677 return GetDeoptId(); 5467 return GetDeoptId();
5678 } 5468 }
5679 5469
5680 DECLARE_INSTRUCTION(Float32x4Clamp) 5470 DECLARE_INSTRUCTION(Float32x4Clamp)
5681 virtual CompileType ComputeType() const; 5471 virtual CompileType ComputeType() const;
5682 5472
5683 virtual bool AllowsCSE() const { return true; }
5684 virtual EffectSet Effects() const { return EffectSet::None(); }
5685 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5686 virtual bool AttributesEqual(Instruction* other) const { return true; } 5473 virtual bool AttributesEqual(Instruction* other) const { return true; }
5687 5474
5688 virtual bool MayThrow() const { return false; }
5689
5690 private: 5475 private:
5691 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr); 5476 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr);
5692 }; 5477 };
5693 5478
5694 5479
5695 class Float32x4WithInstr : public TemplateDefinition<2> { 5480 class Float32x4WithInstr : public TemplateDefinition<2, NoThrow, Pure> {
5696 public: 5481 public:
5697 Float32x4WithInstr(MethodRecognizer::Kind op_kind, 5482 Float32x4WithInstr(MethodRecognizer::Kind op_kind,
5698 Value* left, 5483 Value* left,
5699 Value* replacement, 5484 Value* replacement,
5700 intptr_t deopt_id) 5485 intptr_t deopt_id)
5701 : TemplateDefinition<2>(deopt_id), 5486 : TemplateDefinition(deopt_id),
5702 op_kind_(op_kind) { 5487 op_kind_(op_kind) {
5703 SetInputAt(0, replacement); 5488 SetInputAt(0, replacement);
5704 SetInputAt(1, left); 5489 SetInputAt(1, left);
5705 } 5490 }
5706 5491
5707 Value* left() const { return inputs_[1]; } 5492 Value* left() const { return inputs_[1]; }
5708 Value* replacement() const { return inputs_[0]; } 5493 Value* replacement() const { return inputs_[0]; }
5709 5494
5710 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5495 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5711 5496
(...skipping 15 matching lines...) Expand all
5727 5512
5728 virtual intptr_t DeoptimizationTarget() const { 5513 virtual intptr_t DeoptimizationTarget() const {
5729 // Direct access since this instruction cannot deoptimize, and the deopt-id 5514 // Direct access since this instruction cannot deoptimize, and the deopt-id
5730 // was inherited from another instruction that could deoptimize. 5515 // was inherited from another instruction that could deoptimize.
5731 return GetDeoptId(); 5516 return GetDeoptId();
5732 } 5517 }
5733 5518
5734 DECLARE_INSTRUCTION(Float32x4With) 5519 DECLARE_INSTRUCTION(Float32x4With)
5735 virtual CompileType ComputeType() const; 5520 virtual CompileType ComputeType() const;
5736 5521
5737 virtual bool AllowsCSE() const { return true; }
5738 virtual EffectSet Effects() const { return EffectSet::None(); }
5739 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5740 virtual bool AttributesEqual(Instruction* other) const { 5522 virtual bool AttributesEqual(Instruction* other) const {
5741 return op_kind() == other->AsFloat32x4With()->op_kind(); 5523 return op_kind() == other->AsFloat32x4With()->op_kind();
5742 } 5524 }
5743 5525
5744 virtual bool MayThrow() const { return false; }
5745
5746 private: 5526 private:
5747 const MethodRecognizer::Kind op_kind_; 5527 const MethodRecognizer::Kind op_kind_;
5748 5528
5749 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr); 5529 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr);
5750 }; 5530 };
5751 5531
5752 5532
5753 class Simd64x2ShuffleInstr : public TemplateDefinition<1> { 5533 class Simd64x2ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> {
5754 public: 5534 public:
5755 Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind, 5535 Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind,
5756 Value* value, 5536 Value* value,
5757 intptr_t mask, 5537 intptr_t mask,
5758 intptr_t deopt_id) 5538 intptr_t deopt_id)
5759 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind), mask_(mask) { 5539 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) {
5760 SetInputAt(0, value); 5540 SetInputAt(0, value);
5761 } 5541 }
5762 5542
5763 Value* value() const { return inputs_[0]; } 5543 Value* value() const { return inputs_[0]; }
5764 5544
5765 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5545 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5766 5546
5767 intptr_t mask() const { return mask_; } 5547 intptr_t mask() const { return mask_; }
5768 5548
5769 virtual void PrintOperandsTo(BufferFormatter* f) const; 5549 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 21 matching lines...) Expand all
5791 5571
5792 virtual intptr_t DeoptimizationTarget() const { 5572 virtual intptr_t DeoptimizationTarget() const {
5793 // Direct access since this instruction cannot deoptimize, and the deopt-id 5573 // Direct access since this instruction cannot deoptimize, and the deopt-id
5794 // was inherited from another instruction that could deoptimize. 5574 // was inherited from another instruction that could deoptimize.
5795 return GetDeoptId(); 5575 return GetDeoptId();
5796 } 5576 }
5797 5577
5798 DECLARE_INSTRUCTION(Simd64x2Shuffle) 5578 DECLARE_INSTRUCTION(Simd64x2Shuffle)
5799 virtual CompileType ComputeType() const; 5579 virtual CompileType ComputeType() const;
5800 5580
5801 virtual bool AllowsCSE() const { return true; }
5802 virtual EffectSet Effects() const { return EffectSet::None(); }
5803 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5804 virtual bool AttributesEqual(Instruction* other) const { 5581 virtual bool AttributesEqual(Instruction* other) const {
5805 return (op_kind() == other->AsSimd64x2Shuffle()->op_kind()) && 5582 return (op_kind() == other->AsSimd64x2Shuffle()->op_kind()) &&
5806 (mask() == other->AsSimd64x2Shuffle()->mask()); 5583 (mask() == other->AsSimd64x2Shuffle()->mask());
5807 } 5584 }
5808 5585
5809 virtual bool MayThrow() const { return false; }
5810
5811 private: 5586 private:
5812 const MethodRecognizer::Kind op_kind_; 5587 const MethodRecognizer::Kind op_kind_;
5813 const intptr_t mask_; 5588 const intptr_t mask_;
5814 5589
5815 DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr); 5590 DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr);
5816 }; 5591 };
5817 5592
5818 5593
5819 class Float32x4ToInt32x4Instr : public TemplateDefinition<1> { 5594 class Float32x4ToInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
5820 public: 5595 public:
5821 Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id) 5596 Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id)
5822 : TemplateDefinition<1>(deopt_id) { 5597 : TemplateDefinition(deopt_id) {
5823 SetInputAt(0, left); 5598 SetInputAt(0, left);
5824 } 5599 }
5825 5600
5826 Value* left() const { return inputs_[0]; } 5601 Value* left() const { return inputs_[0]; }
5827 5602
5828 virtual void PrintOperandsTo(BufferFormatter* f) const; 5603 virtual void PrintOperandsTo(BufferFormatter* f) const;
5829 5604
5830 virtual bool CanDeoptimize() const { return false; } 5605 virtual bool CanDeoptimize() const { return false; }
5831 5606
5832 virtual Representation representation() const { 5607 virtual Representation representation() const {
5833 return kUnboxedInt32x4; 5608 return kUnboxedInt32x4;
5834 } 5609 }
5835 5610
5836 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5611 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5837 ASSERT(idx == 0); 5612 ASSERT(idx == 0);
5838 return kUnboxedFloat32x4; 5613 return kUnboxedFloat32x4;
5839 } 5614 }
5840 5615
5841 virtual intptr_t DeoptimizationTarget() const { 5616 virtual intptr_t DeoptimizationTarget() const {
5842 // Direct access since this instruction cannot deoptimize, and the deopt-id 5617 // Direct access since this instruction cannot deoptimize, and the deopt-id
5843 // was inherited from another instruction that could deoptimize. 5618 // was inherited from another instruction that could deoptimize.
5844 return GetDeoptId(); 5619 return GetDeoptId();
5845 } 5620 }
5846 5621
5847 DECLARE_INSTRUCTION(Float32x4ToInt32x4) 5622 DECLARE_INSTRUCTION(Float32x4ToInt32x4)
5848 virtual CompileType ComputeType() const; 5623 virtual CompileType ComputeType() const;
5849 5624
5850 virtual bool AllowsCSE() const { return true; }
5851 virtual EffectSet Effects() const { return EffectSet::None(); }
5852 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5853 virtual bool AttributesEqual(Instruction* other) const { return true; } 5625 virtual bool AttributesEqual(Instruction* other) const { return true; }
5854 5626
5855 virtual bool MayThrow() const { return false; }
5856
5857 private: 5627 private:
5858 DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr); 5628 DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr);
5859 }; 5629 };
5860 5630
5861 5631
5862 class Float32x4ToFloat64x2Instr : public TemplateDefinition<1> { 5632 class Float32x4ToFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> {
5863 public: 5633 public:
5864 Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id) 5634 Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id)
5865 : TemplateDefinition<1>(deopt_id) { 5635 : TemplateDefinition(deopt_id) {
5866 SetInputAt(0, left); 5636 SetInputAt(0, left);
5867 } 5637 }
5868 5638
5869 Value* left() const { return inputs_[0]; } 5639 Value* left() const { return inputs_[0]; }
5870 5640
5871 virtual void PrintOperandsTo(BufferFormatter* f) const; 5641 virtual void PrintOperandsTo(BufferFormatter* f) const;
5872 5642
5873 virtual bool CanDeoptimize() const { return false; } 5643 virtual bool CanDeoptimize() const { return false; }
5874 5644
5875 virtual Representation representation() const { 5645 virtual Representation representation() const {
5876 return kUnboxedFloat64x2; 5646 return kUnboxedFloat64x2;
5877 } 5647 }
5878 5648
5879 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5649 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5880 ASSERT(idx == 0); 5650 ASSERT(idx == 0);
5881 return kUnboxedFloat32x4; 5651 return kUnboxedFloat32x4;
5882 } 5652 }
5883 5653
5884 virtual intptr_t DeoptimizationTarget() const { 5654 virtual intptr_t DeoptimizationTarget() const {
5885 // Direct access since this instruction cannot deoptimize, and the deopt-id 5655 // Direct access since this instruction cannot deoptimize, and the deopt-id
5886 // was inherited from another instruction that could deoptimize. 5656 // was inherited from another instruction that could deoptimize.
5887 return GetDeoptId(); 5657 return GetDeoptId();
5888 } 5658 }
5889 5659
5890 DECLARE_INSTRUCTION(Float32x4ToFloat64x2) 5660 DECLARE_INSTRUCTION(Float32x4ToFloat64x2)
5891 virtual CompileType ComputeType() const; 5661 virtual CompileType ComputeType() const;
5892 5662
5893 virtual bool AllowsCSE() const { return true; }
5894 virtual EffectSet Effects() const { return EffectSet::None(); }
5895 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5896 virtual bool AttributesEqual(Instruction* other) const { return true; } 5663 virtual bool AttributesEqual(Instruction* other) const { return true; }
5897 5664
5898 virtual bool MayThrow() const { return false; }
5899
5900 private: 5665 private:
5901 DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr); 5666 DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr);
5902 }; 5667 };
5903 5668
5904 5669
5905 class Float64x2ToFloat32x4Instr : public TemplateDefinition<1> { 5670 class Float64x2ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
5906 public: 5671 public:
5907 Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id) 5672 Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id)
5908 : TemplateDefinition<1>(deopt_id) { 5673 : TemplateDefinition(deopt_id) {
5909 SetInputAt(0, left); 5674 SetInputAt(0, left);
5910 } 5675 }
5911 5676
5912 Value* left() const { return inputs_[0]; } 5677 Value* left() const { return inputs_[0]; }
5913 5678
5914 virtual void PrintOperandsTo(BufferFormatter* f) const; 5679 virtual void PrintOperandsTo(BufferFormatter* f) const;
5915 5680
5916 virtual bool CanDeoptimize() const { return false; } 5681 virtual bool CanDeoptimize() const { return false; }
5917 5682
5918 virtual Representation representation() const { 5683 virtual Representation representation() const {
5919 return kUnboxedFloat32x4; 5684 return kUnboxedFloat32x4;
5920 } 5685 }
5921 5686
5922 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5687 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5923 ASSERT(idx == 0); 5688 ASSERT(idx == 0);
5924 return kUnboxedFloat64x2; 5689 return kUnboxedFloat64x2;
5925 } 5690 }
5926 5691
5927 virtual intptr_t DeoptimizationTarget() const { 5692 virtual intptr_t DeoptimizationTarget() const {
5928 // Direct access since this instruction cannot deoptimize, and the deopt-id 5693 // Direct access since this instruction cannot deoptimize, and the deopt-id
5929 // was inherited from another instruction that could deoptimize. 5694 // was inherited from another instruction that could deoptimize.
5930 return GetDeoptId(); 5695 return GetDeoptId();
5931 } 5696 }
5932 5697
5933 DECLARE_INSTRUCTION(Float64x2ToFloat32x4) 5698 DECLARE_INSTRUCTION(Float64x2ToFloat32x4)
5934 virtual CompileType ComputeType() const; 5699 virtual CompileType ComputeType() const;
5935 5700
5936 virtual bool AllowsCSE() const { return true; }
5937 virtual EffectSet Effects() const { return EffectSet::None(); }
5938 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5939 virtual bool AttributesEqual(Instruction* other) const { return true; } 5701 virtual bool AttributesEqual(Instruction* other) const { return true; }
5940 5702
5941 virtual bool MayThrow() const { return false; }
5942
5943 private: 5703 private:
5944 DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr); 5704 DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr);
5945 }; 5705 };
5946 5706
5947 5707
5948 class Float64x2ConstructorInstr : public TemplateDefinition<2> { 5708 class Float64x2ConstructorInstr : public TemplateDefinition<2, NoThrow, Pure> {
5949 public: 5709 public:
5950 Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id) 5710 Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id)
5951 : TemplateDefinition<2>(deopt_id) { 5711 : TemplateDefinition(deopt_id) {
5952 SetInputAt(0, value0); 5712 SetInputAt(0, value0);
5953 SetInputAt(1, value1); 5713 SetInputAt(1, value1);
5954 } 5714 }
5955 5715
5956 Value* value0() const { return inputs_[0]; } 5716 Value* value0() const { return inputs_[0]; }
5957 Value* value1() const { return inputs_[1]; } 5717 Value* value1() const { return inputs_[1]; }
5958 5718
5959 virtual void PrintOperandsTo(BufferFormatter* f) const; 5719 virtual void PrintOperandsTo(BufferFormatter* f) const;
5960 5720
5961 virtual bool CanDeoptimize() const { return false; } 5721 virtual bool CanDeoptimize() const { return false; }
5962 5722
5963 virtual Representation representation() const { 5723 virtual Representation representation() const {
5964 return kUnboxedFloat64x2; 5724 return kUnboxedFloat64x2;
5965 } 5725 }
5966 5726
5967 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5727 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5968 ASSERT(idx >= 0 && idx < 2); 5728 ASSERT(idx >= 0 && idx < 2);
5969 return kUnboxedDouble; 5729 return kUnboxedDouble;
5970 } 5730 }
5971 5731
5972 virtual intptr_t DeoptimizationTarget() const { 5732 virtual intptr_t DeoptimizationTarget() const {
5973 // Direct access since this instruction cannot deoptimize, and the deopt-id 5733 // Direct access since this instruction cannot deoptimize, and the deopt-id
5974 // was inherited from another instruction that could deoptimize. 5734 // was inherited from another instruction that could deoptimize.
5975 return GetDeoptId(); 5735 return GetDeoptId();
5976 } 5736 }
5977 5737
5978 DECLARE_INSTRUCTION(Float64x2Constructor) 5738 DECLARE_INSTRUCTION(Float64x2Constructor)
5979 virtual CompileType ComputeType() const; 5739 virtual CompileType ComputeType() const;
5980 5740
5981 virtual bool AllowsCSE() const { return true; }
5982 virtual EffectSet Effects() const { return EffectSet::None(); }
5983 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5984 virtual bool AttributesEqual(Instruction* other) const { return true; } 5741 virtual bool AttributesEqual(Instruction* other) const { return true; }
5985 5742
5986 virtual bool MayThrow() const { return false; }
5987
5988 private: 5743 private:
5989 DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr); 5744 DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr);
5990 }; 5745 };
5991 5746
5992 5747
5993 class Float64x2SplatInstr : public TemplateDefinition<1> { 5748 class Float64x2SplatInstr : public TemplateDefinition<1, NoThrow, Pure> {
5994 public: 5749 public:
5995 Float64x2SplatInstr(Value* value, intptr_t deopt_id) 5750 Float64x2SplatInstr(Value* value, intptr_t deopt_id)
5996 : TemplateDefinition<1>(deopt_id) { 5751 : TemplateDefinition(deopt_id) {
5997 SetInputAt(0, value); 5752 SetInputAt(0, value);
5998 } 5753 }
5999 5754
6000 Value* value() const { return inputs_[0]; } 5755 Value* value() const { return inputs_[0]; }
6001 5756
6002 virtual void PrintOperandsTo(BufferFormatter* f) const; 5757 virtual void PrintOperandsTo(BufferFormatter* f) const;
6003 5758
6004 virtual bool CanDeoptimize() const { return false; } 5759 virtual bool CanDeoptimize() const { return false; }
6005 5760
6006 virtual Representation representation() const { 5761 virtual Representation representation() const {
6007 return kUnboxedFloat64x2; 5762 return kUnboxedFloat64x2;
6008 } 5763 }
6009 5764
6010 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5765 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6011 ASSERT(idx == 0); 5766 ASSERT(idx == 0);
6012 return kUnboxedDouble; 5767 return kUnboxedDouble;
6013 } 5768 }
6014 5769
6015 virtual intptr_t DeoptimizationTarget() const { 5770 virtual intptr_t DeoptimizationTarget() const {
6016 // Direct access since this instruction cannot deoptimize, and the deopt-id 5771 // Direct access since this instruction cannot deoptimize, and the deopt-id
6017 // was inherited from another instruction that could deoptimize. 5772 // was inherited from another instruction that could deoptimize.
6018 return GetDeoptId(); 5773 return GetDeoptId();
6019 } 5774 }
6020 5775
6021 DECLARE_INSTRUCTION(Float64x2Splat) 5776 DECLARE_INSTRUCTION(Float64x2Splat)
6022 virtual CompileType ComputeType() const; 5777 virtual CompileType ComputeType() const;
6023 5778
6024 virtual bool AllowsCSE() const { return true; }
6025 virtual EffectSet Effects() const { return EffectSet::None(); }
6026 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6027 virtual bool AttributesEqual(Instruction* other) const { return true; } 5779 virtual bool AttributesEqual(Instruction* other) const { return true; }
6028 5780
6029 virtual bool MayThrow() const { return false; }
6030
6031 private: 5781 private:
6032 DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr); 5782 DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr);
6033 }; 5783 };
6034 5784
6035 5785
6036 class Float64x2ZeroInstr : public TemplateDefinition<0> { 5786 class Float64x2ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> {
6037 public: 5787 public:
6038 Float64x2ZeroInstr() { } 5788 Float64x2ZeroInstr() { }
6039 5789
6040 virtual bool CanDeoptimize() const { return false; } 5790 virtual bool CanDeoptimize() const { return false; }
6041 5791
6042 virtual Representation representation() const { 5792 virtual Representation representation() const {
6043 return kUnboxedFloat64x2; 5793 return kUnboxedFloat64x2;
6044 } 5794 }
6045 5795
6046 DECLARE_INSTRUCTION(Float64x2Zero) 5796 DECLARE_INSTRUCTION(Float64x2Zero)
6047 virtual CompileType ComputeType() const; 5797 virtual CompileType ComputeType() const;
6048 5798
6049 virtual bool AllowsCSE() const { return true; }
6050 virtual EffectSet Effects() const { return EffectSet::None(); }
6051 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6052 virtual bool AttributesEqual(Instruction* other) const { return true; } 5799 virtual bool AttributesEqual(Instruction* other) const { return true; }
6053 5800
6054 virtual bool MayThrow() const { return false; }
6055
6056 private: 5801 private:
6057 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); 5802 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr);
6058 }; 5803 };
6059 5804
6060 5805
6061 // TODO(vegorov) rename to Unary to match arithmetic instructions. 5806 // TODO(vegorov) rename to Unary to match arithmetic instructions.
6062 class Float64x2ZeroArgInstr : public TemplateDefinition<1> { 5807 class Float64x2ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> {
6063 public: 5808 public:
6064 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind, 5809 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind,
6065 Value* left, 5810 Value* left,
6066 intptr_t deopt_id) 5811 intptr_t deopt_id)
6067 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) { 5812 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6068 SetInputAt(0, left); 5813 SetInputAt(0, left);
6069 } 5814 }
6070 5815
6071 Value* left() const { return inputs_[0]; } 5816 Value* left() const { return inputs_[0]; }
6072 5817
6073 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5818 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6074 5819
6075 virtual void PrintOperandsTo(BufferFormatter* f) const; 5820 virtual void PrintOperandsTo(BufferFormatter* f) const;
6076 5821
6077 virtual bool CanDeoptimize() const { return false; } 5822 virtual bool CanDeoptimize() const { return false; }
(...skipping 13 matching lines...) Expand all
6091 5836
6092 virtual intptr_t DeoptimizationTarget() const { 5837 virtual intptr_t DeoptimizationTarget() const {
6093 // Direct access since this instruction cannot deoptimize, and the deopt-id 5838 // Direct access since this instruction cannot deoptimize, and the deopt-id
6094 // was inherited from another instruction that could deoptimize. 5839 // was inherited from another instruction that could deoptimize.
6095 return GetDeoptId(); 5840 return GetDeoptId();
6096 } 5841 }
6097 5842
6098 DECLARE_INSTRUCTION(Float64x2ZeroArg) 5843 DECLARE_INSTRUCTION(Float64x2ZeroArg)
6099 virtual CompileType ComputeType() const; 5844 virtual CompileType ComputeType() const;
6100 5845
6101 virtual bool AllowsCSE() const { return true; }
6102 virtual EffectSet Effects() const { return EffectSet::None(); }
6103 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6104 virtual bool AttributesEqual(Instruction* other) const { 5846 virtual bool AttributesEqual(Instruction* other) const {
6105 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind(); 5847 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind();
6106 } 5848 }
6107 5849
6108 virtual bool MayThrow() const { return false; }
6109
6110 private: 5850 private:
6111 const MethodRecognizer::Kind op_kind_; 5851 const MethodRecognizer::Kind op_kind_;
6112 5852
6113 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr); 5853 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr);
6114 }; 5854 };
6115 5855
6116 5856
6117 class Float64x2OneArgInstr : public TemplateDefinition<2> { 5857 class Float64x2OneArgInstr : public TemplateDefinition<2, NoThrow, Pure> {
6118 public: 5858 public:
6119 Float64x2OneArgInstr(MethodRecognizer::Kind op_kind, 5859 Float64x2OneArgInstr(MethodRecognizer::Kind op_kind,
6120 Value* left, 5860 Value* left,
6121 Value* right, 5861 Value* right,
6122 intptr_t deopt_id) 5862 intptr_t deopt_id)
6123 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 5863 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6124 SetInputAt(0, left); 5864 SetInputAt(0, left);
6125 SetInputAt(1, right); 5865 SetInputAt(1, right);
6126 } 5866 }
6127 5867
6128 Value* left() const { return inputs_[0]; } 5868 Value* left() const { return inputs_[0]; }
6129 Value* right() const { return inputs_[1]; } 5869 Value* right() const { return inputs_[1]; }
6130 5870
6131 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5871 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6132 5872
6133 virtual void PrintOperandsTo(BufferFormatter* f) const; 5873 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 19 matching lines...) Expand all
6153 5893
6154 virtual intptr_t DeoptimizationTarget() const { 5894 virtual intptr_t DeoptimizationTarget() const {
6155 // Direct access since this instruction cannot deoptimize, and the deopt-id 5895 // Direct access since this instruction cannot deoptimize, and the deopt-id
6156 // was inherited from another instruction that could deoptimize. 5896 // was inherited from another instruction that could deoptimize.
6157 return GetDeoptId(); 5897 return GetDeoptId();
6158 } 5898 }
6159 5899
6160 DECLARE_INSTRUCTION(Float64x2OneArg) 5900 DECLARE_INSTRUCTION(Float64x2OneArg)
6161 virtual CompileType ComputeType() const; 5901 virtual CompileType ComputeType() const;
6162 5902
6163 virtual bool AllowsCSE() const { return true; }
6164 virtual EffectSet Effects() const { return EffectSet::None(); }
6165 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6166 virtual bool AttributesEqual(Instruction* other) const { 5903 virtual bool AttributesEqual(Instruction* other) const {
6167 return op_kind() == other->AsFloat64x2OneArg()->op_kind(); 5904 return op_kind() == other->AsFloat64x2OneArg()->op_kind();
6168 } 5905 }
6169 5906
6170 virtual bool MayThrow() const { return false; }
6171
6172 private: 5907 private:
6173 const MethodRecognizer::Kind op_kind_; 5908 const MethodRecognizer::Kind op_kind_;
6174 5909
6175 DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr); 5910 DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr);
6176 }; 5911 };
6177 5912
6178 5913
6179 class Int32x4ConstructorInstr : public TemplateDefinition<4> { 5914 class Int32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> {
6180 public: 5915 public:
6181 Int32x4ConstructorInstr(Value* value0, 5916 Int32x4ConstructorInstr(Value* value0,
6182 Value* value1, 5917 Value* value1,
6183 Value* value2, 5918 Value* value2,
6184 Value* value3, 5919 Value* value3,
6185 intptr_t deopt_id) 5920 intptr_t deopt_id)
6186 : TemplateDefinition<4>(deopt_id) { 5921 : TemplateDefinition(deopt_id) {
6187 SetInputAt(0, value0); 5922 SetInputAt(0, value0);
6188 SetInputAt(1, value1); 5923 SetInputAt(1, value1);
6189 SetInputAt(2, value2); 5924 SetInputAt(2, value2);
6190 SetInputAt(3, value3); 5925 SetInputAt(3, value3);
6191 } 5926 }
6192 5927
6193 Value* value0() const { return inputs_[0]; } 5928 Value* value0() const { return inputs_[0]; }
6194 Value* value1() const { return inputs_[1]; } 5929 Value* value1() const { return inputs_[1]; }
6195 Value* value2() const { return inputs_[2]; } 5930 Value* value2() const { return inputs_[2]; }
6196 Value* value3() const { return inputs_[3]; } 5931 Value* value3() const { return inputs_[3]; }
(...skipping 13 matching lines...) Expand all
6210 5945
6211 virtual intptr_t DeoptimizationTarget() const { 5946 virtual intptr_t DeoptimizationTarget() const {
6212 // Direct access since this instruction cannot deoptimize, and the deopt-id 5947 // Direct access since this instruction cannot deoptimize, and the deopt-id
6213 // was inherited from another instruction that could deoptimize. 5948 // was inherited from another instruction that could deoptimize.
6214 return GetDeoptId(); 5949 return GetDeoptId();
6215 } 5950 }
6216 5951
6217 DECLARE_INSTRUCTION(Int32x4Constructor) 5952 DECLARE_INSTRUCTION(Int32x4Constructor)
6218 virtual CompileType ComputeType() const; 5953 virtual CompileType ComputeType() const;
6219 5954
6220 virtual bool AllowsCSE() const { return true; }
6221 virtual EffectSet Effects() const { return EffectSet::None(); }
6222 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6223 virtual bool AttributesEqual(Instruction* other) const { return true; } 5955 virtual bool AttributesEqual(Instruction* other) const { return true; }
6224 5956
6225 virtual bool MayThrow() const { return false; }
6226
6227 private: 5957 private:
6228 DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr); 5958 DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr);
6229 }; 5959 };
6230 5960
6231 5961
6232 class Int32x4BoolConstructorInstr : public TemplateDefinition<4> { 5962 class Int32x4BoolConstructorInstr
5963 : public TemplateDefinition<4, NoThrow, Pure> {
6233 public: 5964 public:
6234 Int32x4BoolConstructorInstr(Value* value0, 5965 Int32x4BoolConstructorInstr(Value* value0,
6235 Value* value1, 5966 Value* value1,
6236 Value* value2, 5967 Value* value2,
6237 Value* value3, 5968 Value* value3,
6238 intptr_t deopt_id) 5969 intptr_t deopt_id)
6239 : TemplateDefinition<4>(deopt_id) { 5970 : TemplateDefinition(deopt_id) {
6240 SetInputAt(0, value0); 5971 SetInputAt(0, value0);
6241 SetInputAt(1, value1); 5972 SetInputAt(1, value1);
6242 SetInputAt(2, value2); 5973 SetInputAt(2, value2);
6243 SetInputAt(3, value3); 5974 SetInputAt(3, value3);
6244 } 5975 }
6245 5976
6246 Value* value0() const { return inputs_[0]; } 5977 Value* value0() const { return inputs_[0]; }
6247 Value* value1() const { return inputs_[1]; } 5978 Value* value1() const { return inputs_[1]; }
6248 Value* value2() const { return inputs_[2]; } 5979 Value* value2() const { return inputs_[2]; }
6249 Value* value3() const { return inputs_[3]; } 5980 Value* value3() const { return inputs_[3]; }
(...skipping 13 matching lines...) Expand all
6263 5994
6264 virtual intptr_t DeoptimizationTarget() const { 5995 virtual intptr_t DeoptimizationTarget() const {
6265 // Direct access since this instruction cannot deoptimize, and the deopt-id 5996 // Direct access since this instruction cannot deoptimize, and the deopt-id
6266 // was inherited from another instruction that could deoptimize. 5997 // was inherited from another instruction that could deoptimize.
6267 return GetDeoptId(); 5998 return GetDeoptId();
6268 } 5999 }
6269 6000
6270 DECLARE_INSTRUCTION(Int32x4BoolConstructor) 6001 DECLARE_INSTRUCTION(Int32x4BoolConstructor)
6271 virtual CompileType ComputeType() const; 6002 virtual CompileType ComputeType() const;
6272 6003
6273 virtual bool AllowsCSE() const { return true; }
6274 virtual EffectSet Effects() const { return EffectSet::None(); }
6275 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6276 virtual bool AttributesEqual(Instruction* other) const { return true; } 6004 virtual bool AttributesEqual(Instruction* other) const { return true; }
6277 6005
6278 virtual bool MayThrow() const { return false; }
6279
6280 private: 6006 private:
6281 DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr); 6007 DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr);
6282 }; 6008 };
6283 6009
6284 6010
6285 class Int32x4GetFlagInstr : public TemplateDefinition<1> { 6011 class Int32x4GetFlagInstr : public TemplateDefinition<1, NoThrow, Pure> {
6286 public: 6012 public:
6287 Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind, 6013 Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind,
6288 Value* value, 6014 Value* value,
6289 intptr_t deopt_id) 6015 intptr_t deopt_id)
6290 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) { 6016 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6291 SetInputAt(0, value); 6017 SetInputAt(0, value);
6292 } 6018 }
6293 6019
6294 Value* value() const { return inputs_[0]; } 6020 Value* value() const { return inputs_[0]; }
6295 6021
6296 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6022 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6297 6023
6298 virtual void PrintOperandsTo(BufferFormatter* f) const; 6024 virtual void PrintOperandsTo(BufferFormatter* f) const;
6299 6025
6300 virtual bool CanDeoptimize() const { return false; } 6026 virtual bool CanDeoptimize() const { return false; }
6301 6027
6302 virtual Representation representation() const { 6028 virtual Representation representation() const {
6303 return kTagged; 6029 return kTagged;
6304 } 6030 }
6305 6031
6306 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6032 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6307 ASSERT(idx == 0); 6033 ASSERT(idx == 0);
6308 return kUnboxedInt32x4; 6034 return kUnboxedInt32x4;
6309 } 6035 }
6310 6036
6311 virtual intptr_t DeoptimizationTarget() const { 6037 virtual intptr_t DeoptimizationTarget() const {
6312 // Direct access since this instruction cannot deoptimize, and the deopt-id 6038 // Direct access since this instruction cannot deoptimize, and the deopt-id
6313 // was inherited from another instruction that could deoptimize. 6039 // was inherited from another instruction that could deoptimize.
6314 return GetDeoptId(); 6040 return GetDeoptId();
6315 } 6041 }
6316 6042
6317 DECLARE_INSTRUCTION(Int32x4GetFlag) 6043 DECLARE_INSTRUCTION(Int32x4GetFlag)
6318 virtual CompileType ComputeType() const; 6044 virtual CompileType ComputeType() const;
6319 6045
6320 virtual bool AllowsCSE() const { return true; }
6321 virtual EffectSet Effects() const { return EffectSet::None(); }
6322 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6323 virtual bool AttributesEqual(Instruction* other) const { 6046 virtual bool AttributesEqual(Instruction* other) const {
6324 return op_kind() == other->AsInt32x4GetFlag()->op_kind(); 6047 return op_kind() == other->AsInt32x4GetFlag()->op_kind();
6325 } 6048 }
6326 6049
6327 virtual bool MayThrow() const { return false; }
6328
6329 private: 6050 private:
6330 const MethodRecognizer::Kind op_kind_; 6051 const MethodRecognizer::Kind op_kind_;
6331 6052
6332 DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr); 6053 DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr);
6333 }; 6054 };
6334 6055
6335 6056
6336 class Simd32x4GetSignMaskInstr : public TemplateDefinition<1> { 6057 class Simd32x4GetSignMaskInstr : public TemplateDefinition<1, NoThrow, Pure> {
6337 public: 6058 public:
6338 Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind, 6059 Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind,
6339 Value* value, 6060 Value* value,
6340 intptr_t deopt_id) 6061 intptr_t deopt_id)
6341 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) { 6062 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6342 SetInputAt(0, value); 6063 SetInputAt(0, value);
6343 } 6064 }
6344 6065
6345 Value* value() const { return inputs_[0]; } 6066 Value* value() const { return inputs_[0]; }
6346 6067
6347 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6068 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6348 6069
6349 virtual void PrintOperandsTo(BufferFormatter* f) const; 6070 virtual void PrintOperandsTo(BufferFormatter* f) const;
6350 6071
6351 virtual bool CanDeoptimize() const { return false; } 6072 virtual bool CanDeoptimize() const { return false; }
(...skipping 13 matching lines...) Expand all
6365 6086
6366 virtual intptr_t DeoptimizationTarget() const { 6087 virtual intptr_t DeoptimizationTarget() const {
6367 // Direct access since this instruction cannot deoptimize, and the deopt-id 6088 // Direct access since this instruction cannot deoptimize, and the deopt-id
6368 // was inherited from another instruction that could deoptimize. 6089 // was inherited from another instruction that could deoptimize.
6369 return GetDeoptId(); 6090 return GetDeoptId();
6370 } 6091 }
6371 6092
6372 DECLARE_INSTRUCTION(Simd32x4GetSignMask) 6093 DECLARE_INSTRUCTION(Simd32x4GetSignMask)
6373 virtual CompileType ComputeType() const; 6094 virtual CompileType ComputeType() const;
6374 6095
6375 virtual bool AllowsCSE() const { return true; }
6376 virtual EffectSet Effects() const { return EffectSet::None(); }
6377 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6378 virtual bool AttributesEqual(Instruction* other) const { 6096 virtual bool AttributesEqual(Instruction* other) const {
6379 return other->AsSimd32x4GetSignMask()->op_kind() == op_kind(); 6097 return other->AsSimd32x4GetSignMask()->op_kind() == op_kind();
6380 } 6098 }
6381 6099
6382 virtual bool MayThrow() const { return false; }
6383
6384 private: 6100 private:
6385 const MethodRecognizer::Kind op_kind_; 6101 const MethodRecognizer::Kind op_kind_;
6386 6102
6387 DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr); 6103 DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr);
6388 }; 6104 };
6389 6105
6390 6106
6391 class Int32x4SelectInstr : public TemplateDefinition<3> { 6107 class Int32x4SelectInstr : public TemplateDefinition<3, NoThrow, Pure> {
6392 public: 6108 public:
6393 Int32x4SelectInstr(Value* mask, 6109 Int32x4SelectInstr(Value* mask,
6394 Value* trueValue, 6110 Value* trueValue,
6395 Value* falseValue, 6111 Value* falseValue,
6396 intptr_t deopt_id) 6112 intptr_t deopt_id)
6397 : TemplateDefinition<3>(deopt_id) { 6113 : TemplateDefinition(deopt_id) {
6398 SetInputAt(0, mask); 6114 SetInputAt(0, mask);
6399 SetInputAt(1, trueValue); 6115 SetInputAt(1, trueValue);
6400 SetInputAt(2, falseValue); 6116 SetInputAt(2, falseValue);
6401 } 6117 }
6402 6118
6403 Value* mask() const { return inputs_[0]; } 6119 Value* mask() const { return inputs_[0]; }
6404 Value* trueValue() const { return inputs_[1]; } 6120 Value* trueValue() const { return inputs_[1]; }
6405 Value* falseValue() const { return inputs_[2]; } 6121 Value* falseValue() const { return inputs_[2]; }
6406 6122
6407 virtual void PrintOperandsTo(BufferFormatter* f) const; 6123 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 14 matching lines...) Expand all
6422 6138
6423 virtual intptr_t DeoptimizationTarget() const { 6139 virtual intptr_t DeoptimizationTarget() const {
6424 // Direct access since this instruction cannot deoptimize, and the deopt-id 6140 // Direct access since this instruction cannot deoptimize, and the deopt-id
6425 // was inherited from another instruction that could deoptimize. 6141 // was inherited from another instruction that could deoptimize.
6426 return GetDeoptId(); 6142 return GetDeoptId();
6427 } 6143 }
6428 6144
6429 DECLARE_INSTRUCTION(Int32x4Select) 6145 DECLARE_INSTRUCTION(Int32x4Select)
6430 virtual CompileType ComputeType() const; 6146 virtual CompileType ComputeType() const;
6431 6147
6432 virtual bool AllowsCSE() const { return true; }
6433 virtual EffectSet Effects() const { return EffectSet::None(); }
6434 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6435 virtual bool AttributesEqual(Instruction* other) const { return true; } 6148 virtual bool AttributesEqual(Instruction* other) const { return true; }
6436 6149
6437 virtual bool MayThrow() const { return false; }
6438
6439 private: 6150 private:
6440 DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr); 6151 DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr);
6441 }; 6152 };
6442 6153
6443 6154
6444 class Int32x4SetFlagInstr : public TemplateDefinition<2> { 6155 class Int32x4SetFlagInstr : public TemplateDefinition<2, NoThrow, Pure> {
6445 public: 6156 public:
6446 Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind, 6157 Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind,
6447 Value* value, 6158 Value* value,
6448 Value* flagValue, 6159 Value* flagValue,
6449 intptr_t deopt_id) 6160 intptr_t deopt_id)
6450 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 6161 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6451 SetInputAt(0, value); 6162 SetInputAt(0, value);
6452 SetInputAt(1, flagValue); 6163 SetInputAt(1, flagValue);
6453 } 6164 }
6454 6165
6455 Value* value() const { return inputs_[0]; } 6166 Value* value() const { return inputs_[0]; }
6456 Value* flagValue() const { return inputs_[1]; } 6167 Value* flagValue() const { return inputs_[1]; }
6457 6168
6458 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6169 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6459 6170
6460 virtual void PrintOperandsTo(BufferFormatter* f) const; 6171 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 14 matching lines...) Expand all
6475 6186
6476 virtual intptr_t DeoptimizationTarget() const { 6187 virtual intptr_t DeoptimizationTarget() const {
6477 // Direct access since this instruction cannot deoptimize, and the deopt-id 6188 // Direct access since this instruction cannot deoptimize, and the deopt-id
6478 // was inherited from another instruction that could deoptimize. 6189 // was inherited from another instruction that could deoptimize.
6479 return GetDeoptId(); 6190 return GetDeoptId();
6480 } 6191 }
6481 6192
6482 DECLARE_INSTRUCTION(Int32x4SetFlag) 6193 DECLARE_INSTRUCTION(Int32x4SetFlag)
6483 virtual CompileType ComputeType() const; 6194 virtual CompileType ComputeType() const;
6484 6195
6485 virtual bool AllowsCSE() const { return true; }
6486 virtual EffectSet Effects() const { return EffectSet::None(); }
6487 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6488 virtual bool AttributesEqual(Instruction* other) const { 6196 virtual bool AttributesEqual(Instruction* other) const {
6489 return op_kind() == other->AsInt32x4SetFlag()->op_kind(); 6197 return op_kind() == other->AsInt32x4SetFlag()->op_kind();
6490 } 6198 }
6491 6199
6492 virtual bool MayThrow() const { return false; }
6493
6494 private: 6200 private:
6495 const MethodRecognizer::Kind op_kind_; 6201 const MethodRecognizer::Kind op_kind_;
6496 6202
6497 DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr); 6203 DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr);
6498 }; 6204 };
6499 6205
6500 6206
6501 class Int32x4ToFloat32x4Instr : public TemplateDefinition<1> { 6207 class Int32x4ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> {
6502 public: 6208 public:
6503 Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id) 6209 Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id)
6504 : TemplateDefinition<1>(deopt_id) { 6210 : TemplateDefinition(deopt_id) {
6505 SetInputAt(0, left); 6211 SetInputAt(0, left);
6506 } 6212 }
6507 6213
6508 Value* left() const { return inputs_[0]; } 6214 Value* left() const { return inputs_[0]; }
6509 6215
6510 virtual void PrintOperandsTo(BufferFormatter* f) const; 6216 virtual void PrintOperandsTo(BufferFormatter* f) const;
6511 6217
6512 virtual bool CanDeoptimize() const { return false; } 6218 virtual bool CanDeoptimize() const { return false; }
6513 6219
6514 virtual Representation representation() const { 6220 virtual Representation representation() const {
6515 return kUnboxedFloat32x4; 6221 return kUnboxedFloat32x4;
6516 } 6222 }
6517 6223
6518 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6224 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6519 ASSERT(idx == 0); 6225 ASSERT(idx == 0);
6520 return kUnboxedInt32x4; 6226 return kUnboxedInt32x4;
6521 } 6227 }
6522 6228
6523 virtual intptr_t DeoptimizationTarget() const { 6229 virtual intptr_t DeoptimizationTarget() const {
6524 // Direct access since this instruction cannot deoptimize, and the deopt-id 6230 // Direct access since this instruction cannot deoptimize, and the deopt-id
6525 // was inherited from another instruction that could deoptimize. 6231 // was inherited from another instruction that could deoptimize.
6526 return GetDeoptId(); 6232 return GetDeoptId();
6527 } 6233 }
6528 6234
6529 DECLARE_INSTRUCTION(Int32x4ToFloat32x4) 6235 DECLARE_INSTRUCTION(Int32x4ToFloat32x4)
6530 virtual CompileType ComputeType() const; 6236 virtual CompileType ComputeType() const;
6531 6237
6532 virtual bool AllowsCSE() const { return true; }
6533 virtual EffectSet Effects() const { return EffectSet::None(); }
6534 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6535 virtual bool AttributesEqual(Instruction* other) const { return true; } 6238 virtual bool AttributesEqual(Instruction* other) const { return true; }
6536 6239
6537 virtual bool MayThrow() const { return false; }
6538
6539 private: 6240 private:
6540 DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr); 6241 DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr);
6541 }; 6242 };
6542 6243
6543 6244
6544 class BinaryInt32x4OpInstr : public TemplateDefinition<2> { 6245 class BinaryInt32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> {
6545 public: 6246 public:
6546 BinaryInt32x4OpInstr(Token::Kind op_kind, 6247 BinaryInt32x4OpInstr(Token::Kind op_kind,
6547 Value* left, 6248 Value* left,
6548 Value* right, 6249 Value* right,
6549 intptr_t deopt_id) 6250 intptr_t deopt_id)
6550 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 6251 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6551 SetInputAt(0, left); 6252 SetInputAt(0, left);
6552 SetInputAt(1, right); 6253 SetInputAt(1, right);
6553 } 6254 }
6554 6255
6555 Value* left() const { return inputs_[0]; } 6256 Value* left() const { return inputs_[0]; }
6556 Value* right() const { return inputs_[1]; } 6257 Value* right() const { return inputs_[1]; }
6557 6258
6558 Token::Kind op_kind() const { return op_kind_; } 6259 Token::Kind op_kind() const { return op_kind_; }
6559 6260
6560 virtual void PrintOperandsTo(BufferFormatter* f) const; 6261 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 11 matching lines...) Expand all
6572 6273
6573 virtual intptr_t DeoptimizationTarget() const { 6274 virtual intptr_t DeoptimizationTarget() const {
6574 // Direct access since this instruction cannot deoptimize, and the deopt-id 6275 // Direct access since this instruction cannot deoptimize, and the deopt-id
6575 // was inherited from another instruction that could deoptimize. 6276 // was inherited from another instruction that could deoptimize.
6576 return GetDeoptId(); 6277 return GetDeoptId();
6577 } 6278 }
6578 6279
6579 DECLARE_INSTRUCTION(BinaryInt32x4Op) 6280 DECLARE_INSTRUCTION(BinaryInt32x4Op)
6580 virtual CompileType ComputeType() const; 6281 virtual CompileType ComputeType() const;
6581 6282
6582 virtual bool AllowsCSE() const { return true; }
6583 virtual EffectSet Effects() const { return EffectSet::None(); }
6584 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6585 virtual bool AttributesEqual(Instruction* other) const { 6283 virtual bool AttributesEqual(Instruction* other) const {
6586 return op_kind() == other->AsBinaryInt32x4Op()->op_kind(); 6284 return op_kind() == other->AsBinaryInt32x4Op()->op_kind();
6587 } 6285 }
6588 6286
6589 virtual bool MayThrow() const { return false; }
6590
6591 private: 6287 private:
6592 const Token::Kind op_kind_; 6288 const Token::Kind op_kind_;
6593 6289
6594 DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr); 6290 DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr);
6595 }; 6291 };
6596 6292
6597 6293
6598 class BinaryFloat64x2OpInstr : public TemplateDefinition<2> { 6294 class BinaryFloat64x2OpInstr : public TemplateDefinition<2, NoThrow, Pure> {
6599 public: 6295 public:
6600 BinaryFloat64x2OpInstr(Token::Kind op_kind, 6296 BinaryFloat64x2OpInstr(Token::Kind op_kind,
6601 Value* left, 6297 Value* left,
6602 Value* right, 6298 Value* right,
6603 intptr_t deopt_id) 6299 intptr_t deopt_id)
6604 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) { 6300 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6605 SetInputAt(0, left); 6301 SetInputAt(0, left);
6606 SetInputAt(1, right); 6302 SetInputAt(1, right);
6607 } 6303 }
6608 6304
6609 Value* left() const { return inputs_[0]; } 6305 Value* left() const { return inputs_[0]; }
6610 Value* right() const { return inputs_[1]; } 6306 Value* right() const { return inputs_[1]; }
6611 6307
6612 Token::Kind op_kind() const { return op_kind_; } 6308 Token::Kind op_kind() const { return op_kind_; }
6613 6309
6614 virtual bool CanDeoptimize() const { return false; } 6310 virtual bool CanDeoptimize() const { return false; }
(...skipping 11 matching lines...) Expand all
6626 6322
6627 virtual intptr_t DeoptimizationTarget() const { 6323 virtual intptr_t DeoptimizationTarget() const {
6628 // Direct access since this instruction cannot deoptimize, and the deopt-id 6324 // Direct access since this instruction cannot deoptimize, and the deopt-id
6629 // was inherited from another instruction that could deoptimize. 6325 // was inherited from another instruction that could deoptimize.
6630 return GetDeoptId(); 6326 return GetDeoptId();
6631 } 6327 }
6632 6328
6633 DECLARE_INSTRUCTION(BinaryFloat64x2Op) 6329 DECLARE_INSTRUCTION(BinaryFloat64x2Op)
6634 virtual CompileType ComputeType() const; 6330 virtual CompileType ComputeType() const;
6635 6331
6636 virtual bool AllowsCSE() const { return true; }
6637 virtual EffectSet Effects() const { return EffectSet::None(); }
6638 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6639 virtual bool AttributesEqual(Instruction* other) const { 6332 virtual bool AttributesEqual(Instruction* other) const {
6640 ASSERT(other->IsBinaryFloat64x2Op());
6641 return op_kind() == other->AsBinaryFloat64x2Op()->op_kind(); 6333 return op_kind() == other->AsBinaryFloat64x2Op()->op_kind();
6642 } 6334 }
6643 6335
6644 virtual bool MayThrow() const { return false; }
6645
6646 private: 6336 private:
6647 const Token::Kind op_kind_; 6337 const Token::Kind op_kind_;
6648 6338
6649 DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr); 6339 DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr);
6650 }; 6340 };
6651 6341
6652 6342
6653 class UnaryIntegerOpInstr : public TemplateDefinition<1> { 6343 class UnaryIntegerOpInstr : public TemplateDefinition<1, NoThrow, Pure> {
6654 public: 6344 public:
6655 UnaryIntegerOpInstr(Token::Kind op_kind, 6345 UnaryIntegerOpInstr(Token::Kind op_kind,
6656 Value* value, 6346 Value* value,
6657 intptr_t deopt_id) 6347 intptr_t deopt_id)
6658 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) { 6348 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
6659 ASSERT((op_kind == Token::kNEGATE) || 6349 ASSERT((op_kind == Token::kNEGATE) ||
6660 (op_kind == Token::kBIT_NOT)); 6350 (op_kind == Token::kBIT_NOT));
6661 SetInputAt(0, value); 6351 SetInputAt(0, value);
6662 } 6352 }
6663 6353
6664 static UnaryIntegerOpInstr* Make(Representation representation, 6354 static UnaryIntegerOpInstr* Make(Representation representation,
6665 Token::Kind op_kind, 6355 Token::Kind op_kind,
6666 Value* value, 6356 Value* value,
6667 intptr_t deopt_id, 6357 intptr_t deopt_id,
6668 Range* range); 6358 Range* range);
6669 6359
6670 Value* value() const { return inputs_[0]; } 6360 Value* value() const { return inputs_[0]; }
6671 Token::Kind op_kind() const { return op_kind_; } 6361 Token::Kind op_kind() const { return op_kind_; }
6672 6362
6673 virtual bool AllowsCSE() const { return true; }
6674 virtual EffectSet Effects() const { return EffectSet::None(); }
6675 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6676 virtual bool AttributesEqual(Instruction* other) const { 6363 virtual bool AttributesEqual(Instruction* other) const {
6677 return other->AsUnaryIntegerOp()->op_kind() == op_kind(); 6364 return other->AsUnaryIntegerOp()->op_kind() == op_kind();
6678 } 6365 }
6679 6366
6680 virtual intptr_t DeoptimizationTarget() const { 6367 virtual intptr_t DeoptimizationTarget() const {
6681 // Direct access since this instruction cannot deoptimize, and the deopt-id 6368 // Direct access since this instruction cannot deoptimize, and the deopt-id
6682 // was inherited from another instruction that could deoptimize. 6369 // was inherited from another instruction that could deoptimize.
6683 return GetDeoptId(); 6370 return GetDeoptId();
6684 } 6371 }
6685 6372
6686 virtual bool MayThrow() const { return false; }
6687
6688 virtual void PrintOperandsTo(BufferFormatter* f) const; 6373 virtual void PrintOperandsTo(BufferFormatter* f) const;
6689 6374
6690 DEFINE_INSTRUCTION_TYPE_CHECK(UnaryIntegerOp) 6375 DEFINE_INSTRUCTION_TYPE_CHECK(UnaryIntegerOp)
6691 6376
6692 private: 6377 private:
6693 const Token::Kind op_kind_; 6378 const Token::Kind op_kind_;
6694 }; 6379 };
6695 6380
6696 6381
6697 // Handles both Smi operations: BIT_OR and NEGATE. 6382 // Handles both Smi operations: BIT_OR and NEGATE.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
6764 return kUnboxedMint; 6449 return kUnboxedMint;
6765 } 6450 }
6766 6451
6767 DECLARE_INSTRUCTION(UnaryMintOp) 6452 DECLARE_INSTRUCTION(UnaryMintOp)
6768 6453
6769 private: 6454 private:
6770 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); 6455 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr);
6771 }; 6456 };
6772 6457
6773 6458
6774 class BinaryIntegerOpInstr : public TemplateDefinition<2> { 6459 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> {
6775 public: 6460 public:
6776 BinaryIntegerOpInstr(Token::Kind op_kind, 6461 BinaryIntegerOpInstr(Token::Kind op_kind,
6777 Value* left, 6462 Value* left,
6778 Value* right, 6463 Value* right,
6779 intptr_t deopt_id) 6464 intptr_t deopt_id)
6780 : TemplateDefinition<2>(deopt_id), 6465 : TemplateDefinition(deopt_id),
6781 op_kind_(op_kind), 6466 op_kind_(op_kind),
6782 can_overflow_(true), 6467 can_overflow_(true),
6783 is_truncating_(false) { 6468 is_truncating_(false) {
6784 SetInputAt(0, left); 6469 SetInputAt(0, left);
6785 SetInputAt(1, right); 6470 SetInputAt(1, right);
6786 } 6471 }
6787 6472
6788 static BinaryIntegerOpInstr* Make(Representation representation, 6473 static BinaryIntegerOpInstr* Make(Representation representation,
6789 Token::Kind op_kind, 6474 Token::Kind op_kind,
6790 Value* left, 6475 Value* left,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6830 6515
6831 case Token::kSHR: 6516 case Token::kSHR:
6832 case Token::kSHL: 6517 case Token::kSHL:
6833 // These instructions throw on negative shifts. 6518 // These instructions throw on negative shifts.
6834 return !CanDeoptimize(); 6519 return !CanDeoptimize();
6835 6520
6836 default: 6521 default:
6837 return false; 6522 return false;
6838 } 6523 }
6839 } 6524 }
6840 virtual bool AllowsCSE() const { return true; } 6525
6841 virtual EffectSet Effects() const { return EffectSet::None(); }
6842 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6843 virtual bool AttributesEqual(Instruction* other) const; 6526 virtual bool AttributesEqual(Instruction* other) const;
6844 6527
6845 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 6528 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
6846 6529
6847 virtual bool MayThrow() const { return false; }
6848
6849 virtual void PrintOperandsTo(BufferFormatter* f) const; 6530 virtual void PrintOperandsTo(BufferFormatter* f) const;
6850 6531
6851 DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp) 6532 DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp)
6852 6533
6853 protected: 6534 protected:
6854 void InferRangeHelper(const Range* left_range, 6535 void InferRangeHelper(const Range* left_range,
6855 const Range* right_range, 6536 const Range* right_range,
6856 Range* range); 6537 Range* range);
6857 6538
6858 private: 6539 private:
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
7067 DECLARE_INSTRUCTION(ShiftMintOp) 6748 DECLARE_INSTRUCTION(ShiftMintOp)
7068 6749
7069 private: 6750 private:
7070 bool has_shift_count_check() const; 6751 bool has_shift_count_check() const;
7071 6752
7072 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); 6753 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr);
7073 }; 6754 };
7074 6755
7075 6756
7076 // Handles only NEGATE. 6757 // Handles only NEGATE.
7077 class UnaryDoubleOpInstr : public TemplateDefinition<1> { 6758 class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> {
7078 public: 6759 public:
7079 UnaryDoubleOpInstr(Token::Kind op_kind, 6760 UnaryDoubleOpInstr(Token::Kind op_kind,
7080 Value* value, 6761 Value* value,
7081 intptr_t deopt_id) 6762 intptr_t deopt_id)
7082 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) { 6763 : TemplateDefinition(deopt_id), op_kind_(op_kind) {
7083 ASSERT(op_kind == Token::kNEGATE); 6764 ASSERT(op_kind == Token::kNEGATE);
7084 SetInputAt(0, value); 6765 SetInputAt(0, value);
7085 } 6766 }
7086 6767
7087 Value* value() const { return inputs_[0]; } 6768 Value* value() const { return inputs_[0]; }
7088 Token::Kind op_kind() const { return op_kind_; } 6769 Token::Kind op_kind() const { return op_kind_; }
7089 6770
7090 virtual void PrintOperandsTo(BufferFormatter* f) const; 6771 virtual void PrintOperandsTo(BufferFormatter* f) const;
7091 6772
7092 DECLARE_INSTRUCTION(UnaryDoubleOp) 6773 DECLARE_INSTRUCTION(UnaryDoubleOp)
7093 virtual CompileType ComputeType() const; 6774 virtual CompileType ComputeType() const;
7094 6775
7095 virtual bool CanDeoptimize() const { return false; } 6776 virtual bool CanDeoptimize() const { return false; }
7096 6777
7097 virtual intptr_t DeoptimizationTarget() const { 6778 virtual intptr_t DeoptimizationTarget() const {
7098 // Direct access since this instruction cannot deoptimize, and the deopt-id 6779 // Direct access since this instruction cannot deoptimize, and the deopt-id
7099 // was inherited from another instruction that could deoptimize. 6780 // was inherited from another instruction that could deoptimize.
7100 return GetDeoptId(); 6781 return GetDeoptId();
7101 } 6782 }
7102 6783
7103 virtual Representation representation() const { 6784 virtual Representation representation() const {
7104 return kUnboxedDouble; 6785 return kUnboxedDouble;
7105 } 6786 }
7106 6787
7107 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6788 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7108 ASSERT(idx == 0); 6789 ASSERT(idx == 0);
7109 return kUnboxedDouble; 6790 return kUnboxedDouble;
7110 } 6791 }
7111 6792
7112 virtual bool AllowsCSE() const { return true; }
7113 virtual EffectSet Effects() const { return EffectSet::None(); }
7114 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7115 virtual bool AttributesEqual(Instruction* other) const { return true; } 6793 virtual bool AttributesEqual(Instruction* other) const { return true; }
7116 6794
7117 virtual bool MayThrow() const { return false; }
7118
7119 private: 6795 private:
7120 const Token::Kind op_kind_; 6796 const Token::Kind op_kind_;
7121 6797
7122 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); 6798 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
7123 }; 6799 };
7124 6800
7125 6801
7126 class CheckStackOverflowInstr : public TemplateInstruction<0> { 6802 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> {
7127 public: 6803 public:
7128 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth) 6804 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth)
7129 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()), 6805 : TemplateInstruction(Isolate::Current()->GetNextDeoptId()),
7130 token_pos_(token_pos), 6806 token_pos_(token_pos),
7131 loop_depth_(loop_depth) { 6807 loop_depth_(loop_depth) {
7132 } 6808 }
7133 6809
7134 virtual intptr_t token_pos() const { return token_pos_; } 6810 virtual intptr_t token_pos() const { return token_pos_; }
7135 bool in_loop() const { return loop_depth_ > 0; } 6811 bool in_loop() const { return loop_depth_ > 0; }
7136 intptr_t loop_depth() const { return loop_depth_; } 6812 intptr_t loop_depth() const { return loop_depth_; }
7137 6813
7138 DECLARE_INSTRUCTION(CheckStackOverflow) 6814 DECLARE_INSTRUCTION(CheckStackOverflow)
7139 6815
7140 virtual intptr_t ArgumentCount() const { return 0; } 6816 virtual intptr_t ArgumentCount() const { return 0; }
7141 6817
7142 virtual bool CanDeoptimize() const { return true; } 6818 virtual bool CanDeoptimize() const { return true; }
7143 6819
7144 virtual EffectSet Effects() const { return EffectSet::None(); } 6820 virtual EffectSet Effects() const { return EffectSet::None(); }
7145 6821
7146 virtual bool MayThrow() const { return false; }
7147
7148 virtual void PrintOperandsTo(BufferFormatter* f) const; 6822 virtual void PrintOperandsTo(BufferFormatter* f) const;
7149 6823
7150 private: 6824 private:
7151 const intptr_t token_pos_; 6825 const intptr_t token_pos_;
7152 const intptr_t loop_depth_; 6826 const intptr_t loop_depth_;
7153 6827
7154 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); 6828 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr);
7155 }; 6829 };
7156 6830
7157 6831
7158 // TODO(vegorov): remove this instruction in favor of Int32ToDouble. 6832 // TODO(vegorov): remove this instruction in favor of Int32ToDouble.
7159 class SmiToDoubleInstr : public TemplateDefinition<1> { 6833 class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> {
7160 public: 6834 public:
7161 SmiToDoubleInstr(Value* value, intptr_t token_pos) 6835 SmiToDoubleInstr(Value* value, intptr_t token_pos)
7162 : token_pos_(token_pos) { 6836 : token_pos_(token_pos) {
7163 SetInputAt(0, value); 6837 SetInputAt(0, value);
7164 } 6838 }
7165 6839
7166 Value* value() const { return inputs_[0]; } 6840 Value* value() const { return inputs_[0]; }
7167 virtual intptr_t token_pos() const { return token_pos_; } 6841 virtual intptr_t token_pos() const { return token_pos_; }
7168 6842
7169 DECLARE_INSTRUCTION(SmiToDouble) 6843 DECLARE_INSTRUCTION(SmiToDouble)
7170 virtual CompileType ComputeType() const; 6844 virtual CompileType ComputeType() const;
7171 6845
7172 virtual Representation representation() const { 6846 virtual Representation representation() const {
7173 return kUnboxedDouble; 6847 return kUnboxedDouble;
7174 } 6848 }
7175 6849
7176 virtual bool CanDeoptimize() const { return false; } 6850 virtual bool CanDeoptimize() const { return false; }
7177 6851
7178 virtual bool AllowsCSE() const { return true; }
7179 virtual EffectSet Effects() const { return EffectSet::None(); }
7180 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7181 virtual bool AttributesEqual(Instruction* other) const { return true; } 6852 virtual bool AttributesEqual(Instruction* other) const { return true; }
7182 6853
7183 virtual bool MayThrow() const { return false; }
7184
7185 private: 6854 private:
7186 const intptr_t token_pos_; 6855 const intptr_t token_pos_;
7187 6856
7188 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); 6857 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr);
7189 }; 6858 };
7190 6859
7191 6860
7192 class Int32ToDoubleInstr : public TemplateDefinition<1> { 6861 class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> {
7193 public: 6862 public:
7194 explicit Int32ToDoubleInstr(Value* value) { 6863 explicit Int32ToDoubleInstr(Value* value) {
7195 SetInputAt(0, value); 6864 SetInputAt(0, value);
7196 } 6865 }
7197 6866
7198 Value* value() const { return inputs_[0]; } 6867 Value* value() const { return inputs_[0]; }
7199 6868
7200 DECLARE_INSTRUCTION(Int32ToDouble) 6869 DECLARE_INSTRUCTION(Int32ToDouble)
7201 virtual CompileType ComputeType() const; 6870 virtual CompileType ComputeType() const;
7202 6871
7203 virtual Representation RequiredInputRepresentation(intptr_t index) const { 6872 virtual Representation RequiredInputRepresentation(intptr_t index) const {
7204 ASSERT(index == 0); 6873 ASSERT(index == 0);
7205 return kUnboxedInt32; 6874 return kUnboxedInt32;
7206 } 6875 }
7207 6876
7208 virtual Representation representation() const { 6877 virtual Representation representation() const {
7209 return kUnboxedDouble; 6878 return kUnboxedDouble;
7210 } 6879 }
7211 6880
7212 virtual bool CanDeoptimize() const { return false; } 6881 virtual bool CanDeoptimize() const { return false; }
7213 6882
7214 virtual bool AllowsCSE() const { return true; }
7215 virtual EffectSet Effects() const { return EffectSet::None(); }
7216 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7217 virtual bool AttributesEqual(Instruction* other) const { return true; } 6883 virtual bool AttributesEqual(Instruction* other) const { return true; }
7218 6884
7219 virtual bool MayThrow() const { return false; }
7220
7221 private: 6885 private:
7222 DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr); 6886 DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr);
7223 }; 6887 };
7224 6888
7225 6889
7226 class MintToDoubleInstr : public TemplateDefinition<1> { 6890 class MintToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> {
7227 public: 6891 public:
7228 MintToDoubleInstr(Value* value, intptr_t deopt_id) 6892 MintToDoubleInstr(Value* value, intptr_t deopt_id)
7229 : TemplateDefinition<1>(deopt_id) { 6893 : TemplateDefinition(deopt_id) {
7230 SetInputAt(0, value); 6894 SetInputAt(0, value);
7231 } 6895 }
7232 6896
7233 Value* value() const { return inputs_[0]; } 6897 Value* value() const { return inputs_[0]; }
7234 6898
7235 DECLARE_INSTRUCTION(MintToDouble) 6899 DECLARE_INSTRUCTION(MintToDouble)
7236 virtual CompileType ComputeType() const; 6900 virtual CompileType ComputeType() const;
7237 6901
7238 virtual Representation RequiredInputRepresentation(intptr_t index) const { 6902 virtual Representation RequiredInputRepresentation(intptr_t index) const {
7239 ASSERT(index == 0); 6903 ASSERT(index == 0);
7240 return kUnboxedMint; 6904 return kUnboxedMint;
7241 } 6905 }
7242 6906
7243 virtual Representation representation() const { 6907 virtual Representation representation() const {
7244 return kUnboxedDouble; 6908 return kUnboxedDouble;
7245 } 6909 }
7246 6910
7247 virtual intptr_t DeoptimizationTarget() const { 6911 virtual intptr_t DeoptimizationTarget() const {
7248 // Direct access since this instruction cannot deoptimize, and the deopt-id 6912 // Direct access since this instruction cannot deoptimize, and the deopt-id
7249 // was inherited from another instruction that could deoptimize. 6913 // was inherited from another instruction that could deoptimize.
7250 return GetDeoptId(); 6914 return GetDeoptId();
7251 } 6915 }
7252 6916
7253 virtual bool CanDeoptimize() const { return false; } 6917 virtual bool CanDeoptimize() const { return false; }
7254
7255 virtual bool AllowsCSE() const { return true; }
7256 virtual EffectSet Effects() const { return EffectSet::None(); }
7257 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7258 virtual bool AttributesEqual(Instruction* other) const { return true; } 6918 virtual bool AttributesEqual(Instruction* other) const { return true; }
7259 6919
7260 virtual bool MayThrow() const { return false; }
7261
7262 private: 6920 private:
7263 DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr); 6921 DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr);
7264 }; 6922 };
7265 6923
7266 6924
7267 class DoubleToIntegerInstr : public TemplateDefinition<1> { 6925 class DoubleToIntegerInstr : public TemplateDefinition<1, Throws> {
7268 public: 6926 public:
7269 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) 6927 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
7270 : TemplateDefinition<1>(instance_call->deopt_id()), 6928 : TemplateDefinition(instance_call->deopt_id()),
7271 instance_call_(instance_call) { 6929 instance_call_(instance_call) {
7272 SetInputAt(0, value); 6930 SetInputAt(0, value);
7273 } 6931 }
7274 6932
7275 Value* value() const { return inputs_[0]; } 6933 Value* value() const { return inputs_[0]; }
7276 InstanceCallInstr* instance_call() const { return instance_call_; } 6934 InstanceCallInstr* instance_call() const { return instance_call_; }
7277 6935
7278 DECLARE_INSTRUCTION(DoubleToInteger) 6936 DECLARE_INSTRUCTION(DoubleToInteger)
7279 virtual CompileType ComputeType() const; 6937 virtual CompileType ComputeType() const;
7280 6938
7281 virtual intptr_t ArgumentCount() const { return 1; } 6939 virtual intptr_t ArgumentCount() const { return 1; }
7282 6940
7283 virtual bool CanDeoptimize() const { return true; } 6941 virtual bool CanDeoptimize() const { return true; }
7284 6942
7285 virtual EffectSet Effects() const { return EffectSet::None(); } 6943 virtual EffectSet Effects() const { return EffectSet::None(); }
7286 6944
7287 virtual bool MayThrow() const { return true; }
7288
7289 private: 6945 private:
7290 InstanceCallInstr* instance_call_; 6946 InstanceCallInstr* instance_call_;
7291 6947
7292 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); 6948 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr);
7293 }; 6949 };
7294 6950
7295 6951
7296 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input 6952 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input
7297 // and creates a Smi. 6953 // and creates a Smi.
7298 class DoubleToSmiInstr : public TemplateDefinition<1> { 6954 class DoubleToSmiInstr : public TemplateDefinition<1, NoThrow, Pure> {
7299 public: 6955 public:
7300 DoubleToSmiInstr(Value* value, intptr_t deopt_id) 6956 DoubleToSmiInstr(Value* value, intptr_t deopt_id)
7301 : TemplateDefinition<1>(deopt_id) { 6957 : TemplateDefinition(deopt_id) {
7302 SetInputAt(0, value); 6958 SetInputAt(0, value);
7303 } 6959 }
7304 6960
7305 Value* value() const { return inputs_[0]; } 6961 Value* value() const { return inputs_[0]; }
7306 6962
7307 DECLARE_INSTRUCTION(DoubleToSmi) 6963 DECLARE_INSTRUCTION(DoubleToSmi)
7308 virtual CompileType ComputeType() const; 6964 virtual CompileType ComputeType() const;
7309 6965
7310 virtual bool CanDeoptimize() const { return true; } 6966 virtual bool CanDeoptimize() const { return true; }
7311 6967
7312 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6968 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7313 ASSERT(idx == 0); 6969 ASSERT(idx == 0);
7314 return kUnboxedDouble; 6970 return kUnboxedDouble;
7315 } 6971 }
7316 6972
7317 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 6973 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7318 6974
7319 virtual EffectSet Effects() const { return EffectSet::None(); } 6975 virtual bool AttributesEqual(Instruction* other) const { return true; }
7320
7321 virtual bool MayThrow() const { return false; }
7322 6976
7323 private: 6977 private:
7324 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); 6978 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
7325 }; 6979 };
7326 6980
7327 6981
7328 class DoubleToDoubleInstr : public TemplateDefinition<1> { 6982 class DoubleToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> {
7329 public: 6983 public:
7330 DoubleToDoubleInstr(Value* value, 6984 DoubleToDoubleInstr(Value* value,
7331 MethodRecognizer::Kind recognized_kind, 6985 MethodRecognizer::Kind recognized_kind,
7332 intptr_t deopt_id) 6986 intptr_t deopt_id)
7333 : TemplateDefinition<1>(deopt_id), 6987 : TemplateDefinition(deopt_id),
7334 recognized_kind_(recognized_kind) { 6988 recognized_kind_(recognized_kind) {
7335 SetInputAt(0, value); 6989 SetInputAt(0, value);
7336 } 6990 }
7337 6991
7338 Value* value() const { return inputs_[0]; } 6992 Value* value() const { return inputs_[0]; }
7339 6993
7340 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 6994 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
7341 6995
7342 DECLARE_INSTRUCTION(DoubleToDouble) 6996 DECLARE_INSTRUCTION(DoubleToDouble)
7343 virtual CompileType ComputeType() const; 6997 virtual CompileType ComputeType() const;
7344 6998
7345 virtual bool CanDeoptimize() const { return false; } 6999 virtual bool CanDeoptimize() const { return false; }
7346 7000
7347 virtual Representation representation() const { 7001 virtual Representation representation() const {
7348 return kUnboxedDouble; 7002 return kUnboxedDouble;
7349 } 7003 }
7350 7004
7351 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7005 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7352 ASSERT(idx == 0); 7006 ASSERT(idx == 0);
7353 return kUnboxedDouble; 7007 return kUnboxedDouble;
7354 } 7008 }
7355 7009
7356 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 7010 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7357 7011
7358 virtual bool AllowsCSE() const { return true; }
7359 virtual EffectSet Effects() const { return EffectSet::None(); }
7360 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7361 virtual bool AttributesEqual(Instruction* other) const { 7012 virtual bool AttributesEqual(Instruction* other) const {
7362 return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); 7013 return other->AsDoubleToDouble()->recognized_kind() == recognized_kind();
7363 } 7014 }
7364 7015
7365 virtual bool MayThrow() const { return false; }
7366
7367 private: 7016 private:
7368 const MethodRecognizer::Kind recognized_kind_; 7017 const MethodRecognizer::Kind recognized_kind_;
7369 7018
7370 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); 7019 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
7371 }; 7020 };
7372 7021
7373 7022
7374 class DoubleToFloatInstr: public TemplateDefinition<1> { 7023 class DoubleToFloatInstr: public TemplateDefinition<1, NoThrow, Pure> {
7375 public: 7024 public:
7376 DoubleToFloatInstr(Value* value, intptr_t deopt_id) 7025 DoubleToFloatInstr(Value* value, intptr_t deopt_id)
7377 : TemplateDefinition<1>(deopt_id) { 7026 : TemplateDefinition(deopt_id) {
7378 SetInputAt(0, value); 7027 SetInputAt(0, value);
7379 } 7028 }
7380 7029
7381 Value* value() const { return inputs_[0]; } 7030 Value* value() const { return inputs_[0]; }
7382 7031
7383 DECLARE_INSTRUCTION(DoubleToFloat) 7032 DECLARE_INSTRUCTION(DoubleToFloat)
7384 7033
7385 virtual CompileType ComputeType() const; 7034 virtual CompileType ComputeType() const;
7386 7035
7387 virtual bool CanDeoptimize() const { return false; } 7036 virtual bool CanDeoptimize() const { return false; }
7388 7037
7389 virtual Representation representation() const { 7038 virtual Representation representation() const {
7390 // This works since double is the representation that the typed array 7039 // This works since double is the representation that the typed array
7391 // store expects. 7040 // store expects.
7392 // TODO(fschneider): Change this to a genuine float representation once it 7041 // TODO(fschneider): Change this to a genuine float representation once it
7393 // is supported. 7042 // is supported.
7394 return kUnboxedDouble; 7043 return kUnboxedDouble;
7395 } 7044 }
7396 7045
7397 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7046 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7398 ASSERT(idx == 0); 7047 ASSERT(idx == 0);
7399 return kUnboxedDouble; 7048 return kUnboxedDouble;
7400 } 7049 }
7401 7050
7402 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 7051 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7403 7052
7404 virtual bool AllowsCSE() const { return true; }
7405 virtual EffectSet Effects() const { return EffectSet::None(); }
7406 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7407 virtual bool AttributesEqual(Instruction* other) const { return true; } 7053 virtual bool AttributesEqual(Instruction* other) const { return true; }
7408 7054
7409 virtual bool MayThrow() const { return false; }
7410
7411 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7055 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7412 7056
7413 private: 7057 private:
7414 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr); 7058 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr);
7415 }; 7059 };
7416 7060
7417 7061
7418 class FloatToDoubleInstr: public TemplateDefinition<1> { 7062 class FloatToDoubleInstr: public TemplateDefinition<1, NoThrow, Pure> {
7419 public: 7063 public:
7420 FloatToDoubleInstr(Value* value, intptr_t deopt_id) 7064 FloatToDoubleInstr(Value* value, intptr_t deopt_id)
7421 : TemplateDefinition<1>(deopt_id) { 7065 : TemplateDefinition(deopt_id) {
7422 SetInputAt(0, value); 7066 SetInputAt(0, value);
7423 } 7067 }
7424 7068
7425 Value* value() const { return inputs_[0]; } 7069 Value* value() const { return inputs_[0]; }
7426 7070
7427 DECLARE_INSTRUCTION(FloatToDouble) 7071 DECLARE_INSTRUCTION(FloatToDouble)
7428 7072
7429 virtual CompileType ComputeType() const; 7073 virtual CompileType ComputeType() const;
7430 7074
7431 virtual bool CanDeoptimize() const { return false; } 7075 virtual bool CanDeoptimize() const { return false; }
7432 7076
7433 virtual Representation representation() const { 7077 virtual Representation representation() const {
7434 return kUnboxedDouble; 7078 return kUnboxedDouble;
7435 } 7079 }
7436 7080
7437 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7081 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7438 ASSERT(idx == 0); 7082 ASSERT(idx == 0);
7439 return kUnboxedDouble; 7083 return kUnboxedDouble;
7440 } 7084 }
7441 7085
7442 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 7086 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7443 7087
7444 virtual bool AllowsCSE() const { return true; }
7445 virtual EffectSet Effects() const { return EffectSet::None(); }
7446 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7447 virtual bool AttributesEqual(Instruction* other) const { return true; } 7088 virtual bool AttributesEqual(Instruction* other) const { return true; }
7448 7089
7449 virtual bool MayThrow() const { return false; }
7450
7451 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7090 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7452 7091
7453 private: 7092 private:
7454 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); 7093 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr);
7455 }; 7094 };
7456 7095
7457 7096
7458 class InvokeMathCFunctionInstr : public Definition { 7097 class InvokeMathCFunctionInstr : public PureDefinition {
7459 public: 7098 public:
7460 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, 7099 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
7461 intptr_t deopt_id, 7100 intptr_t deopt_id,
7462 MethodRecognizer::Kind recognized_kind, 7101 MethodRecognizer::Kind recognized_kind,
7463 intptr_t token_pos); 7102 intptr_t token_pos);
7464 7103
7465 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); 7104 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
7466 7105
7467 const RuntimeEntry& TargetFunction() const; 7106 const RuntimeEntry& TargetFunction() const;
7468 7107
(...skipping 19 matching lines...) Expand all
7488 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 7127 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7489 7128
7490 virtual intptr_t InputCount() const { 7129 virtual intptr_t InputCount() const {
7491 return inputs_->length(); 7130 return inputs_->length();
7492 } 7131 }
7493 7132
7494 virtual Value* InputAt(intptr_t i) const { 7133 virtual Value* InputAt(intptr_t i) const {
7495 return (*inputs_)[i]; 7134 return (*inputs_)[i];
7496 } 7135 }
7497 7136
7498 virtual bool AllowsCSE() const { return true; }
7499 virtual EffectSet Effects() const { return EffectSet::None(); }
7500 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7501 virtual bool AttributesEqual(Instruction* other) const { 7137 virtual bool AttributesEqual(Instruction* other) const {
7502 InvokeMathCFunctionInstr* other_invoke = other->AsInvokeMathCFunction(); 7138 InvokeMathCFunctionInstr* other_invoke = other->AsInvokeMathCFunction();
7503 return other_invoke->recognized_kind() == recognized_kind(); 7139 return other_invoke->recognized_kind() == recognized_kind();
7504 } 7140 }
7505 7141
7506 virtual bool MayThrow() const { return false; } 7142 virtual bool MayThrow() const { return false; }
7507 7143
7508 static const intptr_t kSavedSpTempIndex = 0; 7144 static const intptr_t kSavedSpTempIndex = 0;
7509 static const intptr_t kObjectTempIndex = 1; 7145 static const intptr_t kObjectTempIndex = 1;
7510 static const intptr_t kDoubleTempIndex = 2; 7146 static const intptr_t kDoubleTempIndex = 2;
7511 7147
7512 private: 7148 private:
7513 virtual void RawSetInputAt(intptr_t i, Value* value) { 7149 virtual void RawSetInputAt(intptr_t i, Value* value) {
7514 (*inputs_)[i] = value; 7150 (*inputs_)[i] = value;
7515 } 7151 }
7516 7152
7517 ZoneGrowableArray<Value*>* inputs_; 7153 ZoneGrowableArray<Value*>* inputs_;
7518 const MethodRecognizer::Kind recognized_kind_; 7154 const MethodRecognizer::Kind recognized_kind_;
7519 const intptr_t token_pos_; 7155 const intptr_t token_pos_;
7520 7156
7521 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); 7157 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr);
7522 }; 7158 };
7523 7159
7524 7160
7525 class ExtractNthOutputInstr : public TemplateDefinition<1> { 7161 class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> {
7526 public: 7162 public:
7527 // Extract the Nth output register from value. 7163 // Extract the Nth output register from value.
7528 ExtractNthOutputInstr(Value* value, 7164 ExtractNthOutputInstr(Value* value,
7529 intptr_t n, 7165 intptr_t n,
7530 Representation definition_rep, 7166 Representation definition_rep,
7531 intptr_t definition_cid) 7167 intptr_t definition_cid)
7532 : index_(n), 7168 : index_(n),
7533 definition_rep_(definition_rep), 7169 definition_rep_(definition_rep),
7534 definition_cid_(definition_cid) { 7170 definition_cid_(definition_cid) {
7535 SetInputAt(0, value); 7171 SetInputAt(0, value);
(...skipping 17 matching lines...) Expand all
7553 ASSERT(idx == 0); 7189 ASSERT(idx == 0);
7554 if (representation() == kTagged) { 7190 if (representation() == kTagged) {
7555 return kPairOfTagged; 7191 return kPairOfTagged;
7556 } else if (representation() == kUnboxedDouble) { 7192 } else if (representation() == kUnboxedDouble) {
7557 return kPairOfUnboxedDouble; 7193 return kPairOfUnboxedDouble;
7558 } 7194 }
7559 UNREACHABLE(); 7195 UNREACHABLE();
7560 return definition_rep_; 7196 return definition_rep_;
7561 } 7197 }
7562 7198
7563 virtual bool AllowsCSE() const { return true; }
7564 virtual EffectSet Effects() const { return EffectSet::None(); }
7565 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7566 virtual bool AttributesEqual(Instruction* other) const { 7199 virtual bool AttributesEqual(Instruction* other) const {
7567 ExtractNthOutputInstr* other_extract = other->AsExtractNthOutput(); 7200 ExtractNthOutputInstr* other_extract = other->AsExtractNthOutput();
7568 return (other_extract->representation() == representation()) && 7201 return (other_extract->representation() == representation()) &&
7569 (other_extract->index() == index()); 7202 (other_extract->index() == index());
7570 } 7203 }
7571 7204
7572 virtual bool MayThrow() const { return false; }
7573
7574 private: 7205 private:
7575 const intptr_t index_; 7206 const intptr_t index_;
7576 const Representation definition_rep_; 7207 const Representation definition_rep_;
7577 const intptr_t definition_cid_; 7208 const intptr_t definition_cid_;
7578 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr); 7209 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr);
7579 }; 7210 };
7580 7211
7581 7212
7582 class MergedMathInstr : public Definition { 7213 class MergedMathInstr : public PureDefinition {
7583 public: 7214 public:
7584 enum Kind { 7215 enum Kind {
7585 kTruncDivMod, 7216 kTruncDivMod,
7586 kSinCos, 7217 kSinCos,
7587 }; 7218 };
7588 7219
7589 MergedMathInstr(ZoneGrowableArray<Value*>* inputs, 7220 MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
7590 intptr_t original_deopt_id, 7221 intptr_t original_deopt_id,
7591 MergedMathInstr::Kind kind); 7222 MergedMathInstr::Kind kind);
7592 7223
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
7646 } else { 7277 } else {
7647 UNIMPLEMENTED(); 7278 UNIMPLEMENTED();
7648 return kTagged; 7279 return kTagged;
7649 } 7280 }
7650 } 7281 }
7651 7282
7652 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } 7283 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7653 7284
7654 DECLARE_INSTRUCTION(MergedMath) 7285 DECLARE_INSTRUCTION(MergedMath)
7655 7286
7656 virtual bool AllowsCSE() const { return true; }
7657 virtual EffectSet Effects() const { return EffectSet::None(); }
7658 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7659 virtual bool AttributesEqual(Instruction* other) const { 7287 virtual bool AttributesEqual(Instruction* other) const {
7660 MergedMathInstr* other_invoke = other->AsMergedMath(); 7288 MergedMathInstr* other_invoke = other->AsMergedMath();
7661 return other_invoke->kind() == kind(); 7289 return other_invoke->kind() == kind();
7662 } 7290 }
7663 7291
7664 virtual bool MayThrow() const { return false; } 7292 virtual bool MayThrow() const { return false; }
7665 7293
7666 static const char* KindToCString(MergedMathInstr::Kind kind) { 7294 static const char* KindToCString(MergedMathInstr::Kind kind) {
7667 if (kind == kTruncDivMod) return "TruncDivMod"; 7295 if (kind == kTruncDivMod) return "TruncDivMod";
7668 if (kind == kSinCos) return "SinCos"; 7296 if (kind == kSinCos) return "SinCos";
7669 UNIMPLEMENTED(); 7297 UNIMPLEMENTED();
7670 return ""; 7298 return "";
7671 } 7299 }
7672 7300
7673 private: 7301 private:
7674 virtual void RawSetInputAt(intptr_t i, Value* value) { 7302 virtual void RawSetInputAt(intptr_t i, Value* value) {
7675 (*inputs_)[i] = value; 7303 (*inputs_)[i] = value;
7676 } 7304 }
7677 ZoneGrowableArray<Value*>* inputs_; 7305 ZoneGrowableArray<Value*>* inputs_;
7678 MergedMathInstr::Kind kind_; 7306 MergedMathInstr::Kind kind_;
7679 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr); 7307 DISALLOW_COPY_AND_ASSIGN(MergedMathInstr);
7680 }; 7308 };
7681 7309
7682 7310
7683 class CheckClassInstr : public TemplateInstruction<1> { 7311 class CheckClassInstr : public TemplateInstruction<1, NoThrow> {
7684 public: 7312 public:
7685 CheckClassInstr(Value* value, 7313 CheckClassInstr(Value* value,
7686 intptr_t deopt_id, 7314 intptr_t deopt_id,
7687 const ICData& unary_checks, 7315 const ICData& unary_checks,
7688 intptr_t token_pos); 7316 intptr_t token_pos);
7689 7317
7690 DECLARE_INSTRUCTION(CheckClass) 7318 DECLARE_INSTRUCTION(CheckClass)
7691 7319
7692 virtual intptr_t ArgumentCount() const { return 0; } 7320 virtual intptr_t ArgumentCount() const { return 0; }
7693 7321
(...skipping 11 matching lines...) Expand all
7705 7333
7706 virtual void PrintOperandsTo(BufferFormatter* f) const; 7334 virtual void PrintOperandsTo(BufferFormatter* f) const;
7707 7335
7708 bool IsNullCheck() const; 7336 bool IsNullCheck() const;
7709 7337
7710 bool IsDenseSwitch() const; 7338 bool IsDenseSwitch() const;
7711 intptr_t ComputeCidMask() const; 7339 intptr_t ComputeCidMask() const;
7712 static bool IsDenseMask(intptr_t mask); 7340 static bool IsDenseMask(intptr_t mask);
7713 7341
7714 virtual bool AllowsCSE() const { return true; } 7342 virtual bool AllowsCSE() const { return true; }
7343 virtual EffectSet Dependencies() const;
7715 virtual EffectSet Effects() const { return EffectSet::None(); } 7344 virtual EffectSet Effects() const { return EffectSet::None(); }
7716 virtual EffectSet Dependencies() const;
7717 virtual bool AttributesEqual(Instruction* other) const; 7345 virtual bool AttributesEqual(Instruction* other) const;
7718 7346
7719 virtual bool MayThrow() const { return false; }
7720
7721 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } 7347 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
7722 7348
7723 private: 7349 private:
7724 const ICData& unary_checks_; 7350 const ICData& unary_checks_;
7725 GrowableArray<intptr_t> cids_; // Sorted, lowest first. 7351 GrowableArray<intptr_t> cids_; // Sorted, lowest first.
7726 bool licm_hoisted_; 7352 bool licm_hoisted_;
7727 const intptr_t token_pos_; 7353 const intptr_t token_pos_;
7728 7354
7729 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); 7355 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
7730 }; 7356 };
7731 7357
7732 7358
7733 class CheckSmiInstr : public TemplateInstruction<1> { 7359 class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> {
7734 public: 7360 public:
7735 CheckSmiInstr(Value* value, intptr_t deopt_id, intptr_t token_pos) 7361 CheckSmiInstr(Value* value, intptr_t deopt_id, intptr_t token_pos)
7736 : TemplateInstruction<1>(deopt_id), 7362 : TemplateInstruction(deopt_id),
7737 token_pos_(token_pos), 7363 token_pos_(token_pos),
7738 licm_hoisted_(false) { 7364 licm_hoisted_(false) {
7739 SetInputAt(0, value); 7365 SetInputAt(0, value);
7740 } 7366 }
7741 7367
7742 Value* value() const { return inputs_[0]; } 7368 Value* value() const { return inputs_[0]; }
7743 virtual intptr_t token_pos() const { return token_pos_; } 7369 virtual intptr_t token_pos() const { return token_pos_; }
7744 7370
7745 DECLARE_INSTRUCTION(CheckSmi) 7371 DECLARE_INSTRUCTION(CheckSmi)
7746 7372
7747 virtual intptr_t ArgumentCount() const { return 0; } 7373 virtual intptr_t ArgumentCount() const { return 0; }
7748 7374
7749 virtual bool CanDeoptimize() const { return true; } 7375 virtual bool CanDeoptimize() const { return true; }
7750 7376
7751 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 7377 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
7752 7378
7753 virtual bool AllowsCSE() const { return true; }
7754 virtual EffectSet Effects() const { return EffectSet::None(); }
7755 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7756 virtual bool AttributesEqual(Instruction* other) const { return true; } 7379 virtual bool AttributesEqual(Instruction* other) const { return true; }
7757 7380
7758 virtual bool MayThrow() const { return false; }
7759
7760 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } 7381 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
7761 7382
7762 private: 7383 private:
7763 const intptr_t token_pos_; 7384 const intptr_t token_pos_;
7764 bool licm_hoisted_; 7385 bool licm_hoisted_;
7765 7386
7766 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); 7387 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
7767 }; 7388 };
7768 7389
7769 7390
7770 class CheckClassIdInstr : public TemplateInstruction<1> { 7391 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> {
7771 public: 7392 public:
7772 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) 7393 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id)
7773 : TemplateInstruction<1>(deopt_id), cid_(cid) { 7394 : TemplateInstruction(deopt_id), cid_(cid) {
7774 SetInputAt(0, value); 7395 SetInputAt(0, value);
7775 } 7396 }
7776 7397
7777 Value* value() const { return inputs_[0]; } 7398 Value* value() const { return inputs_[0]; }
7778 intptr_t cid() const { return cid_; } 7399 intptr_t cid() const { return cid_; }
7779 7400
7780 DECLARE_INSTRUCTION(CheckClassId) 7401 DECLARE_INSTRUCTION(CheckClassId)
7781 7402
7782 virtual intptr_t ArgumentCount() const { return 0; } 7403 virtual intptr_t ArgumentCount() const { return 0; }
7783 7404
7784 virtual bool CanDeoptimize() const { return true; } 7405 virtual bool CanDeoptimize() const { return true; }
7785 7406
7786 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 7407 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
7787 7408
7788 virtual bool AllowsCSE() const { return true; } 7409 virtual bool AllowsCSE() const { return true; }
7410 virtual EffectSet Dependencies() const;
7789 virtual EffectSet Effects() const { return EffectSet::None(); } 7411 virtual EffectSet Effects() const { return EffectSet::None(); }
7790 virtual EffectSet Dependencies() const;
7791 virtual bool AttributesEqual(Instruction* other) const { return true; } 7412 virtual bool AttributesEqual(Instruction* other) const { return true; }
7792 7413
7793 virtual bool MayThrow() const { return false; }
7794
7795 virtual void PrintOperandsTo(BufferFormatter* f) const; 7414 virtual void PrintOperandsTo(BufferFormatter* f) const;
7796 7415
7797 private: 7416 private:
7798 intptr_t cid_; 7417 intptr_t cid_;
7799 7418
7800 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); 7419 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr);
7801 }; 7420 };
7802 7421
7803 7422
7804 class CheckArrayBoundInstr : public TemplateInstruction<2> { 7423 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> {
7805 public: 7424 public:
7806 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) 7425 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id)
7807 : TemplateInstruction<2>(deopt_id), 7426 : TemplateInstruction(deopt_id),
7808 generalized_(false), 7427 generalized_(false),
7809 licm_hoisted_(false) { 7428 licm_hoisted_(false) {
7810 SetInputAt(kLengthPos, length); 7429 SetInputAt(kLengthPos, length);
7811 SetInputAt(kIndexPos, index); 7430 SetInputAt(kIndexPos, index);
7812 } 7431 }
7813 7432
7814 Value* length() const { return inputs_[kLengthPos]; } 7433 Value* length() const { return inputs_[kLengthPos]; }
7815 Value* index() const { return inputs_[kIndexPos]; } 7434 Value* index() const { return inputs_[kIndexPos]; }
7816 7435
7817 DECLARE_INSTRUCTION(CheckArrayBound) 7436 DECLARE_INSTRUCTION(CheckArrayBound)
7818 7437
7819 virtual intptr_t ArgumentCount() const { return 0; } 7438 virtual intptr_t ArgumentCount() const { return 0; }
7820 7439
7821 virtual bool CanDeoptimize() const { return true; } 7440 virtual bool CanDeoptimize() const { return true; }
7822 7441
7823 bool IsRedundant(const RangeBoundary& length); 7442 bool IsRedundant(const RangeBoundary& length);
7824 7443
7825 void mark_generalized() { 7444 void mark_generalized() {
7826 generalized_ = true; 7445 generalized_ = true;
7827 } 7446 }
7828 7447
7829 virtual Instruction* Canonicalize(FlowGraph* flow_graph); 7448 virtual Instruction* Canonicalize(FlowGraph* flow_graph);
7830 7449
7831 // Returns the length offset for array and string types. 7450 // Returns the length offset for array and string types.
7832 static intptr_t LengthOffsetFor(intptr_t class_id); 7451 static intptr_t LengthOffsetFor(intptr_t class_id);
7833 7452
7834 static bool IsFixedLengthArrayType(intptr_t class_id); 7453 static bool IsFixedLengthArrayType(intptr_t class_id);
7835 7454
7836 virtual bool AllowsCSE() const { return true; }
7837 virtual EffectSet Effects() const { return EffectSet::None(); }
7838 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7839 virtual bool AttributesEqual(Instruction* other) const { return true; } 7455 virtual bool AttributesEqual(Instruction* other) const { return true; }
7840 7456
7841 virtual bool MayThrow() const { return false; }
7842
7843 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } 7457 void set_licm_hoisted(bool value) { licm_hoisted_ = value; }
7844 7458
7845 // Give a name to the location/input indices. 7459 // Give a name to the location/input indices.
7846 enum { 7460 enum {
7847 kLengthPos = 0, 7461 kLengthPos = 0,
7848 kIndexPos = 1 7462 kIndexPos = 1
7849 }; 7463 };
7850 7464
7851 private: 7465 private:
7852 bool generalized_; 7466 bool generalized_;
7853 bool licm_hoisted_; 7467 bool licm_hoisted_;
7854 7468
7855 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); 7469 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr);
7856 }; 7470 };
7857 7471
7858 7472
7859 class BoxIntNInstr : public TemplateDefinition<1> { 7473 class BoxIntNInstr : public TemplateDefinition<1, NoThrow, Pure> {
7860 public: 7474 public:
7861 BoxIntNInstr(Representation representation, Value* value) 7475 BoxIntNInstr(Representation representation, Value* value)
7862 : from_representation_(representation) { 7476 : from_representation_(representation) {
7863 SetInputAt(0, value); 7477 SetInputAt(0, value);
7864 } 7478 }
7865 7479
7866 Representation from_representation() const { return from_representation_; } 7480 Representation from_representation() const { return from_representation_; }
7867 7481
7868 Value* value() const { return inputs_[0]; } 7482 Value* value() const { return inputs_[0]; }
7869 virtual bool ValueFitsSmi() const; 7483 virtual bool ValueFitsSmi() const;
7870 7484
7871 virtual CompileType ComputeType() const; 7485 virtual CompileType ComputeType() const;
7872 virtual bool RecomputeType(); 7486 virtual bool RecomputeType();
7873 7487
7874 virtual bool CanDeoptimize() const { return false; } 7488 virtual bool CanDeoptimize() const { return false; }
7875 7489
7876 virtual intptr_t DeoptimizationTarget() const { 7490 virtual intptr_t DeoptimizationTarget() const {
7877 return Isolate::kNoDeoptId; 7491 return Isolate::kNoDeoptId;
7878 } 7492 }
7879 7493
7880 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7494 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7881 ASSERT(idx == 0); 7495 ASSERT(idx == 0);
7882 return from_representation_; 7496 return from_representation_;
7883 } 7497 }
7884 7498
7885 virtual bool AllowsCSE() const { return true; }
7886 virtual EffectSet Effects() const { return EffectSet::None(); }
7887 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7888 virtual bool AttributesEqual(Instruction* other) const { 7499 virtual bool AttributesEqual(Instruction* other) const {
7889 return other->AsBoxIntN()->from_representation_ == from_representation_; 7500 return other->AsBoxIntN()->from_representation_ == from_representation_;
7890 } 7501 }
7891 7502
7892 virtual bool MayThrow() const { return false; }
7893
7894 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7503 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7895 7504
7896 DEFINE_INSTRUCTION_TYPE_CHECK(BoxIntN) 7505 DEFINE_INSTRUCTION_TYPE_CHECK(BoxIntN)
7897 DECLARE_INSTRUCTION_BACKEND() 7506 DECLARE_INSTRUCTION_BACKEND()
7898 7507
7899 private: 7508 private:
7900 const Representation from_representation_; 7509 const Representation from_representation_;
7901 7510
7902 DISALLOW_COPY_AND_ASSIGN(BoxIntNInstr); 7511 DISALLOW_COPY_AND_ASSIGN(BoxIntNInstr);
7903 }; 7512 };
(...skipping 18 matching lines...) Expand all
7922 7531
7923 virtual void InferRange(RangeAnalysis* analysis, Range* range); 7532 virtual void InferRange(RangeAnalysis* analysis, Range* range);
7924 7533
7925 DECLARE_INSTRUCTION_NO_BACKEND(BoxInt32) 7534 DECLARE_INSTRUCTION_NO_BACKEND(BoxInt32)
7926 7535
7927 private: 7536 private:
7928 DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr); 7537 DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr);
7929 }; 7538 };
7930 7539
7931 7540
7932 class UnboxIntNInstr : public TemplateDefinition<1> { 7541 class UnboxIntNInstr : public TemplateDefinition<1, NoThrow, Pure> {
7933 public: 7542 public:
7934 UnboxIntNInstr(Representation representation, 7543 UnboxIntNInstr(Representation representation,
7935 Value* value, 7544 Value* value,
7936 intptr_t deopt_id) 7545 intptr_t deopt_id)
7937 : TemplateDefinition<1>(deopt_id), 7546 : TemplateDefinition(deopt_id),
7938 representation_(representation), 7547 representation_(representation),
7939 is_truncating_(representation == kUnboxedUint32) { 7548 is_truncating_(representation == kUnboxedUint32) {
7940 SetInputAt(0, value); 7549 SetInputAt(0, value);
7941 } 7550 }
7942 7551
7943 Value* value() const { return inputs_[0]; } 7552 Value* value() const { return inputs_[0]; }
7944 7553
7945 bool is_truncating() const { return is_truncating_; } 7554 bool is_truncating() const { return is_truncating_; }
7946 void mark_truncating() { is_truncating_ = true; } 7555 void mark_truncating() { is_truncating_ = true; }
7947 7556
7948 virtual Representation representation() const { 7557 virtual Representation representation() const {
7949 return representation_; 7558 return representation_;
7950 } 7559 }
7951 7560
7952 virtual CompileType ComputeType() const; 7561 virtual CompileType ComputeType() const;
7953 7562
7954 virtual bool AllowsCSE() const { return true; }
7955 virtual EffectSet Effects() const { return EffectSet::None(); }
7956 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7957 virtual bool AttributesEqual(Instruction* other) const { 7563 virtual bool AttributesEqual(Instruction* other) const {
7958 UnboxIntNInstr* other_unbox = other->AsUnboxIntN(); 7564 UnboxIntNInstr* other_unbox = other->AsUnboxIntN();
7959 return (other_unbox->representation_ == representation_) && 7565 return (other_unbox->representation_ == representation_) &&
7960 (other_unbox->is_truncating_ == is_truncating_); 7566 (other_unbox->is_truncating_ == is_truncating_);
7961 } 7567 }
7962 7568
7963 virtual bool MayThrow() const { return false; }
7964
7965 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7569 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7966 7570
7967 virtual void PrintOperandsTo(BufferFormatter* f) const; 7571 virtual void PrintOperandsTo(BufferFormatter* f) const;
7968 7572
7969 DEFINE_INSTRUCTION_TYPE_CHECK(UnboxIntN) 7573 DEFINE_INSTRUCTION_TYPE_CHECK(UnboxIntN)
7970 DECLARE_INSTRUCTION_BACKEND() 7574 DECLARE_INSTRUCTION_BACKEND()
7971 7575
7972 private: 7576 private:
7973 const Representation representation_; 7577 const Representation representation_;
7974 bool is_truncating_; 7578 bool is_truncating_;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
8008 7612
8009 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7613 virtual Definition* Canonicalize(FlowGraph* flow_graph);
8010 7614
8011 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt32) 7615 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt32)
8012 7616
8013 private: 7617 private:
8014 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); 7618 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr);
8015 }; 7619 };
8016 7620
8017 7621
8018 class UnboxedIntConverterInstr : public TemplateDefinition<1> { 7622 class UnboxedIntConverterInstr : public TemplateDefinition<1, NoThrow> {
8019 public: 7623 public:
8020 UnboxedIntConverterInstr(Representation from, 7624 UnboxedIntConverterInstr(Representation from,
8021 Representation to, 7625 Representation to,
8022 Value* value, 7626 Value* value,
8023 intptr_t deopt_id) 7627 intptr_t deopt_id)
8024 : TemplateDefinition<1>(deopt_id), 7628 : TemplateDefinition(deopt_id),
8025 from_representation_(from), 7629 from_representation_(from),
8026 to_representation_(to), 7630 to_representation_(to),
8027 is_truncating_(to == kUnboxedUint32) { 7631 is_truncating_(to == kUnboxedUint32) {
8028 ASSERT(from != to); 7632 ASSERT(from != to);
8029 ASSERT((from == kUnboxedMint) || 7633 ASSERT((from == kUnboxedMint) ||
8030 (from == kUnboxedUint32) || 7634 (from == kUnboxedUint32) ||
8031 (from == kUnboxedInt32)); 7635 (from == kUnboxedInt32));
8032 ASSERT((to == kUnboxedMint) || 7636 ASSERT((to == kUnboxedMint) ||
8033 (to == kUnboxedUint32) || 7637 (to == kUnboxedUint32) ||
8034 (to == kUnboxedInt32)); 7638 (to == kUnboxedInt32));
(...skipping 25 matching lines...) Expand all
8060 virtual EffectSet Effects() const { return EffectSet::None(); } 7664 virtual EffectSet Effects() const { return EffectSet::None(); }
8061 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7665 virtual EffectSet Dependencies() const { return EffectSet::None(); }
8062 virtual bool AttributesEqual(Instruction* other) const { 7666 virtual bool AttributesEqual(Instruction* other) const {
8063 ASSERT(other->IsUnboxedIntConverter()); 7667 ASSERT(other->IsUnboxedIntConverter());
8064 UnboxedIntConverterInstr* converter = other->AsUnboxedIntConverter(); 7668 UnboxedIntConverterInstr* converter = other->AsUnboxedIntConverter();
8065 return (converter->from() == from()) && 7669 return (converter->from() == from()) &&
8066 (converter->to() == to()) && 7670 (converter->to() == to()) &&
8067 (converter->is_truncating() == is_truncating()); 7671 (converter->is_truncating() == is_truncating());
8068 } 7672 }
8069 7673
8070 virtual bool MayThrow() const { return false; }
8071
8072 virtual void InferRange(RangeAnalysis* analysis, Range* range); 7674 virtual void InferRange(RangeAnalysis* analysis, Range* range);
8073 7675
8074 virtual void PrintOperandsTo(BufferFormatter* f) const; 7676 virtual void PrintOperandsTo(BufferFormatter* f) const;
8075 7677
8076 DECLARE_INSTRUCTION(UnboxedIntConverter); 7678 DECLARE_INSTRUCTION(UnboxedIntConverter);
8077 7679
8078 private: 7680 private:
8079 const Representation from_representation_; 7681 const Representation from_representation_;
8080 const Representation to_representation_; 7682 const Representation to_representation_;
8081 bool is_truncating_; 7683 bool is_truncating_;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
8317 Isolate* isolate, bool opt) const { \ 7919 Isolate* isolate, bool opt) const { \
8318 UNIMPLEMENTED(); \ 7920 UNIMPLEMENTED(); \
8319 return NULL; \ 7921 return NULL; \
8320 } \ 7922 } \
8321 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 7923 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8322 7924
8323 7925
8324 } // namespace dart 7926 } // namespace dart
8325 7927
8326 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7928 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698