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 | |
182 class EffectSet : public ValueObject { | 181 class EffectSet : public ValueObject { |
183 public: | 182 public: |
184 enum Effects { | 183 enum Effects { |
185 kNoEffects = 0, | 184 kNoEffects = 0, |
186 kExternalization = 1, | 185 kExternalization = 1, |
187 kLastEffect = kExternalization | 186 kLastEffect = kExternalization |
188 }; | 187 }; |
189 | 188 |
190 EffectSet(const EffectSet& other) : ValueObject(), effects_(other.effects_) {} | 189 EffectSet(const EffectSet& other) : ValueObject(), effects_(other.effects_) {} |
191 | 190 |
192 bool IsNone() const { return effects_ == kNoEffects; } | 191 bool IsNone() const { return effects_ == kNoEffects; } |
193 | 192 |
194 static EffectSet None() { return EffectSet(kNoEffects); } | 193 static EffectSet None() { return EffectSet(kNoEffects); } |
195 static EffectSet All() { | 194 static EffectSet All() { |
196 ASSERT(EffectSet::kLastEffect == 1); | 195 ASSERT(EffectSet::kLastEffect == 1); |
197 return EffectSet(kExternalization); | 196 return EffectSet(kExternalization); |
198 } | 197 } |
199 | 198 |
200 static EffectSet Externalization() { return EffectSet(kExternalization); } | 199 static EffectSet Externalization() { return EffectSet(kExternalization); } |
201 | 200 |
202 bool ToInt() { return effects_; } | 201 bool ToInt() { return effects_; } |
203 | 202 |
204 private: | 203 private: |
205 explicit EffectSet(intptr_t effects) : effects_(effects) {} | 204 explicit EffectSet(intptr_t effects) : effects_(effects) {} |
206 | 205 |
207 intptr_t effects_; | 206 intptr_t effects_; |
208 }; | 207 }; |
209 | 208 |
210 | |
211 class Value : public ZoneAllocated { | 209 class Value : public ZoneAllocated { |
212 public: | 210 public: |
213 // A forward iterator that allows removing the current value from the | 211 // A forward iterator that allows removing the current value from the |
214 // underlying use list during iteration. | 212 // underlying use list during iteration. |
215 class Iterator { | 213 class Iterator { |
216 public: | 214 public: |
217 explicit Iterator(Value* head) : next_(head) { Advance(); } | 215 explicit Iterator(Value* head) : next_(head) { Advance(); } |
218 Value* Current() const { return current_; } | 216 Value* Current() const { return current_; } |
219 bool Done() const { return current_ == NULL; } | 217 bool Done() const { return current_ == NULL; } |
220 void Advance() { | 218 void Advance() { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 Value* previous_use_; | 302 Value* previous_use_; |
305 Value* next_use_; | 303 Value* next_use_; |
306 Instruction* instruction_; | 304 Instruction* instruction_; |
307 intptr_t use_index_; | 305 intptr_t use_index_; |
308 | 306 |
309 CompileType* reaching_type_; | 307 CompileType* reaching_type_; |
310 | 308 |
311 DISALLOW_COPY_AND_ASSIGN(Value); | 309 DISALLOW_COPY_AND_ASSIGN(Value); |
312 }; | 310 }; |
313 | 311 |
314 | |
315 // An embedded container with N elements of type T. Used (with partial | 312 // An embedded container with N elements of type T. Used (with partial |
316 // specialization for N=0) because embedded arrays cannot have size 0. | 313 // specialization for N=0) because embedded arrays cannot have size 0. |
317 template <typename T, intptr_t N> | 314 template <typename T, intptr_t N> |
318 class EmbeddedArray { | 315 class EmbeddedArray { |
319 public: | 316 public: |
320 EmbeddedArray() : elements_() {} | 317 EmbeddedArray() : elements_() {} |
321 | 318 |
322 intptr_t length() const { return N; } | 319 intptr_t length() const { return N; } |
323 | 320 |
324 const T& operator[](intptr_t i) const { | 321 const T& operator[](intptr_t i) const { |
325 ASSERT(i < length()); | 322 ASSERT(i < length()); |
326 return elements_[i]; | 323 return elements_[i]; |
327 } | 324 } |
328 | 325 |
329 T& operator[](intptr_t i) { | 326 T& operator[](intptr_t i) { |
330 ASSERT(i < length()); | 327 ASSERT(i < length()); |
331 return elements_[i]; | 328 return elements_[i]; |
332 } | 329 } |
333 | 330 |
334 const T& At(intptr_t i) const { return (*this)[i]; } | 331 const T& At(intptr_t i) const { return (*this)[i]; } |
335 | 332 |
336 void SetAt(intptr_t i, const T& val) { (*this)[i] = val; } | 333 void SetAt(intptr_t i, const T& val) { (*this)[i] = val; } |
337 | 334 |
338 private: | 335 private: |
339 T elements_[N]; | 336 T elements_[N]; |
340 }; | 337 }; |
341 | 338 |
342 | |
343 template <typename T> | 339 template <typename T> |
344 class EmbeddedArray<T, 0> { | 340 class EmbeddedArray<T, 0> { |
345 public: | 341 public: |
346 intptr_t length() const { return 0; } | 342 intptr_t length() const { return 0; } |
347 const T& operator[](intptr_t i) const { | 343 const T& operator[](intptr_t i) const { |
348 UNREACHABLE(); | 344 UNREACHABLE(); |
349 static T sentinel = 0; | 345 static T sentinel = 0; |
350 return sentinel; | 346 return sentinel; |
351 } | 347 } |
352 T& operator[](intptr_t i) { | 348 T& operator[](intptr_t i) { |
353 UNREACHABLE(); | 349 UNREACHABLE(); |
354 static T sentinel = 0; | 350 static T sentinel = 0; |
355 return sentinel; | 351 return sentinel; |
356 } | 352 } |
357 }; | 353 }; |
358 | 354 |
359 | |
360 // Instructions. | 355 // Instructions. |
361 | 356 |
362 // M is a single argument macro. It is applied to each concrete instruction | 357 // M is a single argument macro. It is applied to each concrete instruction |
363 // type name. The concrete instruction classes are the name with Instr | 358 // type name. The concrete instruction classes are the name with Instr |
364 // concatenated. | 359 // concatenated. |
365 #define FOR_EACH_INSTRUCTION(M) \ | 360 #define FOR_EACH_INSTRUCTION(M) \ |
366 M(GraphEntry) \ | 361 M(GraphEntry) \ |
367 M(JoinEntry) \ | 362 M(JoinEntry) \ |
368 M(TargetEntry) \ | 363 M(TargetEntry) \ |
369 M(IndirectEntry) \ | 364 M(IndirectEntry) \ |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 #define PRINT_TO_SUPPORT | 557 #define PRINT_TO_SUPPORT |
563 #endif // !PRODUCT | 558 #endif // !PRODUCT |
564 | 559 |
565 #ifndef PRODUCT | 560 #ifndef PRODUCT |
566 #define PRINT_OPERANDS_TO_SUPPORT \ | 561 #define PRINT_OPERANDS_TO_SUPPORT \ |
567 virtual void PrintOperandsTo(BufferFormatter* f) const; | 562 virtual void PrintOperandsTo(BufferFormatter* f) const; |
568 #else | 563 #else |
569 #define PRINT_OPERANDS_TO_SUPPORT | 564 #define PRINT_OPERANDS_TO_SUPPORT |
570 #endif // !PRODUCT | 565 #endif // !PRODUCT |
571 | 566 |
572 | |
573 // Represents a range of class-ids for use in class checks and polymorphic | 567 // Represents a range of class-ids for use in class checks and polymorphic |
574 // dispatches. | 568 // dispatches. |
575 struct CidRange : public ZoneAllocated { | 569 struct CidRange : public ZoneAllocated { |
576 CidRange(const CidRange& o) | 570 CidRange(const CidRange& o) |
577 : ZoneAllocated(), cid_start(o.cid_start), cid_end(o.cid_end) {} | 571 : ZoneAllocated(), cid_start(o.cid_start), cid_end(o.cid_end) {} |
578 CidRange(intptr_t cid_start_arg, intptr_t cid_end_arg) | 572 CidRange(intptr_t cid_start_arg, intptr_t cid_end_arg) |
579 : cid_start(cid_start_arg), cid_end(cid_end_arg) {} | 573 : cid_start(cid_start_arg), cid_end(cid_end_arg) {} |
580 | 574 |
581 bool IsSingleCid() const { return cid_start == cid_end; } | 575 bool IsSingleCid() const { return cid_start == cid_end; } |
582 bool Contains(intptr_t cid) { return cid_start <= cid && cid <= cid_end; } | 576 bool Contains(intptr_t cid) { return cid_start <= cid && cid <= cid_end; } |
583 int32_t Extent() const { return cid_end - cid_start; } | 577 int32_t Extent() const { return cid_end - cid_start; } |
584 | 578 |
585 intptr_t cid_start; | 579 intptr_t cid_start; |
586 intptr_t cid_end; | 580 intptr_t cid_end; |
587 }; | 581 }; |
588 | 582 |
589 | |
590 // Together with CidRange, this represents a mapping from a range of class-ids | 583 // Together with CidRange, this represents a mapping from a range of class-ids |
591 // to a method for a given selector (method name). Also can contain an | 584 // to a method for a given selector (method name). Also can contain an |
592 // indication of how frequently a given method has been called at a call site. | 585 // indication of how frequently a given method has been called at a call site. |
593 // This information can be harvested from the inline caches (ICs). | 586 // This information can be harvested from the inline caches (ICs). |
594 struct TargetInfo : public CidRange { | 587 struct TargetInfo : public CidRange { |
595 TargetInfo(intptr_t cid_start_arg, | 588 TargetInfo(intptr_t cid_start_arg, |
596 intptr_t cid_end_arg, | 589 intptr_t cid_end_arg, |
597 const Function* target_arg, | 590 const Function* target_arg, |
598 intptr_t count_arg) | 591 intptr_t count_arg) |
599 : CidRange(cid_start_arg, cid_end_arg), | 592 : CidRange(cid_start_arg, cid_end_arg), |
600 target(target_arg), | 593 target(target_arg), |
601 count(count_arg) { | 594 count(count_arg) { |
602 ASSERT(target->IsZoneHandle()); | 595 ASSERT(target->IsZoneHandle()); |
603 } | 596 } |
604 const Function* target; | 597 const Function* target; |
605 intptr_t count; | 598 intptr_t count; |
606 }; | 599 }; |
607 | 600 |
608 | |
609 // A set of class-ids, arranged in ranges. Used for the CheckClass | 601 // A set of class-ids, arranged in ranges. Used for the CheckClass |
610 // and PolymorphicInstanceCall instructions. | 602 // and PolymorphicInstanceCall instructions. |
611 class Cids : public ZoneAllocated { | 603 class Cids : public ZoneAllocated { |
612 public: | 604 public: |
613 explicit Cids(Zone* zone) : zone_(zone) {} | 605 explicit Cids(Zone* zone) : zone_(zone) {} |
614 // Creates the off-heap Cids object that reflects the contents | 606 // Creates the off-heap Cids object that reflects the contents |
615 // of the on-VM-heap IC data. | 607 // of the on-VM-heap IC data. |
616 static Cids* Create(Zone* zone, const ICData& ic_data, int argument_number); | 608 static Cids* Create(Zone* zone, const ICData& ic_data, int argument_number); |
617 static Cids* CreateMonomorphic(Zone* zone, intptr_t cid); | 609 static Cids* CreateMonomorphic(Zone* zone, intptr_t cid); |
618 | 610 |
(...skipping 28 matching lines...) Expand all Loading... |
647 const ICData& ic_data, | 639 const ICData& ic_data, |
648 int argument_number, | 640 int argument_number, |
649 bool include_targets); | 641 bool include_targets); |
650 GrowableArray<CidRange*> cid_ranges_; | 642 GrowableArray<CidRange*> cid_ranges_; |
651 Zone* zone_; | 643 Zone* zone_; |
652 | 644 |
653 private: | 645 private: |
654 DISALLOW_IMPLICIT_CONSTRUCTORS(Cids); | 646 DISALLOW_IMPLICIT_CONSTRUCTORS(Cids); |
655 }; | 647 }; |
656 | 648 |
657 | |
658 class CallTargets : public Cids { | 649 class CallTargets : public Cids { |
659 public: | 650 public: |
660 explicit CallTargets(Zone* zone) : Cids(zone) {} | 651 explicit CallTargets(Zone* zone) : Cids(zone) {} |
661 // Creates the off-heap CallTargets object that reflects the contents | 652 // Creates the off-heap CallTargets object that reflects the contents |
662 // of the on-VM-heap IC data. | 653 // of the on-VM-heap IC data. |
663 static CallTargets* Create(Zone* zone, const ICData& ic_data); | 654 static CallTargets* Create(Zone* zone, const ICData& ic_data); |
664 | 655 |
665 // This variant also expands the class-ids to neighbouring classes that | 656 // This variant also expands the class-ids to neighbouring classes that |
666 // inherit the same method. | 657 // inherit the same method. |
667 static CallTargets* CreateAndExpand(Zone* zone, const ICData& ic_data); | 658 static CallTargets* CreateAndExpand(Zone* zone, const ICData& ic_data); |
668 | 659 |
669 TargetInfo* TargetAt(int i) const { return static_cast<TargetInfo*>(At(i)); } | 660 TargetInfo* TargetAt(int i) const { return static_cast<TargetInfo*>(At(i)); } |
670 | 661 |
671 intptr_t AggregateCallCount() const; | 662 intptr_t AggregateCallCount() const; |
672 | 663 |
673 bool HasSingleTarget() const; | 664 bool HasSingleTarget() const; |
674 bool HasSingleRecognizedTarget() const; | 665 bool HasSingleRecognizedTarget() const; |
675 const Function& FirstTarget() const; | 666 const Function& FirstTarget() const; |
676 const Function& MostPopularTarget() const; | 667 const Function& MostPopularTarget() const; |
677 | 668 |
678 private: | 669 private: |
679 void MergeIntoRanges(); | 670 void MergeIntoRanges(); |
680 }; | 671 }; |
681 | 672 |
682 | |
683 class Instruction : public ZoneAllocated { | 673 class Instruction : public ZoneAllocated { |
684 public: | 674 public: |
685 #define DECLARE_TAG(type) k##type, | 675 #define DECLARE_TAG(type) k##type, |
686 enum Tag { FOR_EACH_INSTRUCTION(DECLARE_TAG) }; | 676 enum Tag { FOR_EACH_INSTRUCTION(DECLARE_TAG) }; |
687 #undef DECLARE_TAG | 677 #undef DECLARE_TAG |
688 | 678 |
689 explicit Instruction(intptr_t deopt_id = Thread::kNoDeoptId) | 679 explicit Instruction(intptr_t deopt_id = Thread::kNoDeoptId) |
690 : deopt_id_(deopt_id), | 680 : deopt_id_(deopt_id), |
691 lifetime_position_(kNoPlaceId), | 681 lifetime_position_(kNoPlaceId), |
692 previous_(NULL), | 682 previous_(NULL), |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 }; | 968 }; |
979 Instruction* previous_; | 969 Instruction* previous_; |
980 Instruction* next_; | 970 Instruction* next_; |
981 Environment* env_; | 971 Environment* env_; |
982 LocationSummary* locs_; | 972 LocationSummary* locs_; |
983 intptr_t inlining_id_; | 973 intptr_t inlining_id_; |
984 | 974 |
985 DISALLOW_COPY_AND_ASSIGN(Instruction); | 975 DISALLOW_COPY_AND_ASSIGN(Instruction); |
986 }; | 976 }; |
987 | 977 |
988 | |
989 struct BranchLabels { | 978 struct BranchLabels { |
990 Label* true_label; | 979 Label* true_label; |
991 Label* false_label; | 980 Label* false_label; |
992 Label* fall_through; | 981 Label* fall_through; |
993 }; | 982 }; |
994 | 983 |
995 | |
996 class PureInstruction : public Instruction { | 984 class PureInstruction : public Instruction { |
997 public: | 985 public: |
998 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} | 986 explicit PureInstruction(intptr_t deopt_id) : Instruction(deopt_id) {} |
999 | 987 |
1000 virtual bool AllowsCSE() const { return true; } | 988 virtual bool AllowsCSE() const { return true; } |
1001 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 989 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
1002 | 990 |
1003 virtual EffectSet Effects() const { return EffectSet::None(); } | 991 virtual EffectSet Effects() const { return EffectSet::None(); } |
1004 }; | 992 }; |
1005 | 993 |
1006 | |
1007 // Types to be used as ThrowsTrait for TemplateInstruction/TemplateDefinition. | 994 // Types to be used as ThrowsTrait for TemplateInstruction/TemplateDefinition. |
1008 struct Throws { | 995 struct Throws { |
1009 static const bool kCanThrow = true; | 996 static const bool kCanThrow = true; |
1010 }; | 997 }; |
1011 | 998 |
1012 | |
1013 struct NoThrow { | 999 struct NoThrow { |
1014 static const bool kCanThrow = false; | 1000 static const bool kCanThrow = false; |
1015 }; | 1001 }; |
1016 | 1002 |
1017 | |
1018 // Types to be used as CSETrait for TemplateInstruction/TemplateDefinition. | 1003 // Types to be used as CSETrait for TemplateInstruction/TemplateDefinition. |
1019 // Pure instructions are those that allow CSE and have no effects and | 1004 // Pure instructions are those that allow CSE and have no effects and |
1020 // no dependencies. | 1005 // no dependencies. |
1021 template <typename DefaultBase, typename PureBase> | 1006 template <typename DefaultBase, typename PureBase> |
1022 struct Pure { | 1007 struct Pure { |
1023 typedef PureBase Base; | 1008 typedef PureBase Base; |
1024 }; | 1009 }; |
1025 | 1010 |
1026 | |
1027 template <typename DefaultBase, typename PureBase> | 1011 template <typename DefaultBase, typename PureBase> |
1028 struct NoCSE { | 1012 struct NoCSE { |
1029 typedef DefaultBase Base; | 1013 typedef DefaultBase Base; |
1030 }; | 1014 }; |
1031 | 1015 |
1032 | |
1033 template <intptr_t N, | 1016 template <intptr_t N, |
1034 typename ThrowsTrait, | 1017 typename ThrowsTrait, |
1035 template <typename Default, typename Pure> class CSETrait = NoCSE> | 1018 template <typename Default, typename Pure> class CSETrait = NoCSE> |
1036 class TemplateInstruction | 1019 class TemplateInstruction |
1037 : public CSETrait<Instruction, PureInstruction>::Base { | 1020 : public CSETrait<Instruction, PureInstruction>::Base { |
1038 public: | 1021 public: |
1039 explicit TemplateInstruction(intptr_t deopt_id = Thread::kNoDeoptId) | 1022 explicit TemplateInstruction(intptr_t deopt_id = Thread::kNoDeoptId) |
1040 : CSETrait<Instruction, PureInstruction>::Base(deopt_id), inputs_() {} | 1023 : CSETrait<Instruction, PureInstruction>::Base(deopt_id), inputs_() {} |
1041 | 1024 |
1042 virtual intptr_t InputCount() const { return N; } | 1025 virtual intptr_t InputCount() const { return N; } |
1043 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } | 1026 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
1044 | 1027 |
1045 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } | 1028 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } |
1046 | 1029 |
1047 protected: | 1030 protected: |
1048 EmbeddedArray<Value*, N> inputs_; | 1031 EmbeddedArray<Value*, N> inputs_; |
1049 | 1032 |
1050 private: | 1033 private: |
1051 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 1034 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
1052 }; | 1035 }; |
1053 | 1036 |
1054 | |
1055 class MoveOperands : public ZoneAllocated { | 1037 class MoveOperands : public ZoneAllocated { |
1056 public: | 1038 public: |
1057 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) {} | 1039 MoveOperands(Location dest, Location src) : dest_(dest), src_(src) {} |
1058 | 1040 |
1059 Location src() const { return src_; } | 1041 Location src() const { return src_; } |
1060 Location dest() const { return dest_; } | 1042 Location dest() const { return dest_; } |
1061 | 1043 |
1062 Location* src_slot() { return &src_; } | 1044 Location* src_slot() { return &src_; } |
1063 Location* dest_slot() { return &dest_; } | 1045 Location* dest_slot() { return &dest_; } |
1064 | 1046 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 return src_.IsInvalid(); | 1084 return src_.IsInvalid(); |
1103 } | 1085 } |
1104 | 1086 |
1105 private: | 1087 private: |
1106 Location dest_; | 1088 Location dest_; |
1107 Location src_; | 1089 Location src_; |
1108 | 1090 |
1109 DISALLOW_COPY_AND_ASSIGN(MoveOperands); | 1091 DISALLOW_COPY_AND_ASSIGN(MoveOperands); |
1110 }; | 1092 }; |
1111 | 1093 |
1112 | |
1113 class ParallelMoveInstr : public TemplateInstruction<0, NoThrow> { | 1094 class ParallelMoveInstr : public TemplateInstruction<0, NoThrow> { |
1114 public: | 1095 public: |
1115 ParallelMoveInstr() : moves_(4) {} | 1096 ParallelMoveInstr() : moves_(4) {} |
1116 | 1097 |
1117 DECLARE_INSTRUCTION(ParallelMove) | 1098 DECLARE_INSTRUCTION(ParallelMove) |
1118 | 1099 |
1119 virtual intptr_t ArgumentCount() const { return 0; } | 1100 virtual intptr_t ArgumentCount() const { return 0; } |
1120 | 1101 |
1121 virtual bool ComputeCanDeoptimize() const { return false; } | 1102 virtual bool ComputeCanDeoptimize() const { return false; } |
1122 | 1103 |
(...skipping 24 matching lines...) Expand all Loading... |
1147 } | 1128 } |
1148 | 1129 |
1149 PRINT_TO_SUPPORT | 1130 PRINT_TO_SUPPORT |
1150 | 1131 |
1151 private: | 1132 private: |
1152 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. | 1133 GrowableArray<MoveOperands*> moves_; // Elements cannot be null. |
1153 | 1134 |
1154 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); | 1135 DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr); |
1155 }; | 1136 }; |
1156 | 1137 |
1157 | |
1158 // Basic block entries are administrative nodes. There is a distinguished | 1138 // Basic block entries are administrative nodes. There is a distinguished |
1159 // graph entry with no predecessor. Joins are the only nodes with multiple | 1139 // graph entry with no predecessor. Joins are the only nodes with multiple |
1160 // predecessors. Targets are all other basic block entries. The types | 1140 // predecessors. Targets are all other basic block entries. The types |
1161 // enforce edge-split form---joins are forbidden as the successors of | 1141 // enforce edge-split form---joins are forbidden as the successors of |
1162 // branches. | 1142 // branches. |
1163 class BlockEntryInstr : public Instruction { | 1143 class BlockEntryInstr : public Instruction { |
1164 public: | 1144 public: |
1165 virtual intptr_t PredecessorCount() const = 0; | 1145 virtual intptr_t PredecessorCount() const = 0; |
1166 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0; | 1146 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const = 0; |
1167 | 1147 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 // connect live ranges at the start of the block. | 1311 // connect live ranges at the start of the block. |
1332 ParallelMoveInstr* parallel_move_; | 1312 ParallelMoveInstr* parallel_move_; |
1333 | 1313 |
1334 // Bit vector containing loop blocks for a loop header indexed by block | 1314 // Bit vector containing loop blocks for a loop header indexed by block |
1335 // preorder number. | 1315 // preorder number. |
1336 BitVector* loop_info_; | 1316 BitVector* loop_info_; |
1337 | 1317 |
1338 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); | 1318 DISALLOW_COPY_AND_ASSIGN(BlockEntryInstr); |
1339 }; | 1319 }; |
1340 | 1320 |
1341 | |
1342 class ForwardInstructionIterator : public ValueObject { | 1321 class ForwardInstructionIterator : public ValueObject { |
1343 public: | 1322 public: |
1344 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) | 1323 explicit ForwardInstructionIterator(BlockEntryInstr* block_entry) |
1345 : current_(block_entry) { | 1324 : current_(block_entry) { |
1346 Advance(); | 1325 Advance(); |
1347 } | 1326 } |
1348 | 1327 |
1349 void Advance() { | 1328 void Advance() { |
1350 ASSERT(!Done()); | 1329 ASSERT(!Done()); |
1351 current_ = current_->next(); | 1330 current_ = current_->next(); |
1352 } | 1331 } |
1353 | 1332 |
1354 bool Done() const { return current_ == NULL; } | 1333 bool Done() const { return current_ == NULL; } |
1355 | 1334 |
1356 // Removes 'current_' from graph and sets 'current_' to previous instruction. | 1335 // Removes 'current_' from graph and sets 'current_' to previous instruction. |
1357 void RemoveCurrentFromGraph(); | 1336 void RemoveCurrentFromGraph(); |
1358 | 1337 |
1359 Instruction* Current() const { return current_; } | 1338 Instruction* Current() const { return current_; } |
1360 | 1339 |
1361 private: | 1340 private: |
1362 Instruction* current_; | 1341 Instruction* current_; |
1363 }; | 1342 }; |
1364 | 1343 |
1365 | |
1366 class BackwardInstructionIterator : public ValueObject { | 1344 class BackwardInstructionIterator : public ValueObject { |
1367 public: | 1345 public: |
1368 explicit BackwardInstructionIterator(BlockEntryInstr* block_entry) | 1346 explicit BackwardInstructionIterator(BlockEntryInstr* block_entry) |
1369 : block_entry_(block_entry), current_(block_entry->last_instruction()) { | 1347 : block_entry_(block_entry), current_(block_entry->last_instruction()) { |
1370 ASSERT(block_entry_->previous() == NULL); | 1348 ASSERT(block_entry_->previous() == NULL); |
1371 } | 1349 } |
1372 | 1350 |
1373 void Advance() { | 1351 void Advance() { |
1374 ASSERT(!Done()); | 1352 ASSERT(!Done()); |
1375 current_ = current_->previous(); | 1353 current_ = current_->previous(); |
1376 } | 1354 } |
1377 | 1355 |
1378 bool Done() const { return current_ == block_entry_; } | 1356 bool Done() const { return current_ == block_entry_; } |
1379 | 1357 |
1380 void RemoveCurrentFromGraph(); | 1358 void RemoveCurrentFromGraph(); |
1381 | 1359 |
1382 Instruction* Current() const { return current_; } | 1360 Instruction* Current() const { return current_; } |
1383 | 1361 |
1384 private: | 1362 private: |
1385 BlockEntryInstr* block_entry_; | 1363 BlockEntryInstr* block_entry_; |
1386 Instruction* current_; | 1364 Instruction* current_; |
1387 }; | 1365 }; |
1388 | 1366 |
1389 | |
1390 class GraphEntryInstr : public BlockEntryInstr { | 1367 class GraphEntryInstr : public BlockEntryInstr { |
1391 public: | 1368 public: |
1392 GraphEntryInstr(const ParsedFunction& parsed_function, | 1369 GraphEntryInstr(const ParsedFunction& parsed_function, |
1393 TargetEntryInstr* normal_entry, | 1370 TargetEntryInstr* normal_entry, |
1394 intptr_t osr_id); | 1371 intptr_t osr_id); |
1395 | 1372 |
1396 DECLARE_INSTRUCTION(GraphEntry) | 1373 DECLARE_INSTRUCTION(GraphEntry) |
1397 | 1374 |
1398 virtual intptr_t PredecessorCount() const { return 0; } | 1375 virtual intptr_t PredecessorCount() const { return 0; } |
1399 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 1376 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1462 GrowableArray<IndirectEntryInstr*> indirect_entries_; | 1439 GrowableArray<IndirectEntryInstr*> indirect_entries_; |
1463 GrowableArray<Definition*> initial_definitions_; | 1440 GrowableArray<Definition*> initial_definitions_; |
1464 const intptr_t osr_id_; | 1441 const intptr_t osr_id_; |
1465 intptr_t entry_count_; | 1442 intptr_t entry_count_; |
1466 intptr_t spill_slot_count_; | 1443 intptr_t spill_slot_count_; |
1467 intptr_t fixed_slot_count_; // For try-catch in optimized code. | 1444 intptr_t fixed_slot_count_; // For try-catch in optimized code. |
1468 | 1445 |
1469 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); | 1446 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); |
1470 }; | 1447 }; |
1471 | 1448 |
1472 | |
1473 class JoinEntryInstr : public BlockEntryInstr { | 1449 class JoinEntryInstr : public BlockEntryInstr { |
1474 public: | 1450 public: |
1475 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) | 1451 JoinEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) |
1476 : BlockEntryInstr(block_id, try_index, deopt_id), | 1452 : BlockEntryInstr(block_id, try_index, deopt_id), |
1477 predecessors_(2), // Two is the assumed to be the common case. | 1453 predecessors_(2), // Two is the assumed to be the common case. |
1478 phis_(NULL) {} | 1454 phis_(NULL) {} |
1479 | 1455 |
1480 DECLARE_INSTRUCTION(JoinEntry) | 1456 DECLARE_INSTRUCTION(JoinEntry) |
1481 | 1457 |
1482 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } | 1458 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } |
(...skipping 30 matching lines...) Expand all Loading... |
1513 | 1489 |
1514 virtual void ClearPredecessors() { predecessors_.Clear(); } | 1490 virtual void ClearPredecessors() { predecessors_.Clear(); } |
1515 virtual void AddPredecessor(BlockEntryInstr* predecessor); | 1491 virtual void AddPredecessor(BlockEntryInstr* predecessor); |
1516 | 1492 |
1517 GrowableArray<BlockEntryInstr*> predecessors_; | 1493 GrowableArray<BlockEntryInstr*> predecessors_; |
1518 ZoneGrowableArray<PhiInstr*>* phis_; | 1494 ZoneGrowableArray<PhiInstr*>* phis_; |
1519 | 1495 |
1520 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); | 1496 DISALLOW_COPY_AND_ASSIGN(JoinEntryInstr); |
1521 }; | 1497 }; |
1522 | 1498 |
1523 | |
1524 class PhiIterator : public ValueObject { | 1499 class PhiIterator : public ValueObject { |
1525 public: | 1500 public: |
1526 explicit PhiIterator(JoinEntryInstr* join) : phis_(join->phis()), index_(0) {} | 1501 explicit PhiIterator(JoinEntryInstr* join) : phis_(join->phis()), index_(0) {} |
1527 | 1502 |
1528 void Advance() { | 1503 void Advance() { |
1529 ASSERT(!Done()); | 1504 ASSERT(!Done()); |
1530 index_++; | 1505 index_++; |
1531 } | 1506 } |
1532 | 1507 |
1533 bool Done() const { return (phis_ == NULL) || (index_ >= phis_->length()); } | 1508 bool Done() const { return (phis_ == NULL) || (index_ >= phis_->length()); } |
1534 | 1509 |
1535 PhiInstr* Current() const { return (*phis_)[index_]; } | 1510 PhiInstr* Current() const { return (*phis_)[index_]; } |
1536 | 1511 |
1537 private: | 1512 private: |
1538 ZoneGrowableArray<PhiInstr*>* phis_; | 1513 ZoneGrowableArray<PhiInstr*>* phis_; |
1539 intptr_t index_; | 1514 intptr_t index_; |
1540 }; | 1515 }; |
1541 | 1516 |
1542 | |
1543 class TargetEntryInstr : public BlockEntryInstr { | 1517 class TargetEntryInstr : public BlockEntryInstr { |
1544 public: | 1518 public: |
1545 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) | 1519 TargetEntryInstr(intptr_t block_id, intptr_t try_index, intptr_t deopt_id) |
1546 : BlockEntryInstr(block_id, try_index, deopt_id), | 1520 : BlockEntryInstr(block_id, try_index, deopt_id), |
1547 predecessor_(NULL), | 1521 predecessor_(NULL), |
1548 edge_weight_(0.0) {} | 1522 edge_weight_(0.0) {} |
1549 | 1523 |
1550 DECLARE_INSTRUCTION(TargetEntry) | 1524 DECLARE_INSTRUCTION(TargetEntry) |
1551 | 1525 |
1552 double edge_weight() const { return edge_weight_; } | 1526 double edge_weight() const { return edge_weight_; } |
(...skipping 18 matching lines...) Expand all Loading... |
1571 ASSERT(predecessor_ == NULL); | 1545 ASSERT(predecessor_ == NULL); |
1572 predecessor_ = predecessor; | 1546 predecessor_ = predecessor; |
1573 } | 1547 } |
1574 | 1548 |
1575 BlockEntryInstr* predecessor_; | 1549 BlockEntryInstr* predecessor_; |
1576 double edge_weight_; | 1550 double edge_weight_; |
1577 | 1551 |
1578 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); | 1552 DISALLOW_COPY_AND_ASSIGN(TargetEntryInstr); |
1579 }; | 1553 }; |
1580 | 1554 |
1581 | |
1582 class IndirectEntryInstr : public JoinEntryInstr { | 1555 class IndirectEntryInstr : public JoinEntryInstr { |
1583 public: | 1556 public: |
1584 IndirectEntryInstr(intptr_t block_id, | 1557 IndirectEntryInstr(intptr_t block_id, |
1585 intptr_t indirect_id, | 1558 intptr_t indirect_id, |
1586 intptr_t try_index, | 1559 intptr_t try_index, |
1587 intptr_t deopt_id) | 1560 intptr_t deopt_id) |
1588 : JoinEntryInstr(block_id, try_index, deopt_id), | 1561 : JoinEntryInstr(block_id, try_index, deopt_id), |
1589 indirect_id_(indirect_id) {} | 1562 indirect_id_(indirect_id) {} |
1590 | 1563 |
1591 DECLARE_INSTRUCTION(IndirectEntry) | 1564 DECLARE_INSTRUCTION(IndirectEntry) |
1592 | 1565 |
1593 intptr_t indirect_id() const { return indirect_id_; } | 1566 intptr_t indirect_id() const { return indirect_id_; } |
1594 | 1567 |
1595 PRINT_TO_SUPPORT | 1568 PRINT_TO_SUPPORT |
1596 | 1569 |
1597 private: | 1570 private: |
1598 const intptr_t indirect_id_; | 1571 const intptr_t indirect_id_; |
1599 }; | 1572 }; |
1600 | 1573 |
1601 | |
1602 class CatchBlockEntryInstr : public BlockEntryInstr { | 1574 class CatchBlockEntryInstr : public BlockEntryInstr { |
1603 public: | 1575 public: |
1604 CatchBlockEntryInstr(TokenPosition handler_token_pos, | 1576 CatchBlockEntryInstr(TokenPosition handler_token_pos, |
1605 bool is_generated, | 1577 bool is_generated, |
1606 intptr_t block_id, | 1578 intptr_t block_id, |
1607 intptr_t try_index, | 1579 intptr_t try_index, |
1608 GraphEntryInstr* graph_entry, | 1580 GraphEntryInstr* graph_entry, |
1609 const Array& handler_types, | 1581 const Array& handler_types, |
1610 intptr_t catch_try_index, | 1582 intptr_t catch_try_index, |
1611 const LocalVariable& exception_var, | 1583 const LocalVariable& exception_var, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 const LocalVariable& exception_var_; | 1649 const LocalVariable& exception_var_; |
1678 const LocalVariable& stacktrace_var_; | 1650 const LocalVariable& stacktrace_var_; |
1679 const bool needs_stacktrace_; | 1651 const bool needs_stacktrace_; |
1680 const bool should_restore_closure_context_; | 1652 const bool should_restore_closure_context_; |
1681 TokenPosition handler_token_pos_; | 1653 TokenPosition handler_token_pos_; |
1682 bool is_generated_; | 1654 bool is_generated_; |
1683 | 1655 |
1684 DISALLOW_COPY_AND_ASSIGN(CatchBlockEntryInstr); | 1656 DISALLOW_COPY_AND_ASSIGN(CatchBlockEntryInstr); |
1685 }; | 1657 }; |
1686 | 1658 |
1687 | |
1688 // If the result of the allocation is not stored into any field, passed | 1659 // If the result of the allocation is not stored into any field, passed |
1689 // as an argument or used in a phi then it can't alias with any other | 1660 // as an argument or used in a phi then it can't alias with any other |
1690 // SSA value. | 1661 // SSA value. |
1691 class AliasIdentity : public ValueObject { | 1662 class AliasIdentity : public ValueObject { |
1692 public: | 1663 public: |
1693 // It is unknown if value has aliases. | 1664 // It is unknown if value has aliases. |
1694 static AliasIdentity Unknown() { return AliasIdentity(kUnknown); } | 1665 static AliasIdentity Unknown() { return AliasIdentity(kUnknown); } |
1695 | 1666 |
1696 // It is known that value can have aliases. | 1667 // It is known that value can have aliases. |
1697 static AliasIdentity Aliased() { return AliasIdentity(kAliased); } | 1668 static AliasIdentity Aliased() { return AliasIdentity(kAliased); } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 kAllocationSinkingCandidate = 3, | 1701 kAllocationSinkingCandidate = 3, |
1731 }; | 1702 }; |
1732 | 1703 |
1733 COMPILE_ASSERT((kUnknown & kNotAliased) == 0); | 1704 COMPILE_ASSERT((kUnknown & kNotAliased) == 0); |
1734 COMPILE_ASSERT((kAliased & kNotAliased) == 0); | 1705 COMPILE_ASSERT((kAliased & kNotAliased) == 0); |
1735 COMPILE_ASSERT((kAllocationSinkingCandidate & kNotAliased) != 0); | 1706 COMPILE_ASSERT((kAllocationSinkingCandidate & kNotAliased) != 0); |
1736 | 1707 |
1737 intptr_t value_; | 1708 intptr_t value_; |
1738 }; | 1709 }; |
1739 | 1710 |
1740 | |
1741 // Abstract super-class of all instructions that define a value (Bind, Phi). | 1711 // Abstract super-class of all instructions that define a value (Bind, Phi). |
1742 class Definition : public Instruction { | 1712 class Definition : public Instruction { |
1743 public: | 1713 public: |
1744 explicit Definition(intptr_t deopt_id = Thread::kNoDeoptId); | 1714 explicit Definition(intptr_t deopt_id = Thread::kNoDeoptId); |
1745 | 1715 |
1746 // Overridden by definitions that have call counts. | 1716 // Overridden by definitions that have call counts. |
1747 virtual intptr_t CallCount() const { | 1717 virtual intptr_t CallCount() const { |
1748 UNREACHABLE(); | 1718 UNREACHABLE(); |
1749 return -1; | 1719 return -1; |
1750 } | 1720 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1811 | 1781 |
1812 return false; | 1782 return false; |
1813 } | 1783 } |
1814 | 1784 |
1815 bool HasUses() const { | 1785 bool HasUses() const { |
1816 return (input_use_list_ != NULL) || (env_use_list_ != NULL); | 1786 return (input_use_list_ != NULL) || (env_use_list_ != NULL); |
1817 } | 1787 } |
1818 bool HasOnlyUse(Value* use) const; | 1788 bool HasOnlyUse(Value* use) const; |
1819 bool HasOnlyInputUse(Value* use) const; | 1789 bool HasOnlyInputUse(Value* use) const; |
1820 | 1790 |
1821 | |
1822 Value* input_use_list() const { return input_use_list_; } | 1791 Value* input_use_list() const { return input_use_list_; } |
1823 void set_input_use_list(Value* head) { input_use_list_ = head; } | 1792 void set_input_use_list(Value* head) { input_use_list_ = head; } |
1824 | 1793 |
1825 Value* env_use_list() const { return env_use_list_; } | 1794 Value* env_use_list() const { return env_use_list_; } |
1826 void set_env_use_list(Value* head) { env_use_list_ = head; } | 1795 void set_env_use_list(Value* head) { env_use_list_ = head; } |
1827 | 1796 |
1828 void AddInputUse(Value* value) { Value::AddToList(value, &input_use_list_); } | 1797 void AddInputUse(Value* value) { Value::AddToList(value, &input_use_list_); } |
1829 void AddEnvUse(Value* value) { Value::AddToList(value, &env_use_list_); } | 1798 void AddEnvUse(Value* value) { Value::AddToList(value, &env_use_list_); } |
1830 | 1799 |
1831 // Replace uses of this definition with uses of other definition or value. | 1800 // Replace uses of this definition with uses of other definition or value. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 intptr_t temp_index_; | 1859 intptr_t temp_index_; |
1891 intptr_t ssa_temp_index_; | 1860 intptr_t ssa_temp_index_; |
1892 Value* input_use_list_; | 1861 Value* input_use_list_; |
1893 Value* env_use_list_; | 1862 Value* env_use_list_; |
1894 | 1863 |
1895 Object* constant_value_; | 1864 Object* constant_value_; |
1896 | 1865 |
1897 DISALLOW_COPY_AND_ASSIGN(Definition); | 1866 DISALLOW_COPY_AND_ASSIGN(Definition); |
1898 }; | 1867 }; |
1899 | 1868 |
1900 | |
1901 // Change a value's definition after use lists have been computed. | 1869 // Change a value's definition after use lists have been computed. |
1902 inline void Value::BindTo(Definition* def) { | 1870 inline void Value::BindTo(Definition* def) { |
1903 RemoveFromUseList(); | 1871 RemoveFromUseList(); |
1904 set_definition(def); | 1872 set_definition(def); |
1905 def->AddInputUse(this); | 1873 def->AddInputUse(this); |
1906 } | 1874 } |
1907 | 1875 |
1908 | |
1909 inline void Value::BindToEnvironment(Definition* def) { | 1876 inline void Value::BindToEnvironment(Definition* def) { |
1910 RemoveFromUseList(); | 1877 RemoveFromUseList(); |
1911 set_definition(def); | 1878 set_definition(def); |
1912 def->AddEnvUse(this); | 1879 def->AddEnvUse(this); |
1913 } | 1880 } |
1914 | 1881 |
1915 | |
1916 class PureDefinition : public Definition { | 1882 class PureDefinition : public Definition { |
1917 public: | 1883 public: |
1918 explicit PureDefinition(intptr_t deopt_id) : Definition(deopt_id) {} | 1884 explicit PureDefinition(intptr_t deopt_id) : Definition(deopt_id) {} |
1919 | 1885 |
1920 virtual bool AllowsCSE() const { return true; } | 1886 virtual bool AllowsCSE() const { return true; } |
1921 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 1887 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
1922 | 1888 |
1923 virtual EffectSet Effects() const { return EffectSet::None(); } | 1889 virtual EffectSet Effects() const { return EffectSet::None(); } |
1924 }; | 1890 }; |
1925 | 1891 |
1926 | |
1927 template <intptr_t N, | 1892 template <intptr_t N, |
1928 typename ThrowsTrait, | 1893 typename ThrowsTrait, |
1929 template <typename Impure, typename Pure> class CSETrait = NoCSE> | 1894 template <typename Impure, typename Pure> class CSETrait = NoCSE> |
1930 class TemplateDefinition : public CSETrait<Definition, PureDefinition>::Base { | 1895 class TemplateDefinition : public CSETrait<Definition, PureDefinition>::Base { |
1931 public: | 1896 public: |
1932 explicit TemplateDefinition(intptr_t deopt_id = Thread::kNoDeoptId) | 1897 explicit TemplateDefinition(intptr_t deopt_id = Thread::kNoDeoptId) |
1933 : CSETrait<Definition, PureDefinition>::Base(deopt_id), inputs_() {} | 1898 : CSETrait<Definition, PureDefinition>::Base(deopt_id), inputs_() {} |
1934 | 1899 |
1935 virtual intptr_t InputCount() const { return N; } | 1900 virtual intptr_t InputCount() const { return N; } |
1936 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } | 1901 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
1937 | 1902 |
1938 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } | 1903 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } |
1939 | 1904 |
1940 protected: | 1905 protected: |
1941 EmbeddedArray<Value*, N> inputs_; | 1906 EmbeddedArray<Value*, N> inputs_; |
1942 | 1907 |
1943 private: | 1908 private: |
1944 friend class BranchInstr; | 1909 friend class BranchInstr; |
1945 friend class IfThenElseInstr; | 1910 friend class IfThenElseInstr; |
1946 | 1911 |
1947 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 1912 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
1948 }; | 1913 }; |
1949 | 1914 |
1950 | |
1951 class InductionVariableInfo; | 1915 class InductionVariableInfo; |
1952 | 1916 |
1953 | |
1954 class PhiInstr : public Definition { | 1917 class PhiInstr : public Definition { |
1955 public: | 1918 public: |
1956 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) | 1919 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) |
1957 : block_(block), | 1920 : block_(block), |
1958 inputs_(num_inputs), | 1921 inputs_(num_inputs), |
1959 representation_(kTagged), | 1922 representation_(kTagged), |
1960 reaching_defs_(NULL), | 1923 reaching_defs_(NULL), |
1961 loop_variable_info_(NULL), | 1924 loop_variable_info_(NULL), |
1962 is_alive_(false), | 1925 is_alive_(false), |
1963 is_receiver_(kUnknownReceiver) { | 1926 is_receiver_(kUnknownReceiver) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 GrowableArray<Value*> inputs_; | 2006 GrowableArray<Value*> inputs_; |
2044 Representation representation_; | 2007 Representation representation_; |
2045 BitVector* reaching_defs_; | 2008 BitVector* reaching_defs_; |
2046 InductionVariableInfo* loop_variable_info_; | 2009 InductionVariableInfo* loop_variable_info_; |
2047 bool is_alive_; | 2010 bool is_alive_; |
2048 int8_t is_receiver_; | 2011 int8_t is_receiver_; |
2049 | 2012 |
2050 DISALLOW_COPY_AND_ASSIGN(PhiInstr); | 2013 DISALLOW_COPY_AND_ASSIGN(PhiInstr); |
2051 }; | 2014 }; |
2052 | 2015 |
2053 | |
2054 class ParameterInstr : public Definition { | 2016 class ParameterInstr : public Definition { |
2055 public: | 2017 public: |
2056 ParameterInstr(intptr_t index, | 2018 ParameterInstr(intptr_t index, |
2057 BlockEntryInstr* block, | 2019 BlockEntryInstr* block, |
2058 Register base_reg = FPREG) | 2020 Register base_reg = FPREG) |
2059 : index_(index), base_reg_(base_reg), block_(block) {} | 2021 : index_(index), base_reg_(base_reg), block_(block) {} |
2060 | 2022 |
2061 DECLARE_INSTRUCTION(Parameter) | 2023 DECLARE_INSTRUCTION(Parameter) |
2062 | 2024 |
2063 intptr_t index() const { return index_; } | 2025 intptr_t index() const { return index_; } |
(...skipping 27 matching lines...) Expand all Loading... |
2091 private: | 2053 private: |
2092 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } | 2054 virtual void RawSetInputAt(intptr_t i, Value* value) { UNREACHABLE(); } |
2093 | 2055 |
2094 const intptr_t index_; | 2056 const intptr_t index_; |
2095 const Register base_reg_; | 2057 const Register base_reg_; |
2096 BlockEntryInstr* block_; | 2058 BlockEntryInstr* block_; |
2097 | 2059 |
2098 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); | 2060 DISALLOW_COPY_AND_ASSIGN(ParameterInstr); |
2099 }; | 2061 }; |
2100 | 2062 |
2101 | |
2102 class PushArgumentInstr : public TemplateDefinition<1, NoThrow> { | 2063 class PushArgumentInstr : public TemplateDefinition<1, NoThrow> { |
2103 public: | 2064 public: |
2104 explicit PushArgumentInstr(Value* value) { SetInputAt(0, value); } | 2065 explicit PushArgumentInstr(Value* value) { SetInputAt(0, value); } |
2105 | 2066 |
2106 DECLARE_INSTRUCTION(PushArgument) | 2067 DECLARE_INSTRUCTION(PushArgument) |
2107 | 2068 |
2108 virtual CompileType ComputeType() const; | 2069 virtual CompileType ComputeType() const; |
2109 | 2070 |
2110 Value* value() const { return InputAt(0); } | 2071 Value* value() const { return InputAt(0); } |
2111 | 2072 |
2112 virtual bool ComputeCanDeoptimize() const { return false; } | 2073 virtual bool ComputeCanDeoptimize() const { return false; } |
2113 | 2074 |
2114 virtual EffectSet Effects() const { return EffectSet::None(); } | 2075 virtual EffectSet Effects() const { return EffectSet::None(); } |
2115 | 2076 |
2116 virtual TokenPosition token_pos() const { | 2077 virtual TokenPosition token_pos() const { |
2117 return TokenPosition::kPushArgument; | 2078 return TokenPosition::kPushArgument; |
2118 } | 2079 } |
2119 | 2080 |
2120 PRINT_OPERANDS_TO_SUPPORT | 2081 PRINT_OPERANDS_TO_SUPPORT |
2121 | 2082 |
2122 private: | 2083 private: |
2123 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); | 2084 DISALLOW_COPY_AND_ASSIGN(PushArgumentInstr); |
2124 }; | 2085 }; |
2125 | 2086 |
2126 | |
2127 inline Definition* Instruction::ArgumentAt(intptr_t index) const { | 2087 inline Definition* Instruction::ArgumentAt(intptr_t index) const { |
2128 return PushArgumentAt(index)->value()->definition(); | 2088 return PushArgumentAt(index)->value()->definition(); |
2129 } | 2089 } |
2130 | 2090 |
2131 | |
2132 class ReturnInstr : public TemplateInstruction<1, NoThrow> { | 2091 class ReturnInstr : public TemplateInstruction<1, NoThrow> { |
2133 public: | 2092 public: |
2134 ReturnInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) | 2093 ReturnInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) |
2135 : TemplateInstruction(deopt_id), token_pos_(token_pos) { | 2094 : TemplateInstruction(deopt_id), token_pos_(token_pos) { |
2136 SetInputAt(0, value); | 2095 SetInputAt(0, value); |
2137 } | 2096 } |
2138 | 2097 |
2139 DECLARE_INSTRUCTION(Return) | 2098 DECLARE_INSTRUCTION(Return) |
2140 | 2099 |
2141 virtual TokenPosition token_pos() const { return token_pos_; } | 2100 virtual TokenPosition token_pos() const { return token_pos_; } |
2142 Value* value() const { return inputs_[0]; } | 2101 Value* value() const { return inputs_[0]; } |
2143 | 2102 |
2144 virtual bool CanBecomeDeoptimizationTarget() const { | 2103 virtual bool CanBecomeDeoptimizationTarget() const { |
2145 // Return instruction might turn into a Goto instruction after inlining. | 2104 // Return instruction might turn into a Goto instruction after inlining. |
2146 // Every Goto must have an environment. | 2105 // Every Goto must have an environment. |
2147 return true; | 2106 return true; |
2148 } | 2107 } |
2149 | 2108 |
2150 virtual bool ComputeCanDeoptimize() const { return false; } | 2109 virtual bool ComputeCanDeoptimize() const { return false; } |
2151 | 2110 |
2152 virtual EffectSet Effects() const { return EffectSet::None(); } | 2111 virtual EffectSet Effects() const { return EffectSet::None(); } |
2153 | 2112 |
2154 private: | 2113 private: |
2155 const TokenPosition token_pos_; | 2114 const TokenPosition token_pos_; |
2156 | 2115 |
2157 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); | 2116 DISALLOW_COPY_AND_ASSIGN(ReturnInstr); |
2158 }; | 2117 }; |
2159 | 2118 |
2160 | |
2161 class ThrowInstr : public TemplateInstruction<0, Throws> { | 2119 class ThrowInstr : public TemplateInstruction<0, Throws> { |
2162 public: | 2120 public: |
2163 explicit ThrowInstr(TokenPosition token_pos, intptr_t deopt_id) | 2121 explicit ThrowInstr(TokenPosition token_pos, intptr_t deopt_id) |
2164 : TemplateInstruction(deopt_id), token_pos_(token_pos) {} | 2122 : TemplateInstruction(deopt_id), token_pos_(token_pos) {} |
2165 | 2123 |
2166 DECLARE_INSTRUCTION(Throw) | 2124 DECLARE_INSTRUCTION(Throw) |
2167 | 2125 |
2168 virtual intptr_t ArgumentCount() const { return 1; } | 2126 virtual intptr_t ArgumentCount() const { return 1; } |
2169 | 2127 |
2170 virtual TokenPosition token_pos() const { return token_pos_; } | 2128 virtual TokenPosition token_pos() const { return token_pos_; } |
2171 | 2129 |
2172 virtual bool ComputeCanDeoptimize() const { return true; } | 2130 virtual bool ComputeCanDeoptimize() const { return true; } |
2173 | 2131 |
2174 virtual EffectSet Effects() const { return EffectSet::None(); } | 2132 virtual EffectSet Effects() const { return EffectSet::None(); } |
2175 | 2133 |
2176 private: | 2134 private: |
2177 const TokenPosition token_pos_; | 2135 const TokenPosition token_pos_; |
2178 | 2136 |
2179 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); | 2137 DISALLOW_COPY_AND_ASSIGN(ThrowInstr); |
2180 }; | 2138 }; |
2181 | 2139 |
2182 | |
2183 class ReThrowInstr : public TemplateInstruction<0, Throws> { | 2140 class ReThrowInstr : public TemplateInstruction<0, Throws> { |
2184 public: | 2141 public: |
2185 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the | 2142 // 'catch_try_index' can be CatchClauseNode::kInvalidTryIndex if the |
2186 // rethrow has been artificially generated by the parser. | 2143 // rethrow has been artificially generated by the parser. |
2187 ReThrowInstr(TokenPosition token_pos, | 2144 ReThrowInstr(TokenPosition token_pos, |
2188 intptr_t catch_try_index, | 2145 intptr_t catch_try_index, |
2189 intptr_t deopt_id) | 2146 intptr_t deopt_id) |
2190 : TemplateInstruction(deopt_id), | 2147 : TemplateInstruction(deopt_id), |
2191 token_pos_(token_pos), | 2148 token_pos_(token_pos), |
2192 catch_try_index_(catch_try_index) {} | 2149 catch_try_index_(catch_try_index) {} |
2193 | 2150 |
2194 DECLARE_INSTRUCTION(ReThrow) | 2151 DECLARE_INSTRUCTION(ReThrow) |
2195 | 2152 |
2196 virtual intptr_t ArgumentCount() const { return 2; } | 2153 virtual intptr_t ArgumentCount() const { return 2; } |
2197 | 2154 |
2198 virtual TokenPosition token_pos() const { return token_pos_; } | 2155 virtual TokenPosition token_pos() const { return token_pos_; } |
2199 intptr_t catch_try_index() const { return catch_try_index_; } | 2156 intptr_t catch_try_index() const { return catch_try_index_; } |
2200 | 2157 |
2201 virtual bool ComputeCanDeoptimize() const { return true; } | 2158 virtual bool ComputeCanDeoptimize() const { return true; } |
2202 | 2159 |
2203 virtual EffectSet Effects() const { return EffectSet::None(); } | 2160 virtual EffectSet Effects() const { return EffectSet::None(); } |
2204 | 2161 |
2205 private: | 2162 private: |
2206 const TokenPosition token_pos_; | 2163 const TokenPosition token_pos_; |
2207 const intptr_t catch_try_index_; | 2164 const intptr_t catch_try_index_; |
2208 | 2165 |
2209 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); | 2166 DISALLOW_COPY_AND_ASSIGN(ReThrowInstr); |
2210 }; | 2167 }; |
2211 | 2168 |
2212 | |
2213 class StopInstr : public TemplateInstruction<0, NoThrow> { | 2169 class StopInstr : public TemplateInstruction<0, NoThrow> { |
2214 public: | 2170 public: |
2215 explicit StopInstr(const char* message) : message_(message) { | 2171 explicit StopInstr(const char* message) : message_(message) { |
2216 ASSERT(message != NULL); | 2172 ASSERT(message != NULL); |
2217 } | 2173 } |
2218 | 2174 |
2219 const char* message() const { return message_; } | 2175 const char* message() const { return message_; } |
2220 | 2176 |
2221 DECLARE_INSTRUCTION(Stop); | 2177 DECLARE_INSTRUCTION(Stop); |
2222 | 2178 |
2223 virtual intptr_t ArgumentCount() const { return 0; } | 2179 virtual intptr_t ArgumentCount() const { return 0; } |
2224 | 2180 |
2225 virtual bool ComputeCanDeoptimize() const { return false; } | 2181 virtual bool ComputeCanDeoptimize() const { return false; } |
2226 | 2182 |
2227 virtual EffectSet Effects() const { return EffectSet::None(); } | 2183 virtual EffectSet Effects() const { return EffectSet::None(); } |
2228 | 2184 |
2229 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2185 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2230 | 2186 |
2231 private: | 2187 private: |
2232 const char* message_; | 2188 const char* message_; |
2233 | 2189 |
2234 DISALLOW_COPY_AND_ASSIGN(StopInstr); | 2190 DISALLOW_COPY_AND_ASSIGN(StopInstr); |
2235 }; | 2191 }; |
2236 | 2192 |
2237 | |
2238 class GotoInstr : public TemplateInstruction<0, NoThrow> { | 2193 class GotoInstr : public TemplateInstruction<0, NoThrow> { |
2239 public: | 2194 public: |
2240 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id) | 2195 explicit GotoInstr(JoinEntryInstr* entry, intptr_t deopt_id) |
2241 : TemplateInstruction(deopt_id), | 2196 : TemplateInstruction(deopt_id), |
2242 block_(NULL), | 2197 block_(NULL), |
2243 successor_(entry), | 2198 successor_(entry), |
2244 edge_weight_(0.0), | 2199 edge_weight_(0.0), |
2245 parallel_move_(NULL) {} | 2200 parallel_move_(NULL) {} |
2246 | 2201 |
2247 DECLARE_INSTRUCTION(Goto) | 2202 DECLARE_INSTRUCTION(Goto) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2292 private: | 2247 private: |
2293 BlockEntryInstr* block_; | 2248 BlockEntryInstr* block_; |
2294 JoinEntryInstr* successor_; | 2249 JoinEntryInstr* successor_; |
2295 double edge_weight_; | 2250 double edge_weight_; |
2296 | 2251 |
2297 // Parallel move that will be used by linear scan register allocator to | 2252 // Parallel move that will be used by linear scan register allocator to |
2298 // connect live ranges at the end of the block and resolve phis. | 2253 // connect live ranges at the end of the block and resolve phis. |
2299 ParallelMoveInstr* parallel_move_; | 2254 ParallelMoveInstr* parallel_move_; |
2300 }; | 2255 }; |
2301 | 2256 |
2302 | |
2303 // IndirectGotoInstr represents a dynamically computed jump. Only | 2257 // IndirectGotoInstr represents a dynamically computed jump. Only |
2304 // IndirectEntryInstr targets are valid targets of an indirect goto. The | 2258 // IndirectEntryInstr targets are valid targets of an indirect goto. The |
2305 // concrete target to jump to is given as a parameter to the indirect goto. | 2259 // concrete target to jump to is given as a parameter to the indirect goto. |
2306 // | 2260 // |
2307 // In order to preserve split-edge form, an indirect goto does not itself point | 2261 // In order to preserve split-edge form, an indirect goto does not itself point |
2308 // to its targets. Instead, for each possible target, the successors_ field | 2262 // to its targets. Instead, for each possible target, the successors_ field |
2309 // will contain an ordinary goto instruction that jumps to the target. | 2263 // will contain an ordinary goto instruction that jumps to the target. |
2310 // TODO(zerny): Implement direct support instead of embedding gotos. | 2264 // TODO(zerny): Implement direct support instead of embedding gotos. |
2311 // | 2265 // |
2312 // Byte offsets of all possible targets are stored in the offsets_ array. The | 2266 // Byte offsets of all possible targets are stored in the offsets_ array. The |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 Value* offset() const { return inputs_[0]; } | 2302 Value* offset() const { return inputs_[0]; } |
2349 void ComputeOffsetTable(); | 2303 void ComputeOffsetTable(); |
2350 | 2304 |
2351 PRINT_TO_SUPPORT | 2305 PRINT_TO_SUPPORT |
2352 | 2306 |
2353 private: | 2307 private: |
2354 GrowableArray<TargetEntryInstr*> successors_; | 2308 GrowableArray<TargetEntryInstr*> successors_; |
2355 TypedData& offsets_; | 2309 TypedData& offsets_; |
2356 }; | 2310 }; |
2357 | 2311 |
2358 | |
2359 class ComparisonInstr : public Definition { | 2312 class ComparisonInstr : public Definition { |
2360 public: | 2313 public: |
2361 Value* left() const { return InputAt(0); } | 2314 Value* left() const { return InputAt(0); } |
2362 Value* right() const { return InputAt(1); } | 2315 Value* right() const { return InputAt(1); } |
2363 | 2316 |
2364 virtual TokenPosition token_pos() const { return token_pos_; } | 2317 virtual TokenPosition token_pos() const { return token_pos_; } |
2365 Token::Kind kind() const { return kind_; } | 2318 Token::Kind kind() const { return kind_; } |
2366 | 2319 |
2367 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; | 2320 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right) = 0; |
2368 | 2321 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2423 operation_cid_(kIllegalCid) {} | 2376 operation_cid_(kIllegalCid) {} |
2424 | 2377 |
2425 private: | 2378 private: |
2426 const TokenPosition token_pos_; | 2379 const TokenPosition token_pos_; |
2427 Token::Kind kind_; | 2380 Token::Kind kind_; |
2428 intptr_t operation_cid_; // Set by optimizer. | 2381 intptr_t operation_cid_; // Set by optimizer. |
2429 | 2382 |
2430 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); | 2383 DISALLOW_COPY_AND_ASSIGN(ComparisonInstr); |
2431 }; | 2384 }; |
2432 | 2385 |
2433 | |
2434 class PureComparison : public ComparisonInstr { | 2386 class PureComparison : public ComparisonInstr { |
2435 public: | 2387 public: |
2436 virtual bool AllowsCSE() const { return true; } | 2388 virtual bool AllowsCSE() const { return true; } |
2437 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2389 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2438 | 2390 |
2439 virtual EffectSet Effects() const { return EffectSet::None(); } | 2391 virtual EffectSet Effects() const { return EffectSet::None(); } |
2440 | 2392 |
2441 protected: | 2393 protected: |
2442 PureComparison(TokenPosition token_pos, Token::Kind kind, intptr_t deopt_id) | 2394 PureComparison(TokenPosition token_pos, Token::Kind kind, intptr_t deopt_id) |
2443 : ComparisonInstr(token_pos, kind, deopt_id) {} | 2395 : ComparisonInstr(token_pos, kind, deopt_id) {} |
2444 }; | 2396 }; |
2445 | 2397 |
2446 | |
2447 template <intptr_t N, | 2398 template <intptr_t N, |
2448 typename ThrowsTrait, | 2399 typename ThrowsTrait, |
2449 template <typename Impure, typename Pure> class CSETrait = NoCSE> | 2400 template <typename Impure, typename Pure> class CSETrait = NoCSE> |
2450 class TemplateComparison | 2401 class TemplateComparison |
2451 : public CSETrait<ComparisonInstr, PureComparison>::Base { | 2402 : public CSETrait<ComparisonInstr, PureComparison>::Base { |
2452 public: | 2403 public: |
2453 TemplateComparison(TokenPosition token_pos, | 2404 TemplateComparison(TokenPosition token_pos, |
2454 Token::Kind kind, | 2405 Token::Kind kind, |
2455 intptr_t deopt_id = Thread::kNoDeoptId) | 2406 intptr_t deopt_id = Thread::kNoDeoptId) |
2456 : CSETrait<ComparisonInstr, PureComparison>::Base(token_pos, | 2407 : CSETrait<ComparisonInstr, PureComparison>::Base(token_pos, |
2457 kind, | 2408 kind, |
2458 deopt_id), | 2409 deopt_id), |
2459 inputs_() {} | 2410 inputs_() {} |
2460 | 2411 |
2461 virtual intptr_t InputCount() const { return N; } | 2412 virtual intptr_t InputCount() const { return N; } |
2462 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } | 2413 virtual Value* InputAt(intptr_t i) const { return inputs_[i]; } |
2463 | 2414 |
2464 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } | 2415 virtual bool MayThrow() const { return ThrowsTrait::kCanThrow; } |
2465 | 2416 |
2466 protected: | 2417 protected: |
2467 EmbeddedArray<Value*, N> inputs_; | 2418 EmbeddedArray<Value*, N> inputs_; |
2468 | 2419 |
2469 private: | 2420 private: |
2470 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } | 2421 virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; } |
2471 }; | 2422 }; |
2472 | 2423 |
2473 | |
2474 class BranchInstr : public Instruction { | 2424 class BranchInstr : public Instruction { |
2475 public: | 2425 public: |
2476 explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id) | 2426 explicit BranchInstr(ComparisonInstr* comparison, intptr_t deopt_id) |
2477 : Instruction(deopt_id), comparison_(comparison), constant_target_(NULL) { | 2427 : Instruction(deopt_id), comparison_(comparison), constant_target_(NULL) { |
2478 ASSERT(comparison->env() == NULL); | 2428 ASSERT(comparison->env() == NULL); |
2479 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { | 2429 for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) { |
2480 comparison->InputAt(i)->set_instruction(this); | 2430 comparison->InputAt(i)->set_instruction(this); |
2481 } | 2431 } |
2482 } | 2432 } |
2483 | 2433 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 } | 2493 } |
2544 | 2494 |
2545 TargetEntryInstr* true_successor_; | 2495 TargetEntryInstr* true_successor_; |
2546 TargetEntryInstr* false_successor_; | 2496 TargetEntryInstr* false_successor_; |
2547 ComparisonInstr* comparison_; | 2497 ComparisonInstr* comparison_; |
2548 TargetEntryInstr* constant_target_; | 2498 TargetEntryInstr* constant_target_; |
2549 | 2499 |
2550 DISALLOW_COPY_AND_ASSIGN(BranchInstr); | 2500 DISALLOW_COPY_AND_ASSIGN(BranchInstr); |
2551 }; | 2501 }; |
2552 | 2502 |
2553 | |
2554 class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> { | 2503 class DeoptimizeInstr : public TemplateInstruction<0, NoThrow, Pure> { |
2555 public: | 2504 public: |
2556 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) | 2505 DeoptimizeInstr(ICData::DeoptReasonId deopt_reason, intptr_t deopt_id) |
2557 : TemplateInstruction(deopt_id), deopt_reason_(deopt_reason) {} | 2506 : TemplateInstruction(deopt_id), deopt_reason_(deopt_reason) {} |
2558 | 2507 |
2559 virtual bool ComputeCanDeoptimize() const { return true; } | 2508 virtual bool ComputeCanDeoptimize() const { return true; } |
2560 | 2509 |
2561 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2510 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2562 | 2511 |
2563 DECLARE_INSTRUCTION(Deoptimize) | 2512 DECLARE_INSTRUCTION(Deoptimize) |
2564 | 2513 |
2565 private: | 2514 private: |
2566 const ICData::DeoptReasonId deopt_reason_; | 2515 const ICData::DeoptReasonId deopt_reason_; |
2567 | 2516 |
2568 DISALLOW_COPY_AND_ASSIGN(DeoptimizeInstr); | 2517 DISALLOW_COPY_AND_ASSIGN(DeoptimizeInstr); |
2569 }; | 2518 }; |
2570 | 2519 |
2571 | |
2572 class RedefinitionInstr : public TemplateDefinition<1, NoThrow> { | 2520 class RedefinitionInstr : public TemplateDefinition<1, NoThrow> { |
2573 public: | 2521 public: |
2574 explicit RedefinitionInstr(Value* value) : constrained_type_(NULL) { | 2522 explicit RedefinitionInstr(Value* value) : constrained_type_(NULL) { |
2575 SetInputAt(0, value); | 2523 SetInputAt(0, value); |
2576 } | 2524 } |
2577 | 2525 |
2578 DECLARE_INSTRUCTION(Redefinition) | 2526 DECLARE_INSTRUCTION(Redefinition) |
2579 | 2527 |
2580 Value* value() const { return inputs_[0]; } | 2528 Value* value() const { return inputs_[0]; } |
2581 | 2529 |
2582 virtual CompileType ComputeType() const; | 2530 virtual CompileType ComputeType() const; |
2583 virtual bool RecomputeType(); | 2531 virtual bool RecomputeType(); |
2584 | 2532 |
2585 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2533 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2586 | 2534 |
2587 void set_constrained_type(CompileType* type) { constrained_type_ = type; } | 2535 void set_constrained_type(CompileType* type) { constrained_type_ = type; } |
2588 CompileType* constrained_type() const { return constrained_type_; } | 2536 CompileType* constrained_type() const { return constrained_type_; } |
2589 | 2537 |
2590 virtual bool ComputeCanDeoptimize() const { return false; } | 2538 virtual bool ComputeCanDeoptimize() const { return false; } |
2591 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2539 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2592 virtual EffectSet Effects() const { return EffectSet::None(); } | 2540 virtual EffectSet Effects() const { return EffectSet::None(); } |
2593 | 2541 |
2594 private: | 2542 private: |
2595 CompileType* constrained_type_; | 2543 CompileType* constrained_type_; |
2596 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); | 2544 DISALLOW_COPY_AND_ASSIGN(RedefinitionInstr); |
2597 }; | 2545 }; |
2598 | 2546 |
2599 | |
2600 class ConstraintInstr : public TemplateDefinition<1, NoThrow> { | 2547 class ConstraintInstr : public TemplateDefinition<1, NoThrow> { |
2601 public: | 2548 public: |
2602 ConstraintInstr(Value* value, Range* constraint) | 2549 ConstraintInstr(Value* value, Range* constraint) |
2603 : constraint_(constraint), target_(NULL) { | 2550 : constraint_(constraint), target_(NULL) { |
2604 SetInputAt(0, value); | 2551 SetInputAt(0, value); |
2605 } | 2552 } |
2606 | 2553 |
2607 DECLARE_INSTRUCTION(Constraint) | 2554 DECLARE_INSTRUCTION(Constraint) |
2608 | 2555 |
2609 virtual CompileType ComputeType() const; | 2556 virtual CompileType ComputeType() const; |
(...skipping 20 matching lines...) Expand all Loading... |
2630 | 2577 |
2631 PRINT_OPERANDS_TO_SUPPORT | 2578 PRINT_OPERANDS_TO_SUPPORT |
2632 | 2579 |
2633 private: | 2580 private: |
2634 Range* constraint_; | 2581 Range* constraint_; |
2635 TargetEntryInstr* target_; | 2582 TargetEntryInstr* target_; |
2636 | 2583 |
2637 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); | 2584 DISALLOW_COPY_AND_ASSIGN(ConstraintInstr); |
2638 }; | 2585 }; |
2639 | 2586 |
2640 | |
2641 class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> { | 2587 class ConstantInstr : public TemplateDefinition<0, NoThrow, Pure> { |
2642 public: | 2588 public: |
2643 ConstantInstr(const Object& value, | 2589 ConstantInstr(const Object& value, |
2644 TokenPosition token_pos = TokenPosition::kConstant); | 2590 TokenPosition token_pos = TokenPosition::kConstant); |
2645 | 2591 |
2646 DECLARE_INSTRUCTION(Constant) | 2592 DECLARE_INSTRUCTION(Constant) |
2647 virtual CompileType ComputeType() const; | 2593 virtual CompileType ComputeType() const; |
2648 | 2594 |
2649 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2595 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2650 | 2596 |
2651 const Object& value() const { return value_; } | 2597 const Object& value() const { return value_; } |
2652 | 2598 |
2653 virtual bool ComputeCanDeoptimize() const { return false; } | 2599 virtual bool ComputeCanDeoptimize() const { return false; } |
2654 | 2600 |
2655 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 2601 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
2656 | 2602 |
2657 virtual bool AttributesEqual(Instruction* other) const; | 2603 virtual bool AttributesEqual(Instruction* other) const; |
2658 | 2604 |
2659 virtual TokenPosition token_pos() const { return token_pos_; } | 2605 virtual TokenPosition token_pos() const { return token_pos_; } |
2660 | 2606 |
2661 PRINT_OPERANDS_TO_SUPPORT | 2607 PRINT_OPERANDS_TO_SUPPORT |
2662 | 2608 |
2663 private: | 2609 private: |
2664 const Object& value_; | 2610 const Object& value_; |
2665 const TokenPosition token_pos_; | 2611 const TokenPosition token_pos_; |
2666 | 2612 |
2667 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); | 2613 DISALLOW_COPY_AND_ASSIGN(ConstantInstr); |
2668 }; | 2614 }; |
2669 | 2615 |
2670 | |
2671 // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr. | 2616 // Merged ConstantInstr -> UnboxedXXX into UnboxedConstantInstr. |
2672 // TODO(srdjan): Implemented currently for doubles only, should implement | 2617 // TODO(srdjan): Implemented currently for doubles only, should implement |
2673 // for other unboxing instructions. | 2618 // for other unboxing instructions. |
2674 class UnboxedConstantInstr : public ConstantInstr { | 2619 class UnboxedConstantInstr : public ConstantInstr { |
2675 public: | 2620 public: |
2676 explicit UnboxedConstantInstr(const Object& value, | 2621 explicit UnboxedConstantInstr(const Object& value, |
2677 Representation representation); | 2622 Representation representation); |
2678 | 2623 |
2679 virtual Representation representation() const { return representation_; } | 2624 virtual Representation representation() const { return representation_; } |
2680 | 2625 |
2681 // Either NULL or the address of the unboxed constant. | 2626 // Either NULL or the address of the unboxed constant. |
2682 uword constant_address() const { return constant_address_; } | 2627 uword constant_address() const { return constant_address_; } |
2683 | 2628 |
2684 DECLARE_INSTRUCTION(UnboxedConstant) | 2629 DECLARE_INSTRUCTION(UnboxedConstant) |
2685 | 2630 |
2686 private: | 2631 private: |
2687 const Representation representation_; | 2632 const Representation representation_; |
2688 uword constant_address_; // Either NULL or points to the untagged constant. | 2633 uword constant_address_; // Either NULL or points to the untagged constant. |
2689 | 2634 |
2690 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); | 2635 DISALLOW_COPY_AND_ASSIGN(UnboxedConstantInstr); |
2691 }; | 2636 }; |
2692 | 2637 |
2693 | |
2694 class AssertAssignableInstr : public TemplateDefinition<3, Throws, Pure> { | 2638 class AssertAssignableInstr : public TemplateDefinition<3, Throws, Pure> { |
2695 public: | 2639 public: |
2696 AssertAssignableInstr(TokenPosition token_pos, | 2640 AssertAssignableInstr(TokenPosition token_pos, |
2697 Value* value, | 2641 Value* value, |
2698 Value* instantiator_type_arguments, | 2642 Value* instantiator_type_arguments, |
2699 Value* function_type_arguments, | 2643 Value* function_type_arguments, |
2700 const AbstractType& dst_type, | 2644 const AbstractType& dst_type, |
2701 const String& dst_name, | 2645 const String& dst_name, |
2702 intptr_t deopt_id) | 2646 intptr_t deopt_id) |
2703 : TemplateDefinition(deopt_id), | 2647 : TemplateDefinition(deopt_id), |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2743 PRINT_OPERANDS_TO_SUPPORT | 2687 PRINT_OPERANDS_TO_SUPPORT |
2744 | 2688 |
2745 private: | 2689 private: |
2746 const TokenPosition token_pos_; | 2690 const TokenPosition token_pos_; |
2747 AbstractType& dst_type_; | 2691 AbstractType& dst_type_; |
2748 const String& dst_name_; | 2692 const String& dst_name_; |
2749 | 2693 |
2750 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); | 2694 DISALLOW_COPY_AND_ASSIGN(AssertAssignableInstr); |
2751 }; | 2695 }; |
2752 | 2696 |
2753 | |
2754 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { | 2697 class AssertBooleanInstr : public TemplateDefinition<1, Throws, Pure> { |
2755 public: | 2698 public: |
2756 AssertBooleanInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) | 2699 AssertBooleanInstr(TokenPosition token_pos, Value* value, intptr_t deopt_id) |
2757 : TemplateDefinition(deopt_id), token_pos_(token_pos) { | 2700 : TemplateDefinition(deopt_id), token_pos_(token_pos) { |
2758 SetInputAt(0, value); | 2701 SetInputAt(0, value); |
2759 } | 2702 } |
2760 | 2703 |
2761 DECLARE_INSTRUCTION(AssertBoolean) | 2704 DECLARE_INSTRUCTION(AssertBoolean) |
2762 virtual CompileType ComputeType() const; | 2705 virtual CompileType ComputeType() const; |
2763 | 2706 |
2764 virtual TokenPosition token_pos() const { return token_pos_; } | 2707 virtual TokenPosition token_pos() const { return token_pos_; } |
2765 Value* value() const { return inputs_[0]; } | 2708 Value* value() const { return inputs_[0]; } |
2766 | 2709 |
2767 virtual bool ComputeCanDeoptimize() const { return true; } | 2710 virtual bool ComputeCanDeoptimize() const { return true; } |
2768 | 2711 |
2769 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2712 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2770 | 2713 |
2771 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2714 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2772 | 2715 |
2773 PRINT_OPERANDS_TO_SUPPORT | 2716 PRINT_OPERANDS_TO_SUPPORT |
2774 | 2717 |
2775 private: | 2718 private: |
2776 const TokenPosition token_pos_; | 2719 const TokenPosition token_pos_; |
2777 | 2720 |
2778 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); | 2721 DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr); |
2779 }; | 2722 }; |
2780 | 2723 |
2781 | |
2782 // Denotes a special parameter, currently either the context of a closure | 2724 // Denotes a special parameter, currently either the context of a closure |
2783 // or the type arguments of a generic function. | 2725 // or the type arguments of a generic function. |
2784 class SpecialParameterInstr : public TemplateDefinition<0, NoThrow> { | 2726 class SpecialParameterInstr : public TemplateDefinition<0, NoThrow> { |
2785 public: | 2727 public: |
2786 enum SpecialParameterKind { kContext, kTypeArgs }; | 2728 enum SpecialParameterKind { kContext, kTypeArgs }; |
2787 SpecialParameterInstr(SpecialParameterKind kind, intptr_t deopt_id) | 2729 SpecialParameterInstr(SpecialParameterKind kind, intptr_t deopt_id) |
2788 : TemplateDefinition(deopt_id), kind_(kind) {} | 2730 : TemplateDefinition(deopt_id), kind_(kind) {} |
2789 | 2731 |
2790 DECLARE_INSTRUCTION(SpecialParameter) | 2732 DECLARE_INSTRUCTION(SpecialParameter) |
2791 virtual CompileType ComputeType() const; | 2733 virtual CompileType ComputeType() const; |
2792 | 2734 |
2793 virtual bool ComputeCanDeoptimize() const { return false; } | 2735 virtual bool ComputeCanDeoptimize() const { return false; } |
2794 | 2736 |
2795 virtual EffectSet Effects() const { return EffectSet::None(); } | 2737 virtual EffectSet Effects() const { return EffectSet::None(); } |
2796 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2738 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2797 virtual bool AttributesEqual(Instruction* other) const { | 2739 virtual bool AttributesEqual(Instruction* other) const { |
2798 return kind() == other->AsSpecialParameter()->kind(); | 2740 return kind() == other->AsSpecialParameter()->kind(); |
2799 } | 2741 } |
2800 SpecialParameterKind kind() const { return kind_; } | 2742 SpecialParameterKind kind() const { return kind_; } |
2801 | 2743 |
2802 private: | 2744 private: |
2803 const SpecialParameterKind kind_; | 2745 const SpecialParameterKind kind_; |
2804 DISALLOW_COPY_AND_ASSIGN(SpecialParameterInstr); | 2746 DISALLOW_COPY_AND_ASSIGN(SpecialParameterInstr); |
2805 }; | 2747 }; |
2806 | 2748 |
2807 | |
2808 struct ArgumentsInfo { | 2749 struct ArgumentsInfo { |
2809 ArgumentsInfo(intptr_t type_args_len, | 2750 ArgumentsInfo(intptr_t type_args_len, |
2810 intptr_t pushed_argc, | 2751 intptr_t pushed_argc, |
2811 const Array& argument_names) | 2752 const Array& argument_names) |
2812 : type_args_len(type_args_len), | 2753 : type_args_len(type_args_len), |
2813 pushed_argc(pushed_argc), | 2754 pushed_argc(pushed_argc), |
2814 argument_names(argument_names) {} | 2755 argument_names(argument_names) {} |
2815 | 2756 |
2816 RawArray* ToArgumentsDescriptor() const { | 2757 RawArray* ToArgumentsDescriptor() const { |
2817 return ArgumentsDescriptor::New(type_args_len, | 2758 return ArgumentsDescriptor::New(type_args_len, |
2818 pushed_argc - (type_args_len > 0 ? 1 : 0), | 2759 pushed_argc - (type_args_len > 0 ? 1 : 0), |
2819 argument_names); | 2760 argument_names); |
2820 } | 2761 } |
2821 | 2762 |
2822 intptr_t type_args_len; | 2763 intptr_t type_args_len; |
2823 intptr_t pushed_argc; | 2764 intptr_t pushed_argc; |
2824 const Array& argument_names; | 2765 const Array& argument_names; |
2825 }; | 2766 }; |
2826 | 2767 |
2827 | |
2828 template <intptr_t kInputCount> | 2768 template <intptr_t kInputCount> |
2829 class TemplateDartCall : public TemplateDefinition<kInputCount, Throws> { | 2769 class TemplateDartCall : public TemplateDefinition<kInputCount, Throws> { |
2830 public: | 2770 public: |
2831 TemplateDartCall(intptr_t deopt_id, | 2771 TemplateDartCall(intptr_t deopt_id, |
2832 intptr_t type_args_len, | 2772 intptr_t type_args_len, |
2833 const Array& argument_names, | 2773 const Array& argument_names, |
2834 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2774 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
2835 TokenPosition token_pos) | 2775 TokenPosition token_pos) |
2836 : TemplateDefinition<kInputCount, Throws>(deopt_id), | 2776 : TemplateDefinition<kInputCount, Throws>(deopt_id), |
2837 type_args_len_(type_args_len), | 2777 type_args_len_(type_args_len), |
(...skipping 22 matching lines...) Expand all Loading... |
2860 | 2800 |
2861 private: | 2801 private: |
2862 intptr_t type_args_len_; | 2802 intptr_t type_args_len_; |
2863 const Array& argument_names_; | 2803 const Array& argument_names_; |
2864 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 2804 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
2865 TokenPosition token_pos_; | 2805 TokenPosition token_pos_; |
2866 | 2806 |
2867 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); | 2807 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); |
2868 }; | 2808 }; |
2869 | 2809 |
2870 | |
2871 class ClosureCallInstr : public TemplateDartCall<1> { | 2810 class ClosureCallInstr : public TemplateDartCall<1> { |
2872 public: | 2811 public: |
2873 ClosureCallInstr(Value* function, | 2812 ClosureCallInstr(Value* function, |
2874 ClosureCallNode* node, | 2813 ClosureCallNode* node, |
2875 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2814 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
2876 intptr_t deopt_id) | 2815 intptr_t deopt_id) |
2877 : TemplateDartCall(deopt_id, | 2816 : TemplateDartCall(deopt_id, |
2878 node->arguments()->type_args_len(), | 2817 node->arguments()->type_args_len(), |
2879 node->arguments()->names(), | 2818 node->arguments()->names(), |
2880 arguments, | 2819 arguments, |
(...skipping 25 matching lines...) Expand all Loading... |
2906 virtual bool ComputeCanDeoptimize() const { return true; } | 2845 virtual bool ComputeCanDeoptimize() const { return true; } |
2907 | 2846 |
2908 virtual EffectSet Effects() const { return EffectSet::All(); } | 2847 virtual EffectSet Effects() const { return EffectSet::All(); } |
2909 | 2848 |
2910 PRINT_OPERANDS_TO_SUPPORT | 2849 PRINT_OPERANDS_TO_SUPPORT |
2911 | 2850 |
2912 private: | 2851 private: |
2913 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); | 2852 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); |
2914 }; | 2853 }; |
2915 | 2854 |
2916 | |
2917 class InstanceCallInstr : public TemplateDartCall<0> { | 2855 class InstanceCallInstr : public TemplateDartCall<0> { |
2918 public: | 2856 public: |
2919 InstanceCallInstr(TokenPosition token_pos, | 2857 InstanceCallInstr(TokenPosition token_pos, |
2920 const String& function_name, | 2858 const String& function_name, |
2921 Token::Kind token_kind, | 2859 Token::Kind token_kind, |
2922 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2860 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
2923 intptr_t type_args_len, | 2861 intptr_t type_args_len, |
2924 const Array& argument_names, | 2862 const Array& argument_names, |
2925 intptr_t checked_argument_count, | 2863 intptr_t checked_argument_count, |
2926 const ZoneGrowableArray<const ICData*>& ic_data_array, | 2864 const ZoneGrowableArray<const ICData*>& ic_data_array, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2992 private: | 2930 private: |
2993 const ICData* ic_data_; | 2931 const ICData* ic_data_; |
2994 const String& function_name_; | 2932 const String& function_name_; |
2995 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 2933 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
2996 const intptr_t checked_argument_count_; | 2934 const intptr_t checked_argument_count_; |
2997 bool has_unique_selector_; | 2935 bool has_unique_selector_; |
2998 | 2936 |
2999 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); | 2937 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); |
3000 }; | 2938 }; |
3001 | 2939 |
3002 | |
3003 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { | 2940 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
3004 public: | 2941 public: |
3005 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2942 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
3006 const CallTargets& targets, | 2943 const CallTargets& targets, |
3007 bool complete) | 2944 bool complete) |
3008 : TemplateDefinition(instance_call->deopt_id()), | 2945 : TemplateDefinition(instance_call->deopt_id()), |
3009 instance_call_(instance_call), | 2946 instance_call_(instance_call), |
3010 targets_(targets), | 2947 targets_(targets), |
3011 complete_(complete) { | 2948 complete_(complete) { |
3012 ASSERT(instance_call_ != NULL); | 2949 ASSERT(instance_call_ != NULL); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3069 InstanceCallInstr* instance_call_; | 3006 InstanceCallInstr* instance_call_; |
3070 const CallTargets& targets_; | 3007 const CallTargets& targets_; |
3071 const bool complete_; | 3008 const bool complete_; |
3072 intptr_t total_call_count_; | 3009 intptr_t total_call_count_; |
3073 | 3010 |
3074 friend class PolymorphicInliner; | 3011 friend class PolymorphicInliner; |
3075 | 3012 |
3076 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); | 3013 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); |
3077 }; | 3014 }; |
3078 | 3015 |
3079 | |
3080 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { | 3016 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { |
3081 public: | 3017 public: |
3082 StrictCompareInstr(TokenPosition token_pos, | 3018 StrictCompareInstr(TokenPosition token_pos, |
3083 Token::Kind kind, | 3019 Token::Kind kind, |
3084 Value* left, | 3020 Value* left, |
3085 Value* right, | 3021 Value* right, |
3086 bool needs_number_check, | 3022 bool needs_number_check, |
3087 intptr_t deopt_id); | 3023 intptr_t deopt_id); |
3088 | 3024 |
3089 DECLARE_COMPARISON_INSTRUCTION(StrictCompare) | 3025 DECLARE_COMPARISON_INSTRUCTION(StrictCompare) |
(...skipping 14 matching lines...) Expand all Loading... |
3104 PRINT_OPERANDS_TO_SUPPORT | 3040 PRINT_OPERANDS_TO_SUPPORT |
3105 | 3041 |
3106 private: | 3042 private: |
3107 // True if the comparison must check for double, Mint or Bigint and | 3043 // True if the comparison must check for double, Mint or Bigint and |
3108 // use value comparison instead. | 3044 // use value comparison instead. |
3109 bool needs_number_check_; | 3045 bool needs_number_check_; |
3110 | 3046 |
3111 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); | 3047 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); |
3112 }; | 3048 }; |
3113 | 3049 |
3114 | |
3115 // Comparison instruction that is equivalent to the (left & right) == 0 | 3050 // Comparison instruction that is equivalent to the (left & right) == 0 |
3116 // comparison pattern. | 3051 // comparison pattern. |
3117 class TestSmiInstr : public TemplateComparison<2, NoThrow, Pure> { | 3052 class TestSmiInstr : public TemplateComparison<2, NoThrow, Pure> { |
3118 public: | 3053 public: |
3119 TestSmiInstr(TokenPosition token_pos, | 3054 TestSmiInstr(TokenPosition token_pos, |
3120 Token::Kind kind, | 3055 Token::Kind kind, |
3121 Value* left, | 3056 Value* left, |
3122 Value* right) | 3057 Value* right) |
3123 : TemplateComparison(token_pos, kind) { | 3058 : TemplateComparison(token_pos, kind) { |
3124 ASSERT(kind == Token::kEQ || kind == Token::kNE); | 3059 ASSERT(kind == Token::kEQ || kind == Token::kNE); |
(...skipping 10 matching lines...) Expand all Loading... |
3135 virtual bool ComputeCanDeoptimize() const { return false; } | 3070 virtual bool ComputeCanDeoptimize() const { return false; } |
3136 | 3071 |
3137 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 3072 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
3138 return kTagged; | 3073 return kTagged; |
3139 } | 3074 } |
3140 | 3075 |
3141 private: | 3076 private: |
3142 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); | 3077 DISALLOW_COPY_AND_ASSIGN(TestSmiInstr); |
3143 }; | 3078 }; |
3144 | 3079 |
3145 | |
3146 // Checks the input value cid against cids stored in a table and returns either | 3080 // Checks the input value cid against cids stored in a table and returns either |
3147 // a result or deoptimizes. If the cid is not in the list and there is a deopt | 3081 // a result or deoptimizes. If the cid is not in the list and there is a deopt |
3148 // id, then the instruction deoptimizes. If there is no deopt id, all the | 3082 // id, then the instruction deoptimizes. If there is no deopt id, all the |
3149 // results must be the same (all true or all false) and the instruction returns | 3083 // results must be the same (all true or all false) and the instruction returns |
3150 // the opposite for cids not on the list. The first element in the table must | 3084 // the opposite for cids not on the list. The first element in the table must |
3151 // always be the result for the Smi class-id and is allowed to differ from the | 3085 // always be the result for the Smi class-id and is allowed to differ from the |
3152 // other results even in the no-deopt case. | 3086 // other results even in the no-deopt case. |
3153 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { | 3087 class TestCidsInstr : public TemplateComparison<1, NoThrow, Pure> { |
3154 public: | 3088 public: |
3155 TestCidsInstr(TokenPosition token_pos, | 3089 TestCidsInstr(TokenPosition token_pos, |
(...skipping 27 matching lines...) Expand all Loading... |
3183 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 3117 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
3184 | 3118 |
3185 PRINT_OPERANDS_TO_SUPPORT | 3119 PRINT_OPERANDS_TO_SUPPORT |
3186 | 3120 |
3187 private: | 3121 private: |
3188 const ZoneGrowableArray<intptr_t>& cid_results_; | 3122 const ZoneGrowableArray<intptr_t>& cid_results_; |
3189 bool licm_hoisted_; | 3123 bool licm_hoisted_; |
3190 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); | 3124 DISALLOW_COPY_AND_ASSIGN(TestCidsInstr); |
3191 }; | 3125 }; |
3192 | 3126 |
3193 | |
3194 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { | 3127 class EqualityCompareInstr : public TemplateComparison<2, NoThrow, Pure> { |
3195 public: | 3128 public: |
3196 EqualityCompareInstr(TokenPosition token_pos, | 3129 EqualityCompareInstr(TokenPosition token_pos, |
3197 Token::Kind kind, | 3130 Token::Kind kind, |
3198 Value* left, | 3131 Value* left, |
3199 Value* right, | 3132 Value* right, |
3200 intptr_t cid, | 3133 intptr_t cid, |
3201 intptr_t deopt_id) | 3134 intptr_t deopt_id) |
3202 : TemplateComparison(token_pos, kind, deopt_id) { | 3135 : TemplateComparison(token_pos, kind, deopt_id) { |
3203 ASSERT(Token::IsEqualityOperator(kind)); | 3136 ASSERT(Token::IsEqualityOperator(kind)); |
(...skipping 16 matching lines...) Expand all Loading... |
3220 if (operation_cid() == kMintCid) return kUnboxedMint; | 3153 if (operation_cid() == kMintCid) return kUnboxedMint; |
3221 return kTagged; | 3154 return kTagged; |
3222 } | 3155 } |
3223 | 3156 |
3224 PRINT_OPERANDS_TO_SUPPORT | 3157 PRINT_OPERANDS_TO_SUPPORT |
3225 | 3158 |
3226 private: | 3159 private: |
3227 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); | 3160 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); |
3228 }; | 3161 }; |
3229 | 3162 |
3230 | |
3231 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { | 3163 class RelationalOpInstr : public TemplateComparison<2, NoThrow, Pure> { |
3232 public: | 3164 public: |
3233 RelationalOpInstr(TokenPosition token_pos, | 3165 RelationalOpInstr(TokenPosition token_pos, |
3234 Token::Kind kind, | 3166 Token::Kind kind, |
3235 Value* left, | 3167 Value* left, |
3236 Value* right, | 3168 Value* right, |
3237 intptr_t cid, | 3169 intptr_t cid, |
3238 intptr_t deopt_id) | 3170 intptr_t deopt_id) |
3239 : TemplateComparison(token_pos, kind, deopt_id) { | 3171 : TemplateComparison(token_pos, kind, deopt_id) { |
3240 ASSERT(Token::IsRelationalOperator(kind)); | 3172 ASSERT(Token::IsRelationalOperator(kind)); |
(...skipping 16 matching lines...) Expand all Loading... |
3257 if (operation_cid() == kMintCid) return kUnboxedMint; | 3189 if (operation_cid() == kMintCid) return kUnboxedMint; |
3258 return kTagged; | 3190 return kTagged; |
3259 } | 3191 } |
3260 | 3192 |
3261 PRINT_OPERANDS_TO_SUPPORT | 3193 PRINT_OPERANDS_TO_SUPPORT |
3262 | 3194 |
3263 private: | 3195 private: |
3264 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); | 3196 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); |
3265 }; | 3197 }; |
3266 | 3198 |
3267 | |
3268 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for | 3199 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for |
3269 // materialization of true and false constants. | 3200 // materialization of true and false constants. |
3270 class IfThenElseInstr : public Definition { | 3201 class IfThenElseInstr : public Definition { |
3271 public: | 3202 public: |
3272 IfThenElseInstr(ComparisonInstr* comparison, | 3203 IfThenElseInstr(ComparisonInstr* comparison, |
3273 Value* if_true, | 3204 Value* if_true, |
3274 Value* if_false, | 3205 Value* if_false, |
3275 intptr_t deopt_id) | 3206 intptr_t deopt_id) |
3276 : Definition(deopt_id), | 3207 : Definition(deopt_id), |
3277 comparison_(comparison), | 3208 comparison_(comparison), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3340 comparison()->RawSetInputAt(i, value); | 3271 comparison()->RawSetInputAt(i, value); |
3341 } | 3272 } |
3342 | 3273 |
3343 ComparisonInstr* comparison_; | 3274 ComparisonInstr* comparison_; |
3344 const intptr_t if_true_; | 3275 const intptr_t if_true_; |
3345 const intptr_t if_false_; | 3276 const intptr_t if_false_; |
3346 | 3277 |
3347 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); | 3278 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); |
3348 }; | 3279 }; |
3349 | 3280 |
3350 | |
3351 class StaticCallInstr : public TemplateDartCall<0> { | 3281 class StaticCallInstr : public TemplateDartCall<0> { |
3352 public: | 3282 public: |
3353 StaticCallInstr(TokenPosition token_pos, | 3283 StaticCallInstr(TokenPosition token_pos, |
3354 const Function& function, | 3284 const Function& function, |
3355 intptr_t type_args_len, | 3285 intptr_t type_args_len, |
3356 const Array& argument_names, | 3286 const Array& argument_names, |
3357 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3287 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3358 const ZoneGrowableArray<const ICData*>& ic_data_array, | 3288 const ZoneGrowableArray<const ICData*>& ic_data_array, |
3359 intptr_t deopt_id) | 3289 intptr_t deopt_id) |
3360 : TemplateDartCall(deopt_id, | 3290 : TemplateDartCall(deopt_id, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3459 intptr_t result_cid_; // For some library functions we know the result. | 3389 intptr_t result_cid_; // For some library functions we know the result. |
3460 | 3390 |
3461 // 'True' for recognized list constructors. | 3391 // 'True' for recognized list constructors. |
3462 bool is_known_list_constructor_; | 3392 bool is_known_list_constructor_; |
3463 | 3393 |
3464 AliasIdentity identity_; | 3394 AliasIdentity identity_; |
3465 | 3395 |
3466 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); | 3396 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
3467 }; | 3397 }; |
3468 | 3398 |
3469 | |
3470 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { | 3399 class LoadLocalInstr : public TemplateDefinition<0, NoThrow> { |
3471 public: | 3400 public: |
3472 LoadLocalInstr(const LocalVariable& local, TokenPosition token_pos) | 3401 LoadLocalInstr(const LocalVariable& local, TokenPosition token_pos) |
3473 : local_(local), is_last_(false), token_pos_(token_pos) {} | 3402 : local_(local), is_last_(false), token_pos_(token_pos) {} |
3474 | 3403 |
3475 DECLARE_INSTRUCTION(LoadLocal) | 3404 DECLARE_INSTRUCTION(LoadLocal) |
3476 virtual CompileType ComputeType() const; | 3405 virtual CompileType ComputeType() const; |
3477 | 3406 |
3478 const LocalVariable& local() const { return local_; } | 3407 const LocalVariable& local() const { return local_; } |
3479 | 3408 |
(...skipping 12 matching lines...) Expand all Loading... |
3492 PRINT_OPERANDS_TO_SUPPORT | 3421 PRINT_OPERANDS_TO_SUPPORT |
3493 | 3422 |
3494 private: | 3423 private: |
3495 const LocalVariable& local_; | 3424 const LocalVariable& local_; |
3496 bool is_last_; | 3425 bool is_last_; |
3497 const TokenPosition token_pos_; | 3426 const TokenPosition token_pos_; |
3498 | 3427 |
3499 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); | 3428 DISALLOW_COPY_AND_ASSIGN(LoadLocalInstr); |
3500 }; | 3429 }; |
3501 | 3430 |
3502 | |
3503 class DropTempsInstr : public Definition { | 3431 class DropTempsInstr : public Definition { |
3504 public: | 3432 public: |
3505 DropTempsInstr(intptr_t num_temps, Value* value) | 3433 DropTempsInstr(intptr_t num_temps, Value* value) |
3506 : num_temps_(num_temps), value_(NULL) { | 3434 : num_temps_(num_temps), value_(NULL) { |
3507 if (value != NULL) { | 3435 if (value != NULL) { |
3508 SetInputAt(0, value); | 3436 SetInputAt(0, value); |
3509 } | 3437 } |
3510 } | 3438 } |
3511 | 3439 |
3512 DECLARE_INSTRUCTION(DropTemps) | 3440 DECLARE_INSTRUCTION(DropTemps) |
(...skipping 28 matching lines...) Expand all Loading... |
3541 | 3469 |
3542 private: | 3470 private: |
3543 virtual void RawSetInputAt(intptr_t i, Value* value) { value_ = value; } | 3471 virtual void RawSetInputAt(intptr_t i, Value* value) { value_ = value; } |
3544 | 3472 |
3545 const intptr_t num_temps_; | 3473 const intptr_t num_temps_; |
3546 Value* value_; | 3474 Value* value_; |
3547 | 3475 |
3548 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); | 3476 DISALLOW_COPY_AND_ASSIGN(DropTempsInstr); |
3549 }; | 3477 }; |
3550 | 3478 |
3551 | |
3552 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { | 3479 class StoreLocalInstr : public TemplateDefinition<1, NoThrow> { |
3553 public: | 3480 public: |
3554 StoreLocalInstr(const LocalVariable& local, | 3481 StoreLocalInstr(const LocalVariable& local, |
3555 Value* value, | 3482 Value* value, |
3556 TokenPosition token_pos) | 3483 TokenPosition token_pos) |
3557 : local_(local), is_dead_(false), is_last_(false), token_pos_(token_pos) { | 3484 : local_(local), is_dead_(false), is_last_(false), token_pos_(token_pos) { |
3558 SetInputAt(0, value); | 3485 SetInputAt(0, value); |
3559 } | 3486 } |
3560 | 3487 |
3561 DECLARE_INSTRUCTION(StoreLocal) | 3488 DECLARE_INSTRUCTION(StoreLocal) |
(...skipping 21 matching lines...) Expand all Loading... |
3583 | 3510 |
3584 private: | 3511 private: |
3585 const LocalVariable& local_; | 3512 const LocalVariable& local_; |
3586 bool is_dead_; | 3513 bool is_dead_; |
3587 bool is_last_; | 3514 bool is_last_; |
3588 const TokenPosition token_pos_; | 3515 const TokenPosition token_pos_; |
3589 | 3516 |
3590 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); | 3517 DISALLOW_COPY_AND_ASSIGN(StoreLocalInstr); |
3591 }; | 3518 }; |
3592 | 3519 |
3593 | |
3594 class NativeCallInstr : public TemplateDefinition<0, Throws> { | 3520 class NativeCallInstr : public TemplateDefinition<0, Throws> { |
3595 public: | 3521 public: |
3596 explicit NativeCallInstr(NativeBodyNode* node) | 3522 explicit NativeCallInstr(NativeBodyNode* node) |
3597 : native_name_(&node->native_c_function_name()), | 3523 : native_name_(&node->native_c_function_name()), |
3598 function_(&node->function()), | 3524 function_(&node->function()), |
3599 native_c_function_(NULL), | 3525 native_c_function_(NULL), |
3600 is_bootstrap_native_(false), | 3526 is_bootstrap_native_(false), |
3601 link_lazily_(node->link_lazily()), | 3527 link_lazily_(node->link_lazily()), |
3602 token_pos_(node->token_pos()) {} | 3528 token_pos_(node->token_pos()) {} |
3603 | 3529 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3643 const Function* function_; | 3569 const Function* function_; |
3644 NativeFunction native_c_function_; | 3570 NativeFunction native_c_function_; |
3645 bool is_bootstrap_native_; | 3571 bool is_bootstrap_native_; |
3646 bool is_auto_scope_; | 3572 bool is_auto_scope_; |
3647 bool link_lazily_; | 3573 bool link_lazily_; |
3648 const TokenPosition token_pos_; | 3574 const TokenPosition token_pos_; |
3649 | 3575 |
3650 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); | 3576 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); |
3651 }; | 3577 }; |
3652 | 3578 |
3653 | |
3654 class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> { | 3579 class DebugStepCheckInstr : public TemplateInstruction<0, NoThrow> { |
3655 public: | 3580 public: |
3656 DebugStepCheckInstr(TokenPosition token_pos, | 3581 DebugStepCheckInstr(TokenPosition token_pos, |
3657 RawPcDescriptors::Kind stub_kind, | 3582 RawPcDescriptors::Kind stub_kind, |
3658 intptr_t deopt_id) | 3583 intptr_t deopt_id) |
3659 : TemplateInstruction<0, NoThrow>(deopt_id), | 3584 : TemplateInstruction<0, NoThrow>(deopt_id), |
3660 token_pos_(token_pos), | 3585 token_pos_(token_pos), |
3661 stub_kind_(stub_kind) {} | 3586 stub_kind_(stub_kind) {} |
3662 | 3587 |
3663 DECLARE_INSTRUCTION(DebugStepCheck) | 3588 DECLARE_INSTRUCTION(DebugStepCheck) |
3664 | 3589 |
3665 virtual TokenPosition token_pos() const { return token_pos_; } | 3590 virtual TokenPosition token_pos() const { return token_pos_; } |
3666 virtual bool ComputeCanDeoptimize() const { return false; } | 3591 virtual bool ComputeCanDeoptimize() const { return false; } |
3667 virtual EffectSet Effects() const { return EffectSet::All(); } | 3592 virtual EffectSet Effects() const { return EffectSet::All(); } |
3668 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 3593 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
3669 | 3594 |
3670 private: | 3595 private: |
3671 const TokenPosition token_pos_; | 3596 const TokenPosition token_pos_; |
3672 const RawPcDescriptors::Kind stub_kind_; | 3597 const RawPcDescriptors::Kind stub_kind_; |
3673 | 3598 |
3674 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); | 3599 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); |
3675 }; | 3600 }; |
3676 | 3601 |
3677 | |
3678 enum StoreBarrierType { kNoStoreBarrier, kEmitStoreBarrier }; | 3602 enum StoreBarrierType { kNoStoreBarrier, kEmitStoreBarrier }; |
3679 | 3603 |
3680 | |
3681 class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> { | 3604 class StoreInstanceFieldInstr : public TemplateDefinition<2, NoThrow> { |
3682 public: | 3605 public: |
3683 StoreInstanceFieldInstr(const Field& field, | 3606 StoreInstanceFieldInstr(const Field& field, |
3684 Value* instance, | 3607 Value* instance, |
3685 Value* value, | 3608 Value* value, |
3686 StoreBarrierType emit_store_barrier, | 3609 StoreBarrierType emit_store_barrier, |
3687 TokenPosition token_pos) | 3610 TokenPosition token_pos) |
3688 : field_(field), | 3611 : field_(field), |
3689 offset_in_bytes_(field.Offset()), | 3612 offset_in_bytes_(field.Offset()), |
3690 emit_store_barrier_(emit_store_barrier), | 3613 emit_store_barrier_(emit_store_barrier), |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3760 const Field& field_; | 3683 const Field& field_; |
3761 intptr_t offset_in_bytes_; | 3684 intptr_t offset_in_bytes_; |
3762 const StoreBarrierType emit_store_barrier_; | 3685 const StoreBarrierType emit_store_barrier_; |
3763 const TokenPosition token_pos_; | 3686 const TokenPosition token_pos_; |
3764 // Marks initializing stores. E.g. in the constructor. | 3687 // Marks initializing stores. E.g. in the constructor. |
3765 bool is_initialization_; | 3688 bool is_initialization_; |
3766 | 3689 |
3767 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); | 3690 DISALLOW_COPY_AND_ASSIGN(StoreInstanceFieldInstr); |
3768 }; | 3691 }; |
3769 | 3692 |
3770 | |
3771 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { | 3693 class GuardFieldInstr : public TemplateInstruction<1, NoThrow, Pure> { |
3772 public: | 3694 public: |
3773 GuardFieldInstr(Value* value, const Field& field, intptr_t deopt_id) | 3695 GuardFieldInstr(Value* value, const Field& field, intptr_t deopt_id) |
3774 : TemplateInstruction(deopt_id), field_(field) { | 3696 : TemplateInstruction(deopt_id), field_(field) { |
3775 SetInputAt(0, value); | 3697 SetInputAt(0, value); |
3776 CheckField(field); | 3698 CheckField(field); |
3777 } | 3699 } |
3778 | 3700 |
3779 Value* value() const { return inputs_[0]; } | 3701 Value* value() const { return inputs_[0]; } |
3780 | 3702 |
3781 const Field& field() const { return field_; } | 3703 const Field& field() const { return field_; } |
3782 | 3704 |
3783 virtual bool ComputeCanDeoptimize() const { return true; } | 3705 virtual bool ComputeCanDeoptimize() const { return true; } |
3784 virtual bool CanBecomeDeoptimizationTarget() const { | 3706 virtual bool CanBecomeDeoptimizationTarget() const { |
3785 // Ensure that we record kDeopt PC descriptor in unoptimized code. | 3707 // Ensure that we record kDeopt PC descriptor in unoptimized code. |
3786 return true; | 3708 return true; |
3787 } | 3709 } |
3788 | 3710 |
3789 PRINT_OPERANDS_TO_SUPPORT | 3711 PRINT_OPERANDS_TO_SUPPORT |
3790 | 3712 |
3791 private: | 3713 private: |
3792 const Field& field_; | 3714 const Field& field_; |
3793 | 3715 |
3794 DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr); | 3716 DISALLOW_COPY_AND_ASSIGN(GuardFieldInstr); |
3795 }; | 3717 }; |
3796 | 3718 |
3797 | |
3798 class GuardFieldClassInstr : public GuardFieldInstr { | 3719 class GuardFieldClassInstr : public GuardFieldInstr { |
3799 public: | 3720 public: |
3800 GuardFieldClassInstr(Value* value, const Field& field, intptr_t deopt_id) | 3721 GuardFieldClassInstr(Value* value, const Field& field, intptr_t deopt_id) |
3801 : GuardFieldInstr(value, field, deopt_id) { | 3722 : GuardFieldInstr(value, field, deopt_id) { |
3802 CheckField(field); | 3723 CheckField(field); |
3803 } | 3724 } |
3804 | 3725 |
3805 DECLARE_INSTRUCTION(GuardFieldClass) | 3726 DECLARE_INSTRUCTION(GuardFieldClass) |
3806 | 3727 |
3807 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 3728 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
3808 | 3729 |
3809 virtual bool AttributesEqual(Instruction* other) const; | 3730 virtual bool AttributesEqual(Instruction* other) const; |
3810 | 3731 |
3811 private: | 3732 private: |
3812 DISALLOW_COPY_AND_ASSIGN(GuardFieldClassInstr); | 3733 DISALLOW_COPY_AND_ASSIGN(GuardFieldClassInstr); |
3813 }; | 3734 }; |
3814 | 3735 |
3815 | |
3816 class GuardFieldLengthInstr : public GuardFieldInstr { | 3736 class GuardFieldLengthInstr : public GuardFieldInstr { |
3817 public: | 3737 public: |
3818 GuardFieldLengthInstr(Value* value, const Field& field, intptr_t deopt_id) | 3738 GuardFieldLengthInstr(Value* value, const Field& field, intptr_t deopt_id) |
3819 : GuardFieldInstr(value, field, deopt_id) { | 3739 : GuardFieldInstr(value, field, deopt_id) { |
3820 CheckField(field); | 3740 CheckField(field); |
3821 } | 3741 } |
3822 | 3742 |
3823 DECLARE_INSTRUCTION(GuardFieldLength) | 3743 DECLARE_INSTRUCTION(GuardFieldLength) |
3824 | 3744 |
3825 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 3745 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
3826 | 3746 |
3827 virtual bool AttributesEqual(Instruction* other) const; | 3747 virtual bool AttributesEqual(Instruction* other) const; |
3828 | 3748 |
3829 private: | 3749 private: |
3830 DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr); | 3750 DISALLOW_COPY_AND_ASSIGN(GuardFieldLengthInstr); |
3831 }; | 3751 }; |
3832 | 3752 |
3833 | |
3834 class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { | 3753 class LoadStaticFieldInstr : public TemplateDefinition<1, NoThrow> { |
3835 public: | 3754 public: |
3836 LoadStaticFieldInstr(Value* field_value, TokenPosition token_pos) | 3755 LoadStaticFieldInstr(Value* field_value, TokenPosition token_pos) |
3837 : token_pos_(token_pos) { | 3756 : token_pos_(token_pos) { |
3838 ASSERT(field_value->BindsToConstant()); | 3757 ASSERT(field_value->BindsToConstant()); |
3839 SetInputAt(0, field_value); | 3758 SetInputAt(0, field_value); |
3840 } | 3759 } |
3841 | 3760 |
3842 DECLARE_INSTRUCTION(LoadStaticField) | 3761 DECLARE_INSTRUCTION(LoadStaticField) |
3843 virtual CompileType ComputeType() const; | 3762 virtual CompileType ComputeType() const; |
(...skipping 12 matching lines...) Expand all Loading... |
3856 virtual TokenPosition token_pos() const { return token_pos_; } | 3775 virtual TokenPosition token_pos() const { return token_pos_; } |
3857 | 3776 |
3858 PRINT_OPERANDS_TO_SUPPORT | 3777 PRINT_OPERANDS_TO_SUPPORT |
3859 | 3778 |
3860 private: | 3779 private: |
3861 const TokenPosition token_pos_; | 3780 const TokenPosition token_pos_; |
3862 | 3781 |
3863 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); | 3782 DISALLOW_COPY_AND_ASSIGN(LoadStaticFieldInstr); |
3864 }; | 3783 }; |
3865 | 3784 |
3866 | |
3867 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { | 3785 class StoreStaticFieldInstr : public TemplateDefinition<1, NoThrow> { |
3868 public: | 3786 public: |
3869 StoreStaticFieldInstr(const Field& field, | 3787 StoreStaticFieldInstr(const Field& field, |
3870 Value* value, | 3788 Value* value, |
3871 TokenPosition token_pos) | 3789 TokenPosition token_pos) |
3872 : field_(field), token_pos_(token_pos) { | 3790 : field_(field), token_pos_(token_pos) { |
3873 ASSERT(field.IsZoneHandle()); | 3791 ASSERT(field.IsZoneHandle()); |
3874 SetInputAt(kValuePos, value); | 3792 SetInputAt(kValuePos, value); |
3875 CheckField(field); | 3793 CheckField(field); |
3876 } | 3794 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3955 | 3873 |
3956 private: | 3874 private: |
3957 const intptr_t index_scale_; | 3875 const intptr_t index_scale_; |
3958 const intptr_t class_id_; | 3876 const intptr_t class_id_; |
3959 const AlignmentType alignment_; | 3877 const AlignmentType alignment_; |
3960 const TokenPosition token_pos_; | 3878 const TokenPosition token_pos_; |
3961 | 3879 |
3962 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); | 3880 DISALLOW_COPY_AND_ASSIGN(LoadIndexedInstr); |
3963 }; | 3881 }; |
3964 | 3882 |
3965 | |
3966 // Loads the specified number of code units from the given string, packing | 3883 // Loads the specified number of code units from the given string, packing |
3967 // multiple code units into a single datatype. In essence, this is a specialized | 3884 // multiple code units into a single datatype. In essence, this is a specialized |
3968 // version of LoadIndexedInstr which accepts only string targets and can load | 3885 // version of LoadIndexedInstr which accepts only string targets and can load |
3969 // multiple elements at once. The result datatype differs depending on the | 3886 // multiple elements at once. The result datatype differs depending on the |
3970 // string type, element count, and architecture; if possible, the result is | 3887 // string type, element count, and architecture; if possible, the result is |
3971 // packed into a Smi, falling back to a Mint otherwise. | 3888 // packed into a Smi, falling back to a Mint otherwise. |
3972 // TODO(zerny): Add support for loading into UnboxedInt32x4. | 3889 // TODO(zerny): Add support for loading into UnboxedInt32x4. |
3973 class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { | 3890 class LoadCodeUnitsInstr : public TemplateDefinition<2, NoThrow> { |
3974 public: | 3891 public: |
3975 LoadCodeUnitsInstr(Value* str, | 3892 LoadCodeUnitsInstr(Value* str, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4025 | 3942 |
4026 private: | 3943 private: |
4027 const intptr_t class_id_; | 3944 const intptr_t class_id_; |
4028 const TokenPosition token_pos_; | 3945 const TokenPosition token_pos_; |
4029 const intptr_t element_count_; | 3946 const intptr_t element_count_; |
4030 Representation representation_; | 3947 Representation representation_; |
4031 | 3948 |
4032 DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); | 3949 DISALLOW_COPY_AND_ASSIGN(LoadCodeUnitsInstr); |
4033 }; | 3950 }; |
4034 | 3951 |
4035 | |
4036 class OneByteStringFromCharCodeInstr | 3952 class OneByteStringFromCharCodeInstr |
4037 : public TemplateDefinition<1, NoThrow, Pure> { | 3953 : public TemplateDefinition<1, NoThrow, Pure> { |
4038 public: | 3954 public: |
4039 explicit OneByteStringFromCharCodeInstr(Value* char_code) { | 3955 explicit OneByteStringFromCharCodeInstr(Value* char_code) { |
4040 SetInputAt(0, char_code); | 3956 SetInputAt(0, char_code); |
4041 } | 3957 } |
4042 | 3958 |
4043 DECLARE_INSTRUCTION(OneByteStringFromCharCode) | 3959 DECLARE_INSTRUCTION(OneByteStringFromCharCode) |
4044 virtual CompileType ComputeType() const; | 3960 virtual CompileType ComputeType() const; |
4045 | 3961 |
4046 Value* char_code() const { return inputs_[0]; } | 3962 Value* char_code() const { return inputs_[0]; } |
4047 | 3963 |
4048 virtual bool ComputeCanDeoptimize() const { return false; } | 3964 virtual bool ComputeCanDeoptimize() const { return false; } |
4049 | 3965 |
4050 virtual bool AttributesEqual(Instruction* other) const { return true; } | 3966 virtual bool AttributesEqual(Instruction* other) const { return true; } |
4051 | 3967 |
4052 private: | 3968 private: |
4053 DISALLOW_COPY_AND_ASSIGN(OneByteStringFromCharCodeInstr); | 3969 DISALLOW_COPY_AND_ASSIGN(OneByteStringFromCharCodeInstr); |
4054 }; | 3970 }; |
4055 | 3971 |
4056 | |
4057 class StringToCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { | 3972 class StringToCharCodeInstr : public TemplateDefinition<1, NoThrow, Pure> { |
4058 public: | 3973 public: |
4059 StringToCharCodeInstr(Value* str, intptr_t cid) : cid_(cid) { | 3974 StringToCharCodeInstr(Value* str, intptr_t cid) : cid_(cid) { |
4060 ASSERT(str != NULL); | 3975 ASSERT(str != NULL); |
4061 SetInputAt(0, str); | 3976 SetInputAt(0, str); |
4062 } | 3977 } |
4063 | 3978 |
4064 DECLARE_INSTRUCTION(StringToCharCode) | 3979 DECLARE_INSTRUCTION(StringToCharCode) |
4065 virtual CompileType ComputeType() const; | 3980 virtual CompileType ComputeType() const; |
4066 | 3981 |
4067 Value* str() const { return inputs_[0]; } | 3982 Value* str() const { return inputs_[0]; } |
4068 | 3983 |
4069 virtual bool ComputeCanDeoptimize() const { return false; } | 3984 virtual bool ComputeCanDeoptimize() const { return false; } |
4070 | 3985 |
4071 virtual bool AttributesEqual(Instruction* other) const { | 3986 virtual bool AttributesEqual(Instruction* other) const { |
4072 return other->AsStringToCharCode()->cid_ == cid_; | 3987 return other->AsStringToCharCode()->cid_ == cid_; |
4073 } | 3988 } |
4074 | 3989 |
4075 private: | 3990 private: |
4076 const intptr_t cid_; | 3991 const intptr_t cid_; |
4077 | 3992 |
4078 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); | 3993 DISALLOW_COPY_AND_ASSIGN(StringToCharCodeInstr); |
4079 }; | 3994 }; |
4080 | 3995 |
4081 | |
4082 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { | 3996 class StringInterpolateInstr : public TemplateDefinition<1, Throws> { |
4083 public: | 3997 public: |
4084 StringInterpolateInstr(Value* value, | 3998 StringInterpolateInstr(Value* value, |
4085 TokenPosition token_pos, | 3999 TokenPosition token_pos, |
4086 intptr_t deopt_id) | 4000 intptr_t deopt_id) |
4087 : TemplateDefinition(deopt_id), | 4001 : TemplateDefinition(deopt_id), |
4088 token_pos_(token_pos), | 4002 token_pos_(token_pos), |
4089 function_(Function::ZoneHandle()) { | 4003 function_(Function::ZoneHandle()) { |
4090 SetInputAt(0, value); | 4004 SetInputAt(0, value); |
4091 } | 4005 } |
(...skipping 12 matching lines...) Expand all Loading... |
4104 | 4018 |
4105 DECLARE_INSTRUCTION(StringInterpolate) | 4019 DECLARE_INSTRUCTION(StringInterpolate) |
4106 | 4020 |
4107 private: | 4021 private: |
4108 const TokenPosition token_pos_; | 4022 const TokenPosition token_pos_; |
4109 Function& function_; | 4023 Function& function_; |
4110 | 4024 |
4111 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); | 4025 DISALLOW_COPY_AND_ASSIGN(StringInterpolateInstr); |
4112 }; | 4026 }; |
4113 | 4027 |
4114 | |
4115 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { | 4028 class StoreIndexedInstr : public TemplateDefinition<3, NoThrow> { |
4116 public: | 4029 public: |
4117 StoreIndexedInstr(Value* array, | 4030 StoreIndexedInstr(Value* array, |
4118 Value* index, | 4031 Value* index, |
4119 Value* value, | 4032 Value* value, |
4120 StoreBarrierType emit_store_barrier, | 4033 StoreBarrierType emit_store_barrier, |
4121 intptr_t index_scale, | 4034 intptr_t index_scale, |
4122 intptr_t class_id, | 4035 intptr_t class_id, |
4123 AlignmentType alignment, | 4036 AlignmentType alignment, |
4124 intptr_t deopt_id, | 4037 intptr_t deopt_id, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4159 private: | 4072 private: |
4160 const StoreBarrierType emit_store_barrier_; | 4073 const StoreBarrierType emit_store_barrier_; |
4161 const intptr_t index_scale_; | 4074 const intptr_t index_scale_; |
4162 const intptr_t class_id_; | 4075 const intptr_t class_id_; |
4163 const AlignmentType alignment_; | 4076 const AlignmentType alignment_; |
4164 const TokenPosition token_pos_; | 4077 const TokenPosition token_pos_; |
4165 | 4078 |
4166 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); | 4079 DISALLOW_COPY_AND_ASSIGN(StoreIndexedInstr); |
4167 }; | 4080 }; |
4168 | 4081 |
4169 | |
4170 // Note overrideable, built-in: value ? false : true. | 4082 // Note overrideable, built-in: value ? false : true. |
4171 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { | 4083 class BooleanNegateInstr : public TemplateDefinition<1, NoThrow> { |
4172 public: | 4084 public: |
4173 explicit BooleanNegateInstr(Value* value) { SetInputAt(0, value); } | 4085 explicit BooleanNegateInstr(Value* value) { SetInputAt(0, value); } |
4174 | 4086 |
4175 DECLARE_INSTRUCTION(BooleanNegate) | 4087 DECLARE_INSTRUCTION(BooleanNegate) |
4176 virtual CompileType ComputeType() const; | 4088 virtual CompileType ComputeType() const; |
4177 | 4089 |
4178 Value* value() const { return inputs_[0]; } | 4090 Value* value() const { return inputs_[0]; } |
4179 | 4091 |
4180 virtual bool ComputeCanDeoptimize() const { return false; } | 4092 virtual bool ComputeCanDeoptimize() const { return false; } |
4181 | 4093 |
4182 virtual EffectSet Effects() const { return EffectSet::None(); } | 4094 virtual EffectSet Effects() const { return EffectSet::None(); } |
4183 | 4095 |
4184 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4096 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
4185 | 4097 |
4186 private: | 4098 private: |
4187 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); | 4099 DISALLOW_COPY_AND_ASSIGN(BooleanNegateInstr); |
4188 }; | 4100 }; |
4189 | 4101 |
4190 | |
4191 class InstanceOfInstr : public TemplateDefinition<3, Throws> { | 4102 class InstanceOfInstr : public TemplateDefinition<3, Throws> { |
4192 public: | 4103 public: |
4193 InstanceOfInstr(TokenPosition token_pos, | 4104 InstanceOfInstr(TokenPosition token_pos, |
4194 Value* value, | 4105 Value* value, |
4195 Value* instantiator_type_arguments, | 4106 Value* instantiator_type_arguments, |
4196 Value* function_type_arguments, | 4107 Value* function_type_arguments, |
4197 const AbstractType& type, | 4108 const AbstractType& type, |
4198 intptr_t deopt_id) | 4109 intptr_t deopt_id) |
4199 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { | 4110 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { |
4200 ASSERT(!type.IsNull()); | 4111 ASSERT(!type.IsNull()); |
(...skipping 20 matching lines...) Expand all Loading... |
4221 | 4132 |
4222 private: | 4133 private: |
4223 const TokenPosition token_pos_; | 4134 const TokenPosition token_pos_; |
4224 Value* value_; | 4135 Value* value_; |
4225 Value* type_arguments_; | 4136 Value* type_arguments_; |
4226 const AbstractType& type_; | 4137 const AbstractType& type_; |
4227 | 4138 |
4228 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); | 4139 DISALLOW_COPY_AND_ASSIGN(InstanceOfInstr); |
4229 }; | 4140 }; |
4230 | 4141 |
4231 | |
4232 class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> { | 4142 class AllocateObjectInstr : public TemplateDefinition<0, NoThrow> { |
4233 public: | 4143 public: |
4234 AllocateObjectInstr(TokenPosition token_pos, | 4144 AllocateObjectInstr(TokenPosition token_pos, |
4235 const Class& cls, | 4145 const Class& cls, |
4236 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 4146 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
4237 : token_pos_(token_pos), | 4147 : token_pos_(token_pos), |
4238 cls_(cls), | 4148 cls_(cls), |
4239 arguments_(arguments), | 4149 arguments_(arguments), |
4240 identity_(AliasIdentity::Unknown()), | 4150 identity_(AliasIdentity::Unknown()), |
4241 closure_function_(Function::ZoneHandle()) { | 4151 closure_function_(Function::ZoneHandle()) { |
(...skipping 29 matching lines...) Expand all Loading... |
4271 private: | 4181 private: |
4272 const TokenPosition token_pos_; | 4182 const TokenPosition token_pos_; |
4273 const Class& cls_; | 4183 const Class& cls_; |
4274 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 4184 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
4275 AliasIdentity identity_; | 4185 AliasIdentity identity_; |
4276 Function& closure_function_; | 4186 Function& closure_function_; |
4277 | 4187 |
4278 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); | 4188 DISALLOW_COPY_AND_ASSIGN(AllocateObjectInstr); |
4279 }; | 4189 }; |
4280 | 4190 |
4281 | |
4282 class AllocateUninitializedContextInstr | 4191 class AllocateUninitializedContextInstr |
4283 : public TemplateDefinition<0, NoThrow> { | 4192 : public TemplateDefinition<0, NoThrow> { |
4284 public: | 4193 public: |
4285 AllocateUninitializedContextInstr(TokenPosition token_pos, | 4194 AllocateUninitializedContextInstr(TokenPosition token_pos, |
4286 intptr_t num_context_variables) | 4195 intptr_t num_context_variables) |
4287 : token_pos_(token_pos), | 4196 : token_pos_(token_pos), |
4288 num_context_variables_(num_context_variables), | 4197 num_context_variables_(num_context_variables), |
4289 identity_(AliasIdentity::Unknown()) {} | 4198 identity_(AliasIdentity::Unknown()) {} |
4290 | 4199 |
4291 DECLARE_INSTRUCTION(AllocateUninitializedContext) | 4200 DECLARE_INSTRUCTION(AllocateUninitializedContext) |
(...skipping 12 matching lines...) Expand all Loading... |
4304 PRINT_OPERANDS_TO_SUPPORT | 4213 PRINT_OPERANDS_TO_SUPPORT |
4305 | 4214 |
4306 private: | 4215 private: |
4307 const TokenPosition token_pos_; | 4216 const TokenPosition token_pos_; |
4308 const intptr_t num_context_variables_; | 4217 const intptr_t num_context_variables_; |
4309 AliasIdentity identity_; | 4218 AliasIdentity identity_; |
4310 | 4219 |
4311 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); | 4220 DISALLOW_COPY_AND_ASSIGN(AllocateUninitializedContextInstr); |
4312 }; | 4221 }; |
4313 | 4222 |
4314 | |
4315 // This instruction captures the state of the object which had its allocation | 4223 // This instruction captures the state of the object which had its allocation |
4316 // removed during the AllocationSinking pass. | 4224 // removed during the AllocationSinking pass. |
4317 // It does not produce any real code only deoptimization information. | 4225 // It does not produce any real code only deoptimization information. |
4318 class MaterializeObjectInstr : public Definition { | 4226 class MaterializeObjectInstr : public Definition { |
4319 public: | 4227 public: |
4320 MaterializeObjectInstr(AllocateObjectInstr* allocation, | 4228 MaterializeObjectInstr(AllocateObjectInstr* allocation, |
4321 const ZoneGrowableArray<const Object*>& slots, | 4229 const ZoneGrowableArray<const Object*>& slots, |
4322 ZoneGrowableArray<Value*>* values) | 4230 ZoneGrowableArray<Value*>* values) |
4323 : allocation_(allocation), | 4231 : allocation_(allocation), |
4324 cls_(allocation->cls()), | 4232 cls_(allocation->cls()), |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4407 const ZoneGrowableArray<const Object*>& slots_; | 4315 const ZoneGrowableArray<const Object*>& slots_; |
4408 ZoneGrowableArray<Value*>* values_; | 4316 ZoneGrowableArray<Value*>* values_; |
4409 Location* locations_; | 4317 Location* locations_; |
4410 | 4318 |
4411 bool visited_for_liveness_; | 4319 bool visited_for_liveness_; |
4412 bool registers_remapped_; | 4320 bool registers_remapped_; |
4413 | 4321 |
4414 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); | 4322 DISALLOW_COPY_AND_ASSIGN(MaterializeObjectInstr); |
4415 }; | 4323 }; |
4416 | 4324 |
4417 | |
4418 class CreateArrayInstr : public TemplateDefinition<2, Throws> { | 4325 class CreateArrayInstr : public TemplateDefinition<2, Throws> { |
4419 public: | 4326 public: |
4420 CreateArrayInstr(TokenPosition token_pos, | 4327 CreateArrayInstr(TokenPosition token_pos, |
4421 Value* element_type, | 4328 Value* element_type, |
4422 Value* num_elements, | 4329 Value* num_elements, |
4423 intptr_t deopt_id) | 4330 intptr_t deopt_id) |
4424 : TemplateDefinition(deopt_id), | 4331 : TemplateDefinition(deopt_id), |
4425 token_pos_(token_pos), | 4332 token_pos_(token_pos), |
4426 identity_(AliasIdentity::Unknown()) { | 4333 identity_(AliasIdentity::Unknown()) { |
4427 SetInputAt(kElementTypePos, element_type); | 4334 SetInputAt(kElementTypePos, element_type); |
(...skipping 18 matching lines...) Expand all Loading... |
4446 virtual AliasIdentity Identity() const { return identity_; } | 4353 virtual AliasIdentity Identity() const { return identity_; } |
4447 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 4354 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
4448 | 4355 |
4449 private: | 4356 private: |
4450 const TokenPosition token_pos_; | 4357 const TokenPosition token_pos_; |
4451 AliasIdentity identity_; | 4358 AliasIdentity identity_; |
4452 | 4359 |
4453 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); | 4360 DISALLOW_COPY_AND_ASSIGN(CreateArrayInstr); |
4454 }; | 4361 }; |
4455 | 4362 |
4456 | |
4457 // Note: this instruction must not be moved without the indexed access that | 4363 // Note: this instruction must not be moved without the indexed access that |
4458 // depends on it (e.g. out of loops). GC may cause collect | 4364 // depends on it (e.g. out of loops). GC may cause collect |
4459 // the array while the external data-array is still accessed. | 4365 // the array while the external data-array is still accessed. |
4460 // TODO(vegorov) enable LICMing this instruction by ensuring that array itself | 4366 // TODO(vegorov) enable LICMing this instruction by ensuring that array itself |
4461 // is kept alive. | 4367 // is kept alive. |
4462 class LoadUntaggedInstr : public TemplateDefinition<1, NoThrow> { | 4368 class LoadUntaggedInstr : public TemplateDefinition<1, NoThrow> { |
4463 public: | 4369 public: |
4464 LoadUntaggedInstr(Value* object, intptr_t offset) : offset_(offset) { | 4370 LoadUntaggedInstr(Value* object, intptr_t offset) : offset_(offset) { |
4465 SetInputAt(0, object); | 4371 SetInputAt(0, object); |
4466 } | 4372 } |
(...skipping 15 matching lines...) Expand all Loading... |
4482 | 4388 |
4483 virtual EffectSet Effects() const { return EffectSet::None(); } | 4389 virtual EffectSet Effects() const { return EffectSet::None(); } |
4484 virtual bool AttributesEqual(Instruction* other) const { return true; } | 4390 virtual bool AttributesEqual(Instruction* other) const { return true; } |
4485 | 4391 |
4486 private: | 4392 private: |
4487 intptr_t offset_; | 4393 intptr_t offset_; |
4488 | 4394 |
4489 DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr); | 4395 DISALLOW_COPY_AND_ASSIGN(LoadUntaggedInstr); |
4490 }; | 4396 }; |
4491 | 4397 |
4492 | |
4493 class LoadClassIdInstr : public TemplateDefinition<1, NoThrow> { | 4398 class LoadClassIdInstr : public TemplateDefinition<1, NoThrow> { |
4494 public: | 4399 public: |
4495 explicit LoadClassIdInstr(Value* object) { SetInputAt(0, object); } | 4400 explicit LoadClassIdInstr(Value* object) { SetInputAt(0, object); } |
4496 | 4401 |
4497 virtual Representation representation() const { return kTagged; } | 4402 virtual Representation representation() const { return kTagged; } |
4498 DECLARE_INSTRUCTION(LoadClassId) | 4403 DECLARE_INSTRUCTION(LoadClassId) |
4499 virtual CompileType ComputeType() const; | 4404 virtual CompileType ComputeType() const; |
4500 | 4405 |
4501 Value* object() const { return inputs_[0]; } | 4406 Value* object() const { return inputs_[0]; } |
4502 | 4407 |
4503 virtual bool ComputeCanDeoptimize() const { return false; } | 4408 virtual bool ComputeCanDeoptimize() const { return false; } |
4504 | 4409 |
4505 virtual bool AllowsCSE() const { return true; } | 4410 virtual bool AllowsCSE() const { return true; } |
4506 virtual EffectSet Dependencies() const { | 4411 virtual EffectSet Dependencies() const { |
4507 return EffectSet::Externalization(); | 4412 return EffectSet::Externalization(); |
4508 } | 4413 } |
4509 virtual EffectSet Effects() const { return EffectSet::None(); } | 4414 virtual EffectSet Effects() const { return EffectSet::None(); } |
4510 virtual bool AttributesEqual(Instruction* other) const { return true; } | 4415 virtual bool AttributesEqual(Instruction* other) const { return true; } |
4511 | 4416 |
4512 private: | 4417 private: |
4513 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); | 4418 DISALLOW_COPY_AND_ASSIGN(LoadClassIdInstr); |
4514 }; | 4419 }; |
4515 | 4420 |
4516 | |
4517 class LoadFieldInstr : public TemplateDefinition<1, NoThrow> { | 4421 class LoadFieldInstr : public TemplateDefinition<1, NoThrow> { |
4518 public: | 4422 public: |
4519 LoadFieldInstr(Value* instance, | 4423 LoadFieldInstr(Value* instance, |
4520 intptr_t offset_in_bytes, | 4424 intptr_t offset_in_bytes, |
4521 const AbstractType& type, | 4425 const AbstractType& type, |
4522 TokenPosition token_pos) | 4426 TokenPosition token_pos) |
4523 : offset_in_bytes_(offset_in_bytes), | 4427 : offset_in_bytes_(offset_in_bytes), |
4524 type_(type), | 4428 type_(type), |
4525 result_cid_(kDynamicCid), | 4429 result_cid_(kDynamicCid), |
4526 immutable_(false), | 4430 immutable_(false), |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4616 intptr_t result_cid_; | 4520 intptr_t result_cid_; |
4617 bool immutable_; | 4521 bool immutable_; |
4618 | 4522 |
4619 MethodRecognizer::Kind recognized_kind_; | 4523 MethodRecognizer::Kind recognized_kind_; |
4620 const Field* field_; | 4524 const Field* field_; |
4621 const TokenPosition token_pos_; | 4525 const TokenPosition token_pos_; |
4622 | 4526 |
4623 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); | 4527 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); |
4624 }; | 4528 }; |
4625 | 4529 |
4626 | |
4627 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { | 4530 class InstantiateTypeInstr : public TemplateDefinition<2, Throws> { |
4628 public: | 4531 public: |
4629 InstantiateTypeInstr(TokenPosition token_pos, | 4532 InstantiateTypeInstr(TokenPosition token_pos, |
4630 const AbstractType& type, | 4533 const AbstractType& type, |
4631 Value* instantiator_type_arguments, | 4534 Value* instantiator_type_arguments, |
4632 Value* function_type_arguments, | 4535 Value* function_type_arguments, |
4633 intptr_t deopt_id) | 4536 intptr_t deopt_id) |
4634 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { | 4537 : TemplateDefinition(deopt_id), token_pos_(token_pos), type_(type) { |
4635 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); | 4538 ASSERT(type.IsZoneHandle() || type.IsReadOnlyHandle()); |
4636 SetInputAt(0, instantiator_type_arguments); | 4539 SetInputAt(0, instantiator_type_arguments); |
(...skipping 13 matching lines...) Expand all Loading... |
4650 | 4553 |
4651 PRINT_OPERANDS_TO_SUPPORT | 4554 PRINT_OPERANDS_TO_SUPPORT |
4652 | 4555 |
4653 private: | 4556 private: |
4654 const TokenPosition token_pos_; | 4557 const TokenPosition token_pos_; |
4655 const AbstractType& type_; | 4558 const AbstractType& type_; |
4656 | 4559 |
4657 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); | 4560 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeInstr); |
4658 }; | 4561 }; |
4659 | 4562 |
4660 | |
4661 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { | 4563 class InstantiateTypeArgumentsInstr : public TemplateDefinition<2, Throws> { |
4662 public: | 4564 public: |
4663 InstantiateTypeArgumentsInstr(TokenPosition token_pos, | 4565 InstantiateTypeArgumentsInstr(TokenPosition token_pos, |
4664 const TypeArguments& type_arguments, | 4566 const TypeArguments& type_arguments, |
4665 const Class& instantiator_class, | 4567 const Class& instantiator_class, |
4666 Value* instantiator_type_arguments, | 4568 Value* instantiator_type_arguments, |
4667 Value* function_type_arguments, | 4569 Value* function_type_arguments, |
4668 intptr_t deopt_id) | 4570 intptr_t deopt_id) |
4669 : TemplateDefinition(deopt_id), | 4571 : TemplateDefinition(deopt_id), |
4670 token_pos_(token_pos), | 4572 token_pos_(token_pos), |
(...skipping 21 matching lines...) Expand all Loading... |
4692 PRINT_OPERANDS_TO_SUPPORT | 4594 PRINT_OPERANDS_TO_SUPPORT |
4693 | 4595 |
4694 private: | 4596 private: |
4695 const TokenPosition token_pos_; | 4597 const TokenPosition token_pos_; |
4696 const TypeArguments& type_arguments_; | 4598 const TypeArguments& type_arguments_; |
4697 const Class& instantiator_class_; | 4599 const Class& instantiator_class_; |
4698 | 4600 |
4699 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); | 4601 DISALLOW_COPY_AND_ASSIGN(InstantiateTypeArgumentsInstr); |
4700 }; | 4602 }; |
4701 | 4603 |
4702 | |
4703 class AllocateContextInstr : public TemplateDefinition<0, NoThrow> { | 4604 class AllocateContextInstr : public TemplateDefinition<0, NoThrow> { |
4704 public: | 4605 public: |
4705 AllocateContextInstr(TokenPosition token_pos, intptr_t num_context_variables) | 4606 AllocateContextInstr(TokenPosition token_pos, intptr_t num_context_variables) |
4706 : token_pos_(token_pos), num_context_variables_(num_context_variables) {} | 4607 : token_pos_(token_pos), num_context_variables_(num_context_variables) {} |
4707 | 4608 |
4708 DECLARE_INSTRUCTION(AllocateContext) | 4609 DECLARE_INSTRUCTION(AllocateContext) |
4709 virtual CompileType ComputeType() const; | 4610 virtual CompileType ComputeType() const; |
4710 | 4611 |
4711 virtual TokenPosition token_pos() const { return token_pos_; } | 4612 virtual TokenPosition token_pos() const { return token_pos_; } |
4712 intptr_t num_context_variables() const { return num_context_variables_; } | 4613 intptr_t num_context_variables() const { return num_context_variables_; } |
4713 | 4614 |
4714 virtual bool ComputeCanDeoptimize() const { return false; } | 4615 virtual bool ComputeCanDeoptimize() const { return false; } |
4715 | 4616 |
4716 virtual EffectSet Effects() const { return EffectSet::None(); } | 4617 virtual EffectSet Effects() const { return EffectSet::None(); } |
4717 | 4618 |
4718 PRINT_OPERANDS_TO_SUPPORT | 4619 PRINT_OPERANDS_TO_SUPPORT |
4719 | 4620 |
4720 private: | 4621 private: |
4721 const TokenPosition token_pos_; | 4622 const TokenPosition token_pos_; |
4722 const intptr_t num_context_variables_; | 4623 const intptr_t num_context_variables_; |
4723 | 4624 |
4724 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); | 4625 DISALLOW_COPY_AND_ASSIGN(AllocateContextInstr); |
4725 }; | 4626 }; |
4726 | 4627 |
4727 | |
4728 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { | 4628 class InitStaticFieldInstr : public TemplateInstruction<1, Throws> { |
4729 public: | 4629 public: |
4730 InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id) | 4630 InitStaticFieldInstr(Value* input, const Field& field, intptr_t deopt_id) |
4731 : TemplateInstruction(deopt_id), field_(field) { | 4631 : TemplateInstruction(deopt_id), field_(field) { |
4732 SetInputAt(0, input); | 4632 SetInputAt(0, input); |
4733 CheckField(field); | 4633 CheckField(field); |
4734 } | 4634 } |
4735 | 4635 |
4736 virtual TokenPosition token_pos() const { return field_.token_pos(); } | 4636 virtual TokenPosition token_pos() const { return field_.token_pos(); } |
4737 const Field& field() const { return field_; } | 4637 const Field& field() const { return field_; } |
4738 | 4638 |
4739 DECLARE_INSTRUCTION(InitStaticField) | 4639 DECLARE_INSTRUCTION(InitStaticField) |
4740 | 4640 |
4741 virtual bool ComputeCanDeoptimize() const { return true; } | 4641 virtual bool ComputeCanDeoptimize() const { return true; } |
4742 virtual EffectSet Effects() const { return EffectSet::All(); } | 4642 virtual EffectSet Effects() const { return EffectSet::All(); } |
4743 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 4643 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
4744 | 4644 |
4745 private: | 4645 private: |
4746 const Field& field_; | 4646 const Field& field_; |
4747 | 4647 |
4748 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); | 4648 DISALLOW_COPY_AND_ASSIGN(InitStaticFieldInstr); |
4749 }; | 4649 }; |
4750 | 4650 |
4751 | |
4752 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { | 4651 class CloneContextInstr : public TemplateDefinition<1, NoThrow> { |
4753 public: | 4652 public: |
4754 CloneContextInstr(TokenPosition token_pos, | 4653 CloneContextInstr(TokenPosition token_pos, |
4755 Value* context_value, | 4654 Value* context_value, |
4756 intptr_t deopt_id) | 4655 intptr_t deopt_id) |
4757 : TemplateDefinition(deopt_id), token_pos_(token_pos) { | 4656 : TemplateDefinition(deopt_id), token_pos_(token_pos) { |
4758 SetInputAt(0, context_value); | 4657 SetInputAt(0, context_value); |
4759 } | 4658 } |
4760 | 4659 |
4761 virtual TokenPosition token_pos() const { return token_pos_; } | 4660 virtual TokenPosition token_pos() const { return token_pos_; } |
4762 Value* context_value() const { return inputs_[0]; } | 4661 Value* context_value() const { return inputs_[0]; } |
4763 | 4662 |
4764 DECLARE_INSTRUCTION(CloneContext) | 4663 DECLARE_INSTRUCTION(CloneContext) |
4765 virtual CompileType ComputeType() const; | 4664 virtual CompileType ComputeType() const; |
4766 | 4665 |
4767 virtual bool ComputeCanDeoptimize() const { return true; } | 4666 virtual bool ComputeCanDeoptimize() const { return true; } |
4768 | 4667 |
4769 virtual EffectSet Effects() const { return EffectSet::None(); } | 4668 virtual EffectSet Effects() const { return EffectSet::None(); } |
4770 | 4669 |
4771 private: | 4670 private: |
4772 const TokenPosition token_pos_; | 4671 const TokenPosition token_pos_; |
4773 | 4672 |
4774 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); | 4673 DISALLOW_COPY_AND_ASSIGN(CloneContextInstr); |
4775 }; | 4674 }; |
4776 | 4675 |
4777 | |
4778 class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> { | 4676 class CheckEitherNonSmiInstr : public TemplateInstruction<2, NoThrow, Pure> { |
4779 public: | 4677 public: |
4780 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) | 4678 CheckEitherNonSmiInstr(Value* left, Value* right, intptr_t deopt_id) |
4781 : TemplateInstruction(deopt_id), licm_hoisted_(false) { | 4679 : TemplateInstruction(deopt_id), licm_hoisted_(false) { |
4782 SetInputAt(0, left); | 4680 SetInputAt(0, left); |
4783 SetInputAt(1, right); | 4681 SetInputAt(1, right); |
4784 } | 4682 } |
4785 | 4683 |
4786 Value* left() const { return inputs_[0]; } | 4684 Value* left() const { return inputs_[0]; } |
4787 Value* right() const { return inputs_[1]; } | 4685 Value* right() const { return inputs_[1]; } |
4788 | 4686 |
4789 DECLARE_INSTRUCTION(CheckEitherNonSmi) | 4687 DECLARE_INSTRUCTION(CheckEitherNonSmi) |
4790 | 4688 |
4791 virtual bool ComputeCanDeoptimize() const { return true; } | 4689 virtual bool ComputeCanDeoptimize() const { return true; } |
4792 | 4690 |
4793 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 4691 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
4794 | 4692 |
4795 virtual bool AttributesEqual(Instruction* other) const { return true; } | 4693 virtual bool AttributesEqual(Instruction* other) const { return true; } |
4796 | 4694 |
4797 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 4695 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
4798 | 4696 |
4799 private: | 4697 private: |
4800 bool licm_hoisted_; | 4698 bool licm_hoisted_; |
4801 | 4699 |
4802 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); | 4700 DISALLOW_COPY_AND_ASSIGN(CheckEitherNonSmiInstr); |
4803 }; | 4701 }; |
4804 | 4702 |
4805 | |
4806 class Boxing : public AllStatic { | 4703 class Boxing : public AllStatic { |
4807 public: | 4704 public: |
4808 static bool Supports(Representation rep) { | 4705 static bool Supports(Representation rep) { |
4809 switch (rep) { | 4706 switch (rep) { |
4810 case kUnboxedDouble: | 4707 case kUnboxedDouble: |
4811 case kUnboxedFloat32x4: | 4708 case kUnboxedFloat32x4: |
4812 case kUnboxedFloat64x2: | 4709 case kUnboxedFloat64x2: |
4813 case kUnboxedInt32x4: | 4710 case kUnboxedInt32x4: |
4814 case kUnboxedMint: | 4711 case kUnboxedMint: |
4815 case kUnboxedInt32: | 4712 case kUnboxedInt32: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4855 return kFloat64x2Cid; | 4752 return kFloat64x2Cid; |
4856 case kUnboxedInt32x4: | 4753 case kUnboxedInt32x4: |
4857 return kInt32x4Cid; | 4754 return kInt32x4Cid; |
4858 default: | 4755 default: |
4859 UNREACHABLE(); | 4756 UNREACHABLE(); |
4860 return kIllegalCid; | 4757 return kIllegalCid; |
4861 } | 4758 } |
4862 } | 4759 } |
4863 }; | 4760 }; |
4864 | 4761 |
4865 | |
4866 class BoxInstr : public TemplateDefinition<1, NoThrow, Pure> { | 4762 class BoxInstr : public TemplateDefinition<1, NoThrow, Pure> { |
4867 public: | 4763 public: |
4868 static BoxInstr* Create(Representation from, Value* value); | 4764 static BoxInstr* Create(Representation from, Value* value); |
4869 | 4765 |
4870 Value* value() const { return inputs_[0]; } | 4766 Value* value() const { return inputs_[0]; } |
4871 Representation from_representation() const { return from_representation_; } | 4767 Representation from_representation() const { return from_representation_; } |
4872 | 4768 |
4873 DECLARE_INSTRUCTION(Box) | 4769 DECLARE_INSTRUCTION(Box) |
4874 virtual CompileType ComputeType() const; | 4770 virtual CompileType ComputeType() const; |
4875 | 4771 |
(...skipping 22 matching lines...) Expand all Loading... |
4898 private: | 4794 private: |
4899 intptr_t ValueOffset() const { | 4795 intptr_t ValueOffset() const { |
4900 return Boxing::ValueOffset(from_representation()); | 4796 return Boxing::ValueOffset(from_representation()); |
4901 } | 4797 } |
4902 | 4798 |
4903 const Representation from_representation_; | 4799 const Representation from_representation_; |
4904 | 4800 |
4905 DISALLOW_COPY_AND_ASSIGN(BoxInstr); | 4801 DISALLOW_COPY_AND_ASSIGN(BoxInstr); |
4906 }; | 4802 }; |
4907 | 4803 |
4908 | |
4909 class BoxIntegerInstr : public BoxInstr { | 4804 class BoxIntegerInstr : public BoxInstr { |
4910 public: | 4805 public: |
4911 BoxIntegerInstr(Representation representation, Value* value) | 4806 BoxIntegerInstr(Representation representation, Value* value) |
4912 : BoxInstr(representation, value) {} | 4807 : BoxInstr(representation, value) {} |
4913 | 4808 |
4914 virtual bool ValueFitsSmi() const; | 4809 virtual bool ValueFitsSmi() const; |
4915 | 4810 |
4916 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 4811 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
4917 | 4812 |
4918 virtual CompileType ComputeType() const; | 4813 virtual CompileType ComputeType() const; |
4919 virtual bool RecomputeType(); | 4814 virtual bool RecomputeType(); |
4920 | 4815 |
4921 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4816 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
4922 | 4817 |
4923 DEFINE_INSTRUCTION_TYPE_CHECK(BoxInteger) | 4818 DEFINE_INSTRUCTION_TYPE_CHECK(BoxInteger) |
4924 | 4819 |
4925 private: | 4820 private: |
4926 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); | 4821 DISALLOW_COPY_AND_ASSIGN(BoxIntegerInstr); |
4927 }; | 4822 }; |
4928 | 4823 |
4929 | |
4930 class BoxInteger32Instr : public BoxIntegerInstr { | 4824 class BoxInteger32Instr : public BoxIntegerInstr { |
4931 public: | 4825 public: |
4932 BoxInteger32Instr(Representation representation, Value* value) | 4826 BoxInteger32Instr(Representation representation, Value* value) |
4933 : BoxIntegerInstr(representation, value) {} | 4827 : BoxIntegerInstr(representation, value) {} |
4934 | 4828 |
4935 DECLARE_INSTRUCTION_BACKEND() | 4829 DECLARE_INSTRUCTION_BACKEND() |
4936 | 4830 |
4937 private: | 4831 private: |
4938 DISALLOW_COPY_AND_ASSIGN(BoxInteger32Instr); | 4832 DISALLOW_COPY_AND_ASSIGN(BoxInteger32Instr); |
4939 }; | 4833 }; |
4940 | 4834 |
4941 | |
4942 class BoxInt32Instr : public BoxInteger32Instr { | 4835 class BoxInt32Instr : public BoxInteger32Instr { |
4943 public: | 4836 public: |
4944 explicit BoxInt32Instr(Value* value) | 4837 explicit BoxInt32Instr(Value* value) |
4945 : BoxInteger32Instr(kUnboxedInt32, value) {} | 4838 : BoxInteger32Instr(kUnboxedInt32, value) {} |
4946 | 4839 |
4947 DECLARE_INSTRUCTION_NO_BACKEND(BoxInt32) | 4840 DECLARE_INSTRUCTION_NO_BACKEND(BoxInt32) |
4948 | 4841 |
4949 private: | 4842 private: |
4950 DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr); | 4843 DISALLOW_COPY_AND_ASSIGN(BoxInt32Instr); |
4951 }; | 4844 }; |
4952 | 4845 |
4953 | |
4954 class BoxUint32Instr : public BoxInteger32Instr { | 4846 class BoxUint32Instr : public BoxInteger32Instr { |
4955 public: | 4847 public: |
4956 explicit BoxUint32Instr(Value* value) | 4848 explicit BoxUint32Instr(Value* value) |
4957 : BoxInteger32Instr(kUnboxedUint32, value) {} | 4849 : BoxInteger32Instr(kUnboxedUint32, value) {} |
4958 | 4850 |
4959 DECLARE_INSTRUCTION_NO_BACKEND(BoxUint32) | 4851 DECLARE_INSTRUCTION_NO_BACKEND(BoxUint32) |
4960 | 4852 |
4961 private: | 4853 private: |
4962 DISALLOW_COPY_AND_ASSIGN(BoxUint32Instr); | 4854 DISALLOW_COPY_AND_ASSIGN(BoxUint32Instr); |
4963 }; | 4855 }; |
4964 | 4856 |
4965 | |
4966 class BoxInt64Instr : public BoxIntegerInstr { | 4857 class BoxInt64Instr : public BoxIntegerInstr { |
4967 public: | 4858 public: |
4968 explicit BoxInt64Instr(Value* value) : BoxIntegerInstr(kUnboxedMint, value) {} | 4859 explicit BoxInt64Instr(Value* value) : BoxIntegerInstr(kUnboxedMint, value) {} |
4969 | 4860 |
4970 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4861 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
4971 | 4862 |
4972 DECLARE_INSTRUCTION(BoxInt64) | 4863 DECLARE_INSTRUCTION(BoxInt64) |
4973 | 4864 |
4974 private: | 4865 private: |
4975 DISALLOW_COPY_AND_ASSIGN(BoxInt64Instr); | 4866 DISALLOW_COPY_AND_ASSIGN(BoxInt64Instr); |
4976 }; | 4867 }; |
4977 | 4868 |
4978 | |
4979 class UnboxInstr : public TemplateDefinition<1, NoThrow, Pure> { | 4869 class UnboxInstr : public TemplateDefinition<1, NoThrow, Pure> { |
4980 public: | 4870 public: |
4981 static UnboxInstr* Create(Representation to, Value* value, intptr_t deopt_id); | 4871 static UnboxInstr* Create(Representation to, Value* value, intptr_t deopt_id); |
4982 | 4872 |
4983 Value* value() const { return inputs_[0]; } | 4873 Value* value() const { return inputs_[0]; } |
4984 | 4874 |
4985 virtual bool ComputeCanDeoptimize() const { | 4875 virtual bool ComputeCanDeoptimize() const { |
4986 const intptr_t value_cid = value()->Type()->ToCid(); | 4876 const intptr_t value_cid = value()->Type()->ToCid(); |
4987 | 4877 |
4988 if (CanConvertSmi() && (value()->Type()->ToCid() == kSmiCid)) { | 4878 if (CanConvertSmi() && (value()->Type()->ToCid() == kSmiCid)) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5020 | 4910 |
5021 intptr_t BoxCid() const { return Boxing::BoxCid(representation_); } | 4911 intptr_t BoxCid() const { return Boxing::BoxCid(representation_); } |
5022 | 4912 |
5023 intptr_t ValueOffset() const { return Boxing::ValueOffset(representation_); } | 4913 intptr_t ValueOffset() const { return Boxing::ValueOffset(representation_); } |
5024 | 4914 |
5025 const Representation representation_; | 4915 const Representation representation_; |
5026 | 4916 |
5027 DISALLOW_COPY_AND_ASSIGN(UnboxInstr); | 4917 DISALLOW_COPY_AND_ASSIGN(UnboxInstr); |
5028 }; | 4918 }; |
5029 | 4919 |
5030 | |
5031 class UnboxIntegerInstr : public UnboxInstr { | 4920 class UnboxIntegerInstr : public UnboxInstr { |
5032 public: | 4921 public: |
5033 enum TruncationMode { kTruncate, kNoTruncation }; | 4922 enum TruncationMode { kTruncate, kNoTruncation }; |
5034 | 4923 |
5035 UnboxIntegerInstr(Representation representation, | 4924 UnboxIntegerInstr(Representation representation, |
5036 TruncationMode truncation_mode, | 4925 TruncationMode truncation_mode, |
5037 Value* value, | 4926 Value* value, |
5038 intptr_t deopt_id) | 4927 intptr_t deopt_id) |
5039 : UnboxInstr(representation, value, deopt_id), | 4928 : UnboxInstr(representation, value, deopt_id), |
5040 is_truncating_(truncation_mode == kTruncate) {} | 4929 is_truncating_(truncation_mode == kTruncate) {} |
(...skipping 13 matching lines...) Expand all Loading... |
5054 DEFINE_INSTRUCTION_TYPE_CHECK(UnboxInteger) | 4943 DEFINE_INSTRUCTION_TYPE_CHECK(UnboxInteger) |
5055 | 4944 |
5056 PRINT_OPERANDS_TO_SUPPORT | 4945 PRINT_OPERANDS_TO_SUPPORT |
5057 | 4946 |
5058 private: | 4947 private: |
5059 bool is_truncating_; | 4948 bool is_truncating_; |
5060 | 4949 |
5061 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); | 4950 DISALLOW_COPY_AND_ASSIGN(UnboxIntegerInstr); |
5062 }; | 4951 }; |
5063 | 4952 |
5064 | |
5065 class UnboxInteger32Instr : public UnboxIntegerInstr { | 4953 class UnboxInteger32Instr : public UnboxIntegerInstr { |
5066 public: | 4954 public: |
5067 UnboxInteger32Instr(Representation representation, | 4955 UnboxInteger32Instr(Representation representation, |
5068 TruncationMode truncation_mode, | 4956 TruncationMode truncation_mode, |
5069 Value* value, | 4957 Value* value, |
5070 intptr_t deopt_id) | 4958 intptr_t deopt_id) |
5071 : UnboxIntegerInstr(representation, truncation_mode, value, deopt_id) {} | 4959 : UnboxIntegerInstr(representation, truncation_mode, value, deopt_id) {} |
5072 | 4960 |
5073 DECLARE_INSTRUCTION_BACKEND() | 4961 DECLARE_INSTRUCTION_BACKEND() |
5074 | 4962 |
5075 private: | 4963 private: |
5076 DISALLOW_COPY_AND_ASSIGN(UnboxInteger32Instr); | 4964 DISALLOW_COPY_AND_ASSIGN(UnboxInteger32Instr); |
5077 }; | 4965 }; |
5078 | 4966 |
5079 | |
5080 class UnboxUint32Instr : public UnboxInteger32Instr { | 4967 class UnboxUint32Instr : public UnboxInteger32Instr { |
5081 public: | 4968 public: |
5082 UnboxUint32Instr(Value* value, intptr_t deopt_id) | 4969 UnboxUint32Instr(Value* value, intptr_t deopt_id) |
5083 : UnboxInteger32Instr(kUnboxedUint32, kTruncate, value, deopt_id) { | 4970 : UnboxInteger32Instr(kUnboxedUint32, kTruncate, value, deopt_id) { |
5084 ASSERT(is_truncating()); | 4971 ASSERT(is_truncating()); |
5085 } | 4972 } |
5086 | 4973 |
5087 virtual bool ComputeCanDeoptimize() const; | 4974 virtual bool ComputeCanDeoptimize() const; |
5088 | 4975 |
5089 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 4976 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
5090 | 4977 |
5091 DECLARE_INSTRUCTION_NO_BACKEND(UnboxUint32) | 4978 DECLARE_INSTRUCTION_NO_BACKEND(UnboxUint32) |
5092 | 4979 |
5093 private: | 4980 private: |
5094 DISALLOW_COPY_AND_ASSIGN(UnboxUint32Instr); | 4981 DISALLOW_COPY_AND_ASSIGN(UnboxUint32Instr); |
5095 }; | 4982 }; |
5096 | 4983 |
5097 | |
5098 class UnboxInt32Instr : public UnboxInteger32Instr { | 4984 class UnboxInt32Instr : public UnboxInteger32Instr { |
5099 public: | 4985 public: |
5100 UnboxInt32Instr(TruncationMode truncation_mode, | 4986 UnboxInt32Instr(TruncationMode truncation_mode, |
5101 Value* value, | 4987 Value* value, |
5102 intptr_t deopt_id) | 4988 intptr_t deopt_id) |
5103 : UnboxInteger32Instr(kUnboxedInt32, truncation_mode, value, deopt_id) {} | 4989 : UnboxInteger32Instr(kUnboxedInt32, truncation_mode, value, deopt_id) {} |
5104 | 4990 |
5105 virtual bool ComputeCanDeoptimize() const; | 4991 virtual bool ComputeCanDeoptimize() const; |
5106 | 4992 |
5107 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 4993 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
5108 | 4994 |
5109 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 4995 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
5110 | 4996 |
5111 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt32) | 4997 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt32) |
5112 | 4998 |
5113 private: | 4999 private: |
5114 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); | 5000 DISALLOW_COPY_AND_ASSIGN(UnboxInt32Instr); |
5115 }; | 5001 }; |
5116 | 5002 |
5117 | |
5118 class UnboxInt64Instr : public UnboxIntegerInstr { | 5003 class UnboxInt64Instr : public UnboxIntegerInstr { |
5119 public: | 5004 public: |
5120 UnboxInt64Instr(Value* value, intptr_t deopt_id) | 5005 UnboxInt64Instr(Value* value, intptr_t deopt_id) |
5121 : UnboxIntegerInstr(kUnboxedMint, kNoTruncation, value, deopt_id) {} | 5006 : UnboxIntegerInstr(kUnboxedMint, kNoTruncation, value, deopt_id) {} |
5122 | 5007 |
5123 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 5008 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
5124 | 5009 |
5125 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt64) | 5010 DECLARE_INSTRUCTION_NO_BACKEND(UnboxInt64) |
5126 | 5011 |
5127 private: | 5012 private: |
5128 DISALLOW_COPY_AND_ASSIGN(UnboxInt64Instr); | 5013 DISALLOW_COPY_AND_ASSIGN(UnboxInt64Instr); |
5129 }; | 5014 }; |
5130 | 5015 |
5131 | |
5132 bool Definition::IsMintDefinition() { | 5016 bool Definition::IsMintDefinition() { |
5133 return (Type()->ToCid() == kMintCid) || IsBinaryMintOp() || IsUnaryMintOp() || | 5017 return (Type()->ToCid() == kMintCid) || IsBinaryMintOp() || IsUnaryMintOp() || |
5134 IsShiftMintOp() || IsBoxInt64() || IsUnboxInt64(); | 5018 IsShiftMintOp() || IsBoxInt64() || IsUnboxInt64(); |
5135 } | 5019 } |
5136 | 5020 |
5137 | |
5138 class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5021 class MathUnaryInstr : public TemplateDefinition<1, NoThrow, Pure> { |
5139 public: | 5022 public: |
5140 enum MathUnaryKind { | 5023 enum MathUnaryKind { |
5141 kIllegal, | 5024 kIllegal, |
5142 kSqrt, | 5025 kSqrt, |
5143 kDoubleSquare, | 5026 kDoubleSquare, |
5144 }; | 5027 }; |
5145 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) | 5028 MathUnaryInstr(MathUnaryKind kind, Value* value, intptr_t deopt_id) |
5146 : TemplateDefinition(deopt_id), kind_(kind) { | 5029 : TemplateDefinition(deopt_id), kind_(kind) { |
5147 SetInputAt(0, value); | 5030 SetInputAt(0, value); |
(...skipping 29 matching lines...) Expand all Loading... |
5177 static const char* KindToCString(MathUnaryKind kind); | 5060 static const char* KindToCString(MathUnaryKind kind); |
5178 | 5061 |
5179 PRINT_OPERANDS_TO_SUPPORT | 5062 PRINT_OPERANDS_TO_SUPPORT |
5180 | 5063 |
5181 private: | 5064 private: |
5182 const MathUnaryKind kind_; | 5065 const MathUnaryKind kind_; |
5183 | 5066 |
5184 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr); | 5067 DISALLOW_COPY_AND_ASSIGN(MathUnaryInstr); |
5185 }; | 5068 }; |
5186 | 5069 |
5187 | |
5188 // Calls into the runtime and performs a case-insensitive comparison of the | 5070 // Calls into the runtime and performs a case-insensitive comparison of the |
5189 // UTF16 strings (i.e. TwoByteString or ExternalTwoByteString) located at | 5071 // UTF16 strings (i.e. TwoByteString or ExternalTwoByteString) located at |
5190 // str[lhs_index:lhs_index + length] and str[rhs_index:rhs_index + length]. | 5072 // str[lhs_index:lhs_index + length] and str[rhs_index:rhs_index + length]. |
5191 // | 5073 // |
5192 // TODO(zerny): Remove this once (if) functions inherited from unibrow | 5074 // TODO(zerny): Remove this once (if) functions inherited from unibrow |
5193 // are moved to dart code. | 5075 // are moved to dart code. |
5194 class CaseInsensitiveCompareUC16Instr | 5076 class CaseInsensitiveCompareUC16Instr |
5195 : public TemplateDefinition<4, NoThrow, Pure> { | 5077 : public TemplateDefinition<4, NoThrow, Pure> { |
5196 public: | 5078 public: |
5197 CaseInsensitiveCompareUC16Instr(Value* str, | 5079 CaseInsensitiveCompareUC16Instr(Value* str, |
(...skipping 30 matching lines...) Expand all Loading... |
5228 virtual bool AttributesEqual(Instruction* other) const { | 5110 virtual bool AttributesEqual(Instruction* other) const { |
5229 return other->AsCaseInsensitiveCompareUC16()->cid_ == cid_; | 5111 return other->AsCaseInsensitiveCompareUC16()->cid_ == cid_; |
5230 } | 5112 } |
5231 | 5113 |
5232 private: | 5114 private: |
5233 const intptr_t cid_; | 5115 const intptr_t cid_; |
5234 | 5116 |
5235 DISALLOW_COPY_AND_ASSIGN(CaseInsensitiveCompareUC16Instr); | 5117 DISALLOW_COPY_AND_ASSIGN(CaseInsensitiveCompareUC16Instr); |
5236 }; | 5118 }; |
5237 | 5119 |
5238 | |
5239 // Represents Math's static min and max functions. | 5120 // Represents Math's static min and max functions. |
5240 class MathMinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5121 class MathMinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5241 public: | 5122 public: |
5242 MathMinMaxInstr(MethodRecognizer::Kind op_kind, | 5123 MathMinMaxInstr(MethodRecognizer::Kind op_kind, |
5243 Value* left_value, | 5124 Value* left_value, |
5244 Value* right_value, | 5125 Value* right_value, |
5245 intptr_t deopt_id, | 5126 intptr_t deopt_id, |
5246 intptr_t result_cid) | 5127 intptr_t result_cid) |
5247 : TemplateDefinition(deopt_id), | 5128 : TemplateDefinition(deopt_id), |
5248 op_kind_(op_kind), | 5129 op_kind_(op_kind), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5287 virtual CompileType ComputeType() const; | 5168 virtual CompileType ComputeType() const; |
5288 virtual bool AttributesEqual(Instruction* other) const; | 5169 virtual bool AttributesEqual(Instruction* other) const; |
5289 | 5170 |
5290 private: | 5171 private: |
5291 const MethodRecognizer::Kind op_kind_; | 5172 const MethodRecognizer::Kind op_kind_; |
5292 const intptr_t result_cid_; | 5173 const intptr_t result_cid_; |
5293 | 5174 |
5294 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); | 5175 DISALLOW_COPY_AND_ASSIGN(MathMinMaxInstr); |
5295 }; | 5176 }; |
5296 | 5177 |
5297 | |
5298 class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5178 class BinaryDoubleOpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5299 public: | 5179 public: |
5300 BinaryDoubleOpInstr(Token::Kind op_kind, | 5180 BinaryDoubleOpInstr(Token::Kind op_kind, |
5301 Value* left, | 5181 Value* left, |
5302 Value* right, | 5182 Value* right, |
5303 intptr_t deopt_id, | 5183 intptr_t deopt_id, |
5304 TokenPosition token_pos) | 5184 TokenPosition token_pos) |
5305 : TemplateDefinition(deopt_id), op_kind_(op_kind), token_pos_(token_pos) { | 5185 : TemplateDefinition(deopt_id), op_kind_(op_kind), token_pos_(token_pos) { |
5306 SetInputAt(0, left); | 5186 SetInputAt(0, left); |
5307 SetInputAt(1, right); | 5187 SetInputAt(1, right); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5340 return op_kind() == other->AsBinaryDoubleOp()->op_kind(); | 5220 return op_kind() == other->AsBinaryDoubleOp()->op_kind(); |
5341 } | 5221 } |
5342 | 5222 |
5343 private: | 5223 private: |
5344 const Token::Kind op_kind_; | 5224 const Token::Kind op_kind_; |
5345 const TokenPosition token_pos_; | 5225 const TokenPosition token_pos_; |
5346 | 5226 |
5347 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); | 5227 DISALLOW_COPY_AND_ASSIGN(BinaryDoubleOpInstr); |
5348 }; | 5228 }; |
5349 | 5229 |
5350 | |
5351 class DoubleTestOpInstr : public TemplateComparison<1, NoThrow, Pure> { | 5230 class DoubleTestOpInstr : public TemplateComparison<1, NoThrow, Pure> { |
5352 public: | 5231 public: |
5353 DoubleTestOpInstr(MethodRecognizer::Kind op_kind, | 5232 DoubleTestOpInstr(MethodRecognizer::Kind op_kind, |
5354 Value* value, | 5233 Value* value, |
5355 intptr_t deopt_id, | 5234 intptr_t deopt_id, |
5356 TokenPosition token_pos) | 5235 TokenPosition token_pos) |
5357 : TemplateComparison(token_pos, Token::kEQ, deopt_id), op_kind_(op_kind) { | 5236 : TemplateComparison(token_pos, Token::kEQ, deopt_id), op_kind_(op_kind) { |
5358 SetInputAt(0, value); | 5237 SetInputAt(0, value); |
5359 } | 5238 } |
5360 | 5239 |
(...skipping 22 matching lines...) Expand all Loading... |
5383 } | 5262 } |
5384 | 5263 |
5385 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 5264 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
5386 | 5265 |
5387 private: | 5266 private: |
5388 const MethodRecognizer::Kind op_kind_; | 5267 const MethodRecognizer::Kind op_kind_; |
5389 | 5268 |
5390 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); | 5269 DISALLOW_COPY_AND_ASSIGN(DoubleTestOpInstr); |
5391 }; | 5270 }; |
5392 | 5271 |
5393 | |
5394 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5272 class BinaryFloat32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5395 public: | 5273 public: |
5396 BinaryFloat32x4OpInstr(Token::Kind op_kind, | 5274 BinaryFloat32x4OpInstr(Token::Kind op_kind, |
5397 Value* left, | 5275 Value* left, |
5398 Value* right, | 5276 Value* right, |
5399 intptr_t deopt_id) | 5277 intptr_t deopt_id) |
5400 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5278 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5401 SetInputAt(0, left); | 5279 SetInputAt(0, left); |
5402 SetInputAt(1, right); | 5280 SetInputAt(1, right); |
5403 } | 5281 } |
(...skipping 26 matching lines...) Expand all Loading... |
5430 } | 5308 } |
5431 | 5309 |
5432 PRINT_OPERANDS_TO_SUPPORT | 5310 PRINT_OPERANDS_TO_SUPPORT |
5433 | 5311 |
5434 private: | 5312 private: |
5435 const Token::Kind op_kind_; | 5313 const Token::Kind op_kind_; |
5436 | 5314 |
5437 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); | 5315 DISALLOW_COPY_AND_ASSIGN(BinaryFloat32x4OpInstr); |
5438 }; | 5316 }; |
5439 | 5317 |
5440 | |
5441 class Simd32x4ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5318 class Simd32x4ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
5442 public: | 5319 public: |
5443 Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, | 5320 Simd32x4ShuffleInstr(MethodRecognizer::Kind op_kind, |
5444 Value* value, | 5321 Value* value, |
5445 intptr_t mask, | 5322 intptr_t mask, |
5446 intptr_t deopt_id) | 5323 intptr_t deopt_id) |
5447 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) { | 5324 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) { |
5448 SetInputAt(0, value); | 5325 SetInputAt(0, value); |
5449 } | 5326 } |
5450 | 5327 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5499 (mask() == other->AsSimd32x4Shuffle()->mask()); | 5376 (mask() == other->AsSimd32x4Shuffle()->mask()); |
5500 } | 5377 } |
5501 | 5378 |
5502 private: | 5379 private: |
5503 const MethodRecognizer::Kind op_kind_; | 5380 const MethodRecognizer::Kind op_kind_; |
5504 const intptr_t mask_; | 5381 const intptr_t mask_; |
5505 | 5382 |
5506 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr); | 5383 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleInstr); |
5507 }; | 5384 }; |
5508 | 5385 |
5509 | |
5510 class Simd32x4ShuffleMixInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5386 class Simd32x4ShuffleMixInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5511 public: | 5387 public: |
5512 Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, | 5388 Simd32x4ShuffleMixInstr(MethodRecognizer::Kind op_kind, |
5513 Value* xy, | 5389 Value* xy, |
5514 Value* zw, | 5390 Value* zw, |
5515 intptr_t mask, | 5391 intptr_t mask, |
5516 intptr_t deopt_id) | 5392 intptr_t deopt_id) |
5517 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) { | 5393 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) { |
5518 SetInputAt(0, xy); | 5394 SetInputAt(0, xy); |
5519 SetInputAt(1, zw); | 5395 SetInputAt(1, zw); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5561 (mask() == other->AsSimd32x4ShuffleMix()->mask()); | 5437 (mask() == other->AsSimd32x4ShuffleMix()->mask()); |
5562 } | 5438 } |
5563 | 5439 |
5564 private: | 5440 private: |
5565 const MethodRecognizer::Kind op_kind_; | 5441 const MethodRecognizer::Kind op_kind_; |
5566 const intptr_t mask_; | 5442 const intptr_t mask_; |
5567 | 5443 |
5568 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr); | 5444 DISALLOW_COPY_AND_ASSIGN(Simd32x4ShuffleMixInstr); |
5569 }; | 5445 }; |
5570 | 5446 |
5571 | |
5572 class Float32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { | 5447 class Float32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { |
5573 public: | 5448 public: |
5574 Float32x4ConstructorInstr(Value* value0, | 5449 Float32x4ConstructorInstr(Value* value0, |
5575 Value* value1, | 5450 Value* value1, |
5576 Value* value2, | 5451 Value* value2, |
5577 Value* value3, | 5452 Value* value3, |
5578 intptr_t deopt_id) | 5453 intptr_t deopt_id) |
5579 : TemplateDefinition(deopt_id) { | 5454 : TemplateDefinition(deopt_id) { |
5580 SetInputAt(0, value0); | 5455 SetInputAt(0, value0); |
5581 SetInputAt(1, value1); | 5456 SetInputAt(1, value1); |
(...skipping 25 matching lines...) Expand all Loading... |
5607 virtual CompileType ComputeType() const; | 5482 virtual CompileType ComputeType() const; |
5608 | 5483 |
5609 virtual bool AttributesEqual(Instruction* other) const { return true; } | 5484 virtual bool AttributesEqual(Instruction* other) const { return true; } |
5610 | 5485 |
5611 PRINT_OPERANDS_TO_SUPPORT | 5486 PRINT_OPERANDS_TO_SUPPORT |
5612 | 5487 |
5613 private: | 5488 private: |
5614 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr); | 5489 DISALLOW_COPY_AND_ASSIGN(Float32x4ConstructorInstr); |
5615 }; | 5490 }; |
5616 | 5491 |
5617 | |
5618 class Float32x4SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5492 class Float32x4SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { |
5619 public: | 5493 public: |
5620 Float32x4SplatInstr(Value* value, intptr_t deopt_id) | 5494 Float32x4SplatInstr(Value* value, intptr_t deopt_id) |
5621 : TemplateDefinition(deopt_id) { | 5495 : TemplateDefinition(deopt_id) { |
5622 SetInputAt(0, value); | 5496 SetInputAt(0, value); |
5623 } | 5497 } |
5624 | 5498 |
5625 Value* value() const { return inputs_[0]; } | 5499 Value* value() const { return inputs_[0]; } |
5626 | 5500 |
5627 virtual bool ComputeCanDeoptimize() const { return false; } | 5501 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
5643 virtual CompileType ComputeType() const; | 5517 virtual CompileType ComputeType() const; |
5644 | 5518 |
5645 virtual bool AttributesEqual(Instruction* other) const { return true; } | 5519 virtual bool AttributesEqual(Instruction* other) const { return true; } |
5646 | 5520 |
5647 PRINT_OPERANDS_TO_SUPPORT | 5521 PRINT_OPERANDS_TO_SUPPORT |
5648 | 5522 |
5649 private: | 5523 private: |
5650 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr); | 5524 DISALLOW_COPY_AND_ASSIGN(Float32x4SplatInstr); |
5651 }; | 5525 }; |
5652 | 5526 |
5653 | |
5654 // TODO(vegorov) replace with UnboxedConstantInstr. | 5527 // TODO(vegorov) replace with UnboxedConstantInstr. |
5655 class Float32x4ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { | 5528 class Float32x4ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { |
5656 public: | 5529 public: |
5657 Float32x4ZeroInstr() {} | 5530 Float32x4ZeroInstr() {} |
5658 | 5531 |
5659 virtual bool ComputeCanDeoptimize() const { return false; } | 5532 virtual bool ComputeCanDeoptimize() const { return false; } |
5660 | 5533 |
5661 virtual Representation representation() const { return kUnboxedFloat32x4; } | 5534 virtual Representation representation() const { return kUnboxedFloat32x4; } |
5662 | 5535 |
5663 DECLARE_INSTRUCTION(Float32x4Zero) | 5536 DECLARE_INSTRUCTION(Float32x4Zero) |
5664 virtual CompileType ComputeType() const; | 5537 virtual CompileType ComputeType() const; |
5665 | 5538 |
5666 virtual bool AttributesEqual(Instruction* other) const { return true; } | 5539 virtual bool AttributesEqual(Instruction* other) const { return true; } |
5667 | 5540 |
5668 private: | 5541 private: |
5669 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); | 5542 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroInstr); |
5670 }; | 5543 }; |
5671 | 5544 |
5672 | |
5673 class Float32x4ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5545 class Float32x4ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5674 public: | 5546 public: |
5675 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind, | 5547 Float32x4ComparisonInstr(MethodRecognizer::Kind op_kind, |
5676 Value* left, | 5548 Value* left, |
5677 Value* right, | 5549 Value* right, |
5678 intptr_t deopt_id) | 5550 intptr_t deopt_id) |
5679 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5551 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5680 SetInputAt(0, left); | 5552 SetInputAt(0, left); |
5681 SetInputAt(1, right); | 5553 SetInputAt(1, right); |
5682 } | 5554 } |
(...skipping 26 matching lines...) Expand all Loading... |
5709 } | 5581 } |
5710 | 5582 |
5711 PRINT_OPERANDS_TO_SUPPORT | 5583 PRINT_OPERANDS_TO_SUPPORT |
5712 | 5584 |
5713 private: | 5585 private: |
5714 const MethodRecognizer::Kind op_kind_; | 5586 const MethodRecognizer::Kind op_kind_; |
5715 | 5587 |
5716 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr); | 5588 DISALLOW_COPY_AND_ASSIGN(Float32x4ComparisonInstr); |
5717 }; | 5589 }; |
5718 | 5590 |
5719 | |
5720 class Float32x4MinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5591 class Float32x4MinMaxInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5721 public: | 5592 public: |
5722 Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind, | 5593 Float32x4MinMaxInstr(MethodRecognizer::Kind op_kind, |
5723 Value* left, | 5594 Value* left, |
5724 Value* right, | 5595 Value* right, |
5725 intptr_t deopt_id) | 5596 intptr_t deopt_id) |
5726 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5597 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5727 SetInputAt(0, left); | 5598 SetInputAt(0, left); |
5728 SetInputAt(1, right); | 5599 SetInputAt(1, right); |
5729 } | 5600 } |
(...skipping 26 matching lines...) Expand all Loading... |
5756 } | 5627 } |
5757 | 5628 |
5758 PRINT_OPERANDS_TO_SUPPORT | 5629 PRINT_OPERANDS_TO_SUPPORT |
5759 | 5630 |
5760 private: | 5631 private: |
5761 const MethodRecognizer::Kind op_kind_; | 5632 const MethodRecognizer::Kind op_kind_; |
5762 | 5633 |
5763 DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr); | 5634 DISALLOW_COPY_AND_ASSIGN(Float32x4MinMaxInstr); |
5764 }; | 5635 }; |
5765 | 5636 |
5766 | |
5767 class Float32x4ScaleInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5637 class Float32x4ScaleInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5768 public: | 5638 public: |
5769 Float32x4ScaleInstr(MethodRecognizer::Kind op_kind, | 5639 Float32x4ScaleInstr(MethodRecognizer::Kind op_kind, |
5770 Value* left, | 5640 Value* left, |
5771 Value* right, | 5641 Value* right, |
5772 intptr_t deopt_id) | 5642 intptr_t deopt_id) |
5773 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5643 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5774 SetInputAt(0, left); | 5644 SetInputAt(0, left); |
5775 SetInputAt(1, right); | 5645 SetInputAt(1, right); |
5776 } | 5646 } |
(...skipping 29 matching lines...) Expand all Loading... |
5806 } | 5676 } |
5807 | 5677 |
5808 PRINT_OPERANDS_TO_SUPPORT | 5678 PRINT_OPERANDS_TO_SUPPORT |
5809 | 5679 |
5810 private: | 5680 private: |
5811 const MethodRecognizer::Kind op_kind_; | 5681 const MethodRecognizer::Kind op_kind_; |
5812 | 5682 |
5813 DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr); | 5683 DISALLOW_COPY_AND_ASSIGN(Float32x4ScaleInstr); |
5814 }; | 5684 }; |
5815 | 5685 |
5816 | |
5817 class Float32x4SqrtInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5686 class Float32x4SqrtInstr : public TemplateDefinition<1, NoThrow, Pure> { |
5818 public: | 5687 public: |
5819 Float32x4SqrtInstr(MethodRecognizer::Kind op_kind, | 5688 Float32x4SqrtInstr(MethodRecognizer::Kind op_kind, |
5820 Value* left, | 5689 Value* left, |
5821 intptr_t deopt_id) | 5690 intptr_t deopt_id) |
5822 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5691 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5823 SetInputAt(0, left); | 5692 SetInputAt(0, left); |
5824 } | 5693 } |
5825 | 5694 |
5826 Value* left() const { return inputs_[0]; } | 5695 Value* left() const { return inputs_[0]; } |
(...skipping 23 matching lines...) Expand all Loading... |
5850 } | 5719 } |
5851 | 5720 |
5852 PRINT_OPERANDS_TO_SUPPORT | 5721 PRINT_OPERANDS_TO_SUPPORT |
5853 | 5722 |
5854 private: | 5723 private: |
5855 const MethodRecognizer::Kind op_kind_; | 5724 const MethodRecognizer::Kind op_kind_; |
5856 | 5725 |
5857 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr); | 5726 DISALLOW_COPY_AND_ASSIGN(Float32x4SqrtInstr); |
5858 }; | 5727 }; |
5859 | 5728 |
5860 | |
5861 // TODO(vegorov) rename to Unary to match naming convention for arithmetic. | 5729 // TODO(vegorov) rename to Unary to match naming convention for arithmetic. |
5862 class Float32x4ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5730 class Float32x4ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { |
5863 public: | 5731 public: |
5864 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind, | 5732 Float32x4ZeroArgInstr(MethodRecognizer::Kind op_kind, |
5865 Value* left, | 5733 Value* left, |
5866 intptr_t deopt_id) | 5734 intptr_t deopt_id) |
5867 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5735 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5868 SetInputAt(0, left); | 5736 SetInputAt(0, left); |
5869 } | 5737 } |
5870 | 5738 |
(...skipping 24 matching lines...) Expand all Loading... |
5895 } | 5763 } |
5896 | 5764 |
5897 PRINT_OPERANDS_TO_SUPPORT | 5765 PRINT_OPERANDS_TO_SUPPORT |
5898 | 5766 |
5899 private: | 5767 private: |
5900 const MethodRecognizer::Kind op_kind_; | 5768 const MethodRecognizer::Kind op_kind_; |
5901 | 5769 |
5902 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr); | 5770 DISALLOW_COPY_AND_ASSIGN(Float32x4ZeroArgInstr); |
5903 }; | 5771 }; |
5904 | 5772 |
5905 | |
5906 class Float32x4ClampInstr : public TemplateDefinition<3, NoThrow, Pure> { | 5773 class Float32x4ClampInstr : public TemplateDefinition<3, NoThrow, Pure> { |
5907 public: | 5774 public: |
5908 Float32x4ClampInstr(Value* left, | 5775 Float32x4ClampInstr(Value* left, |
5909 Value* lower, | 5776 Value* lower, |
5910 Value* upper, | 5777 Value* upper, |
5911 intptr_t deopt_id) | 5778 intptr_t deopt_id) |
5912 : TemplateDefinition(deopt_id) { | 5779 : TemplateDefinition(deopt_id) { |
5913 SetInputAt(0, left); | 5780 SetInputAt(0, left); |
5914 SetInputAt(1, lower); | 5781 SetInputAt(1, lower); |
5915 SetInputAt(2, upper); | 5782 SetInputAt(2, upper); |
(...skipping 22 matching lines...) Expand all Loading... |
5938 virtual CompileType ComputeType() const; | 5805 virtual CompileType ComputeType() const; |
5939 | 5806 |
5940 virtual bool AttributesEqual(Instruction* other) const { return true; } | 5807 virtual bool AttributesEqual(Instruction* other) const { return true; } |
5941 | 5808 |
5942 PRINT_OPERANDS_TO_SUPPORT | 5809 PRINT_OPERANDS_TO_SUPPORT |
5943 | 5810 |
5944 private: | 5811 private: |
5945 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr); | 5812 DISALLOW_COPY_AND_ASSIGN(Float32x4ClampInstr); |
5946 }; | 5813 }; |
5947 | 5814 |
5948 | |
5949 class Float32x4WithInstr : public TemplateDefinition<2, NoThrow, Pure> { | 5815 class Float32x4WithInstr : public TemplateDefinition<2, NoThrow, Pure> { |
5950 public: | 5816 public: |
5951 Float32x4WithInstr(MethodRecognizer::Kind op_kind, | 5817 Float32x4WithInstr(MethodRecognizer::Kind op_kind, |
5952 Value* left, | 5818 Value* left, |
5953 Value* replacement, | 5819 Value* replacement, |
5954 intptr_t deopt_id) | 5820 intptr_t deopt_id) |
5955 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 5821 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
5956 SetInputAt(0, replacement); | 5822 SetInputAt(0, replacement); |
5957 SetInputAt(1, left); | 5823 SetInputAt(1, left); |
5958 } | 5824 } |
(...skipping 29 matching lines...) Expand all Loading... |
5988 } | 5854 } |
5989 | 5855 |
5990 PRINT_OPERANDS_TO_SUPPORT | 5856 PRINT_OPERANDS_TO_SUPPORT |
5991 | 5857 |
5992 private: | 5858 private: |
5993 const MethodRecognizer::Kind op_kind_; | 5859 const MethodRecognizer::Kind op_kind_; |
5994 | 5860 |
5995 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr); | 5861 DISALLOW_COPY_AND_ASSIGN(Float32x4WithInstr); |
5996 }; | 5862 }; |
5997 | 5863 |
5998 | |
5999 class Simd64x2ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 5864 class Simd64x2ShuffleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
6000 public: | 5865 public: |
6001 Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind, | 5866 Simd64x2ShuffleInstr(MethodRecognizer::Kind op_kind, |
6002 Value* value, | 5867 Value* value, |
6003 intptr_t mask, | 5868 intptr_t mask, |
6004 intptr_t deopt_id) | 5869 intptr_t deopt_id) |
6005 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) { | 5870 : TemplateDefinition(deopt_id), op_kind_(op_kind), mask_(mask) { |
6006 SetInputAt(0, value); | 5871 SetInputAt(0, value); |
6007 } | 5872 } |
6008 | 5873 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6049 | 5914 |
6050 PRINT_OPERANDS_TO_SUPPORT | 5915 PRINT_OPERANDS_TO_SUPPORT |
6051 | 5916 |
6052 private: | 5917 private: |
6053 const MethodRecognizer::Kind op_kind_; | 5918 const MethodRecognizer::Kind op_kind_; |
6054 const intptr_t mask_; | 5919 const intptr_t mask_; |
6055 | 5920 |
6056 DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr); | 5921 DISALLOW_COPY_AND_ASSIGN(Simd64x2ShuffleInstr); |
6057 }; | 5922 }; |
6058 | 5923 |
6059 | |
6060 class Float32x4ToInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { | 5924 class Float32x4ToInt32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { |
6061 public: | 5925 public: |
6062 Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id) | 5926 Float32x4ToInt32x4Instr(Value* left, intptr_t deopt_id) |
6063 : TemplateDefinition(deopt_id) { | 5927 : TemplateDefinition(deopt_id) { |
6064 SetInputAt(0, left); | 5928 SetInputAt(0, left); |
6065 } | 5929 } |
6066 | 5930 |
6067 Value* left() const { return inputs_[0]; } | 5931 Value* left() const { return inputs_[0]; } |
6068 | 5932 |
6069 virtual bool ComputeCanDeoptimize() const { return false; } | 5933 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6085 virtual CompileType ComputeType() const; | 5949 virtual CompileType ComputeType() const; |
6086 | 5950 |
6087 virtual bool AttributesEqual(Instruction* other) const { return true; } | 5951 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6088 | 5952 |
6089 PRINT_OPERANDS_TO_SUPPORT | 5953 PRINT_OPERANDS_TO_SUPPORT |
6090 | 5954 |
6091 private: | 5955 private: |
6092 DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr); | 5956 DISALLOW_COPY_AND_ASSIGN(Float32x4ToInt32x4Instr); |
6093 }; | 5957 }; |
6094 | 5958 |
6095 | |
6096 class Float32x4ToFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> { | 5959 class Float32x4ToFloat64x2Instr : public TemplateDefinition<1, NoThrow, Pure> { |
6097 public: | 5960 public: |
6098 Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id) | 5961 Float32x4ToFloat64x2Instr(Value* left, intptr_t deopt_id) |
6099 : TemplateDefinition(deopt_id) { | 5962 : TemplateDefinition(deopt_id) { |
6100 SetInputAt(0, left); | 5963 SetInputAt(0, left); |
6101 } | 5964 } |
6102 | 5965 |
6103 Value* left() const { return inputs_[0]; } | 5966 Value* left() const { return inputs_[0]; } |
6104 | 5967 |
6105 virtual bool ComputeCanDeoptimize() const { return false; } | 5968 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6121 virtual CompileType ComputeType() const; | 5984 virtual CompileType ComputeType() const; |
6122 | 5985 |
6123 virtual bool AttributesEqual(Instruction* other) const { return true; } | 5986 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6124 | 5987 |
6125 PRINT_OPERANDS_TO_SUPPORT | 5988 PRINT_OPERANDS_TO_SUPPORT |
6126 | 5989 |
6127 private: | 5990 private: |
6128 DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr); | 5991 DISALLOW_COPY_AND_ASSIGN(Float32x4ToFloat64x2Instr); |
6129 }; | 5992 }; |
6130 | 5993 |
6131 | |
6132 class Float64x2ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { | 5994 class Float64x2ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { |
6133 public: | 5995 public: |
6134 Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id) | 5996 Float64x2ToFloat32x4Instr(Value* left, intptr_t deopt_id) |
6135 : TemplateDefinition(deopt_id) { | 5997 : TemplateDefinition(deopt_id) { |
6136 SetInputAt(0, left); | 5998 SetInputAt(0, left); |
6137 } | 5999 } |
6138 | 6000 |
6139 Value* left() const { return inputs_[0]; } | 6001 Value* left() const { return inputs_[0]; } |
6140 | 6002 |
6141 virtual bool ComputeCanDeoptimize() const { return false; } | 6003 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6157 virtual CompileType ComputeType() const; | 6019 virtual CompileType ComputeType() const; |
6158 | 6020 |
6159 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6021 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6160 | 6022 |
6161 PRINT_OPERANDS_TO_SUPPORT | 6023 PRINT_OPERANDS_TO_SUPPORT |
6162 | 6024 |
6163 private: | 6025 private: |
6164 DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr); | 6026 DISALLOW_COPY_AND_ASSIGN(Float64x2ToFloat32x4Instr); |
6165 }; | 6027 }; |
6166 | 6028 |
6167 | |
6168 class Float64x2ConstructorInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6029 class Float64x2ConstructorInstr : public TemplateDefinition<2, NoThrow, Pure> { |
6169 public: | 6030 public: |
6170 Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id) | 6031 Float64x2ConstructorInstr(Value* value0, Value* value1, intptr_t deopt_id) |
6171 : TemplateDefinition(deopt_id) { | 6032 : TemplateDefinition(deopt_id) { |
6172 SetInputAt(0, value0); | 6033 SetInputAt(0, value0); |
6173 SetInputAt(1, value1); | 6034 SetInputAt(1, value1); |
6174 } | 6035 } |
6175 | 6036 |
6176 Value* value0() const { return inputs_[0]; } | 6037 Value* value0() const { return inputs_[0]; } |
6177 Value* value1() const { return inputs_[1]; } | 6038 Value* value1() const { return inputs_[1]; } |
(...skipping 17 matching lines...) Expand all Loading... |
6195 | 6056 |
6196 DECLARE_INSTRUCTION(Float64x2Constructor) | 6057 DECLARE_INSTRUCTION(Float64x2Constructor) |
6197 virtual CompileType ComputeType() const; | 6058 virtual CompileType ComputeType() const; |
6198 | 6059 |
6199 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6060 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6200 | 6061 |
6201 private: | 6062 private: |
6202 DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr); | 6063 DISALLOW_COPY_AND_ASSIGN(Float64x2ConstructorInstr); |
6203 }; | 6064 }; |
6204 | 6065 |
6205 | |
6206 class Float64x2SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { | 6066 class Float64x2SplatInstr : public TemplateDefinition<1, NoThrow, Pure> { |
6207 public: | 6067 public: |
6208 Float64x2SplatInstr(Value* value, intptr_t deopt_id) | 6068 Float64x2SplatInstr(Value* value, intptr_t deopt_id) |
6209 : TemplateDefinition(deopt_id) { | 6069 : TemplateDefinition(deopt_id) { |
6210 SetInputAt(0, value); | 6070 SetInputAt(0, value); |
6211 } | 6071 } |
6212 | 6072 |
6213 Value* value() const { return inputs_[0]; } | 6073 Value* value() const { return inputs_[0]; } |
6214 | 6074 |
6215 virtual bool ComputeCanDeoptimize() const { return false; } | 6075 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6231 virtual CompileType ComputeType() const; | 6091 virtual CompileType ComputeType() const; |
6232 | 6092 |
6233 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6093 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6234 | 6094 |
6235 PRINT_OPERANDS_TO_SUPPORT | 6095 PRINT_OPERANDS_TO_SUPPORT |
6236 | 6096 |
6237 private: | 6097 private: |
6238 DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr); | 6098 DISALLOW_COPY_AND_ASSIGN(Float64x2SplatInstr); |
6239 }; | 6099 }; |
6240 | 6100 |
6241 | |
6242 class Float64x2ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { | 6101 class Float64x2ZeroInstr : public TemplateDefinition<0, NoThrow, Pure> { |
6243 public: | 6102 public: |
6244 Float64x2ZeroInstr() {} | 6103 Float64x2ZeroInstr() {} |
6245 | 6104 |
6246 virtual bool ComputeCanDeoptimize() const { return false; } | 6105 virtual bool ComputeCanDeoptimize() const { return false; } |
6247 | 6106 |
6248 virtual Representation representation() const { return kUnboxedFloat64x2; } | 6107 virtual Representation representation() const { return kUnboxedFloat64x2; } |
6249 | 6108 |
6250 DECLARE_INSTRUCTION(Float64x2Zero) | 6109 DECLARE_INSTRUCTION(Float64x2Zero) |
6251 virtual CompileType ComputeType() const; | 6110 virtual CompileType ComputeType() const; |
6252 | 6111 |
6253 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6112 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6254 | 6113 |
6255 private: | 6114 private: |
6256 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); | 6115 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroInstr); |
6257 }; | 6116 }; |
6258 | 6117 |
6259 | |
6260 // TODO(vegorov) rename to Unary to match arithmetic instructions. | 6118 // TODO(vegorov) rename to Unary to match arithmetic instructions. |
6261 class Float64x2ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { | 6119 class Float64x2ZeroArgInstr : public TemplateDefinition<1, NoThrow, Pure> { |
6262 public: | 6120 public: |
6263 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind, | 6121 Float64x2ZeroArgInstr(MethodRecognizer::Kind op_kind, |
6264 Value* left, | 6122 Value* left, |
6265 intptr_t deopt_id) | 6123 intptr_t deopt_id) |
6266 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6124 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6267 SetInputAt(0, left); | 6125 SetInputAt(0, left); |
6268 } | 6126 } |
6269 | 6127 |
(...skipping 30 matching lines...) Expand all Loading... |
6300 virtual bool AttributesEqual(Instruction* other) const { | 6158 virtual bool AttributesEqual(Instruction* other) const { |
6301 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind(); | 6159 return op_kind() == other->AsFloat64x2ZeroArg()->op_kind(); |
6302 } | 6160 } |
6303 | 6161 |
6304 private: | 6162 private: |
6305 const MethodRecognizer::Kind op_kind_; | 6163 const MethodRecognizer::Kind op_kind_; |
6306 | 6164 |
6307 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr); | 6165 DISALLOW_COPY_AND_ASSIGN(Float64x2ZeroArgInstr); |
6308 }; | 6166 }; |
6309 | 6167 |
6310 | |
6311 class Float64x2OneArgInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6168 class Float64x2OneArgInstr : public TemplateDefinition<2, NoThrow, Pure> { |
6312 public: | 6169 public: |
6313 Float64x2OneArgInstr(MethodRecognizer::Kind op_kind, | 6170 Float64x2OneArgInstr(MethodRecognizer::Kind op_kind, |
6314 Value* left, | 6171 Value* left, |
6315 Value* right, | 6172 Value* right, |
6316 intptr_t deopt_id) | 6173 intptr_t deopt_id) |
6317 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6174 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6318 SetInputAt(0, left); | 6175 SetInputAt(0, left); |
6319 SetInputAt(1, right); | 6176 SetInputAt(1, right); |
6320 } | 6177 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6355 virtual bool AttributesEqual(Instruction* other) const { | 6212 virtual bool AttributesEqual(Instruction* other) const { |
6356 return op_kind() == other->AsFloat64x2OneArg()->op_kind(); | 6213 return op_kind() == other->AsFloat64x2OneArg()->op_kind(); |
6357 } | 6214 } |
6358 | 6215 |
6359 private: | 6216 private: |
6360 const MethodRecognizer::Kind op_kind_; | 6217 const MethodRecognizer::Kind op_kind_; |
6361 | 6218 |
6362 DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr); | 6219 DISALLOW_COPY_AND_ASSIGN(Float64x2OneArgInstr); |
6363 }; | 6220 }; |
6364 | 6221 |
6365 | |
6366 class Int32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { | 6222 class Int32x4ConstructorInstr : public TemplateDefinition<4, NoThrow, Pure> { |
6367 public: | 6223 public: |
6368 Int32x4ConstructorInstr(Value* value0, | 6224 Int32x4ConstructorInstr(Value* value0, |
6369 Value* value1, | 6225 Value* value1, |
6370 Value* value2, | 6226 Value* value2, |
6371 Value* value3, | 6227 Value* value3, |
6372 intptr_t deopt_id) | 6228 intptr_t deopt_id) |
6373 : TemplateDefinition(deopt_id) { | 6229 : TemplateDefinition(deopt_id) { |
6374 SetInputAt(0, value0); | 6230 SetInputAt(0, value0); |
6375 SetInputAt(1, value1); | 6231 SetInputAt(1, value1); |
(...skipping 25 matching lines...) Expand all Loading... |
6401 virtual CompileType ComputeType() const; | 6257 virtual CompileType ComputeType() const; |
6402 | 6258 |
6403 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6259 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6404 | 6260 |
6405 PRINT_OPERANDS_TO_SUPPORT | 6261 PRINT_OPERANDS_TO_SUPPORT |
6406 | 6262 |
6407 private: | 6263 private: |
6408 DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr); | 6264 DISALLOW_COPY_AND_ASSIGN(Int32x4ConstructorInstr); |
6409 }; | 6265 }; |
6410 | 6266 |
6411 | |
6412 class Int32x4BoolConstructorInstr | 6267 class Int32x4BoolConstructorInstr |
6413 : public TemplateDefinition<4, NoThrow, Pure> { | 6268 : public TemplateDefinition<4, NoThrow, Pure> { |
6414 public: | 6269 public: |
6415 Int32x4BoolConstructorInstr(Value* value0, | 6270 Int32x4BoolConstructorInstr(Value* value0, |
6416 Value* value1, | 6271 Value* value1, |
6417 Value* value2, | 6272 Value* value2, |
6418 Value* value3, | 6273 Value* value3, |
6419 intptr_t deopt_id) | 6274 intptr_t deopt_id) |
6420 : TemplateDefinition(deopt_id) { | 6275 : TemplateDefinition(deopt_id) { |
6421 SetInputAt(0, value0); | 6276 SetInputAt(0, value0); |
(...skipping 26 matching lines...) Expand all Loading... |
6448 virtual CompileType ComputeType() const; | 6303 virtual CompileType ComputeType() const; |
6449 | 6304 |
6450 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6305 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6451 | 6306 |
6452 PRINT_OPERANDS_TO_SUPPORT | 6307 PRINT_OPERANDS_TO_SUPPORT |
6453 | 6308 |
6454 private: | 6309 private: |
6455 DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr); | 6310 DISALLOW_COPY_AND_ASSIGN(Int32x4BoolConstructorInstr); |
6456 }; | 6311 }; |
6457 | 6312 |
6458 | |
6459 class Int32x4GetFlagInstr : public TemplateDefinition<1, NoThrow, Pure> { | 6313 class Int32x4GetFlagInstr : public TemplateDefinition<1, NoThrow, Pure> { |
6460 public: | 6314 public: |
6461 Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind, | 6315 Int32x4GetFlagInstr(MethodRecognizer::Kind op_kind, |
6462 Value* value, | 6316 Value* value, |
6463 intptr_t deopt_id) | 6317 intptr_t deopt_id) |
6464 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6318 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6465 SetInputAt(0, value); | 6319 SetInputAt(0, value); |
6466 } | 6320 } |
6467 | 6321 |
6468 Value* value() const { return inputs_[0]; } | 6322 Value* value() const { return inputs_[0]; } |
(...skipping 23 matching lines...) Expand all Loading... |
6492 } | 6346 } |
6493 | 6347 |
6494 PRINT_OPERANDS_TO_SUPPORT | 6348 PRINT_OPERANDS_TO_SUPPORT |
6495 | 6349 |
6496 private: | 6350 private: |
6497 const MethodRecognizer::Kind op_kind_; | 6351 const MethodRecognizer::Kind op_kind_; |
6498 | 6352 |
6499 DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr); | 6353 DISALLOW_COPY_AND_ASSIGN(Int32x4GetFlagInstr); |
6500 }; | 6354 }; |
6501 | 6355 |
6502 | |
6503 class Simd32x4GetSignMaskInstr : public TemplateDefinition<1, NoThrow, Pure> { | 6356 class Simd32x4GetSignMaskInstr : public TemplateDefinition<1, NoThrow, Pure> { |
6504 public: | 6357 public: |
6505 Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind, | 6358 Simd32x4GetSignMaskInstr(MethodRecognizer::Kind op_kind, |
6506 Value* value, | 6359 Value* value, |
6507 intptr_t deopt_id) | 6360 intptr_t deopt_id) |
6508 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6361 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6509 SetInputAt(0, value); | 6362 SetInputAt(0, value); |
6510 } | 6363 } |
6511 | 6364 |
6512 Value* value() const { return inputs_[0]; } | 6365 Value* value() const { return inputs_[0]; } |
(...skipping 27 matching lines...) Expand all Loading... |
6540 } | 6393 } |
6541 | 6394 |
6542 PRINT_OPERANDS_TO_SUPPORT | 6395 PRINT_OPERANDS_TO_SUPPORT |
6543 | 6396 |
6544 private: | 6397 private: |
6545 const MethodRecognizer::Kind op_kind_; | 6398 const MethodRecognizer::Kind op_kind_; |
6546 | 6399 |
6547 DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr); | 6400 DISALLOW_COPY_AND_ASSIGN(Simd32x4GetSignMaskInstr); |
6548 }; | 6401 }; |
6549 | 6402 |
6550 | |
6551 class Int32x4SelectInstr : public TemplateDefinition<3, NoThrow, Pure> { | 6403 class Int32x4SelectInstr : public TemplateDefinition<3, NoThrow, Pure> { |
6552 public: | 6404 public: |
6553 Int32x4SelectInstr(Value* mask, | 6405 Int32x4SelectInstr(Value* mask, |
6554 Value* trueValue, | 6406 Value* trueValue, |
6555 Value* falseValue, | 6407 Value* falseValue, |
6556 intptr_t deopt_id) | 6408 intptr_t deopt_id) |
6557 : TemplateDefinition(deopt_id) { | 6409 : TemplateDefinition(deopt_id) { |
6558 SetInputAt(0, mask); | 6410 SetInputAt(0, mask); |
6559 SetInputAt(1, trueValue); | 6411 SetInputAt(1, trueValue); |
6560 SetInputAt(2, falseValue); | 6412 SetInputAt(2, falseValue); |
(...skipping 25 matching lines...) Expand all Loading... |
6586 virtual CompileType ComputeType() const; | 6438 virtual CompileType ComputeType() const; |
6587 | 6439 |
6588 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6440 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6589 | 6441 |
6590 PRINT_OPERANDS_TO_SUPPORT | 6442 PRINT_OPERANDS_TO_SUPPORT |
6591 | 6443 |
6592 private: | 6444 private: |
6593 DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr); | 6445 DISALLOW_COPY_AND_ASSIGN(Int32x4SelectInstr); |
6594 }; | 6446 }; |
6595 | 6447 |
6596 | |
6597 class Int32x4SetFlagInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6448 class Int32x4SetFlagInstr : public TemplateDefinition<2, NoThrow, Pure> { |
6598 public: | 6449 public: |
6599 Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind, | 6450 Int32x4SetFlagInstr(MethodRecognizer::Kind op_kind, |
6600 Value* value, | 6451 Value* value, |
6601 Value* flagValue, | 6452 Value* flagValue, |
6602 intptr_t deopt_id) | 6453 intptr_t deopt_id) |
6603 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6454 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6604 SetInputAt(0, value); | 6455 SetInputAt(0, value); |
6605 SetInputAt(1, flagValue); | 6456 SetInputAt(1, flagValue); |
6606 } | 6457 } |
(...skipping 29 matching lines...) Expand all Loading... |
6636 } | 6487 } |
6637 | 6488 |
6638 PRINT_OPERANDS_TO_SUPPORT | 6489 PRINT_OPERANDS_TO_SUPPORT |
6639 | 6490 |
6640 private: | 6491 private: |
6641 const MethodRecognizer::Kind op_kind_; | 6492 const MethodRecognizer::Kind op_kind_; |
6642 | 6493 |
6643 DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr); | 6494 DISALLOW_COPY_AND_ASSIGN(Int32x4SetFlagInstr); |
6644 }; | 6495 }; |
6645 | 6496 |
6646 | |
6647 class Int32x4ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { | 6497 class Int32x4ToFloat32x4Instr : public TemplateDefinition<1, NoThrow, Pure> { |
6648 public: | 6498 public: |
6649 Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id) | 6499 Int32x4ToFloat32x4Instr(Value* left, intptr_t deopt_id) |
6650 : TemplateDefinition(deopt_id) { | 6500 : TemplateDefinition(deopt_id) { |
6651 SetInputAt(0, left); | 6501 SetInputAt(0, left); |
6652 } | 6502 } |
6653 | 6503 |
6654 Value* left() const { return inputs_[0]; } | 6504 Value* left() const { return inputs_[0]; } |
6655 | 6505 |
6656 virtual bool ComputeCanDeoptimize() const { return false; } | 6506 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6672 virtual CompileType ComputeType() const; | 6522 virtual CompileType ComputeType() const; |
6673 | 6523 |
6674 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6524 virtual bool AttributesEqual(Instruction* other) const { return true; } |
6675 | 6525 |
6676 PRINT_OPERANDS_TO_SUPPORT | 6526 PRINT_OPERANDS_TO_SUPPORT |
6677 | 6527 |
6678 private: | 6528 private: |
6679 DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr); | 6529 DISALLOW_COPY_AND_ASSIGN(Int32x4ToFloat32x4Instr); |
6680 }; | 6530 }; |
6681 | 6531 |
6682 | |
6683 class BinaryInt32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6532 class BinaryInt32x4OpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
6684 public: | 6533 public: |
6685 BinaryInt32x4OpInstr(Token::Kind op_kind, | 6534 BinaryInt32x4OpInstr(Token::Kind op_kind, |
6686 Value* left, | 6535 Value* left, |
6687 Value* right, | 6536 Value* right, |
6688 intptr_t deopt_id) | 6537 intptr_t deopt_id) |
6689 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6538 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6690 SetInputAt(0, left); | 6539 SetInputAt(0, left); |
6691 SetInputAt(1, right); | 6540 SetInputAt(1, right); |
6692 } | 6541 } |
(...skipping 26 matching lines...) Expand all Loading... |
6719 } | 6568 } |
6720 | 6569 |
6721 PRINT_OPERANDS_TO_SUPPORT | 6570 PRINT_OPERANDS_TO_SUPPORT |
6722 | 6571 |
6723 private: | 6572 private: |
6724 const Token::Kind op_kind_; | 6573 const Token::Kind op_kind_; |
6725 | 6574 |
6726 DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr); | 6575 DISALLOW_COPY_AND_ASSIGN(BinaryInt32x4OpInstr); |
6727 }; | 6576 }; |
6728 | 6577 |
6729 | |
6730 class BinaryFloat64x2OpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6578 class BinaryFloat64x2OpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
6731 public: | 6579 public: |
6732 BinaryFloat64x2OpInstr(Token::Kind op_kind, | 6580 BinaryFloat64x2OpInstr(Token::Kind op_kind, |
6733 Value* left, | 6581 Value* left, |
6734 Value* right, | 6582 Value* right, |
6735 intptr_t deopt_id) | 6583 intptr_t deopt_id) |
6736 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6584 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6737 SetInputAt(0, left); | 6585 SetInputAt(0, left); |
6738 SetInputAt(1, right); | 6586 SetInputAt(1, right); |
6739 } | 6587 } |
(...skipping 26 matching lines...) Expand all Loading... |
6766 } | 6614 } |
6767 | 6615 |
6768 PRINT_OPERANDS_TO_SUPPORT | 6616 PRINT_OPERANDS_TO_SUPPORT |
6769 | 6617 |
6770 private: | 6618 private: |
6771 const Token::Kind op_kind_; | 6619 const Token::Kind op_kind_; |
6772 | 6620 |
6773 DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr); | 6621 DISALLOW_COPY_AND_ASSIGN(BinaryFloat64x2OpInstr); |
6774 }; | 6622 }; |
6775 | 6623 |
6776 | |
6777 class UnaryIntegerOpInstr : public TemplateDefinition<1, NoThrow, Pure> { | 6624 class UnaryIntegerOpInstr : public TemplateDefinition<1, NoThrow, Pure> { |
6778 public: | 6625 public: |
6779 UnaryIntegerOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 6626 UnaryIntegerOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
6780 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 6627 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
6781 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT)); | 6628 ASSERT((op_kind == Token::kNEGATE) || (op_kind == Token::kBIT_NOT)); |
6782 SetInputAt(0, value); | 6629 SetInputAt(0, value); |
6783 } | 6630 } |
6784 | 6631 |
6785 static UnaryIntegerOpInstr* Make(Representation representation, | 6632 static UnaryIntegerOpInstr* Make(Representation representation, |
6786 Token::Kind op_kind, | 6633 Token::Kind op_kind, |
(...skipping 17 matching lines...) Expand all Loading... |
6804 PRINT_OPERANDS_TO_SUPPORT | 6651 PRINT_OPERANDS_TO_SUPPORT |
6805 | 6652 |
6806 RawInteger* Evaluate(const Integer& value) const; | 6653 RawInteger* Evaluate(const Integer& value) const; |
6807 | 6654 |
6808 DEFINE_INSTRUCTION_TYPE_CHECK(UnaryIntegerOp) | 6655 DEFINE_INSTRUCTION_TYPE_CHECK(UnaryIntegerOp) |
6809 | 6656 |
6810 private: | 6657 private: |
6811 const Token::Kind op_kind_; | 6658 const Token::Kind op_kind_; |
6812 }; | 6659 }; |
6813 | 6660 |
6814 | |
6815 // Handles both Smi operations: BIT_OR and NEGATE. | 6661 // Handles both Smi operations: BIT_OR and NEGATE. |
6816 class UnarySmiOpInstr : public UnaryIntegerOpInstr { | 6662 class UnarySmiOpInstr : public UnaryIntegerOpInstr { |
6817 public: | 6663 public: |
6818 UnarySmiOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 6664 UnarySmiOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
6819 : UnaryIntegerOpInstr(op_kind, value, deopt_id) {} | 6665 : UnaryIntegerOpInstr(op_kind, value, deopt_id) {} |
6820 | 6666 |
6821 virtual bool ComputeCanDeoptimize() const { | 6667 virtual bool ComputeCanDeoptimize() const { |
6822 return op_kind() == Token::kNEGATE; | 6668 return op_kind() == Token::kNEGATE; |
6823 } | 6669 } |
6824 | 6670 |
6825 virtual CompileType ComputeType() const; | 6671 virtual CompileType ComputeType() const; |
6826 | 6672 |
6827 DECLARE_INSTRUCTION(UnarySmiOp) | 6673 DECLARE_INSTRUCTION(UnarySmiOp) |
6828 | 6674 |
6829 private: | 6675 private: |
6830 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); | 6676 DISALLOW_COPY_AND_ASSIGN(UnarySmiOpInstr); |
6831 }; | 6677 }; |
6832 | 6678 |
6833 | |
6834 class UnaryUint32OpInstr : public UnaryIntegerOpInstr { | 6679 class UnaryUint32OpInstr : public UnaryIntegerOpInstr { |
6835 public: | 6680 public: |
6836 UnaryUint32OpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 6681 UnaryUint32OpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
6837 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { | 6682 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { |
6838 ASSERT(op_kind == Token::kBIT_NOT); | 6683 ASSERT(op_kind == Token::kBIT_NOT); |
6839 } | 6684 } |
6840 | 6685 |
6841 virtual bool ComputeCanDeoptimize() const { return false; } | 6686 virtual bool ComputeCanDeoptimize() const { return false; } |
6842 | 6687 |
6843 virtual CompileType ComputeType() const; | 6688 virtual CompileType ComputeType() const; |
6844 | 6689 |
6845 virtual Representation representation() const { return kUnboxedUint32; } | 6690 virtual Representation representation() const { return kUnboxedUint32; } |
6846 | 6691 |
6847 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 6692 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
6848 ASSERT(idx == 0); | 6693 ASSERT(idx == 0); |
6849 return kUnboxedUint32; | 6694 return kUnboxedUint32; |
6850 } | 6695 } |
6851 | 6696 |
6852 DECLARE_INSTRUCTION(UnaryUint32Op) | 6697 DECLARE_INSTRUCTION(UnaryUint32Op) |
6853 | 6698 |
6854 private: | 6699 private: |
6855 DISALLOW_COPY_AND_ASSIGN(UnaryUint32OpInstr); | 6700 DISALLOW_COPY_AND_ASSIGN(UnaryUint32OpInstr); |
6856 }; | 6701 }; |
6857 | 6702 |
6858 | |
6859 class UnaryMintOpInstr : public UnaryIntegerOpInstr { | 6703 class UnaryMintOpInstr : public UnaryIntegerOpInstr { |
6860 public: | 6704 public: |
6861 UnaryMintOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 6705 UnaryMintOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
6862 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { | 6706 : UnaryIntegerOpInstr(op_kind, value, deopt_id) { |
6863 ASSERT(op_kind == Token::kBIT_NOT); | 6707 ASSERT(op_kind == Token::kBIT_NOT); |
6864 } | 6708 } |
6865 | 6709 |
6866 virtual bool ComputeCanDeoptimize() const { return false; } | 6710 virtual bool ComputeCanDeoptimize() const { return false; } |
6867 | 6711 |
6868 virtual CompileType ComputeType() const; | 6712 virtual CompileType ComputeType() const; |
6869 | 6713 |
6870 virtual Representation representation() const { return kUnboxedMint; } | 6714 virtual Representation representation() const { return kUnboxedMint; } |
6871 | 6715 |
6872 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 6716 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
6873 ASSERT(idx == 0); | 6717 ASSERT(idx == 0); |
6874 return kUnboxedMint; | 6718 return kUnboxedMint; |
6875 } | 6719 } |
6876 | 6720 |
6877 DECLARE_INSTRUCTION(UnaryMintOp) | 6721 DECLARE_INSTRUCTION(UnaryMintOp) |
6878 | 6722 |
6879 private: | 6723 private: |
6880 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); | 6724 DISALLOW_COPY_AND_ASSIGN(UnaryMintOpInstr); |
6881 }; | 6725 }; |
6882 | 6726 |
6883 | |
6884 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { | 6727 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
6885 public: | 6728 public: |
6886 CheckedSmiOpInstr(Token::Kind op_kind, | 6729 CheckedSmiOpInstr(Token::Kind op_kind, |
6887 Value* left, | 6730 Value* left, |
6888 Value* right, | 6731 Value* right, |
6889 InstanceCallInstr* call) | 6732 InstanceCallInstr* call) |
6890 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { | 6733 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { |
6891 ASSERT(call->type_args_len() == 0); | 6734 ASSERT(call->type_args_len() == 0); |
6892 SetInputAt(0, left); | 6735 SetInputAt(0, left); |
6893 SetInputAt(1, right); | 6736 SetInputAt(1, right); |
(...skipping 13 matching lines...) Expand all Loading... |
6907 PRINT_OPERANDS_TO_SUPPORT | 6750 PRINT_OPERANDS_TO_SUPPORT |
6908 | 6751 |
6909 DECLARE_INSTRUCTION(CheckedSmiOp) | 6752 DECLARE_INSTRUCTION(CheckedSmiOp) |
6910 | 6753 |
6911 private: | 6754 private: |
6912 InstanceCallInstr* call_; | 6755 InstanceCallInstr* call_; |
6913 const Token::Kind op_kind_; | 6756 const Token::Kind op_kind_; |
6914 DISALLOW_COPY_AND_ASSIGN(CheckedSmiOpInstr); | 6757 DISALLOW_COPY_AND_ASSIGN(CheckedSmiOpInstr); |
6915 }; | 6758 }; |
6916 | 6759 |
6917 | |
6918 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { | 6760 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { |
6919 public: | 6761 public: |
6920 CheckedSmiComparisonInstr(Token::Kind op_kind, | 6762 CheckedSmiComparisonInstr(Token::Kind op_kind, |
6921 Value* left, | 6763 Value* left, |
6922 Value* right, | 6764 Value* right, |
6923 InstanceCallInstr* call) | 6765 InstanceCallInstr* call) |
6924 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), | 6766 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), |
6925 call_(call), | 6767 call_(call), |
6926 is_negated_(false) { | 6768 is_negated_(false) { |
6927 ASSERT(call->type_args_len() == 0); | 6769 ASSERT(call->type_args_len() == 0); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6962 #endif | 6804 #endif |
6963 | 6805 |
6964 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); | 6806 virtual ComparisonInstr* CopyWithNewOperands(Value* left, Value* right); |
6965 | 6807 |
6966 private: | 6808 private: |
6967 InstanceCallInstr* call_; | 6809 InstanceCallInstr* call_; |
6968 bool is_negated_; | 6810 bool is_negated_; |
6969 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); | 6811 DISALLOW_COPY_AND_ASSIGN(CheckedSmiComparisonInstr); |
6970 }; | 6812 }; |
6971 | 6813 |
6972 | |
6973 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { | 6814 class BinaryIntegerOpInstr : public TemplateDefinition<2, NoThrow, Pure> { |
6974 public: | 6815 public: |
6975 BinaryIntegerOpInstr(Token::Kind op_kind, | 6816 BinaryIntegerOpInstr(Token::Kind op_kind, |
6976 Value* left, | 6817 Value* left, |
6977 Value* right, | 6818 Value* right, |
6978 intptr_t deopt_id) | 6819 intptr_t deopt_id) |
6979 : TemplateDefinition(deopt_id), | 6820 : TemplateDefinition(deopt_id), |
6980 op_kind_(op_kind), | 6821 op_kind_(op_kind), |
6981 can_overflow_(true), | 6822 can_overflow_(true), |
6982 is_truncating_(false) { | 6823 is_truncating_(false) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7014 bool RightIsPowerOfTwoConstant() const; | 6855 bool RightIsPowerOfTwoConstant() const; |
7015 | 6856 |
7016 RawInteger* Evaluate(const Integer& left, const Integer& right) const; | 6857 RawInteger* Evaluate(const Integer& left, const Integer& right) const; |
7017 | 6858 |
7018 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 6859 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
7019 | 6860 |
7020 virtual bool AttributesEqual(Instruction* other) const; | 6861 virtual bool AttributesEqual(Instruction* other) const; |
7021 | 6862 |
7022 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } | 6863 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } |
7023 | 6864 |
7024 | |
7025 PRINT_OPERANDS_TO_SUPPORT | 6865 PRINT_OPERANDS_TO_SUPPORT |
7026 | 6866 |
7027 DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp) | 6867 DEFINE_INSTRUCTION_TYPE_CHECK(BinaryIntegerOp) |
7028 | 6868 |
7029 protected: | 6869 protected: |
7030 void InferRangeHelper(const Range* left_range, | 6870 void InferRangeHelper(const Range* left_range, |
7031 const Range* right_range, | 6871 const Range* right_range, |
7032 Range* range); | 6872 Range* range); |
7033 | 6873 |
7034 private: | 6874 private: |
7035 Definition* CreateConstantResult(FlowGraph* graph, const Integer& result); | 6875 Definition* CreateConstantResult(FlowGraph* graph, const Integer& result); |
7036 | 6876 |
7037 const Token::Kind op_kind_; | 6877 const Token::Kind op_kind_; |
7038 | 6878 |
7039 bool can_overflow_; | 6879 bool can_overflow_; |
7040 bool is_truncating_; | 6880 bool is_truncating_; |
7041 }; | 6881 }; |
7042 | 6882 |
7043 | |
7044 class BinarySmiOpInstr : public BinaryIntegerOpInstr { | 6883 class BinarySmiOpInstr : public BinaryIntegerOpInstr { |
7045 public: | 6884 public: |
7046 BinarySmiOpInstr(Token::Kind op_kind, | 6885 BinarySmiOpInstr(Token::Kind op_kind, |
7047 Value* left, | 6886 Value* left, |
7048 Value* right, | 6887 Value* right, |
7049 intptr_t deopt_id) | 6888 intptr_t deopt_id) |
7050 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id), | 6889 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id), |
7051 right_range_(NULL) {} | 6890 right_range_(NULL) {} |
7052 | 6891 |
7053 virtual bool ComputeCanDeoptimize() const; | 6892 virtual bool ComputeCanDeoptimize() const; |
7054 | 6893 |
7055 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 6894 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
7056 virtual CompileType ComputeType() const; | 6895 virtual CompileType ComputeType() const; |
7057 | 6896 |
7058 DECLARE_INSTRUCTION(BinarySmiOp) | 6897 DECLARE_INSTRUCTION(BinarySmiOp) |
7059 | 6898 |
7060 Range* right_range() const { return right_range_; } | 6899 Range* right_range() const { return right_range_; } |
7061 | 6900 |
7062 private: | 6901 private: |
7063 Range* right_range_; | 6902 Range* right_range_; |
7064 | 6903 |
7065 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); | 6904 DISALLOW_COPY_AND_ASSIGN(BinarySmiOpInstr); |
7066 }; | 6905 }; |
7067 | 6906 |
7068 | |
7069 class BinaryInt32OpInstr : public BinaryIntegerOpInstr { | 6907 class BinaryInt32OpInstr : public BinaryIntegerOpInstr { |
7070 public: | 6908 public: |
7071 BinaryInt32OpInstr(Token::Kind op_kind, | 6909 BinaryInt32OpInstr(Token::Kind op_kind, |
7072 Value* left, | 6910 Value* left, |
7073 Value* right, | 6911 Value* right, |
7074 intptr_t deopt_id) | 6912 intptr_t deopt_id) |
7075 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 6913 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
7076 SetInputAt(0, left); | 6914 SetInputAt(0, left); |
7077 SetInputAt(1, right); | 6915 SetInputAt(1, right); |
7078 } | 6916 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7115 | 6953 |
7116 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 6954 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
7117 virtual CompileType ComputeType() const; | 6955 virtual CompileType ComputeType() const; |
7118 | 6956 |
7119 DECLARE_INSTRUCTION(BinaryInt32Op) | 6957 DECLARE_INSTRUCTION(BinaryInt32Op) |
7120 | 6958 |
7121 private: | 6959 private: |
7122 DISALLOW_COPY_AND_ASSIGN(BinaryInt32OpInstr); | 6960 DISALLOW_COPY_AND_ASSIGN(BinaryInt32OpInstr); |
7123 }; | 6961 }; |
7124 | 6962 |
7125 | |
7126 class BinaryUint32OpInstr : public BinaryIntegerOpInstr { | 6963 class BinaryUint32OpInstr : public BinaryIntegerOpInstr { |
7127 public: | 6964 public: |
7128 BinaryUint32OpInstr(Token::Kind op_kind, | 6965 BinaryUint32OpInstr(Token::Kind op_kind, |
7129 Value* left, | 6966 Value* left, |
7130 Value* right, | 6967 Value* right, |
7131 intptr_t deopt_id) | 6968 intptr_t deopt_id) |
7132 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 6969 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
7133 mark_truncating(); | 6970 mark_truncating(); |
7134 } | 6971 } |
7135 | 6972 |
7136 virtual bool ComputeCanDeoptimize() const { return false; } | 6973 virtual bool ComputeCanDeoptimize() const { return false; } |
7137 | 6974 |
7138 virtual Representation representation() const { return kUnboxedUint32; } | 6975 virtual Representation representation() const { return kUnboxedUint32; } |
7139 | 6976 |
7140 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 6977 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
7141 ASSERT((idx == 0) || (idx == 1)); | 6978 ASSERT((idx == 0) || (idx == 1)); |
7142 return kUnboxedUint32; | 6979 return kUnboxedUint32; |
7143 } | 6980 } |
7144 | 6981 |
7145 virtual CompileType ComputeType() const; | 6982 virtual CompileType ComputeType() const; |
7146 | 6983 |
7147 DECLARE_INSTRUCTION(BinaryUint32Op) | 6984 DECLARE_INSTRUCTION(BinaryUint32Op) |
7148 | 6985 |
7149 private: | 6986 private: |
7150 DISALLOW_COPY_AND_ASSIGN(BinaryUint32OpInstr); | 6987 DISALLOW_COPY_AND_ASSIGN(BinaryUint32OpInstr); |
7151 }; | 6988 }; |
7152 | 6989 |
7153 | |
7154 class ShiftUint32OpInstr : public BinaryIntegerOpInstr { | 6990 class ShiftUint32OpInstr : public BinaryIntegerOpInstr { |
7155 public: | 6991 public: |
7156 ShiftUint32OpInstr(Token::Kind op_kind, | 6992 ShiftUint32OpInstr(Token::Kind op_kind, |
7157 Value* left, | 6993 Value* left, |
7158 Value* right, | 6994 Value* right, |
7159 intptr_t deopt_id) | 6995 intptr_t deopt_id) |
7160 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 6996 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
7161 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); | 6997 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); |
7162 } | 6998 } |
7163 | 6999 |
7164 virtual bool ComputeCanDeoptimize() const { return true; } | 7000 virtual bool ComputeCanDeoptimize() const { return true; } |
7165 | 7001 |
7166 virtual Representation representation() const { return kUnboxedUint32; } | 7002 virtual Representation representation() const { return kUnboxedUint32; } |
7167 | 7003 |
7168 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7004 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
7169 ASSERT((idx == 0) || (idx == 1)); | 7005 ASSERT((idx == 0) || (idx == 1)); |
7170 return (idx == 0) ? kUnboxedUint32 : kTagged; | 7006 return (idx == 0) ? kUnboxedUint32 : kTagged; |
7171 } | 7007 } |
7172 | 7008 |
7173 virtual CompileType ComputeType() const; | 7009 virtual CompileType ComputeType() const; |
7174 | 7010 |
7175 DECLARE_INSTRUCTION(ShiftUint32Op) | 7011 DECLARE_INSTRUCTION(ShiftUint32Op) |
7176 | 7012 |
7177 private: | 7013 private: |
7178 DISALLOW_COPY_AND_ASSIGN(ShiftUint32OpInstr); | 7014 DISALLOW_COPY_AND_ASSIGN(ShiftUint32OpInstr); |
7179 }; | 7015 }; |
7180 | 7016 |
7181 | |
7182 class BinaryMintOpInstr : public BinaryIntegerOpInstr { | 7017 class BinaryMintOpInstr : public BinaryIntegerOpInstr { |
7183 public: | 7018 public: |
7184 BinaryMintOpInstr(Token::Kind op_kind, | 7019 BinaryMintOpInstr(Token::Kind op_kind, |
7185 Value* left, | 7020 Value* left, |
7186 Value* right, | 7021 Value* right, |
7187 intptr_t deopt_id) | 7022 intptr_t deopt_id) |
7188 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { | 7023 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id) { |
7189 if (FLAG_limit_ints_to_64_bits) { | 7024 if (FLAG_limit_ints_to_64_bits) { |
7190 mark_truncating(); | 7025 mark_truncating(); |
7191 } | 7026 } |
(...skipping 27 matching lines...) Expand all Loading... |
7219 | 7054 |
7220 virtual void InferRange(RangeAnalysis* analysis, Range* range); | 7055 virtual void InferRange(RangeAnalysis* analysis, Range* range); |
7221 virtual CompileType ComputeType() const; | 7056 virtual CompileType ComputeType() const; |
7222 | 7057 |
7223 DECLARE_INSTRUCTION(BinaryMintOp) | 7058 DECLARE_INSTRUCTION(BinaryMintOp) |
7224 | 7059 |
7225 private: | 7060 private: |
7226 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); | 7061 DISALLOW_COPY_AND_ASSIGN(BinaryMintOpInstr); |
7227 }; | 7062 }; |
7228 | 7063 |
7229 | |
7230 class ShiftMintOpInstr : public BinaryIntegerOpInstr { | 7064 class ShiftMintOpInstr : public BinaryIntegerOpInstr { |
7231 public: | 7065 public: |
7232 ShiftMintOpInstr(Token::Kind op_kind, | 7066 ShiftMintOpInstr(Token::Kind op_kind, |
7233 Value* left, | 7067 Value* left, |
7234 Value* right, | 7068 Value* right, |
7235 intptr_t deopt_id) | 7069 intptr_t deopt_id) |
7236 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id), | 7070 : BinaryIntegerOpInstr(op_kind, left, right, deopt_id), |
7237 shift_range_(NULL) { | 7071 shift_range_(NULL) { |
7238 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); | 7072 ASSERT((op_kind == Token::kSHR) || (op_kind == Token::kSHL)); |
7239 if (FLAG_limit_ints_to_64_bits) { | 7073 if (FLAG_limit_ints_to_64_bits) { |
(...skipping 25 matching lines...) Expand all Loading... |
7265 | 7099 |
7266 // Returns true if the shift amount is guranteed to be in | 7100 // Returns true if the shift amount is guranteed to be in |
7267 // [0..kMintShiftCountLimit] range. | 7101 // [0..kMintShiftCountLimit] range. |
7268 bool IsShiftCountInRange() const; | 7102 bool IsShiftCountInRange() const; |
7269 | 7103 |
7270 Range* shift_range_; | 7104 Range* shift_range_; |
7271 | 7105 |
7272 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); | 7106 DISALLOW_COPY_AND_ASSIGN(ShiftMintOpInstr); |
7273 }; | 7107 }; |
7274 | 7108 |
7275 | |
7276 // Handles only NEGATE. | 7109 // Handles only NEGATE. |
7277 class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7110 class UnaryDoubleOpInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7278 public: | 7111 public: |
7279 UnaryDoubleOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) | 7112 UnaryDoubleOpInstr(Token::Kind op_kind, Value* value, intptr_t deopt_id) |
7280 : TemplateDefinition(deopt_id), op_kind_(op_kind) { | 7113 : TemplateDefinition(deopt_id), op_kind_(op_kind) { |
7281 ASSERT(op_kind == Token::kNEGATE); | 7114 ASSERT(op_kind == Token::kNEGATE); |
7282 SetInputAt(0, value); | 7115 SetInputAt(0, value); |
7283 } | 7116 } |
7284 | 7117 |
7285 Value* value() const { return inputs_[0]; } | 7118 Value* value() const { return inputs_[0]; } |
(...skipping 20 matching lines...) Expand all Loading... |
7306 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7139 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7307 | 7140 |
7308 PRINT_OPERANDS_TO_SUPPORT | 7141 PRINT_OPERANDS_TO_SUPPORT |
7309 | 7142 |
7310 private: | 7143 private: |
7311 const Token::Kind op_kind_; | 7144 const Token::Kind op_kind_; |
7312 | 7145 |
7313 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); | 7146 DISALLOW_COPY_AND_ASSIGN(UnaryDoubleOpInstr); |
7314 }; | 7147 }; |
7315 | 7148 |
7316 | |
7317 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { | 7149 class CheckStackOverflowInstr : public TemplateInstruction<0, NoThrow> { |
7318 public: | 7150 public: |
7319 enum Kind { | 7151 enum Kind { |
7320 // kOsrAndPreemption stack overflow checks are emitted in both unoptimized | 7152 // kOsrAndPreemption stack overflow checks are emitted in both unoptimized |
7321 // and optimized versions of the code and they serve as both preemption and | 7153 // and optimized versions of the code and they serve as both preemption and |
7322 // OSR entry points. | 7154 // OSR entry points. |
7323 kOsrAndPreemption, | 7155 kOsrAndPreemption, |
7324 | 7156 |
7325 // kOsrOnly stack overflow checks are only needed in the unoptimized code | 7157 // kOsrOnly stack overflow checks are only needed in the unoptimized code |
7326 // because we can't OSR optimized code. | 7158 // because we can't OSR optimized code. |
(...skipping 26 matching lines...) Expand all Loading... |
7353 PRINT_OPERANDS_TO_SUPPORT | 7185 PRINT_OPERANDS_TO_SUPPORT |
7354 | 7186 |
7355 private: | 7187 private: |
7356 const TokenPosition token_pos_; | 7188 const TokenPosition token_pos_; |
7357 const intptr_t loop_depth_; | 7189 const intptr_t loop_depth_; |
7358 const Kind kind_; | 7190 const Kind kind_; |
7359 | 7191 |
7360 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); | 7192 DISALLOW_COPY_AND_ASSIGN(CheckStackOverflowInstr); |
7361 }; | 7193 }; |
7362 | 7194 |
7363 | |
7364 // TODO(vegorov): remove this instruction in favor of Int32ToDouble. | 7195 // TODO(vegorov): remove this instruction in favor of Int32ToDouble. |
7365 class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7196 class SmiToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7366 public: | 7197 public: |
7367 SmiToDoubleInstr(Value* value, TokenPosition token_pos) | 7198 SmiToDoubleInstr(Value* value, TokenPosition token_pos) |
7368 : token_pos_(token_pos) { | 7199 : token_pos_(token_pos) { |
7369 SetInputAt(0, value); | 7200 SetInputAt(0, value); |
7370 } | 7201 } |
7371 | 7202 |
7372 Value* value() const { return inputs_[0]; } | 7203 Value* value() const { return inputs_[0]; } |
7373 virtual TokenPosition token_pos() const { return token_pos_; } | 7204 virtual TokenPosition token_pos() const { return token_pos_; } |
7374 | 7205 |
7375 DECLARE_INSTRUCTION(SmiToDouble) | 7206 DECLARE_INSTRUCTION(SmiToDouble) |
7376 virtual CompileType ComputeType() const; | 7207 virtual CompileType ComputeType() const; |
7377 | 7208 |
7378 virtual Representation representation() const { return kUnboxedDouble; } | 7209 virtual Representation representation() const { return kUnboxedDouble; } |
7379 | 7210 |
7380 virtual bool ComputeCanDeoptimize() const { return false; } | 7211 virtual bool ComputeCanDeoptimize() const { return false; } |
7381 | 7212 |
7382 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7213 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7383 | 7214 |
7384 private: | 7215 private: |
7385 const TokenPosition token_pos_; | 7216 const TokenPosition token_pos_; |
7386 | 7217 |
7387 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); | 7218 DISALLOW_COPY_AND_ASSIGN(SmiToDoubleInstr); |
7388 }; | 7219 }; |
7389 | 7220 |
7390 | |
7391 class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7221 class Int32ToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7392 public: | 7222 public: |
7393 explicit Int32ToDoubleInstr(Value* value) { SetInputAt(0, value); } | 7223 explicit Int32ToDoubleInstr(Value* value) { SetInputAt(0, value); } |
7394 | 7224 |
7395 Value* value() const { return inputs_[0]; } | 7225 Value* value() const { return inputs_[0]; } |
7396 | 7226 |
7397 DECLARE_INSTRUCTION(Int32ToDouble) | 7227 DECLARE_INSTRUCTION(Int32ToDouble) |
7398 virtual CompileType ComputeType() const; | 7228 virtual CompileType ComputeType() const; |
7399 | 7229 |
7400 virtual Representation RequiredInputRepresentation(intptr_t index) const { | 7230 virtual Representation RequiredInputRepresentation(intptr_t index) const { |
7401 ASSERT(index == 0); | 7231 ASSERT(index == 0); |
7402 return kUnboxedInt32; | 7232 return kUnboxedInt32; |
7403 } | 7233 } |
7404 | 7234 |
7405 virtual Representation representation() const { return kUnboxedDouble; } | 7235 virtual Representation representation() const { return kUnboxedDouble; } |
7406 | 7236 |
7407 virtual bool ComputeCanDeoptimize() const { return false; } | 7237 virtual bool ComputeCanDeoptimize() const { return false; } |
7408 | 7238 |
7409 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7239 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7410 | 7240 |
7411 private: | 7241 private: |
7412 DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr); | 7242 DISALLOW_COPY_AND_ASSIGN(Int32ToDoubleInstr); |
7413 }; | 7243 }; |
7414 | 7244 |
7415 | |
7416 class MintToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7245 class MintToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7417 public: | 7246 public: |
7418 MintToDoubleInstr(Value* value, intptr_t deopt_id) | 7247 MintToDoubleInstr(Value* value, intptr_t deopt_id) |
7419 : TemplateDefinition(deopt_id) { | 7248 : TemplateDefinition(deopt_id) { |
7420 SetInputAt(0, value); | 7249 SetInputAt(0, value); |
7421 } | 7250 } |
7422 | 7251 |
7423 Value* value() const { return inputs_[0]; } | 7252 Value* value() const { return inputs_[0]; } |
7424 | 7253 |
7425 DECLARE_INSTRUCTION(MintToDouble) | 7254 DECLARE_INSTRUCTION(MintToDouble) |
(...skipping 12 matching lines...) Expand all Loading... |
7438 return GetDeoptId(); | 7267 return GetDeoptId(); |
7439 } | 7268 } |
7440 | 7269 |
7441 virtual bool ComputeCanDeoptimize() const { return false; } | 7270 virtual bool ComputeCanDeoptimize() const { return false; } |
7442 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7271 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7443 | 7272 |
7444 private: | 7273 private: |
7445 DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr); | 7274 DISALLOW_COPY_AND_ASSIGN(MintToDoubleInstr); |
7446 }; | 7275 }; |
7447 | 7276 |
7448 | |
7449 class DoubleToIntegerInstr : public TemplateDefinition<1, Throws> { | 7277 class DoubleToIntegerInstr : public TemplateDefinition<1, Throws> { |
7450 public: | 7278 public: |
7451 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) | 7279 DoubleToIntegerInstr(Value* value, InstanceCallInstr* instance_call) |
7452 : TemplateDefinition(instance_call->deopt_id()), | 7280 : TemplateDefinition(instance_call->deopt_id()), |
7453 instance_call_(instance_call) { | 7281 instance_call_(instance_call) { |
7454 SetInputAt(0, value); | 7282 SetInputAt(0, value); |
7455 } | 7283 } |
7456 | 7284 |
7457 Value* value() const { return inputs_[0]; } | 7285 Value* value() const { return inputs_[0]; } |
7458 InstanceCallInstr* instance_call() const { return instance_call_; } | 7286 InstanceCallInstr* instance_call() const { return instance_call_; } |
7459 | 7287 |
7460 DECLARE_INSTRUCTION(DoubleToInteger) | 7288 DECLARE_INSTRUCTION(DoubleToInteger) |
7461 virtual CompileType ComputeType() const; | 7289 virtual CompileType ComputeType() const; |
7462 | 7290 |
7463 virtual intptr_t ArgumentCount() const { return 1; } | 7291 virtual intptr_t ArgumentCount() const { return 1; } |
7464 | 7292 |
7465 virtual bool ComputeCanDeoptimize() const { return true; } | 7293 virtual bool ComputeCanDeoptimize() const { return true; } |
7466 | 7294 |
7467 virtual EffectSet Effects() const { return EffectSet::None(); } | 7295 virtual EffectSet Effects() const { return EffectSet::None(); } |
7468 | 7296 |
7469 private: | 7297 private: |
7470 InstanceCallInstr* instance_call_; | 7298 InstanceCallInstr* instance_call_; |
7471 | 7299 |
7472 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); | 7300 DISALLOW_COPY_AND_ASSIGN(DoubleToIntegerInstr); |
7473 }; | 7301 }; |
7474 | 7302 |
7475 | |
7476 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input | 7303 // Similar to 'DoubleToIntegerInstr' but expects unboxed double as input |
7477 // and creates a Smi. | 7304 // and creates a Smi. |
7478 class DoubleToSmiInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7305 class DoubleToSmiInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7479 public: | 7306 public: |
7480 DoubleToSmiInstr(Value* value, intptr_t deopt_id) | 7307 DoubleToSmiInstr(Value* value, intptr_t deopt_id) |
7481 : TemplateDefinition(deopt_id) { | 7308 : TemplateDefinition(deopt_id) { |
7482 SetInputAt(0, value); | 7309 SetInputAt(0, value); |
7483 } | 7310 } |
7484 | 7311 |
7485 Value* value() const { return inputs_[0]; } | 7312 Value* value() const { return inputs_[0]; } |
7486 | 7313 |
7487 DECLARE_INSTRUCTION(DoubleToSmi) | 7314 DECLARE_INSTRUCTION(DoubleToSmi) |
7488 virtual CompileType ComputeType() const; | 7315 virtual CompileType ComputeType() const; |
7489 | 7316 |
7490 virtual bool ComputeCanDeoptimize() const { return true; } | 7317 virtual bool ComputeCanDeoptimize() const { return true; } |
7491 | 7318 |
7492 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 7319 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
7493 ASSERT(idx == 0); | 7320 ASSERT(idx == 0); |
7494 return kUnboxedDouble; | 7321 return kUnboxedDouble; |
7495 } | 7322 } |
7496 | 7323 |
7497 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } | 7324 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } |
7498 | 7325 |
7499 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7326 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7500 | 7327 |
7501 private: | 7328 private: |
7502 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); | 7329 DISALLOW_COPY_AND_ASSIGN(DoubleToSmiInstr); |
7503 }; | 7330 }; |
7504 | 7331 |
7505 | |
7506 class DoubleToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7332 class DoubleToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7507 public: | 7333 public: |
7508 DoubleToDoubleInstr(Value* value, | 7334 DoubleToDoubleInstr(Value* value, |
7509 MethodRecognizer::Kind recognized_kind, | 7335 MethodRecognizer::Kind recognized_kind, |
7510 intptr_t deopt_id) | 7336 intptr_t deopt_id) |
7511 : TemplateDefinition(deopt_id), recognized_kind_(recognized_kind) { | 7337 : TemplateDefinition(deopt_id), recognized_kind_(recognized_kind) { |
7512 SetInputAt(0, value); | 7338 SetInputAt(0, value); |
7513 } | 7339 } |
7514 | 7340 |
7515 Value* value() const { return inputs_[0]; } | 7341 Value* value() const { return inputs_[0]; } |
(...skipping 17 matching lines...) Expand all Loading... |
7533 virtual bool AttributesEqual(Instruction* other) const { | 7359 virtual bool AttributesEqual(Instruction* other) const { |
7534 return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); | 7360 return other->AsDoubleToDouble()->recognized_kind() == recognized_kind(); |
7535 } | 7361 } |
7536 | 7362 |
7537 private: | 7363 private: |
7538 const MethodRecognizer::Kind recognized_kind_; | 7364 const MethodRecognizer::Kind recognized_kind_; |
7539 | 7365 |
7540 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); | 7366 DISALLOW_COPY_AND_ASSIGN(DoubleToDoubleInstr); |
7541 }; | 7367 }; |
7542 | 7368 |
7543 | |
7544 class DoubleToFloatInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7369 class DoubleToFloatInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7545 public: | 7370 public: |
7546 DoubleToFloatInstr(Value* value, intptr_t deopt_id) | 7371 DoubleToFloatInstr(Value* value, intptr_t deopt_id) |
7547 : TemplateDefinition(deopt_id) { | 7372 : TemplateDefinition(deopt_id) { |
7548 SetInputAt(0, value); | 7373 SetInputAt(0, value); |
7549 } | 7374 } |
7550 | 7375 |
7551 Value* value() const { return inputs_[0]; } | 7376 Value* value() const { return inputs_[0]; } |
7552 | 7377 |
7553 DECLARE_INSTRUCTION(DoubleToFloat) | 7378 DECLARE_INSTRUCTION(DoubleToFloat) |
(...skipping 18 matching lines...) Expand all Loading... |
7572 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } | 7397 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } |
7573 | 7398 |
7574 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7399 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7575 | 7400 |
7576 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 7401 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
7577 | 7402 |
7578 private: | 7403 private: |
7579 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr); | 7404 DISALLOW_COPY_AND_ASSIGN(DoubleToFloatInstr); |
7580 }; | 7405 }; |
7581 | 7406 |
7582 | |
7583 class FloatToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7407 class FloatToDoubleInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7584 public: | 7408 public: |
7585 FloatToDoubleInstr(Value* value, intptr_t deopt_id) | 7409 FloatToDoubleInstr(Value* value, intptr_t deopt_id) |
7586 : TemplateDefinition(deopt_id) { | 7410 : TemplateDefinition(deopt_id) { |
7587 SetInputAt(0, value); | 7411 SetInputAt(0, value); |
7588 } | 7412 } |
7589 | 7413 |
7590 Value* value() const { return inputs_[0]; } | 7414 Value* value() const { return inputs_[0]; } |
7591 | 7415 |
7592 DECLARE_INSTRUCTION(FloatToDouble) | 7416 DECLARE_INSTRUCTION(FloatToDouble) |
(...skipping 12 matching lines...) Expand all Loading... |
7605 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } | 7429 virtual intptr_t DeoptimizationTarget() const { return GetDeoptId(); } |
7606 | 7430 |
7607 virtual bool AttributesEqual(Instruction* other) const { return true; } | 7431 virtual bool AttributesEqual(Instruction* other) const { return true; } |
7608 | 7432 |
7609 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 7433 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
7610 | 7434 |
7611 private: | 7435 private: |
7612 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); | 7436 DISALLOW_COPY_AND_ASSIGN(FloatToDoubleInstr); |
7613 }; | 7437 }; |
7614 | 7438 |
7615 | |
7616 class InvokeMathCFunctionInstr : public PureDefinition { | 7439 class InvokeMathCFunctionInstr : public PureDefinition { |
7617 public: | 7440 public: |
7618 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, | 7441 InvokeMathCFunctionInstr(ZoneGrowableArray<Value*>* inputs, |
7619 intptr_t deopt_id, | 7442 intptr_t deopt_id, |
7620 MethodRecognizer::Kind recognized_kind, | 7443 MethodRecognizer::Kind recognized_kind, |
7621 TokenPosition token_pos); | 7444 TokenPosition token_pos); |
7622 | 7445 |
7623 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); | 7446 static intptr_t ArgumentCountFor(MethodRecognizer::Kind recognized_kind_); |
7624 | 7447 |
7625 const RuntimeEntry& TargetFunction() const; | 7448 const RuntimeEntry& TargetFunction() const; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7664 (*inputs_)[i] = value; | 7487 (*inputs_)[i] = value; |
7665 } | 7488 } |
7666 | 7489 |
7667 ZoneGrowableArray<Value*>* inputs_; | 7490 ZoneGrowableArray<Value*>* inputs_; |
7668 const MethodRecognizer::Kind recognized_kind_; | 7491 const MethodRecognizer::Kind recognized_kind_; |
7669 const TokenPosition token_pos_; | 7492 const TokenPosition token_pos_; |
7670 | 7493 |
7671 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); | 7494 DISALLOW_COPY_AND_ASSIGN(InvokeMathCFunctionInstr); |
7672 }; | 7495 }; |
7673 | 7496 |
7674 | |
7675 class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> { | 7497 class ExtractNthOutputInstr : public TemplateDefinition<1, NoThrow, Pure> { |
7676 public: | 7498 public: |
7677 // Extract the Nth output register from value. | 7499 // Extract the Nth output register from value. |
7678 ExtractNthOutputInstr(Value* value, | 7500 ExtractNthOutputInstr(Value* value, |
7679 intptr_t n, | 7501 intptr_t n, |
7680 Representation definition_rep, | 7502 Representation definition_rep, |
7681 intptr_t definition_cid) | 7503 intptr_t definition_cid) |
7682 : index_(n), | 7504 : index_(n), |
7683 definition_rep_(definition_rep), | 7505 definition_rep_(definition_rep), |
7684 definition_cid_(definition_cid) { | 7506 definition_cid_(definition_cid) { |
(...skipping 28 matching lines...) Expand all Loading... |
7713 | 7535 |
7714 PRINT_OPERANDS_TO_SUPPORT | 7536 PRINT_OPERANDS_TO_SUPPORT |
7715 | 7537 |
7716 private: | 7538 private: |
7717 const intptr_t index_; | 7539 const intptr_t index_; |
7718 const Representation definition_rep_; | 7540 const Representation definition_rep_; |
7719 const intptr_t definition_cid_; | 7541 const intptr_t definition_cid_; |
7720 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr); | 7542 DISALLOW_COPY_AND_ASSIGN(ExtractNthOutputInstr); |
7721 }; | 7543 }; |
7722 | 7544 |
7723 | |
7724 class TruncDivModInstr : public TemplateDefinition<2, NoThrow, Pure> { | 7545 class TruncDivModInstr : public TemplateDefinition<2, NoThrow, Pure> { |
7725 public: | 7546 public: |
7726 TruncDivModInstr(Value* lhs, Value* rhs, intptr_t deopt_id); | 7547 TruncDivModInstr(Value* lhs, Value* rhs, intptr_t deopt_id); |
7727 | 7548 |
7728 static intptr_t OutputIndexOf(Token::Kind token); | 7549 static intptr_t OutputIndexOf(Token::Kind token); |
7729 | 7550 |
7730 virtual CompileType ComputeType() const; | 7551 virtual CompileType ComputeType() const; |
7731 | 7552 |
7732 virtual bool ComputeCanDeoptimize() const { return true; } | 7553 virtual bool ComputeCanDeoptimize() const { return true; } |
7733 | 7554 |
(...skipping 21 matching lines...) Expand all Loading... |
7755 // needs to cache range of the divisor in the operation to prevent | 7576 // needs to cache range of the divisor in the operation to prevent |
7756 // bugs when range information gets out of sync with the final decision | 7577 // bugs when range information gets out of sync with the final decision |
7757 // whether some instruction can deoptimize or not made in | 7578 // whether some instruction can deoptimize or not made in |
7758 // EliminateEnvironments(). | 7579 // EliminateEnvironments(). |
7759 return InputAt(1)->definition()->range(); | 7580 return InputAt(1)->definition()->range(); |
7760 } | 7581 } |
7761 | 7582 |
7762 DISALLOW_COPY_AND_ASSIGN(TruncDivModInstr); | 7583 DISALLOW_COPY_AND_ASSIGN(TruncDivModInstr); |
7763 }; | 7584 }; |
7764 | 7585 |
7765 | |
7766 class CheckClassInstr : public TemplateInstruction<1, NoThrow> { | 7586 class CheckClassInstr : public TemplateInstruction<1, NoThrow> { |
7767 public: | 7587 public: |
7768 CheckClassInstr(Value* value, | 7588 CheckClassInstr(Value* value, |
7769 intptr_t deopt_id, | 7589 intptr_t deopt_id, |
7770 const Cids& cids, | 7590 const Cids& cids, |
7771 TokenPosition token_pos); | 7591 TokenPosition token_pos); |
7772 | 7592 |
7773 DECLARE_INSTRUCTION(CheckClass) | 7593 DECLARE_INSTRUCTION(CheckClass) |
7774 | 7594 |
7775 virtual bool ComputeCanDeoptimize() const { return true; } | 7595 virtual bool ComputeCanDeoptimize() const { return true; } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7818 void EmitBitTest(FlowGraphCompiler* compiler, | 7638 void EmitBitTest(FlowGraphCompiler* compiler, |
7819 intptr_t min, | 7639 intptr_t min, |
7820 intptr_t max, | 7640 intptr_t max, |
7821 intptr_t mask, | 7641 intptr_t mask, |
7822 Label* deopt); | 7642 Label* deopt); |
7823 void EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt); | 7643 void EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt); |
7824 | 7644 |
7825 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); | 7645 DISALLOW_COPY_AND_ASSIGN(CheckClassInstr); |
7826 }; | 7646 }; |
7827 | 7647 |
7828 | |
7829 class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> { | 7648 class CheckSmiInstr : public TemplateInstruction<1, NoThrow, Pure> { |
7830 public: | 7649 public: |
7831 CheckSmiInstr(Value* value, intptr_t deopt_id, TokenPosition token_pos) | 7650 CheckSmiInstr(Value* value, intptr_t deopt_id, TokenPosition token_pos) |
7832 : TemplateInstruction(deopt_id), | 7651 : TemplateInstruction(deopt_id), |
7833 token_pos_(token_pos), | 7652 token_pos_(token_pos), |
7834 licm_hoisted_(false) { | 7653 licm_hoisted_(false) { |
7835 SetInputAt(0, value); | 7654 SetInputAt(0, value); |
7836 } | 7655 } |
7837 | 7656 |
7838 Value* value() const { return inputs_[0]; } | 7657 Value* value() const { return inputs_[0]; } |
(...skipping 10 matching lines...) Expand all Loading... |
7849 bool licm_hoisted() const { return licm_hoisted_; } | 7668 bool licm_hoisted() const { return licm_hoisted_; } |
7850 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } | 7669 void set_licm_hoisted(bool value) { licm_hoisted_ = value; } |
7851 | 7670 |
7852 private: | 7671 private: |
7853 const TokenPosition token_pos_; | 7672 const TokenPosition token_pos_; |
7854 bool licm_hoisted_; | 7673 bool licm_hoisted_; |
7855 | 7674 |
7856 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 7675 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
7857 }; | 7676 }; |
7858 | 7677 |
7859 | |
7860 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { | 7678 class CheckClassIdInstr : public TemplateInstruction<1, NoThrow> { |
7861 public: | 7679 public: |
7862 CheckClassIdInstr(Value* value, CidRange cids, intptr_t deopt_id) | 7680 CheckClassIdInstr(Value* value, CidRange cids, intptr_t deopt_id) |
7863 : TemplateInstruction(deopt_id), cids_(cids) { | 7681 : TemplateInstruction(deopt_id), cids_(cids) { |
7864 SetInputAt(0, value); | 7682 SetInputAt(0, value); |
7865 } | 7683 } |
7866 | 7684 |
7867 Value* value() const { return inputs_[0]; } | 7685 Value* value() const { return inputs_[0]; } |
7868 const CidRange& cids() const { return cids_; } | 7686 const CidRange& cids() const { return cids_; } |
7869 | 7687 |
(...skipping 11 matching lines...) Expand all Loading... |
7881 PRINT_OPERANDS_TO_SUPPORT | 7699 PRINT_OPERANDS_TO_SUPPORT |
7882 | 7700 |
7883 private: | 7701 private: |
7884 bool Contains(intptr_t cid) const; | 7702 bool Contains(intptr_t cid) const; |
7885 | 7703 |
7886 CidRange cids_; | 7704 CidRange cids_; |
7887 | 7705 |
7888 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); | 7706 DISALLOW_COPY_AND_ASSIGN(CheckClassIdInstr); |
7889 }; | 7707 }; |
7890 | 7708 |
7891 | |
7892 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { | 7709 class CheckArrayBoundInstr : public TemplateInstruction<2, NoThrow, Pure> { |
7893 public: | 7710 public: |
7894 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) | 7711 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) |
7895 : TemplateInstruction(deopt_id), | 7712 : TemplateInstruction(deopt_id), |
7896 generalized_(false), | 7713 generalized_(false), |
7897 licm_hoisted_(false) { | 7714 licm_hoisted_(false) { |
7898 SetInputAt(kLengthPos, length); | 7715 SetInputAt(kLengthPos, length); |
7899 SetInputAt(kIndexPos, index); | 7716 SetInputAt(kIndexPos, index); |
7900 } | 7717 } |
7901 | 7718 |
(...skipping 22 matching lines...) Expand all Loading... |
7924 // Give a name to the location/input indices. | 7741 // Give a name to the location/input indices. |
7925 enum { kLengthPos = 0, kIndexPos = 1 }; | 7742 enum { kLengthPos = 0, kIndexPos = 1 }; |
7926 | 7743 |
7927 private: | 7744 private: |
7928 bool generalized_; | 7745 bool generalized_; |
7929 bool licm_hoisted_; | 7746 bool licm_hoisted_; |
7930 | 7747 |
7931 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); | 7748 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); |
7932 }; | 7749 }; |
7933 | 7750 |
7934 | |
7935 class GenericCheckBoundInstr : public TemplateInstruction<2, Throws, NoCSE> { | 7751 class GenericCheckBoundInstr : public TemplateInstruction<2, Throws, NoCSE> { |
7936 public: | 7752 public: |
7937 GenericCheckBoundInstr(Value* length, Value* index, intptr_t deopt_id) | 7753 GenericCheckBoundInstr(Value* length, Value* index, intptr_t deopt_id) |
7938 : TemplateInstruction(deopt_id) { | 7754 : TemplateInstruction(deopt_id) { |
7939 SetInputAt(kLengthPos, length); | 7755 SetInputAt(kLengthPos, length); |
7940 SetInputAt(kIndexPos, index); | 7756 SetInputAt(kIndexPos, index); |
7941 } | 7757 } |
7942 | 7758 |
7943 Value* length() const { return inputs_[kLengthPos]; } | 7759 Value* length() const { return inputs_[kLengthPos]; } |
7944 Value* index() const { return inputs_[kIndexPos]; } | 7760 Value* index() const { return inputs_[kIndexPos]; } |
7945 | 7761 |
7946 virtual EffectSet Effects() const { return EffectSet::None(); } | 7762 virtual EffectSet Effects() const { return EffectSet::None(); } |
7947 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 7763 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
7948 | 7764 |
7949 DECLARE_INSTRUCTION(GenericCheckBound) | 7765 DECLARE_INSTRUCTION(GenericCheckBound) |
7950 | 7766 |
7951 virtual bool ComputeCanDeoptimize() const { return true; } | 7767 virtual bool ComputeCanDeoptimize() const { return true; } |
7952 | 7768 |
7953 // Give a name to the location/input indices. | 7769 // Give a name to the location/input indices. |
7954 enum { kLengthPos = 0, kIndexPos = 1 }; | 7770 enum { kLengthPos = 0, kIndexPos = 1 }; |
7955 | 7771 |
7956 private: | 7772 private: |
7957 DISALLOW_COPY_AND_ASSIGN(GenericCheckBoundInstr); | 7773 DISALLOW_COPY_AND_ASSIGN(GenericCheckBoundInstr); |
7958 }; | 7774 }; |
7959 | 7775 |
7960 | |
7961 class UnboxedIntConverterInstr : public TemplateDefinition<1, NoThrow> { | 7776 class UnboxedIntConverterInstr : public TemplateDefinition<1, NoThrow> { |
7962 public: | 7777 public: |
7963 UnboxedIntConverterInstr(Representation from, | 7778 UnboxedIntConverterInstr(Representation from, |
7964 Representation to, | 7779 Representation to, |
7965 Value* value, | 7780 Value* value, |
7966 intptr_t deopt_id) | 7781 intptr_t deopt_id) |
7967 : TemplateDefinition(deopt_id), | 7782 : TemplateDefinition(deopt_id), |
7968 from_representation_(from), | 7783 from_representation_(from), |
7969 to_representation_(to), | 7784 to_representation_(to), |
7970 is_truncating_(to == kUnboxedUint32) { | 7785 is_truncating_(to == kUnboxedUint32) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8016 PRINT_OPERANDS_TO_SUPPORT | 7831 PRINT_OPERANDS_TO_SUPPORT |
8017 | 7832 |
8018 private: | 7833 private: |
8019 const Representation from_representation_; | 7834 const Representation from_representation_; |
8020 const Representation to_representation_; | 7835 const Representation to_representation_; |
8021 bool is_truncating_; | 7836 bool is_truncating_; |
8022 | 7837 |
8023 DISALLOW_COPY_AND_ASSIGN(UnboxedIntConverterInstr); | 7838 DISALLOW_COPY_AND_ASSIGN(UnboxedIntConverterInstr); |
8024 }; | 7839 }; |
8025 | 7840 |
8026 | |
8027 #undef DECLARE_INSTRUCTION | 7841 #undef DECLARE_INSTRUCTION |
8028 | 7842 |
8029 class Environment : public ZoneAllocated { | 7843 class Environment : public ZoneAllocated { |
8030 public: | 7844 public: |
8031 // Iterate the non-NULL values in the innermost level of an environment. | 7845 // Iterate the non-NULL values in the innermost level of an environment. |
8032 class ShallowIterator : public ValueObject { | 7846 class ShallowIterator : public ValueObject { |
8033 public: | 7847 public: |
8034 explicit ShallowIterator(Environment* environment) | 7848 explicit ShallowIterator(Environment* environment) |
8035 : environment_(environment), index_(0) {} | 7849 : environment_(environment), index_(0) {} |
8036 | 7850 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8227 intptr_t deopt_id, | 8041 intptr_t deopt_id, |
8228 const ParsedFunction& parsed_function, | 8042 const ParsedFunction& parsed_function, |
8229 Environment* outer) | 8043 Environment* outer) |
8230 : values_(length), | 8044 : values_(length), |
8231 locations_(NULL), | 8045 locations_(NULL), |
8232 fixed_parameter_count_(fixed_parameter_count), | 8046 fixed_parameter_count_(fixed_parameter_count), |
8233 deopt_id_(deopt_id), | 8047 deopt_id_(deopt_id), |
8234 parsed_function_(parsed_function), | 8048 parsed_function_(parsed_function), |
8235 outer_(outer) {} | 8049 outer_(outer) {} |
8236 | 8050 |
8237 | |
8238 GrowableArray<Value*> values_; | 8051 GrowableArray<Value*> values_; |
8239 Location* locations_; | 8052 Location* locations_; |
8240 const intptr_t fixed_parameter_count_; | 8053 const intptr_t fixed_parameter_count_; |
8241 intptr_t deopt_id_; | 8054 intptr_t deopt_id_; |
8242 const ParsedFunction& parsed_function_; | 8055 const ParsedFunction& parsed_function_; |
8243 Environment* outer_; | 8056 Environment* outer_; |
8244 | 8057 |
8245 DISALLOW_COPY_AND_ASSIGN(Environment); | 8058 DISALLOW_COPY_AND_ASSIGN(Environment); |
8246 }; | 8059 }; |
8247 | 8060 |
8248 | |
8249 // Visitor base class to visit each instruction and computation in a flow | 8061 // Visitor base class to visit each instruction and computation in a flow |
8250 // graph as defined by a reversed list of basic blocks. | 8062 // graph as defined by a reversed list of basic blocks. |
8251 class FlowGraphVisitor : public ValueObject { | 8063 class FlowGraphVisitor : public ValueObject { |
8252 public: | 8064 public: |
8253 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) | 8065 explicit FlowGraphVisitor(const GrowableArray<BlockEntryInstr*>& block_order) |
8254 : current_iterator_(NULL), block_order_(block_order) {} | 8066 : current_iterator_(NULL), block_order_(block_order) {} |
8255 virtual ~FlowGraphVisitor() {} | 8067 virtual ~FlowGraphVisitor() {} |
8256 | 8068 |
8257 ForwardInstructionIterator* current_iterator() const { | 8069 ForwardInstructionIterator* current_iterator() const { |
8258 return current_iterator_; | 8070 return current_iterator_; |
(...skipping 13 matching lines...) Expand all Loading... |
8272 #undef DECLARE_VISIT_INSTRUCTION | 8084 #undef DECLARE_VISIT_INSTRUCTION |
8273 | 8085 |
8274 protected: | 8086 protected: |
8275 ForwardInstructionIterator* current_iterator_; | 8087 ForwardInstructionIterator* current_iterator_; |
8276 | 8088 |
8277 private: | 8089 private: |
8278 const GrowableArray<BlockEntryInstr*>& block_order_; | 8090 const GrowableArray<BlockEntryInstr*>& block_order_; |
8279 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 8091 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
8280 }; | 8092 }; |
8281 | 8093 |
8282 | |
8283 // Helper macros for platform ports. | 8094 // Helper macros for platform ports. |
8284 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ | 8095 #define DEFINE_UNIMPLEMENTED_INSTRUCTION(Name) \ |
8285 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8096 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8286 UNIMPLEMENTED(); \ | 8097 UNIMPLEMENTED(); \ |
8287 return NULL; \ | 8098 return NULL; \ |
8288 } \ | 8099 } \ |
8289 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8100 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8290 | 8101 |
8291 | |
8292 } // namespace dart | 8102 } // namespace dart |
8293 | 8103 |
8294 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8104 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |