| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 | 469 |
| 470 HUseListNode* current_; | 470 HUseListNode* current_; |
| 471 HUseListNode* next_; | 471 HUseListNode* next_; |
| 472 HValue* value_; | 472 HValue* value_; |
| 473 int index_; | 473 int index_; |
| 474 | 474 |
| 475 friend class HValue; | 475 friend class HValue; |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 | 478 |
| 479 // All tracked flags should appear before untracked ones. | 479 // There must be one corresponding kDepends flag for every kChanges flag and |
| 480 // the order of the kChanges flags must be exactly the same as of the kDepends |
| 481 // flags. All tracked flags should appear before untracked ones. |
| 480 enum GVNFlag { | 482 enum GVNFlag { |
| 481 // Declare global value numbering flags. | 483 // Declare global value numbering flags. |
| 482 #define DECLARE_FLAG(Type) k##Type, | 484 #define DECLARE_FLAG(type) kChanges##type, kDependsOn##type, |
| 483 GVN_TRACKED_FLAG_LIST(DECLARE_FLAG) | 485 GVN_TRACKED_FLAG_LIST(DECLARE_FLAG) |
| 484 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) | 486 GVN_UNTRACKED_FLAG_LIST(DECLARE_FLAG) |
| 485 #undef DECLARE_FLAG | 487 #undef DECLARE_FLAG |
| 486 #define COUNT_FLAG(Type) + 1 | 488 kNumberOfFlags, |
| 487 kNumberOfTrackedSideEffects = 0 GVN_TRACKED_FLAG_LIST(COUNT_FLAG), | 489 #define COUNT_FLAG(type) + 1 |
| 488 kNumberOfUntrackedSideEffects = 0 GVN_UNTRACKED_FLAG_LIST(COUNT_FLAG), | 490 kNumberOfTrackedSideEffects = 0 GVN_TRACKED_FLAG_LIST(COUNT_FLAG) |
| 489 #undef COUNT_FLAG | 491 #undef COUNT_FLAG |
| 490 kNumberOfFlags = kNumberOfTrackedSideEffects + kNumberOfUntrackedSideEffects | |
| 491 }; | 492 }; |
| 492 | 493 |
| 493 | 494 |
| 494 static inline GVNFlag GVNFlagFromInt(int i) { | |
| 495 ASSERT(i >= 0); | |
| 496 ASSERT(i < kNumberOfFlags); | |
| 497 return static_cast<GVNFlag>(i); | |
| 498 } | |
| 499 | |
| 500 | |
| 501 class DecompositionResult V8_FINAL BASE_EMBEDDED { | 495 class DecompositionResult V8_FINAL BASE_EMBEDDED { |
| 502 public: | 496 public: |
| 503 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} | 497 DecompositionResult() : base_(NULL), offset_(0), scale_(0) {} |
| 504 | 498 |
| 505 HValue* base() { return base_; } | 499 HValue* base() { return base_; } |
| 506 int offset() { return offset_; } | 500 int offset() { return offset_; } |
| 507 int scale() { return scale_; } | 501 int scale() { return scale_; } |
| 508 | 502 |
| 509 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { | 503 bool Apply(HValue* other_base, int other_offset, int other_scale = 0) { |
| 510 if (base_ == NULL) { | 504 if (base_ == NULL) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 536 *a = *b; | 530 *a = *b; |
| 537 *b = c; | 531 *b = c; |
| 538 } | 532 } |
| 539 | 533 |
| 540 HValue* base_; | 534 HValue* base_; |
| 541 int offset_; | 535 int offset_; |
| 542 int scale_; | 536 int scale_; |
| 543 }; | 537 }; |
| 544 | 538 |
| 545 | 539 |
| 546 typedef EnumSet<GVNFlag, int32_t> GVNFlagSet; | 540 typedef EnumSet<GVNFlag, int64_t> GVNFlagSet; |
| 547 | 541 |
| 548 | 542 |
| 549 class HValue : public ZoneObject { | 543 class HValue : public ZoneObject { |
| 550 public: | 544 public: |
| 551 static const int kNoNumber = -1; | 545 static const int kNoNumber = -1; |
| 552 | 546 |
| 553 enum Flag { | 547 enum Flag { |
| 554 kFlexibleRepresentation, | 548 kFlexibleRepresentation, |
| 555 kCannotBeTagged, | 549 kCannotBeTagged, |
| 556 // Participate in Global Value Numbering, i.e. elimination of | 550 // Participate in Global Value Numbering, i.e. elimination of |
| (...skipping 30 matching lines...) Expand all Loading... |
| 587 // HEnvironmentMarkers are deleted before dead code | 581 // HEnvironmentMarkers are deleted before dead code |
| 588 // elimination takes place, so they can repurpose the kIsLive flag: | 582 // elimination takes place, so they can repurpose the kIsLive flag: |
| 589 kEndsLiveRange = kIsLive, | 583 kEndsLiveRange = kIsLive, |
| 590 | 584 |
| 591 // TODO(everyone): Don't forget to update this! | 585 // TODO(everyone): Don't forget to update this! |
| 592 kLastFlag = kIsLive | 586 kLastFlag = kIsLive |
| 593 }; | 587 }; |
| 594 | 588 |
| 595 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 589 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
| 596 | 590 |
| 591 static const int kChangesToDependsFlagsLeftShift = 1; |
| 592 |
| 593 static GVNFlag ChangesFlagFromInt(int x) { |
| 594 return static_cast<GVNFlag>(x * 2); |
| 595 } |
| 596 static GVNFlag DependsOnFlagFromInt(int x) { |
| 597 return static_cast<GVNFlag>(x * 2 + 1); |
| 598 } |
| 599 static GVNFlagSet ConvertChangesToDependsFlags(GVNFlagSet flags) { |
| 600 return GVNFlagSet(flags.ToIntegral() << kChangesToDependsFlagsLeftShift); |
| 601 } |
| 602 |
| 597 static HValue* cast(HValue* value) { return value; } | 603 static HValue* cast(HValue* value) { return value; } |
| 598 | 604 |
| 599 enum Opcode { | 605 enum Opcode { |
| 600 // Declare a unique enum value for each hydrogen instruction. | 606 // Declare a unique enum value for each hydrogen instruction. |
| 601 #define DECLARE_OPCODE(type) k##type, | 607 #define DECLARE_OPCODE(type) k##type, |
| 602 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) | 608 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) |
| 603 kPhi | 609 kPhi |
| 604 #undef DECLARE_OPCODE | 610 #undef DECLARE_OPCODE |
| 605 }; | 611 }; |
| 606 virtual Opcode opcode() const = 0; | 612 virtual Opcode opcode() const = 0; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 } | 768 } |
| 763 | 769 |
| 764 // Returns true if the flag specified is set for all uses, false otherwise. | 770 // Returns true if the flag specified is set for all uses, false otherwise. |
| 765 bool CheckUsesForFlag(Flag f) const; | 771 bool CheckUsesForFlag(Flag f) const; |
| 766 // Same as before and the first one without the flag is returned in value. | 772 // Same as before and the first one without the flag is returned in value. |
| 767 bool CheckUsesForFlag(Flag f, HValue** value) const; | 773 bool CheckUsesForFlag(Flag f, HValue** value) const; |
| 768 // Returns true if the flag specified is set for all uses, and this set | 774 // Returns true if the flag specified is set for all uses, and this set |
| 769 // of uses is non-empty. | 775 // of uses is non-empty. |
| 770 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) const; | 776 bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) const; |
| 771 | 777 |
| 772 GVNFlagSet ChangesFlags() const { return changes_flags_; } | 778 GVNFlagSet gvn_flags() const { return gvn_flags_; } |
| 773 GVNFlagSet DependsOnFlags() const { return depends_on_flags_; } | 779 void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); } |
| 774 void SetChangesFlag(GVNFlag f) { changes_flags_.Add(f); } | 780 void ClearGVNFlag(GVNFlag f) { gvn_flags_.Remove(f); } |
| 775 void SetDependsOnFlag(GVNFlag f) { depends_on_flags_.Add(f); } | 781 bool CheckGVNFlag(GVNFlag f) const { return gvn_flags_.Contains(f); } |
| 776 void ClearChangesFlag(GVNFlag f) { changes_flags_.Remove(f); } | 782 void SetAllSideEffects() { gvn_flags_.Add(AllSideEffectsFlagSet()); } |
| 777 void ClearDependsOnFlag(GVNFlag f) { depends_on_flags_.Remove(f); } | |
| 778 bool CheckChangesFlag(GVNFlag f) const { | |
| 779 return changes_flags_.Contains(f); | |
| 780 } | |
| 781 bool CheckDependsOnFlag(GVNFlag f) const { | |
| 782 return depends_on_flags_.Contains(f); | |
| 783 } | |
| 784 void SetAllSideEffects() { changes_flags_.Add(AllSideEffectsFlagSet()); } | |
| 785 void ClearAllSideEffects() { | 783 void ClearAllSideEffects() { |
| 786 changes_flags_.Remove(AllSideEffectsFlagSet()); | 784 gvn_flags_.Remove(AllSideEffectsFlagSet()); |
| 787 } | 785 } |
| 788 bool HasSideEffects() const { | 786 bool HasSideEffects() const { |
| 789 return changes_flags_.ContainsAnyOf(AllSideEffectsFlagSet()); | 787 return gvn_flags_.ContainsAnyOf(AllSideEffectsFlagSet()); |
| 790 } | 788 } |
| 791 bool HasObservableSideEffects() const { | 789 bool HasObservableSideEffects() const { |
| 792 return !CheckFlag(kHasNoObservableSideEffects) && | 790 return !CheckFlag(kHasNoObservableSideEffects) && |
| 793 changes_flags_.ContainsAnyOf(AllObservableSideEffectsFlagSet()); | 791 gvn_flags_.ContainsAnyOf(AllObservableSideEffectsFlagSet()); |
| 792 } |
| 793 |
| 794 GVNFlagSet DependsOnFlags() const { |
| 795 GVNFlagSet result = gvn_flags_; |
| 796 result.Intersect(AllDependsOnFlagSet()); |
| 797 return result; |
| 794 } | 798 } |
| 795 | 799 |
| 796 GVNFlagSet SideEffectFlags() const { | 800 GVNFlagSet SideEffectFlags() const { |
| 797 GVNFlagSet result = ChangesFlags(); | 801 GVNFlagSet result = gvn_flags_; |
| 798 result.Intersect(AllSideEffectsFlagSet()); | 802 result.Intersect(AllSideEffectsFlagSet()); |
| 799 return result; | 803 return result; |
| 800 } | 804 } |
| 801 | 805 |
| 806 GVNFlagSet ChangesFlags() const { |
| 807 GVNFlagSet result = gvn_flags_; |
| 808 result.Intersect(AllChangesFlagSet()); |
| 809 return result; |
| 810 } |
| 811 |
| 802 GVNFlagSet ObservableChangesFlags() const { | 812 GVNFlagSet ObservableChangesFlags() const { |
| 803 GVNFlagSet result = ChangesFlags(); | 813 GVNFlagSet result = gvn_flags_; |
| 814 result.Intersect(AllChangesFlagSet()); |
| 804 result.Intersect(AllObservableSideEffectsFlagSet()); | 815 result.Intersect(AllObservableSideEffectsFlagSet()); |
| 805 return result; | 816 return result; |
| 806 } | 817 } |
| 807 | 818 |
| 808 Range* range() const { return range_; } | 819 Range* range() const { return range_; } |
| 809 // TODO(svenpanne) We should really use the null object pattern here. | 820 // TODO(svenpanne) We should really use the null object pattern here. |
| 810 bool HasRange() const { return range_ != NULL; } | 821 bool HasRange() const { return range_ != NULL; } |
| 811 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } | 822 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); } |
| 812 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } | 823 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); } |
| 813 bool RangeCanInclude(int value) const { | 824 bool RangeCanInclude(int value) const { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 void clear_block() { | 945 void clear_block() { |
| 935 ASSERT(block_ != NULL); | 946 ASSERT(block_ != NULL); |
| 936 block_ = NULL; | 947 block_ = NULL; |
| 937 } | 948 } |
| 938 | 949 |
| 939 void set_representation(Representation r) { | 950 void set_representation(Representation r) { |
| 940 ASSERT(representation_.IsNone() && !r.IsNone()); | 951 ASSERT(representation_.IsNone() && !r.IsNone()); |
| 941 representation_ = r; | 952 representation_ = r; |
| 942 } | 953 } |
| 943 | 954 |
| 944 static GVNFlagSet AllFlagSet() { | 955 static GVNFlagSet AllDependsOnFlagSet() { |
| 945 GVNFlagSet result; | 956 GVNFlagSet result; |
| 946 #define ADD_FLAG(Type) result.Add(k##Type); | 957 // Create changes mask. |
| 958 #define ADD_FLAG(type) result.Add(kDependsOn##type); |
| 947 GVN_TRACKED_FLAG_LIST(ADD_FLAG) | 959 GVN_TRACKED_FLAG_LIST(ADD_FLAG) |
| 948 GVN_UNTRACKED_FLAG_LIST(ADD_FLAG) | 960 GVN_UNTRACKED_FLAG_LIST(ADD_FLAG) |
| 949 #undef ADD_FLAG | 961 #undef ADD_FLAG |
| 962 return result; |
| 963 } |
| 964 |
| 965 static GVNFlagSet AllChangesFlagSet() { |
| 966 GVNFlagSet result; |
| 967 // Create changes mask. |
| 968 #define ADD_FLAG(type) result.Add(kChanges##type); |
| 969 GVN_TRACKED_FLAG_LIST(ADD_FLAG) |
| 970 GVN_UNTRACKED_FLAG_LIST(ADD_FLAG) |
| 971 #undef ADD_FLAG |
| 950 return result; | 972 return result; |
| 951 } | 973 } |
| 952 | 974 |
| 953 // A flag mask to mark an instruction as having arbitrary side effects. | 975 // A flag mask to mark an instruction as having arbitrary side effects. |
| 954 static GVNFlagSet AllSideEffectsFlagSet() { | 976 static GVNFlagSet AllSideEffectsFlagSet() { |
| 955 GVNFlagSet result = AllFlagSet(); | 977 GVNFlagSet result = AllChangesFlagSet(); |
| 956 result.Remove(kOsrEntries); | 978 result.Remove(kChangesOsrEntries); |
| 957 return result; | 979 return result; |
| 958 } | 980 } |
| 959 | 981 |
| 960 // A flag mask of all side effects that can make observable changes in | 982 // A flag mask of all side effects that can make observable changes in |
| 961 // an executing program (i.e. are not safe to repeat, move or remove); | 983 // an executing program (i.e. are not safe to repeat, move or remove); |
| 962 static GVNFlagSet AllObservableSideEffectsFlagSet() { | 984 static GVNFlagSet AllObservableSideEffectsFlagSet() { |
| 963 GVNFlagSet result = AllFlagSet(); | 985 GVNFlagSet result = AllChangesFlagSet(); |
| 964 result.Remove(kNewSpacePromotion); | 986 result.Remove(kChangesNewSpacePromotion); |
| 965 result.Remove(kElementsKind); | 987 result.Remove(kChangesElementsKind); |
| 966 result.Remove(kElementsPointer); | 988 result.Remove(kChangesElementsPointer); |
| 967 result.Remove(kMaps); | 989 result.Remove(kChangesMaps); |
| 968 return result; | 990 return result; |
| 969 } | 991 } |
| 970 | 992 |
| 971 // Remove the matching use from the use list if present. Returns the | 993 // Remove the matching use from the use list if present. Returns the |
| 972 // removed list node or NULL. | 994 // removed list node or NULL. |
| 973 HUseListNode* RemoveUse(HValue* value, int index); | 995 HUseListNode* RemoveUse(HValue* value, int index); |
| 974 | 996 |
| 975 void RegisterUse(int index, HValue* new_value); | 997 void RegisterUse(int index, HValue* new_value); |
| 976 | 998 |
| 977 HBasicBlock* block_; | 999 HBasicBlock* block_; |
| 978 | 1000 |
| 979 // The id of this instruction in the hydrogen graph, assigned when first | 1001 // The id of this instruction in the hydrogen graph, assigned when first |
| 980 // added to the graph. Reflects creation order. | 1002 // added to the graph. Reflects creation order. |
| 981 int id_; | 1003 int id_; |
| 982 | 1004 |
| 983 Representation representation_; | 1005 Representation representation_; |
| 984 HType type_; | 1006 HType type_; |
| 985 HUseListNode* use_list_; | 1007 HUseListNode* use_list_; |
| 986 Range* range_; | 1008 Range* range_; |
| 987 int flags_; | 1009 int flags_; |
| 988 GVNFlagSet changes_flags_; | 1010 GVNFlagSet gvn_flags_; |
| 989 GVNFlagSet depends_on_flags_; | |
| 990 | 1011 |
| 991 private: | 1012 private: |
| 992 virtual bool IsDeletable() const { return false; } | 1013 virtual bool IsDeletable() const { return false; } |
| 993 | 1014 |
| 994 DISALLOW_COPY_AND_ASSIGN(HValue); | 1015 DISALLOW_COPY_AND_ASSIGN(HValue); |
| 995 }; | 1016 }; |
| 996 | 1017 |
| 997 | 1018 |
| 998 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ | 1019 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ |
| 999 static I* New(Zone* zone, HValue* context) { \ | 1020 static I* New(Zone* zone, HValue* context) { \ |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 virtual bool HasStackCheck() { return false; } | 1254 virtual bool HasStackCheck() { return false; } |
| 1234 | 1255 |
| 1235 DECLARE_ABSTRACT_INSTRUCTION(Instruction) | 1256 DECLARE_ABSTRACT_INSTRUCTION(Instruction) |
| 1236 | 1257 |
| 1237 protected: | 1258 protected: |
| 1238 HInstruction(HType type = HType::Tagged()) | 1259 HInstruction(HType type = HType::Tagged()) |
| 1239 : HValue(type), | 1260 : HValue(type), |
| 1240 next_(NULL), | 1261 next_(NULL), |
| 1241 previous_(NULL), | 1262 previous_(NULL), |
| 1242 position_(RelocInfo::kNoPosition) { | 1263 position_(RelocInfo::kNoPosition) { |
| 1243 SetDependsOnFlag(kOsrEntries); | 1264 SetGVNFlag(kDependsOnOsrEntries); |
| 1244 } | 1265 } |
| 1245 | 1266 |
| 1246 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } | 1267 virtual void DeleteFromGraph() V8_OVERRIDE { Unlink(); } |
| 1247 | 1268 |
| 1248 private: | 1269 private: |
| 1249 void InitializeAsFirst(HBasicBlock* block) { | 1270 void InitializeAsFirst(HBasicBlock* block) { |
| 1250 ASSERT(!IsLinked()); | 1271 ASSERT(!IsLinked()); |
| 1251 SetBlock(block); | 1272 SetBlock(block); |
| 1252 } | 1273 } |
| 1253 | 1274 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1693 SetFlag(kUseGVN); | 1714 SetFlag(kUseGVN); |
| 1694 if (is_truncating_to_smi) { | 1715 if (is_truncating_to_smi) { |
| 1695 SetFlag(kTruncatingToSmi); | 1716 SetFlag(kTruncatingToSmi); |
| 1696 SetFlag(kTruncatingToInt32); | 1717 SetFlag(kTruncatingToInt32); |
| 1697 } | 1718 } |
| 1698 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); | 1719 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
| 1699 if (value->representation().IsSmi() || value->type().IsSmi()) { | 1720 if (value->representation().IsSmi() || value->type().IsSmi()) { |
| 1700 set_type(HType::Smi()); | 1721 set_type(HType::Smi()); |
| 1701 } else { | 1722 } else { |
| 1702 set_type(HType::TaggedNumber()); | 1723 set_type(HType::TaggedNumber()); |
| 1703 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 1724 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
| 1704 } | 1725 } |
| 1705 } | 1726 } |
| 1706 | 1727 |
| 1707 bool can_convert_undefined_to_nan() { | 1728 bool can_convert_undefined_to_nan() { |
| 1708 return CheckUsesForFlag(kAllowUndefinedAsNaN); | 1729 return CheckUsesForFlag(kAllowUndefinedAsNaN); |
| 1709 } | 1730 } |
| 1710 | 1731 |
| 1711 virtual HValue* EnsureAndPropagateNotMinusZero( | 1732 virtual HValue* EnsureAndPropagateNotMinusZero( |
| 1712 BitVector* visited) V8_OVERRIDE; | 1733 BitVector* visited) V8_OVERRIDE; |
| 1713 virtual HType CalculateInferredType() V8_OVERRIDE; | 1734 virtual HType CalculateInferredType() V8_OVERRIDE; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 } | 1960 } |
| 1940 | 1961 |
| 1941 bool is_function_entry() { return type_ == kFunctionEntry; } | 1962 bool is_function_entry() { return type_ == kFunctionEntry; } |
| 1942 bool is_backwards_branch() { return type_ == kBackwardsBranch; } | 1963 bool is_backwards_branch() { return type_ == kBackwardsBranch; } |
| 1943 | 1964 |
| 1944 DECLARE_CONCRETE_INSTRUCTION(StackCheck) | 1965 DECLARE_CONCRETE_INSTRUCTION(StackCheck) |
| 1945 | 1966 |
| 1946 private: | 1967 private: |
| 1947 HStackCheck(HValue* context, Type type) : type_(type) { | 1968 HStackCheck(HValue* context, Type type) : type_(type) { |
| 1948 SetOperandAt(0, context); | 1969 SetOperandAt(0, context); |
| 1949 SetChangesFlag(kNewSpacePromotion); | 1970 SetGVNFlag(kChangesNewSpacePromotion); |
| 1950 } | 1971 } |
| 1951 | 1972 |
| 1952 Type type_; | 1973 Type type_; |
| 1953 }; | 1974 }; |
| 1954 | 1975 |
| 1955 | 1976 |
| 1956 enum InliningKind { | 1977 enum InliningKind { |
| 1957 NORMAL_RETURN, // Drop the function from the environment on return. | 1978 NORMAL_RETURN, // Drop the function from the environment on return. |
| 1958 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. | 1979 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. |
| 1959 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. | 1980 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) | 2508 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) |
| 2488 | 2509 |
| 2489 protected: | 2510 protected: |
| 2490 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 2511 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 2491 | 2512 |
| 2492 private: | 2513 private: |
| 2493 explicit HMapEnumLength(HValue* value) | 2514 explicit HMapEnumLength(HValue* value) |
| 2494 : HUnaryOperation(value, HType::Smi()) { | 2515 : HUnaryOperation(value, HType::Smi()) { |
| 2495 set_representation(Representation::Smi()); | 2516 set_representation(Representation::Smi()); |
| 2496 SetFlag(kUseGVN); | 2517 SetFlag(kUseGVN); |
| 2497 SetDependsOnFlag(kMaps); | 2518 SetGVNFlag(kDependsOnMaps); |
| 2498 } | 2519 } |
| 2499 | 2520 |
| 2500 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2521 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 2501 }; | 2522 }; |
| 2502 | 2523 |
| 2503 | 2524 |
| 2504 class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { | 2525 class HUnaryMathOperation V8_FINAL : public HTemplateInstruction<2> { |
| 2505 public: | 2526 public: |
| 2506 static HInstruction* New(Zone* zone, | 2527 static HInstruction* New(Zone* zone, |
| 2507 HValue* context, | 2528 HValue* context, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2561 switch (op) { | 2582 switch (op) { |
| 2562 case kMathFloor: | 2583 case kMathFloor: |
| 2563 case kMathRound: | 2584 case kMathRound: |
| 2564 set_representation(Representation::Integer32()); | 2585 set_representation(Representation::Integer32()); |
| 2565 break; | 2586 break; |
| 2566 case kMathAbs: | 2587 case kMathAbs: |
| 2567 // Not setting representation here: it is None intentionally. | 2588 // Not setting representation here: it is None intentionally. |
| 2568 SetFlag(kFlexibleRepresentation); | 2589 SetFlag(kFlexibleRepresentation); |
| 2569 // TODO(svenpanne) This flag is actually only needed if representation() | 2590 // TODO(svenpanne) This flag is actually only needed if representation() |
| 2570 // is tagged, and not when it is an unboxed double or unboxed integer. | 2591 // is tagged, and not when it is an unboxed double or unboxed integer. |
| 2571 SetChangesFlag(kNewSpacePromotion); | 2592 SetGVNFlag(kChangesNewSpacePromotion); |
| 2572 break; | 2593 break; |
| 2573 case kMathLog: | 2594 case kMathLog: |
| 2574 case kMathExp: | 2595 case kMathExp: |
| 2575 case kMathSqrt: | 2596 case kMathSqrt: |
| 2576 case kMathPowHalf: | 2597 case kMathPowHalf: |
| 2577 set_representation(Representation::Double()); | 2598 set_representation(Representation::Double()); |
| 2578 break; | 2599 break; |
| 2579 default: | 2600 default: |
| 2580 UNREACHABLE(); | 2601 UNREACHABLE(); |
| 2581 } | 2602 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2610 HLoadRoot* b = HLoadRoot::cast(other); | 2631 HLoadRoot* b = HLoadRoot::cast(other); |
| 2611 return index_ == b->index_; | 2632 return index_ == b->index_; |
| 2612 } | 2633 } |
| 2613 | 2634 |
| 2614 private: | 2635 private: |
| 2615 HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) | 2636 HLoadRoot(Heap::RootListIndex index, HType type = HType::Tagged()) |
| 2616 : HTemplateInstruction<0>(type), index_(index) { | 2637 : HTemplateInstruction<0>(type), index_(index) { |
| 2617 SetFlag(kUseGVN); | 2638 SetFlag(kUseGVN); |
| 2618 // TODO(bmeurer): We'll need kDependsOnRoots once we add the | 2639 // TODO(bmeurer): We'll need kDependsOnRoots once we add the |
| 2619 // corresponding HStoreRoot instruction. | 2640 // corresponding HStoreRoot instruction. |
| 2620 SetDependsOnFlag(kCalls); | 2641 SetGVNFlag(kDependsOnCalls); |
| 2621 } | 2642 } |
| 2622 | 2643 |
| 2623 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 2644 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 2624 | 2645 |
| 2625 const Heap::RootListIndex index_; | 2646 const Heap::RootListIndex index_; |
| 2626 }; | 2647 }; |
| 2627 | 2648 |
| 2628 | 2649 |
| 2629 class HCheckMaps V8_FINAL : public HTemplateInstruction<2> { | 2650 class HCheckMaps V8_FINAL : public HTemplateInstruction<2> { |
| 2630 public: | 2651 public: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 return this->map_set_.Equals(&HCheckMaps::cast(other)->map_set_); | 2696 return this->map_set_.Equals(&HCheckMaps::cast(other)->map_set_); |
| 2676 } | 2697 } |
| 2677 | 2698 |
| 2678 virtual int RedefinedOperandIndex() { return 0; } | 2699 virtual int RedefinedOperandIndex() { return 0; } |
| 2679 | 2700 |
| 2680 private: | 2701 private: |
| 2681 void Add(Handle<Map> map, Zone* zone) { | 2702 void Add(Handle<Map> map, Zone* zone) { |
| 2682 map_set_.Add(Unique<Map>(map), zone); | 2703 map_set_.Add(Unique<Map>(map), zone); |
| 2683 if (!has_migration_target_ && map->is_migration_target()) { | 2704 if (!has_migration_target_ && map->is_migration_target()) { |
| 2684 has_migration_target_ = true; | 2705 has_migration_target_ = true; |
| 2685 SetChangesFlag(kNewSpacePromotion); | 2706 SetGVNFlag(kChangesNewSpacePromotion); |
| 2686 } | 2707 } |
| 2687 } | 2708 } |
| 2688 | 2709 |
| 2689 // Clients should use one of the static New* methods above. | 2710 // Clients should use one of the static New* methods above. |
| 2690 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) | 2711 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) |
| 2691 : HTemplateInstruction<2>(value->type()), | 2712 : HTemplateInstruction<2>(value->type()), |
| 2692 omit_(false), has_migration_target_(false) { | 2713 omit_(false), has_migration_target_(false) { |
| 2693 SetOperandAt(0, value); | 2714 SetOperandAt(0, value); |
| 2694 // Use the object value for the dependency if NULL is passed. | 2715 // Use the object value for the dependency if NULL is passed. |
| 2695 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2716 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
| 2696 set_representation(Representation::Tagged()); | 2717 set_representation(Representation::Tagged()); |
| 2697 SetFlag(kUseGVN); | 2718 SetFlag(kUseGVN); |
| 2698 SetFlag(kTrackSideEffectDominators); | 2719 SetFlag(kTrackSideEffectDominators); |
| 2699 SetDependsOnFlag(kMaps); | 2720 SetGVNFlag(kDependsOnMaps); |
| 2700 SetDependsOnFlag(kElementsKind); | 2721 SetGVNFlag(kDependsOnElementsKind); |
| 2701 } | 2722 } |
| 2702 | 2723 |
| 2703 bool omit_; | 2724 bool omit_; |
| 2704 bool has_migration_target_; | 2725 bool has_migration_target_; |
| 2705 UniqueSet<Map> map_set_; | 2726 UniqueSet<Map> map_set_; |
| 2706 }; | 2727 }; |
| 2707 | 2728 |
| 2708 | 2729 |
| 2709 class HCheckValue V8_FINAL : public HUnaryOperation { | 2730 class HCheckValue V8_FINAL : public HUnaryOperation { |
| 2710 public: | 2731 public: |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3294 const ZoneList<HValue*>* values() const { return &values_; } | 3315 const ZoneList<HValue*>* values() const { return &values_; } |
| 3295 int length() const { return values_.length(); } | 3316 int length() const { return values_.length(); } |
| 3296 int capture_id() const { return capture_id_; } | 3317 int capture_id() const { return capture_id_; } |
| 3297 | 3318 |
| 3298 // Shortcut for the map value of this captured object. | 3319 // Shortcut for the map value of this captured object. |
| 3299 HValue* map_value() const { return values()->first(); } | 3320 HValue* map_value() const { return values()->first(); } |
| 3300 | 3321 |
| 3301 void ReuseSideEffectsFromStore(HInstruction* store) { | 3322 void ReuseSideEffectsFromStore(HInstruction* store) { |
| 3302 ASSERT(store->HasObservableSideEffects()); | 3323 ASSERT(store->HasObservableSideEffects()); |
| 3303 ASSERT(store->IsStoreNamedField()); | 3324 ASSERT(store->IsStoreNamedField()); |
| 3304 changes_flags_.Add(store->ChangesFlags()); | 3325 gvn_flags_.Add(store->gvn_flags()); |
| 3305 } | 3326 } |
| 3306 | 3327 |
| 3307 // Replay effects of this instruction on the given environment. | 3328 // Replay effects of this instruction on the given environment. |
| 3308 void ReplayEnvironment(HEnvironment* env); | 3329 void ReplayEnvironment(HEnvironment* env); |
| 3309 | 3330 |
| 3310 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 3331 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 3311 | 3332 |
| 3312 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) | 3333 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) |
| 3313 | 3334 |
| 3314 private: | 3335 private: |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3927 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, | 3948 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, |
| 3928 HType type = HType::Tagged()) | 3949 HType type = HType::Tagged()) |
| 3929 : HBinaryOperation(context, left, right, type) { | 3950 : HBinaryOperation(context, left, right, type) { |
| 3930 SetFlag(kFlexibleRepresentation); | 3951 SetFlag(kFlexibleRepresentation); |
| 3931 SetFlag(kTruncatingToInt32); | 3952 SetFlag(kTruncatingToInt32); |
| 3932 SetFlag(kAllowUndefinedAsNaN); | 3953 SetFlag(kAllowUndefinedAsNaN); |
| 3933 SetAllSideEffects(); | 3954 SetAllSideEffects(); |
| 3934 } | 3955 } |
| 3935 | 3956 |
| 3936 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 3957 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { |
| 3937 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 3958 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
| 3938 if (to.IsTagged() && | 3959 if (to.IsTagged() && |
| 3939 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 3960 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 3940 SetAllSideEffects(); | 3961 SetAllSideEffects(); |
| 3941 ClearFlag(kUseGVN); | 3962 ClearFlag(kUseGVN); |
| 3942 } else { | 3963 } else { |
| 3943 ClearAllSideEffects(); | 3964 ClearAllSideEffects(); |
| 3944 SetFlag(kUseGVN); | 3965 SetFlag(kUseGVN); |
| 3945 } | 3966 } |
| 3946 } | 3967 } |
| 3947 | 3968 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4004 class HArithmeticBinaryOperation : public HBinaryOperation { | 4025 class HArithmeticBinaryOperation : public HBinaryOperation { |
| 4005 public: | 4026 public: |
| 4006 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 4027 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
| 4007 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { | 4028 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { |
| 4008 SetAllSideEffects(); | 4029 SetAllSideEffects(); |
| 4009 SetFlag(kFlexibleRepresentation); | 4030 SetFlag(kFlexibleRepresentation); |
| 4010 SetFlag(kAllowUndefinedAsNaN); | 4031 SetFlag(kAllowUndefinedAsNaN); |
| 4011 } | 4032 } |
| 4012 | 4033 |
| 4013 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 4034 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { |
| 4014 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); | 4035 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); |
| 4015 if (to.IsTagged() && | 4036 if (to.IsTagged() && |
| 4016 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { | 4037 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { |
| 4017 SetAllSideEffects(); | 4038 SetAllSideEffects(); |
| 4018 ClearFlag(kUseGVN); | 4039 ClearFlag(kUseGVN); |
| 4019 } else { | 4040 } else { |
| 4020 ClearAllSideEffects(); | 4041 ClearAllSideEffects(); |
| 4021 SetFlag(kUseGVN); | 4042 SetFlag(kUseGVN); |
| 4022 } | 4043 } |
| 4023 } | 4044 } |
| 4024 | 4045 |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4329 HStringCompareAndBranch(HValue* context, | 4350 HStringCompareAndBranch(HValue* context, |
| 4330 HValue* left, | 4351 HValue* left, |
| 4331 HValue* right, | 4352 HValue* right, |
| 4332 Token::Value token) | 4353 Token::Value token) |
| 4333 : token_(token) { | 4354 : token_(token) { |
| 4334 ASSERT(Token::IsCompareOp(token)); | 4355 ASSERT(Token::IsCompareOp(token)); |
| 4335 SetOperandAt(0, context); | 4356 SetOperandAt(0, context); |
| 4336 SetOperandAt(1, left); | 4357 SetOperandAt(1, left); |
| 4337 SetOperandAt(2, right); | 4358 SetOperandAt(2, right); |
| 4338 set_representation(Representation::Tagged()); | 4359 set_representation(Representation::Tagged()); |
| 4339 SetChangesFlag(kNewSpacePromotion); | 4360 SetGVNFlag(kChangesNewSpacePromotion); |
| 4340 } | 4361 } |
| 4341 | 4362 |
| 4342 Token::Value token_; | 4363 Token::Value token_; |
| 4343 }; | 4364 }; |
| 4344 | 4365 |
| 4345 | 4366 |
| 4346 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { | 4367 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { |
| 4347 public: | 4368 public: |
| 4348 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); | 4369 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); |
| 4349 | 4370 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4554 | 4575 |
| 4555 protected: | 4576 protected: |
| 4556 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 4577 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 4557 | 4578 |
| 4558 private: | 4579 private: |
| 4559 HPower(HValue* left, HValue* right) { | 4580 HPower(HValue* left, HValue* right) { |
| 4560 SetOperandAt(0, left); | 4581 SetOperandAt(0, left); |
| 4561 SetOperandAt(1, right); | 4582 SetOperandAt(1, right); |
| 4562 set_representation(Representation::Double()); | 4583 set_representation(Representation::Double()); |
| 4563 SetFlag(kUseGVN); | 4584 SetFlag(kUseGVN); |
| 4564 SetChangesFlag(kNewSpacePromotion); | 4585 SetGVNFlag(kChangesNewSpacePromotion); |
| 4565 } | 4586 } |
| 4566 | 4587 |
| 4567 virtual bool IsDeletable() const V8_OVERRIDE { | 4588 virtual bool IsDeletable() const V8_OVERRIDE { |
| 4568 return !right()->representation().IsTagged(); | 4589 return !right()->representation().IsTagged(); |
| 4569 } | 4590 } |
| 4570 }; | 4591 }; |
| 4571 | 4592 |
| 4572 | 4593 |
| 4573 class HAdd V8_FINAL : public HArithmeticBinaryOperation { | 4594 class HAdd V8_FINAL : public HArithmeticBinaryOperation { |
| 4574 public: | 4595 public: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 4596 } else if (right()->IsInteger32Constant()) { | 4617 } else if (right()->IsInteger32Constant()) { |
| 4597 decomposition->Apply(left(), right()->GetInteger32Constant()); | 4618 decomposition->Apply(left(), right()->GetInteger32Constant()); |
| 4598 return true; | 4619 return true; |
| 4599 } else { | 4620 } else { |
| 4600 return false; | 4621 return false; |
| 4601 } | 4622 } |
| 4602 } | 4623 } |
| 4603 | 4624 |
| 4604 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { | 4625 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { |
| 4605 if (to.IsTagged()) { | 4626 if (to.IsTagged()) { |
| 4606 SetChangesFlag(kNewSpacePromotion); | 4627 SetGVNFlag(kChangesNewSpacePromotion); |
| 4607 ClearFlag(kAllowUndefinedAsNaN); | 4628 ClearFlag(kAllowUndefinedAsNaN); |
| 4608 } | 4629 } |
| 4609 if (to.IsTagged() && | 4630 if (to.IsTagged() && |
| 4610 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || | 4631 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || |
| 4611 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { | 4632 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { |
| 4612 SetAllSideEffects(); | 4633 SetAllSideEffects(); |
| 4613 ClearFlag(kUseGVN); | 4634 ClearFlag(kUseGVN); |
| 4614 } else { | 4635 } else { |
| 4615 ClearAllSideEffects(); | 4636 ClearAllSideEffects(); |
| 4616 SetFlag(kUseGVN); | 4637 SetFlag(kUseGVN); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5053 BailoutId ast_id() const { return ast_id_; } | 5074 BailoutId ast_id() const { return ast_id_; } |
| 5054 | 5075 |
| 5055 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 5076 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 5056 return Representation::None(); | 5077 return Representation::None(); |
| 5057 } | 5078 } |
| 5058 | 5079 |
| 5059 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 5080 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
| 5060 | 5081 |
| 5061 private: | 5082 private: |
| 5062 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | 5083 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { |
| 5063 SetChangesFlag(kOsrEntries); | 5084 SetGVNFlag(kChangesOsrEntries); |
| 5064 SetChangesFlag(kNewSpacePromotion); | 5085 SetGVNFlag(kChangesNewSpacePromotion); |
| 5065 } | 5086 } |
| 5066 | 5087 |
| 5067 BailoutId ast_id_; | 5088 BailoutId ast_id_; |
| 5068 }; | 5089 }; |
| 5069 | 5090 |
| 5070 | 5091 |
| 5071 class HParameter V8_FINAL : public HTemplateInstruction<0> { | 5092 class HParameter V8_FINAL : public HTemplateInstruction<0> { |
| 5072 public: | 5093 public: |
| 5073 enum ParameterKind { | 5094 enum ParameterKind { |
| 5074 STACK_PARAMETER, | 5095 STACK_PARAMETER, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5196 protected: | 5217 protected: |
| 5197 virtual bool DataEquals(HValue* other) V8_OVERRIDE { | 5218 virtual bool DataEquals(HValue* other) V8_OVERRIDE { |
| 5198 return cell_ == HLoadGlobalCell::cast(other)->cell_; | 5219 return cell_ == HLoadGlobalCell::cast(other)->cell_; |
| 5199 } | 5220 } |
| 5200 | 5221 |
| 5201 private: | 5222 private: |
| 5202 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) | 5223 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) |
| 5203 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { | 5224 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { |
| 5204 set_representation(Representation::Tagged()); | 5225 set_representation(Representation::Tagged()); |
| 5205 SetFlag(kUseGVN); | 5226 SetFlag(kUseGVN); |
| 5206 SetDependsOnFlag(kGlobalVars); | 5227 SetGVNFlag(kDependsOnGlobalVars); |
| 5207 } | 5228 } |
| 5208 | 5229 |
| 5209 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } | 5230 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } |
| 5210 | 5231 |
| 5211 Unique<Cell> cell_; | 5232 Unique<Cell> cell_; |
| 5212 PropertyDetails details_; | 5233 PropertyDetails details_; |
| 5213 }; | 5234 }; |
| 5214 | 5235 |
| 5215 | 5236 |
| 5216 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { | 5237 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5348 Handle<AllocationSite> allocation_site = | 5369 Handle<AllocationSite> allocation_site = |
| 5349 Handle<AllocationSite>::null()) | 5370 Handle<AllocationSite>::null()) |
| 5350 : HTemplateInstruction<2>(type), | 5371 : HTemplateInstruction<2>(type), |
| 5351 flags_(ComputeFlags(pretenure_flag, instance_type)), | 5372 flags_(ComputeFlags(pretenure_flag, instance_type)), |
| 5352 dominating_allocate_(NULL), | 5373 dominating_allocate_(NULL), |
| 5353 filler_free_space_size_(NULL) { | 5374 filler_free_space_size_(NULL) { |
| 5354 SetOperandAt(0, context); | 5375 SetOperandAt(0, context); |
| 5355 SetOperandAt(1, size); | 5376 SetOperandAt(1, size); |
| 5356 set_representation(Representation::Tagged()); | 5377 set_representation(Representation::Tagged()); |
| 5357 SetFlag(kTrackSideEffectDominators); | 5378 SetFlag(kTrackSideEffectDominators); |
| 5358 SetChangesFlag(kNewSpacePromotion); | 5379 SetGVNFlag(kChangesNewSpacePromotion); |
| 5359 SetDependsOnFlag(kNewSpacePromotion); | 5380 SetGVNFlag(kDependsOnNewSpacePromotion); |
| 5360 | 5381 |
| 5361 if (FLAG_trace_pretenuring) { | 5382 if (FLAG_trace_pretenuring) { |
| 5362 PrintF("HAllocate with AllocationSite %p %s\n", | 5383 PrintF("HAllocate with AllocationSite %p %s\n", |
| 5363 allocation_site.is_null() | 5384 allocation_site.is_null() |
| 5364 ? static_cast<void*>(NULL) | 5385 ? static_cast<void*>(NULL) |
| 5365 : static_cast<void*>(*allocation_site), | 5386 : static_cast<void*>(*allocation_site), |
| 5366 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 5387 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| 5367 } | 5388 } |
| 5368 } | 5389 } |
| 5369 | 5390 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5547 | 5568 |
| 5548 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) | 5569 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
| 5549 | 5570 |
| 5550 private: | 5571 private: |
| 5551 HStoreGlobalCell(HValue* value, | 5572 HStoreGlobalCell(HValue* value, |
| 5552 Handle<PropertyCell> cell, | 5573 Handle<PropertyCell> cell, |
| 5553 PropertyDetails details) | 5574 PropertyDetails details) |
| 5554 : HUnaryOperation(value), | 5575 : HUnaryOperation(value), |
| 5555 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), | 5576 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), |
| 5556 details_(details) { | 5577 details_(details) { |
| 5557 SetChangesFlag(kGlobalVars); | 5578 SetGVNFlag(kChangesGlobalVars); |
| 5558 } | 5579 } |
| 5559 | 5580 |
| 5560 Unique<PropertyCell> cell_; | 5581 Unique<PropertyCell> cell_; |
| 5561 PropertyDetails details_; | 5582 PropertyDetails details_; |
| 5562 }; | 5583 }; |
| 5563 | 5584 |
| 5564 | 5585 |
| 5565 class HLoadContextSlot V8_FINAL : public HUnaryOperation { | 5586 class HLoadContextSlot V8_FINAL : public HUnaryOperation { |
| 5566 public: | 5587 public: |
| 5567 enum Mode { | 5588 enum Mode { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5586 mode_ = kCheckDeoptimize; | 5607 mode_ = kCheckDeoptimize; |
| 5587 break; | 5608 break; |
| 5588 case CONST: | 5609 case CONST: |
| 5589 mode_ = kCheckReturnUndefined; | 5610 mode_ = kCheckReturnUndefined; |
| 5590 break; | 5611 break; |
| 5591 default: | 5612 default: |
| 5592 mode_ = kNoCheck; | 5613 mode_ = kNoCheck; |
| 5593 } | 5614 } |
| 5594 set_representation(Representation::Tagged()); | 5615 set_representation(Representation::Tagged()); |
| 5595 SetFlag(kUseGVN); | 5616 SetFlag(kUseGVN); |
| 5596 SetDependsOnFlag(kContextSlots); | 5617 SetGVNFlag(kDependsOnContextSlots); |
| 5597 } | 5618 } |
| 5598 | 5619 |
| 5599 int slot_index() const { return slot_index_; } | 5620 int slot_index() const { return slot_index_; } |
| 5600 Mode mode() const { return mode_; } | 5621 Mode mode() const { return mode_; } |
| 5601 | 5622 |
| 5602 bool DeoptimizesOnHole() { | 5623 bool DeoptimizesOnHole() { |
| 5603 return mode_ == kCheckDeoptimize; | 5624 return mode_ == kCheckDeoptimize; |
| 5604 } | 5625 } |
| 5605 | 5626 |
| 5606 bool RequiresHoleCheck() const { | 5627 bool RequiresHoleCheck() const { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5670 | 5691 |
| 5671 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 5692 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 5672 | 5693 |
| 5673 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 5694 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
| 5674 | 5695 |
| 5675 private: | 5696 private: |
| 5676 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) | 5697 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) |
| 5677 : slot_index_(slot_index), mode_(mode) { | 5698 : slot_index_(slot_index), mode_(mode) { |
| 5678 SetOperandAt(0, context); | 5699 SetOperandAt(0, context); |
| 5679 SetOperandAt(1, value); | 5700 SetOperandAt(1, value); |
| 5680 SetChangesFlag(kContextSlots); | 5701 SetGVNFlag(kChangesContextSlots); |
| 5681 } | 5702 } |
| 5682 | 5703 |
| 5683 int slot_index_; | 5704 int slot_index_; |
| 5684 Mode mode_; | 5705 Mode mode_; |
| 5685 }; | 5706 }; |
| 5686 | 5707 |
| 5687 | 5708 |
| 5688 // Represents an access to a portion of an object, such as the map pointer, | 5709 // Represents an access to a portion of an object, such as the map pointer, |
| 5689 // array elements pointer, etc, but not accesses to array elements themselves. | 5710 // array elements pointer, etc, but not accesses to array elements themselves. |
| 5690 class HObjectAccess V8_FINAL { | 5711 class HObjectAccess V8_FINAL { |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5948 | 5969 |
| 5949 static HObjectAccess ForJSArrayBufferViewByteLength() { | 5970 static HObjectAccess ForJSArrayBufferViewByteLength() { |
| 5950 return HObjectAccess::ForObservableJSObjectOffset( | 5971 return HObjectAccess::ForObservableJSObjectOffset( |
| 5951 JSArrayBufferView::kByteLengthOffset); | 5972 JSArrayBufferView::kByteLengthOffset); |
| 5952 } | 5973 } |
| 5953 | 5974 |
| 5954 static HObjectAccess ForGlobalObjectNativeContext() { | 5975 static HObjectAccess ForGlobalObjectNativeContext() { |
| 5955 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset); | 5976 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset); |
| 5956 } | 5977 } |
| 5957 | 5978 |
| 5958 void PrintTo(StringStream* stream) const; | 5979 void PrintTo(StringStream* stream); |
| 5959 | 5980 |
| 5960 inline bool Equals(HObjectAccess that) const { | 5981 inline bool Equals(HObjectAccess that) const { |
| 5961 return value_ == that.value_; // portion and offset must match | 5982 return value_ == that.value_; // portion and offset must match |
| 5962 } | 5983 } |
| 5963 | 5984 |
| 5964 protected: | 5985 protected: |
| 5965 void SetGVNFlags(HValue *instr, PropertyAccessType access_type); | 5986 void SetGVNFlags(HValue *instr, PropertyAccessType access_type); |
| 5966 | 5987 |
| 5967 private: | 5988 private: |
| 5968 // internal use only; different parts of an object or array | 5989 // internal use only; different parts of an object or array |
| 5969 enum Portion { | 5990 enum Portion { |
| 5970 kMaps, // map of an object | 5991 kMaps, // map of an object |
| 5971 kArrayLengths, // the length of an array | 5992 kArrayLengths, // the length of an array |
| 5972 kStringLengths, // the length of a string | 5993 kStringLengths, // the length of a string |
| 5973 kElementsPointer, // elements pointer | 5994 kElementsPointer, // elements pointer |
| 5974 kBackingStore, // some field in the backing store | 5995 kBackingStore, // some field in the backing store |
| 5975 kDouble, // some double field | 5996 kDouble, // some double field |
| 5976 kInobject, // some other in-object field | 5997 kInobject, // some other in-object field |
| 5977 kExternalMemory // some field in external memory | 5998 kExternalMemory // some field in external memory |
| 5978 }; | 5999 }; |
| 5979 | 6000 |
| 5980 HObjectAccess() : value_(0) {} | |
| 5981 | |
| 5982 HObjectAccess(Portion portion, int offset, | 6001 HObjectAccess(Portion portion, int offset, |
| 5983 Representation representation = Representation::Tagged(), | 6002 Representation representation = Representation::Tagged(), |
| 5984 Handle<String> name = Handle<String>::null(), | 6003 Handle<String> name = Handle<String>::null(), |
| 5985 bool immutable = false, | 6004 bool immutable = false, |
| 5986 bool existing_inobject_property = true) | 6005 bool existing_inobject_property = true) |
| 5987 : value_(PortionField::encode(portion) | | 6006 : value_(PortionField::encode(portion) | |
| 5988 RepresentationField::encode(representation.kind()) | | 6007 RepresentationField::encode(representation.kind()) | |
| 5989 ImmutableField::encode(immutable ? 1 : 0) | | 6008 ImmutableField::encode(immutable ? 1 : 0) | |
| 5990 ExistingInobjectPropertyField::encode( | 6009 ExistingInobjectPropertyField::encode( |
| 5991 existing_inobject_property ? 1 : 0) | | 6010 existing_inobject_property ? 1 : 0) | |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6004 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; | 6023 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; |
| 6005 class ImmutableField : public BitField<bool, 7, 1> {}; | 6024 class ImmutableField : public BitField<bool, 7, 1> {}; |
| 6006 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; | 6025 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; |
| 6007 class OffsetField : public BitField<int, 9, 23> {}; | 6026 class OffsetField : public BitField<int, 9, 23> {}; |
| 6008 | 6027 |
| 6009 uint32_t value_; // encodes portion, representation, immutable, and offset | 6028 uint32_t value_; // encodes portion, representation, immutable, and offset |
| 6010 Handle<String> name_; | 6029 Handle<String> name_; |
| 6011 | 6030 |
| 6012 friend class HLoadNamedField; | 6031 friend class HLoadNamedField; |
| 6013 friend class HStoreNamedField; | 6032 friend class HStoreNamedField; |
| 6014 friend class SideEffectsScope; | |
| 6015 | 6033 |
| 6016 inline Portion portion() const { | 6034 inline Portion portion() const { |
| 6017 return PortionField::decode(value_); | 6035 return PortionField::decode(value_); |
| 6018 } | 6036 } |
| 6019 }; | 6037 }; |
| 6020 | 6038 |
| 6021 | 6039 |
| 6022 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { | 6040 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { |
| 6023 public: | 6041 public: |
| 6024 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*, | 6042 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6141 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) | 6159 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) |
| 6142 | 6160 |
| 6143 protected: | 6161 protected: |
| 6144 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } | 6162 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } |
| 6145 | 6163 |
| 6146 private: | 6164 private: |
| 6147 explicit HLoadFunctionPrototype(HValue* function) | 6165 explicit HLoadFunctionPrototype(HValue* function) |
| 6148 : HUnaryOperation(function) { | 6166 : HUnaryOperation(function) { |
| 6149 set_representation(Representation::Tagged()); | 6167 set_representation(Representation::Tagged()); |
| 6150 SetFlag(kUseGVN); | 6168 SetFlag(kUseGVN); |
| 6151 SetDependsOnFlag(kCalls); | 6169 SetGVNFlag(kDependsOnCalls); |
| 6152 } | 6170 } |
| 6153 }; | 6171 }; |
| 6154 | 6172 |
| 6155 class ArrayInstructionInterface { | 6173 class ArrayInstructionInterface { |
| 6156 public: | 6174 public: |
| 6157 virtual HValue* GetKey() = 0; | 6175 virtual HValue* GetKey() = 0; |
| 6158 virtual void SetKey(HValue* key) = 0; | 6176 virtual void SetKey(HValue* key) = 0; |
| 6159 virtual void SetIndexOffset(uint32_t index_offset) = 0; | 6177 virtual void SetIndexOffset(uint32_t index_offset) = 0; |
| 6160 virtual int MaxIndexOffsetBits() = 0; | 6178 virtual int MaxIndexOffsetBits() = 0; |
| 6161 virtual bool IsDehoisted() = 0; | 6179 virtual bool IsDehoisted() = 0; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6286 set_type(HType::Smi()); | 6304 set_type(HType::Smi()); |
| 6287 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { | 6305 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { |
| 6288 set_representation(Representation::Integer32()); | 6306 set_representation(Representation::Integer32()); |
| 6289 } else { | 6307 } else { |
| 6290 set_representation(Representation::Smi()); | 6308 set_representation(Representation::Smi()); |
| 6291 } | 6309 } |
| 6292 } else { | 6310 } else { |
| 6293 set_representation(Representation::Tagged()); | 6311 set_representation(Representation::Tagged()); |
| 6294 } | 6312 } |
| 6295 | 6313 |
| 6296 SetDependsOnFlag(kArrayElements); | 6314 SetGVNFlag(kDependsOnArrayElements); |
| 6297 } else { | 6315 } else { |
| 6298 set_representation(Representation::Double()); | 6316 set_representation(Representation::Double()); |
| 6299 SetDependsOnFlag(kDoubleArrayElements); | 6317 SetGVNFlag(kDependsOnDoubleArrayElements); |
| 6300 } | 6318 } |
| 6301 } else { | 6319 } else { |
| 6302 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || | 6320 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || |
| 6303 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || | 6321 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || |
| 6304 elements_kind == FLOAT32_ELEMENTS || | 6322 elements_kind == FLOAT32_ELEMENTS || |
| 6305 elements_kind == FLOAT64_ELEMENTS) { | 6323 elements_kind == FLOAT64_ELEMENTS) { |
| 6306 set_representation(Representation::Double()); | 6324 set_representation(Representation::Double()); |
| 6307 } else { | 6325 } else { |
| 6308 set_representation(Representation::Integer32()); | 6326 set_representation(Representation::Integer32()); |
| 6309 } | 6327 } |
| 6310 | 6328 |
| 6311 if (is_external()) { | 6329 if (is_external()) { |
| 6312 SetDependsOnFlag(kExternalMemory); | 6330 SetGVNFlag(kDependsOnExternalMemory); |
| 6313 } else if (is_fixed_typed_array()) { | 6331 } else if (is_fixed_typed_array()) { |
| 6314 SetDependsOnFlag(kTypedArrayElements); | 6332 SetGVNFlag(kDependsOnTypedArrayElements); |
| 6315 } else { | 6333 } else { |
| 6316 UNREACHABLE(); | 6334 UNREACHABLE(); |
| 6317 } | 6335 } |
| 6318 // Native code could change the specialized array. | 6336 // Native code could change the specialized array. |
| 6319 SetDependsOnFlag(kCalls); | 6337 SetGVNFlag(kDependsOnCalls); |
| 6320 } | 6338 } |
| 6321 | 6339 |
| 6322 SetFlag(kUseGVN); | 6340 SetFlag(kUseGVN); |
| 6323 } | 6341 } |
| 6324 | 6342 |
| 6325 virtual bool IsDeletable() const V8_OVERRIDE { | 6343 virtual bool IsDeletable() const V8_OVERRIDE { |
| 6326 return !RequiresHoleCheck(); | 6344 return !RequiresHoleCheck(); |
| 6327 } | 6345 } |
| 6328 | 6346 |
| 6329 // Establish some checks around our packed fields | 6347 // Establish some checks around our packed fields |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6433 } | 6451 } |
| 6434 return field_representation(); | 6452 return field_representation(); |
| 6435 } else if (field_representation().IsExternal()) { | 6453 } else if (field_representation().IsExternal()) { |
| 6436 return Representation::External(); | 6454 return Representation::External(); |
| 6437 } | 6455 } |
| 6438 } | 6456 } |
| 6439 return Representation::Tagged(); | 6457 return Representation::Tagged(); |
| 6440 } | 6458 } |
| 6441 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6459 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 6442 HValue* dominator) V8_OVERRIDE { | 6460 HValue* dominator) V8_OVERRIDE { |
| 6443 ASSERT(side_effect == kNewSpacePromotion); | 6461 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 6444 new_space_dominator_ = dominator; | 6462 new_space_dominator_ = dominator; |
| 6445 return false; | 6463 return false; |
| 6446 } | 6464 } |
| 6447 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; | 6465 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; |
| 6448 | 6466 |
| 6449 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } | 6467 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } |
| 6450 bool IsSkipWriteBarrier() const { | 6468 bool IsSkipWriteBarrier() const { |
| 6451 return write_barrier_mode_ == SKIP_WRITE_BARRIER; | 6469 return write_barrier_mode_ == SKIP_WRITE_BARRIER; |
| 6452 } | 6470 } |
| 6453 | 6471 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6665 void SetUninitialized(bool is_uninitialized) { | 6683 void SetUninitialized(bool is_uninitialized) { |
| 6666 is_uninitialized_ = is_uninitialized; | 6684 is_uninitialized_ = is_uninitialized; |
| 6667 } | 6685 } |
| 6668 | 6686 |
| 6669 bool IsConstantHoleStore() { | 6687 bool IsConstantHoleStore() { |
| 6670 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); | 6688 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); |
| 6671 } | 6689 } |
| 6672 | 6690 |
| 6673 virtual bool HandleSideEffectDominator(GVNFlag side_effect, | 6691 virtual bool HandleSideEffectDominator(GVNFlag side_effect, |
| 6674 HValue* dominator) V8_OVERRIDE { | 6692 HValue* dominator) V8_OVERRIDE { |
| 6675 ASSERT(side_effect == kNewSpacePromotion); | 6693 ASSERT(side_effect == kChangesNewSpacePromotion); |
| 6676 new_space_dominator_ = dominator; | 6694 new_space_dominator_ = dominator; |
| 6677 return false; | 6695 return false; |
| 6678 } | 6696 } |
| 6679 | 6697 |
| 6680 HValue* new_space_dominator() const { return new_space_dominator_; } | 6698 HValue* new_space_dominator() const { return new_space_dominator_; } |
| 6681 | 6699 |
| 6682 bool NeedsWriteBarrier() { | 6700 bool NeedsWriteBarrier() { |
| 6683 if (value_is_smi()) { | 6701 if (value_is_smi()) { |
| 6684 return false; | 6702 return false; |
| 6685 } else { | 6703 } else { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6708 if (!FLAG_smi_x64_store_opt) store_mode_ = INITIALIZING_STORE; | 6726 if (!FLAG_smi_x64_store_opt) store_mode_ = INITIALIZING_STORE; |
| 6709 SetOperandAt(0, obj); | 6727 SetOperandAt(0, obj); |
| 6710 SetOperandAt(1, key); | 6728 SetOperandAt(1, key); |
| 6711 SetOperandAt(2, val); | 6729 SetOperandAt(2, val); |
| 6712 | 6730 |
| 6713 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || | 6731 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || |
| 6714 elements_kind == FAST_SMI_ELEMENTS); | 6732 elements_kind == FAST_SMI_ELEMENTS); |
| 6715 | 6733 |
| 6716 if (IsFastObjectElementsKind(elements_kind)) { | 6734 if (IsFastObjectElementsKind(elements_kind)) { |
| 6717 SetFlag(kTrackSideEffectDominators); | 6735 SetFlag(kTrackSideEffectDominators); |
| 6718 SetDependsOnFlag(kNewSpacePromotion); | 6736 SetGVNFlag(kDependsOnNewSpacePromotion); |
| 6719 } | 6737 } |
| 6720 if (is_external()) { | 6738 if (is_external()) { |
| 6721 SetChangesFlag(kExternalMemory); | 6739 SetGVNFlag(kChangesExternalMemory); |
| 6722 SetFlag(kAllowUndefinedAsNaN); | 6740 SetFlag(kAllowUndefinedAsNaN); |
| 6723 } else if (IsFastDoubleElementsKind(elements_kind)) { | 6741 } else if (IsFastDoubleElementsKind(elements_kind)) { |
| 6724 SetChangesFlag(kDoubleArrayElements); | 6742 SetGVNFlag(kChangesDoubleArrayElements); |
| 6725 } else if (IsFastSmiElementsKind(elements_kind)) { | 6743 } else if (IsFastSmiElementsKind(elements_kind)) { |
| 6726 SetChangesFlag(kArrayElements); | 6744 SetGVNFlag(kChangesArrayElements); |
| 6727 } else if (is_fixed_typed_array()) { | 6745 } else if (is_fixed_typed_array()) { |
| 6728 SetChangesFlag(kTypedArrayElements); | 6746 SetGVNFlag(kChangesTypedArrayElements); |
| 6729 SetFlag(kAllowUndefinedAsNaN); | 6747 SetFlag(kAllowUndefinedAsNaN); |
| 6730 } else { | 6748 } else { |
| 6731 SetChangesFlag(kArrayElements); | 6749 SetGVNFlag(kChangesArrayElements); |
| 6732 } | 6750 } |
| 6733 | 6751 |
| 6734 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | 6752 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. |
| 6735 if ((elements_kind >= EXTERNAL_INT8_ELEMENTS && | 6753 if ((elements_kind >= EXTERNAL_INT8_ELEMENTS && |
| 6736 elements_kind <= EXTERNAL_UINT32_ELEMENTS) || | 6754 elements_kind <= EXTERNAL_UINT32_ELEMENTS) || |
| 6737 (elements_kind >= UINT8_ELEMENTS && | 6755 (elements_kind >= UINT8_ELEMENTS && |
| 6738 elements_kind <= INT32_ELEMENTS)) { | 6756 elements_kind <= INT32_ELEMENTS)) { |
| 6739 SetFlag(kTruncatingToInt32); | 6757 SetFlag(kTruncatingToInt32); |
| 6740 } | 6758 } |
| 6741 } | 6759 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6825 HValue* object, | 6843 HValue* object, |
| 6826 Handle<Map> original_map, | 6844 Handle<Map> original_map, |
| 6827 Handle<Map> transitioned_map) | 6845 Handle<Map> transitioned_map) |
| 6828 : original_map_(Unique<Map>(original_map)), | 6846 : original_map_(Unique<Map>(original_map)), |
| 6829 transitioned_map_(Unique<Map>(transitioned_map)), | 6847 transitioned_map_(Unique<Map>(transitioned_map)), |
| 6830 from_kind_(original_map->elements_kind()), | 6848 from_kind_(original_map->elements_kind()), |
| 6831 to_kind_(transitioned_map->elements_kind()) { | 6849 to_kind_(transitioned_map->elements_kind()) { |
| 6832 SetOperandAt(0, object); | 6850 SetOperandAt(0, object); |
| 6833 SetOperandAt(1, context); | 6851 SetOperandAt(1, context); |
| 6834 SetFlag(kUseGVN); | 6852 SetFlag(kUseGVN); |
| 6835 SetChangesFlag(kElementsKind); | 6853 SetGVNFlag(kChangesElementsKind); |
| 6836 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { | 6854 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { |
| 6837 SetChangesFlag(kElementsPointer); | 6855 SetGVNFlag(kChangesElementsPointer); |
| 6838 SetChangesFlag(kNewSpacePromotion); | 6856 SetGVNFlag(kChangesNewSpacePromotion); |
| 6839 } | 6857 } |
| 6840 set_representation(Representation::Tagged()); | 6858 set_representation(Representation::Tagged()); |
| 6841 } | 6859 } |
| 6842 | 6860 |
| 6843 Unique<Map> original_map_; | 6861 Unique<Map> original_map_; |
| 6844 Unique<Map> transitioned_map_; | 6862 Unique<Map> transitioned_map_; |
| 6845 ElementsKind from_kind_; | 6863 ElementsKind from_kind_; |
| 6846 ElementsKind to_kind_; | 6864 ElementsKind to_kind_; |
| 6847 }; | 6865 }; |
| 6848 | 6866 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6879 HStringAdd(HValue* context, | 6897 HStringAdd(HValue* context, |
| 6880 HValue* left, | 6898 HValue* left, |
| 6881 HValue* right, | 6899 HValue* right, |
| 6882 PretenureFlag pretenure_flag, | 6900 PretenureFlag pretenure_flag, |
| 6883 StringAddFlags flags, | 6901 StringAddFlags flags, |
| 6884 Handle<AllocationSite> allocation_site) | 6902 Handle<AllocationSite> allocation_site) |
| 6885 : HBinaryOperation(context, left, right, HType::String()), | 6903 : HBinaryOperation(context, left, right, HType::String()), |
| 6886 flags_(flags), pretenure_flag_(pretenure_flag) { | 6904 flags_(flags), pretenure_flag_(pretenure_flag) { |
| 6887 set_representation(Representation::Tagged()); | 6905 set_representation(Representation::Tagged()); |
| 6888 SetFlag(kUseGVN); | 6906 SetFlag(kUseGVN); |
| 6889 SetDependsOnFlag(kMaps); | 6907 SetGVNFlag(kDependsOnMaps); |
| 6890 SetChangesFlag(kNewSpacePromotion); | 6908 SetGVNFlag(kChangesNewSpacePromotion); |
| 6891 if (FLAG_trace_pretenuring) { | 6909 if (FLAG_trace_pretenuring) { |
| 6892 PrintF("HStringAdd with AllocationSite %p %s\n", | 6910 PrintF("HStringAdd with AllocationSite %p %s\n", |
| 6893 allocation_site.is_null() | 6911 allocation_site.is_null() |
| 6894 ? static_cast<void*>(NULL) | 6912 ? static_cast<void*>(NULL) |
| 6895 : static_cast<void*>(*allocation_site), | 6913 : static_cast<void*>(*allocation_site), |
| 6896 pretenure_flag == TENURED ? "tenured" : "not tenured"); | 6914 pretenure_flag == TENURED ? "tenured" : "not tenured"); |
| 6897 } | 6915 } |
| 6898 } | 6916 } |
| 6899 | 6917 |
| 6900 // No side-effects except possible allocation: | 6918 // No side-effects except possible allocation: |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6931 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 6949 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
| 6932 } | 6950 } |
| 6933 | 6951 |
| 6934 private: | 6952 private: |
| 6935 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 6953 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { |
| 6936 SetOperandAt(0, context); | 6954 SetOperandAt(0, context); |
| 6937 SetOperandAt(1, string); | 6955 SetOperandAt(1, string); |
| 6938 SetOperandAt(2, index); | 6956 SetOperandAt(2, index); |
| 6939 set_representation(Representation::Integer32()); | 6957 set_representation(Representation::Integer32()); |
| 6940 SetFlag(kUseGVN); | 6958 SetFlag(kUseGVN); |
| 6941 SetDependsOnFlag(kMaps); | 6959 SetGVNFlag(kDependsOnMaps); |
| 6942 SetDependsOnFlag(kStringChars); | 6960 SetGVNFlag(kDependsOnStringChars); |
| 6943 SetChangesFlag(kNewSpacePromotion); | 6961 SetGVNFlag(kChangesNewSpacePromotion); |
| 6944 } | 6962 } |
| 6945 | 6963 |
| 6946 // No side effects: runtime function assumes string + number inputs. | 6964 // No side effects: runtime function assumes string + number inputs. |
| 6947 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 6965 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 6948 }; | 6966 }; |
| 6949 | 6967 |
| 6950 | 6968 |
| 6951 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { | 6969 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { |
| 6952 public: | 6970 public: |
| 6953 static HInstruction* New(Zone* zone, | 6971 static HInstruction* New(Zone* zone, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 6967 | 6985 |
| 6968 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) | 6986 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) |
| 6969 | 6987 |
| 6970 private: | 6988 private: |
| 6971 HStringCharFromCode(HValue* context, HValue* char_code) | 6989 HStringCharFromCode(HValue* context, HValue* char_code) |
| 6972 : HTemplateInstruction<2>(HType::String()) { | 6990 : HTemplateInstruction<2>(HType::String()) { |
| 6973 SetOperandAt(0, context); | 6991 SetOperandAt(0, context); |
| 6974 SetOperandAt(1, char_code); | 6992 SetOperandAt(1, char_code); |
| 6975 set_representation(Representation::Tagged()); | 6993 set_representation(Representation::Tagged()); |
| 6976 SetFlag(kUseGVN); | 6994 SetFlag(kUseGVN); |
| 6977 SetChangesFlag(kNewSpacePromotion); | 6995 SetGVNFlag(kChangesNewSpacePromotion); |
| 6978 } | 6996 } |
| 6979 | 6997 |
| 6980 virtual bool IsDeletable() const V8_OVERRIDE { | 6998 virtual bool IsDeletable() const V8_OVERRIDE { |
| 6981 return !value()->ToNumberCanBeObserved(); | 6999 return !value()->ToNumberCanBeObserved(); |
| 6982 } | 7000 } |
| 6983 }; | 7001 }; |
| 6984 | 7002 |
| 6985 | 7003 |
| 6986 template <int V> | 7004 template <int V> |
| 6987 class HMaterializedLiteral : public HTemplateInstruction<V> { | 7005 class HMaterializedLiteral : public HTemplateInstruction<V> { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7076 Handle<SharedFunctionInfo> shared, | 7094 Handle<SharedFunctionInfo> shared, |
| 7077 bool pretenure) | 7095 bool pretenure) |
| 7078 : HTemplateInstruction<1>(HType::JSObject()), | 7096 : HTemplateInstruction<1>(HType::JSObject()), |
| 7079 shared_info_(shared), | 7097 shared_info_(shared), |
| 7080 pretenure_(pretenure), | 7098 pretenure_(pretenure), |
| 7081 has_no_literals_(shared->num_literals() == 0), | 7099 has_no_literals_(shared->num_literals() == 0), |
| 7082 is_generator_(shared->is_generator()), | 7100 is_generator_(shared->is_generator()), |
| 7083 language_mode_(shared->language_mode()) { | 7101 language_mode_(shared->language_mode()) { |
| 7084 SetOperandAt(0, context); | 7102 SetOperandAt(0, context); |
| 7085 set_representation(Representation::Tagged()); | 7103 set_representation(Representation::Tagged()); |
| 7086 SetChangesFlag(kNewSpacePromotion); | 7104 SetGVNFlag(kChangesNewSpacePromotion); |
| 7087 } | 7105 } |
| 7088 | 7106 |
| 7089 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7107 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7090 | 7108 |
| 7091 Handle<SharedFunctionInfo> shared_info_; | 7109 Handle<SharedFunctionInfo> shared_info_; |
| 7092 bool pretenure_ : 1; | 7110 bool pretenure_ : 1; |
| 7093 bool has_no_literals_ : 1; | 7111 bool has_no_literals_ : 1; |
| 7094 bool is_generator_ : 1; | 7112 bool is_generator_ : 1; |
| 7095 LanguageMode language_mode_; | 7113 LanguageMode language_mode_; |
| 7096 }; | 7114 }; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7147 | 7165 |
| 7148 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 7166 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 7149 return Representation::Tagged(); | 7167 return Representation::Tagged(); |
| 7150 } | 7168 } |
| 7151 | 7169 |
| 7152 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | 7170 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) |
| 7153 | 7171 |
| 7154 private: | 7172 private: |
| 7155 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 7173 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
| 7156 set_representation(Representation::Tagged()); | 7174 set_representation(Representation::Tagged()); |
| 7157 SetChangesFlag(kNewSpacePromotion); | 7175 SetGVNFlag(kChangesNewSpacePromotion); |
| 7158 | 7176 |
| 7159 // This instruction is not marked as kChangesMaps, but does | 7177 // This instruction is not marked as kChangesMaps, but does |
| 7160 // change the map of the input operand. Use it only when creating | 7178 // change the map of the input operand. Use it only when creating |
| 7161 // object literals via a runtime call. | 7179 // object literals via a runtime call. |
| 7162 ASSERT(value->IsCallRuntime()); | 7180 ASSERT(value->IsCallRuntime()); |
| 7163 #ifdef DEBUG | 7181 #ifdef DEBUG |
| 7164 const Runtime::Function* function = HCallRuntime::cast(value)->function(); | 7182 const Runtime::Function* function = HCallRuntime::cast(value)->function(); |
| 7165 ASSERT(function->function_id == Runtime::kCreateObjectLiteral); | 7183 ASSERT(function->function_id == Runtime::kCreateObjectLiteral); |
| 7166 #endif | 7184 #endif |
| 7167 } | 7185 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7226 } | 7244 } |
| 7227 | 7245 |
| 7228 private: | 7246 private: |
| 7229 HSeqStringGetChar(String::Encoding encoding, | 7247 HSeqStringGetChar(String::Encoding encoding, |
| 7230 HValue* string, | 7248 HValue* string, |
| 7231 HValue* index) : encoding_(encoding) { | 7249 HValue* index) : encoding_(encoding) { |
| 7232 SetOperandAt(0, string); | 7250 SetOperandAt(0, string); |
| 7233 SetOperandAt(1, index); | 7251 SetOperandAt(1, index); |
| 7234 set_representation(Representation::Integer32()); | 7252 set_representation(Representation::Integer32()); |
| 7235 SetFlag(kUseGVN); | 7253 SetFlag(kUseGVN); |
| 7236 SetDependsOnFlag(kStringChars); | 7254 SetGVNFlag(kDependsOnStringChars); |
| 7237 } | 7255 } |
| 7238 | 7256 |
| 7239 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7257 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7240 | 7258 |
| 7241 String::Encoding encoding_; | 7259 String::Encoding encoding_; |
| 7242 }; | 7260 }; |
| 7243 | 7261 |
| 7244 | 7262 |
| 7245 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<4> { | 7263 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<4> { |
| 7246 public: | 7264 public: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7265 HSeqStringSetChar(HValue* context, | 7283 HSeqStringSetChar(HValue* context, |
| 7266 String::Encoding encoding, | 7284 String::Encoding encoding, |
| 7267 HValue* string, | 7285 HValue* string, |
| 7268 HValue* index, | 7286 HValue* index, |
| 7269 HValue* value) : encoding_(encoding) { | 7287 HValue* value) : encoding_(encoding) { |
| 7270 SetOperandAt(0, context); | 7288 SetOperandAt(0, context); |
| 7271 SetOperandAt(1, string); | 7289 SetOperandAt(1, string); |
| 7272 SetOperandAt(2, index); | 7290 SetOperandAt(2, index); |
| 7273 SetOperandAt(3, value); | 7291 SetOperandAt(3, value); |
| 7274 set_representation(Representation::Tagged()); | 7292 set_representation(Representation::Tagged()); |
| 7275 SetChangesFlag(kStringChars); | 7293 SetGVNFlag(kChangesStringChars); |
| 7276 } | 7294 } |
| 7277 | 7295 |
| 7278 String::Encoding encoding_; | 7296 String::Encoding encoding_; |
| 7279 }; | 7297 }; |
| 7280 | 7298 |
| 7281 | 7299 |
| 7282 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { | 7300 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { |
| 7283 public: | 7301 public: |
| 7284 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); | 7302 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); |
| 7285 | 7303 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 7305 return true; | 7323 return true; |
| 7306 } | 7324 } |
| 7307 | 7325 |
| 7308 private: | 7326 private: |
| 7309 HCheckMapValue(HValue* value, | 7327 HCheckMapValue(HValue* value, |
| 7310 HValue* map) { | 7328 HValue* map) { |
| 7311 SetOperandAt(0, value); | 7329 SetOperandAt(0, value); |
| 7312 SetOperandAt(1, map); | 7330 SetOperandAt(1, map); |
| 7313 set_representation(Representation::Tagged()); | 7331 set_representation(Representation::Tagged()); |
| 7314 SetFlag(kUseGVN); | 7332 SetFlag(kUseGVN); |
| 7315 SetDependsOnFlag(kMaps); | 7333 SetGVNFlag(kDependsOnMaps); |
| 7316 SetDependsOnFlag(kElementsKind); | 7334 SetGVNFlag(kDependsOnElementsKind); |
| 7317 } | 7335 } |
| 7318 }; | 7336 }; |
| 7319 | 7337 |
| 7320 | 7338 |
| 7321 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { | 7339 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { |
| 7322 public: | 7340 public: |
| 7323 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); | 7341 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); |
| 7324 | 7342 |
| 7325 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { | 7343 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { |
| 7326 return Representation::Tagged(); | 7344 return Representation::Tagged(); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7418 virtual bool IsDeletable() const V8_OVERRIDE { return true; } | 7436 virtual bool IsDeletable() const V8_OVERRIDE { return true; } |
| 7419 }; | 7437 }; |
| 7420 | 7438 |
| 7421 | 7439 |
| 7422 #undef DECLARE_INSTRUCTION | 7440 #undef DECLARE_INSTRUCTION |
| 7423 #undef DECLARE_CONCRETE_INSTRUCTION | 7441 #undef DECLARE_CONCRETE_INSTRUCTION |
| 7424 | 7442 |
| 7425 } } // namespace v8::internal | 7443 } } // namespace v8::internal |
| 7426 | 7444 |
| 7427 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7445 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |