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

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

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