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

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

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