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