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

Side by Side Diff: src/hydrogen-instructions.h

Issue 144423010: Improve inobject field tracking during GVN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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
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
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
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
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
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
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
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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 return this->map_set_.Equals(&HCheckMaps::cast(other)->map_set_); 2667 return this->map_set_.Equals(&HCheckMaps::cast(other)->map_set_);
2689 } 2668 }
2690 2669
2691 virtual int RedefinedOperandIndex() { return 0; } 2670 virtual int RedefinedOperandIndex() { return 0; }
2692 2671
2693 private: 2672 private:
2694 void Add(Handle<Map> map, Zone* zone) { 2673 void Add(Handle<Map> map, Zone* zone) {
2695 map_set_.Add(Unique<Map>(map), zone); 2674 map_set_.Add(Unique<Map>(map), zone);
2696 if (!has_migration_target_ && map->is_migration_target()) { 2675 if (!has_migration_target_ && map->is_migration_target()) {
2697 has_migration_target_ = true; 2676 has_migration_target_ = true;
2698 SetGVNFlag(kChangesNewSpacePromotion); 2677 SetChangesFlag(kNewSpacePromotion);
2699 } 2678 }
2700 } 2679 }
2701 2680
2702 // Clients should use one of the static New* methods above. 2681 // Clients should use one of the static New* methods above.
2703 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) 2682 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck)
2704 : HTemplateInstruction<2>(value->type()), 2683 : HTemplateInstruction<2>(value->type()),
2705 omit_(false), has_migration_target_(false) { 2684 omit_(false), has_migration_target_(false) {
2706 SetOperandAt(0, value); 2685 SetOperandAt(0, value);
2707 // Use the object value for the dependency if NULL is passed. 2686 // Use the object value for the dependency if NULL is passed.
2708 SetOperandAt(1, typecheck != NULL ? typecheck : value); 2687 SetOperandAt(1, typecheck != NULL ? typecheck : value);
2709 set_representation(Representation::Tagged()); 2688 set_representation(Representation::Tagged());
2710 SetFlag(kUseGVN); 2689 SetFlag(kUseGVN);
2711 SetFlag(kTrackSideEffectDominators); 2690 SetFlag(kTrackSideEffectDominators);
2712 SetGVNFlag(kDependsOnMaps); 2691 SetDependsOnFlag(kMaps);
2713 SetGVNFlag(kDependsOnElementsKind); 2692 SetDependsOnFlag(kElementsKind);
2714 } 2693 }
2715 2694
2716 bool omit_; 2695 bool omit_;
2717 bool has_migration_target_; 2696 bool has_migration_target_;
2718 UniqueSet<Map> map_set_; 2697 UniqueSet<Map> map_set_;
2719 }; 2698 };
2720 2699
2721 2700
2722 class HCheckValue V8_FINAL : public HUnaryOperation { 2701 class HCheckValue V8_FINAL : public HUnaryOperation {
2723 public: 2702 public:
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 const ZoneList<HValue*>* values() const { return &values_; } 3286 const ZoneList<HValue*>* values() const { return &values_; }
3308 int length() const { return values_.length(); } 3287 int length() const { return values_.length(); }
3309 int capture_id() const { return capture_id_; } 3288 int capture_id() const { return capture_id_; }
3310 3289
3311 // Shortcut for the map value of this captured object. 3290 // Shortcut for the map value of this captured object.
3312 HValue* map_value() const { return values()->first(); } 3291 HValue* map_value() const { return values()->first(); }
3313 3292
3314 void ReuseSideEffectsFromStore(HInstruction* store) { 3293 void ReuseSideEffectsFromStore(HInstruction* store) {
3315 ASSERT(store->HasObservableSideEffects()); 3294 ASSERT(store->HasObservableSideEffects());
3316 ASSERT(store->IsStoreNamedField()); 3295 ASSERT(store->IsStoreNamedField());
3317 gvn_flags_.Add(store->gvn_flags()); 3296 changes_flags_.Add(store->ChangesFlags());
3318 } 3297 }
3319 3298
3320 // Replay effects of this instruction on the given environment. 3299 // Replay effects of this instruction on the given environment.
3321 void ReplayEnvironment(HEnvironment* env); 3300 void ReplayEnvironment(HEnvironment* env);
3322 3301
3323 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 3302 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
3324 3303
3325 DECLARE_CONCRETE_INSTRUCTION(CapturedObject) 3304 DECLARE_CONCRETE_INSTRUCTION(CapturedObject)
3326 3305
3327 private: 3306 private:
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
3940 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 3919 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
3941 HType type = HType::Tagged()) 3920 HType type = HType::Tagged())
3942 : HBinaryOperation(context, left, right, type) { 3921 : HBinaryOperation(context, left, right, type) {
3943 SetFlag(kFlexibleRepresentation); 3922 SetFlag(kFlexibleRepresentation);
3944 SetFlag(kTruncatingToInt32); 3923 SetFlag(kTruncatingToInt32);
3945 SetFlag(kAllowUndefinedAsNaN); 3924 SetFlag(kAllowUndefinedAsNaN);
3946 SetAllSideEffects(); 3925 SetAllSideEffects();
3947 } 3926 }
3948 3927
3949 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 3928 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
3950 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); 3929 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
3951 if (to.IsTagged() && 3930 if (to.IsTagged() &&
3952 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 3931 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
3953 SetAllSideEffects(); 3932 SetAllSideEffects();
3954 ClearFlag(kUseGVN); 3933 ClearFlag(kUseGVN);
3955 } else { 3934 } else {
3956 ClearAllSideEffects(); 3935 ClearAllSideEffects();
3957 SetFlag(kUseGVN); 3936 SetFlag(kUseGVN);
3958 } 3937 }
3959 } 3938 }
3960 3939
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
4017 class HArithmeticBinaryOperation : public HBinaryOperation { 3996 class HArithmeticBinaryOperation : public HBinaryOperation {
4018 public: 3997 public:
4019 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 3998 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
4020 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { 3999 : HBinaryOperation(context, left, right, HType::TaggedNumber()) {
4021 SetAllSideEffects(); 4000 SetAllSideEffects();
4022 SetFlag(kFlexibleRepresentation); 4001 SetFlag(kFlexibleRepresentation);
4023 SetFlag(kAllowUndefinedAsNaN); 4002 SetFlag(kAllowUndefinedAsNaN);
4024 } 4003 }
4025 4004
4026 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4005 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4027 if (to.IsTagged()) SetGVNFlag(kChangesNewSpacePromotion); 4006 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4028 if (to.IsTagged() && 4007 if (to.IsTagged() &&
4029 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 4008 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4030 SetAllSideEffects(); 4009 SetAllSideEffects();
4031 ClearFlag(kUseGVN); 4010 ClearFlag(kUseGVN);
4032 } else { 4011 } else {
4033 ClearAllSideEffects(); 4012 ClearAllSideEffects();
4034 SetFlag(kUseGVN); 4013 SetFlag(kUseGVN);
4035 } 4014 }
4036 } 4015 }
4037 4016
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
4342 HStringCompareAndBranch(HValue* context, 4321 HStringCompareAndBranch(HValue* context,
4343 HValue* left, 4322 HValue* left,
4344 HValue* right, 4323 HValue* right,
4345 Token::Value token) 4324 Token::Value token)
4346 : token_(token) { 4325 : token_(token) {
4347 ASSERT(Token::IsCompareOp(token)); 4326 ASSERT(Token::IsCompareOp(token));
4348 SetOperandAt(0, context); 4327 SetOperandAt(0, context);
4349 SetOperandAt(1, left); 4328 SetOperandAt(1, left);
4350 SetOperandAt(2, right); 4329 SetOperandAt(2, right);
4351 set_representation(Representation::Tagged()); 4330 set_representation(Representation::Tagged());
4352 SetGVNFlag(kChangesNewSpacePromotion); 4331 SetChangesFlag(kNewSpacePromotion);
4353 } 4332 }
4354 4333
4355 Token::Value token_; 4334 Token::Value token_;
4356 }; 4335 };
4357 4336
4358 4337
4359 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> { 4338 class HIsConstructCallAndBranch : public HTemplateControlInstruction<2, 0> {
4360 public: 4339 public:
4361 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch); 4340 DECLARE_INSTRUCTION_FACTORY_P0(HIsConstructCallAndBranch);
4362 4341
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4567 4546
4568 protected: 4547 protected:
4569 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4548 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4570 4549
4571 private: 4550 private:
4572 HPower(HValue* left, HValue* right) { 4551 HPower(HValue* left, HValue* right) {
4573 SetOperandAt(0, left); 4552 SetOperandAt(0, left);
4574 SetOperandAt(1, right); 4553 SetOperandAt(1, right);
4575 set_representation(Representation::Double()); 4554 set_representation(Representation::Double());
4576 SetFlag(kUseGVN); 4555 SetFlag(kUseGVN);
4577 SetGVNFlag(kChangesNewSpacePromotion); 4556 SetChangesFlag(kNewSpacePromotion);
4578 } 4557 }
4579 4558
4580 virtual bool IsDeletable() const V8_OVERRIDE { 4559 virtual bool IsDeletable() const V8_OVERRIDE {
4581 return !right()->representation().IsTagged(); 4560 return !right()->representation().IsTagged();
4582 } 4561 }
4583 }; 4562 };
4584 4563
4585 4564
4586 class HAdd V8_FINAL : public HArithmeticBinaryOperation { 4565 class HAdd V8_FINAL : public HArithmeticBinaryOperation {
4587 public: 4566 public:
(...skipping 21 matching lines...) Expand all
4609 } else if (right()->IsInteger32Constant()) { 4588 } else if (right()->IsInteger32Constant()) {
4610 decomposition->Apply(left(), right()->GetInteger32Constant()); 4589 decomposition->Apply(left(), right()->GetInteger32Constant());
4611 return true; 4590 return true;
4612 } else { 4591 } else {
4613 return false; 4592 return false;
4614 } 4593 }
4615 } 4594 }
4616 4595
4617 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4596 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4618 if (to.IsTagged()) { 4597 if (to.IsTagged()) {
4619 SetGVNFlag(kChangesNewSpacePromotion); 4598 SetChangesFlag(kNewSpacePromotion);
4620 ClearFlag(kAllowUndefinedAsNaN); 4599 ClearFlag(kAllowUndefinedAsNaN);
4621 } 4600 }
4622 if (to.IsTagged() && 4601 if (to.IsTagged() &&
4623 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || 4602 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() ||
4624 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { 4603 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) {
4625 SetAllSideEffects(); 4604 SetAllSideEffects();
4626 ClearFlag(kUseGVN); 4605 ClearFlag(kUseGVN);
4627 } else { 4606 } else {
4628 ClearAllSideEffects(); 4607 ClearAllSideEffects();
4629 SetFlag(kUseGVN); 4608 SetFlag(kUseGVN);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
5066 BailoutId ast_id() const { return ast_id_; } 5045 BailoutId ast_id() const { return ast_id_; }
5067 5046
5068 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 5047 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
5069 return Representation::None(); 5048 return Representation::None();
5070 } 5049 }
5071 5050
5072 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) 5051 DECLARE_CONCRETE_INSTRUCTION(OsrEntry)
5073 5052
5074 private: 5053 private:
5075 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { 5054 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) {
5076 SetGVNFlag(kChangesOsrEntries); 5055 SetChangesFlag(kOsrEntries);
5077 SetGVNFlag(kChangesNewSpacePromotion); 5056 SetChangesFlag(kNewSpacePromotion);
5078 } 5057 }
5079 5058
5080 BailoutId ast_id_; 5059 BailoutId ast_id_;
5081 }; 5060 };
5082 5061
5083 5062
5084 class HParameter V8_FINAL : public HTemplateInstruction<0> { 5063 class HParameter V8_FINAL : public HTemplateInstruction<0> {
5085 public: 5064 public:
5086 enum ParameterKind { 5065 enum ParameterKind {
5087 STACK_PARAMETER, 5066 STACK_PARAMETER,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5209 protected: 5188 protected:
5210 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 5189 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
5211 return cell_ == HLoadGlobalCell::cast(other)->cell_; 5190 return cell_ == HLoadGlobalCell::cast(other)->cell_;
5212 } 5191 }
5213 5192
5214 private: 5193 private:
5215 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) 5194 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details)
5216 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) { 5195 : cell_(Unique<Cell>::CreateUninitialized(cell)), details_(details) {
5217 set_representation(Representation::Tagged()); 5196 set_representation(Representation::Tagged());
5218 SetFlag(kUseGVN); 5197 SetFlag(kUseGVN);
5219 SetGVNFlag(kDependsOnGlobalVars); 5198 SetDependsOnFlag(kGlobalVars);
5220 } 5199 }
5221 5200
5222 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); } 5201 virtual bool IsDeletable() const V8_OVERRIDE { return !RequiresHoleCheck(); }
5223 5202
5224 Unique<Cell> cell_; 5203 Unique<Cell> cell_;
5225 PropertyDetails details_; 5204 PropertyDetails details_;
5226 }; 5205 };
5227 5206
5228 5207
5229 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> { 5208 class HLoadGlobalGeneric V8_FINAL : public HTemplateInstruction<2> {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 Handle<AllocationSite> allocation_site = 5340 Handle<AllocationSite> allocation_site =
5362 Handle<AllocationSite>::null()) 5341 Handle<AllocationSite>::null())
5363 : HTemplateInstruction<2>(type), 5342 : HTemplateInstruction<2>(type),
5364 flags_(ComputeFlags(pretenure_flag, instance_type)), 5343 flags_(ComputeFlags(pretenure_flag, instance_type)),
5365 dominating_allocate_(NULL), 5344 dominating_allocate_(NULL),
5366 filler_free_space_size_(NULL) { 5345 filler_free_space_size_(NULL) {
5367 SetOperandAt(0, context); 5346 SetOperandAt(0, context);
5368 SetOperandAt(1, size); 5347 SetOperandAt(1, size);
5369 set_representation(Representation::Tagged()); 5348 set_representation(Representation::Tagged());
5370 SetFlag(kTrackSideEffectDominators); 5349 SetFlag(kTrackSideEffectDominators);
5371 SetGVNFlag(kChangesNewSpacePromotion); 5350 SetChangesFlag(kNewSpacePromotion);
5372 SetGVNFlag(kDependsOnNewSpacePromotion); 5351 SetDependsOnFlag(kNewSpacePromotion);
5373 5352
5374 if (FLAG_trace_pretenuring) { 5353 if (FLAG_trace_pretenuring) {
5375 PrintF("HAllocate with AllocationSite %p %s\n", 5354 PrintF("HAllocate with AllocationSite %p %s\n",
5376 allocation_site.is_null() 5355 allocation_site.is_null()
5377 ? static_cast<void*>(NULL) 5356 ? static_cast<void*>(NULL)
5378 : static_cast<void*>(*allocation_site), 5357 : static_cast<void*>(*allocation_site),
5379 pretenure_flag == TENURED ? "tenured" : "not tenured"); 5358 pretenure_flag == TENURED ? "tenured" : "not tenured");
5380 } 5359 }
5381 } 5360 }
5382 5361
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 5539
5561 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) 5540 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell)
5562 5541
5563 private: 5542 private:
5564 HStoreGlobalCell(HValue* value, 5543 HStoreGlobalCell(HValue* value,
5565 Handle<PropertyCell> cell, 5544 Handle<PropertyCell> cell,
5566 PropertyDetails details) 5545 PropertyDetails details)
5567 : HUnaryOperation(value), 5546 : HUnaryOperation(value),
5568 cell_(Unique<PropertyCell>::CreateUninitialized(cell)), 5547 cell_(Unique<PropertyCell>::CreateUninitialized(cell)),
5569 details_(details) { 5548 details_(details) {
5570 SetGVNFlag(kChangesGlobalVars); 5549 SetChangesFlag(kGlobalVars);
5571 } 5550 }
5572 5551
5573 Unique<PropertyCell> cell_; 5552 Unique<PropertyCell> cell_;
5574 PropertyDetails details_; 5553 PropertyDetails details_;
5575 }; 5554 };
5576 5555
5577 5556
5578 class HLoadContextSlot V8_FINAL : public HUnaryOperation { 5557 class HLoadContextSlot V8_FINAL : public HUnaryOperation {
5579 public: 5558 public:
5580 enum Mode { 5559 enum Mode {
(...skipping 18 matching lines...) Expand all
5599 mode_ = kCheckDeoptimize; 5578 mode_ = kCheckDeoptimize;
5600 break; 5579 break;
5601 case CONST: 5580 case CONST:
5602 mode_ = kCheckReturnUndefined; 5581 mode_ = kCheckReturnUndefined;
5603 break; 5582 break;
5604 default: 5583 default:
5605 mode_ = kNoCheck; 5584 mode_ = kNoCheck;
5606 } 5585 }
5607 set_representation(Representation::Tagged()); 5586 set_representation(Representation::Tagged());
5608 SetFlag(kUseGVN); 5587 SetFlag(kUseGVN);
5609 SetGVNFlag(kDependsOnContextSlots); 5588 SetDependsOnFlag(kContextSlots);
5610 } 5589 }
5611 5590
5612 int slot_index() const { return slot_index_; } 5591 int slot_index() const { return slot_index_; }
5613 Mode mode() const { return mode_; } 5592 Mode mode() const { return mode_; }
5614 5593
5615 bool DeoptimizesOnHole() { 5594 bool DeoptimizesOnHole() {
5616 return mode_ == kCheckDeoptimize; 5595 return mode_ == kCheckDeoptimize;
5617 } 5596 }
5618 5597
5619 bool RequiresHoleCheck() const { 5598 bool RequiresHoleCheck() const {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5683 5662
5684 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 5663 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
5685 5664
5686 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) 5665 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot)
5687 5666
5688 private: 5667 private:
5689 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) 5668 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value)
5690 : slot_index_(slot_index), mode_(mode) { 5669 : slot_index_(slot_index), mode_(mode) {
5691 SetOperandAt(0, context); 5670 SetOperandAt(0, context);
5692 SetOperandAt(1, value); 5671 SetOperandAt(1, value);
5693 SetGVNFlag(kChangesContextSlots); 5672 SetChangesFlag(kContextSlots);
5694 } 5673 }
5695 5674
5696 int slot_index_; 5675 int slot_index_;
5697 Mode mode_; 5676 Mode mode_;
5698 }; 5677 };
5699 5678
5700 5679
5701 // Represents an access to a portion of an object, such as the map pointer, 5680 // Represents an access to a portion of an object, such as the map pointer,
5702 // array elements pointer, etc, but not accesses to array elements themselves. 5681 // array elements pointer, etc, but not accesses to array elements themselves.
5703 class HObjectAccess V8_FINAL { 5682 class HObjectAccess V8_FINAL {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
5961 5940
5962 static HObjectAccess ForJSArrayBufferViewByteLength() { 5941 static HObjectAccess ForJSArrayBufferViewByteLength() {
5963 return HObjectAccess::ForObservableJSObjectOffset( 5942 return HObjectAccess::ForObservableJSObjectOffset(
5964 JSArrayBufferView::kByteLengthOffset); 5943 JSArrayBufferView::kByteLengthOffset);
5965 } 5944 }
5966 5945
5967 static HObjectAccess ForGlobalObjectNativeContext() { 5946 static HObjectAccess ForGlobalObjectNativeContext() {
5968 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset); 5947 return HObjectAccess(kInobject, GlobalObject::kNativeContextOffset);
5969 } 5948 }
5970 5949
5971 void PrintTo(StringStream* stream); 5950 void PrintTo(StringStream* stream) const;
5972 5951
5973 inline bool Equals(HObjectAccess that) const { 5952 inline bool Equals(HObjectAccess that) const {
5974 return value_ == that.value_; // portion and offset must match 5953 return value_ == that.value_; // portion and offset must match
5975 } 5954 }
5976 5955
5977 protected: 5956 protected:
5978 void SetGVNFlags(HValue *instr, PropertyAccessType access_type); 5957 void SetGVNFlags(HValue *instr, PropertyAccessType access_type);
5979 5958
5980 private: 5959 private:
5981 // internal use only; different parts of an object or array 5960 // internal use only; different parts of an object or array
5982 enum Portion { 5961 enum Portion {
5983 kMaps, // map of an object 5962 kMaps, // map of an object
5984 kArrayLengths, // the length of an array 5963 kArrayLengths, // the length of an array
5985 kStringLengths, // the length of a string 5964 kStringLengths, // the length of a string
5986 kElementsPointer, // elements pointer 5965 kElementsPointer, // elements pointer
5987 kBackingStore, // some field in the backing store 5966 kBackingStore, // some field in the backing store
5988 kDouble, // some double field 5967 kDouble, // some double field
5989 kInobject, // some other in-object field 5968 kInobject, // some other in-object field
5990 kExternalMemory // some field in external memory 5969 kExternalMemory // some field in external memory
5991 }; 5970 };
5992 5971
5972 HObjectAccess() : value_(0) {}
5973
5993 HObjectAccess(Portion portion, int offset, 5974 HObjectAccess(Portion portion, int offset,
5994 Representation representation = Representation::Tagged(), 5975 Representation representation = Representation::Tagged(),
5995 Handle<String> name = Handle<String>::null(), 5976 Handle<String> name = Handle<String>::null(),
5996 bool immutable = false, 5977 bool immutable = false,
5997 bool existing_inobject_property = true) 5978 bool existing_inobject_property = true)
5998 : value_(PortionField::encode(portion) | 5979 : value_(PortionField::encode(portion) |
5999 RepresentationField::encode(representation.kind()) | 5980 RepresentationField::encode(representation.kind()) |
6000 ImmutableField::encode(immutable ? 1 : 0) | 5981 ImmutableField::encode(immutable ? 1 : 0) |
6001 ExistingInobjectPropertyField::encode( 5982 ExistingInobjectPropertyField::encode(
6002 existing_inobject_property ? 1 : 0) | 5983 existing_inobject_property ? 1 : 0) |
(...skipping 12 matching lines...) Expand all
6015 class RepresentationField : public BitField<Representation::Kind, 3, 4> {}; 5996 class RepresentationField : public BitField<Representation::Kind, 3, 4> {};
6016 class ImmutableField : public BitField<bool, 7, 1> {}; 5997 class ImmutableField : public BitField<bool, 7, 1> {};
6017 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {}; 5998 class ExistingInobjectPropertyField : public BitField<bool, 8, 1> {};
6018 class OffsetField : public BitField<int, 9, 23> {}; 5999 class OffsetField : public BitField<int, 9, 23> {};
6019 6000
6020 uint32_t value_; // encodes portion, representation, immutable, and offset 6001 uint32_t value_; // encodes portion, representation, immutable, and offset
6021 Handle<String> name_; 6002 Handle<String> name_;
6022 6003
6023 friend class HLoadNamedField; 6004 friend class HLoadNamedField;
6024 friend class HStoreNamedField; 6005 friend class HStoreNamedField;
6006 friend class SideEffectsScope;
6025 6007
6026 inline Portion portion() const { 6008 inline Portion portion() const {
6027 return PortionField::decode(value_); 6009 return PortionField::decode(value_);
6028 } 6010 }
6029 }; 6011 };
6030 6012
6031 6013
6032 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> { 6014 class HLoadNamedField V8_FINAL : public HTemplateInstruction<2> {
6033 public: 6015 public:
6034 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*, 6016 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HValue*,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
6151 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 6133 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
6152 6134
6153 protected: 6135 protected:
6154 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 6136 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
6155 6137
6156 private: 6138 private:
6157 explicit HLoadFunctionPrototype(HValue* function) 6139 explicit HLoadFunctionPrototype(HValue* function)
6158 : HUnaryOperation(function) { 6140 : HUnaryOperation(function) {
6159 set_representation(Representation::Tagged()); 6141 set_representation(Representation::Tagged());
6160 SetFlag(kUseGVN); 6142 SetFlag(kUseGVN);
6161 SetGVNFlag(kDependsOnCalls); 6143 SetDependsOnFlag(kCalls);
6162 } 6144 }
6163 }; 6145 };
6164 6146
6165 class ArrayInstructionInterface { 6147 class ArrayInstructionInterface {
6166 public: 6148 public:
6167 virtual HValue* GetKey() = 0; 6149 virtual HValue* GetKey() = 0;
6168 virtual void SetKey(HValue* key) = 0; 6150 virtual void SetKey(HValue* key) = 0;
6169 virtual void SetIndexOffset(uint32_t index_offset) = 0; 6151 virtual void SetIndexOffset(uint32_t index_offset) = 0;
6170 virtual int MaxIndexOffsetBits() = 0; 6152 virtual int MaxIndexOffsetBits() = 0;
6171 virtual bool IsDehoisted() = 0; 6153 virtual bool IsDehoisted() = 0;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
6296 set_type(HType::Smi()); 6278 set_type(HType::Smi());
6297 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) { 6279 if (SmiValuesAre32Bits() && !RequiresHoleCheck()) {
6298 set_representation(Representation::Integer32()); 6280 set_representation(Representation::Integer32());
6299 } else { 6281 } else {
6300 set_representation(Representation::Smi()); 6282 set_representation(Representation::Smi());
6301 } 6283 }
6302 } else { 6284 } else {
6303 set_representation(Representation::Tagged()); 6285 set_representation(Representation::Tagged());
6304 } 6286 }
6305 6287
6306 SetGVNFlag(kDependsOnArrayElements); 6288 SetDependsOnFlag(kArrayElements);
6307 } else { 6289 } else {
6308 set_representation(Representation::Double()); 6290 set_representation(Representation::Double());
6309 SetGVNFlag(kDependsOnDoubleArrayElements); 6291 SetDependsOnFlag(kDoubleArrayElements);
6310 } 6292 }
6311 } else { 6293 } else {
6312 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS || 6294 if (elements_kind == EXTERNAL_FLOAT32_ELEMENTS ||
6313 elements_kind == EXTERNAL_FLOAT64_ELEMENTS || 6295 elements_kind == EXTERNAL_FLOAT64_ELEMENTS ||
6314 elements_kind == FLOAT32_ELEMENTS || 6296 elements_kind == FLOAT32_ELEMENTS ||
6315 elements_kind == FLOAT64_ELEMENTS) { 6297 elements_kind == FLOAT64_ELEMENTS) {
6316 set_representation(Representation::Double()); 6298 set_representation(Representation::Double());
6317 } else { 6299 } else {
6318 set_representation(Representation::Integer32()); 6300 set_representation(Representation::Integer32());
6319 } 6301 }
6320 6302
6321 if (is_external()) { 6303 if (is_external()) {
6322 SetGVNFlag(kDependsOnExternalMemory); 6304 SetDependsOnFlag(kExternalMemory);
6323 } else if (is_fixed_typed_array()) { 6305 } else if (is_fixed_typed_array()) {
6324 SetGVNFlag(kDependsOnTypedArrayElements); 6306 SetDependsOnFlag(kTypedArrayElements);
6325 } else { 6307 } else {
6326 UNREACHABLE(); 6308 UNREACHABLE();
6327 } 6309 }
6328 // Native code could change the specialized array. 6310 // Native code could change the specialized array.
6329 SetGVNFlag(kDependsOnCalls); 6311 SetDependsOnFlag(kCalls);
6330 } 6312 }
6331 6313
6332 SetFlag(kUseGVN); 6314 SetFlag(kUseGVN);
6333 } 6315 }
6334 6316
6335 virtual bool IsDeletable() const V8_OVERRIDE { 6317 virtual bool IsDeletable() const V8_OVERRIDE {
6336 return !RequiresHoleCheck(); 6318 return !RequiresHoleCheck();
6337 } 6319 }
6338 6320
6339 // Establish some checks around our packed fields 6321 // Establish some checks around our packed fields
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
6443 } 6425 }
6444 return field_representation(); 6426 return field_representation();
6445 } else if (field_representation().IsExternal()) { 6427 } else if (field_representation().IsExternal()) {
6446 return Representation::External(); 6428 return Representation::External();
6447 } 6429 }
6448 } 6430 }
6449 return Representation::Tagged(); 6431 return Representation::Tagged();
6450 } 6432 }
6451 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 6433 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
6452 HValue* dominator) V8_OVERRIDE { 6434 HValue* dominator) V8_OVERRIDE {
6453 ASSERT(side_effect == kChangesNewSpacePromotion); 6435 ASSERT(side_effect == kNewSpacePromotion);
6454 new_space_dominator_ = dominator; 6436 new_space_dominator_ = dominator;
6455 return false; 6437 return false;
6456 } 6438 }
6457 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6439 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6458 6440
6459 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; } 6441 void SkipWriteBarrier() { write_barrier_mode_ = SKIP_WRITE_BARRIER; }
6460 bool IsSkipWriteBarrier() const { 6442 bool IsSkipWriteBarrier() const {
6461 return write_barrier_mode_ == SKIP_WRITE_BARRIER; 6443 return write_barrier_mode_ == SKIP_WRITE_BARRIER;
6462 } 6444 }
6463 6445
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
6675 void SetUninitialized(bool is_uninitialized) { 6657 void SetUninitialized(bool is_uninitialized) {
6676 is_uninitialized_ = is_uninitialized; 6658 is_uninitialized_ = is_uninitialized;
6677 } 6659 }
6678 6660
6679 bool IsConstantHoleStore() { 6661 bool IsConstantHoleStore() {
6680 return value()->IsConstant() && HConstant::cast(value())->IsTheHole(); 6662 return value()->IsConstant() && HConstant::cast(value())->IsTheHole();
6681 } 6663 }
6682 6664
6683 virtual bool HandleSideEffectDominator(GVNFlag side_effect, 6665 virtual bool HandleSideEffectDominator(GVNFlag side_effect,
6684 HValue* dominator) V8_OVERRIDE { 6666 HValue* dominator) V8_OVERRIDE {
6685 ASSERT(side_effect == kChangesNewSpacePromotion); 6667 ASSERT(side_effect == kNewSpacePromotion);
6686 new_space_dominator_ = dominator; 6668 new_space_dominator_ = dominator;
6687 return false; 6669 return false;
6688 } 6670 }
6689 6671
6690 HValue* new_space_dominator() const { return new_space_dominator_; } 6672 HValue* new_space_dominator() const { return new_space_dominator_; }
6691 6673
6692 bool NeedsWriteBarrier() { 6674 bool NeedsWriteBarrier() {
6693 if (value_is_smi()) { 6675 if (value_is_smi()) {
6694 return false; 6676 return false;
6695 } else { 6677 } else {
(...skipping 22 matching lines...) Expand all
6718 if (!FLAG_smi_x64_store_opt) store_mode_ = INITIALIZING_STORE; 6700 if (!FLAG_smi_x64_store_opt) store_mode_ = INITIALIZING_STORE;
6719 SetOperandAt(0, obj); 6701 SetOperandAt(0, obj);
6720 SetOperandAt(1, key); 6702 SetOperandAt(1, key);
6721 SetOperandAt(2, val); 6703 SetOperandAt(2, val);
6722 6704
6723 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY || 6705 ASSERT(store_mode != STORE_TO_INITIALIZED_ENTRY ||
6724 elements_kind == FAST_SMI_ELEMENTS); 6706 elements_kind == FAST_SMI_ELEMENTS);
6725 6707
6726 if (IsFastObjectElementsKind(elements_kind)) { 6708 if (IsFastObjectElementsKind(elements_kind)) {
6727 SetFlag(kTrackSideEffectDominators); 6709 SetFlag(kTrackSideEffectDominators);
6728 SetGVNFlag(kDependsOnNewSpacePromotion); 6710 SetDependsOnFlag(kNewSpacePromotion);
6729 } 6711 }
6730 if (is_external()) { 6712 if (is_external()) {
6731 SetGVNFlag(kChangesExternalMemory); 6713 SetChangesFlag(kExternalMemory);
6732 SetFlag(kAllowUndefinedAsNaN); 6714 SetFlag(kAllowUndefinedAsNaN);
6733 } else if (IsFastDoubleElementsKind(elements_kind)) { 6715 } else if (IsFastDoubleElementsKind(elements_kind)) {
6734 SetGVNFlag(kChangesDoubleArrayElements); 6716 SetChangesFlag(kDoubleArrayElements);
6735 } else if (IsFastSmiElementsKind(elements_kind)) { 6717 } else if (IsFastSmiElementsKind(elements_kind)) {
6736 SetGVNFlag(kChangesArrayElements); 6718 SetChangesFlag(kArrayElements);
6737 } else if (is_fixed_typed_array()) { 6719 } else if (is_fixed_typed_array()) {
6738 SetGVNFlag(kChangesTypedArrayElements); 6720 SetChangesFlag(kTypedArrayElements);
6739 SetFlag(kAllowUndefinedAsNaN); 6721 SetFlag(kAllowUndefinedAsNaN);
6740 } else { 6722 } else {
6741 SetGVNFlag(kChangesArrayElements); 6723 SetChangesFlag(kArrayElements);
6742 } 6724 }
6743 6725
6744 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. 6726 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating.
6745 if ((elements_kind >= EXTERNAL_INT8_ELEMENTS && 6727 if ((elements_kind >= EXTERNAL_INT8_ELEMENTS &&
6746 elements_kind <= EXTERNAL_UINT32_ELEMENTS) || 6728 elements_kind <= EXTERNAL_UINT32_ELEMENTS) ||
6747 (elements_kind >= UINT8_ELEMENTS && 6729 (elements_kind >= UINT8_ELEMENTS &&
6748 elements_kind <= INT32_ELEMENTS)) { 6730 elements_kind <= INT32_ELEMENTS)) {
6749 SetFlag(kTruncatingToInt32); 6731 SetFlag(kTruncatingToInt32);
6750 } 6732 }
6751 } 6733 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
6835 HValue* object, 6817 HValue* object,
6836 Handle<Map> original_map, 6818 Handle<Map> original_map,
6837 Handle<Map> transitioned_map) 6819 Handle<Map> transitioned_map)
6838 : original_map_(Unique<Map>(original_map)), 6820 : original_map_(Unique<Map>(original_map)),
6839 transitioned_map_(Unique<Map>(transitioned_map)), 6821 transitioned_map_(Unique<Map>(transitioned_map)),
6840 from_kind_(original_map->elements_kind()), 6822 from_kind_(original_map->elements_kind()),
6841 to_kind_(transitioned_map->elements_kind()) { 6823 to_kind_(transitioned_map->elements_kind()) {
6842 SetOperandAt(0, object); 6824 SetOperandAt(0, object);
6843 SetOperandAt(1, context); 6825 SetOperandAt(1, context);
6844 SetFlag(kUseGVN); 6826 SetFlag(kUseGVN);
6845 SetGVNFlag(kChangesElementsKind); 6827 SetChangesFlag(kElementsKind);
6846 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) { 6828 if (!IsSimpleMapChangeTransition(from_kind_, to_kind_)) {
6847 SetGVNFlag(kChangesElementsPointer); 6829 SetChangesFlag(kElementsPointer);
6848 SetGVNFlag(kChangesNewSpacePromotion); 6830 SetChangesFlag(kNewSpacePromotion);
6849 } 6831 }
6850 set_representation(Representation::Tagged()); 6832 set_representation(Representation::Tagged());
6851 } 6833 }
6852 6834
6853 Unique<Map> original_map_; 6835 Unique<Map> original_map_;
6854 Unique<Map> transitioned_map_; 6836 Unique<Map> transitioned_map_;
6855 ElementsKind from_kind_; 6837 ElementsKind from_kind_;
6856 ElementsKind to_kind_; 6838 ElementsKind to_kind_;
6857 }; 6839 };
6858 6840
(...skipping 30 matching lines...) Expand all
6889 HStringAdd(HValue* context, 6871 HStringAdd(HValue* context,
6890 HValue* left, 6872 HValue* left,
6891 HValue* right, 6873 HValue* right,
6892 PretenureFlag pretenure_flag, 6874 PretenureFlag pretenure_flag,
6893 StringAddFlags flags, 6875 StringAddFlags flags,
6894 Handle<AllocationSite> allocation_site) 6876 Handle<AllocationSite> allocation_site)
6895 : HBinaryOperation(context, left, right, HType::String()), 6877 : HBinaryOperation(context, left, right, HType::String()),
6896 flags_(flags), pretenure_flag_(pretenure_flag) { 6878 flags_(flags), pretenure_flag_(pretenure_flag) {
6897 set_representation(Representation::Tagged()); 6879 set_representation(Representation::Tagged());
6898 SetFlag(kUseGVN); 6880 SetFlag(kUseGVN);
6899 SetGVNFlag(kDependsOnMaps); 6881 SetDependsOnFlag(kMaps);
6900 SetGVNFlag(kChangesNewSpacePromotion); 6882 SetChangesFlag(kNewSpacePromotion);
6901 if (FLAG_trace_pretenuring) { 6883 if (FLAG_trace_pretenuring) {
6902 PrintF("HStringAdd with AllocationSite %p %s\n", 6884 PrintF("HStringAdd with AllocationSite %p %s\n",
6903 allocation_site.is_null() 6885 allocation_site.is_null()
6904 ? static_cast<void*>(NULL) 6886 ? static_cast<void*>(NULL)
6905 : static_cast<void*>(*allocation_site), 6887 : static_cast<void*>(*allocation_site),
6906 pretenure_flag == TENURED ? "tenured" : "not tenured"); 6888 pretenure_flag == TENURED ? "tenured" : "not tenured");
6907 } 6889 }
6908 } 6890 }
6909 6891
6910 // No side-effects except possible allocation: 6892 // No side-effects except possible allocation:
(...skipping 30 matching lines...) Expand all
6941 return new(zone) Range(0, String::kMaxUtf16CodeUnit); 6923 return new(zone) Range(0, String::kMaxUtf16CodeUnit);
6942 } 6924 }
6943 6925
6944 private: 6926 private:
6945 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { 6927 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) {
6946 SetOperandAt(0, context); 6928 SetOperandAt(0, context);
6947 SetOperandAt(1, string); 6929 SetOperandAt(1, string);
6948 SetOperandAt(2, index); 6930 SetOperandAt(2, index);
6949 set_representation(Representation::Integer32()); 6931 set_representation(Representation::Integer32());
6950 SetFlag(kUseGVN); 6932 SetFlag(kUseGVN);
6951 SetGVNFlag(kDependsOnMaps); 6933 SetDependsOnFlag(kMaps);
6952 SetGVNFlag(kDependsOnStringChars); 6934 SetDependsOnFlag(kStringChars);
6953 SetGVNFlag(kChangesNewSpacePromotion); 6935 SetChangesFlag(kNewSpacePromotion);
6954 } 6936 }
6955 6937
6956 // No side effects: runtime function assumes string + number inputs. 6938 // No side effects: runtime function assumes string + number inputs.
6957 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6939 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6958 }; 6940 };
6959 6941
6960 6942
6961 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> { 6943 class HStringCharFromCode V8_FINAL : public HTemplateInstruction<2> {
6962 public: 6944 public:
6963 static HInstruction* New(Zone* zone, 6945 static HInstruction* New(Zone* zone,
(...skipping 13 matching lines...) Expand all
6977 6959
6978 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 6960 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
6979 6961
6980 private: 6962 private:
6981 HStringCharFromCode(HValue* context, HValue* char_code) 6963 HStringCharFromCode(HValue* context, HValue* char_code)
6982 : HTemplateInstruction<2>(HType::String()) { 6964 : HTemplateInstruction<2>(HType::String()) {
6983 SetOperandAt(0, context); 6965 SetOperandAt(0, context);
6984 SetOperandAt(1, char_code); 6966 SetOperandAt(1, char_code);
6985 set_representation(Representation::Tagged()); 6967 set_representation(Representation::Tagged());
6986 SetFlag(kUseGVN); 6968 SetFlag(kUseGVN);
6987 SetGVNFlag(kChangesNewSpacePromotion); 6969 SetChangesFlag(kNewSpacePromotion);
6988 } 6970 }
6989 6971
6990 virtual bool IsDeletable() const V8_OVERRIDE { 6972 virtual bool IsDeletable() const V8_OVERRIDE {
6991 return !value()->ToNumberCanBeObserved(); 6973 return !value()->ToNumberCanBeObserved();
6992 } 6974 }
6993 }; 6975 };
6994 6976
6995 6977
6996 template <int V> 6978 template <int V>
6997 class HMaterializedLiteral : public HTemplateInstruction<V> { 6979 class HMaterializedLiteral : public HTemplateInstruction<V> {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
7086 Handle<SharedFunctionInfo> shared, 7068 Handle<SharedFunctionInfo> shared,
7087 bool pretenure) 7069 bool pretenure)
7088 : HTemplateInstruction<1>(HType::JSObject()), 7070 : HTemplateInstruction<1>(HType::JSObject()),
7089 shared_info_(shared), 7071 shared_info_(shared),
7090 pretenure_(pretenure), 7072 pretenure_(pretenure),
7091 has_no_literals_(shared->num_literals() == 0), 7073 has_no_literals_(shared->num_literals() == 0),
7092 is_generator_(shared->is_generator()), 7074 is_generator_(shared->is_generator()),
7093 language_mode_(shared->language_mode()) { 7075 language_mode_(shared->language_mode()) {
7094 SetOperandAt(0, context); 7076 SetOperandAt(0, context);
7095 set_representation(Representation::Tagged()); 7077 set_representation(Representation::Tagged());
7096 SetGVNFlag(kChangesNewSpacePromotion); 7078 SetChangesFlag(kNewSpacePromotion);
7097 } 7079 }
7098 7080
7099 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7081 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7100 7082
7101 Handle<SharedFunctionInfo> shared_info_; 7083 Handle<SharedFunctionInfo> shared_info_;
7102 bool pretenure_ : 1; 7084 bool pretenure_ : 1;
7103 bool has_no_literals_ : 1; 7085 bool has_no_literals_ : 1;
7104 bool is_generator_ : 1; 7086 bool is_generator_ : 1;
7105 LanguageMode language_mode_; 7087 LanguageMode language_mode_;
7106 }; 7088 };
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
7157 7139
7158 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7140 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7159 return Representation::Tagged(); 7141 return Representation::Tagged();
7160 } 7142 }
7161 7143
7162 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) 7144 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties)
7163 7145
7164 private: 7146 private:
7165 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { 7147 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) {
7166 set_representation(Representation::Tagged()); 7148 set_representation(Representation::Tagged());
7167 SetGVNFlag(kChangesNewSpacePromotion); 7149 SetChangesFlag(kNewSpacePromotion);
7168 7150
7169 // This instruction is not marked as kChangesMaps, but does 7151 // This instruction is not marked as kChangesMaps, but does
7170 // change the map of the input operand. Use it only when creating 7152 // change the map of the input operand. Use it only when creating
7171 // object literals via a runtime call. 7153 // object literals via a runtime call.
7172 ASSERT(value->IsCallRuntime()); 7154 ASSERT(value->IsCallRuntime());
7173 #ifdef DEBUG 7155 #ifdef DEBUG
7174 const Runtime::Function* function = HCallRuntime::cast(value)->function(); 7156 const Runtime::Function* function = HCallRuntime::cast(value)->function();
7175 ASSERT(function->function_id == Runtime::kCreateObjectLiteral); 7157 ASSERT(function->function_id == Runtime::kCreateObjectLiteral);
7176 #endif 7158 #endif
7177 } 7159 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
7236 } 7218 }
7237 7219
7238 private: 7220 private:
7239 HSeqStringGetChar(String::Encoding encoding, 7221 HSeqStringGetChar(String::Encoding encoding,
7240 HValue* string, 7222 HValue* string,
7241 HValue* index) : encoding_(encoding) { 7223 HValue* index) : encoding_(encoding) {
7242 SetOperandAt(0, string); 7224 SetOperandAt(0, string);
7243 SetOperandAt(1, index); 7225 SetOperandAt(1, index);
7244 set_representation(Representation::Integer32()); 7226 set_representation(Representation::Integer32());
7245 SetFlag(kUseGVN); 7227 SetFlag(kUseGVN);
7246 SetGVNFlag(kDependsOnStringChars); 7228 SetDependsOnFlag(kStringChars);
7247 } 7229 }
7248 7230
7249 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7231 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7250 7232
7251 String::Encoding encoding_; 7233 String::Encoding encoding_;
7252 }; 7234 };
7253 7235
7254 7236
7255 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<4> { 7237 class HSeqStringSetChar V8_FINAL : public HTemplateInstruction<4> {
7256 public: 7238 public:
(...skipping 18 matching lines...) Expand all
7275 HSeqStringSetChar(HValue* context, 7257 HSeqStringSetChar(HValue* context,
7276 String::Encoding encoding, 7258 String::Encoding encoding,
7277 HValue* string, 7259 HValue* string,
7278 HValue* index, 7260 HValue* index,
7279 HValue* value) : encoding_(encoding) { 7261 HValue* value) : encoding_(encoding) {
7280 SetOperandAt(0, context); 7262 SetOperandAt(0, context);
7281 SetOperandAt(1, string); 7263 SetOperandAt(1, string);
7282 SetOperandAt(2, index); 7264 SetOperandAt(2, index);
7283 SetOperandAt(3, value); 7265 SetOperandAt(3, value);
7284 set_representation(Representation::Tagged()); 7266 set_representation(Representation::Tagged());
7285 SetGVNFlag(kChangesStringChars); 7267 SetChangesFlag(kStringChars);
7286 } 7268 }
7287 7269
7288 String::Encoding encoding_; 7270 String::Encoding encoding_;
7289 }; 7271 };
7290 7272
7291 7273
7292 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> { 7274 class HCheckMapValue V8_FINAL : public HTemplateInstruction<2> {
7293 public: 7275 public:
7294 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); 7276 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*);
7295 7277
(...skipping 19 matching lines...) Expand all
7315 return true; 7297 return true;
7316 } 7298 }
7317 7299
7318 private: 7300 private:
7319 HCheckMapValue(HValue* value, 7301 HCheckMapValue(HValue* value,
7320 HValue* map) { 7302 HValue* map) {
7321 SetOperandAt(0, value); 7303 SetOperandAt(0, value);
7322 SetOperandAt(1, map); 7304 SetOperandAt(1, map);
7323 set_representation(Representation::Tagged()); 7305 set_representation(Representation::Tagged());
7324 SetFlag(kUseGVN); 7306 SetFlag(kUseGVN);
7325 SetGVNFlag(kDependsOnMaps); 7307 SetDependsOnFlag(kMaps);
7326 SetGVNFlag(kDependsOnElementsKind); 7308 SetDependsOnFlag(kElementsKind);
7327 } 7309 }
7328 }; 7310 };
7329 7311
7330 7312
7331 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> { 7313 class HForInPrepareMap V8_FINAL : public HTemplateInstruction<2> {
7332 public: 7314 public:
7333 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*); 7315 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HForInPrepareMap, HValue*);
7334 7316
7335 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7317 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7336 return Representation::Tagged(); 7318 return Representation::Tagged();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
7428 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7410 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7429 }; 7411 };
7430 7412
7431 7413
7432 #undef DECLARE_INSTRUCTION 7414 #undef DECLARE_INSTRUCTION
7433 #undef DECLARE_CONCRETE_INSTRUCTION 7415 #undef DECLARE_CONCRETE_INSTRUCTION
7434 7416
7435 } } // namespace v8::internal 7417 } } // namespace v8::internal
7436 7418
7437 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7419 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen-gvn.h ('K') | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698