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

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

Issue 676743002: IR cleanup: pass deopt id as constructor argument instead of doing deopt_id_ assignment. (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 | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 DECLARE_INSTRUCTION_BACKEND() \ 593 DECLARE_INSTRUCTION_BACKEND() \
594 594
595 class Instruction : public ZoneAllocated { 595 class Instruction : public ZoneAllocated {
596 public: 596 public:
597 #define DECLARE_TAG(type) k##type, 597 #define DECLARE_TAG(type) k##type,
598 enum Tag { 598 enum Tag {
599 FOR_EACH_INSTRUCTION(DECLARE_TAG) 599 FOR_EACH_INSTRUCTION(DECLARE_TAG)
600 }; 600 };
601 #undef DECLARE_TAG 601 #undef DECLARE_TAG
602 602
603 Instruction() 603 explicit Instruction(intptr_t deopt_id = Isolate::kNoDeoptId)
604 : deopt_id_(Isolate::kNoDeoptId), 604 : deopt_id_(deopt_id),
605 lifetime_position_(-1), 605 lifetime_position_(-1),
606 previous_(NULL), 606 previous_(NULL),
607 next_(NULL), 607 next_(NULL),
608 env_(NULL), 608 env_(NULL),
609 locs_(NULL), 609 locs_(NULL),
610 place_id_(kNoPlaceId) { } 610 place_id_(kNoPlaceId) { }
611 611
612 virtual ~Instruction() { } 612 virtual ~Instruction() { }
613 613
614 virtual Tag tag() const = 0; 614 virtual Tag tag() const = 0;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 // Fetch deopt id without checking if this computation can deoptimize. 844 // Fetch deopt id without checking if this computation can deoptimize.
845 intptr_t GetDeoptId() const { 845 intptr_t GetDeoptId() const {
846 return deopt_id_; 846 return deopt_id_;
847 } 847 }
848 848
849 private: 849 private:
850 friend class FlowGraphPrinter; 850 friend class FlowGraphPrinter;
851 friend class Definition; // Needed for InsertBefore, InsertAfter. 851 friend class Definition; // Needed for InsertBefore, InsertAfter.
852 friend class CallSiteInliner; 852 friend class CallSiteInliner;
853 853
854 // Classes that set or read deopt_id_. 854 // deopt_id_ write access.
855 friend class UnboxIntegerInstr; 855 friend class ComparisonInstr;
856 friend class UnboxDoubleInstr;
857 friend class UnboxFloat32x4Instr;
858 friend class UnboxFloat64x2Instr;
859 friend class UnboxInt32x4Instr;
860 friend class BinaryDoubleOpInstr;
861 friend class BinaryFloat32x4OpInstr;
862 friend class Float32x4ZeroInstr;
863 friend class Float32x4SplatInstr;
864 friend class Simd32x4ShuffleInstr;
865 friend class Simd32x4ShuffleMixInstr;
866 friend class Simd32x4GetSignMaskInstr;
867 friend class Float32x4ConstructorInstr;
868 friend class Float32x4ComparisonInstr;
869 friend class Float32x4MinMaxInstr;
870 friend class Float32x4ScaleInstr;
871 friend class Float32x4SqrtInstr;
872 friend class Float32x4ZeroArgInstr;
873 friend class Float32x4ClampInstr;
874 friend class Float32x4WithInstr;
875 friend class Float32x4ToInt32x4Instr;
876 friend class Simd64x2ShuffleInstr;
877 friend class Float64x2ZeroArgInstr;
878 friend class Float64x2OneArgInstr;
879 friend class Float32x4ToFloat64x2Instr;
880 friend class Float64x2ToFloat32x4Instr;
881 friend class Float64x2ZeroInstr;
882 friend class Float64x2SplatInstr;
883 friend class Float64x2ConstructorInstr;
884 friend class Int32x4ConstructorInstr;
885 friend class Int32x4BoolConstructorInstr;
886 friend class Int32x4GetFlagInstr;
887 friend class Int32x4SetFlagInstr;
888 friend class Int32x4SelectInstr;
889 friend class Int32x4ToFloat32x4Instr;
890 friend class BinaryInt32x4OpInstr;
891 friend class BinaryFloat64x2OpInstr;
892 friend class UnaryDoubleOpInstr;
893 friend class MathUnaryInstr;
894 friend class MathMinMaxInstr;
895 friend class CheckClassInstr;
896 friend class CheckClassIdInstr;
897 friend class GuardFieldInstr;
898 friend class CheckSmiInstr;
899 friend class CheckArrayBoundInstr;
900 friend class CheckEitherNonSmiInstr;
901 friend class LICM; 856 friend class LICM;
902 friend class Scheduler; 857 friend class Scheduler;
903 friend class DoubleToSmiInstr; 858 friend class BlockEntryInstr;
904 friend class DoubleToDoubleInstr;
905 friend class DoubleToFloatInstr;
906 friend class FloatToDoubleInstr;
907 friend class InvokeMathCFunctionInstr;
908 friend class MergedMathInstr;
909 friend class FlowGraphOptimizer;
910 friend class LoadIndexedInstr;
911 friend class StoreIndexedInstr;
912 friend class StoreInstanceFieldInstr;
913 friend class ComparisonInstr;
914 friend class TargetEntryInstr;
915 friend class JoinEntryInstr;
916 friend class InstanceOfInstr;
917 friend class PolymorphicInstanceCallInstr;
918 friend class SmiToDoubleInstr;
919 friend class MintToDoubleInstr;
920 friend class DoubleToIntegerInstr;
921 friend class BranchSimplifier; 859 friend class BranchSimplifier;
922 friend class BlockEntryInstr;
923 friend class RelationalOpInstr;
924 friend class EqualityCompareInstr;
925 friend class TestCidsInstr;
926 friend class UnboxIntNInstr;
927 friend class UnboxInt32Instr;
928 friend class UnboxUint32Instr;
929 friend class UnboxedIntConverterInstr;
930 friend class UnaryIntegerOpInstr;
931 friend class BinaryIntegerOpInstr;
932 friend class DeoptimizeInstr;
933
934 // deopt_id_ access.
935 friend class InstanceCallInstr;
936 friend class StaticCallInstr;
937 friend class GotoInstr;
938 friend class ReturnInstr;
939 friend class BranchInstr;
940 friend class AssertAssignableInstr;
941 friend class TestSmiInstr;
942 friend class IfThenElseInstr;
943 friend class StrictCompareInstr;
944 friend class ThrowInstr;
945 friend class ReThrowInstr;
946 friend class AssertBooleanInstr;
947 friend class CurrentContextInstr;
948 friend class ClosureCallInstr;
949 friend class StringInterpolateInstr;
950 friend class CreateArrayInstr;
951 friend class InstantiateTypeInstr;
952 friend class InstantiateTypeArgumentsInstr;
953 friend class InitStaticFieldInstr;
954 friend class CloneContextInstr;
955 friend class CheckStackOverflowInstr;
956 860
957 virtual void RawSetInputAt(intptr_t i, Value* value) = 0; 861 virtual void RawSetInputAt(intptr_t i, Value* value) = 0;
958 862
959 enum { 863 enum {
960 kNoPlaceId = -1 864 kNoPlaceId = -1
961 }; 865 };
962 866
963 intptr_t deopt_id_; 867 intptr_t deopt_id_;
964 intptr_t lifetime_position_; // Position used by register allocator. 868 intptr_t lifetime_position_; // Position used by register allocator.
965 Instruction* previous_; 869 Instruction* previous_;
966 Instruction* next_; 870 Instruction* next_;
967 Environment* env_; 871 Environment* env_;
968 LocationSummary* locs_; 872 LocationSummary* locs_;
969 intptr_t place_id_; 873 intptr_t place_id_;
970 874
971 DISALLOW_COPY_AND_ASSIGN(Instruction); 875 DISALLOW_COPY_AND_ASSIGN(Instruction);
972 }; 876 };
973 877
974 878
975 template<intptr_t N> 879 template<intptr_t N>
976 class TemplateInstruction: public Instruction { 880 class TemplateInstruction: public Instruction {
977 public: 881 public:
978 TemplateInstruction<N>() : inputs_() { } 882 explicit TemplateInstruction<N>(intptr_t deopt_id = Isolate::kNoDeoptId)
883 : Instruction(deopt_id), inputs_() { }
979 884
980 virtual intptr_t InputCount() const { return N; } 885 virtual intptr_t InputCount() const { return N; }
981 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 886 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
982 887
983 protected: 888 protected:
984 EmbeddedArray<Value*, N> inputs_; 889 EmbeddedArray<Value*, N> inputs_;
985 890
986 private: 891 private:
987 virtual void RawSetInputAt(intptr_t i, Value* value) { 892 virtual void RawSetInputAt(intptr_t i, Value* value) {
988 inputs_[i] = value; 893 inputs_[i] = value;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 void set_block_id(intptr_t block_id) { block_id_ = block_id; } 1126 void set_block_id(intptr_t block_id) { block_id_ = block_id; }
1222 1127
1223 // For all instruction in this block: Remove all inputs (including in the 1128 // For all instruction in this block: Remove all inputs (including in the
1224 // environment) from their definition's use lists for all instructions. 1129 // environment) from their definition's use lists for all instructions.
1225 void ClearAllInstructions(); 1130 void ClearAllInstructions();
1226 1131
1227 DEFINE_INSTRUCTION_TYPE_CHECK(BlockEntry) 1132 DEFINE_INSTRUCTION_TYPE_CHECK(BlockEntry)
1228 1133
1229 protected: 1134 protected:
1230 BlockEntryInstr(intptr_t block_id, intptr_t try_index) 1135 BlockEntryInstr(intptr_t block_id, intptr_t try_index)
1231 : block_id_(block_id), 1136 : Instruction(Isolate::Current()->GetNextDeoptId()),
1137 block_id_(block_id),
1232 try_index_(try_index), 1138 try_index_(try_index),
1233 preorder_number_(-1), 1139 preorder_number_(-1),
1234 postorder_number_(-1), 1140 postorder_number_(-1),
1235 dominator_(NULL), 1141 dominator_(NULL),
1236 dominated_blocks_(1), 1142 dominated_blocks_(1),
1237 last_instruction_(NULL), 1143 last_instruction_(NULL),
1238 parallel_move_(NULL), 1144 parallel_move_(NULL),
1239 loop_info_(NULL) { 1145 loop_info_(NULL) {
1240 deopt_id_ = Isolate::Current()->GetNextDeoptId();
1241 } 1146 }
1242 1147
1243 private: 1148 private:
1244 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } 1149 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); }
1245 1150
1246 virtual void ClearPredecessors() = 0; 1151 virtual void ClearPredecessors() = 0;
1247 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0; 1152 virtual void AddPredecessor(BlockEntryInstr* predecessor) = 0;
1248 1153
1249 void set_dominator(BlockEntryInstr* instr) { dominator_ = instr; } 1154 void set_dominator(BlockEntryInstr* instr) { dominator_ = instr; }
1250 1155
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 COMPILE_ASSERT((kAliased & kNotAliased) == 0); 1526 COMPILE_ASSERT((kAliased & kNotAliased) == 0);
1622 COMPILE_ASSERT((kAllocationSinkingCandidate & kNotAliased) != 0); 1527 COMPILE_ASSERT((kAllocationSinkingCandidate & kNotAliased) != 0);
1623 1528
1624 intptr_t value_; 1529 intptr_t value_;
1625 }; 1530 };
1626 1531
1627 1532
1628 // Abstract super-class of all instructions that define a value (Bind, Phi). 1533 // Abstract super-class of all instructions that define a value (Bind, Phi).
1629 class Definition : public Instruction { 1534 class Definition : public Instruction {
1630 public: 1535 public:
1631 Definition(); 1536 explicit Definition(intptr_t deopt_id = Isolate::kNoDeoptId);
1632 1537
1633 // Overridden by definitions that have pushed arguments. 1538 // Overridden by definitions that have pushed arguments.
1634 virtual intptr_t ArgumentCount() const { return 0; } 1539 virtual intptr_t ArgumentCount() const { return 0; }
1635 1540
1636 // Overridden by definitions that have call counts. 1541 // Overridden by definitions that have call counts.
1637 virtual intptr_t CallCount() const { 1542 virtual intptr_t CallCount() const {
1638 UNREACHABLE(); 1543 UNREACHABLE();
1639 return -1; 1544 return -1;
1640 } 1545 }
1641 1546
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 inline void Value::BindToEnvironment(Definition* def) { 1733 inline void Value::BindToEnvironment(Definition* def) {
1829 RemoveFromUseList(); 1734 RemoveFromUseList();
1830 set_definition(def); 1735 set_definition(def);
1831 def->AddEnvUse(this); 1736 def->AddEnvUse(this);
1832 } 1737 }
1833 1738
1834 1739
1835 template<intptr_t N> 1740 template<intptr_t N>
1836 class TemplateDefinition : public Definition { 1741 class TemplateDefinition : public Definition {
1837 public: 1742 public:
1838 TemplateDefinition<N>() : inputs_() { } 1743 explicit TemplateDefinition<N>(intptr_t deopt_id = Isolate::kNoDeoptId)
1744 : Definition(deopt_id), inputs_() { }
1839 1745
1840 virtual intptr_t InputCount() const { return N; } 1746 virtual intptr_t InputCount() const { return N; }
1841 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } 1747 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; }
1842 1748
1843 protected: 1749 protected:
1844 EmbeddedArray<Value*, N> inputs_; 1750 EmbeddedArray<Value*, N> inputs_;
1845 1751
1846 private: 1752 private:
1847 friend class BranchInstr; 1753 friend class BranchInstr;
1848 friend class IfThenElseInstr; 1754 friend class IfThenElseInstr;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 1946
2041 1947
2042 inline Definition* Instruction::ArgumentAt(intptr_t index) const { 1948 inline Definition* Instruction::ArgumentAt(intptr_t index) const {
2043 return PushArgumentAt(index)->value()->definition(); 1949 return PushArgumentAt(index)->value()->definition();
2044 } 1950 }
2045 1951
2046 1952
2047 class ReturnInstr : public TemplateInstruction<1> { 1953 class ReturnInstr : public TemplateInstruction<1> {
2048 public: 1954 public:
2049 ReturnInstr(intptr_t token_pos, Value* value) 1955 ReturnInstr(intptr_t token_pos, Value* value)
2050 : token_pos_(token_pos) { 1956 : TemplateInstruction<1>(Isolate::Current()->GetNextDeoptId()),
2051 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 1957 token_pos_(token_pos) {
2052 SetInputAt(0, value); 1958 SetInputAt(0, value);
2053 } 1959 }
2054 1960
2055 DECLARE_INSTRUCTION(Return) 1961 DECLARE_INSTRUCTION(Return)
2056 1962
2057 virtual intptr_t ArgumentCount() const { return 0; } 1963 virtual intptr_t ArgumentCount() const { return 0; }
2058 1964
2059 virtual intptr_t token_pos() const { return token_pos_; } 1965 virtual intptr_t token_pos() const { return token_pos_; }
2060 Value* value() const { return inputs_[0]; } 1966 Value* value() const { return inputs_[0]; }
2061 1967
(...skipping 11 matching lines...) Expand all
2073 1979
2074 private: 1980 private:
2075 const intptr_t token_pos_; 1981 const intptr_t token_pos_;
2076 1982
2077 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); 1983 DISALLOW_COPY_AND_ASSIGN(ReturnInstr);
2078 }; 1984 };
2079 1985
2080 1986
2081 class ThrowInstr : public TemplateInstruction<0> { 1987 class ThrowInstr : public TemplateInstruction<0> {
2082 public: 1988 public:
2083 explicit ThrowInstr(intptr_t token_pos) : token_pos_(token_pos) { 1989 explicit ThrowInstr(intptr_t token_pos)
2084 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 1990 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()),
1991 token_pos_(token_pos) {
2085 } 1992 }
2086 1993
2087 DECLARE_INSTRUCTION(Throw) 1994 DECLARE_INSTRUCTION(Throw)
2088 1995
2089 virtual intptr_t ArgumentCount() const { return 1; } 1996 virtual intptr_t ArgumentCount() const { return 1; }
2090 1997
2091 virtual intptr_t token_pos() const { return token_pos_; } 1998 virtual intptr_t token_pos() const { return token_pos_; }
2092 1999
2093 virtual bool CanDeoptimize() const { return true; } 2000 virtual bool CanDeoptimize() const { return true; }
2094 2001
2095 virtual EffectSet Effects() const { return EffectSet::None(); } 2002 virtual EffectSet Effects() const { return EffectSet::None(); }
2096 2003
2097 virtual bool MayThrow() const { return true; } 2004 virtual bool MayThrow() const { return true; }
2098 2005
2099 private: 2006 private:
2100 const intptr_t token_pos_; 2007 const intptr_t token_pos_;
2101 2008
2102 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); 2009 DISALLOW_COPY_AND_ASSIGN(ThrowInstr);
2103 }; 2010 };
2104 2011
2105 2012
2106 class ReThrowInstr : public TemplateInstruction<0> { 2013 class ReThrowInstr : public TemplateInstruction<0> {
2107 public: 2014 public:
2108 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the 2015 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the
2109 // rethrow has been artifically generated by the parser. 2016 // rethrow has been artifically generated by the parser.
2110 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index) 2017 ReThrowInstr(intptr_t token_pos, intptr_t catch_try_index)
2111 : token_pos_(token_pos), catch_try_index_(catch_try_index) { 2018 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()),
2112 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 2019 token_pos_(token_pos),
2020 catch_try_index_(catch_try_index) {
2113 } 2021 }
2114 2022
2115 DECLARE_INSTRUCTION(ReThrow) 2023 DECLARE_INSTRUCTION(ReThrow)
2116 2024
2117 virtual intptr_t ArgumentCount() const { return 2; } 2025 virtual intptr_t ArgumentCount() const { return 2; }
2118 2026
2119 virtual intptr_t token_pos() const { return token_pos_; } 2027 virtual intptr_t token_pos() const { return token_pos_; }
2120 intptr_t catch_try_index() const { return catch_try_index_; } 2028 intptr_t catch_try_index() const { return catch_try_index_; }
2121 2029
2122 virtual bool CanDeoptimize() const { return true; } 2030 virtual bool CanDeoptimize() const { return true; }
2123 2031
2124 virtual EffectSet Effects() const { return EffectSet::None(); } 2032 virtual EffectSet Effects() const { return EffectSet::None(); }
2125 2033
2126 virtual bool MayThrow() const { return true; } 2034 virtual bool MayThrow() const { return true; }
2127 2035
2128 private: 2036 private:
2129 const intptr_t token_pos_; 2037 const intptr_t token_pos_;
2130 const intptr_t catch_try_index_; 2038 const intptr_t catch_try_index_;
2131 2039
2132 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); 2040 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr);
2133 }; 2041 };
2134 2042
2135 2043
2136 class GotoInstr : public TemplateInstruction<0> { 2044 class GotoInstr : public TemplateInstruction<0> {
2137 public: 2045 public:
2138 explicit GotoInstr(JoinEntryInstr* entry) 2046 explicit GotoInstr(JoinEntryInstr* entry)
2139 : successor_(entry), 2047 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()),
2048 successor_(entry),
2140 edge_weight_(0.0), 2049 edge_weight_(0.0),
2141 parallel_move_(NULL) { 2050 parallel_move_(NULL) {
2142 deopt_id_ = Isolate::Current()->GetNextDeoptId();
2143 } 2051 }
2144 2052
2145 DECLARE_INSTRUCTION(Goto) 2053 DECLARE_INSTRUCTION(Goto)
2146 2054
2147 virtual intptr_t ArgumentCount() const { return 0; } 2055 virtual intptr_t ArgumentCount() const { return 0; }
2148 2056
2149 JoinEntryInstr* successor() const { return successor_; } 2057 JoinEntryInstr* successor() const { return successor_; }
2150 void set_successor(JoinEntryInstr* successor) { successor_ = successor; } 2058 void set_successor(JoinEntryInstr* successor) { successor_ = successor; }
2151 virtual intptr_t SuccessorCount() const; 2059 virtual intptr_t SuccessorCount() const;
2152 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const; 2060 virtual BlockEntryInstr* SuccessorAt(intptr_t index) const;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2219 } 2127 }
2220 2128
2221 // Operation class id is computed from collected ICData. 2129 // Operation class id is computed from collected ICData.
2222 void set_operation_cid(intptr_t value) { operation_cid_ = value; } 2130 void set_operation_cid(intptr_t value) { operation_cid_ = value; }
2223 intptr_t operation_cid() const { return operation_cid_; } 2131 intptr_t operation_cid() const { return operation_cid_; }
2224 2132
2225 void NegateComparison() { 2133 void NegateComparison() {
2226 kind_ = Token::NegateComparison(kind_); 2134 kind_ = Token::NegateComparison(kind_);
2227 } 2135 }
2228 2136
2137 virtual bool CanBecomeDeoptimizationTarget() const { return true; }
2138 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
2139
2229 DEFINE_INSTRUCTION_TYPE_CHECK(Comparison) 2140 DEFINE_INSTRUCTION_TYPE_CHECK(Comparison)
2230 2141
2231 protected: 2142 protected:
2232 ComparisonInstr(intptr_t token_pos, 2143 ComparisonInstr(intptr_t token_pos,
2233 Token::Kind kind, 2144 Token::Kind kind,
2234 Value* left, 2145 Value* left,
2235 Value* right) 2146 Value* right,
2236 : token_pos_(token_pos), kind_(kind), operation_cid_(kIllegalCid) { 2147 intptr_t deopt_id = Isolate::kNoDeoptId)
2148 : TemplateDefinition<2>(deopt_id),
2149 token_pos_(token_pos),
2150 kind_(kind),
2151 operation_cid_(kIllegalCid) {
2237 SetInputAt(0, left); 2152 SetInputAt(0, left);
2238 if (right != NULL) { 2153 if (right != NULL) {
2239 SetInputAt(1, right); 2154 SetInputAt(1, right);
2240 } 2155 }
2241 } 2156 }
2242 2157
2243 private: 2158 private:
2244 const intptr_t token_pos_; 2159 const intptr_t token_pos_;
2245 Token::Kind kind_; 2160 Token::Kind kind_;
2246 intptr_t operation_cid_; // Set by optimizer. 2161 intptr_t operation_cid_; // Set by optimizer.
2247 2162
2248 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); 2163 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr);
2249 }; 2164 };
2250 2165
2251 2166
2252 class BranchInstr : public Instruction { 2167 class BranchInstr : public Instruction {
2253 public: 2168 public:
2254 explicit BranchInstr(ComparisonInstr* comparison) 2169 explicit BranchInstr(ComparisonInstr* comparison)
2255 : comparison_(comparison), 2170 : Instruction(Isolate::Current()->GetNextDeoptId()),
2171 comparison_(comparison),
2256 is_checked_(false), 2172 is_checked_(false),
2257 constrained_type_(NULL), 2173 constrained_type_(NULL),
2258 constant_target_(NULL) { 2174 constant_target_(NULL) {
2259 deopt_id_ = Isolate::Current()->GetNextDeoptId();
2260 ASSERT(comparison->env() == NULL); 2175 ASSERT(comparison->env() == NULL);
2261 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 2176 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
2262 comparison->InputAt(i)->set_instruction(this); 2177 comparison->InputAt(i)->set_instruction(this);
2263 } 2178 }
2264 } 2179 }
2265 2180
2266 DECLARE_INSTRUCTION(Branch) 2181 DECLARE_INSTRUCTION(Branch)
2267 2182
2268 virtual intptr_t ArgumentCount() const { 2183 virtual intptr_t ArgumentCount() const {
2269 return comparison()->ArgumentCount(); 2184 return comparison()->ArgumentCount();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 virtual bool MayThrow() const { return false; } 2296 virtual bool MayThrow() const { return false; }
2382 2297
2383 private: 2298 private:
2384 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr); 2299 DISALLOW_COPY_AND_ASSIGN(StoreContextInstr);
2385 }; 2300 };
2386 2301
2387 2302
2388 class DeoptimizeInstr : public TemplateInstruction<0> { 2303 class DeoptimizeInstr : public TemplateInstruction<0> {
2389 public: 2304 public:
2390 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) 2305 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id)
2391 : deopt_reason_(deopt_reason) { 2306 : TemplateInstruction<0>(deopt_id),
2392 deopt_id_ = deopt_id; 2307 deopt_reason_(deopt_reason) {
2393 } 2308 }
2394 2309
2395 virtual intptr_t ArgumentCount() const { return 0; } 2310 virtual intptr_t ArgumentCount() const { return 0; }
2396 2311
2397 virtual bool CanDeoptimize() const { return true; } 2312 virtual bool CanDeoptimize() const { return true; }
2398 2313
2399 virtual bool AllowsCSE() const { return true; } 2314 virtual bool AllowsCSE() const { return true; }
2400 virtual EffectSet Effects() const { return EffectSet::None(); } 2315 virtual EffectSet Effects() const { return EffectSet::None(); }
2401 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2316 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2402 virtual bool AttributesEqual(Instruction* other) const { 2317 virtual bool AttributesEqual(Instruction* other) const {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 }; 2457 };
2543 2458
2544 2459
2545 class AssertAssignableInstr : public TemplateDefinition<3> { 2460 class AssertAssignableInstr : public TemplateDefinition<3> {
2546 public: 2461 public:
2547 AssertAssignableInstr(intptr_t token_pos, 2462 AssertAssignableInstr(intptr_t token_pos,
2548 Value* value, 2463 Value* value,
2549 Value* instantiator, 2464 Value* instantiator,
2550 Value* instantiator_type_arguments, 2465 Value* instantiator_type_arguments,
2551 const AbstractType& dst_type, 2466 const AbstractType& dst_type,
2552 const String& dst_name) 2467 const String& dst_name,
2553 : token_pos_(token_pos), 2468 intptr_t deopt_id)
2469 : TemplateDefinition<3>(deopt_id),
2470 token_pos_(token_pos),
2554 dst_type_(AbstractType::ZoneHandle(dst_type.raw())), 2471 dst_type_(AbstractType::ZoneHandle(dst_type.raw())),
2555 dst_name_(dst_name) { 2472 dst_name_(dst_name) {
2556 deopt_id_ = Isolate::Current()->GetNextDeoptId();
2557 ASSERT(!dst_type.IsNull()); 2473 ASSERT(!dst_type.IsNull());
2558 ASSERT(!dst_name.IsNull()); 2474 ASSERT(!dst_name.IsNull());
2559 SetInputAt(0, value); 2475 SetInputAt(0, value);
2560 SetInputAt(1, instantiator); 2476 SetInputAt(1, instantiator);
2561 SetInputAt(2, instantiator_type_arguments); 2477 SetInputAt(2, instantiator_type_arguments);
2562 } 2478 }
2563 2479
2564 DECLARE_INSTRUCTION(AssertAssignable) 2480 DECLARE_INSTRUCTION(AssertAssignable)
2565 virtual CompileType* ComputeInitialType() const; 2481 virtual CompileType* ComputeInitialType() const;
2566 virtual bool RecomputeType(); 2482 virtual bool RecomputeType();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 AbstractType& dst_type_; 2516 AbstractType& dst_type_;
2601 const String& dst_name_; 2517 const String& dst_name_;
2602 2518
2603 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); 2519 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr);
2604 }; 2520 };
2605 2521
2606 2522
2607 class AssertBooleanInstr : public TemplateDefinition<1> { 2523 class AssertBooleanInstr : public TemplateDefinition<1> {
2608 public: 2524 public:
2609 AssertBooleanInstr(intptr_t token_pos, Value* value) 2525 AssertBooleanInstr(intptr_t token_pos, Value* value)
2610 : token_pos_(token_pos) { 2526 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()),
2611 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 2527 token_pos_(token_pos) {
2612 SetInputAt(0, value); 2528 SetInputAt(0, value);
2613 } 2529 }
2614 2530
2615 DECLARE_INSTRUCTION(AssertBoolean) 2531 DECLARE_INSTRUCTION(AssertBoolean)
2616 virtual CompileType ComputeType() const; 2532 virtual CompileType ComputeType() const;
2617 2533
2618 virtual intptr_t token_pos() const { return token_pos_; } 2534 virtual intptr_t token_pos() const { return token_pos_; }
2619 Value* value() const { return inputs_[0]; } 2535 Value* value() const { return inputs_[0]; }
2620 2536
2621 virtual void PrintOperandsTo(BufferFormatter* f) const; 2537 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 13 matching lines...) Expand all
2635 const intptr_t token_pos_; 2551 const intptr_t token_pos_;
2636 2552
2637 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); 2553 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
2638 }; 2554 };
2639 2555
2640 2556
2641 // Denotes the current context, normally held in a register. This is 2557 // Denotes the current context, normally held in a register. This is
2642 // a computation, not a value, because it's mutable. 2558 // a computation, not a value, because it's mutable.
2643 class CurrentContextInstr : public TemplateDefinition<0> { 2559 class CurrentContextInstr : public TemplateDefinition<0> {
2644 public: 2560 public:
2645 CurrentContextInstr() { 2561 CurrentContextInstr()
2646 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 2562 : TemplateDefinition<0>(Isolate::Current()->GetNextDeoptId()) {
2647 } 2563 }
2648 2564
2649 DECLARE_INSTRUCTION(CurrentContext) 2565 DECLARE_INSTRUCTION(CurrentContext)
2650 virtual CompileType ComputeType() const; 2566 virtual CompileType ComputeType() const;
2651 2567
2652 virtual bool CanDeoptimize() const { return false; } 2568 virtual bool CanDeoptimize() const { return false; }
2653 2569
2654 virtual EffectSet Effects() const { return EffectSet::None(); } 2570 virtual EffectSet Effects() const { return EffectSet::None(); }
2655 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2571 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2656 virtual bool AttributesEqual(Instruction* other) const { return true; } 2572 virtual bool AttributesEqual(Instruction* other) const { return true; }
2657 2573
2658 virtual bool MayThrow() const { return false; } 2574 virtual bool MayThrow() const { return false; }
2659 2575
2660 private: 2576 private:
2661 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); 2577 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr);
2662 }; 2578 };
2663 2579
2664 2580
2665 class ClosureCallInstr : public TemplateDefinition<1> { 2581 class ClosureCallInstr : public TemplateDefinition<1> {
2666 public: 2582 public:
2667 ClosureCallInstr(Value* function, 2583 ClosureCallInstr(Value* function,
2668 ClosureCallNode* node, 2584 ClosureCallNode* node,
2669 ZoneGrowableArray<PushArgumentInstr*>* arguments) 2585 ZoneGrowableArray<PushArgumentInstr*>* arguments)
2670 : ast_node_(*node), 2586 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()),
2587 ast_node_(*node),
2671 arguments_(arguments) { 2588 arguments_(arguments) {
2672 deopt_id_ = Isolate::Current()->GetNextDeoptId();
2673 SetInputAt(0, function); 2589 SetInputAt(0, function);
2674 } 2590 }
2675 2591
2676 DECLARE_INSTRUCTION(ClosureCall) 2592 DECLARE_INSTRUCTION(ClosureCall)
2677 2593
2678 const Array& argument_names() const { return ast_node_.arguments()->names(); } 2594 const Array& argument_names() const { return ast_node_.arguments()->names(); }
2679 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } 2595 virtual intptr_t token_pos() const { return ast_node_.token_pos(); }
2680 2596
2681 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 2597 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
2682 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2598 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
(...skipping 21 matching lines...) Expand all
2704 2620
2705 class InstanceCallInstr : public TemplateDefinition<0> { 2621 class InstanceCallInstr : public TemplateDefinition<0> {
2706 public: 2622 public:
2707 InstanceCallInstr(intptr_t token_pos, 2623 InstanceCallInstr(intptr_t token_pos,
2708 const String& function_name, 2624 const String& function_name,
2709 Token::Kind token_kind, 2625 Token::Kind token_kind,
2710 ZoneGrowableArray<PushArgumentInstr*>* arguments, 2626 ZoneGrowableArray<PushArgumentInstr*>* arguments,
2711 const Array& argument_names, 2627 const Array& argument_names,
2712 intptr_t checked_argument_count, 2628 intptr_t checked_argument_count,
2713 const ZoneGrowableArray<const ICData*>& ic_data_array) 2629 const ZoneGrowableArray<const ICData*>& ic_data_array)
2714 : ic_data_(NULL), 2630 : TemplateDefinition<0>(Isolate::Current()->GetNextDeoptId()),
2631 ic_data_(NULL),
2715 token_pos_(token_pos), 2632 token_pos_(token_pos),
2716 function_name_(function_name), 2633 function_name_(function_name),
2717 token_kind_(token_kind), 2634 token_kind_(token_kind),
2718 arguments_(arguments), 2635 arguments_(arguments),
2719 argument_names_(argument_names), 2636 argument_names_(argument_names),
2720 checked_argument_count_(checked_argument_count) { 2637 checked_argument_count_(checked_argument_count) {
2721 deopt_id_ = Isolate::Current()->GetNextDeoptId();
2722 ic_data_ = GetICData(ic_data_array); 2638 ic_data_ = GetICData(ic_data_array);
2723 ASSERT(function_name.IsNotTemporaryScopedHandle()); 2639 ASSERT(function_name.IsNotTemporaryScopedHandle());
2724 ASSERT(!arguments->is_empty()); 2640 ASSERT(!arguments->is_empty());
2725 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); 2641 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
2726 ASSERT(Token::IsBinaryOperator(token_kind) || 2642 ASSERT(Token::IsBinaryOperator(token_kind) ||
2727 Token::IsEqualityOperator(token_kind) || 2643 Token::IsEqualityOperator(token_kind) ||
2728 Token::IsRelationalOperator(token_kind) || 2644 Token::IsRelationalOperator(token_kind) ||
2729 Token::IsPrefixOperator(token_kind) || 2645 Token::IsPrefixOperator(token_kind) ||
2730 Token::IsIndexOperator(token_kind) || 2646 Token::IsIndexOperator(token_kind) ||
2731 Token::IsTypeTestOperator(token_kind) || 2647 Token::IsTypeTestOperator(token_kind) ||
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 2700
2785 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); 2701 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr);
2786 }; 2702 };
2787 2703
2788 2704
2789 class PolymorphicInstanceCallInstr : public TemplateDefinition<0> { 2705 class PolymorphicInstanceCallInstr : public TemplateDefinition<0> {
2790 public: 2706 public:
2791 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, 2707 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call,
2792 const ICData& ic_data, 2708 const ICData& ic_data,
2793 bool with_checks) 2709 bool with_checks)
2794 : instance_call_(instance_call), 2710 : TemplateDefinition<0>(instance_call->deopt_id()),
2711 instance_call_(instance_call),
2795 ic_data_(ic_data), 2712 ic_data_(ic_data),
2796 with_checks_(with_checks) { 2713 with_checks_(with_checks) {
2797 ASSERT(instance_call_ != NULL); 2714 ASSERT(instance_call_ != NULL);
2798 ASSERT(ic_data.NumberOfChecks() > 0); 2715 ASSERT(ic_data.NumberOfChecks() > 0);
2799 deopt_id_ = instance_call->deopt_id();
2800 } 2716 }
2801 2717
2802 InstanceCallInstr* instance_call() const { return instance_call_; } 2718 InstanceCallInstr* instance_call() const { return instance_call_; }
2803 bool with_checks() const { return with_checks_; } 2719 bool with_checks() const { return with_checks_; }
2804 virtual intptr_t token_pos() const { return instance_call_->token_pos(); } 2720 virtual intptr_t token_pos() const { return instance_call_->token_pos(); }
2805 2721
2806 virtual intptr_t ArgumentCount() const { 2722 virtual intptr_t ArgumentCount() const {
2807 return instance_call()->ArgumentCount(); 2723 return instance_call()->ArgumentCount();
2808 } 2724 }
2809 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 2725 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2846 bool needs_number_check); 2762 bool needs_number_check);
2847 2763
2848 DECLARE_INSTRUCTION(StrictCompare) 2764 DECLARE_INSTRUCTION(StrictCompare)
2849 2765
2850 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 2766 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
2851 2767
2852 virtual CompileType ComputeType() const; 2768 virtual CompileType ComputeType() const;
2853 2769
2854 virtual void PrintOperandsTo(BufferFormatter* f) const; 2770 virtual void PrintOperandsTo(BufferFormatter* f) const;
2855 2771
2856 virtual bool CanBecomeDeoptimizationTarget() const {
2857 // StrictCompare can be merged into Branch and thus needs an environment.
2858 return true;
2859 }
2860
2861 virtual bool CanDeoptimize() const { return false; } 2772 virtual bool CanDeoptimize() const { return false; }
2862 2773
2863 virtual Definition* Canonicalize(FlowGraph* flow_graph); 2774 virtual Definition* Canonicalize(FlowGraph* flow_graph);
2864 2775
2865 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2776 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2866 BranchInstr* branch); 2777 BranchInstr* branch);
2867 2778
2868 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2779 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
2869 BranchLabels labels); 2780 BranchLabels labels);
2870 2781
(...skipping 15 matching lines...) Expand all
2886 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); 2797 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr);
2887 }; 2798 };
2888 2799
2889 2800
2890 // Comparison instruction that is equivalent to the (left & right) == 0 2801 // Comparison instruction that is equivalent to the (left & right) == 0
2891 // comparison pattern. 2802 // comparison pattern.
2892 class TestSmiInstr : public ComparisonInstr { 2803 class TestSmiInstr : public ComparisonInstr {
2893 public: 2804 public:
2894 TestSmiInstr(intptr_t token_pos, Token::Kind kind, Value* left, Value* right) 2805 TestSmiInstr(intptr_t token_pos, Token::Kind kind, Value* left, Value* right)
2895 : ComparisonInstr(token_pos, kind, left, right) { 2806 : ComparisonInstr(token_pos, kind, left, right) {
2896 deopt_id_ = Isolate::Current()->GetNextDeoptId();
2897 ASSERT(kind == Token::kEQ || kind == Token::kNE); 2807 ASSERT(kind == Token::kEQ || kind == Token::kNE);
2898 } 2808 }
2899 2809
2900 DECLARE_INSTRUCTION(TestSmi); 2810 DECLARE_INSTRUCTION(TestSmi);
2901 2811
2902 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 2812 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
2903 2813
2904 virtual CompileType ComputeType() const; 2814 virtual CompileType ComputeType() const;
2905 2815
2906 virtual bool CanDeoptimize() const { return false; } 2816 virtual bool CanDeoptimize() const { return false; }
2907 2817
2908 virtual bool CanBecomeDeoptimizationTarget() const {
2909 // TestSmi can be merged into Branch and thus needs an environment.
2910 return true;
2911 }
2912
2913 virtual intptr_t DeoptimizationTarget() const {
2914 return GetDeoptId();
2915 }
2916
2917 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2818 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2918 return kTagged; 2819 return kTagged;
2919 } 2820 }
2920 2821
2921 virtual EffectSet Effects() const { return EffectSet::None(); } 2822 virtual EffectSet Effects() const { return EffectSet::None(); }
2922 2823
2923 virtual bool MayThrow() const { return false; } 2824 virtual bool MayThrow() const { return false; }
2924 2825
2925 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2826 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2926 BranchInstr* branch); 2827 BranchInstr* branch);
(...skipping 10 matching lines...) Expand all
2937 // a result or deoptimizes. 2838 // a result or deoptimizes.
2938 // TODO(srdjan): Modify ComparisonInstr to allow 1 or 2 arguments, since 2839 // TODO(srdjan): Modify ComparisonInstr to allow 1 or 2 arguments, since
2939 // TestCidInstr needs only one argument 2840 // TestCidInstr needs only one argument
2940 class TestCidsInstr : public ComparisonInstr { 2841 class TestCidsInstr : public ComparisonInstr {
2941 public: 2842 public:
2942 TestCidsInstr(intptr_t token_pos, 2843 TestCidsInstr(intptr_t token_pos,
2943 Token::Kind kind, 2844 Token::Kind kind,
2944 Value* value, 2845 Value* value,
2945 const ZoneGrowableArray<intptr_t>& cid_results, 2846 const ZoneGrowableArray<intptr_t>& cid_results,
2946 intptr_t deopt_id) 2847 intptr_t deopt_id)
2947 : ComparisonInstr(token_pos, kind, value, NULL), 2848 : ComparisonInstr(token_pos, kind, value, NULL, deopt_id),
2948 cid_results_(cid_results) { 2849 cid_results_(cid_results) {
2949 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT)); 2850 ASSERT((kind == Token::kIS) || (kind == Token::kISNOT));
2950 set_operation_cid(kObjectCid); 2851 set_operation_cid(kObjectCid);
2951 deopt_id_ = deopt_id;
2952 } 2852 }
2953 2853
2954 virtual intptr_t InputCount() const { return 1; } 2854 virtual intptr_t InputCount() const { return 1; }
2955 2855
2956 const ZoneGrowableArray<intptr_t>& cid_results() const { 2856 const ZoneGrowableArray<intptr_t>& cid_results() const {
2957 return cid_results_; 2857 return cid_results_;
2958 } 2858 }
2959 2859
2960 DECLARE_INSTRUCTION(TestCids); 2860 DECLARE_INSTRUCTION(TestCids);
2961 2861
2962 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 2862 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
2963 2863
2964 virtual CompileType ComputeType() const; 2864 virtual CompileType ComputeType() const;
2965 2865
2966 virtual bool CanDeoptimize() const { 2866 virtual bool CanDeoptimize() const {
2967 return deopt_id_ != Isolate::kNoDeoptId; 2867 return GetDeoptId() != Isolate::kNoDeoptId;
2968 }
2969
2970 virtual bool CanBecomeDeoptimizationTarget() const {
2971 // TestCid can be merged into Branch and thus needs an environment.
2972 return true;
2973 }
2974
2975 virtual intptr_t DeoptimizationTarget() const {
2976 return GetDeoptId();
2977 } 2868 }
2978 2869
2979 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2870 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
2980 return kTagged; 2871 return kTagged;
2981 } 2872 }
2982 2873
2983 virtual EffectSet Effects() const { return EffectSet::None(); } 2874 virtual EffectSet Effects() const { return EffectSet::None(); }
2984 virtual bool AllowsCSE() const { return true; } 2875 virtual bool AllowsCSE() const { return true; }
2985 virtual EffectSet Dependencies() const { return EffectSet::None(); } 2876 virtual EffectSet Dependencies() const { return EffectSet::None(); }
2986 2877
(...skipping 16 matching lines...) Expand all
3003 2894
3004 2895
3005 class EqualityCompareInstr : public ComparisonInstr { 2896 class EqualityCompareInstr : public ComparisonInstr {
3006 public: 2897 public:
3007 EqualityCompareInstr(intptr_t token_pos, 2898 EqualityCompareInstr(intptr_t token_pos,
3008 Token::Kind kind, 2899 Token::Kind kind,
3009 Value* left, 2900 Value* left,
3010 Value* right, 2901 Value* right,
3011 intptr_t cid, 2902 intptr_t cid,
3012 intptr_t deopt_id) 2903 intptr_t deopt_id)
3013 : ComparisonInstr(token_pos, kind, left, right) { 2904 : ComparisonInstr(token_pos, kind, left, right, deopt_id) {
3014 ASSERT(Token::IsEqualityOperator(kind)); 2905 ASSERT(Token::IsEqualityOperator(kind));
3015 set_operation_cid(cid); 2906 set_operation_cid(cid);
3016 deopt_id_ = deopt_id; // Override generated deopt-id.
3017 } 2907 }
3018 2908
3019 DECLARE_INSTRUCTION(EqualityCompare) 2909 DECLARE_INSTRUCTION(EqualityCompare)
3020 2910
3021 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 2911 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3022 2912
3023 virtual CompileType ComputeType() const; 2913 virtual CompileType ComputeType() const;
3024 2914
3025 virtual void PrintOperandsTo(BufferFormatter* f) const; 2915 virtual void PrintOperandsTo(BufferFormatter* f) const;
3026 2916
3027 virtual bool CanDeoptimize() const { return false; } 2917 virtual bool CanDeoptimize() const { return false; }
3028 2918
3029 virtual bool CanBecomeDeoptimizationTarget() const {
3030 // EqualityCompare can be merged into Branch and thus needs an environment.
3031 return true;
3032 }
3033
3034 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2919 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
3035 BranchInstr* branch); 2920 BranchInstr* branch);
3036 2921
3037 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2922 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3038 BranchLabels labels); 2923 BranchLabels labels);
3039 2924
3040 virtual intptr_t DeoptimizationTarget() const {
3041 return GetDeoptId();
3042 }
3043
3044 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2925 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3045 ASSERT((idx == 0) || (idx == 1)); 2926 ASSERT((idx == 0) || (idx == 1));
3046 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 2927 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
3047 if (operation_cid() == kMintCid) return kUnboxedMint; 2928 if (operation_cid() == kMintCid) return kUnboxedMint;
3048 return kTagged; 2929 return kTagged;
3049 } 2930 }
3050 2931
3051 virtual EffectSet Effects() const { return EffectSet::None(); } 2932 virtual EffectSet Effects() const { return EffectSet::None(); }
3052 2933
3053 virtual bool MayThrow() const { return false; } 2934 virtual bool MayThrow() const { return false; }
3054 2935
3055 private: 2936 private:
3056 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); 2937 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
3057 }; 2938 };
3058 2939
3059 2940
3060 class RelationalOpInstr : public ComparisonInstr { 2941 class RelationalOpInstr : public ComparisonInstr {
3061 public: 2942 public:
3062 RelationalOpInstr(intptr_t token_pos, 2943 RelationalOpInstr(intptr_t token_pos,
3063 Token::Kind kind, 2944 Token::Kind kind,
3064 Value* left, 2945 Value* left,
3065 Value* right, 2946 Value* right,
3066 intptr_t cid, 2947 intptr_t cid,
3067 intptr_t deopt_id) 2948 intptr_t deopt_id)
3068 : ComparisonInstr(token_pos, kind, left, right) { 2949 : ComparisonInstr(token_pos, kind, left, right, deopt_id) {
3069 ASSERT(Token::IsRelationalOperator(kind)); 2950 ASSERT(Token::IsRelationalOperator(kind));
3070 set_operation_cid(cid); 2951 set_operation_cid(cid);
3071 deopt_id_ = deopt_id; // Override generated deopt-id.
3072 } 2952 }
3073 2953
3074 DECLARE_INSTRUCTION(RelationalOp) 2954 DECLARE_INSTRUCTION(RelationalOp)
3075 2955
3076 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); 2956 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right);
3077 2957
3078 virtual CompileType ComputeType() const; 2958 virtual CompileType ComputeType() const;
3079 2959
3080 virtual void PrintOperandsTo(BufferFormatter* f) const; 2960 virtual void PrintOperandsTo(BufferFormatter* f) const;
3081 2961
3082 virtual bool CanDeoptimize() const { return false; } 2962 virtual bool CanDeoptimize() const { return false; }
3083 2963
3084 virtual bool CanBecomeDeoptimizationTarget() const {
3085 // RelationalOp can be merged into Branch and thus needs an environment.
3086 return true;
3087 }
3088
3089 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2964 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
3090 BranchInstr* branch); 2965 BranchInstr* branch);
3091 2966
3092 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler, 2967 virtual Condition EmitComparisonCode(FlowGraphCompiler* compiler,
3093 BranchLabels labels); 2968 BranchLabels labels);
3094 2969
3095 virtual intptr_t DeoptimizationTarget() const {
3096 return GetDeoptId();
3097 }
3098
3099 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 2970 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3100 ASSERT((idx == 0) || (idx == 1)); 2971 ASSERT((idx == 0) || (idx == 1));
3101 if (operation_cid() == kDoubleCid) return kUnboxedDouble; 2972 if (operation_cid() == kDoubleCid) return kUnboxedDouble;
3102 if (operation_cid() == kMintCid) return kUnboxedMint; 2973 if (operation_cid() == kMintCid) return kUnboxedMint;
3103 return kTagged; 2974 return kTagged;
3104 } 2975 }
3105 2976
3106 virtual EffectSet Effects() const { 2977 virtual EffectSet Effects() const {
3107 return EffectSet::None(); 2978 return EffectSet::None();
3108 } 2979 }
3109 2980
3110 virtual bool MayThrow() const { return false; } 2981 virtual bool MayThrow() const { return false; }
3111 2982
3112 private: 2983 private:
3113 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); 2984 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
3114 }; 2985 };
3115 2986
3116 2987
3117 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for 2988 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for
3118 // materialization of true and false constants. 2989 // materialization of true and false constants.
3119 class IfThenElseInstr : public Definition { 2990 class IfThenElseInstr : public Definition {
3120 public: 2991 public:
3121 IfThenElseInstr(ComparisonInstr* comparison, 2992 IfThenElseInstr(ComparisonInstr* comparison,
3122 Value* if_true, 2993 Value* if_true,
3123 Value* if_false) 2994 Value* if_false)
3124 : comparison_(comparison), 2995 : Definition(Isolate::Current()->GetNextDeoptId()),
2996 comparison_(comparison),
3125 if_true_(Smi::Cast(if_true->BoundConstant()).Value()), 2997 if_true_(Smi::Cast(if_true->BoundConstant()).Value()),
3126 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) { 2998 if_false_(Smi::Cast(if_false->BoundConstant()).Value()) {
3127 deopt_id_ = Isolate::Current()->GetNextDeoptId();
3128 // Adjust uses at the comparison. 2999 // Adjust uses at the comparison.
3129 ASSERT(comparison->env() == NULL); 3000 ASSERT(comparison->env() == NULL);
3130 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { 3001 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
3131 comparison->InputAt(i)->set_instruction(this); 3002 comparison->InputAt(i)->set_instruction(this);
3132 } 3003 }
3133 } 3004 }
3134 3005
3135 // Returns true if this combination of comparison and values flowing on 3006 // Returns true if this combination of comparison and values flowing on
3136 // the true and false paths is supported on the current platform. 3007 // the true and false paths is supported on the current platform.
3137 static bool Supports(ComparisonInstr* comparison, Value* v1, Value* v2); 3008 static bool Supports(ComparisonInstr* comparison, Value* v1, Value* v2);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
3195 }; 3066 };
3196 3067
3197 3068
3198 class StaticCallInstr : public TemplateDefinition<0> { 3069 class StaticCallInstr : public TemplateDefinition<0> {
3199 public: 3070 public:
3200 StaticCallInstr(intptr_t token_pos, 3071 StaticCallInstr(intptr_t token_pos,
3201 const Function& function, 3072 const Function& function,
3202 const Array& argument_names, 3073 const Array& argument_names,
3203 ZoneGrowableArray<PushArgumentInstr*>* arguments, 3074 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3204 const ZoneGrowableArray<const ICData*>& ic_data_array) 3075 const ZoneGrowableArray<const ICData*>& ic_data_array)
3205 : ic_data_(NULL), 3076 : TemplateDefinition<0>(Isolate::Current()->GetNextDeoptId()),
3077 ic_data_(NULL),
3206 token_pos_(token_pos), 3078 token_pos_(token_pos),
3207 function_(function), 3079 function_(function),
3208 argument_names_(argument_names), 3080 argument_names_(argument_names),
3209 arguments_(arguments), 3081 arguments_(arguments),
3210 result_cid_(kDynamicCid), 3082 result_cid_(kDynamicCid),
3211 is_known_list_constructor_(false), 3083 is_known_list_constructor_(false),
3212 is_native_list_factory_(false), 3084 is_native_list_factory_(false),
3213 identity_(AliasIdentity::Unknown()) { 3085 identity_(AliasIdentity::Unknown()) {
3214 deopt_id_ = Isolate::Current()->GetNextDeoptId();
3215 ic_data_ = GetICData(ic_data_array); 3086 ic_data_ = GetICData(ic_data_array);
3216 ASSERT(function.IsZoneHandle()); 3087 ASSERT(function.IsZoneHandle());
3217 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); 3088 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
3218 } 3089 }
3219 3090
3220 // ICData for static calls carries call count. 3091 // ICData for static calls carries call count.
3221 const ICData* ic_data() const { return ic_data_; } 3092 const ICData* ic_data() const { return ic_data_; }
3222 bool HasICData() const { 3093 bool HasICData() const {
3223 return (ic_data() != NULL) && !ic_data()->IsNull(); 3094 return (ic_data() != NULL) && !ic_data()->IsNull();
3224 } 3095 }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 3481
3611 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); 3482 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr);
3612 }; 3483 };
3613 3484
3614 3485
3615 class GuardFieldInstr : public TemplateInstruction<1> { 3486 class GuardFieldInstr : public TemplateInstruction<1> {
3616 public: 3487 public:
3617 GuardFieldInstr(Value* value, 3488 GuardFieldInstr(Value* value,
3618 const Field& field, 3489 const Field& field,
3619 intptr_t deopt_id) 3490 intptr_t deopt_id)
3620 : field_(field) { 3491 : TemplateInstruction<1>(deopt_id),
3621 deopt_id_ = deopt_id; 3492 field_(field) {
3622 SetInputAt(0, value); 3493 SetInputAt(0, value);
3623 } 3494 }
3624 3495
3625 Value* value() const { return inputs_[0]; } 3496 Value* value() const { return inputs_[0]; }
3626 3497
3627 const Field& field() const { return field_; } 3498 const Field& field() const { return field_; }
3628 3499
3629 virtual intptr_t ArgumentCount() const { return 0; } 3500 virtual intptr_t ArgumentCount() const { return 0; }
3630 3501
3631 virtual bool CanDeoptimize() const { return true; } 3502 virtual bool CanDeoptimize() const { return true; }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3759 3630
3760 3631
3761 class LoadIndexedInstr : public TemplateDefinition<2> { 3632 class LoadIndexedInstr : public TemplateDefinition<2> {
3762 public: 3633 public:
3763 LoadIndexedInstr(Value* array, 3634 LoadIndexedInstr(Value* array,
3764 Value* index, 3635 Value* index,
3765 intptr_t index_scale, 3636 intptr_t index_scale,
3766 intptr_t class_id, 3637 intptr_t class_id,
3767 intptr_t deopt_id, 3638 intptr_t deopt_id,
3768 intptr_t token_pos) 3639 intptr_t token_pos)
3769 : index_scale_(index_scale), 3640 : TemplateDefinition<2>(deopt_id),
3641 index_scale_(index_scale),
3770 class_id_(class_id), 3642 class_id_(class_id),
3771 token_pos_(token_pos) { 3643 token_pos_(token_pos) {
3772 SetInputAt(0, array); 3644 SetInputAt(0, array);
3773 SetInputAt(1, index); 3645 SetInputAt(1, index);
3774 deopt_id_ = deopt_id;
3775 } 3646 }
3776 3647
3777 intptr_t token_pos() const { return token_pos_; } 3648 intptr_t token_pos() const { return token_pos_; }
3778 3649
3779 DECLARE_INSTRUCTION(LoadIndexed) 3650 DECLARE_INSTRUCTION(LoadIndexed)
3780 virtual CompileType ComputeType() const; 3651 virtual CompileType ComputeType() const;
3781 3652
3782 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 3653 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
3783 ASSERT(idx == 0 || idx == 1); 3654 ASSERT(idx == 0 || idx == 1);
3784 // The array may be tagged or untagged (for external arrays). 3655 // The array may be tagged or untagged (for external arrays).
3785 if (idx == 0) return kNoRepresentation; 3656 if (idx == 0) return kNoRepresentation;
3786 return kTagged; 3657 return kTagged;
3787 } 3658 }
3788 3659
3789 bool IsExternal() const { 3660 bool IsExternal() const {
3790 return array()->definition()->representation() == kUntagged; 3661 return array()->definition()->representation() == kUntagged;
3791 } 3662 }
3792 3663
3793 Value* array() const { return inputs_[0]; } 3664 Value* array() const { return inputs_[0]; }
3794 Value* index() const { return inputs_[1]; } 3665 Value* index() const { return inputs_[1]; }
3795 intptr_t index_scale() const { return index_scale_; } 3666 intptr_t index_scale() const { return index_scale_; }
3796 intptr_t class_id() const { return class_id_; } 3667 intptr_t class_id() const { return class_id_; }
3797 3668
3798 virtual bool CanDeoptimize() const { 3669 virtual bool CanDeoptimize() const {
3799 return deopt_id_ != Isolate::kNoDeoptId; 3670 return GetDeoptId() != Isolate::kNoDeoptId;
3800 } 3671 }
3801 3672
3802 bool Typed32BitIsSmi() const { 3673 bool Typed32BitIsSmi() const {
3803 return kSmiBits >= 32; 3674 return kSmiBits >= 32;
3804 } 3675 }
3805 3676
3806 virtual Representation representation() const; 3677 virtual Representation representation() const;
3807 virtual void InferRange(RangeAnalysis* analysis, Range* range); 3678 virtual void InferRange(RangeAnalysis* analysis, Range* range);
3808 3679
3809 virtual bool AllowsCSE() const { return false; } 3680 virtual bool AllowsCSE() const { return false; }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 private: 3752 private:
3882 const intptr_t cid_; 3753 const intptr_t cid_;
3883 3754
3884 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); 3755 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr);
3885 }; 3756 };
3886 3757
3887 3758
3888 class StringInterpolateInstr : public TemplateDefinition<1> { 3759 class StringInterpolateInstr : public TemplateDefinition<1> {
3889 public: 3760 public:
3890 StringInterpolateInstr(Value* value, intptr_t token_pos) 3761 StringInterpolateInstr(Value* value, intptr_t token_pos)
3891 : token_pos_(token_pos), function_(Function::Handle()) { 3762 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()),
3892 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 3763 token_pos_(token_pos),
3764 function_(Function::Handle()) {
3893 SetInputAt(0, value); 3765 SetInputAt(0, value);
3894 } 3766 }
3895 3767
3896 Value* value() const { return inputs_[0]; } 3768 Value* value() const { return inputs_[0]; }
3897 virtual intptr_t token_pos() const { return token_pos_; } 3769 virtual intptr_t token_pos() const { return token_pos_; }
3898 3770
3899 virtual CompileType ComputeType() const; 3771 virtual CompileType ComputeType() const;
3900 // Issues a static call to Dart code which calls toString on objects. 3772 // Issues a static call to Dart code which calls toString on objects.
3901 virtual EffectSet Effects() const { return EffectSet::All(); } 3773 virtual EffectSet Effects() const { return EffectSet::All(); }
3902 virtual bool CanDeoptimize() const { return true; } 3774 virtual bool CanDeoptimize() const { return true; }
(...skipping 16 matching lines...) Expand all
3919 class StoreIndexedInstr : public TemplateDefinition<3> { 3791 class StoreIndexedInstr : public TemplateDefinition<3> {
3920 public: 3792 public:
3921 StoreIndexedInstr(Value* array, 3793 StoreIndexedInstr(Value* array,
3922 Value* index, 3794 Value* index,
3923 Value* value, 3795 Value* value,
3924 StoreBarrierType emit_store_barrier, 3796 StoreBarrierType emit_store_barrier,
3925 intptr_t index_scale, 3797 intptr_t index_scale,
3926 intptr_t class_id, 3798 intptr_t class_id,
3927 intptr_t deopt_id, 3799 intptr_t deopt_id,
3928 intptr_t token_pos) 3800 intptr_t token_pos)
3929 : emit_store_barrier_(emit_store_barrier), 3801 : TemplateDefinition<3>(deopt_id),
3802 emit_store_barrier_(emit_store_barrier),
3930 index_scale_(index_scale), 3803 index_scale_(index_scale),
3931 class_id_(class_id), 3804 class_id_(class_id),
3932 token_pos_(token_pos) { 3805 token_pos_(token_pos) {
3933 SetInputAt(kArrayPos, array); 3806 SetInputAt(kArrayPos, array);
3934 SetInputAt(kIndexPos, index); 3807 SetInputAt(kIndexPos, index);
3935 SetInputAt(kValuePos, value); 3808 SetInputAt(kValuePos, value);
3936 deopt_id_ = deopt_id;
3937 } 3809 }
3938 3810
3939 DECLARE_INSTRUCTION(StoreIndexed) 3811 DECLARE_INSTRUCTION(StoreIndexed)
3940 3812
3941 enum { 3813 enum {
3942 kArrayPos = 0, 3814 kArrayPos = 0,
3943 kIndexPos = 1, 3815 kIndexPos = 1,
3944 kValuePos = 2 3816 kValuePos = 2
3945 }; 3817 };
3946 3818
(...skipping 13 matching lines...) Expand all
3960 3832
3961 virtual Representation RequiredInputRepresentation(intptr_t idx) const; 3833 virtual Representation RequiredInputRepresentation(intptr_t idx) const;
3962 3834
3963 bool IsExternal() const { 3835 bool IsExternal() const {
3964 return array()->definition()->representation() == kUntagged; 3836 return array()->definition()->representation() == kUntagged;
3965 } 3837 }
3966 3838
3967 virtual intptr_t DeoptimizationTarget() const { 3839 virtual intptr_t DeoptimizationTarget() const {
3968 // Direct access since this instruction cannot deoptimize, and the deopt-id 3840 // Direct access since this instruction cannot deoptimize, and the deopt-id
3969 // was inherited from another instruction that could deoptimize. 3841 // was inherited from another instruction that could deoptimize.
3970 return deopt_id_; 3842 return GetDeoptId();
3971 } 3843 }
3972 3844
3973 virtual EffectSet Effects() const { return EffectSet::None(); } 3845 virtual EffectSet Effects() const { return EffectSet::None(); }
3974 3846
3975 virtual bool MayThrow() const { return false; } 3847 virtual bool MayThrow() const { return false; }
3976 3848
3977 private: 3849 private:
3978 const StoreBarrierType emit_store_barrier_; 3850 const StoreBarrierType emit_store_barrier_;
3979 const intptr_t index_scale_; 3851 const intptr_t index_scale_;
3980 const intptr_t class_id_; 3852 const intptr_t class_id_;
(...skipping 30 matching lines...) Expand all
4011 3883
4012 class InstanceOfInstr : public TemplateDefinition<3> { 3884 class InstanceOfInstr : public TemplateDefinition<3> {
4013 public: 3885 public:
4014 InstanceOfInstr(intptr_t token_pos, 3886 InstanceOfInstr(intptr_t token_pos,
4015 Value* value, 3887 Value* value,
4016 Value* instantiator, 3888 Value* instantiator,
4017 Value* instantiator_type_arguments, 3889 Value* instantiator_type_arguments,
4018 const AbstractType& type, 3890 const AbstractType& type,
4019 bool negate_result, 3891 bool negate_result,
4020 intptr_t deopt_id) 3892 intptr_t deopt_id)
4021 : token_pos_(token_pos), 3893 : TemplateDefinition<3>(deopt_id),
3894 token_pos_(token_pos),
4022 type_(type), 3895 type_(type),
4023 negate_result_(negate_result) { 3896 negate_result_(negate_result) {
4024 ASSERT(!type.IsNull()); 3897 ASSERT(!type.IsNull());
4025 SetInputAt(0, value); 3898 SetInputAt(0, value);
4026 SetInputAt(1, instantiator); 3899 SetInputAt(1, instantiator);
4027 SetInputAt(2, instantiator_type_arguments); 3900 SetInputAt(2, instantiator_type_arguments);
4028 deopt_id_ = deopt_id;
4029 } 3901 }
4030 3902
4031 DECLARE_INSTRUCTION(InstanceOf) 3903 DECLARE_INSTRUCTION(InstanceOf)
4032 virtual CompileType ComputeType() const; 3904 virtual CompileType ComputeType() const;
4033 3905
4034 Value* value() const { return inputs_[0]; } 3906 Value* value() const { return inputs_[0]; }
4035 Value* instantiator() const { return inputs_[1]; } 3907 Value* instantiator() const { return inputs_[1]; }
4036 Value* instantiator_type_arguments() const { return inputs_[2]; } 3908 Value* instantiator_type_arguments() const { return inputs_[2]; }
4037 3909
4038 bool negate_result() const { return negate_result_; } 3910 bool negate_result() const { return negate_result_; }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
4198 4070
4199 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); 4071 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr);
4200 }; 4072 };
4201 4073
4202 4074
4203 class CreateArrayInstr : public TemplateDefinition<2> { 4075 class CreateArrayInstr : public TemplateDefinition<2> {
4204 public: 4076 public:
4205 CreateArrayInstr(intptr_t token_pos, 4077 CreateArrayInstr(intptr_t token_pos,
4206 Value* element_type, 4078 Value* element_type,
4207 Value* num_elements) 4079 Value* num_elements)
4208 : token_pos_(token_pos), identity_(AliasIdentity::Unknown()) { 4080 : TemplateDefinition<2>(Isolate::Current()->GetNextDeoptId()),
4209 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 4081 token_pos_(token_pos),
4082 identity_(AliasIdentity::Unknown()) {
4210 SetInputAt(kElementTypePos, element_type); 4083 SetInputAt(kElementTypePos, element_type);
4211 SetInputAt(kLengthPos, num_elements); 4084 SetInputAt(kLengthPos, num_elements);
4212 } 4085 }
4213 4086
4214 enum { 4087 enum {
4215 kElementTypePos = 0, 4088 kElementTypePos = 0,
4216 kLengthPos = 1 4089 kLengthPos = 1
4217 }; 4090 };
4218 4091
4219 DECLARE_INSTRUCTION(CreateArray) 4092 DECLARE_INSTRUCTION(CreateArray)
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); 4276 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr);
4404 }; 4277 };
4405 4278
4406 4279
4407 class InstantiateTypeInstr : public TemplateDefinition<1> { 4280 class InstantiateTypeInstr : public TemplateDefinition<1> {
4408 public: 4281 public:
4409 InstantiateTypeInstr(intptr_t token_pos, 4282 InstantiateTypeInstr(intptr_t token_pos,
4410 const AbstractType& type, 4283 const AbstractType& type,
4411 const Class& instantiator_class, 4284 const Class& instantiator_class,
4412 Value* instantiator) 4285 Value* instantiator)
4413 : token_pos_(token_pos), 4286 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()),
4287 token_pos_(token_pos),
4414 type_(type), 4288 type_(type),
4415 instantiator_class_(instantiator_class) { 4289 instantiator_class_(instantiator_class) {
4416 deopt_id_ = Isolate::Current()->GetNextDeoptId();
4417 ASSERT(type.IsZoneHandle()); 4290 ASSERT(type.IsZoneHandle());
4418 SetInputAt(0, instantiator); 4291 SetInputAt(0, instantiator);
4419 } 4292 }
4420 4293
4421 DECLARE_INSTRUCTION(InstantiateType) 4294 DECLARE_INSTRUCTION(InstantiateType)
4422 4295
4423 Value* instantiator() const { return inputs_[0]; } 4296 Value* instantiator() const { return inputs_[0]; }
4424 const AbstractType& type() const { return type_; 4297 const AbstractType& type() const { return type_;
4425 } 4298 }
4426 const Class& instantiator_class() const { return instantiator_class_; } 4299 const Class& instantiator_class() const { return instantiator_class_; }
(...skipping 15 matching lines...) Expand all
4442 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); 4315 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr);
4443 }; 4316 };
4444 4317
4445 4318
4446 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> { 4319 class InstantiateTypeArgumentsInstr : public TemplateDefinition<1> {
4447 public: 4320 public:
4448 InstantiateTypeArgumentsInstr(intptr_t token_pos, 4321 InstantiateTypeArgumentsInstr(intptr_t token_pos,
4449 const TypeArguments& type_arguments, 4322 const TypeArguments& type_arguments,
4450 const Class& instantiator_class, 4323 const Class& instantiator_class,
4451 Value* instantiator) 4324 Value* instantiator)
4452 : token_pos_(token_pos), 4325 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()),
4326 token_pos_(token_pos),
4453 type_arguments_(type_arguments), 4327 type_arguments_(type_arguments),
4454 instantiator_class_(instantiator_class) { 4328 instantiator_class_(instantiator_class) {
4455 deopt_id_ = Isolate::Current()->GetNextDeoptId();
4456 ASSERT(type_arguments.IsZoneHandle()); 4329 ASSERT(type_arguments.IsZoneHandle());
4457 SetInputAt(0, instantiator); 4330 SetInputAt(0, instantiator);
4458 } 4331 }
4459 4332
4460 DECLARE_INSTRUCTION(InstantiateTypeArguments) 4333 DECLARE_INSTRUCTION(InstantiateTypeArguments)
4461 4334
4462 Value* instantiator() const { return inputs_[0]; } 4335 Value* instantiator() const { return inputs_[0]; }
4463 const TypeArguments& type_arguments() const { 4336 const TypeArguments& type_arguments() const {
4464 return type_arguments_; 4337 return type_arguments_;
4465 } 4338 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4510 const intptr_t token_pos_; 4383 const intptr_t token_pos_;
4511 const intptr_t num_context_variables_; 4384 const intptr_t num_context_variables_;
4512 4385
4513 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); 4386 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr);
4514 }; 4387 };
4515 4388
4516 4389
4517 class InitStaticFieldInstr : public TemplateInstruction<1> { 4390 class InitStaticFieldInstr : public TemplateInstruction<1> {
4518 public: 4391 public:
4519 InitStaticFieldInstr(Value* input, const Field& field) 4392 InitStaticFieldInstr(Value* input, const Field& field)
4520 : field_(field) { 4393 : TemplateInstruction<1>(Isolate::Current()->GetNextDeoptId()),
4521 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 4394 field_(field) {
4522 SetInputAt(0, input); 4395 SetInputAt(0, input);
4523 } 4396 }
4524 4397
4525 virtual intptr_t token_pos() const { return field_.token_pos(); } 4398 virtual intptr_t token_pos() const { return field_.token_pos(); }
4526 const Field& field() const { return field_; } 4399 const Field& field() const { return field_; }
4527 4400
4528 DECLARE_INSTRUCTION(InitStaticField) 4401 DECLARE_INSTRUCTION(InitStaticField)
4529 4402
4530 virtual intptr_t ArgumentCount() const { return 0; } 4403 virtual intptr_t ArgumentCount() const { return 0; }
4531 virtual bool CanDeoptimize() const { return true; } 4404 virtual bool CanDeoptimize() const { return true; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
4565 const intptr_t token_pos_; 4438 const intptr_t token_pos_;
4566 const intptr_t num_context_variables_; 4439 const intptr_t num_context_variables_;
4567 4440
4568 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); 4441 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr);
4569 }; 4442 };
4570 4443
4571 4444
4572 class CloneContextInstr : public TemplateDefinition<1> { 4445 class CloneContextInstr : public TemplateDefinition<1> {
4573 public: 4446 public:
4574 CloneContextInstr(intptr_t token_pos, Value* context_value) 4447 CloneContextInstr(intptr_t token_pos, Value* context_value)
4575 : token_pos_(token_pos) { 4448 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()),
4576 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 4449 token_pos_(token_pos) {
4577 SetInputAt(0, context_value); 4450 SetInputAt(0, context_value);
4578 } 4451 }
4579 4452
4580 virtual intptr_t token_pos() const { return token_pos_; } 4453 virtual intptr_t token_pos() const { return token_pos_; }
4581 Value* context_value() const { return inputs_[0]; } 4454 Value* context_value() const { return inputs_[0]; }
4582 4455
4583 DECLARE_INSTRUCTION(CloneContext) 4456 DECLARE_INSTRUCTION(CloneContext)
4584 virtual CompileType ComputeType() const; 4457 virtual CompileType ComputeType() const;
4585 4458
4586 virtual bool CanDeoptimize() const { return true; } 4459 virtual bool CanDeoptimize() const { return true; }
4587 4460
4588 virtual EffectSet Effects() const { return EffectSet::None(); } 4461 virtual EffectSet Effects() const { return EffectSet::None(); }
4589 4462
4590 virtual bool MayThrow() const { return false; } 4463 virtual bool MayThrow() const { return false; }
4591 4464
4592 private: 4465 private:
4593 const intptr_t token_pos_; 4466 const intptr_t token_pos_;
4594 4467
4595 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); 4468 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr);
4596 }; 4469 };
4597 4470
4598 4471
4599 class CheckEitherNonSmiInstr : public TemplateInstruction<2> { 4472 class CheckEitherNonSmiInstr : public TemplateInstruction<2> {
4600 public: 4473 public:
4601 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) 4474 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id)
4602 : licm_hoisted_(false) { 4475 : TemplateInstruction<2>(deopt_id), licm_hoisted_(false) {
4603 SetInputAt(0, left); 4476 SetInputAt(0, left);
4604 SetInputAt(1, right); 4477 SetInputAt(1, right);
4605 // Override generated deopt-id.
4606 deopt_id_ = deopt_id;
4607 } 4478 }
4608 4479
4609 Value* left() const { return inputs_[0]; } 4480 Value* left() const { return inputs_[0]; }
4610 Value* right() const { return inputs_[1]; } 4481 Value* right() const { return inputs_[1]; }
4611 4482
4612 DECLARE_INSTRUCTION(CheckEitherNonSmi) 4483 DECLARE_INSTRUCTION(CheckEitherNonSmi)
4613 4484
4614 virtual intptr_t ArgumentCount() const { return 0; } 4485 virtual intptr_t ArgumentCount() const { return 0; }
4615 4486
4616 virtual bool CanDeoptimize() const { return true; } 4487 virtual bool CanDeoptimize() const { return true; }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4817 4688
4818 private: 4689 private:
4819 bool is_smi_; 4690 bool is_smi_;
4820 4691
4821 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); 4692 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr);
4822 }; 4693 };
4823 4694
4824 4695
4825 class UnboxDoubleInstr : public TemplateDefinition<1> { 4696 class UnboxDoubleInstr : public TemplateDefinition<1> {
4826 public: 4697 public:
4827 UnboxDoubleInstr(Value* value, intptr_t deopt_id) { 4698 UnboxDoubleInstr(Value* value, intptr_t deopt_id)
4699 : TemplateDefinition<1>(deopt_id) {
4828 SetInputAt(0, value); 4700 SetInputAt(0, value);
4829 deopt_id_ = deopt_id;
4830 } 4701 }
4831 4702
4832 Value* value() const { return inputs_[0]; } 4703 Value* value() const { return inputs_[0]; }
4833 4704
4834 virtual bool CanDeoptimize() const { 4705 virtual bool CanDeoptimize() const {
4835 return (value()->Type()->ToCid() != kDoubleCid) 4706 return (value()->Type()->ToCid() != kDoubleCid)
4836 && (value()->Type()->ToCid() != kSmiCid); 4707 && (value()->Type()->ToCid() != kSmiCid);
4837 } 4708 }
4838 4709
4839 virtual Representation representation() const { 4710 virtual Representation representation() const {
(...skipping 12 matching lines...) Expand all
4852 4723
4853 Definition* Canonicalize(FlowGraph* flow_graph); 4724 Definition* Canonicalize(FlowGraph* flow_graph);
4854 4725
4855 private: 4726 private:
4856 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr); 4727 DISALLOW_COPY_AND_ASSIGN(UnboxDoubleInstr);
4857 }; 4728 };
4858 4729
4859 4730
4860 class UnboxFloat32x4Instr : public TemplateDefinition<1> { 4731 class UnboxFloat32x4Instr : public TemplateDefinition<1> {
4861 public: 4732 public:
4862 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id) { 4733 UnboxFloat32x4Instr(Value* value, intptr_t deopt_id)
4734 : TemplateDefinition<1>(deopt_id) {
4863 SetInputAt(0, value); 4735 SetInputAt(0, value);
4864 deopt_id_ = deopt_id;
4865 } 4736 }
4866 4737
4867 Value* value() const { return inputs_[0]; } 4738 Value* value() const { return inputs_[0]; }
4868 4739
4869 virtual bool CanDeoptimize() const { 4740 virtual bool CanDeoptimize() const {
4870 return (value()->Type()->ToCid() != kFloat32x4Cid); 4741 return (value()->Type()->ToCid() != kFloat32x4Cid);
4871 } 4742 }
4872 4743
4873 virtual Representation representation() const { 4744 virtual Representation representation() const {
4874 return kUnboxedFloat32x4; 4745 return kUnboxedFloat32x4;
(...skipping 11 matching lines...) Expand all
4886 4757
4887 Definition* Canonicalize(FlowGraph* flow_graph); 4758 Definition* Canonicalize(FlowGraph* flow_graph);
4888 4759
4889 private: 4760 private:
4890 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr); 4761 DISALLOW_COPY_AND_ASSIGN(UnboxFloat32x4Instr);
4891 }; 4762 };
4892 4763
4893 4764
4894 class UnboxFloat64x2Instr : public TemplateDefinition<1> { 4765 class UnboxFloat64x2Instr : public TemplateDefinition<1> {
4895 public: 4766 public:
4896 UnboxFloat64x2Instr(Value* value, intptr_t deopt_id) { 4767 UnboxFloat64x2Instr(Value* value, intptr_t deopt_id)
4768 : TemplateDefinition<1>(deopt_id) {
4897 SetInputAt(0, value); 4769 SetInputAt(0, value);
4898 deopt_id_ = deopt_id;
4899 } 4770 }
4900 4771
4901 Value* value() const { return inputs_[0]; } 4772 Value* value() const { return inputs_[0]; }
4902 4773
4903 virtual bool CanDeoptimize() const { 4774 virtual bool CanDeoptimize() const {
4904 return (value()->Type()->ToCid() != kFloat64x2Cid); 4775 return (value()->Type()->ToCid() != kFloat64x2Cid);
4905 } 4776 }
4906 4777
4907 virtual Representation representation() const { 4778 virtual Representation representation() const {
4908 return kUnboxedFloat64x2; 4779 return kUnboxedFloat64x2;
(...skipping 11 matching lines...) Expand all
4920 4791
4921 Definition* Canonicalize(FlowGraph* flow_graph); 4792 Definition* Canonicalize(FlowGraph* flow_graph);
4922 4793
4923 private: 4794 private:
4924 DISALLOW_COPY_AND_ASSIGN(UnboxFloat64x2Instr); 4795 DISALLOW_COPY_AND_ASSIGN(UnboxFloat64x2Instr);
4925 }; 4796 };
4926 4797
4927 4798
4928 class UnboxInt32x4Instr : public TemplateDefinition<1> { 4799 class UnboxInt32x4Instr : public TemplateDefinition<1> {
4929 public: 4800 public:
4930 UnboxInt32x4Instr(Value* value, intptr_t deopt_id) { 4801 UnboxInt32x4Instr(Value* value, intptr_t deopt_id)
4802 : TemplateDefinition<1>(deopt_id) {
4931 SetInputAt(0, value); 4803 SetInputAt(0, value);
4932 deopt_id_ = deopt_id;
4933 } 4804 }
4934 4805
4935 Value* value() const { return inputs_[0]; } 4806 Value* value() const { return inputs_[0]; }
4936 4807
4937 virtual bool CanDeoptimize() const { 4808 virtual bool CanDeoptimize() const {
4938 return (value()->Type()->ToCid() != kInt32x4Cid); 4809 return (value()->Type()->ToCid() != kInt32x4Cid);
4939 } 4810 }
4940 4811
4941 virtual Representation representation() const { 4812 virtual Representation representation() const {
4942 return kUnboxedInt32x4; 4813 return kUnboxedInt32x4;
(...skipping 11 matching lines...) Expand all
4954 4825
4955 Definition* Canonicalize(FlowGraph* flow_graph); 4826 Definition* Canonicalize(FlowGraph* flow_graph);
4956 4827
4957 private: 4828 private:
4958 DISALLOW_COPY_AND_ASSIGN(UnboxInt32x4Instr); 4829 DISALLOW_COPY_AND_ASSIGN(UnboxInt32x4Instr);
4959 }; 4830 };
4960 4831
4961 4832
4962 class UnboxIntegerInstr : public TemplateDefinition<1> { 4833 class UnboxIntegerInstr : public TemplateDefinition<1> {
4963 public: 4834 public:
4964 UnboxIntegerInstr(Value* value, intptr_t deopt_id) { 4835 UnboxIntegerInstr(Value* value, intptr_t deopt_id)
4836 : TemplateDefinition<1>(deopt_id) {
4965 SetInputAt(0, value); 4837 SetInputAt(0, value);
4966 deopt_id_ = deopt_id;
4967 } 4838 }
4968 4839
4969 Value* value() const { return inputs_[0]; } 4840 Value* value() const { return inputs_[0]; }
4970 4841
4971 virtual bool CanDeoptimize() const { 4842 virtual bool CanDeoptimize() const {
4972 return (value()->Type()->ToCid() != kSmiCid) 4843 return (value()->Type()->ToCid() != kSmiCid)
4973 && (value()->Type()->ToCid() != kMintCid); 4844 && (value()->Type()->ToCid() != kMintCid);
4974 } 4845 }
4975 4846
4976 virtual Representation representation() const { 4847 virtual Representation representation() const {
4977 return kUnboxedMint; 4848 return kUnboxedMint;
4978 } 4849 }
4979 4850
4980 intptr_t deopt_id() const { return deopt_id_; } 4851 intptr_t deopt_id() const { return GetDeoptId(); }
4981 4852
4982 virtual void InferRange(RangeAnalysis* analysis, Range* range); 4853 virtual void InferRange(RangeAnalysis* analysis, Range* range);
4983 4854
4984 DECLARE_INSTRUCTION(UnboxInteger) 4855 DECLARE_INSTRUCTION(UnboxInteger)
4985 virtual CompileType ComputeType() const; 4856 virtual CompileType ComputeType() const;
4986 4857
4987 virtual bool AllowsCSE() const { return true; } 4858 virtual bool AllowsCSE() const { return true; }
4988 virtual EffectSet Effects() const { return EffectSet::None(); } 4859 virtual EffectSet Effects() const { return EffectSet::None(); }
4989 virtual EffectSet Dependencies() const { return EffectSet::None(); } 4860 virtual EffectSet Dependencies() const { return EffectSet::None(); }
4990 virtual bool AttributesEqual(Instruction* other) const { return true; } 4861 virtual bool AttributesEqual(Instruction* other) const { return true; }
(...skipping 10 matching lines...) Expand all
5001 class MathUnaryInstr : public TemplateDefinition<1> { 4872 class MathUnaryInstr : public TemplateDefinition<1> {
5002 public: 4873 public:
5003 enum MathUnaryKind { 4874 enum MathUnaryKind {
5004 kIllegal, 4875 kIllegal,
5005 kSin, 4876 kSin,
5006 kCos, 4877 kCos,
5007 kSqrt, 4878 kSqrt,
5008 kDoubleSquare, 4879 kDoubleSquare,
5009 }; 4880 };
5010 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) 4881 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id)
5011 : kind_(kind) { 4882 : TemplateDefinition<1>(deopt_id), kind_(kind) {
5012 SetInputAt(0, value); 4883 SetInputAt(0, value);
5013 deopt_id_ = deopt_id;
5014 } 4884 }
5015 4885
5016 Value* value() const { return inputs_[0]; } 4886 Value* value() const { return inputs_[0]; }
5017 MathUnaryKind kind() const { return kind_; } 4887 MathUnaryKind kind() const { return kind_; }
5018 const RuntimeEntry& TargetFunction() const; 4888 const RuntimeEntry& TargetFunction() const;
5019 4889
5020 virtual void PrintOperandsTo(BufferFormatter* f) const; 4890 virtual void PrintOperandsTo(BufferFormatter* f) const;
5021 4891
5022 virtual bool CanDeoptimize() const { return false; } 4892 virtual bool CanDeoptimize() const { return false; }
5023 4893
5024 virtual Representation representation() const { 4894 virtual Representation representation() const {
5025 return kUnboxedDouble; 4895 return kUnboxedDouble;
5026 } 4896 }
5027 4897
5028 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 4898 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5029 ASSERT(idx == 0); 4899 ASSERT(idx == 0);
5030 return kUnboxedDouble; 4900 return kUnboxedDouble;
5031 } 4901 }
5032 4902
5033 virtual intptr_t DeoptimizationTarget() const { 4903 virtual intptr_t DeoptimizationTarget() const {
5034 // Direct access since this instruction cannot deoptimize, and the deopt-id 4904 // Direct access since this instruction cannot deoptimize, and the deopt-id
5035 // was inherited from another instruction that could deoptimize. 4905 // was inherited from another instruction that could deoptimize.
5036 return deopt_id_; 4906 return GetDeoptId();
5037 } 4907 }
5038 4908
5039 DECLARE_INSTRUCTION(MathUnary) 4909 DECLARE_INSTRUCTION(MathUnary)
5040 virtual CompileType ComputeType() const; 4910 virtual CompileType ComputeType() const;
5041 4911
5042 virtual bool AllowsCSE() const { return true; } 4912 virtual bool AllowsCSE() const { return true; }
5043 virtual EffectSet Effects() const { return EffectSet::None(); } 4913 virtual EffectSet Effects() const { return EffectSet::None(); }
5044 virtual EffectSet Dependencies() const { return EffectSet::None(); } 4914 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5045 virtual bool AttributesEqual(Instruction* other) const { 4915 virtual bool AttributesEqual(Instruction* other) const {
5046 return kind() == other->AsMathUnary()->kind(); 4916 return kind() == other->AsMathUnary()->kind();
(...skipping 13 matching lines...) Expand all
5060 4930
5061 4931
5062 // Represents Math's static min and max functions. 4932 // Represents Math's static min and max functions.
5063 class MathMinMaxInstr : public TemplateDefinition<2> { 4933 class MathMinMaxInstr : public TemplateDefinition<2> {
5064 public: 4934 public:
5065 MathMinMaxInstr(MethodRecognizer::Kind op_kind, 4935 MathMinMaxInstr(MethodRecognizer::Kind op_kind,
5066 Value* left_value, 4936 Value* left_value,
5067 Value* right_value, 4937 Value* right_value,
5068 intptr_t deopt_id, 4938 intptr_t deopt_id,
5069 intptr_t result_cid) 4939 intptr_t result_cid)
5070 : op_kind_(op_kind), result_cid_(result_cid) { 4940 : TemplateDefinition<2>(deopt_id),
4941 op_kind_(op_kind),
4942 result_cid_(result_cid) {
5071 ASSERT((result_cid == kSmiCid) || (result_cid == kDoubleCid)); 4943 ASSERT((result_cid == kSmiCid) || (result_cid == kDoubleCid));
5072 SetInputAt(0, left_value); 4944 SetInputAt(0, left_value);
5073 SetInputAt(1, right_value); 4945 SetInputAt(1, right_value);
5074 deopt_id_ = deopt_id;
5075 } 4946 }
5076 4947
5077 MethodRecognizer::Kind op_kind() const { return op_kind_; } 4948 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5078 4949
5079 Value* left() const { return inputs_[0]; } 4950 Value* left() const { return inputs_[0]; }
5080 Value* right() const { return inputs_[1]; } 4951 Value* right() const { return inputs_[1]; }
5081 4952
5082 intptr_t result_cid() const { return result_cid_; } 4953 intptr_t result_cid() const { return result_cid_; }
5083 4954
5084 virtual bool CanDeoptimize() const { return false; } 4955 virtual bool CanDeoptimize() const { return false; }
(...skipping 10 matching lines...) Expand all
5095 if (result_cid() == kSmiCid) { 4966 if (result_cid() == kSmiCid) {
5096 return kTagged; 4967 return kTagged;
5097 } 4968 }
5098 ASSERT(result_cid() == kDoubleCid); 4969 ASSERT(result_cid() == kDoubleCid);
5099 return kUnboxedDouble; 4970 return kUnboxedDouble;
5100 } 4971 }
5101 4972
5102 virtual intptr_t DeoptimizationTarget() const { 4973 virtual intptr_t DeoptimizationTarget() const {
5103 // Direct access since this instruction cannot deoptimize, and the deopt-id 4974 // Direct access since this instruction cannot deoptimize, and the deopt-id
5104 // was inherited from another instruction that could deoptimize. 4975 // was inherited from another instruction that could deoptimize.
5105 return deopt_id_; 4976 return GetDeoptId();
5106 } 4977 }
5107 4978
5108 DECLARE_INSTRUCTION(MathMinMax) 4979 DECLARE_INSTRUCTION(MathMinMax)
5109 virtual CompileType ComputeType() const; 4980 virtual CompileType ComputeType() const;
5110 virtual bool AllowsCSE() const { return true; } 4981 virtual bool AllowsCSE() const { return true; }
5111 virtual EffectSet Effects() const { return EffectSet::None(); } 4982 virtual EffectSet Effects() const { return EffectSet::None(); }
5112 virtual EffectSet Dependencies() const { return EffectSet::None(); } 4983 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5113 virtual bool AttributesEqual(Instruction* other) const; 4984 virtual bool AttributesEqual(Instruction* other) const;
5114 4985
5115 virtual bool MayThrow() const { return false; } 4986 virtual bool MayThrow() const { return false; }
5116 4987
5117 private: 4988 private:
5118 const MethodRecognizer::Kind op_kind_; 4989 const MethodRecognizer::Kind op_kind_;
5119 const intptr_t result_cid_; 4990 const intptr_t result_cid_;
5120 4991
5121 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); 4992 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr);
5122 }; 4993 };
5123 4994
5124 4995
5125 class BinaryDoubleOpInstr : public TemplateDefinition<2> { 4996 class BinaryDoubleOpInstr : public TemplateDefinition<2> {
5126 public: 4997 public:
5127 BinaryDoubleOpInstr(Token::Kind op_kind, 4998 BinaryDoubleOpInstr(Token::Kind op_kind,
5128 Value* left, 4999 Value* left,
5129 Value* right, 5000 Value* right,
5130 intptr_t deopt_id, 5001 intptr_t deopt_id,
5131 intptr_t token_pos) 5002 intptr_t token_pos)
5132 : op_kind_(op_kind), token_pos_(token_pos) { 5003 : TemplateDefinition<2>(deopt_id),
5004 op_kind_(op_kind),
5005 token_pos_(token_pos) {
5133 SetInputAt(0, left); 5006 SetInputAt(0, left);
5134 SetInputAt(1, right); 5007 SetInputAt(1, right);
5135 // Overriden generated deopt_id.
5136 deopt_id_ = deopt_id;
5137 } 5008 }
5138 5009
5139 Value* left() const { return inputs_[0]; } 5010 Value* left() const { return inputs_[0]; }
5140 Value* right() const { return inputs_[1]; } 5011 Value* right() const { return inputs_[1]; }
5141 5012
5142 Token::Kind op_kind() const { return op_kind_; } 5013 Token::Kind op_kind() const { return op_kind_; }
5143 5014
5144 virtual intptr_t token_pos() const { return token_pos_; } 5015 virtual intptr_t token_pos() const { return token_pos_; }
5145 5016
5146 virtual void PrintOperandsTo(BufferFormatter* f) const; 5017 virtual void PrintOperandsTo(BufferFormatter* f) const;
5147 5018
5148 virtual bool CanDeoptimize() const { return false; } 5019 virtual bool CanDeoptimize() const { return false; }
5149 5020
5150 virtual Representation representation() const { 5021 virtual Representation representation() const {
5151 return kUnboxedDouble; 5022 return kUnboxedDouble;
5152 } 5023 }
5153 5024
5154 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5025 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5155 ASSERT((idx == 0) || (idx == 1)); 5026 ASSERT((idx == 0) || (idx == 1));
5156 return kUnboxedDouble; 5027 return kUnboxedDouble;
5157 } 5028 }
5158 5029
5159 virtual intptr_t DeoptimizationTarget() const { 5030 virtual intptr_t DeoptimizationTarget() const {
5160 // Direct access since this instruction cannot deoptimize, and the deopt-id 5031 // Direct access since this instruction cannot deoptimize, and the deopt-id
5161 // was inherited from another instruction that could deoptimize. 5032 // was inherited from another instruction that could deoptimize.
5162 return deopt_id_; 5033 return GetDeoptId();
5163 } 5034 }
5164 5035
5165 DECLARE_INSTRUCTION(BinaryDoubleOp) 5036 DECLARE_INSTRUCTION(BinaryDoubleOp)
5166 virtual CompileType ComputeType() const; 5037 virtual CompileType ComputeType() const;
5167 5038
5168 virtual Definition* Canonicalize(FlowGraph* flow_graph); 5039 virtual Definition* Canonicalize(FlowGraph* flow_graph);
5169 5040
5170 virtual bool AllowsCSE() const { return true; } 5041 virtual bool AllowsCSE() const { return true; }
5171 virtual EffectSet Effects() const { return EffectSet::None(); } 5042 virtual EffectSet Effects() const { return EffectSet::None(); }
5172 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5043 virtual EffectSet Dependencies() const { return EffectSet::None(); }
(...skipping 10 matching lines...) Expand all
5183 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); 5054 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr);
5184 }; 5055 };
5185 5056
5186 5057
5187 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> { 5058 class BinaryFloat32x4OpInstr : public TemplateDefinition<2> {
5188 public: 5059 public:
5189 BinaryFloat32x4OpInstr(Token::Kind op_kind, 5060 BinaryFloat32x4OpInstr(Token::Kind op_kind,
5190 Value* left, 5061 Value* left,
5191 Value* right, 5062 Value* right,
5192 intptr_t deopt_id) 5063 intptr_t deopt_id)
5193 : op_kind_(op_kind) { 5064 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
5194 SetInputAt(0, left); 5065 SetInputAt(0, left);
5195 SetInputAt(1, right); 5066 SetInputAt(1, right);
5196 deopt_id_ = deopt_id;
5197 } 5067 }
5198 5068
5199 Value* left() const { return inputs_[0]; } 5069 Value* left() const { return inputs_[0]; }
5200 Value* right() const { return inputs_[1]; } 5070 Value* right() const { return inputs_[1]; }
5201 5071
5202 Token::Kind op_kind() const { return op_kind_; } 5072 Token::Kind op_kind() const { return op_kind_; }
5203 5073
5204 virtual void PrintOperandsTo(BufferFormatter* f) const; 5074 virtual void PrintOperandsTo(BufferFormatter* f) const;
5205 5075
5206 virtual bool CanDeoptimize() const { return false; } 5076 virtual bool CanDeoptimize() const { return false; }
5207 5077
5208 virtual Representation representation() const { 5078 virtual Representation representation() const {
5209 return kUnboxedFloat32x4; 5079 return kUnboxedFloat32x4;
5210 } 5080 }
5211 5081
5212 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5082 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5213 ASSERT((idx == 0) || (idx == 1)); 5083 ASSERT((idx == 0) || (idx == 1));
5214 return kUnboxedFloat32x4; 5084 return kUnboxedFloat32x4;
5215 } 5085 }
5216 5086
5217 virtual intptr_t DeoptimizationTarget() const { 5087 virtual intptr_t DeoptimizationTarget() const {
5218 // Direct access since this instruction cannot deoptimize, and the deopt-id 5088 // Direct access since this instruction cannot deoptimize, and the deopt-id
5219 // was inherited from another instruction that could deoptimize. 5089 // was inherited from another instruction that could deoptimize.
5220 return deopt_id_; 5090 return GetDeoptId();
5221 } 5091 }
5222 5092
5223 DECLARE_INSTRUCTION(BinaryFloat32x4Op) 5093 DECLARE_INSTRUCTION(BinaryFloat32x4Op)
5224 virtual CompileType ComputeType() const; 5094 virtual CompileType ComputeType() const;
5225 5095
5226 virtual bool AllowsCSE() const { return true; } 5096 virtual bool AllowsCSE() const { return true; }
5227 virtual EffectSet Effects() const { return EffectSet::None(); } 5097 virtual EffectSet Effects() const { return EffectSet::None(); }
5228 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5098 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5229 virtual bool AttributesEqual(Instruction* other) const { 5099 virtual bool AttributesEqual(Instruction* other) const {
5230 return op_kind() == other->AsBinaryFloat32x4Op()->op_kind(); 5100 return op_kind() == other->AsBinaryFloat32x4Op()->op_kind();
5231 } 5101 }
5232 5102
5233 virtual bool MayThrow() const { return false; } 5103 virtual bool MayThrow() const { return false; }
5234 5104
5235 private: 5105 private:
5236 const Token::Kind op_kind_; 5106 const Token::Kind op_kind_;
5237 5107
5238 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); 5108 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr);
5239 }; 5109 };
5240 5110
5241 5111
5242 class Simd32x4ShuffleInstr : public TemplateDefinition<1> { 5112 class Simd32x4ShuffleInstr : public TemplateDefinition<1> {
5243 public: 5113 public:
5244 Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, Value* value, 5114 Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, Value* value,
5245 intptr_t mask, 5115 intptr_t mask,
5246 intptr_t deopt_id) 5116 intptr_t deopt_id)
5247 : op_kind_(op_kind), mask_(mask) { 5117 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind), mask_(mask) {
5248 SetInputAt(0, value); 5118 SetInputAt(0, value);
5249 deopt_id_ = deopt_id;
5250 } 5119 }
5251 5120
5252 Value* value() const { return inputs_[0]; } 5121 Value* value() const { return inputs_[0]; }
5253 5122
5254 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5123 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5255 5124
5256 intptr_t mask() const { return mask_; } 5125 intptr_t mask() const { return mask_; }
5257 5126
5258 virtual void PrintOperandsTo(BufferFormatter* f) const; 5127 virtual void PrintOperandsTo(BufferFormatter* f) const;
5259 5128
(...skipping 22 matching lines...) Expand all
5282 (op_kind_ == MethodRecognizer::kFloat32x4Shuffle)) { 5151 (op_kind_ == MethodRecognizer::kFloat32x4Shuffle)) {
5283 return kUnboxedFloat32x4; 5152 return kUnboxedFloat32x4;
5284 } 5153 }
5285 ASSERT((op_kind_ == MethodRecognizer::kInt32x4Shuffle)); 5154 ASSERT((op_kind_ == MethodRecognizer::kInt32x4Shuffle));
5286 return kUnboxedInt32x4; 5155 return kUnboxedInt32x4;
5287 } 5156 }
5288 5157
5289 virtual intptr_t DeoptimizationTarget() const { 5158 virtual intptr_t DeoptimizationTarget() const {
5290 // Direct access since this instruction cannot deoptimize, and the deopt-id 5159 // Direct access since this instruction cannot deoptimize, and the deopt-id
5291 // was inherited from another instruction that could deoptimize. 5160 // was inherited from another instruction that could deoptimize.
5292 return deopt_id_; 5161 return GetDeoptId();
5293 } 5162 }
5294 5163
5295 DECLARE_INSTRUCTION(Simd32x4Shuffle) 5164 DECLARE_INSTRUCTION(Simd32x4Shuffle)
5296 virtual CompileType ComputeType() const; 5165 virtual CompileType ComputeType() const;
5297 5166
5298 virtual bool AllowsCSE() const { return true; } 5167 virtual bool AllowsCSE() const { return true; }
5299 virtual EffectSet Effects() const { return EffectSet::None(); } 5168 virtual EffectSet Effects() const { return EffectSet::None(); }
5300 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5169 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5301 virtual bool AttributesEqual(Instruction* other) const { 5170 virtual bool AttributesEqual(Instruction* other) const {
5302 return (op_kind() == other->AsSimd32x4Shuffle()->op_kind()) && 5171 return (op_kind() == other->AsSimd32x4Shuffle()->op_kind()) &&
5303 (mask() == other->AsSimd32x4Shuffle()->mask()); 5172 (mask() == other->AsSimd32x4Shuffle()->mask());
5304 } 5173 }
5305 5174
5306 virtual bool MayThrow() const { return false; } 5175 virtual bool MayThrow() const { return false; }
5307 5176
5308 private: 5177 private:
5309 const MethodRecognizer::Kind op_kind_; 5178 const MethodRecognizer::Kind op_kind_;
5310 const intptr_t mask_; 5179 const intptr_t mask_;
5311 5180
5312 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr); 5181 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr);
5313 }; 5182 };
5314 5183
5315 5184
5316 class Simd32x4ShuffleMixInstr : public TemplateDefinition<2> { 5185 class Simd32x4ShuffleMixInstr : public TemplateDefinition<2> {
5317 public: 5186 public:
5318 Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, Value* xy, 5187 Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, Value* xy,
5319 Value* zw, intptr_t mask, intptr_t deopt_id) 5188 Value* zw, intptr_t mask, intptr_t deopt_id)
5320 : op_kind_(op_kind), mask_(mask) { 5189 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind), mask_(mask) {
5321 SetInputAt(0, xy); 5190 SetInputAt(0, xy);
5322 SetInputAt(1, zw); 5191 SetInputAt(1, zw);
5323 deopt_id_ = deopt_id;
5324 } 5192 }
5325 5193
5326 Value* xy() const { return inputs_[0]; } 5194 Value* xy() const { return inputs_[0]; }
5327 Value* zw() const { return inputs_[1]; } 5195 Value* zw() const { return inputs_[1]; }
5328 5196
5329 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5197 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5330 5198
5331 intptr_t mask() const { return mask_; } 5199 intptr_t mask() const { return mask_; }
5332 5200
5333 virtual void PrintOperandsTo(BufferFormatter* f) const; 5201 virtual void PrintOperandsTo(BufferFormatter* f) const;
(...skipping 13 matching lines...) Expand all
5347 if (op_kind() == MethodRecognizer::kInt32x4ShuffleMix) { 5215 if (op_kind() == MethodRecognizer::kInt32x4ShuffleMix) {
5348 return kUnboxedInt32x4; 5216 return kUnboxedInt32x4;
5349 } 5217 }
5350 ASSERT(op_kind() == MethodRecognizer::kFloat32x4ShuffleMix); 5218 ASSERT(op_kind() == MethodRecognizer::kFloat32x4ShuffleMix);
5351 return kUnboxedFloat32x4; 5219 return kUnboxedFloat32x4;
5352 } 5220 }
5353 5221
5354 virtual intptr_t DeoptimizationTarget() const { 5222 virtual intptr_t DeoptimizationTarget() const {
5355 // Direct access since this instruction cannot deoptimize, and the deopt-id 5223 // Direct access since this instruction cannot deoptimize, and the deopt-id
5356 // was inherited from another instruction that could deoptimize. 5224 // was inherited from another instruction that could deoptimize.
5357 return deopt_id_; 5225 return GetDeoptId();
5358 } 5226 }
5359 5227
5360 DECLARE_INSTRUCTION(Simd32x4ShuffleMix) 5228 DECLARE_INSTRUCTION(Simd32x4ShuffleMix)
5361 virtual CompileType ComputeType() const; 5229 virtual CompileType ComputeType() const;
5362 5230
5363 virtual bool AllowsCSE() const { return true; } 5231 virtual bool AllowsCSE() const { return true; }
5364 virtual EffectSet Effects() const { return EffectSet::None(); } 5232 virtual EffectSet Effects() const { return EffectSet::None(); }
5365 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5233 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5366 virtual bool AttributesEqual(Instruction* other) const { 5234 virtual bool AttributesEqual(Instruction* other) const {
5367 return (op_kind() == other->AsSimd32x4ShuffleMix()->op_kind()) && 5235 return (op_kind() == other->AsSimd32x4ShuffleMix()->op_kind()) &&
5368 (mask() == other->AsSimd32x4ShuffleMix()->mask()); 5236 (mask() == other->AsSimd32x4ShuffleMix()->mask());
5369 } 5237 }
5370 5238
5371 virtual bool MayThrow() const { return false; } 5239 virtual bool MayThrow() const { return false; }
5372 5240
5373 private: 5241 private:
5374 const MethodRecognizer::Kind op_kind_; 5242 const MethodRecognizer::Kind op_kind_;
5375 const intptr_t mask_; 5243 const intptr_t mask_;
5376 5244
5377 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr); 5245 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr);
5378 }; 5246 };
5379 5247
5380 5248
5381 class Float32x4ConstructorInstr : public TemplateDefinition<4> { 5249 class Float32x4ConstructorInstr : public TemplateDefinition<4> {
5382 public: 5250 public:
5383 Float32x4ConstructorInstr(Value* value0, Value* value1, Value* value2, 5251 Float32x4ConstructorInstr(Value* value0,
5384 Value* value3, intptr_t deopt_id) { 5252 Value* value1,
5253 Value* value2,
5254 Value* value3,
5255 intptr_t deopt_id)
5256 : TemplateDefinition<4>(deopt_id) {
5385 SetInputAt(0, value0); 5257 SetInputAt(0, value0);
5386 SetInputAt(1, value1); 5258 SetInputAt(1, value1);
5387 SetInputAt(2, value2); 5259 SetInputAt(2, value2);
5388 SetInputAt(3, value3); 5260 SetInputAt(3, value3);
5389 deopt_id_ = deopt_id;
5390 } 5261 }
5391 5262
5392 Value* value0() const { return inputs_[0]; } 5263 Value* value0() const { return inputs_[0]; }
5393 Value* value1() const { return inputs_[1]; } 5264 Value* value1() const { return inputs_[1]; }
5394 Value* value2() const { return inputs_[2]; } 5265 Value* value2() const { return inputs_[2]; }
5395 Value* value3() const { return inputs_[3]; } 5266 Value* value3() const { return inputs_[3]; }
5396 5267
5397 virtual void PrintOperandsTo(BufferFormatter* f) const; 5268 virtual void PrintOperandsTo(BufferFormatter* f) const;
5398 5269
5399 virtual bool CanDeoptimize() const { return false; } 5270 virtual bool CanDeoptimize() const { return false; }
5400 5271
5401 virtual Representation representation() const { 5272 virtual Representation representation() const {
5402 return kUnboxedFloat32x4; 5273 return kUnboxedFloat32x4;
5403 } 5274 }
5404 5275
5405 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5276 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5406 ASSERT(idx >= 0 && idx < 4); 5277 ASSERT(idx >= 0 && idx < 4);
5407 return kUnboxedDouble; 5278 return kUnboxedDouble;
5408 } 5279 }
5409 5280
5410 virtual intptr_t DeoptimizationTarget() const { 5281 virtual intptr_t DeoptimizationTarget() const {
5411 // Direct access since this instruction cannot deoptimize, and the deopt-id 5282 // Direct access since this instruction cannot deoptimize, and the deopt-id
5412 // was inherited from another instruction that could deoptimize. 5283 // was inherited from another instruction that could deoptimize.
5413 return deopt_id_; 5284 return GetDeoptId();
5414 } 5285 }
5415 5286
5416 DECLARE_INSTRUCTION(Float32x4Constructor) 5287 DECLARE_INSTRUCTION(Float32x4Constructor)
5417 virtual CompileType ComputeType() const; 5288 virtual CompileType ComputeType() const;
5418 5289
5419 virtual bool AllowsCSE() const { return true; } 5290 virtual bool AllowsCSE() const { return true; }
5420 virtual EffectSet Effects() const { return EffectSet::None(); } 5291 virtual EffectSet Effects() const { return EffectSet::None(); }
5421 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5292 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5422 virtual bool AttributesEqual(Instruction* other) const { return true; } 5293 virtual bool AttributesEqual(Instruction* other) const { return true; }
5423 5294
5424 virtual bool MayThrow() const { return false; } 5295 virtual bool MayThrow() const { return false; }
5425 5296
5426 private: 5297 private:
5427 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr); 5298 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr);
5428 }; 5299 };
5429 5300
5430 5301
5431 class Float32x4SplatInstr : public TemplateDefinition<1> { 5302 class Float32x4SplatInstr : public TemplateDefinition<1> {
5432 public: 5303 public:
5433 Float32x4SplatInstr(Value* value, intptr_t deopt_id) { 5304 Float32x4SplatInstr(Value* value, intptr_t deopt_id)
5305 : TemplateDefinition<1>(deopt_id) {
5434 SetInputAt(0, value); 5306 SetInputAt(0, value);
5435 deopt_id_ = deopt_id;
5436 } 5307 }
5437 5308
5438 Value* value() const { return inputs_[0]; } 5309 Value* value() const { return inputs_[0]; }
5439 5310
5440 virtual void PrintOperandsTo(BufferFormatter* f) const; 5311 virtual void PrintOperandsTo(BufferFormatter* f) const;
5441 5312
5442 virtual bool CanDeoptimize() const { return false; } 5313 virtual bool CanDeoptimize() const { return false; }
5443 5314
5444 virtual Representation representation() const { 5315 virtual Representation representation() const {
5445 return kUnboxedFloat32x4; 5316 return kUnboxedFloat32x4;
5446 } 5317 }
5447 5318
5448 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5319 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5449 ASSERT(idx == 0); 5320 ASSERT(idx == 0);
5450 return kUnboxedDouble; 5321 return kUnboxedDouble;
5451 } 5322 }
5452 5323
5453 virtual intptr_t DeoptimizationTarget() const { 5324 virtual intptr_t DeoptimizationTarget() const {
5454 // Direct access since this instruction cannot deoptimize, and the deopt-id 5325 // Direct access since this instruction cannot deoptimize, and the deopt-id
5455 // was inherited from another instruction that could deoptimize. 5326 // was inherited from another instruction that could deoptimize.
5456 return deopt_id_; 5327 return GetDeoptId();
5457 } 5328 }
5458 5329
5459 DECLARE_INSTRUCTION(Float32x4Splat) 5330 DECLARE_INSTRUCTION(Float32x4Splat)
5460 virtual CompileType ComputeType() const; 5331 virtual CompileType ComputeType() const;
5461 5332
5462 virtual bool AllowsCSE() const { return true; } 5333 virtual bool AllowsCSE() const { return true; }
5463 virtual EffectSet Effects() const { return EffectSet::None(); } 5334 virtual EffectSet Effects() const { return EffectSet::None(); }
5464 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5335 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5465 virtual bool AttributesEqual(Instruction* other) const { return true; } 5336 virtual bool AttributesEqual(Instruction* other) const { return true; }
5466 5337
5467 virtual bool MayThrow() const { return false; } 5338 virtual bool MayThrow() const { return false; }
5468 5339
5469 private: 5340 private:
5470 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr); 5341 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr);
5471 }; 5342 };
5472 5343
5473 5344
5345 // TODO(vegorov) replace with UnboxedConstantInstr.
5474 class Float32x4ZeroInstr : public TemplateDefinition<0> { 5346 class Float32x4ZeroInstr : public TemplateDefinition<0> {
5475 public: 5347 public:
5476 explicit Float32x4ZeroInstr(intptr_t deopt_id) { 5348 Float32x4ZeroInstr() { }
5477 deopt_id_ = deopt_id;
5478 }
5479
5480 Value* value() const { return inputs_[0]; }
5481
5482 virtual void PrintOperandsTo(BufferFormatter* f) const;
5483 5349
5484 virtual bool CanDeoptimize() const { return false; } 5350 virtual bool CanDeoptimize() const { return false; }
5485 5351
5486 virtual Representation representation() const { 5352 virtual Representation representation() const {
5487 return kUnboxedFloat32x4; 5353 return kUnboxedFloat32x4;
5488 } 5354 }
5489 5355
5490 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5491 UNIMPLEMENTED();
5492 return kUnboxedFloat32x4;
5493 }
5494
5495 virtual intptr_t DeoptimizationTarget() const {
5496 // Direct access since this instruction cannot deoptimize, and the deopt-id
5497 // was inherited from another instruction that could deoptimize.
5498 return deopt_id_;
5499 }
5500
5501 DECLARE_INSTRUCTION(Float32x4Zero) 5356 DECLARE_INSTRUCTION(Float32x4Zero)
5502 virtual CompileType ComputeType() const; 5357 virtual CompileType ComputeType() const;
5503 5358
5504 virtual bool AllowsCSE() const { return true; } 5359 virtual bool AllowsCSE() const { return true; }
5505 virtual EffectSet Effects() const { return EffectSet::None(); } 5360 virtual EffectSet Effects() const { return EffectSet::None(); }
5506 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5361 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5507 virtual bool AttributesEqual(Instruction* other) const { return true; } 5362 virtual bool AttributesEqual(Instruction* other) const { return true; }
5508 5363
5509 virtual bool MayThrow() const { return false; } 5364 virtual bool MayThrow() const { return false; }
5510 5365
5511 private: 5366 private:
5512 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); 5367 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr);
5513 }; 5368 };
5514 5369
5515 5370
5516 class Float32x4ComparisonInstr : public TemplateDefinition<2> { 5371 class Float32x4ComparisonInstr : public TemplateDefinition<2> {
5517 public: 5372 public:
5518 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind, Value* left, 5373 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind,
5519 Value* right, intptr_t deopt_id) 5374 Value* left,
5520 : op_kind_(op_kind) { 5375 Value* right,
5376 intptr_t deopt_id)
5377 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
5521 SetInputAt(0, left); 5378 SetInputAt(0, left);
5522 SetInputAt(1, right); 5379 SetInputAt(1, right);
5523 deopt_id_ = deopt_id;
5524 } 5380 }
5525 5381
5526 Value* left() const { return inputs_[0]; } 5382 Value* left() const { return inputs_[0]; }
5527 Value* right() const { return inputs_[1]; } 5383 Value* right() const { return inputs_[1]; }
5528 5384
5529 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5385 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5530 5386
5531 virtual void PrintOperandsTo(BufferFormatter* f) const; 5387 virtual void PrintOperandsTo(BufferFormatter* f) const;
5532 5388
5533 virtual bool CanDeoptimize() const { return false; } 5389 virtual bool CanDeoptimize() const { return false; }
5534 5390
5535 virtual Representation representation() const { 5391 virtual Representation representation() const {
5536 return kUnboxedInt32x4; 5392 return kUnboxedInt32x4;
5537 } 5393 }
5538 5394
5539 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5395 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5540 ASSERT((idx == 0) || (idx == 1)); 5396 ASSERT((idx == 0) || (idx == 1));
5541 return kUnboxedFloat32x4; 5397 return kUnboxedFloat32x4;
5542 } 5398 }
5543 5399
5544 virtual intptr_t DeoptimizationTarget() const { 5400 virtual intptr_t DeoptimizationTarget() const {
5545 // Direct access since this instruction cannot deoptimize, and the deopt-id 5401 // Direct access since this instruction cannot deoptimize, and the deopt-id
5546 // was inherited from another instruction that could deoptimize. 5402 // was inherited from another instruction that could deoptimize.
5547 return deopt_id_; 5403 return GetDeoptId();
5548 } 5404 }
5549 5405
5550 DECLARE_INSTRUCTION(Float32x4Comparison) 5406 DECLARE_INSTRUCTION(Float32x4Comparison)
5551 virtual CompileType ComputeType() const; 5407 virtual CompileType ComputeType() const;
5552 5408
5553 virtual bool AllowsCSE() const { return true; } 5409 virtual bool AllowsCSE() const { return true; }
5554 virtual EffectSet Effects() const { return EffectSet::None(); } 5410 virtual EffectSet Effects() const { return EffectSet::None(); }
5555 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5411 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5556 virtual bool AttributesEqual(Instruction* other) const { 5412 virtual bool AttributesEqual(Instruction* other) const {
5557 return op_kind() == other->AsFloat32x4Comparison()->op_kind(); 5413 return op_kind() == other->AsFloat32x4Comparison()->op_kind();
5558 } 5414 }
5559 5415
5560 virtual bool MayThrow() const { return false; } 5416 virtual bool MayThrow() const { return false; }
5561 5417
5562 private: 5418 private:
5563 const MethodRecognizer::Kind op_kind_; 5419 const MethodRecognizer::Kind op_kind_;
5564 5420
5565 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr); 5421 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr);
5566 }; 5422 };
5567 5423
5568 5424
5569 class Float32x4MinMaxInstr : public TemplateDefinition<2> { 5425 class Float32x4MinMaxInstr : public TemplateDefinition<2> {
5570 public: 5426 public:
5571 Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind, Value* left, 5427 Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind,
5572 Value* right, intptr_t deopt_id) 5428 Value* left,
5573 : op_kind_(op_kind) { 5429 Value* right,
5430 intptr_t deopt_id)
5431 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
5574 SetInputAt(0, left); 5432 SetInputAt(0, left);
5575 SetInputAt(1, right); 5433 SetInputAt(1, right);
5576 deopt_id_ = deopt_id;
5577 } 5434 }
5578 5435
5579 Value* left() const { return inputs_[0]; } 5436 Value* left() const { return inputs_[0]; }
5580 Value* right() const { return inputs_[1]; } 5437 Value* right() const { return inputs_[1]; }
5581 5438
5582 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5439 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5583 5440
5584 virtual void PrintOperandsTo(BufferFormatter* f) const; 5441 virtual void PrintOperandsTo(BufferFormatter* f) const;
5585 5442
5586 virtual bool CanDeoptimize() const { return false; } 5443 virtual bool CanDeoptimize() const { return false; }
5587 5444
5588 virtual Representation representation() const { 5445 virtual Representation representation() const {
5589 return kUnboxedFloat32x4; 5446 return kUnboxedFloat32x4;
5590 } 5447 }
5591 5448
5592 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5449 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5593 ASSERT((idx == 0) || (idx == 1)); 5450 ASSERT((idx == 0) || (idx == 1));
5594 return kUnboxedFloat32x4; 5451 return kUnboxedFloat32x4;
5595 } 5452 }
5596 5453
5597 virtual intptr_t DeoptimizationTarget() const { 5454 virtual intptr_t DeoptimizationTarget() const {
5598 // Direct access since this instruction cannot deoptimize, and the deopt-id 5455 // Direct access since this instruction cannot deoptimize, and the deopt-id
5599 // was inherited from another instruction that could deoptimize. 5456 // was inherited from another instruction that could deoptimize.
5600 return deopt_id_; 5457 return GetDeoptId();
5601 } 5458 }
5602 5459
5603 DECLARE_INSTRUCTION(Float32x4MinMax) 5460 DECLARE_INSTRUCTION(Float32x4MinMax)
5604 virtual CompileType ComputeType() const; 5461 virtual CompileType ComputeType() const;
5605 5462
5606 virtual bool AllowsCSE() const { return true; } 5463 virtual bool AllowsCSE() const { return true; }
5607 virtual EffectSet Effects() const { return EffectSet::None(); } 5464 virtual EffectSet Effects() const { return EffectSet::None(); }
5608 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5465 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5609 virtual bool AttributesEqual(Instruction* other) const { 5466 virtual bool AttributesEqual(Instruction* other) const {
5610 return op_kind() == other->AsFloat32x4MinMax()->op_kind(); 5467 return op_kind() == other->AsFloat32x4MinMax()->op_kind();
5611 } 5468 }
5612 5469
5613 virtual bool MayThrow() const { return false; } 5470 virtual bool MayThrow() const { return false; }
5614 5471
5615 private: 5472 private:
5616 const MethodRecognizer::Kind op_kind_; 5473 const MethodRecognizer::Kind op_kind_;
5617 5474
5618 DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr); 5475 DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr);
5619 }; 5476 };
5620 5477
5621 5478
5622 class Float32x4ScaleInstr : public TemplateDefinition<2> { 5479 class Float32x4ScaleInstr : public TemplateDefinition<2> {
5623 public: 5480 public:
5624 Float32x4ScaleInstr(MethodRecognizer::Kind op_kind, Value* left, 5481 Float32x4ScaleInstr(MethodRecognizer::Kind op_kind,
5625 Value* right, intptr_t deopt_id) 5482 Value* left,
5626 : op_kind_(op_kind) { 5483 Value* right,
5484 intptr_t deopt_id)
5485 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
5627 SetInputAt(0, left); 5486 SetInputAt(0, left);
5628 SetInputAt(1, right); 5487 SetInputAt(1, right);
5629 deopt_id_ = deopt_id;
5630 } 5488 }
5631 5489
5632 Value* left() const { return inputs_[0]; } 5490 Value* left() const { return inputs_[0]; }
5633 Value* right() const { return inputs_[1]; } 5491 Value* right() const { return inputs_[1]; }
5634 5492
5635 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5493 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5636 5494
5637 virtual void PrintOperandsTo(BufferFormatter* f) const; 5495 virtual void PrintOperandsTo(BufferFormatter* f) const;
5638 5496
5639 virtual bool CanDeoptimize() const { return false; } 5497 virtual bool CanDeoptimize() const { return false; }
5640 5498
5641 virtual Representation representation() const { 5499 virtual Representation representation() const {
5642 return kUnboxedFloat32x4; 5500 return kUnboxedFloat32x4;
5643 } 5501 }
5644 5502
5645 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5503 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5646 ASSERT((idx == 0) || (idx == 1)); 5504 ASSERT((idx == 0) || (idx == 1));
5647 if (idx == 0) { 5505 if (idx == 0) {
5648 return kUnboxedDouble; 5506 return kUnboxedDouble;
5649 } 5507 }
5650 return kUnboxedFloat32x4; 5508 return kUnboxedFloat32x4;
5651 } 5509 }
5652 5510
5653 virtual intptr_t DeoptimizationTarget() const { 5511 virtual intptr_t DeoptimizationTarget() const {
5654 // Direct access since this instruction cannot deoptimize, and the deopt-id 5512 // Direct access since this instruction cannot deoptimize, and the deopt-id
5655 // was inherited from another instruction that could deoptimize. 5513 // was inherited from another instruction that could deoptimize.
5656 return deopt_id_; 5514 return GetDeoptId();
5657 } 5515 }
5658 5516
5659 DECLARE_INSTRUCTION(Float32x4Scale) 5517 DECLARE_INSTRUCTION(Float32x4Scale)
5660 virtual CompileType ComputeType() const; 5518 virtual CompileType ComputeType() const;
5661 5519
5662 virtual bool AllowsCSE() const { return true; } 5520 virtual bool AllowsCSE() const { return true; }
5663 virtual EffectSet Effects() const { return EffectSet::None(); } 5521 virtual EffectSet Effects() const { return EffectSet::None(); }
5664 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5522 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5665 virtual bool AttributesEqual(Instruction* other) const { 5523 virtual bool AttributesEqual(Instruction* other) const {
5666 return op_kind() == other->AsFloat32x4Scale()->op_kind(); 5524 return op_kind() == other->AsFloat32x4Scale()->op_kind();
5667 } 5525 }
5668 5526
5669 virtual bool MayThrow() const { return false; } 5527 virtual bool MayThrow() const { return false; }
5670 5528
5671 private: 5529 private:
5672 const MethodRecognizer::Kind op_kind_; 5530 const MethodRecognizer::Kind op_kind_;
5673 5531
5674 DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr); 5532 DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr);
5675 }; 5533 };
5676 5534
5677 5535
5678 class Float32x4SqrtInstr : public TemplateDefinition<1> { 5536 class Float32x4SqrtInstr : public TemplateDefinition<1> {
5679 public: 5537 public:
5680 Float32x4SqrtInstr(MethodRecognizer::Kind op_kind, Value* left, 5538 Float32x4SqrtInstr(MethodRecognizer::Kind op_kind,
5681 intptr_t deopt_id) : op_kind_(op_kind) { 5539 Value* left,
5540 intptr_t deopt_id)
5541 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) {
5682 SetInputAt(0, left); 5542 SetInputAt(0, left);
5683 deopt_id_ = deopt_id;
5684 } 5543 }
5685 5544
5686 Value* left() const { return inputs_[0]; } 5545 Value* left() const { return inputs_[0]; }
5687 5546
5688 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5547 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5689 5548
5690 virtual void PrintOperandsTo(BufferFormatter* f) const; 5549 virtual void PrintOperandsTo(BufferFormatter* f) const;
5691 5550
5692 virtual bool CanDeoptimize() const { return false; } 5551 virtual bool CanDeoptimize() const { return false; }
5693 5552
5694 virtual Representation representation() const { 5553 virtual Representation representation() const {
5695 return kUnboxedFloat32x4; 5554 return kUnboxedFloat32x4;
5696 } 5555 }
5697 5556
5698 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5557 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5699 ASSERT(idx == 0); 5558 ASSERT(idx == 0);
5700 return kUnboxedFloat32x4; 5559 return kUnboxedFloat32x4;
5701 } 5560 }
5702 5561
5703 virtual intptr_t DeoptimizationTarget() const { 5562 virtual intptr_t DeoptimizationTarget() const {
5704 // Direct access since this instruction cannot deoptimize, and the deopt-id 5563 // Direct access since this instruction cannot deoptimize, and the deopt-id
5705 // was inherited from another instruction that could deoptimize. 5564 // was inherited from another instruction that could deoptimize.
5706 return deopt_id_; 5565 return GetDeoptId();
5707 } 5566 }
5708 5567
5709 DECLARE_INSTRUCTION(Float32x4Sqrt) 5568 DECLARE_INSTRUCTION(Float32x4Sqrt)
5710 virtual CompileType ComputeType() const; 5569 virtual CompileType ComputeType() const;
5711 5570
5712 virtual bool AllowsCSE() const { return true; } 5571 virtual bool AllowsCSE() const { return true; }
5713 virtual EffectSet Effects() const { return EffectSet::None(); } 5572 virtual EffectSet Effects() const { return EffectSet::None(); }
5714 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5573 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5715 virtual bool AttributesEqual(Instruction* other) const { 5574 virtual bool AttributesEqual(Instruction* other) const {
5716 return op_kind() == other->AsFloat32x4Sqrt()->op_kind(); 5575 return op_kind() == other->AsFloat32x4Sqrt()->op_kind();
5717 } 5576 }
5718 5577
5719 virtual bool MayThrow() const { return false; } 5578 virtual bool MayThrow() const { return false; }
5720 5579
5721 private: 5580 private:
5722 const MethodRecognizer::Kind op_kind_; 5581 const MethodRecognizer::Kind op_kind_;
5723 5582
5724 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr); 5583 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr);
5725 }; 5584 };
5726 5585
5727 5586
5587 // TODO(vegorov) rename to Unary to match naming convention for arithmetic.
5728 class Float32x4ZeroArgInstr : public TemplateDefinition<1> { 5588 class Float32x4ZeroArgInstr : public TemplateDefinition<1> {
5729 public: 5589 public:
5730 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind, Value* left, 5590 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind,
5731 intptr_t deopt_id) : op_kind_(op_kind) { 5591 Value* left,
5592 intptr_t deopt_id)
5593 : TemplateDefinition<1>(deopt_id),
5594 op_kind_(op_kind) {
5732 SetInputAt(0, left); 5595 SetInputAt(0, left);
5733 deopt_id_ = deopt_id;
5734 } 5596 }
5735 5597
5736 Value* left() const { return inputs_[0]; } 5598 Value* left() const { return inputs_[0]; }
5737 5599
5738 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5600 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5739 5601
5740 virtual void PrintOperandsTo(BufferFormatter* f) const; 5602 virtual void PrintOperandsTo(BufferFormatter* f) const;
5741 5603
5742 virtual bool CanDeoptimize() const { return false; } 5604 virtual bool CanDeoptimize() const { return false; }
5743 5605
5744 virtual Representation representation() const { 5606 virtual Representation representation() const {
5745 return kUnboxedFloat32x4; 5607 return kUnboxedFloat32x4;
5746 } 5608 }
5747 5609
5748 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5610 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5749 ASSERT(idx == 0); 5611 ASSERT(idx == 0);
5750 return kUnboxedFloat32x4; 5612 return kUnboxedFloat32x4;
5751 } 5613 }
5752 5614
5753 virtual intptr_t DeoptimizationTarget() const { 5615 virtual intptr_t DeoptimizationTarget() const {
5754 // Direct access since this instruction cannot deoptimize, and the deopt-id 5616 // Direct access since this instruction cannot deoptimize, and the deopt-id
5755 // was inherited from another instruction that could deoptimize. 5617 // was inherited from another instruction that could deoptimize.
5756 return deopt_id_; 5618 return GetDeoptId();
5757 } 5619 }
5758 5620
5759 DECLARE_INSTRUCTION(Float32x4ZeroArg) 5621 DECLARE_INSTRUCTION(Float32x4ZeroArg)
5760 virtual CompileType ComputeType() const; 5622 virtual CompileType ComputeType() const;
5761 5623
5762 virtual bool AllowsCSE() const { return true; } 5624 virtual bool AllowsCSE() const { return true; }
5763 virtual EffectSet Effects() const { return EffectSet::None(); } 5625 virtual EffectSet Effects() const { return EffectSet::None(); }
5764 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5626 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5765 virtual bool AttributesEqual(Instruction* other) const { 5627 virtual bool AttributesEqual(Instruction* other) const {
5766 return op_kind() == other->AsFloat32x4ZeroArg()->op_kind(); 5628 return op_kind() == other->AsFloat32x4ZeroArg()->op_kind();
5767 } 5629 }
5768 5630
5769 virtual bool MayThrow() const { return false; } 5631 virtual bool MayThrow() const { return false; }
5770 5632
5771 private: 5633 private:
5772 const MethodRecognizer::Kind op_kind_; 5634 const MethodRecognizer::Kind op_kind_;
5773 5635
5774 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr); 5636 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr);
5775 }; 5637 };
5776 5638
5777 5639
5778 class Float32x4ClampInstr : public TemplateDefinition<3> { 5640 class Float32x4ClampInstr : public TemplateDefinition<3> {
5779 public: 5641 public:
5780 Float32x4ClampInstr(Value* left, Value* lower, Value* upper, 5642 Float32x4ClampInstr(Value* left,
5781 intptr_t deopt_id) { 5643 Value* lower,
5644 Value* upper,
5645 intptr_t deopt_id)
5646 : TemplateDefinition<3>(deopt_id) {
5782 SetInputAt(0, left); 5647 SetInputAt(0, left);
5783 SetInputAt(1, lower); 5648 SetInputAt(1, lower);
5784 SetInputAt(2, upper); 5649 SetInputAt(2, upper);
5785 deopt_id_ = deopt_id;
5786 } 5650 }
5787 5651
5788 Value* left() const { return inputs_[0]; } 5652 Value* left() const { return inputs_[0]; }
5789 Value* lower() const { return inputs_[1]; } 5653 Value* lower() const { return inputs_[1]; }
5790 Value* upper() const { return inputs_[2]; } 5654 Value* upper() const { return inputs_[2]; }
5791 5655
5792 virtual void PrintOperandsTo(BufferFormatter* f) const; 5656 virtual void PrintOperandsTo(BufferFormatter* f) const;
5793 5657
5794 virtual bool CanDeoptimize() const { return false; } 5658 virtual bool CanDeoptimize() const { return false; }
5795 5659
5796 virtual Representation representation() const { 5660 virtual Representation representation() const {
5797 return kUnboxedFloat32x4; 5661 return kUnboxedFloat32x4;
5798 } 5662 }
5799 5663
5800 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5664 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5801 ASSERT((idx == 0) || (idx == 1) || (idx == 2)); 5665 ASSERT((idx == 0) || (idx == 1) || (idx == 2));
5802 return kUnboxedFloat32x4; 5666 return kUnboxedFloat32x4;
5803 } 5667 }
5804 5668
5805 virtual intptr_t DeoptimizationTarget() const { 5669 virtual intptr_t DeoptimizationTarget() const {
5806 // Direct access since this instruction cannot deoptimize, and the deopt-id 5670 // Direct access since this instruction cannot deoptimize, and the deopt-id
5807 // was inherited from another instruction that could deoptimize. 5671 // was inherited from another instruction that could deoptimize.
5808 return deopt_id_; 5672 return GetDeoptId();
5809 } 5673 }
5810 5674
5811 DECLARE_INSTRUCTION(Float32x4Clamp) 5675 DECLARE_INSTRUCTION(Float32x4Clamp)
5812 virtual CompileType ComputeType() const; 5676 virtual CompileType ComputeType() const;
5813 5677
5814 virtual bool AllowsCSE() const { return true; } 5678 virtual bool AllowsCSE() const { return true; }
5815 virtual EffectSet Effects() const { return EffectSet::None(); } 5679 virtual EffectSet Effects() const { return EffectSet::None(); }
5816 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5680 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5817 virtual bool AttributesEqual(Instruction* other) const { return true; } 5681 virtual bool AttributesEqual(Instruction* other) const { return true; }
5818 5682
5819 virtual bool MayThrow() const { return false; } 5683 virtual bool MayThrow() const { return false; }
5820 5684
5821 private: 5685 private:
5822 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr); 5686 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr);
5823 }; 5687 };
5824 5688
5825 5689
5826 class Float32x4WithInstr : public TemplateDefinition<2> { 5690 class Float32x4WithInstr : public TemplateDefinition<2> {
5827 public: 5691 public:
5828 Float32x4WithInstr(MethodRecognizer::Kind op_kind, Value* left, 5692 Float32x4WithInstr(MethodRecognizer::Kind op_kind,
5829 Value* replacement, intptr_t deopt_id) 5693 Value* left,
5830 : op_kind_(op_kind) { 5694 Value* replacement,
5695 intptr_t deopt_id)
5696 : TemplateDefinition<2>(deopt_id),
5697 op_kind_(op_kind) {
5831 SetInputAt(0, replacement); 5698 SetInputAt(0, replacement);
5832 SetInputAt(1, left); 5699 SetInputAt(1, left);
5833 deopt_id_ = deopt_id;
5834 } 5700 }
5835 5701
5836 Value* left() const { return inputs_[1]; } 5702 Value* left() const { return inputs_[1]; }
5837 Value* replacement() const { return inputs_[0]; } 5703 Value* replacement() const { return inputs_[0]; }
5838 5704
5839 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5705 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5840 5706
5841 virtual void PrintOperandsTo(BufferFormatter* f) const; 5707 virtual void PrintOperandsTo(BufferFormatter* f) const;
5842 5708
5843 virtual bool CanDeoptimize() const { return false; } 5709 virtual bool CanDeoptimize() const { return false; }
5844 5710
5845 virtual Representation representation() const { 5711 virtual Representation representation() const {
5846 return kUnboxedFloat32x4; 5712 return kUnboxedFloat32x4;
5847 } 5713 }
5848 5714
5849 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5715 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5850 ASSERT((idx == 0) || (idx == 1)); 5716 ASSERT((idx == 0) || (idx == 1));
5851 if (idx == 0) { 5717 if (idx == 0) {
5852 return kUnboxedDouble; 5718 return kUnboxedDouble;
5853 } 5719 }
5854 return kUnboxedFloat32x4; 5720 return kUnboxedFloat32x4;
5855 } 5721 }
5856 5722
5857 virtual intptr_t DeoptimizationTarget() const { 5723 virtual intptr_t DeoptimizationTarget() const {
5858 // Direct access since this instruction cannot deoptimize, and the deopt-id 5724 // Direct access since this instruction cannot deoptimize, and the deopt-id
5859 // was inherited from another instruction that could deoptimize. 5725 // was inherited from another instruction that could deoptimize.
5860 return deopt_id_; 5726 return GetDeoptId();
5861 } 5727 }
5862 5728
5863 DECLARE_INSTRUCTION(Float32x4With) 5729 DECLARE_INSTRUCTION(Float32x4With)
5864 virtual CompileType ComputeType() const; 5730 virtual CompileType ComputeType() const;
5865 5731
5866 virtual bool AllowsCSE() const { return true; } 5732 virtual bool AllowsCSE() const { return true; }
5867 virtual EffectSet Effects() const { return EffectSet::None(); } 5733 virtual EffectSet Effects() const { return EffectSet::None(); }
5868 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5734 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5869 virtual bool AttributesEqual(Instruction* other) const { 5735 virtual bool AttributesEqual(Instruction* other) const {
5870 return op_kind() == other->AsFloat32x4With()->op_kind(); 5736 return op_kind() == other->AsFloat32x4With()->op_kind();
5871 } 5737 }
5872 5738
5873 virtual bool MayThrow() const { return false; } 5739 virtual bool MayThrow() const { return false; }
5874 5740
5875 private: 5741 private:
5876 const MethodRecognizer::Kind op_kind_; 5742 const MethodRecognizer::Kind op_kind_;
5877 5743
5878 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr); 5744 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr);
5879 }; 5745 };
5880 5746
5881 5747
5882 class Simd64x2ShuffleInstr : public TemplateDefinition<1> { 5748 class Simd64x2ShuffleInstr : public TemplateDefinition<1> {
5883 public: 5749 public:
5884 Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind, Value* value, 5750 Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind,
5751 Value* value,
5885 intptr_t mask, 5752 intptr_t mask,
5886 intptr_t deopt_id) 5753 intptr_t deopt_id)
5887 : op_kind_(op_kind), mask_(mask) { 5754 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind), mask_(mask) {
5888 SetInputAt(0, value); 5755 SetInputAt(0, value);
5889 deopt_id_ = deopt_id;
5890 } 5756 }
5891 5757
5892 Value* value() const { return inputs_[0]; } 5758 Value* value() const { return inputs_[0]; }
5893 5759
5894 MethodRecognizer::Kind op_kind() const { return op_kind_; } 5760 MethodRecognizer::Kind op_kind() const { return op_kind_; }
5895 5761
5896 intptr_t mask() const { return mask_; } 5762 intptr_t mask() const { return mask_; }
5897 5763
5898 virtual void PrintOperandsTo(BufferFormatter* f) const; 5764 virtual void PrintOperandsTo(BufferFormatter* f) const;
5899 5765
(...skipping 14 matching lines...) Expand all
5914 (op_kind_ == MethodRecognizer::kFloat64x2GetY)) { 5780 (op_kind_ == MethodRecognizer::kFloat64x2GetY)) {
5915 return kUnboxedFloat64x2; 5781 return kUnboxedFloat64x2;
5916 } 5782 }
5917 UNIMPLEMENTED(); 5783 UNIMPLEMENTED();
5918 return kUnboxedFloat64x2; 5784 return kUnboxedFloat64x2;
5919 } 5785 }
5920 5786
5921 virtual intptr_t DeoptimizationTarget() const { 5787 virtual intptr_t DeoptimizationTarget() const {
5922 // Direct access since this instruction cannot deoptimize, and the deopt-id 5788 // Direct access since this instruction cannot deoptimize, and the deopt-id
5923 // was inherited from another instruction that could deoptimize. 5789 // was inherited from another instruction that could deoptimize.
5924 return deopt_id_; 5790 return GetDeoptId();
5925 } 5791 }
5926 5792
5927 DECLARE_INSTRUCTION(Simd64x2Shuffle) 5793 DECLARE_INSTRUCTION(Simd64x2Shuffle)
5928 virtual CompileType ComputeType() const; 5794 virtual CompileType ComputeType() const;
5929 5795
5930 virtual bool AllowsCSE() const { return true; } 5796 virtual bool AllowsCSE() const { return true; }
5931 virtual EffectSet Effects() const { return EffectSet::None(); } 5797 virtual EffectSet Effects() const { return EffectSet::None(); }
5932 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5798 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5933 virtual bool AttributesEqual(Instruction* other) const { 5799 virtual bool AttributesEqual(Instruction* other) const {
5934 return (op_kind() == other->AsSimd64x2Shuffle()->op_kind()) && 5800 return (op_kind() == other->AsSimd64x2Shuffle()->op_kind()) &&
5935 (mask() == other->AsSimd64x2Shuffle()->mask()); 5801 (mask() == other->AsSimd64x2Shuffle()->mask());
5936 } 5802 }
5937 5803
5938 virtual bool MayThrow() const { return false; } 5804 virtual bool MayThrow() const { return false; }
5939 5805
5940 private: 5806 private:
5941 const MethodRecognizer::Kind op_kind_; 5807 const MethodRecognizer::Kind op_kind_;
5942 const intptr_t mask_; 5808 const intptr_t mask_;
5943 5809
5944 DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr); 5810 DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr);
5945 }; 5811 };
5946 5812
5947 5813
5948 class Float32x4ToInt32x4Instr : public TemplateDefinition<1> { 5814 class Float32x4ToInt32x4Instr : public TemplateDefinition<1> {
5949 public: 5815 public:
5950 Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id) { 5816 Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id)
5817 : TemplateDefinition<1>(deopt_id) {
5951 SetInputAt(0, left); 5818 SetInputAt(0, left);
5952 deopt_id_ = deopt_id;
5953 } 5819 }
5954 5820
5955 Value* left() const { return inputs_[0]; } 5821 Value* left() const { return inputs_[0]; }
5956 5822
5957 virtual void PrintOperandsTo(BufferFormatter* f) const; 5823 virtual void PrintOperandsTo(BufferFormatter* f) const;
5958 5824
5959 virtual bool CanDeoptimize() const { return false; } 5825 virtual bool CanDeoptimize() const { return false; }
5960 5826
5961 virtual Representation representation() const { 5827 virtual Representation representation() const {
5962 return kUnboxedInt32x4; 5828 return kUnboxedInt32x4;
5963 } 5829 }
5964 5830
5965 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5831 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
5966 ASSERT(idx == 0); 5832 ASSERT(idx == 0);
5967 return kUnboxedFloat32x4; 5833 return kUnboxedFloat32x4;
5968 } 5834 }
5969 5835
5970 virtual intptr_t DeoptimizationTarget() const { 5836 virtual intptr_t DeoptimizationTarget() const {
5971 // Direct access since this instruction cannot deoptimize, and the deopt-id 5837 // Direct access since this instruction cannot deoptimize, and the deopt-id
5972 // was inherited from another instruction that could deoptimize. 5838 // was inherited from another instruction that could deoptimize.
5973 return deopt_id_; 5839 return GetDeoptId();
5974 } 5840 }
5975 5841
5976 DECLARE_INSTRUCTION(Float32x4ToInt32x4) 5842 DECLARE_INSTRUCTION(Float32x4ToInt32x4)
5977 virtual CompileType ComputeType() const; 5843 virtual CompileType ComputeType() const;
5978 5844
5979 virtual bool AllowsCSE() const { return true; } 5845 virtual bool AllowsCSE() const { return true; }
5980 virtual EffectSet Effects() const { return EffectSet::None(); } 5846 virtual EffectSet Effects() const { return EffectSet::None(); }
5981 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5847 virtual EffectSet Dependencies() const { return EffectSet::None(); }
5982 virtual bool AttributesEqual(Instruction* other) const { return true; } 5848 virtual bool AttributesEqual(Instruction* other) const { return true; }
5983 5849
5984 virtual bool MayThrow() const { return false; } 5850 virtual bool MayThrow() const { return false; }
5985 5851
5986 private: 5852 private:
5987 DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr); 5853 DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr);
5988 }; 5854 };
5989 5855
5990 5856
5991 class Float32x4ToFloat64x2Instr : public TemplateDefinition<1> { 5857 class Float32x4ToFloat64x2Instr : public TemplateDefinition<1> {
5992 public: 5858 public:
5993 Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id) { 5859 Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id)
5860 : TemplateDefinition<1>(deopt_id) {
5994 SetInputAt(0, left); 5861 SetInputAt(0, left);
5995 deopt_id_ = deopt_id;
5996 } 5862 }
5997 5863
5998 Value* left() const { return inputs_[0]; } 5864 Value* left() const { return inputs_[0]; }
5999 5865
6000 virtual void PrintOperandsTo(BufferFormatter* f) const; 5866 virtual void PrintOperandsTo(BufferFormatter* f) const;
6001 5867
6002 virtual bool CanDeoptimize() const { return false; } 5868 virtual bool CanDeoptimize() const { return false; }
6003 5869
6004 virtual Representation representation() const { 5870 virtual Representation representation() const {
6005 return kUnboxedFloat64x2; 5871 return kUnboxedFloat64x2;
6006 } 5872 }
6007 5873
6008 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5874 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6009 ASSERT(idx == 0); 5875 ASSERT(idx == 0);
6010 return kUnboxedFloat32x4; 5876 return kUnboxedFloat32x4;
6011 } 5877 }
6012 5878
6013 virtual intptr_t DeoptimizationTarget() const { 5879 virtual intptr_t DeoptimizationTarget() const {
6014 // Direct access since this instruction cannot deoptimize, and the deopt-id 5880 // Direct access since this instruction cannot deoptimize, and the deopt-id
6015 // was inherited from another instruction that could deoptimize. 5881 // was inherited from another instruction that could deoptimize.
6016 return deopt_id_; 5882 return GetDeoptId();
6017 } 5883 }
6018 5884
6019 DECLARE_INSTRUCTION(Float32x4ToFloat64x2) 5885 DECLARE_INSTRUCTION(Float32x4ToFloat64x2)
6020 virtual CompileType ComputeType() const; 5886 virtual CompileType ComputeType() const;
6021 5887
6022 virtual bool AllowsCSE() const { return true; } 5888 virtual bool AllowsCSE() const { return true; }
6023 virtual EffectSet Effects() const { return EffectSet::None(); } 5889 virtual EffectSet Effects() const { return EffectSet::None(); }
6024 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5890 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6025 virtual bool AttributesEqual(Instruction* other) const { return true; } 5891 virtual bool AttributesEqual(Instruction* other) const { return true; }
6026 5892
6027 virtual bool MayThrow() const { return false; } 5893 virtual bool MayThrow() const { return false; }
6028 5894
6029 private: 5895 private:
6030 DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr); 5896 DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr);
6031 }; 5897 };
6032 5898
6033 5899
6034 class Float64x2ToFloat32x4Instr : public TemplateDefinition<1> { 5900 class Float64x2ToFloat32x4Instr : public TemplateDefinition<1> {
6035 public: 5901 public:
6036 Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id) { 5902 Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id)
5903 : TemplateDefinition<1>(deopt_id) {
6037 SetInputAt(0, left); 5904 SetInputAt(0, left);
6038 deopt_id_ = deopt_id;
6039 } 5905 }
6040 5906
6041 Value* left() const { return inputs_[0]; } 5907 Value* left() const { return inputs_[0]; }
6042 5908
6043 virtual void PrintOperandsTo(BufferFormatter* f) const; 5909 virtual void PrintOperandsTo(BufferFormatter* f) const;
6044 5910
6045 virtual bool CanDeoptimize() const { return false; } 5911 virtual bool CanDeoptimize() const { return false; }
6046 5912
6047 virtual Representation representation() const { 5913 virtual Representation representation() const {
6048 return kUnboxedFloat32x4; 5914 return kUnboxedFloat32x4;
6049 } 5915 }
6050 5916
6051 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5917 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6052 ASSERT(idx == 0); 5918 ASSERT(idx == 0);
6053 return kUnboxedFloat64x2; 5919 return kUnboxedFloat64x2;
6054 } 5920 }
6055 5921
6056 virtual intptr_t DeoptimizationTarget() const { 5922 virtual intptr_t DeoptimizationTarget() const {
6057 // Direct access since this instruction cannot deoptimize, and the deopt-id 5923 // Direct access since this instruction cannot deoptimize, and the deopt-id
6058 // was inherited from another instruction that could deoptimize. 5924 // was inherited from another instruction that could deoptimize.
6059 return deopt_id_; 5925 return GetDeoptId();
6060 } 5926 }
6061 5927
6062 DECLARE_INSTRUCTION(Float64x2ToFloat32x4) 5928 DECLARE_INSTRUCTION(Float64x2ToFloat32x4)
6063 virtual CompileType ComputeType() const; 5929 virtual CompileType ComputeType() const;
6064 5930
6065 virtual bool AllowsCSE() const { return true; } 5931 virtual bool AllowsCSE() const { return true; }
6066 virtual EffectSet Effects() const { return EffectSet::None(); } 5932 virtual EffectSet Effects() const { return EffectSet::None(); }
6067 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5933 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6068 virtual bool AttributesEqual(Instruction* other) const { return true; } 5934 virtual bool AttributesEqual(Instruction* other) const { return true; }
6069 5935
6070 virtual bool MayThrow() const { return false; } 5936 virtual bool MayThrow() const { return false; }
6071 5937
6072 private: 5938 private:
6073 DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr); 5939 DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr);
6074 }; 5940 };
6075 5941
6076 5942
6077 class Float64x2ConstructorInstr : public TemplateDefinition<2> { 5943 class Float64x2ConstructorInstr : public TemplateDefinition<2> {
6078 public: 5944 public:
6079 Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id) { 5945 Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id)
5946 : TemplateDefinition<2>(deopt_id) {
6080 SetInputAt(0, value0); 5947 SetInputAt(0, value0);
6081 SetInputAt(1, value1); 5948 SetInputAt(1, value1);
6082 deopt_id_ = deopt_id;
6083 } 5949 }
6084 5950
6085 Value* value0() const { return inputs_[0]; } 5951 Value* value0() const { return inputs_[0]; }
6086 Value* value1() const { return inputs_[1]; } 5952 Value* value1() const { return inputs_[1]; }
6087 5953
6088 virtual void PrintOperandsTo(BufferFormatter* f) const; 5954 virtual void PrintOperandsTo(BufferFormatter* f) const;
6089 5955
6090 virtual bool CanDeoptimize() const { return false; } 5956 virtual bool CanDeoptimize() const { return false; }
6091 5957
6092 virtual Representation representation() const { 5958 virtual Representation representation() const {
6093 return kUnboxedFloat64x2; 5959 return kUnboxedFloat64x2;
6094 } 5960 }
6095 5961
6096 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 5962 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6097 ASSERT(idx >= 0 && idx < 2); 5963 ASSERT(idx >= 0 && idx < 2);
6098 return kUnboxedDouble; 5964 return kUnboxedDouble;
6099 } 5965 }
6100 5966
6101 virtual intptr_t DeoptimizationTarget() const { 5967 virtual intptr_t DeoptimizationTarget() const {
6102 // Direct access since this instruction cannot deoptimize, and the deopt-id 5968 // Direct access since this instruction cannot deoptimize, and the deopt-id
6103 // was inherited from another instruction that could deoptimize. 5969 // was inherited from another instruction that could deoptimize.
6104 return deopt_id_; 5970 return GetDeoptId();
6105 } 5971 }
6106 5972
6107 DECLARE_INSTRUCTION(Float64x2Constructor) 5973 DECLARE_INSTRUCTION(Float64x2Constructor)
6108 virtual CompileType ComputeType() const; 5974 virtual CompileType ComputeType() const;
6109 5975
6110 virtual bool AllowsCSE() const { return true; } 5976 virtual bool AllowsCSE() const { return true; }
6111 virtual EffectSet Effects() const { return EffectSet::None(); } 5977 virtual EffectSet Effects() const { return EffectSet::None(); }
6112 virtual EffectSet Dependencies() const { return EffectSet::None(); } 5978 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6113 virtual bool AttributesEqual(Instruction* other) const { return true; } 5979 virtual bool AttributesEqual(Instruction* other) const { return true; }
6114 5980
6115 virtual bool MayThrow() const { return false; } 5981 virtual bool MayThrow() const { return false; }
6116 5982
6117 private: 5983 private:
6118 DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr); 5984 DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr);
6119 }; 5985 };
6120 5986
6121 5987
6122 class Float64x2SplatInstr : public TemplateDefinition<1> { 5988 class Float64x2SplatInstr : public TemplateDefinition<1> {
6123 public: 5989 public:
6124 Float64x2SplatInstr(Value* value, intptr_t deopt_id) { 5990 Float64x2SplatInstr(Value* value, intptr_t deopt_id)
5991 : TemplateDefinition<1>(deopt_id) {
6125 SetInputAt(0, value); 5992 SetInputAt(0, value);
6126 deopt_id_ = deopt_id;
6127 } 5993 }
6128 5994
6129 Value* value() const { return inputs_[0]; } 5995 Value* value() const { return inputs_[0]; }
6130 5996
6131 virtual void PrintOperandsTo(BufferFormatter* f) const; 5997 virtual void PrintOperandsTo(BufferFormatter* f) const;
6132 5998
6133 virtual bool CanDeoptimize() const { return false; } 5999 virtual bool CanDeoptimize() const { return false; }
6134 6000
6135 virtual Representation representation() const { 6001 virtual Representation representation() const {
6136 return kUnboxedFloat64x2; 6002 return kUnboxedFloat64x2;
6137 } 6003 }
6138 6004
6139 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6005 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6140 ASSERT(idx == 0); 6006 ASSERT(idx == 0);
6141 return kUnboxedDouble; 6007 return kUnboxedDouble;
6142 } 6008 }
6143 6009
6144 virtual intptr_t DeoptimizationTarget() const { 6010 virtual intptr_t DeoptimizationTarget() const {
6145 // Direct access since this instruction cannot deoptimize, and the deopt-id 6011 // Direct access since this instruction cannot deoptimize, and the deopt-id
6146 // was inherited from another instruction that could deoptimize. 6012 // was inherited from another instruction that could deoptimize.
6147 return deopt_id_; 6013 return GetDeoptId();
6148 } 6014 }
6149 6015
6150 DECLARE_INSTRUCTION(Float64x2Splat) 6016 DECLARE_INSTRUCTION(Float64x2Splat)
6151 virtual CompileType ComputeType() const; 6017 virtual CompileType ComputeType() const;
6152 6018
6153 virtual bool AllowsCSE() const { return true; } 6019 virtual bool AllowsCSE() const { return true; }
6154 virtual EffectSet Effects() const { return EffectSet::None(); } 6020 virtual EffectSet Effects() const { return EffectSet::None(); }
6155 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6021 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6156 virtual bool AttributesEqual(Instruction* other) const { return true; } 6022 virtual bool AttributesEqual(Instruction* other) const { return true; }
6157 6023
6158 virtual bool MayThrow() const { return false; } 6024 virtual bool MayThrow() const { return false; }
6159 6025
6160 private: 6026 private:
6161 DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr); 6027 DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr);
6162 }; 6028 };
6163 6029
6164 6030
6165 class Float64x2ZeroInstr : public TemplateDefinition<0> { 6031 class Float64x2ZeroInstr : public TemplateDefinition<0> {
6166 public: 6032 public:
6167 explicit Float64x2ZeroInstr(intptr_t deopt_id) { 6033 Float64x2ZeroInstr() { }
6168 deopt_id_ = deopt_id;
6169 }
6170
6171 virtual void PrintOperandsTo(BufferFormatter* f) const;
6172 6034
6173 virtual bool CanDeoptimize() const { return false; } 6035 virtual bool CanDeoptimize() const { return false; }
6174 6036
6175 virtual Representation representation() const { 6037 virtual Representation representation() const {
6176 return kUnboxedFloat64x2; 6038 return kUnboxedFloat64x2;
6177 } 6039 }
6178 6040
6179 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6180 UNIMPLEMENTED();
6181 return kUnboxedFloat64x2;
6182 }
6183
6184 virtual intptr_t DeoptimizationTarget() const {
6185 // Direct access since this instruction cannot deoptimize, and the deopt-id
6186 // was inherited from another instruction that could deoptimize.
6187 return deopt_id_;
6188 }
6189
6190 DECLARE_INSTRUCTION(Float64x2Zero) 6041 DECLARE_INSTRUCTION(Float64x2Zero)
6191 virtual CompileType ComputeType() const; 6042 virtual CompileType ComputeType() const;
6192 6043
6193 virtual bool AllowsCSE() const { return true; } 6044 virtual bool AllowsCSE() const { return true; }
6194 virtual EffectSet Effects() const { return EffectSet::None(); } 6045 virtual EffectSet Effects() const { return EffectSet::None(); }
6195 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6046 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6196 virtual bool AttributesEqual(Instruction* other) const { return true; } 6047 virtual bool AttributesEqual(Instruction* other) const { return true; }
6197 6048
6198 virtual bool MayThrow() const { return false; } 6049 virtual bool MayThrow() const { return false; }
6199 6050
6200 private: 6051 private:
6201 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); 6052 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr);
6202 }; 6053 };
6203 6054
6204 6055
6056 // TODO(vegorov) rename to Unary to match arithmetic instructions.
6205 class Float64x2ZeroArgInstr : public TemplateDefinition<1> { 6057 class Float64x2ZeroArgInstr : public TemplateDefinition<1> {
6206 public: 6058 public:
6207 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind, Value* left, 6059 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind,
6208 intptr_t deopt_id) : op_kind_(op_kind) { 6060 Value* left,
6061 intptr_t deopt_id)
6062 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) {
6209 SetInputAt(0, left); 6063 SetInputAt(0, left);
6210 deopt_id_ = deopt_id;
6211 } 6064 }
6212 6065
6213 Value* left() const { return inputs_[0]; } 6066 Value* left() const { return inputs_[0]; }
6214 6067
6215 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6068 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6216 6069
6217 virtual void PrintOperandsTo(BufferFormatter* f) const; 6070 virtual void PrintOperandsTo(BufferFormatter* f) const;
6218 6071
6219 virtual bool CanDeoptimize() const { return false; } 6072 virtual bool CanDeoptimize() const { return false; }
6220 6073
6221 virtual Representation representation() const { 6074 virtual Representation representation() const {
6222 if (op_kind() == MethodRecognizer::kFloat64x2GetSignMask) { 6075 if (op_kind() == MethodRecognizer::kFloat64x2GetSignMask) {
6223 // Smi. 6076 // Smi.
6224 return kTagged; 6077 return kTagged;
6225 } 6078 }
6226 return kUnboxedFloat64x2; 6079 return kUnboxedFloat64x2;
6227 } 6080 }
6228 6081
6229 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6082 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6230 ASSERT(idx == 0); 6083 ASSERT(idx == 0);
6231 return kUnboxedFloat64x2; 6084 return kUnboxedFloat64x2;
6232 } 6085 }
6233 6086
6234 virtual intptr_t DeoptimizationTarget() const { 6087 virtual intptr_t DeoptimizationTarget() const {
6235 // Direct access since this instruction cannot deoptimize, and the deopt-id 6088 // Direct access since this instruction cannot deoptimize, and the deopt-id
6236 // was inherited from another instruction that could deoptimize. 6089 // was inherited from another instruction that could deoptimize.
6237 return deopt_id_; 6090 return GetDeoptId();
6238 } 6091 }
6239 6092
6240 DECLARE_INSTRUCTION(Float64x2ZeroArg) 6093 DECLARE_INSTRUCTION(Float64x2ZeroArg)
6241 virtual CompileType ComputeType() const; 6094 virtual CompileType ComputeType() const;
6242 6095
6243 virtual bool AllowsCSE() const { return true; } 6096 virtual bool AllowsCSE() const { return true; }
6244 virtual EffectSet Effects() const { return EffectSet::None(); } 6097 virtual EffectSet Effects() const { return EffectSet::None(); }
6245 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6098 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6246 virtual bool AttributesEqual(Instruction* other) const { 6099 virtual bool AttributesEqual(Instruction* other) const {
6247 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind(); 6100 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind();
6248 } 6101 }
6249 6102
6250 virtual bool MayThrow() const { return false; } 6103 virtual bool MayThrow() const { return false; }
6251 6104
6252 private: 6105 private:
6253 const MethodRecognizer::Kind op_kind_; 6106 const MethodRecognizer::Kind op_kind_;
6254 6107
6255 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr); 6108 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr);
6256 }; 6109 };
6257 6110
6258 6111
6259 class Float64x2OneArgInstr : public TemplateDefinition<2> { 6112 class Float64x2OneArgInstr : public TemplateDefinition<2> {
6260 public: 6113 public:
6261 Float64x2OneArgInstr(MethodRecognizer::Kind op_kind, Value* left, 6114 Float64x2OneArgInstr(MethodRecognizer::Kind op_kind,
6262 Value* right, intptr_t deopt_id) : op_kind_(op_kind) { 6115 Value* left,
6116 Value* right,
6117 intptr_t deopt_id)
6118 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
6263 SetInputAt(0, left); 6119 SetInputAt(0, left);
6264 SetInputAt(1, right); 6120 SetInputAt(1, right);
6265 deopt_id_ = deopt_id;
6266 } 6121 }
6267 6122
6268 Value* left() const { return inputs_[0]; } 6123 Value* left() const { return inputs_[0]; }
6269 Value* right() const { return inputs_[1]; } 6124 Value* right() const { return inputs_[1]; }
6270 6125
6271 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6126 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6272 6127
6273 virtual void PrintOperandsTo(BufferFormatter* f) const; 6128 virtual void PrintOperandsTo(BufferFormatter* f) const;
6274 6129
6275 virtual bool CanDeoptimize() const { return false; } 6130 virtual bool CanDeoptimize() const { return false; }
(...skipping 11 matching lines...) Expand all
6287 (op_kind() == MethodRecognizer::kFloat64x2WithY) || 6142 (op_kind() == MethodRecognizer::kFloat64x2WithY) ||
6288 (op_kind() == MethodRecognizer::kFloat64x2Scale)) { 6143 (op_kind() == MethodRecognizer::kFloat64x2Scale)) {
6289 return kUnboxedDouble; 6144 return kUnboxedDouble;
6290 } 6145 }
6291 return kUnboxedFloat64x2; 6146 return kUnboxedFloat64x2;
6292 } 6147 }
6293 6148
6294 virtual intptr_t DeoptimizationTarget() const { 6149 virtual intptr_t DeoptimizationTarget() const {
6295 // Direct access since this instruction cannot deoptimize, and the deopt-id 6150 // Direct access since this instruction cannot deoptimize, and the deopt-id
6296 // was inherited from another instruction that could deoptimize. 6151 // was inherited from another instruction that could deoptimize.
6297 return deopt_id_; 6152 return GetDeoptId();
6298 } 6153 }
6299 6154
6300 DECLARE_INSTRUCTION(Float64x2OneArg) 6155 DECLARE_INSTRUCTION(Float64x2OneArg)
6301 virtual CompileType ComputeType() const; 6156 virtual CompileType ComputeType() const;
6302 6157
6303 virtual bool AllowsCSE() const { return true; } 6158 virtual bool AllowsCSE() const { return true; }
6304 virtual EffectSet Effects() const { return EffectSet::None(); } 6159 virtual EffectSet Effects() const { return EffectSet::None(); }
6305 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6160 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6306 virtual bool AttributesEqual(Instruction* other) const { 6161 virtual bool AttributesEqual(Instruction* other) const {
6307 return op_kind() == other->AsFloat64x2OneArg()->op_kind(); 6162 return op_kind() == other->AsFloat64x2OneArg()->op_kind();
6308 } 6163 }
6309 6164
6310 virtual bool MayThrow() const { return false; } 6165 virtual bool MayThrow() const { return false; }
6311 6166
6312 private: 6167 private:
6313 const MethodRecognizer::Kind op_kind_; 6168 const MethodRecognizer::Kind op_kind_;
6314 6169
6315 DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr); 6170 DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr);
6316 }; 6171 };
6317 6172
6318 6173
6319 class Int32x4ConstructorInstr : public TemplateDefinition<4> { 6174 class Int32x4ConstructorInstr : public TemplateDefinition<4> {
6320 public: 6175 public:
6321 Int32x4ConstructorInstr(Value* value0, Value* value1, Value* value2, 6176 Int32x4ConstructorInstr(Value* value0,
6322 Value* value3, intptr_t deopt_id) { 6177 Value* value1,
6178 Value* value2,
6179 Value* value3,
6180 intptr_t deopt_id)
6181 : TemplateDefinition<4>(deopt_id) {
6323 SetInputAt(0, value0); 6182 SetInputAt(0, value0);
6324 SetInputAt(1, value1); 6183 SetInputAt(1, value1);
6325 SetInputAt(2, value2); 6184 SetInputAt(2, value2);
6326 SetInputAt(3, value3); 6185 SetInputAt(3, value3);
6327 deopt_id_ = deopt_id;
6328 } 6186 }
6329 6187
6330 Value* value0() const { return inputs_[0]; } 6188 Value* value0() const { return inputs_[0]; }
6331 Value* value1() const { return inputs_[1]; } 6189 Value* value1() const { return inputs_[1]; }
6332 Value* value2() const { return inputs_[2]; } 6190 Value* value2() const { return inputs_[2]; }
6333 Value* value3() const { return inputs_[3]; } 6191 Value* value3() const { return inputs_[3]; }
6334 6192
6335 virtual void PrintOperandsTo(BufferFormatter* f) const; 6193 virtual void PrintOperandsTo(BufferFormatter* f) const;
6336 6194
6337 virtual bool CanDeoptimize() const { return false; } 6195 virtual bool CanDeoptimize() const { return false; }
6338 6196
6339 virtual Representation representation() const { 6197 virtual Representation representation() const {
6340 return kUnboxedInt32x4; 6198 return kUnboxedInt32x4;
6341 } 6199 }
6342 6200
6343 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6201 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6344 ASSERT((idx >= 0) && (idx < 4)); 6202 ASSERT((idx >= 0) && (idx < 4));
6345 return kUnboxedUint32; 6203 return kUnboxedUint32;
6346 } 6204 }
6347 6205
6348 virtual intptr_t DeoptimizationTarget() const { 6206 virtual intptr_t DeoptimizationTarget() const {
6349 // Direct access since this instruction cannot deoptimize, and the deopt-id 6207 // Direct access since this instruction cannot deoptimize, and the deopt-id
6350 // was inherited from another instruction that could deoptimize. 6208 // was inherited from another instruction that could deoptimize.
6351 return deopt_id_; 6209 return GetDeoptId();
6352 } 6210 }
6353 6211
6354 DECLARE_INSTRUCTION(Int32x4Constructor) 6212 DECLARE_INSTRUCTION(Int32x4Constructor)
6355 virtual CompileType ComputeType() const; 6213 virtual CompileType ComputeType() const;
6356 6214
6357 virtual bool AllowsCSE() const { return true; } 6215 virtual bool AllowsCSE() const { return true; }
6358 virtual EffectSet Effects() const { return EffectSet::None(); } 6216 virtual EffectSet Effects() const { return EffectSet::None(); }
6359 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6217 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6360 virtual bool AttributesEqual(Instruction* other) const { return true; } 6218 virtual bool AttributesEqual(Instruction* other) const { return true; }
6361 6219
6362 virtual bool MayThrow() const { return false; } 6220 virtual bool MayThrow() const { return false; }
6363 6221
6364 private: 6222 private:
6365 DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr); 6223 DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr);
6366 }; 6224 };
6367 6225
6368 6226
6369 class Int32x4BoolConstructorInstr : public TemplateDefinition<4> { 6227 class Int32x4BoolConstructorInstr : public TemplateDefinition<4> {
6370 public: 6228 public:
6371 Int32x4BoolConstructorInstr(Value* value0, Value* value1, Value* value2, 6229 Int32x4BoolConstructorInstr(Value* value0,
6372 Value* value3, intptr_t deopt_id) { 6230 Value* value1,
6231 Value* value2,
6232 Value* value3,
6233 intptr_t deopt_id)
6234 : TemplateDefinition<4>(deopt_id) {
6373 SetInputAt(0, value0); 6235 SetInputAt(0, value0);
6374 SetInputAt(1, value1); 6236 SetInputAt(1, value1);
6375 SetInputAt(2, value2); 6237 SetInputAt(2, value2);
6376 SetInputAt(3, value3); 6238 SetInputAt(3, value3);
6377 deopt_id_ = deopt_id;
6378 } 6239 }
6379 6240
6380 Value* value0() const { return inputs_[0]; } 6241 Value* value0() const { return inputs_[0]; }
6381 Value* value1() const { return inputs_[1]; } 6242 Value* value1() const { return inputs_[1]; }
6382 Value* value2() const { return inputs_[2]; } 6243 Value* value2() const { return inputs_[2]; }
6383 Value* value3() const { return inputs_[3]; } 6244 Value* value3() const { return inputs_[3]; }
6384 6245
6385 virtual void PrintOperandsTo(BufferFormatter* f) const; 6246 virtual void PrintOperandsTo(BufferFormatter* f) const;
6386 6247
6387 virtual bool CanDeoptimize() const { return false; } 6248 virtual bool CanDeoptimize() const { return false; }
6388 6249
6389 virtual Representation representation() const { 6250 virtual Representation representation() const {
6390 return kUnboxedInt32x4; 6251 return kUnboxedInt32x4;
6391 } 6252 }
6392 6253
6393 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6254 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6394 ASSERT((idx >= 0) && (idx < 4)); 6255 ASSERT((idx >= 0) && (idx < 4));
6395 return kTagged; 6256 return kTagged;
6396 } 6257 }
6397 6258
6398 virtual intptr_t DeoptimizationTarget() const { 6259 virtual intptr_t DeoptimizationTarget() const {
6399 // Direct access since this instruction cannot deoptimize, and the deopt-id 6260 // Direct access since this instruction cannot deoptimize, and the deopt-id
6400 // was inherited from another instruction that could deoptimize. 6261 // was inherited from another instruction that could deoptimize.
6401 return deopt_id_; 6262 return GetDeoptId();
6402 } 6263 }
6403 6264
6404 DECLARE_INSTRUCTION(Int32x4BoolConstructor) 6265 DECLARE_INSTRUCTION(Int32x4BoolConstructor)
6405 virtual CompileType ComputeType() const; 6266 virtual CompileType ComputeType() const;
6406 6267
6407 virtual bool AllowsCSE() const { return true; } 6268 virtual bool AllowsCSE() const { return true; }
6408 virtual EffectSet Effects() const { return EffectSet::None(); } 6269 virtual EffectSet Effects() const { return EffectSet::None(); }
6409 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6270 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6410 virtual bool AttributesEqual(Instruction* other) const { return true; } 6271 virtual bool AttributesEqual(Instruction* other) const { return true; }
6411 6272
6412 virtual bool MayThrow() const { return false; } 6273 virtual bool MayThrow() const { return false; }
6413 6274
6414 private: 6275 private:
6415 DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr); 6276 DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr);
6416 }; 6277 };
6417 6278
6418 6279
6419 class Int32x4GetFlagInstr : public TemplateDefinition<1> { 6280 class Int32x4GetFlagInstr : public TemplateDefinition<1> {
6420 public: 6281 public:
6421 Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind, Value* value, 6282 Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind,
6422 intptr_t deopt_id) 6283 Value* value,
6423 : op_kind_(op_kind) { 6284 intptr_t deopt_id)
6285 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) {
6424 SetInputAt(0, value); 6286 SetInputAt(0, value);
6425 deopt_id_ = deopt_id;
6426 } 6287 }
6427 6288
6428 Value* value() const { return inputs_[0]; } 6289 Value* value() const { return inputs_[0]; }
6429 6290
6430 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6291 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6431 6292
6432 virtual void PrintOperandsTo(BufferFormatter* f) const; 6293 virtual void PrintOperandsTo(BufferFormatter* f) const;
6433 6294
6434 virtual bool CanDeoptimize() const { return false; } 6295 virtual bool CanDeoptimize() const { return false; }
6435 6296
6436 virtual Representation representation() const { 6297 virtual Representation representation() const {
6437 return kTagged; 6298 return kTagged;
6438 } 6299 }
6439 6300
6440 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6301 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6441 ASSERT(idx == 0); 6302 ASSERT(idx == 0);
6442 return kUnboxedInt32x4; 6303 return kUnboxedInt32x4;
6443 } 6304 }
6444 6305
6445 virtual intptr_t DeoptimizationTarget() const { 6306 virtual intptr_t DeoptimizationTarget() const {
6446 // Direct access since this instruction cannot deoptimize, and the deopt-id 6307 // Direct access since this instruction cannot deoptimize, and the deopt-id
6447 // was inherited from another instruction that could deoptimize. 6308 // was inherited from another instruction that could deoptimize.
6448 return deopt_id_; 6309 return GetDeoptId();
6449 } 6310 }
6450 6311
6451 DECLARE_INSTRUCTION(Int32x4GetFlag) 6312 DECLARE_INSTRUCTION(Int32x4GetFlag)
6452 virtual CompileType ComputeType() const; 6313 virtual CompileType ComputeType() const;
6453 6314
6454 virtual bool AllowsCSE() const { return true; } 6315 virtual bool AllowsCSE() const { return true; }
6455 virtual EffectSet Effects() const { return EffectSet::None(); } 6316 virtual EffectSet Effects() const { return EffectSet::None(); }
6456 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6317 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6457 virtual bool AttributesEqual(Instruction* other) const { 6318 virtual bool AttributesEqual(Instruction* other) const {
6458 return op_kind() == other->AsInt32x4GetFlag()->op_kind(); 6319 return op_kind() == other->AsInt32x4GetFlag()->op_kind();
6459 } 6320 }
6460 6321
6461 virtual bool MayThrow() const { return false; } 6322 virtual bool MayThrow() const { return false; }
6462 6323
6463 private: 6324 private:
6464 const MethodRecognizer::Kind op_kind_; 6325 const MethodRecognizer::Kind op_kind_;
6465 6326
6466 DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr); 6327 DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr);
6467 }; 6328 };
6468 6329
6469 6330
6470 class Simd32x4GetSignMaskInstr : public TemplateDefinition<1> { 6331 class Simd32x4GetSignMaskInstr : public TemplateDefinition<1> {
6471 public: 6332 public:
6472 Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind, Value* value, 6333 Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind,
6473 intptr_t deopt_id) : op_kind_(op_kind) { 6334 Value* value,
6335 intptr_t deopt_id)
6336 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) {
6474 SetInputAt(0, value); 6337 SetInputAt(0, value);
6475 deopt_id_ = deopt_id;
6476 } 6338 }
6477 6339
6478 Value* value() const { return inputs_[0]; } 6340 Value* value() const { return inputs_[0]; }
6479 6341
6480 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6342 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6481 6343
6482 virtual void PrintOperandsTo(BufferFormatter* f) const; 6344 virtual void PrintOperandsTo(BufferFormatter* f) const;
6483 6345
6484 virtual bool CanDeoptimize() const { return false; } 6346 virtual bool CanDeoptimize() const { return false; }
6485 6347
6486 virtual Representation representation() const { 6348 virtual Representation representation() const {
6487 return kTagged; 6349 return kTagged;
6488 } 6350 }
6489 6351
6490 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6352 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6491 ASSERT(idx == 0); 6353 ASSERT(idx == 0);
6492 if (op_kind_ == MethodRecognizer::kFloat32x4GetSignMask) { 6354 if (op_kind_ == MethodRecognizer::kFloat32x4GetSignMask) {
6493 return kUnboxedFloat32x4; 6355 return kUnboxedFloat32x4;
6494 } 6356 }
6495 ASSERT(op_kind_ == MethodRecognizer::kInt32x4GetSignMask); 6357 ASSERT(op_kind_ == MethodRecognizer::kInt32x4GetSignMask);
6496 return kUnboxedInt32x4; 6358 return kUnboxedInt32x4;
6497 } 6359 }
6498 6360
6499 virtual intptr_t DeoptimizationTarget() const { 6361 virtual intptr_t DeoptimizationTarget() const {
6500 // Direct access since this instruction cannot deoptimize, and the deopt-id 6362 // Direct access since this instruction cannot deoptimize, and the deopt-id
6501 // was inherited from another instruction that could deoptimize. 6363 // was inherited from another instruction that could deoptimize.
6502 return deopt_id_; 6364 return GetDeoptId();
6503 } 6365 }
6504 6366
6505 DECLARE_INSTRUCTION(Simd32x4GetSignMask) 6367 DECLARE_INSTRUCTION(Simd32x4GetSignMask)
6506 virtual CompileType ComputeType() const; 6368 virtual CompileType ComputeType() const;
6507 6369
6508 virtual bool AllowsCSE() const { return true; } 6370 virtual bool AllowsCSE() const { return true; }
6509 virtual EffectSet Effects() const { return EffectSet::None(); } 6371 virtual EffectSet Effects() const { return EffectSet::None(); }
6510 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6372 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6511 virtual bool AttributesEqual(Instruction* other) const { 6373 virtual bool AttributesEqual(Instruction* other) const {
6512 return other->AsSimd32x4GetSignMask()->op_kind() == op_kind(); 6374 return other->AsSimd32x4GetSignMask()->op_kind() == op_kind();
6513 } 6375 }
6514 6376
6515 virtual bool MayThrow() const { return false; } 6377 virtual bool MayThrow() const { return false; }
6516 6378
6517 private: 6379 private:
6518 const MethodRecognizer::Kind op_kind_; 6380 const MethodRecognizer::Kind op_kind_;
6519 6381
6520 DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr); 6382 DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr);
6521 }; 6383 };
6522 6384
6523 6385
6524 class Int32x4SelectInstr : public TemplateDefinition<3> { 6386 class Int32x4SelectInstr : public TemplateDefinition<3> {
6525 public: 6387 public:
6526 Int32x4SelectInstr(Value* mask, Value* trueValue, Value* falseValue, 6388 Int32x4SelectInstr(Value* mask,
6527 intptr_t deopt_id) { 6389 Value* trueValue,
6390 Value* falseValue,
6391 intptr_t deopt_id)
6392 : TemplateDefinition<3>(deopt_id) {
6528 SetInputAt(0, mask); 6393 SetInputAt(0, mask);
6529 SetInputAt(1, trueValue); 6394 SetInputAt(1, trueValue);
6530 SetInputAt(2, falseValue); 6395 SetInputAt(2, falseValue);
6531 deopt_id_ = deopt_id;
6532 } 6396 }
6533 6397
6534 Value* mask() const { return inputs_[0]; } 6398 Value* mask() const { return inputs_[0]; }
6535 Value* trueValue() const { return inputs_[1]; } 6399 Value* trueValue() const { return inputs_[1]; }
6536 Value* falseValue() const { return inputs_[2]; } 6400 Value* falseValue() const { return inputs_[2]; }
6537 6401
6538 virtual void PrintOperandsTo(BufferFormatter* f) const; 6402 virtual void PrintOperandsTo(BufferFormatter* f) const;
6539 6403
6540 virtual bool CanDeoptimize() const { return false; } 6404 virtual bool CanDeoptimize() const { return false; }
6541 6405
6542 virtual Representation representation() const { 6406 virtual Representation representation() const {
6543 return kUnboxedFloat32x4; 6407 return kUnboxedFloat32x4;
6544 } 6408 }
6545 6409
6546 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6410 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6547 ASSERT((idx == 0) || (idx == 1) || (idx == 2)); 6411 ASSERT((idx == 0) || (idx == 1) || (idx == 2));
6548 if (idx == 0) { 6412 if (idx == 0) {
6549 return kUnboxedInt32x4; 6413 return kUnboxedInt32x4;
6550 } 6414 }
6551 return kUnboxedFloat32x4; 6415 return kUnboxedFloat32x4;
6552 } 6416 }
6553 6417
6554 virtual intptr_t DeoptimizationTarget() const { 6418 virtual intptr_t DeoptimizationTarget() const {
6555 // Direct access since this instruction cannot deoptimize, and the deopt-id 6419 // Direct access since this instruction cannot deoptimize, and the deopt-id
6556 // was inherited from another instruction that could deoptimize. 6420 // was inherited from another instruction that could deoptimize.
6557 return deopt_id_; 6421 return GetDeoptId();
6558 } 6422 }
6559 6423
6560 DECLARE_INSTRUCTION(Int32x4Select) 6424 DECLARE_INSTRUCTION(Int32x4Select)
6561 virtual CompileType ComputeType() const; 6425 virtual CompileType ComputeType() const;
6562 6426
6563 virtual bool AllowsCSE() const { return true; } 6427 virtual bool AllowsCSE() const { return true; }
6564 virtual EffectSet Effects() const { return EffectSet::None(); } 6428 virtual EffectSet Effects() const { return EffectSet::None(); }
6565 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6429 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6566 virtual bool AttributesEqual(Instruction* other) const { return true; } 6430 virtual bool AttributesEqual(Instruction* other) const { return true; }
6567 6431
6568 virtual bool MayThrow() const { return false; } 6432 virtual bool MayThrow() const { return false; }
6569 6433
6570 private: 6434 private:
6571 DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr); 6435 DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr);
6572 }; 6436 };
6573 6437
6574 6438
6575 class Int32x4SetFlagInstr : public TemplateDefinition<2> { 6439 class Int32x4SetFlagInstr : public TemplateDefinition<2> {
6576 public: 6440 public:
6577 Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind, Value* value, 6441 Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind,
6578 Value* flagValue, intptr_t deopt_id) 6442 Value* value,
6579 : op_kind_(op_kind) { 6443 Value* flagValue,
6444 intptr_t deopt_id)
6445 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
6580 SetInputAt(0, value); 6446 SetInputAt(0, value);
6581 SetInputAt(1, flagValue); 6447 SetInputAt(1, flagValue);
6582 deopt_id_ = deopt_id;
6583 } 6448 }
6584 6449
6585 Value* value() const { return inputs_[0]; } 6450 Value* value() const { return inputs_[0]; }
6586 Value* flagValue() const { return inputs_[1]; } 6451 Value* flagValue() const { return inputs_[1]; }
6587 6452
6588 MethodRecognizer::Kind op_kind() const { return op_kind_; } 6453 MethodRecognizer::Kind op_kind() const { return op_kind_; }
6589 6454
6590 virtual void PrintOperandsTo(BufferFormatter* f) const; 6455 virtual void PrintOperandsTo(BufferFormatter* f) const;
6591 6456
6592 virtual bool CanDeoptimize() const { return false; } 6457 virtual bool CanDeoptimize() const { return false; }
6593 6458
6594 virtual Representation representation() const { 6459 virtual Representation representation() const {
6595 return kUnboxedInt32x4; 6460 return kUnboxedInt32x4;
6596 } 6461 }
6597 6462
6598 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6463 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6599 ASSERT((idx == 0) || (idx == 1)); 6464 ASSERT((idx == 0) || (idx == 1));
6600 if (idx == 1) { 6465 if (idx == 1) {
6601 return kTagged; 6466 return kTagged;
6602 } 6467 }
6603 return kUnboxedInt32x4; 6468 return kUnboxedInt32x4;
6604 } 6469 }
6605 6470
6606 virtual intptr_t DeoptimizationTarget() const { 6471 virtual intptr_t DeoptimizationTarget() const {
6607 // Direct access since this instruction cannot deoptimize, and the deopt-id 6472 // Direct access since this instruction cannot deoptimize, and the deopt-id
6608 // was inherited from another instruction that could deoptimize. 6473 // was inherited from another instruction that could deoptimize.
6609 return deopt_id_; 6474 return GetDeoptId();
6610 } 6475 }
6611 6476
6612 DECLARE_INSTRUCTION(Int32x4SetFlag) 6477 DECLARE_INSTRUCTION(Int32x4SetFlag)
6613 virtual CompileType ComputeType() const; 6478 virtual CompileType ComputeType() const;
6614 6479
6615 virtual bool AllowsCSE() const { return true; } 6480 virtual bool AllowsCSE() const { return true; }
6616 virtual EffectSet Effects() const { return EffectSet::None(); } 6481 virtual EffectSet Effects() const { return EffectSet::None(); }
6617 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6482 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6618 virtual bool AttributesEqual(Instruction* other) const { 6483 virtual bool AttributesEqual(Instruction* other) const {
6619 return op_kind() == other->AsInt32x4SetFlag()->op_kind(); 6484 return op_kind() == other->AsInt32x4SetFlag()->op_kind();
6620 } 6485 }
6621 6486
6622 virtual bool MayThrow() const { return false; } 6487 virtual bool MayThrow() const { return false; }
6623 6488
6624 private: 6489 private:
6625 const MethodRecognizer::Kind op_kind_; 6490 const MethodRecognizer::Kind op_kind_;
6626 6491
6627 DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr); 6492 DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr);
6628 }; 6493 };
6629 6494
6630 6495
6631 class Int32x4ToFloat32x4Instr : public TemplateDefinition<1> { 6496 class Int32x4ToFloat32x4Instr : public TemplateDefinition<1> {
6632 public: 6497 public:
6633 Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id) { 6498 Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id)
6499 : TemplateDefinition<1>(deopt_id) {
6634 SetInputAt(0, left); 6500 SetInputAt(0, left);
6635 deopt_id_ = deopt_id;
6636 } 6501 }
6637 6502
6638 Value* left() const { return inputs_[0]; } 6503 Value* left() const { return inputs_[0]; }
6639 6504
6640 virtual void PrintOperandsTo(BufferFormatter* f) const; 6505 virtual void PrintOperandsTo(BufferFormatter* f) const;
6641 6506
6642 virtual bool CanDeoptimize() const { return false; } 6507 virtual bool CanDeoptimize() const { return false; }
6643 6508
6644 virtual Representation representation() const { 6509 virtual Representation representation() const {
6645 return kUnboxedFloat32x4; 6510 return kUnboxedFloat32x4;
6646 } 6511 }
6647 6512
6648 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6513 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6649 ASSERT(idx == 0); 6514 ASSERT(idx == 0);
6650 return kUnboxedInt32x4; 6515 return kUnboxedInt32x4;
6651 } 6516 }
6652 6517
6653 virtual intptr_t DeoptimizationTarget() const { 6518 virtual intptr_t DeoptimizationTarget() const {
6654 // Direct access since this instruction cannot deoptimize, and the deopt-id 6519 // Direct access since this instruction cannot deoptimize, and the deopt-id
6655 // was inherited from another instruction that could deoptimize. 6520 // was inherited from another instruction that could deoptimize.
6656 return deopt_id_; 6521 return GetDeoptId();
6657 } 6522 }
6658 6523
6659 DECLARE_INSTRUCTION(Int32x4ToFloat32x4) 6524 DECLARE_INSTRUCTION(Int32x4ToFloat32x4)
6660 virtual CompileType ComputeType() const; 6525 virtual CompileType ComputeType() const;
6661 6526
6662 virtual bool AllowsCSE() const { return true; } 6527 virtual bool AllowsCSE() const { return true; }
6663 virtual EffectSet Effects() const { return EffectSet::None(); } 6528 virtual EffectSet Effects() const { return EffectSet::None(); }
6664 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6529 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6665 virtual bool AttributesEqual(Instruction* other) const { return true; } 6530 virtual bool AttributesEqual(Instruction* other) const { return true; }
6666 6531
6667 virtual bool MayThrow() const { return false; } 6532 virtual bool MayThrow() const { return false; }
6668 6533
6669 private: 6534 private:
6670 DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr); 6535 DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr);
6671 }; 6536 };
6672 6537
6673 6538
6674 class BinaryInt32x4OpInstr : public TemplateDefinition<2> { 6539 class BinaryInt32x4OpInstr : public TemplateDefinition<2> {
6675 public: 6540 public:
6676 BinaryInt32x4OpInstr(Token::Kind op_kind, 6541 BinaryInt32x4OpInstr(Token::Kind op_kind,
6677 Value* left, 6542 Value* left,
6678 Value* right, 6543 Value* right,
6679 intptr_t deopt_id) 6544 intptr_t deopt_id)
6680 : op_kind_(op_kind) { 6545 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
6681 SetInputAt(0, left); 6546 SetInputAt(0, left);
6682 SetInputAt(1, right); 6547 SetInputAt(1, right);
6683 deopt_id_ = deopt_id;
6684 } 6548 }
6685 6549
6686 Value* left() const { return inputs_[0]; } 6550 Value* left() const { return inputs_[0]; }
6687 Value* right() const { return inputs_[1]; } 6551 Value* right() const { return inputs_[1]; }
6688 6552
6689 Token::Kind op_kind() const { return op_kind_; } 6553 Token::Kind op_kind() const { return op_kind_; }
6690 6554
6691 virtual void PrintOperandsTo(BufferFormatter* f) const; 6555 virtual void PrintOperandsTo(BufferFormatter* f) const;
6692 6556
6693 virtual bool CanDeoptimize() const { return false; } 6557 virtual bool CanDeoptimize() const { return false; }
6694 6558
6695 virtual Representation representation() const { 6559 virtual Representation representation() const {
6696 return kUnboxedInt32x4; 6560 return kUnboxedInt32x4;
6697 } 6561 }
6698 6562
6699 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6563 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6700 ASSERT((idx == 0) || (idx == 1)); 6564 ASSERT((idx == 0) || (idx == 1));
6701 return kUnboxedInt32x4; 6565 return kUnboxedInt32x4;
6702 } 6566 }
6703 6567
6704 virtual intptr_t DeoptimizationTarget() const { 6568 virtual intptr_t DeoptimizationTarget() const {
6705 // Direct access since this instruction cannot deoptimize, and the deopt-id 6569 // Direct access since this instruction cannot deoptimize, and the deopt-id
6706 // was inherited from another instruction that could deoptimize. 6570 // was inherited from another instruction that could deoptimize.
6707 return deopt_id_; 6571 return GetDeoptId();
6708 } 6572 }
6709 6573
6710 DECLARE_INSTRUCTION(BinaryInt32x4Op) 6574 DECLARE_INSTRUCTION(BinaryInt32x4Op)
6711 virtual CompileType ComputeType() const; 6575 virtual CompileType ComputeType() const;
6712 6576
6713 virtual bool AllowsCSE() const { return true; } 6577 virtual bool AllowsCSE() const { return true; }
6714 virtual EffectSet Effects() const { return EffectSet::None(); } 6578 virtual EffectSet Effects() const { return EffectSet::None(); }
6715 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6579 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6716 virtual bool AttributesEqual(Instruction* other) const { 6580 virtual bool AttributesEqual(Instruction* other) const {
6717 return op_kind() == other->AsBinaryInt32x4Op()->op_kind(); 6581 return op_kind() == other->AsBinaryInt32x4Op()->op_kind();
6718 } 6582 }
6719 6583
6720 virtual bool MayThrow() const { return false; } 6584 virtual bool MayThrow() const { return false; }
6721 6585
6722 private: 6586 private:
6723 const Token::Kind op_kind_; 6587 const Token::Kind op_kind_;
6724 6588
6725 DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr); 6589 DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr);
6726 }; 6590 };
6727 6591
6728 6592
6729 class BinaryFloat64x2OpInstr : public TemplateDefinition<2> { 6593 class BinaryFloat64x2OpInstr : public TemplateDefinition<2> {
6730 public: 6594 public:
6731 BinaryFloat64x2OpInstr(Token::Kind op_kind, 6595 BinaryFloat64x2OpInstr(Token::Kind op_kind,
6732 Value* left, 6596 Value* left,
6733 Value* right, 6597 Value* right,
6734 intptr_t deopt_id) 6598 intptr_t deopt_id)
6735 : op_kind_(op_kind) { 6599 : TemplateDefinition<2>(deopt_id), op_kind_(op_kind) {
6736 SetInputAt(0, left); 6600 SetInputAt(0, left);
6737 SetInputAt(1, right); 6601 SetInputAt(1, right);
6738 deopt_id_ = deopt_id;
6739 } 6602 }
6740 6603
6741 Value* left() const { return inputs_[0]; } 6604 Value* left() const { return inputs_[0]; }
6742 Value* right() const { return inputs_[1]; } 6605 Value* right() const { return inputs_[1]; }
6743 6606
6744 Token::Kind op_kind() const { return op_kind_; } 6607 Token::Kind op_kind() const { return op_kind_; }
6745 6608
6746 virtual bool CanDeoptimize() const { return false; } 6609 virtual bool CanDeoptimize() const { return false; }
6747 6610
6748 virtual Representation representation() const { 6611 virtual Representation representation() const {
6749 return kUnboxedFloat64x2; 6612 return kUnboxedFloat64x2;
6750 } 6613 }
6751 6614
6752 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 6615 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
6753 ASSERT((idx == 0) || (idx == 1)); 6616 ASSERT((idx == 0) || (idx == 1));
6754 return kUnboxedFloat64x2; 6617 return kUnboxedFloat64x2;
6755 } 6618 }
6756 6619
6757 virtual void PrintOperandsTo(BufferFormatter* f) const; 6620 virtual void PrintOperandsTo(BufferFormatter* f) const;
6758 6621
6759 virtual intptr_t DeoptimizationTarget() const { 6622 virtual intptr_t DeoptimizationTarget() const {
6760 // Direct access since this instruction cannot deoptimize, and the deopt-id 6623 // Direct access since this instruction cannot deoptimize, and the deopt-id
6761 // was inherited from another instruction that could deoptimize. 6624 // was inherited from another instruction that could deoptimize.
6762 return deopt_id_; 6625 return GetDeoptId();
6763 } 6626 }
6764 6627
6765 DECLARE_INSTRUCTION(BinaryFloat64x2Op) 6628 DECLARE_INSTRUCTION(BinaryFloat64x2Op)
6766 virtual CompileType ComputeType() const; 6629 virtual CompileType ComputeType() const;
6767 6630
6768 virtual bool AllowsCSE() const { return true; } 6631 virtual bool AllowsCSE() const { return true; }
6769 virtual EffectSet Effects() const { return EffectSet::None(); } 6632 virtual EffectSet Effects() const { return EffectSet::None(); }
6770 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6633 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6771 virtual bool AttributesEqual(Instruction* other) const { 6634 virtual bool AttributesEqual(Instruction* other) const {
6772 ASSERT(other->IsBinaryFloat64x2Op()); 6635 ASSERT(other->IsBinaryFloat64x2Op());
6773 return op_kind() == other->AsBinaryFloat64x2Op()->op_kind(); 6636 return op_kind() == other->AsBinaryFloat64x2Op()->op_kind();
6774 } 6637 }
6775 6638
6776 virtual bool MayThrow() const { return false; } 6639 virtual bool MayThrow() const { return false; }
6777 6640
6778 private: 6641 private:
6779 const Token::Kind op_kind_; 6642 const Token::Kind op_kind_;
6780 6643
6781 DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr); 6644 DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr);
6782 }; 6645 };
6783 6646
6784 6647
6785 class UnaryIntegerOpInstr : public TemplateDefinition<1> { 6648 class UnaryIntegerOpInstr : public TemplateDefinition<1> {
6786 public: 6649 public:
6787 UnaryIntegerOpInstr(Token::Kind op_kind, 6650 UnaryIntegerOpInstr(Token::Kind op_kind,
6788 Value* value, 6651 Value* value,
6789 intptr_t deopt_id) 6652 intptr_t deopt_id)
6790 : op_kind_(op_kind) { 6653 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) {
6791 ASSERT((op_kind == Token::kNEGATE) || 6654 ASSERT((op_kind == Token::kNEGATE) ||
6792 (op_kind == Token::kBIT_NOT)); 6655 (op_kind == Token::kBIT_NOT));
6793 SetInputAt(0, value); 6656 SetInputAt(0, value);
6794 // Override generated deopt-id.
6795 deopt_id_ = deopt_id;
6796 } 6657 }
6797 6658
6798 static UnaryIntegerOpInstr* Make(Representation representation, 6659 static UnaryIntegerOpInstr* Make(Representation representation,
6799 Token::Kind op_kind, 6660 Token::Kind op_kind,
6800 Value* value, 6661 Value* value,
6801 intptr_t deopt_id, 6662 intptr_t deopt_id,
6802 Range* range); 6663 Range* range);
6803 6664
6804 Value* value() const { return inputs_[0]; } 6665 Value* value() const { return inputs_[0]; }
6805 Token::Kind op_kind() const { return op_kind_; } 6666 Token::Kind op_kind() const { return op_kind_; }
6806 6667
6807 virtual bool AllowsCSE() const { return true; } 6668 virtual bool AllowsCSE() const { return true; }
6808 virtual EffectSet Effects() const { return EffectSet::None(); } 6669 virtual EffectSet Effects() const { return EffectSet::None(); }
6809 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6670 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6810 virtual bool AttributesEqual(Instruction* other) const { 6671 virtual bool AttributesEqual(Instruction* other) const {
6811 return other->AsUnaryIntegerOp()->op_kind() == op_kind(); 6672 return other->AsUnaryIntegerOp()->op_kind() == op_kind();
6812 } 6673 }
6813 6674
6814 virtual intptr_t DeoptimizationTarget() const { 6675 virtual intptr_t DeoptimizationTarget() const {
6815 // Direct access since this instruction cannot deoptimize, and the deopt-id 6676 // Direct access since this instruction cannot deoptimize, and the deopt-id
6816 // was inherited from another instruction that could deoptimize. 6677 // was inherited from another instruction that could deoptimize.
6817 return deopt_id_; 6678 return GetDeoptId();
6818 } 6679 }
6819 6680
6820 virtual bool MayThrow() const { return false; } 6681 virtual bool MayThrow() const { return false; }
6821 6682
6822 virtual void PrintOperandsTo(BufferFormatter* f) const; 6683 virtual void PrintOperandsTo(BufferFormatter* f) const;
6823 6684
6824 DEFINE_INSTRUCTION_TYPE_CHECK(UnaryIntegerOp) 6685 DEFINE_INSTRUCTION_TYPE_CHECK(UnaryIntegerOp)
6825 6686
6826 private: 6687 private:
6827 const Token::Kind op_kind_; 6688 const Token::Kind op_kind_;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
6904 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); 6765 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr);
6905 }; 6766 };
6906 6767
6907 6768
6908 class BinaryIntegerOpInstr : public TemplateDefinition<2> { 6769 class BinaryIntegerOpInstr : public TemplateDefinition<2> {
6909 public: 6770 public:
6910 BinaryIntegerOpInstr(Token::Kind op_kind, 6771 BinaryIntegerOpInstr(Token::Kind op_kind,
6911 Value* left, 6772 Value* left,
6912 Value* right, 6773 Value* right,
6913 intptr_t deopt_id) 6774 intptr_t deopt_id)
6914 : op_kind_(op_kind), 6775 : TemplateDefinition<2>(deopt_id),
6776 op_kind_(op_kind),
6915 can_overflow_(true), 6777 can_overflow_(true),
6916 is_truncating_(false) { 6778 is_truncating_(false) {
6917 SetInputAt(0, left); 6779 SetInputAt(0, left);
6918 SetInputAt(1, right); 6780 SetInputAt(1, right);
6919 // Override generated deopt-id.
6920 deopt_id_ = deopt_id;
6921 } 6781 }
6922 6782
6923 static BinaryIntegerOpInstr* Make(Representation representation, 6783 static BinaryIntegerOpInstr* Make(Representation representation,
6924 Token::Kind op_kind, 6784 Token::Kind op_kind,
6925 Value* left, 6785 Value* left,
6926 Value* right, 6786 Value* right,
6927 intptr_t deopt_id, 6787 intptr_t deopt_id,
6928 bool can_overflow, 6788 bool can_overflow,
6929 bool is_truncating, 6789 bool is_truncating,
6930 Range* range); 6790 Range* range);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
6970 6830
6971 default: 6831 default:
6972 return false; 6832 return false;
6973 } 6833 }
6974 } 6834 }
6975 virtual bool AllowsCSE() const { return true; } 6835 virtual bool AllowsCSE() const { return true; }
6976 virtual EffectSet Effects() const { return EffectSet::None(); } 6836 virtual EffectSet Effects() const { return EffectSet::None(); }
6977 virtual EffectSet Dependencies() const { return EffectSet::None(); } 6837 virtual EffectSet Dependencies() const { return EffectSet::None(); }
6978 virtual bool AttributesEqual(Instruction* other) const; 6838 virtual bool AttributesEqual(Instruction* other) const;
6979 6839
6980 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 6840 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
6981 6841
6982 virtual bool MayThrow() const { return false; } 6842 virtual bool MayThrow() const { return false; }
6983 6843
6984 virtual void PrintOperandsTo(BufferFormatter* f) const; 6844 virtual void PrintOperandsTo(BufferFormatter* f) const;
6985 6845
6986 DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp) 6846 DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp)
6987 6847
6988 protected: 6848 protected:
6989 void InferRangeHelper(const Range* left_range, 6849 void InferRangeHelper(const Range* left_range,
6990 const Range* right_range, 6850 const Range* right_range,
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
7207 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); 7067 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr);
7208 }; 7068 };
7209 7069
7210 7070
7211 // Handles only NEGATE. 7071 // Handles only NEGATE.
7212 class UnaryDoubleOpInstr : public TemplateDefinition<1> { 7072 class UnaryDoubleOpInstr : public TemplateDefinition<1> {
7213 public: 7073 public:
7214 UnaryDoubleOpInstr(Token::Kind op_kind, 7074 UnaryDoubleOpInstr(Token::Kind op_kind,
7215 Value* value, 7075 Value* value,
7216 intptr_t deopt_id) 7076 intptr_t deopt_id)
7217 : op_kind_(op_kind) { 7077 : TemplateDefinition<1>(deopt_id), op_kind_(op_kind) {
7218 ASSERT(op_kind == Token::kNEGATE); 7078 ASSERT(op_kind == Token::kNEGATE);
7219 SetInputAt(0, value); 7079 SetInputAt(0, value);
7220 // Overriden generated deopt_id.
7221 deopt_id_ = deopt_id;
7222 } 7080 }
7223 7081
7224 Value* value() const { return inputs_[0]; } 7082 Value* value() const { return inputs_[0]; }
7225 Token::Kind op_kind() const { return op_kind_; } 7083 Token::Kind op_kind() const { return op_kind_; }
7226 7084
7227 virtual void PrintOperandsTo(BufferFormatter* f) const; 7085 virtual void PrintOperandsTo(BufferFormatter* f) const;
7228 7086
7229 DECLARE_INSTRUCTION(UnaryDoubleOp) 7087 DECLARE_INSTRUCTION(UnaryDoubleOp)
7230 virtual CompileType ComputeType() const; 7088 virtual CompileType ComputeType() const;
7231 7089
7232 virtual bool CanDeoptimize() const { return false; } 7090 virtual bool CanDeoptimize() const { return false; }
7233 7091
7234 virtual intptr_t DeoptimizationTarget() const { 7092 virtual intptr_t DeoptimizationTarget() const {
7235 // Direct access since this instruction cannot deoptimize, and the deopt-id 7093 // Direct access since this instruction cannot deoptimize, and the deopt-id
7236 // was inherited from another instruction that could deoptimize. 7094 // was inherited from another instruction that could deoptimize.
7237 return deopt_id_; 7095 return GetDeoptId();
7238 } 7096 }
7239 7097
7240 virtual Representation representation() const { 7098 virtual Representation representation() const {
7241 return kUnboxedDouble; 7099 return kUnboxedDouble;
7242 } 7100 }
7243 7101
7244 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7102 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7245 ASSERT(idx == 0); 7103 ASSERT(idx == 0);
7246 return kUnboxedDouble; 7104 return kUnboxedDouble;
7247 } 7105 }
7248 7106
7249 virtual bool AllowsCSE() const { return true; } 7107 virtual bool AllowsCSE() const { return true; }
7250 virtual EffectSet Effects() const { return EffectSet::None(); } 7108 virtual EffectSet Effects() const { return EffectSet::None(); }
7251 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7109 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7252 virtual bool AttributesEqual(Instruction* other) const { return true; } 7110 virtual bool AttributesEqual(Instruction* other) const { return true; }
7253 7111
7254 virtual bool MayThrow() const { return false; } 7112 virtual bool MayThrow() const { return false; }
7255 7113
7256 private: 7114 private:
7257 const Token::Kind op_kind_; 7115 const Token::Kind op_kind_;
7258 7116
7259 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); 7117 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr);
7260 }; 7118 };
7261 7119
7262 7120
7263 class CheckStackOverflowInstr : public TemplateInstruction<0> { 7121 class CheckStackOverflowInstr : public TemplateInstruction<0> {
7264 public: 7122 public:
7265 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth) 7123 CheckStackOverflowInstr(intptr_t token_pos, intptr_t loop_depth)
7266 : token_pos_(token_pos), loop_depth_(loop_depth) { 7124 : TemplateInstruction<0>(Isolate::Current()->GetNextDeoptId()),
7267 deopt_id_ = Isolate::Current()->GetNextDeoptId(); 7125 token_pos_(token_pos),
7126 loop_depth_(loop_depth) {
7268 } 7127 }
7269 7128
7270 virtual intptr_t token_pos() const { return token_pos_; } 7129 virtual intptr_t token_pos() const { return token_pos_; }
7271 bool in_loop() const { return loop_depth_ > 0; } 7130 bool in_loop() const { return loop_depth_ > 0; }
7272 intptr_t loop_depth() const { return loop_depth_; } 7131 intptr_t loop_depth() const { return loop_depth_; }
7273 7132
7274 DECLARE_INSTRUCTION(CheckStackOverflow) 7133 DECLARE_INSTRUCTION(CheckStackOverflow)
7275 7134
7276 virtual intptr_t ArgumentCount() const { return 0; } 7135 virtual intptr_t ArgumentCount() const { return 0; }
7277 7136
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
7355 virtual bool MayThrow() const { return false; } 7214 virtual bool MayThrow() const { return false; }
7356 7215
7357 private: 7216 private:
7358 DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr); 7217 DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr);
7359 }; 7218 };
7360 7219
7361 7220
7362 class MintToDoubleInstr : public TemplateDefinition<1> { 7221 class MintToDoubleInstr : public TemplateDefinition<1> {
7363 public: 7222 public:
7364 MintToDoubleInstr(Value* value, intptr_t deopt_id) 7223 MintToDoubleInstr(Value* value, intptr_t deopt_id)
7365 : deopt_id_(deopt_id) { 7224 : TemplateDefinition<1>(deopt_id) {
7366 SetInputAt(0, value); 7225 SetInputAt(0, value);
7367 } 7226 }
7368 7227
7369 Value* value() const { return inputs_[0]; } 7228 Value* value() const { return inputs_[0]; }
7370 7229
7371 DECLARE_INSTRUCTION(MintToDouble) 7230 DECLARE_INSTRUCTION(MintToDouble)
7372 virtual CompileType ComputeType() const; 7231 virtual CompileType ComputeType() const;
7373 7232
7374 virtual Representation RequiredInputRepresentation(intptr_t index) const { 7233 virtual Representation RequiredInputRepresentation(intptr_t index) const {
7375 ASSERT(index == 0); 7234 ASSERT(index == 0);
7376 return kUnboxedMint; 7235 return kUnboxedMint;
7377 } 7236 }
7378 7237
7379 virtual Representation representation() const { 7238 virtual Representation representation() const {
7380 return kUnboxedDouble; 7239 return kUnboxedDouble;
7381 } 7240 }
7382 7241
7383 virtual intptr_t DeoptimizationTarget() const { 7242 virtual intptr_t DeoptimizationTarget() const {
7384 // Direct access since this instruction cannot deoptimize, and the deopt-id 7243 // Direct access since this instruction cannot deoptimize, and the deopt-id
7385 // was inherited from another instruction that could deoptimize. 7244 // was inherited from another instruction that could deoptimize.
7386 return deopt_id_; 7245 return GetDeoptId();
7387 } 7246 }
7388 7247
7389 virtual bool CanDeoptimize() const { return false; } 7248 virtual bool CanDeoptimize() const { return false; }
7390 7249
7391 virtual bool AllowsCSE() const { return true; } 7250 virtual bool AllowsCSE() const { return true; }
7392 virtual EffectSet Effects() const { return EffectSet::None(); } 7251 virtual EffectSet Effects() const { return EffectSet::None(); }
7393 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7252 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7394 virtual bool AttributesEqual(Instruction* other) const { return true; } 7253 virtual bool AttributesEqual(Instruction* other) const { return true; }
7395 7254
7396 virtual bool MayThrow() const { return false; } 7255 virtual bool MayThrow() const { return false; }
7397 7256
7398 private: 7257 private:
7399 const intptr_t deopt_id_;
7400
7401 DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr); 7258 DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr);
7402 }; 7259 };
7403 7260
7404 7261
7405 class DoubleToIntegerInstr : public TemplateDefinition<1> { 7262 class DoubleToIntegerInstr : public TemplateDefinition<1> {
7406 public: 7263 public:
7407 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) 7264 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call)
7408 : instance_call_(instance_call) { 7265 : TemplateDefinition<1>(instance_call->deopt_id()),
7266 instance_call_(instance_call) {
7409 SetInputAt(0, value); 7267 SetInputAt(0, value);
7410 deopt_id_ = instance_call->deopt_id();
7411 } 7268 }
7412 7269
7413 Value* value() const { return inputs_[0]; } 7270 Value* value() const { return inputs_[0]; }
7414 InstanceCallInstr* instance_call() const { return instance_call_; } 7271 InstanceCallInstr* instance_call() const { return instance_call_; }
7415 7272
7416 DECLARE_INSTRUCTION(DoubleToInteger) 7273 DECLARE_INSTRUCTION(DoubleToInteger)
7417 virtual CompileType ComputeType() const; 7274 virtual CompileType ComputeType() const;
7418 7275
7419 virtual intptr_t ArgumentCount() const { return 1; } 7276 virtual intptr_t ArgumentCount() const { return 1; }
7420 7277
7421 virtual bool CanDeoptimize() const { return true; } 7278 virtual bool CanDeoptimize() const { return true; }
7422 7279
7423 virtual EffectSet Effects() const { return EffectSet::None(); } 7280 virtual EffectSet Effects() const { return EffectSet::None(); }
7424 7281
7425 virtual bool MayThrow() const { return true; } 7282 virtual bool MayThrow() const { return true; }
7426 7283
7427 private: 7284 private:
7428 InstanceCallInstr* instance_call_; 7285 InstanceCallInstr* instance_call_;
7429 7286
7430 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); 7287 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr);
7431 }; 7288 };
7432 7289
7433 7290
7434 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input 7291 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input
7435 // and creates a Smi. 7292 // and creates a Smi.
7436 class DoubleToSmiInstr : public TemplateDefinition<1> { 7293 class DoubleToSmiInstr : public TemplateDefinition<1> {
7437 public: 7294 public:
7438 DoubleToSmiInstr(Value* value, intptr_t deopt_id) { 7295 DoubleToSmiInstr(Value* value, intptr_t deopt_id)
7296 : TemplateDefinition<1>(deopt_id) {
7439 SetInputAt(0, value); 7297 SetInputAt(0, value);
7440 // Override generated deopt-id.
7441 deopt_id_ = deopt_id;
7442 } 7298 }
7443 7299
7444 Value* value() const { return inputs_[0]; } 7300 Value* value() const { return inputs_[0]; }
7445 7301
7446 DECLARE_INSTRUCTION(DoubleToSmi) 7302 DECLARE_INSTRUCTION(DoubleToSmi)
7447 virtual CompileType ComputeType() const; 7303 virtual CompileType ComputeType() const;
7448 7304
7449 virtual bool CanDeoptimize() const { return true; } 7305 virtual bool CanDeoptimize() const { return true; }
7450 7306
7451 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7307 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7452 ASSERT(idx == 0); 7308 ASSERT(idx == 0);
7453 return kUnboxedDouble; 7309 return kUnboxedDouble;
7454 } 7310 }
7455 7311
7456 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7312 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7457 7313
7458 virtual EffectSet Effects() const { return EffectSet::None(); } 7314 virtual EffectSet Effects() const { return EffectSet::None(); }
7459 7315
7460 virtual bool MayThrow() const { return false; } 7316 virtual bool MayThrow() const { return false; }
7461 7317
7462 private: 7318 private:
7463 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); 7319 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr);
7464 }; 7320 };
7465 7321
7466 7322
7467 class DoubleToDoubleInstr : public TemplateDefinition<1> { 7323 class DoubleToDoubleInstr : public TemplateDefinition<1> {
7468 public: 7324 public:
7469 DoubleToDoubleInstr(Value* value, 7325 DoubleToDoubleInstr(Value* value,
7470 MethodRecognizer::Kind recognized_kind, 7326 MethodRecognizer::Kind recognized_kind,
7471 intptr_t deopt_id) 7327 intptr_t deopt_id)
7472 : recognized_kind_(recognized_kind) { 7328 : TemplateDefinition<1>(deopt_id),
7329 recognized_kind_(recognized_kind) {
7473 SetInputAt(0, value); 7330 SetInputAt(0, value);
7474 // Override generated deopt-id.
7475 deopt_id_ = deopt_id;
7476 } 7331 }
7477 7332
7478 Value* value() const { return inputs_[0]; } 7333 Value* value() const { return inputs_[0]; }
7479 7334
7480 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 7335 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
7481 7336
7482 DECLARE_INSTRUCTION(DoubleToDouble) 7337 DECLARE_INSTRUCTION(DoubleToDouble)
7483 virtual CompileType ComputeType() const; 7338 virtual CompileType ComputeType() const;
7484 7339
7485 virtual bool CanDeoptimize() const { return false; } 7340 virtual bool CanDeoptimize() const { return false; }
7486 7341
7487 virtual Representation representation() const { 7342 virtual Representation representation() const {
7488 return kUnboxedDouble; 7343 return kUnboxedDouble;
7489 } 7344 }
7490 7345
7491 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7346 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7492 ASSERT(idx == 0); 7347 ASSERT(idx == 0);
7493 return kUnboxedDouble; 7348 return kUnboxedDouble;
7494 } 7349 }
7495 7350
7496 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7351 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7497 7352
7498 virtual bool AllowsCSE() const { return true; } 7353 virtual bool AllowsCSE() const { return true; }
7499 virtual EffectSet Effects() const { return EffectSet::None(); } 7354 virtual EffectSet Effects() const { return EffectSet::None(); }
7500 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7355 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7501 virtual bool AttributesEqual(Instruction* other) const { 7356 virtual bool AttributesEqual(Instruction* other) const {
7502 return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); 7357 return other->AsDoubleToDouble()->recognized_kind() == recognized_kind();
7503 } 7358 }
7504 7359
7505 virtual bool MayThrow() const { return false; } 7360 virtual bool MayThrow() const { return false; }
7506 7361
7507 private: 7362 private:
7508 const MethodRecognizer::Kind recognized_kind_; 7363 const MethodRecognizer::Kind recognized_kind_;
7509 7364
7510 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); 7365 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr);
7511 }; 7366 };
7512 7367
7513 7368
7514 class DoubleToFloatInstr: public TemplateDefinition<1> { 7369 class DoubleToFloatInstr: public TemplateDefinition<1> {
7515 public: 7370 public:
7516 DoubleToFloatInstr(Value* value, intptr_t deopt_id) { 7371 DoubleToFloatInstr(Value* value, intptr_t deopt_id)
7372 : TemplateDefinition<1>(deopt_id) {
7517 SetInputAt(0, value); 7373 SetInputAt(0, value);
7518 // Override generated deopt-id.
7519 deopt_id_ = deopt_id;
7520 } 7374 }
7521 7375
7522 Value* value() const { return inputs_[0]; } 7376 Value* value() const { return inputs_[0]; }
7523 7377
7524 DECLARE_INSTRUCTION(DoubleToFloat) 7378 DECLARE_INSTRUCTION(DoubleToFloat)
7525 7379
7526 virtual CompileType ComputeType() const; 7380 virtual CompileType ComputeType() const;
7527 7381
7528 virtual bool CanDeoptimize() const { return false; } 7382 virtual bool CanDeoptimize() const { return false; }
7529 7383
7530 virtual Representation representation() const { 7384 virtual Representation representation() const {
7531 // This works since double is the representation that the typed array 7385 // This works since double is the representation that the typed array
7532 // store expects. 7386 // store expects.
7533 // TODO(fschneider): Change this to a genuine float representation once it 7387 // TODO(fschneider): Change this to a genuine float representation once it
7534 // is supported. 7388 // is supported.
7535 return kUnboxedDouble; 7389 return kUnboxedDouble;
7536 } 7390 }
7537 7391
7538 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7392 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7539 ASSERT(idx == 0); 7393 ASSERT(idx == 0);
7540 return kUnboxedDouble; 7394 return kUnboxedDouble;
7541 } 7395 }
7542 7396
7543 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7397 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7544 7398
7545 virtual bool AllowsCSE() const { return true; } 7399 virtual bool AllowsCSE() const { return true; }
7546 virtual EffectSet Effects() const { return EffectSet::None(); } 7400 virtual EffectSet Effects() const { return EffectSet::None(); }
7547 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7401 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7548 virtual bool AttributesEqual(Instruction* other) const { return true; } 7402 virtual bool AttributesEqual(Instruction* other) const { return true; }
7549 7403
7550 virtual bool MayThrow() const { return false; } 7404 virtual bool MayThrow() const { return false; }
7551 7405
7552 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7406 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7553 7407
7554 private: 7408 private:
7555 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr); 7409 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr);
7556 }; 7410 };
7557 7411
7558 7412
7559 class FloatToDoubleInstr: public TemplateDefinition<1> { 7413 class FloatToDoubleInstr: public TemplateDefinition<1> {
7560 public: 7414 public:
7561 FloatToDoubleInstr(Value* value, intptr_t deopt_id) { 7415 FloatToDoubleInstr(Value* value, intptr_t deopt_id)
7416 : TemplateDefinition<1>(deopt_id) {
7562 SetInputAt(0, value); 7417 SetInputAt(0, value);
7563 // Override generated deopt-id.
7564 deopt_id_ = deopt_id;
7565 } 7418 }
7566 7419
7567 Value* value() const { return inputs_[0]; } 7420 Value* value() const { return inputs_[0]; }
7568 7421
7569 DECLARE_INSTRUCTION(FloatToDouble) 7422 DECLARE_INSTRUCTION(FloatToDouble)
7570 7423
7571 virtual CompileType ComputeType() const; 7424 virtual CompileType ComputeType() const;
7572 7425
7573 virtual bool CanDeoptimize() const { return false; } 7426 virtual bool CanDeoptimize() const { return false; }
7574 7427
7575 virtual Representation representation() const { 7428 virtual Representation representation() const {
7576 return kUnboxedDouble; 7429 return kUnboxedDouble;
7577 } 7430 }
7578 7431
7579 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7432 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7580 ASSERT(idx == 0); 7433 ASSERT(idx == 0);
7581 return kUnboxedDouble; 7434 return kUnboxedDouble;
7582 } 7435 }
7583 7436
7584 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7437 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7585 7438
7586 virtual bool AllowsCSE() const { return true; } 7439 virtual bool AllowsCSE() const { return true; }
7587 virtual EffectSet Effects() const { return EffectSet::None(); } 7440 virtual EffectSet Effects() const { return EffectSet::None(); }
7588 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7441 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7589 virtual bool AttributesEqual(Instruction* other) const { return true; } 7442 virtual bool AttributesEqual(Instruction* other) const { return true; }
7590 7443
7591 virtual bool MayThrow() const { return false; } 7444 virtual bool MayThrow() const { return false; }
7592 7445
7593 virtual Definition* Canonicalize(FlowGraph* flow_graph); 7446 virtual Definition* Canonicalize(FlowGraph* flow_graph);
7594 7447
7595 private: 7448 private:
7596 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); 7449 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr);
7597 }; 7450 };
7598 7451
7599 7452
7600 class InvokeMathCFunctionInstr : public Definition { 7453 class InvokeMathCFunctionInstr : public Definition {
7601 public: 7454 public:
7602 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, 7455 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs,
7603 intptr_t original_deopt_id, 7456 intptr_t deopt_id,
7604 MethodRecognizer::Kind recognized_kind, 7457 MethodRecognizer::Kind recognized_kind,
7605 intptr_t token_pos); 7458 intptr_t token_pos);
7606 7459
7607 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); 7460 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_);
7608 7461
7609 const RuntimeEntry& TargetFunction() const; 7462 const RuntimeEntry& TargetFunction() const;
7610 7463
7611 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; } 7464 MethodRecognizer::Kind recognized_kind() const { return recognized_kind_; }
7612 7465
7613 virtual intptr_t token_pos() const { return token_pos_; } 7466 virtual intptr_t token_pos() const { return token_pos_; }
7614 7467
7615 DECLARE_INSTRUCTION(InvokeMathCFunction) 7468 DECLARE_INSTRUCTION(InvokeMathCFunction)
7616 virtual CompileType ComputeType() const; 7469 virtual CompileType ComputeType() const;
7617 virtual void PrintOperandsTo(BufferFormatter* f) const; 7470 virtual void PrintOperandsTo(BufferFormatter* f) const;
7618 7471
7619 virtual bool CanDeoptimize() const { return false; } 7472 virtual bool CanDeoptimize() const { return false; }
7620 7473
7621 virtual Representation representation() const { 7474 virtual Representation representation() const {
7622 return kUnboxedDouble; 7475 return kUnboxedDouble;
7623 } 7476 }
7624 7477
7625 virtual Representation RequiredInputRepresentation(intptr_t idx) const { 7478 virtual Representation RequiredInputRepresentation(intptr_t idx) const {
7626 ASSERT((0 <= idx) && (idx < InputCount())); 7479 ASSERT((0 <= idx) && (idx < InputCount()));
7627 return kUnboxedDouble; 7480 return kUnboxedDouble;
7628 } 7481 }
7629 7482
7630 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7483 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7631 7484
7632 virtual intptr_t InputCount() const { 7485 virtual intptr_t InputCount() const {
7633 return inputs_->length(); 7486 return inputs_->length();
7634 } 7487 }
7635 7488
7636 virtual Value* InputAt(intptr_t i) const { 7489 virtual Value* InputAt(intptr_t i) const {
7637 return (*inputs_)[i]; 7490 return (*inputs_)[i];
7638 } 7491 }
7639 7492
7640 virtual bool AllowsCSE() const { return true; } 7493 virtual bool AllowsCSE() const { return true; }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
7784 if (kind_ == kTruncDivMod) { 7637 if (kind_ == kTruncDivMod) {
7785 return kTagged; 7638 return kTagged;
7786 } else if (kind_ == kSinCos) { 7639 } else if (kind_ == kSinCos) {
7787 return kUnboxedDouble; 7640 return kUnboxedDouble;
7788 } else { 7641 } else {
7789 UNIMPLEMENTED(); 7642 UNIMPLEMENTED();
7790 return kTagged; 7643 return kTagged;
7791 } 7644 }
7792 } 7645 }
7793 7646
7794 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } 7647 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); }
7795 7648
7796 DECLARE_INSTRUCTION(MergedMath) 7649 DECLARE_INSTRUCTION(MergedMath)
7797 7650
7798 virtual bool AllowsCSE() const { return true; } 7651 virtual bool AllowsCSE() const { return true; }
7799 virtual EffectSet Effects() const { return EffectSet::None(); } 7652 virtual EffectSet Effects() const { return EffectSet::None(); }
7800 virtual EffectSet Dependencies() const { return EffectSet::None(); } 7653 virtual EffectSet Dependencies() const { return EffectSet::None(); }
7801 virtual bool AttributesEqual(Instruction* other) const { 7654 virtual bool AttributesEqual(Instruction* other) const {
7802 MergedMathInstr* other_invoke = other->AsMergedMath(); 7655 MergedMathInstr* other_invoke = other->AsMergedMath();
7803 return other_invoke->kind() == kind(); 7656 return other_invoke->kind() == kind();
7804 } 7657 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
7867 GrowableArray<intptr_t> cids_; // Sorted, lowest first. 7720 GrowableArray<intptr_t> cids_; // Sorted, lowest first.
7868 bool licm_hoisted_; 7721 bool licm_hoisted_;
7869 const intptr_t token_pos_; 7722 const intptr_t token_pos_;
7870 7723
7871 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); 7724 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr);
7872 }; 7725 };
7873 7726
7874 7727
7875 class CheckSmiInstr : public TemplateInstruction<1> { 7728 class CheckSmiInstr : public TemplateInstruction<1> {
7876 public: 7729 public:
7877 CheckSmiInstr(Value* value, intptr_t original_deopt_id, intptr_t token_pos) 7730 CheckSmiInstr(Value* value, intptr_t deopt_id, intptr_t token_pos)
7878 : token_pos_(token_pos), licm_hoisted_(false) { 7731 : TemplateInstruction<1>(deopt_id),
7732 token_pos_(token_pos),
7733 licm_hoisted_(false) {
7879 SetInputAt(0, value); 7734 SetInputAt(0, value);
7880 deopt_id_ = original_deopt_id;
7881 } 7735 }
7882 7736
7883 Value* value() const { return inputs_[0]; } 7737 Value* value() const { return inputs_[0]; }
7884 virtual intptr_t token_pos() const { return token_pos_; } 7738 virtual intptr_t token_pos() const { return token_pos_; }
7885 7739
7886 DECLARE_INSTRUCTION(CheckSmi) 7740 DECLARE_INSTRUCTION(CheckSmi)
7887 7741
7888 virtual intptr_t ArgumentCount() const { return 0; } 7742 virtual intptr_t ArgumentCount() const { return 0; }
7889 7743
7890 virtual bool CanDeoptimize() const { return true; } 7744 virtual bool CanDeoptimize() const { return true; }
(...skipping 12 matching lines...) Expand all
7903 private: 7757 private:
7904 const intptr_t token_pos_; 7758 const intptr_t token_pos_;
7905 bool licm_hoisted_; 7759 bool licm_hoisted_;
7906 7760
7907 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); 7761 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr);
7908 }; 7762 };
7909 7763
7910 7764
7911 class CheckClassIdInstr : public TemplateInstruction<1> { 7765 class CheckClassIdInstr : public TemplateInstruction<1> {
7912 public: 7766 public:
7913 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id) : cid_(cid) { 7767 CheckClassIdInstr(Value* value, intptr_t cid, intptr_t deopt_id)
7768 : TemplateInstruction<1>(deopt_id), cid_(cid) {
7914 SetInputAt(0, value); 7769 SetInputAt(0, value);
7915 // Override generated deopt-id.
7916 deopt_id_ = deopt_id;
7917 } 7770 }
7918 7771
7919 Value* value() const { return inputs_[0]; } 7772 Value* value() const { return inputs_[0]; }
7920 intptr_t cid() const { return cid_; } 7773 intptr_t cid() const { return cid_; }
7921 7774
7922 DECLARE_INSTRUCTION(CheckClassId) 7775 DECLARE_INSTRUCTION(CheckClassId)
7923 7776
7924 virtual intptr_t ArgumentCount() const { return 0; } 7777 virtual intptr_t ArgumentCount() const { return 0; }
7925 7778
7926 virtual bool CanDeoptimize() const { return true; } 7779 virtual bool CanDeoptimize() const { return true; }
(...skipping 12 matching lines...) Expand all
7939 private: 7792 private:
7940 intptr_t cid_; 7793 intptr_t cid_;
7941 7794
7942 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); 7795 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr);
7943 }; 7796 };
7944 7797
7945 7798
7946 class CheckArrayBoundInstr : public TemplateInstruction<2> { 7799 class CheckArrayBoundInstr : public TemplateInstruction<2> {
7947 public: 7800 public:
7948 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) 7801 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id)
7949 : generalized_(false), licm_hoisted_(false) { 7802 : TemplateInstruction<2>(deopt_id),
7803 generalized_(false),
7804 licm_hoisted_(false) {
7950 SetInputAt(kLengthPos, length); 7805 SetInputAt(kLengthPos, length);
7951 SetInputAt(kIndexPos, index); 7806 SetInputAt(kIndexPos, index);
7952 // Override generated deopt-id.
7953 deopt_id_ = deopt_id;
7954 } 7807 }
7955 7808
7956 Value* length() const { return inputs_[kLengthPos]; } 7809 Value* length() const { return inputs_[kLengthPos]; }
7957 Value* index() const { return inputs_[kIndexPos]; } 7810 Value* index() const { return inputs_[kIndexPos]; }
7958 7811
7959 DECLARE_INSTRUCTION(CheckArrayBound) 7812 DECLARE_INSTRUCTION(CheckArrayBound)
7960 7813
7961 virtual intptr_t ArgumentCount() const { return 0; } 7814 virtual intptr_t ArgumentCount() const { return 0; }
7962 7815
7963 virtual bool CanDeoptimize() const { return true; } 7816 virtual bool CanDeoptimize() const { return true; }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
8069 private: 7922 private:
8070 DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr); 7923 DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr);
8071 }; 7924 };
8072 7925
8073 7926
8074 class UnboxIntNInstr : public TemplateDefinition<1> { 7927 class UnboxIntNInstr : public TemplateDefinition<1> {
8075 public: 7928 public:
8076 UnboxIntNInstr(Representation representation, 7929 UnboxIntNInstr(Representation representation,
8077 Value* value, 7930 Value* value,
8078 intptr_t deopt_id) 7931 intptr_t deopt_id)
8079 : representation_(representation), 7932 : TemplateDefinition<1>(deopt_id),
7933 representation_(representation),
8080 is_truncating_(representation == kUnboxedUint32) { 7934 is_truncating_(representation == kUnboxedUint32) {
8081 SetInputAt(0, value); 7935 SetInputAt(0, value);
8082 deopt_id_ = deopt_id;
8083 } 7936 }
8084 7937
8085 Value* value() const { return inputs_[0]; } 7938 Value* value() const { return inputs_[0]; }
8086 7939
8087 bool is_truncating() const { return is_truncating_; } 7940 bool is_truncating() const { return is_truncating_; }
8088 void mark_truncating() { is_truncating_ = true; } 7941 void mark_truncating() { is_truncating_ = true; }
8089 7942
8090 virtual Representation representation() const { 7943 virtual Representation representation() const {
8091 return representation_; 7944 return representation_;
8092 } 7945 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
8156 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); 8009 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr);
8157 }; 8010 };
8158 8011
8159 8012
8160 class UnboxedIntConverterInstr : public TemplateDefinition<1> { 8013 class UnboxedIntConverterInstr : public TemplateDefinition<1> {
8161 public: 8014 public:
8162 UnboxedIntConverterInstr(Representation from, 8015 UnboxedIntConverterInstr(Representation from,
8163 Representation to, 8016 Representation to,
8164 Value* value, 8017 Value* value,
8165 intptr_t deopt_id) 8018 intptr_t deopt_id)
8166 : from_representation_(from), 8019 : TemplateDefinition<1>(deopt_id),
8020 from_representation_(from),
8167 to_representation_(to), 8021 to_representation_(to),
8168 is_truncating_(to == kUnboxedUint32) { 8022 is_truncating_(to == kUnboxedUint32) {
8169 ASSERT(from != to); 8023 ASSERT(from != to);
8170 ASSERT((from == kUnboxedMint) || 8024 ASSERT((from == kUnboxedMint) ||
8171 (from == kUnboxedUint32) || 8025 (from == kUnboxedUint32) ||
8172 (from == kUnboxedInt32)); 8026 (from == kUnboxedInt32));
8173 ASSERT((to == kUnboxedMint) || 8027 ASSERT((to == kUnboxedMint) ||
8174 (to == kUnboxedUint32) || 8028 (to == kUnboxedUint32) ||
8175 (to == kUnboxedInt32)); 8029 (to == kUnboxedInt32));
8176 ASSERT((to != kUnboxedInt32) || (deopt_id != Isolate::kNoDeoptId)); 8030 ASSERT((to != kUnboxedInt32) || (deopt_id != Isolate::kNoDeoptId));
8177 SetInputAt(0, value); 8031 SetInputAt(0, value);
8178 deopt_id_ = deopt_id;
8179 } 8032 }
8180 8033
8181 Value* value() const { return inputs_[0]; } 8034 Value* value() const { return inputs_[0]; }
8182 8035
8183 Representation from() const { return from_representation_; } 8036 Representation from() const { return from_representation_; }
8184 Representation to() const { return to_representation_; } 8037 Representation to() const { return to_representation_; }
8185 bool is_truncating() const { return is_truncating_; } 8038 bool is_truncating() const { return is_truncating_; }
8186 8039
8187 void mark_truncating() { is_truncating_ = true; } 8040 void mark_truncating() { is_truncating_ = true; }
8188 8041
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
8459 Isolate* isolate, bool opt) const { \ 8312 Isolate* isolate, bool opt) const { \
8460 UNIMPLEMENTED(); \ 8313 UNIMPLEMENTED(); \
8461 return NULL; \ 8314 return NULL; \
8462 } \ 8315 } \
8463 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 8316 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
8464 8317
8465 8318
8466 } // namespace dart 8319 } // namespace dart
8467 8320
8468 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 8321 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/il_printer.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698