| OLD | NEW |
| 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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define RUNTIME_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/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 private: | 171 private: |
| 172 bool CanComputeIsInstanceOf(const AbstractType& type, | 172 bool CanComputeIsInstanceOf(const AbstractType& type, |
| 173 bool is_nullable, | 173 bool is_nullable, |
| 174 bool* is_instance); | 174 bool* is_instance); |
| 175 | 175 |
| 176 bool is_nullable_; | 176 bool is_nullable_; |
| 177 intptr_t cid_; | 177 intptr_t cid_; |
| 178 const AbstractType* type_; | 178 const AbstractType* type_; |
| 179 }; | 179 }; |
| 180 | 180 |
| 181 // TODO(dartbug.com/30474): remove EffectSet as there are no tracked effects | |
| 182 // anymore. | |
| 183 class EffectSet : public ValueObject { | |
| 184 public: | |
| 185 enum Effects { | |
| 186 kNoEffects = 0, | |
| 187 kUnusedEffect = 1, // Currently unused. | |
| 188 kLastEffect = kUnusedEffect | |
| 189 }; | |
| 190 | |
| 191 EffectSet(const EffectSet& other) : ValueObject(), effects_(other.effects_) {} | |
| 192 | |
| 193 bool IsNone() const { return effects_ == kNoEffects; } | |
| 194 | |
| 195 static EffectSet None() { return EffectSet(kNoEffects); } | |
| 196 static EffectSet All() { | |
| 197 ASSERT(EffectSet::kLastEffect == 1); | |
| 198 return EffectSet(kUnusedEffect); | |
| 199 } | |
| 200 | |
| 201 bool ToInt() { return effects_; } | |
| 202 | |
| 203 private: | |
| 204 explicit EffectSet(intptr_t effects) : effects_(effects) {} | |
| 205 | |
| 206 intptr_t effects_; | |
| 207 }; | |
| 208 | |
| 209 class Value : public ZoneAllocated { | 181 class Value : public ZoneAllocated { |
| 210 public: | 182 public: |
| 211 // A forward iterator that allows removing the current value from the | 183 // A forward iterator that allows removing the current value from the |
| 212 // underlying use list during iteration. | 184 // underlying use list during iteration. |
| 213 class Iterator { | 185 class Iterator { |
| 214 public: | 186 public: |
| 215 explicit Iterator(Value* head) : next_(head) { Advance(); } | 187 explicit Iterator(Value* head) : next_(head) { Advance(); } |
| 216 Value* Current() const { return current_; } | 188 Value* Current() const { return current_; } |
| 217 bool Done() const { return current_ == NULL; } | 189 bool Done() const { return current_ == NULL; } |
| 218 void Advance() { | 190 void Advance() { |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 // instruction. | 842 // instruction. |
| 871 Instruction* AppendInstruction(Instruction* tail); | 843 Instruction* AppendInstruction(Instruction* tail); |
| 872 | 844 |
| 873 // Returns true if CSE and LICM are allowed for this instruction. | 845 // Returns true if CSE and LICM are allowed for this instruction. |
| 874 virtual bool AllowsCSE() const { return false; } | 846 virtual bool AllowsCSE() const { return false; } |
| 875 | 847 |
| 876 // Returns true if this instruction has any side-effects besides storing. | 848 // Returns true if this instruction has any side-effects besides storing. |
| 877 // See StoreInstanceFieldInstr::HasUnknownSideEffects() for rationale. | 849 // See StoreInstanceFieldInstr::HasUnknownSideEffects() for rationale. |
| 878 virtual bool HasUnknownSideEffects() const = 0; | 850 virtual bool HasUnknownSideEffects() const = 0; |
| 879 | 851 |
| 880 // Returns set of effects that affect this instruction. | |
| 881 virtual EffectSet Dependencies() const { | |
| 882 UNREACHABLE(); | |
| 883 return EffectSet::All(); | |
| 884 } | |
| 885 | |
| 886 // Get the block entry for this instruction. | 852 // Get the block entry for this instruction. |
| 887 virtual BlockEntryInstr* GetBlock(); | 853 virtual BlockEntryInstr* GetBlock(); |
| 888 | 854 |
| 889 // Place identifiers used by the load optimization pass. | 855 // Place identifiers used by the load optimization pass. |
| 890 intptr_t place_id() const { return place_id_; } | 856 intptr_t place_id() const { return place_id_; } |
| 891 void set_place_id(intptr_t place_id) { place_id_ = place_id; } | 857 void set_place_id(intptr_t place_id) { place_id_ = place_id; } |
| 892 bool HasPlaceId() const { return place_id_ != kNoPlaceId; } | 858 bool HasPlaceId() const { return place_id_ != kNoPlaceId; } |
| 893 | 859 |
| 894 intptr_t inlining_id() const { return inlining_id_; } | 860 intptr_t inlining_id() const { return inlining_id_; } |
| 895 void set_inlining_id(intptr_t value) { | 861 void set_inlining_id(intptr_t value) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 Label* true_label; | 945 Label* true_label; |
| 980 Label* false_label; | 946 Label* false_label; |
| 981 Label* fall_through; | 947 Label* fall_through; |
| 982 }; | 948 }; |
| 983 | 949 |
| 984 class PureInstruction : public Instruction { | 950 class PureInstruction : public Instruction { |
| 985 public: | 951 public: |
| 986 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} | 952 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} |
| 987 | 953 |
| 988 virtual bool AllowsCSE() const { return true; } | 954 virtual bool AllowsCSE() const { return true; } |
| 989 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 990 | |
| 991 virtual bool HasUnknownSideEffects() const { return false; } | 955 virtual bool HasUnknownSideEffects() const { return false; } |
| 992 }; | 956 }; |
| 993 | 957 |
| 994 // Types to be used as ThrowsTrait for TemplateInstruction/TemplateDefinition. | 958 // Types to be used as ThrowsTrait for TemplateInstruction/TemplateDefinition. |
| 995 struct Throws { | 959 struct Throws { |
| 996 static const bool kCanThrow = true; | 960 static const bool kCanThrow = true; |
| 997 }; | 961 }; |
| 998 | 962 |
| 999 struct NoThrow { | 963 struct NoThrow { |
| 1000 static const bool kCanThrow = false; | 964 static const bool kCanThrow = false; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 | 1063 |
| 1100 virtual intptr_t ArgumentCount() const { return 0; } | 1064 virtual intptr_t ArgumentCount() const { return 0; } |
| 1101 | 1065 |
| 1102 virtual bool ComputeCanDeoptimize() const { return false; } | 1066 virtual bool ComputeCanDeoptimize() const { return false; } |
| 1103 | 1067 |
| 1104 virtual bool HasUnknownSideEffects() const { | 1068 virtual bool HasUnknownSideEffects() const { |
| 1105 UNREACHABLE(); // This instruction never visited by optimization passes. | 1069 UNREACHABLE(); // This instruction never visited by optimization passes. |
| 1106 return false; | 1070 return false; |
| 1107 } | 1071 } |
| 1108 | 1072 |
| 1109 virtual EffectSet Dependencies() const { | |
| 1110 UNREACHABLE(); // This instruction never visited by optimization passes. | |
| 1111 return EffectSet::None(); | |
| 1112 } | |
| 1113 | |
| 1114 MoveOperands* AddMove(Location dest, Location src) { | 1073 MoveOperands* AddMove(Location dest, Location src) { |
| 1115 MoveOperands* move = new MoveOperands(dest, src); | 1074 MoveOperands* move = new MoveOperands(dest, src); |
| 1116 moves_.Add(move); | 1075 moves_.Add(move); |
| 1117 return move; | 1076 return move; |
| 1118 } | 1077 } |
| 1119 | 1078 |
| 1120 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } | 1079 MoveOperands* MoveOperandsAt(intptr_t index) const { return moves_[index]; } |
| 1121 | 1080 |
| 1122 intptr_t NumMoves() const { return moves_.length(); } | 1081 intptr_t NumMoves() const { return moves_.length(); } |
| 1123 | 1082 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 | 1178 |
| 1220 virtual bool CanBecomeDeoptimizationTarget() const { | 1179 virtual bool CanBecomeDeoptimizationTarget() const { |
| 1221 // BlockEntry environment is copied to Goto and Branch instructions | 1180 // BlockEntry environment is copied to Goto and Branch instructions |
| 1222 // when we insert new blocks targeting this block. | 1181 // when we insert new blocks targeting this block. |
| 1223 return true; | 1182 return true; |
| 1224 } | 1183 } |
| 1225 | 1184 |
| 1226 virtual bool ComputeCanDeoptimize() const { return false; } | 1185 virtual bool ComputeCanDeoptimize() const { return false; } |
| 1227 | 1186 |
| 1228 virtual bool HasUnknownSideEffects() const { return false; } | 1187 virtual bool HasUnknownSideEffects() const { return false; } |
| 1229 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 1230 | 1188 |
| 1231 virtual bool MayThrow() const { return false; } | 1189 virtual bool MayThrow() const { return false; } |
| 1232 | 1190 |
| 1233 intptr_t try_index() const { return try_index_; } | 1191 intptr_t try_index() const { return try_index_; } |
| 1234 void set_try_index(intptr_t index) { try_index_ = index; } | 1192 void set_try_index(intptr_t index) { try_index_ = index; } |
| 1235 | 1193 |
| 1236 // True for blocks inside a try { } region. | 1194 // True for blocks inside a try { } region. |
| 1237 bool InsideTryBlock() const { | 1195 bool InsideTryBlock() const { |
| 1238 return try_index_ != CatchClauseNode::kInvalidTryIndex; | 1196 return try_index_ != CatchClauseNode::kInvalidTryIndex; |
| 1239 } | 1197 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 | 1423 |
| 1466 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } | 1424 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } |
| 1467 | 1425 |
| 1468 PhiInstr* InsertPhi(intptr_t var_index, intptr_t var_count); | 1426 PhiInstr* InsertPhi(intptr_t var_index, intptr_t var_count); |
| 1469 void RemoveDeadPhis(Definition* replacement); | 1427 void RemoveDeadPhis(Definition* replacement); |
| 1470 | 1428 |
| 1471 void InsertPhi(PhiInstr* phi); | 1429 void InsertPhi(PhiInstr* phi); |
| 1472 void RemovePhi(PhiInstr* phi); | 1430 void RemovePhi(PhiInstr* phi); |
| 1473 | 1431 |
| 1474 virtual bool HasUnknownSideEffects() const { return false; } | 1432 virtual bool HasUnknownSideEffects() const { return false; } |
| 1475 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 1476 | 1433 |
| 1477 PRINT_TO_SUPPORT | 1434 PRINT_TO_SUPPORT |
| 1478 | 1435 |
| 1479 private: | 1436 private: |
| 1480 // Classes that have access to predecessors_ when inlining. | 1437 // Classes that have access to predecessors_ when inlining. |
| 1481 friend class BlockEntryInstr; | 1438 friend class BlockEntryInstr; |
| 1482 friend class InlineExitCollector; | 1439 friend class InlineExitCollector; |
| 1483 friend class PolymorphicInliner; | 1440 friend class PolymorphicInliner; |
| 1484 friend class IndirectEntryInstr; // Access in il_printer.cc. | 1441 friend class IndirectEntryInstr; // Access in il_printer.cc. |
| 1485 | 1442 |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 RemoveFromUseList(); | 1834 RemoveFromUseList(); |
| 1878 set_definition(def); | 1835 set_definition(def); |
| 1879 def->AddEnvUse(this); | 1836 def->AddEnvUse(this); |
| 1880 } | 1837 } |
| 1881 | 1838 |
| 1882 class PureDefinition : public Definition { | 1839 class PureDefinition : public Definition { |
| 1883 public: | 1840 public: |
| 1884 explicit PureDefinition(intptr_t deopt_id) : Definition(deopt_id) {} | 1841 explicit PureDefinition(intptr_t deopt_id) : Definition(deopt_id) {} |
| 1885 | 1842 |
| 1886 virtual bool AllowsCSE() const { return true; } | 1843 virtual bool AllowsCSE() const { return true; } |
| 1887 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 1888 | |
| 1889 virtual bool HasUnknownSideEffects() const { return false; } | 1844 virtual bool HasUnknownSideEffects() const { return false; } |
| 1890 }; | 1845 }; |
| 1891 | 1846 |
| 1892 template <intptr_t N, | 1847 template <intptr_t N, |
| 1893 typename ThrowsTrait, | 1848 typename ThrowsTrait, |
| 1894 template <typename Impure, typename Pure> class CSETrait = NoCSE> | 1849 template <typename Impure, typename Pure> class CSETrait = NoCSE> |
| 1895 class TemplateDefinition : public CSETrait<Definition, PureDefinition>::Base { | 1850 class TemplateDefinition : public CSETrait<Definition, PureDefinition>::Base { |
| 1896 public: | 1851 public: |
| 1897 explicit TemplateDefinition(intptr_t deopt_id = Thread::kNoDeoptId) | 1852 explicit TemplateDefinition(intptr_t deopt_id = Thread::kNoDeoptId) |
| 1898 : CSETrait<Definition, PureDefinition>::Base(deopt_id), inputs_() {} | 1853 : CSETrait<Definition, PureDefinition>::Base(deopt_id), inputs_() {} |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 | 1985 |
| 2031 intptr_t InputCount() const { return 0; } | 1986 intptr_t InputCount() const { return 0; } |
| 2032 Value* InputAt(intptr_t i) const { | 1987 Value* InputAt(intptr_t i) const { |
| 2033 UNREACHABLE(); | 1988 UNREACHABLE(); |
| 2034 return NULL; | 1989 return NULL; |
| 2035 } | 1990 } |
| 2036 | 1991 |
| 2037 virtual bool ComputeCanDeoptimize() const { return false; } | 1992 virtual bool ComputeCanDeoptimize() const { return false; } |
| 2038 | 1993 |
| 2039 virtual bool HasUnknownSideEffects() const { return false; } | 1994 virtual bool HasUnknownSideEffects() const { return false; } |
| 2040 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 2041 | 1995 |
| 2042 virtual intptr_t Hashcode() const { | 1996 virtual intptr_t Hashcode() const { |
| 2043 UNREACHABLE(); | 1997 UNREACHABLE(); |
| 2044 return 0; | 1998 return 0; |
| 2045 } | 1999 } |
| 2046 | 2000 |
| 2047 virtual CompileType ComputeType() const; | 2001 virtual CompileType ComputeType() const; |
| 2048 | 2002 |
| 2049 virtual bool MayThrow() const { return false; } | 2003 virtual bool MayThrow() const { return false; } |
| 2050 | 2004 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2175 const char* message() const { return message_; } | 2129 const char* message() const { return message_; } |
| 2176 | 2130 |
| 2177 DECLARE_INSTRUCTION(Stop); | 2131 DECLARE_INSTRUCTION(Stop); |
| 2178 | 2132 |
| 2179 virtual intptr_t ArgumentCount() const { return 0; } | 2133 virtual intptr_t ArgumentCount() const { return 0; } |
| 2180 | 2134 |
| 2181 virtual bool ComputeCanDeoptimize() const { return false; } | 2135 virtual bool ComputeCanDeoptimize() const { return false; } |
| 2182 | 2136 |
| 2183 virtual bool HasUnknownSideEffects() const { return false; } | 2137 virtual bool HasUnknownSideEffects() const { return false; } |
| 2184 | 2138 |
| 2185 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 2186 | |
| 2187 private: | 2139 private: |
| 2188 const char* message_; | 2140 const char* message_; |
| 2189 | 2141 |
| 2190 DISALLOW_COPY_AND_ASSIGN(StopInstr); | 2142 DISALLOW_COPY_AND_ASSIGN(StopInstr); |
| 2191 }; | 2143 }; |
| 2192 | 2144 |
| 2193 class GotoInstr : public TemplateInstruction<0, NoThrow> { | 2145 class GotoInstr : public TemplateInstruction<0, NoThrow> { |
| 2194 public: | 2146 public: |
| 2195 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id) | 2147 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id) |
| 2196 : TemplateInstruction(deopt_id), | 2148 : TemplateInstruction(deopt_id), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 const TokenPosition token_pos_; | 2331 const TokenPosition token_pos_; |
| 2380 Token::Kind kind_; | 2332 Token::Kind kind_; |
| 2381 intptr_t operation_cid_; // Set by optimizer. | 2333 intptr_t operation_cid_; // Set by optimizer. |
| 2382 | 2334 |
| 2383 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); | 2335 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); |
| 2384 }; | 2336 }; |
| 2385 | 2337 |
| 2386 class PureComparison : public ComparisonInstr { | 2338 class PureComparison : public ComparisonInstr { |
| 2387 public: | 2339 public: |
| 2388 virtual bool AllowsCSE() const { return true; } | 2340 virtual bool AllowsCSE() const { return true; } |
| 2389 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 2390 | |
| 2391 virtual bool HasUnknownSideEffects() const { return false; } | 2341 virtual bool HasUnknownSideEffects() const { return false; } |
| 2392 | 2342 |
| 2393 protected: | 2343 protected: |
| 2394 PureComparison(TokenPosition token_pos, Token::Kind kind, intptr_t deopt_id) | 2344 PureComparison(TokenPosition token_pos, Token::Kind kind, intptr_t deopt_id) |
| 2395 : ComparisonInstr(token_pos, kind, deopt_id) {} | 2345 : ComparisonInstr(token_pos, kind, deopt_id) {} |
| 2396 }; | 2346 }; |
| 2397 | 2347 |
| 2398 template <intptr_t N, | 2348 template <intptr_t N, |
| 2399 typename ThrowsTrait, | 2349 typename ThrowsTrait, |
| 2400 template <typename Impure, typename Pure> class CSETrait = NoCSE> | 2350 template <typename Impure, typename Pure> class CSETrait = NoCSE> |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 | 2481 |
| 2532 virtual CompileType ComputeType() const; | 2482 virtual CompileType ComputeType() const; |
| 2533 virtual bool RecomputeType(); | 2483 virtual bool RecomputeType(); |
| 2534 | 2484 |
| 2535 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2485 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 2536 | 2486 |
| 2537 void set_constrained_type(CompileType* type) { constrained_type_ = type; } | 2487 void set_constrained_type(CompileType* type) { constrained_type_ = type; } |
| 2538 CompileType* constrained_type() const { return constrained_type_; } | 2488 CompileType* constrained_type() const { return constrained_type_; } |
| 2539 | 2489 |
| 2540 virtual bool ComputeCanDeoptimize() const { return false; } | 2490 virtual bool ComputeCanDeoptimize() const { return false; } |
| 2541 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 2542 virtual bool HasUnknownSideEffects() const { return false; } | 2491 virtual bool HasUnknownSideEffects() const { return false; } |
| 2543 | 2492 |
| 2544 private: | 2493 private: |
| 2545 CompileType* constrained_type_; | 2494 CompileType* constrained_type_; |
| 2546 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); | 2495 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); |
| 2547 }; | 2496 }; |
| 2548 | 2497 |
| 2549 class ConstraintInstr : public TemplateDefinition<1, NoThrow> { | 2498 class ConstraintInstr : public TemplateDefinition<1, NoThrow> { |
| 2550 public: | 2499 public: |
| 2551 ConstraintInstr(Value* value, Range* constraint) | 2500 ConstraintInstr(Value* value, Range* constraint) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2730 enum SpecialParameterKind { kContext, kTypeArgs }; | 2679 enum SpecialParameterKind { kContext, kTypeArgs }; |
| 2731 SpecialParameterInstr(SpecialParameterKind kind, intptr_t deopt_id) | 2680 SpecialParameterInstr(SpecialParameterKind kind, intptr_t deopt_id) |
| 2732 : TemplateDefinition(deopt_id), kind_(kind) {} | 2681 : TemplateDefinition(deopt_id), kind_(kind) {} |
| 2733 | 2682 |
| 2734 DECLARE_INSTRUCTION(SpecialParameter) | 2683 DECLARE_INSTRUCTION(SpecialParameter) |
| 2735 virtual CompileType ComputeType() const; | 2684 virtual CompileType ComputeType() const; |
| 2736 | 2685 |
| 2737 virtual bool ComputeCanDeoptimize() const { return false; } | 2686 virtual bool ComputeCanDeoptimize() const { return false; } |
| 2738 | 2687 |
| 2739 virtual bool HasUnknownSideEffects() const { return false; } | 2688 virtual bool HasUnknownSideEffects() const { return false; } |
| 2740 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2689 |
| 2741 virtual bool AttributesEqual(Instruction* other) const { | 2690 virtual bool AttributesEqual(Instruction* other) const { |
| 2742 return kind() == other->AsSpecialParameter()->kind(); | 2691 return kind() == other->AsSpecialParameter()->kind(); |
| 2743 } | 2692 } |
| 2744 SpecialParameterKind kind() const { return kind_; } | 2693 SpecialParameterKind kind() const { return kind_; } |
| 2745 | 2694 |
| 2746 private: | 2695 private: |
| 2747 const SpecialParameterKind kind_; | 2696 const SpecialParameterKind kind_; |
| 2748 DISALLOW_COPY_AND_ASSIGN(SpecialParameterInstr); | 2697 DISALLOW_COPY_AND_ASSIGN(SpecialParameterInstr); |
| 2749 }; | 2698 }; |
| 2750 | 2699 |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 3203 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 3255 | 3204 |
| 3256 ComparisonInstr* comparison() const { return comparison_; } | 3205 ComparisonInstr* comparison() const { return comparison_; } |
| 3257 intptr_t if_true() const { return if_true_; } | 3206 intptr_t if_true() const { return if_true_; } |
| 3258 intptr_t if_false() const { return if_false_; } | 3207 intptr_t if_false() const { return if_false_; } |
| 3259 | 3208 |
| 3260 virtual bool AllowsCSE() const { return comparison()->AllowsCSE(); } | 3209 virtual bool AllowsCSE() const { return comparison()->AllowsCSE(); } |
| 3261 virtual bool HasUnknownSideEffects() const { | 3210 virtual bool HasUnknownSideEffects() const { |
| 3262 return comparison()->HasUnknownSideEffects(); | 3211 return comparison()->HasUnknownSideEffects(); |
| 3263 } | 3212 } |
| 3264 virtual EffectSet Dependencies() const { | 3213 |
| 3265 return comparison()->Dependencies(); | |
| 3266 } | |
| 3267 virtual bool AttributesEqual(Instruction* other) const { | 3214 virtual bool AttributesEqual(Instruction* other) const { |
| 3268 IfThenElseInstr* other_if_then_else = other->AsIfThenElse(); | 3215 IfThenElseInstr* other_if_then_else = other->AsIfThenElse(); |
| 3269 return (comparison()->tag() == other_if_then_else->comparison()->tag()) && | 3216 return (comparison()->tag() == other_if_then_else->comparison()->tag()) && |
| 3270 comparison()->AttributesEqual(other_if_then_else->comparison()) && | 3217 comparison()->AttributesEqual(other_if_then_else->comparison()) && |
| 3271 (if_true_ == other_if_then_else->if_true_) && | 3218 (if_true_ == other_if_then_else->if_true_) && |
| 3272 (if_false_ == other_if_then_else->if_false_); | 3219 (if_false_ == other_if_then_else->if_false_); |
| 3273 } | 3220 } |
| 3274 | 3221 |
| 3275 virtual bool MayThrow() const { return comparison()->MayThrow(); } | 3222 virtual bool MayThrow() const { return comparison()->MayThrow(); } |
| 3276 | 3223 |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 const Field& StaticField() const; | 3721 const Field& StaticField() const; |
| 3775 | 3722 |
| 3776 Value* field_value() const { return inputs_[0]; } | 3723 Value* field_value() const { return inputs_[0]; } |
| 3777 | 3724 |
| 3778 virtual bool ComputeCanDeoptimize() const { return false; } | 3725 virtual bool ComputeCanDeoptimize() const { return false; } |
| 3779 | 3726 |
| 3780 virtual bool AllowsCSE() const { | 3727 virtual bool AllowsCSE() const { |
| 3781 return StaticField().is_final() && !FLAG_fields_may_be_reset; | 3728 return StaticField().is_final() && !FLAG_fields_may_be_reset; |
| 3782 } | 3729 } |
| 3783 virtual bool HasUnknownSideEffects() const { return false; } | 3730 virtual bool HasUnknownSideEffects() const { return false; } |
| 3784 virtual EffectSet Dependencies() const; | 3731 |
| 3785 virtual bool AttributesEqual(Instruction* other) const; | 3732 virtual bool AttributesEqual(Instruction* other) const; |
| 3786 | 3733 |
| 3787 virtual TokenPosition token_pos() const { return token_pos_; } | 3734 virtual TokenPosition token_pos() const { return token_pos_; } |
| 3788 | 3735 |
| 3789 PRINT_OPERANDS_TO_SUPPORT | 3736 PRINT_OPERANDS_TO_SUPPORT |
| 3790 | 3737 |
| 3791 private: | 3738 private: |
| 3792 const TokenPosition token_pos_; | 3739 const TokenPosition token_pos_; |
| 3793 | 3740 |
| 3794 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 3741 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4509 bool Evaluate(const Object& instance_value, Object* result); | 4456 bool Evaluate(const Object& instance_value, Object* result); |
| 4510 | 4457 |
| 4511 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4458 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 4512 | 4459 |
| 4513 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid); | 4460 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid); |
| 4514 | 4461 |
| 4515 static bool IsFixedLengthArrayCid(intptr_t cid); | 4462 static bool IsFixedLengthArrayCid(intptr_t cid); |
| 4516 | 4463 |
| 4517 virtual bool AllowsCSE() const { return immutable_; } | 4464 virtual bool AllowsCSE() const { return immutable_; } |
| 4518 virtual bool HasUnknownSideEffects() const { return false; } | 4465 virtual bool HasUnknownSideEffects() const { return false; } |
| 4519 virtual EffectSet Dependencies() const; | 4466 |
| 4520 virtual bool AttributesEqual(Instruction* other) const; | 4467 virtual bool AttributesEqual(Instruction* other) const; |
| 4521 | 4468 |
| 4522 PRINT_OPERANDS_TO_SUPPORT | 4469 PRINT_OPERANDS_TO_SUPPORT |
| 4523 | 4470 |
| 4524 private: | 4471 private: |
| 4525 const intptr_t offset_in_bytes_; | 4472 const intptr_t offset_in_bytes_; |
| 4526 const AbstractType& type_; | 4473 const AbstractType& type_; |
| 4527 intptr_t result_cid_; | 4474 intptr_t result_cid_; |
| 4528 bool immutable_; | 4475 bool immutable_; |
| 4529 | 4476 |
| (...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7613 bool IsNullCheck() const { return IsDeoptIfNull() || IsDeoptIfNotNull(); } | 7560 bool IsNullCheck() const { return IsDeoptIfNull() || IsDeoptIfNotNull(); } |
| 7614 | 7561 |
| 7615 bool IsDeoptIfNull() const; | 7562 bool IsDeoptIfNull() const; |
| 7616 bool IsDeoptIfNotNull() const; | 7563 bool IsDeoptIfNotNull() const; |
| 7617 | 7564 |
| 7618 bool IsBitTest() const; | 7565 bool IsBitTest() const; |
| 7619 static bool IsCompactCidRange(const Cids& cids); | 7566 static bool IsCompactCidRange(const Cids& cids); |
| 7620 intptr_t ComputeCidMask() const; | 7567 intptr_t ComputeCidMask() const; |
| 7621 | 7568 |
| 7622 virtual bool AllowsCSE() const { return true; } | 7569 virtual bool AllowsCSE() const { return true; } |
| 7623 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 7624 virtual bool HasUnknownSideEffects() const { return false; } | 7570 virtual bool HasUnknownSideEffects() const { return false; } |
| 7571 |
| 7625 virtual bool AttributesEqual(Instruction* other) const; | 7572 virtual bool AttributesEqual(Instruction* other) const; |
| 7626 | 7573 |
| 7627 bool licm_hoisted() const { return licm_hoisted_; } | 7574 bool licm_hoisted() const { return licm_hoisted_; } |
| 7628 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 7575 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
| 7629 | 7576 |
| 7630 PRINT_OPERANDS_TO_SUPPORT | 7577 PRINT_OPERANDS_TO_SUPPORT |
| 7631 | 7578 |
| 7632 private: | 7579 private: |
| 7633 const Cids& cids_; | 7580 const Cids& cids_; |
| 7634 bool licm_hoisted_; | 7581 bool licm_hoisted_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7693 Value* value() const { return inputs_[0]; } | 7640 Value* value() const { return inputs_[0]; } |
| 7694 const CidRange& cids() const { return cids_; } | 7641 const CidRange& cids() const { return cids_; } |
| 7695 | 7642 |
| 7696 DECLARE_INSTRUCTION(CheckClassId) | 7643 DECLARE_INSTRUCTION(CheckClassId) |
| 7697 | 7644 |
| 7698 virtual bool ComputeCanDeoptimize() const { return true; } | 7645 virtual bool ComputeCanDeoptimize() const { return true; } |
| 7699 | 7646 |
| 7700 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 7647 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 7701 | 7648 |
| 7702 virtual bool AllowsCSE() const { return true; } | 7649 virtual bool AllowsCSE() const { return true; } |
| 7703 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 7704 virtual bool HasUnknownSideEffects() const { return false; } | 7650 virtual bool HasUnknownSideEffects() const { return false; } |
| 7651 |
| 7705 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7652 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 7706 | 7653 |
| 7707 PRINT_OPERANDS_TO_SUPPORT | 7654 PRINT_OPERANDS_TO_SUPPORT |
| 7708 | 7655 |
| 7709 private: | 7656 private: |
| 7710 bool Contains(intptr_t cid) const; | 7657 bool Contains(intptr_t cid) const; |
| 7711 | 7658 |
| 7712 CidRange cids_; | 7659 CidRange cids_; |
| 7713 | 7660 |
| 7714 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); | 7661 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7761 GenericCheckBoundInstr(Value* length, Value* index, intptr_t deopt_id) | 7708 GenericCheckBoundInstr(Value* length, Value* index, intptr_t deopt_id) |
| 7762 : TemplateInstruction(deopt_id) { | 7709 : TemplateInstruction(deopt_id) { |
| 7763 SetInputAt(kLengthPos, length); | 7710 SetInputAt(kLengthPos, length); |
| 7764 SetInputAt(kIndexPos, index); | 7711 SetInputAt(kIndexPos, index); |
| 7765 } | 7712 } |
| 7766 | 7713 |
| 7767 Value* length() const { return inputs_[kLengthPos]; } | 7714 Value* length() const { return inputs_[kLengthPos]; } |
| 7768 Value* index() const { return inputs_[kIndexPos]; } | 7715 Value* index() const { return inputs_[kIndexPos]; } |
| 7769 | 7716 |
| 7770 virtual bool HasUnknownSideEffects() const { return false; } | 7717 virtual bool HasUnknownSideEffects() const { return false; } |
| 7771 virtual EffectSet Dependencies() const { return EffectSet::None(); } | |
| 7772 | 7718 |
| 7773 DECLARE_INSTRUCTION(GenericCheckBound) | 7719 DECLARE_INSTRUCTION(GenericCheckBound) |
| 7774 | 7720 |
| 7775 virtual bool ComputeCanDeoptimize() const { return true; } | 7721 virtual bool ComputeCanDeoptimize() const { return true; } |
| 7776 | 7722 |
| 7777 // Give a name to the location/input indices. | 7723 // Give a name to the location/input indices. |
| 7778 enum { kLengthPos = 0, kIndexPos = 1 }; | 7724 enum { kLengthPos = 0, kIndexPos = 1 }; |
| 7779 | 7725 |
| 7780 private: | 7726 private: |
| 7781 DISALLOW_COPY_AND_ASSIGN(GenericCheckBoundInstr); | 7727 DISALLOW_COPY_AND_ASSIGN(GenericCheckBoundInstr); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 7812 virtual bool ComputeCanDeoptimize() const; | 7758 virtual bool ComputeCanDeoptimize() const; |
| 7813 | 7759 |
| 7814 virtual Representation representation() const { return to(); } | 7760 virtual Representation representation() const { return to(); } |
| 7815 | 7761 |
| 7816 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7762 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 7817 ASSERT(idx == 0); | 7763 ASSERT(idx == 0); |
| 7818 return from(); | 7764 return from(); |
| 7819 } | 7765 } |
| 7820 | 7766 |
| 7821 virtual bool HasUnknownSideEffects() const { return false; } | 7767 virtual bool HasUnknownSideEffects() const { return false; } |
| 7822 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 7768 |
| 7823 virtual bool AttributesEqual(Instruction* other) const { | 7769 virtual bool AttributesEqual(Instruction* other) const { |
| 7824 ASSERT(other->IsUnboxedIntConverter()); | 7770 ASSERT(other->IsUnboxedIntConverter()); |
| 7825 UnboxedIntConverterInstr* converter = other->AsUnboxedIntConverter(); | 7771 UnboxedIntConverterInstr* converter = other->AsUnboxedIntConverter(); |
| 7826 return (converter->from() == from()) && (converter->to() == to()) && | 7772 return (converter->from() == from()) && (converter->to() == to()) && |
| 7827 (converter->is_truncating() == is_truncating()); | 7773 (converter->is_truncating() == is_truncating()); |
| 7828 } | 7774 } |
| 7829 | 7775 |
| 7830 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 7776 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
| 7831 | 7777 |
| 7832 virtual CompileType ComputeType() const { | 7778 virtual CompileType ComputeType() const { |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8103 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ | 8049 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ |
| 8104 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8050 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8105 UNIMPLEMENTED(); \ | 8051 UNIMPLEMENTED(); \ |
| 8106 return NULL; \ | 8052 return NULL; \ |
| 8107 } \ | 8053 } \ |
| 8108 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8054 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8109 | 8055 |
| 8110 } // namespace dart | 8056 } // namespace dart |
| 8111 | 8057 |
| 8112 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8058 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |