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

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

Issue 9233005: Split side-effect flags from flags in Hydrogen instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix whitespace Created 8 years, 11 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 HUseListNode* current_; 486 HUseListNode* current_;
487 HUseListNode* next_; 487 HUseListNode* next_;
488 HValue* value_; 488 HValue* value_;
489 int index_; 489 int index_;
490 490
491 friend class HValue; 491 friend class HValue;
492 }; 492 };
493 493
494 494
495 // There must be one corresponding kDepends flag for every kChanges flag and
496 // the order of the kChanges flags must be exactly the same as of the kDepends
497 // flags.
498 enum GVNFlag {
499 // Declare global value numbering flags.
500 #define DECLARE_FLAG(type) kChanges##type, kDependsOn##type,
501 GVN_FLAG_LIST(DECLARE_FLAG)
502 #undef DECLARE_FLAG
503 kAfterLastFlag,
504 kLastFlag = kAfterLastFlag - 1
505 };
506
507 typedef EnumSet<GVNFlag> GVNFlagSet;
508
509
495 class HValue: public ZoneObject { 510 class HValue: public ZoneObject {
496 public: 511 public:
497 static const int kNoNumber = -1; 512 static const int kNoNumber = -1;
498 513
499 // There must be one corresponding kDepends flag for every kChanges flag and
500 // the order of the kChanges flags must be exactly the same as of the kDepends
501 // flags.
502 enum Flag { 514 enum Flag {
503 // Declare global value numbering flags.
504 #define DECLARE_DO(type) kChanges##type, kDependsOn##type,
505 GVN_FLAG_LIST(DECLARE_DO)
506 #undef DECLARE_DO
507 kFlexibleRepresentation, 515 kFlexibleRepresentation,
508 // Participate in Global Value Numbering, i.e. elimination of 516 // Participate in Global Value Numbering, i.e. elimination of
509 // unnecessary recomputations. If an instruction sets this flag, it must 517 // unnecessary recomputations. If an instruction sets this flag, it must
510 // implement DataEquals(), which will be used to determine if other 518 // implement DataEquals(), which will be used to determine if other
511 // occurrences of the instruction are indeed the same. 519 // occurrences of the instruction are indeed the same.
512 kUseGVN, 520 kUseGVN,
513 kCanOverflow, 521 kCanOverflow,
514 kBailoutOnMinusZero, 522 kBailoutOnMinusZero,
515 kCanBeDivByZero, 523 kCanBeDivByZero,
516 kDeoptimizeOnUndefined, 524 kDeoptimizeOnUndefined,
517 kIsArguments, 525 kIsArguments,
518 kTruncatingToInt32, 526 kTruncatingToInt32,
519 kLastFlag = kTruncatingToInt32 527 kLastFlag = kTruncatingToInt32
520 }; 528 };
521 529
522 STATIC_ASSERT(kLastFlag < kBitsPerInt); 530 STATIC_ASSERT(kLastFlag < kBitsPerInt);
523 531
524 static const int kChangesToDependsFlagsLeftShift = 1; 532 static const int kChangesToDependsFlagsLeftShift = 1;
525 533
526 static int ConvertChangesToDependsFlags(int flags) { 534 static GVNFlagSet ConvertChangesToDependsFlags(GVNFlagSet flags) {
527 return flags << kChangesToDependsFlagsLeftShift; 535 return GVNFlagSet(flags.ToIntegral() << kChangesToDependsFlagsLeftShift);
528 } 536 }
529 537
530 static HValue* cast(HValue* value) { return value; } 538 static HValue* cast(HValue* value) { return value; }
531 539
532 enum Opcode { 540 enum Opcode {
533 // Declare a unique enum value for each hydrogen instruction. 541 // Declare a unique enum value for each hydrogen instruction.
534 #define DECLARE_OPCODE(type) k##type, 542 #define DECLARE_OPCODE(type) k##type,
535 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE) 543 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_OPCODE)
536 kPhi 544 kPhi
537 #undef DECLARE_OPCODE 545 #undef DECLARE_OPCODE
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 return use_list_ != NULL && use_list_->tail() != NULL; 623 return use_list_ != NULL && use_list_->tail() != NULL;
616 } 624 }
617 int UseCount() const; 625 int UseCount() const;
618 void ClearOperands(); 626 void ClearOperands();
619 627
620 int flags() const { return flags_; } 628 int flags() const { return flags_; }
621 void SetFlag(Flag f) { flags_ |= (1 << f); } 629 void SetFlag(Flag f) { flags_ |= (1 << f); }
622 void ClearFlag(Flag f) { flags_ &= ~(1 << f); } 630 void ClearFlag(Flag f) { flags_ &= ~(1 << f); }
623 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } 631 bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; }
624 632
625 void SetAllSideEffects() { flags_ |= AllSideEffects(); } 633 GVNFlagSet gvn_flags() const { return gvn_flags_; }
626 void ClearAllSideEffects() { flags_ &= ~AllSideEffects(); } 634 void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); }
627 bool HasSideEffects() const { return (flags_ & AllSideEffects()) != 0; } 635 void ClearGVNFlag(GVNFlag f) { gvn_flags_.Remove(f); }
636 bool CheckGVNFlag(GVNFlag f) const { return gvn_flags_.Contains(f); }
637 void SetAllSideEffects() { gvn_flags_.Add(AllSideEffectsFlagSet()); }
638 void ClearAllSideEffects() {
639 gvn_flags_.Remove(AllSideEffectsFlagSet());
640 }
641 bool HasSideEffects() const {
642 return gvn_flags_.ContainsAnyOf(AllSideEffectsFlagSet());
643 }
628 bool HasObservableSideEffects() const { 644 bool HasObservableSideEffects() const {
629 return (flags_ & ObservableSideEffects()) != 0; 645 return gvn_flags_.ContainsAnyOf(AllObservableSideEffectsFlagSet());
630 } 646 }
631 647
632 int ChangesFlags() const { return flags_ & ChangesFlagsMask(); } 648 GVNFlagSet ChangesFlags() const {
633 int ObservableChangesFlags() const { 649 GVNFlagSet result = gvn_flags_;
634 return flags_ & ChangesFlagsMask() & ObservableSideEffects(); 650 result.Intersect(AllChangesFlagSet());
651 return result;
652 }
653
654 GVNFlagSet ObservableChangesFlags() const {
655 GVNFlagSet result = gvn_flags_;
656 result.Intersect(AllChangesFlagSet());
657 result.Intersect(AllObservableSideEffectsFlagSet());
658 return result;
635 } 659 }
636 660
637 Range* range() const { return range_; } 661 Range* range() const { return range_; }
638 bool HasRange() const { return range_ != NULL; } 662 bool HasRange() const { return range_ != NULL; }
639 void AddNewRange(Range* r); 663 void AddNewRange(Range* r);
640 void RemoveLastAddedRange(); 664 void RemoveLastAddedRange();
641 void ComputeInitialRange(); 665 void ComputeInitialRange();
642 666
643 // Representation helpers. 667 // Representation helpers.
644 virtual Representation RequiredInputRepresentation(int index) = 0; 668 virtual Representation RequiredInputRepresentation(int index) = 0;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 ASSERT(block_ != NULL); 714 ASSERT(block_ != NULL);
691 block_ = NULL; 715 block_ = NULL;
692 } 716 }
693 717
694 void set_representation(Representation r) { 718 void set_representation(Representation r) {
695 // Representation is set-once. 719 // Representation is set-once.
696 ASSERT(representation_.IsNone() && !r.IsNone()); 720 ASSERT(representation_.IsNone() && !r.IsNone());
697 representation_ = r; 721 representation_ = r;
698 } 722 }
699 723
700 private: 724 static GVNFlagSet AllChangesFlagSet() {
701 static int ChangesFlagsMask() { 725 GVNFlagSet result;
702 int result = 0;
703 // Create changes mask. 726 // Create changes mask.
704 #define ADD_FLAG(type) result |= (1 << kChanges##type); 727 #define ADD_FLAG(type) result.Add(kChanges##type);
705 GVN_FLAG_LIST(ADD_FLAG) 728 GVN_FLAG_LIST(ADD_FLAG)
706 #undef ADD_FLAG 729 #undef ADD_FLAG
707 return result; 730 return result;
708 } 731 }
709 732
710 // A flag mask to mark an instruction as having arbitrary side effects. 733 // A flag mask to mark an instruction as having arbitrary side effects.
711 static int AllSideEffects() { 734 static GVNFlagSet AllSideEffectsFlagSet() {
712 return ChangesFlagsMask() & ~(1 << kChangesOsrEntries); 735 GVNFlagSet result = AllChangesFlagSet();
736 result.Remove(kChangesOsrEntries);
737 return result;
713 } 738 }
714 739
715 // A flag mask of all side effects that can make observable changes in 740 // A flag mask of all side effects that can make observable changes in
716 // an executing program (i.e. are not safe to repeat, move or remove); 741 // an executing program (i.e. are not safe to repeat, move or remove);
717 static int ObservableSideEffects() { 742 static GVNFlagSet AllObservableSideEffectsFlagSet() {
718 return ChangesFlagsMask() & ~(1 << kChangesElementsKind); 743 GVNFlagSet result = AllChangesFlagSet();
744 result.Remove(kChangesElementsKind);
745 return result;
719 } 746 }
720 747
721 // Remove the matching use from the use list if present. Returns the 748 // Remove the matching use from the use list if present. Returns the
722 // removed list node or NULL. 749 // removed list node or NULL.
723 HUseListNode* RemoveUse(HValue* value, int index); 750 HUseListNode* RemoveUse(HValue* value, int index);
724 751
725 void RegisterUse(int index, HValue* new_value); 752 void RegisterUse(int index, HValue* new_value);
726 753
727 HBasicBlock* block_; 754 HBasicBlock* block_;
728 755
729 // The id of this instruction in the hydrogen graph, assigned when first 756 // The id of this instruction in the hydrogen graph, assigned when first
730 // added to the graph. Reflects creation order. 757 // added to the graph. Reflects creation order.
731 int id_; 758 int id_;
732 759
733 Representation representation_; 760 Representation representation_;
734 HType type_; 761 HType type_;
735 HUseListNode* use_list_; 762 HUseListNode* use_list_;
736 Range* range_; 763 Range* range_;
737 int flags_; 764 int flags_;
765 GVNFlagSet gvn_flags_;
738 766
739 DISALLOW_COPY_AND_ASSIGN(HValue); 767 DISALLOW_COPY_AND_ASSIGN(HValue);
740 }; 768 };
741 769
742 770
743 class HInstruction: public HValue { 771 class HInstruction: public HValue {
744 public: 772 public:
745 HInstruction* next() const { return next_; } 773 HInstruction* next() const { return next_; }
746 HInstruction* previous() const { return previous_; } 774 HInstruction* previous() const { return previous_; }
747 775
(...skipping 17 matching lines...) Expand all
765 793
766 virtual bool IsCall() { return false; } 794 virtual bool IsCall() { return false; }
767 795
768 DECLARE_ABSTRACT_INSTRUCTION(Instruction) 796 DECLARE_ABSTRACT_INSTRUCTION(Instruction)
769 797
770 protected: 798 protected:
771 HInstruction() 799 HInstruction()
772 : next_(NULL), 800 : next_(NULL),
773 previous_(NULL), 801 previous_(NULL),
774 position_(RelocInfo::kNoPosition) { 802 position_(RelocInfo::kNoPosition) {
775 SetFlag(kDependsOnOsrEntries); 803 SetGVNFlag(kDependsOnOsrEntries);
776 } 804 }
777 805
778 virtual void DeleteFromGraph() { Unlink(); } 806 virtual void DeleteFromGraph() { Unlink(); }
779 807
780 private: 808 private:
781 void InitializeAsFirst(HBasicBlock* block) { 809 void InitializeAsFirst(HBasicBlock* block) {
782 ASSERT(!IsLinked()); 810 ASSERT(!IsLinked());
783 SetBlock(block); 811 SetBlock(block);
784 } 812 }
785 813
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 class HJSArrayLength: public HTemplateInstruction<2> { 1737 class HJSArrayLength: public HTemplateInstruction<2> {
1710 public: 1738 public:
1711 HJSArrayLength(HValue* value, HValue* typecheck) { 1739 HJSArrayLength(HValue* value, HValue* typecheck) {
1712 // The length of an array is stored as a tagged value in the array 1740 // The length of an array is stored as a tagged value in the array
1713 // object. It is guaranteed to be 32 bit integer, but it can be 1741 // object. It is guaranteed to be 32 bit integer, but it can be
1714 // represented as either a smi or heap number. 1742 // represented as either a smi or heap number.
1715 SetOperandAt(0, value); 1743 SetOperandAt(0, value);
1716 SetOperandAt(1, typecheck); 1744 SetOperandAt(1, typecheck);
1717 set_representation(Representation::Tagged()); 1745 set_representation(Representation::Tagged());
1718 SetFlag(kUseGVN); 1746 SetFlag(kUseGVN);
1719 SetFlag(kDependsOnArrayLengths); 1747 SetGVNFlag(kDependsOnArrayLengths);
1720 SetFlag(kDependsOnMaps); 1748 SetGVNFlag(kDependsOnMaps);
1721 } 1749 }
1722 1750
1723 virtual Representation RequiredInputRepresentation(int index) { 1751 virtual Representation RequiredInputRepresentation(int index) {
1724 return Representation::Tagged(); 1752 return Representation::Tagged();
1725 } 1753 }
1726 1754
1727 virtual void PrintDataTo(StringStream* stream); 1755 virtual void PrintDataTo(StringStream* stream);
1728 1756
1729 HValue* value() { return OperandAt(0); } 1757 HValue* value() { return OperandAt(0); }
1730 HValue* typecheck() { return OperandAt(1); } 1758 HValue* typecheck() { return OperandAt(1); }
1731 1759
1732 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength) 1760 DECLARE_CONCRETE_INSTRUCTION(JSArrayLength)
1733 1761
1734 protected: 1762 protected:
1735 virtual bool DataEquals(HValue* other) { return true; } 1763 virtual bool DataEquals(HValue* other) { return true; }
1736 }; 1764 };
1737 1765
1738 1766
1739 class HFixedArrayBaseLength: public HUnaryOperation { 1767 class HFixedArrayBaseLength: public HUnaryOperation {
1740 public: 1768 public:
1741 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) { 1769 explicit HFixedArrayBaseLength(HValue* value) : HUnaryOperation(value) {
1742 set_representation(Representation::Tagged()); 1770 set_representation(Representation::Tagged());
1743 SetFlag(kUseGVN); 1771 SetFlag(kUseGVN);
1744 SetFlag(kDependsOnArrayLengths); 1772 SetGVNFlag(kDependsOnArrayLengths);
1745 } 1773 }
1746 1774
1747 virtual Representation RequiredInputRepresentation(int index) { 1775 virtual Representation RequiredInputRepresentation(int index) {
1748 return Representation::Tagged(); 1776 return Representation::Tagged();
1749 } 1777 }
1750 1778
1751 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength) 1779 DECLARE_CONCRETE_INSTRUCTION(FixedArrayBaseLength)
1752 1780
1753 protected: 1781 protected:
1754 virtual bool DataEquals(HValue* other) { return true; } 1782 virtual bool DataEquals(HValue* other) { return true; }
1755 }; 1783 };
1756 1784
1757 1785
1758 class HElementsKind: public HUnaryOperation { 1786 class HElementsKind: public HUnaryOperation {
1759 public: 1787 public:
1760 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { 1788 explicit HElementsKind(HValue* value) : HUnaryOperation(value) {
1761 set_representation(Representation::Integer32()); 1789 set_representation(Representation::Integer32());
1762 SetFlag(kUseGVN); 1790 SetFlag(kUseGVN);
1763 SetFlag(kDependsOnElementsKind); 1791 SetGVNFlag(kDependsOnElementsKind);
1764 } 1792 }
1765 1793
1766 virtual Representation RequiredInputRepresentation(int index) { 1794 virtual Representation RequiredInputRepresentation(int index) {
1767 return Representation::Tagged(); 1795 return Representation::Tagged();
1768 } 1796 }
1769 1797
1770 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) 1798 DECLARE_CONCRETE_INSTRUCTION(ElementsKind)
1771 1799
1772 protected: 1800 protected:
1773 virtual bool DataEquals(HValue* other) { return true; } 1801 virtual bool DataEquals(HValue* other) { return true; }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 private: 1907 private:
1880 BuiltinFunctionId op_; 1908 BuiltinFunctionId op_;
1881 }; 1909 };
1882 1910
1883 1911
1884 class HLoadElements: public HUnaryOperation { 1912 class HLoadElements: public HUnaryOperation {
1885 public: 1913 public:
1886 explicit HLoadElements(HValue* value) : HUnaryOperation(value) { 1914 explicit HLoadElements(HValue* value) : HUnaryOperation(value) {
1887 set_representation(Representation::Tagged()); 1915 set_representation(Representation::Tagged());
1888 SetFlag(kUseGVN); 1916 SetFlag(kUseGVN);
1889 SetFlag(kDependsOnMaps); 1917 SetGVNFlag(kDependsOnMaps);
1890 SetFlag(kDependsOnElementsKind); 1918 SetGVNFlag(kDependsOnElementsKind);
1891 } 1919 }
1892 1920
1893 virtual Representation RequiredInputRepresentation(int index) { 1921 virtual Representation RequiredInputRepresentation(int index) {
1894 return Representation::Tagged(); 1922 return Representation::Tagged();
1895 } 1923 }
1896 1924
1897 DECLARE_CONCRETE_INSTRUCTION(LoadElements) 1925 DECLARE_CONCRETE_INSTRUCTION(LoadElements)
1898 1926
1899 protected: 1927 protected:
1900 virtual bool DataEquals(HValue* other) { return true; } 1928 virtual bool DataEquals(HValue* other) { return true; }
(...skipping 29 matching lines...) Expand all
1930 HValue* typecheck = NULL, 1958 HValue* typecheck = NULL,
1931 CompareMapMode mode = REQUIRE_EXACT_MAP) 1959 CompareMapMode mode = REQUIRE_EXACT_MAP)
1932 : map_(map), 1960 : map_(map),
1933 mode_(mode) { 1961 mode_(mode) {
1934 SetOperandAt(0, value); 1962 SetOperandAt(0, value);
1935 // If callers don't depend on a typecheck, they can pass in NULL. In that 1963 // If callers don't depend on a typecheck, they can pass in NULL. In that
1936 // case we use a copy of the |value| argument as a dummy value. 1964 // case we use a copy of the |value| argument as a dummy value.
1937 SetOperandAt(1, typecheck != NULL ? typecheck : value); 1965 SetOperandAt(1, typecheck != NULL ? typecheck : value);
1938 set_representation(Representation::Tagged()); 1966 set_representation(Representation::Tagged());
1939 SetFlag(kUseGVN); 1967 SetFlag(kUseGVN);
1940 SetFlag(kDependsOnMaps); 1968 SetGVNFlag(kDependsOnMaps);
1941 has_element_transitions_ = 1969 has_element_transitions_ =
1942 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL) != NULL || 1970 map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, NULL) != NULL ||
1943 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL) != NULL; 1971 map->LookupElementsTransitionMap(FAST_ELEMENTS, NULL) != NULL;
1944 } 1972 }
1945 1973
1946 virtual Representation RequiredInputRepresentation(int index) { 1974 virtual Representation RequiredInputRepresentation(int index) {
1947 return Representation::Tagged(); 1975 return Representation::Tagged();
1948 } 1976 }
1949 virtual void PrintDataTo(StringStream* stream); 1977 virtual void PrintDataTo(StringStream* stream);
1950 virtual HType CalculateInferredType(); 1978 virtual HType CalculateInferredType();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 protected: 2126 protected:
2099 virtual bool DataEquals(HValue* other) { return true; } 2127 virtual bool DataEquals(HValue* other) { return true; }
2100 }; 2128 };
2101 2129
2102 2130
2103 class HCheckPrototypeMaps: public HTemplateInstruction<0> { 2131 class HCheckPrototypeMaps: public HTemplateInstruction<0> {
2104 public: 2132 public:
2105 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder) 2133 HCheckPrototypeMaps(Handle<JSObject> prototype, Handle<JSObject> holder)
2106 : prototype_(prototype), holder_(holder) { 2134 : prototype_(prototype), holder_(holder) {
2107 SetFlag(kUseGVN); 2135 SetFlag(kUseGVN);
2108 SetFlag(kDependsOnMaps); 2136 SetGVNFlag(kDependsOnMaps);
2109 } 2137 }
2110 2138
2111 #ifdef DEBUG 2139 #ifdef DEBUG
2112 virtual void Verify(); 2140 virtual void Verify();
2113 #endif 2141 #endif
2114 2142
2115 Handle<JSObject> prototype() const { return prototype_; } 2143 Handle<JSObject> prototype() const { return prototype_; }
2116 Handle<JSObject> holder() const { return holder_; } 2144 Handle<JSObject> holder() const { return holder_; }
2117 2145
2118 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) 2146 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps)
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3248 DECLARE_CONCRETE_INSTRUCTION(Sar) 3276 DECLARE_CONCRETE_INSTRUCTION(Sar)
3249 3277
3250 protected: 3278 protected:
3251 virtual bool DataEquals(HValue* other) { return true; } 3279 virtual bool DataEquals(HValue* other) { return true; }
3252 }; 3280 };
3253 3281
3254 3282
3255 class HOsrEntry: public HTemplateInstruction<0> { 3283 class HOsrEntry: public HTemplateInstruction<0> {
3256 public: 3284 public:
3257 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) { 3285 explicit HOsrEntry(int ast_id) : ast_id_(ast_id) {
3258 SetFlag(kChangesOsrEntries); 3286 SetGVNFlag(kChangesOsrEntries);
3259 } 3287 }
3260 3288
3261 int ast_id() const { return ast_id_; } 3289 int ast_id() const { return ast_id_; }
3262 3290
3263 virtual Representation RequiredInputRepresentation(int index) { 3291 virtual Representation RequiredInputRepresentation(int index) {
3264 return Representation::None(); 3292 return Representation::None();
3265 } 3293 }
3266 3294
3267 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) 3295 DECLARE_CONCRETE_INSTRUCTION(OsrEntry)
3268 3296
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3336 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) 3364 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue)
3337 }; 3365 };
3338 3366
3339 3367
3340 class HLoadGlobalCell: public HTemplateInstruction<0> { 3368 class HLoadGlobalCell: public HTemplateInstruction<0> {
3341 public: 3369 public:
3342 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details) 3370 HLoadGlobalCell(Handle<JSGlobalPropertyCell> cell, PropertyDetails details)
3343 : cell_(cell), details_(details) { 3371 : cell_(cell), details_(details) {
3344 set_representation(Representation::Tagged()); 3372 set_representation(Representation::Tagged());
3345 SetFlag(kUseGVN); 3373 SetFlag(kUseGVN);
3346 SetFlag(kDependsOnGlobalVars); 3374 SetGVNFlag(kDependsOnGlobalVars);
3347 } 3375 }
3348 3376
3349 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 3377 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
3350 bool RequiresHoleCheck(); 3378 bool RequiresHoleCheck();
3351 3379
3352 virtual void PrintDataTo(StringStream* stream); 3380 virtual void PrintDataTo(StringStream* stream);
3353 3381
3354 virtual intptr_t Hashcode() { 3382 virtual intptr_t Hashcode() {
3355 ASSERT(!HEAP->allow_allocation(false)); 3383 ASSERT(!HEAP->allow_allocation(false));
3356 return reinterpret_cast<intptr_t>(*cell_); 3384 return reinterpret_cast<intptr_t>(*cell_);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3415 3443
3416 3444
3417 class HStoreGlobalCell: public HUnaryOperation { 3445 class HStoreGlobalCell: public HUnaryOperation {
3418 public: 3446 public:
3419 HStoreGlobalCell(HValue* value, 3447 HStoreGlobalCell(HValue* value,
3420 Handle<JSGlobalPropertyCell> cell, 3448 Handle<JSGlobalPropertyCell> cell,
3421 PropertyDetails details) 3449 PropertyDetails details)
3422 : HUnaryOperation(value), 3450 : HUnaryOperation(value),
3423 cell_(cell), 3451 cell_(cell),
3424 details_(details) { 3452 details_(details) {
3425 SetFlag(kChangesGlobalVars); 3453 SetGVNFlag(kChangesGlobalVars);
3426 } 3454 }
3427 3455
3428 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 3456 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
3429 bool RequiresHoleCheck() { 3457 bool RequiresHoleCheck() {
3430 return !details_.IsDontDelete() || details_.IsReadOnly(); 3458 return !details_.IsDontDelete() || details_.IsReadOnly();
3431 } 3459 }
3432 bool NeedsWriteBarrier() { 3460 bool NeedsWriteBarrier() {
3433 return StoringValueNeedsWriteBarrier(value()); 3461 return StoringValueNeedsWriteBarrier(value());
3434 } 3462 }
3435 3463
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3506 mode_ = kCheckDeoptimize; 3534 mode_ = kCheckDeoptimize;
3507 break; 3535 break;
3508 case CONST: 3536 case CONST:
3509 mode_ = kCheckReturnUndefined; 3537 mode_ = kCheckReturnUndefined;
3510 break; 3538 break;
3511 default: 3539 default:
3512 mode_ = kNoCheck; 3540 mode_ = kNoCheck;
3513 } 3541 }
3514 set_representation(Representation::Tagged()); 3542 set_representation(Representation::Tagged());
3515 SetFlag(kUseGVN); 3543 SetFlag(kUseGVN);
3516 SetFlag(kDependsOnContextSlots); 3544 SetGVNFlag(kDependsOnContextSlots);
3517 } 3545 }
3518 3546
3519 int slot_index() const { return slot_index_; } 3547 int slot_index() const { return slot_index_; }
3520 Mode mode() const { return mode_; } 3548 Mode mode() const { return mode_; }
3521 3549
3522 bool DeoptimizesOnHole() { 3550 bool DeoptimizesOnHole() {
3523 return mode_ == kCheckDeoptimize; 3551 return mode_ == kCheckDeoptimize;
3524 } 3552 }
3525 3553
3526 bool RequiresHoleCheck() { 3554 bool RequiresHoleCheck() {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 // which will subsequently throw a reference error. 3587 // which will subsequently throw a reference error.
3560 kCheckDeoptimize, 3588 kCheckDeoptimize,
3561 // Check the previous value and ignore assignment if it isn't a hole value 3589 // Check the previous value and ignore assignment if it isn't a hole value
3562 kCheckIgnoreAssignment 3590 kCheckIgnoreAssignment
3563 }; 3591 };
3564 3592
3565 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) 3593 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value)
3566 : slot_index_(slot_index), mode_(mode) { 3594 : slot_index_(slot_index), mode_(mode) {
3567 SetOperandAt(0, context); 3595 SetOperandAt(0, context);
3568 SetOperandAt(1, value); 3596 SetOperandAt(1, value);
3569 SetFlag(kChangesContextSlots); 3597 SetGVNFlag(kChangesContextSlots);
3570 } 3598 }
3571 3599
3572 HValue* context() { return OperandAt(0); } 3600 HValue* context() { return OperandAt(0); }
3573 HValue* value() { return OperandAt(1); } 3601 HValue* value() { return OperandAt(1); }
3574 int slot_index() const { return slot_index_; } 3602 int slot_index() const { return slot_index_; }
3575 Mode mode() const { return mode_; } 3603 Mode mode() const { return mode_; }
3576 3604
3577 bool NeedsWriteBarrier() { 3605 bool NeedsWriteBarrier() {
3578 return StoringValueNeedsWriteBarrier(value()); 3606 return StoringValueNeedsWriteBarrier(value());
3579 } 3607 }
(...skipping 21 matching lines...) Expand all
3601 3629
3602 3630
3603 class HLoadNamedField: public HUnaryOperation { 3631 class HLoadNamedField: public HUnaryOperation {
3604 public: 3632 public:
3605 HLoadNamedField(HValue* object, bool is_in_object, int offset) 3633 HLoadNamedField(HValue* object, bool is_in_object, int offset)
3606 : HUnaryOperation(object), 3634 : HUnaryOperation(object),
3607 is_in_object_(is_in_object), 3635 is_in_object_(is_in_object),
3608 offset_(offset) { 3636 offset_(offset) {
3609 set_representation(Representation::Tagged()); 3637 set_representation(Representation::Tagged());
3610 SetFlag(kUseGVN); 3638 SetFlag(kUseGVN);
3611 SetFlag(kDependsOnMaps); 3639 SetGVNFlag(kDependsOnMaps);
3612 if (is_in_object) { 3640 if (is_in_object) {
3613 SetFlag(kDependsOnInobjectFields); 3641 SetGVNFlag(kDependsOnInobjectFields);
3614 } else { 3642 } else {
3615 SetFlag(kDependsOnBackingStoreFields); 3643 SetGVNFlag(kDependsOnBackingStoreFields);
3616 } 3644 }
3617 } 3645 }
3618 3646
3619 HValue* object() { return OperandAt(0); } 3647 HValue* object() { return OperandAt(0); }
3620 bool is_in_object() const { return is_in_object_; } 3648 bool is_in_object() const { return is_in_object_; }
3621 int offset() const { return offset_; } 3649 int offset() const { return offset_; }
3622 3650
3623 virtual Representation RequiredInputRepresentation(int index) { 3651 virtual Representation RequiredInputRepresentation(int index) {
3624 return Representation::Tagged(); 3652 return Representation::Tagged();
3625 } 3653 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 Handle<Object> name_; 3727 Handle<Object> name_;
3700 }; 3728 };
3701 3729
3702 3730
3703 class HLoadFunctionPrototype: public HUnaryOperation { 3731 class HLoadFunctionPrototype: public HUnaryOperation {
3704 public: 3732 public:
3705 explicit HLoadFunctionPrototype(HValue* function) 3733 explicit HLoadFunctionPrototype(HValue* function)
3706 : HUnaryOperation(function) { 3734 : HUnaryOperation(function) {
3707 set_representation(Representation::Tagged()); 3735 set_representation(Representation::Tagged());
3708 SetFlag(kUseGVN); 3736 SetFlag(kUseGVN);
3709 SetFlag(kDependsOnCalls); 3737 SetGVNFlag(kDependsOnCalls);
3710 } 3738 }
3711 3739
3712 HValue* function() { return OperandAt(0); } 3740 HValue* function() { return OperandAt(0); }
3713 3741
3714 virtual Representation RequiredInputRepresentation(int index) { 3742 virtual Representation RequiredInputRepresentation(int index) {
3715 return Representation::Tagged(); 3743 return Representation::Tagged();
3716 } 3744 }
3717 3745
3718 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype) 3746 DECLARE_CONCRETE_INSTRUCTION(LoadFunctionPrototype)
3719 3747
3720 protected: 3748 protected:
3721 virtual bool DataEquals(HValue* other) { return true; } 3749 virtual bool DataEquals(HValue* other) { return true; }
3722 }; 3750 };
3723 3751
3724 3752
3725 class HLoadKeyedFastElement: public HTemplateInstruction<2> { 3753 class HLoadKeyedFastElement: public HTemplateInstruction<2> {
3726 public: 3754 public:
3727 HLoadKeyedFastElement(HValue* obj, HValue* key) { 3755 HLoadKeyedFastElement(HValue* obj, HValue* key) {
3728 SetOperandAt(0, obj); 3756 SetOperandAt(0, obj);
3729 SetOperandAt(1, key); 3757 SetOperandAt(1, key);
3730 set_representation(Representation::Tagged()); 3758 set_representation(Representation::Tagged());
3731 SetFlag(kDependsOnArrayElements); 3759 SetGVNFlag(kDependsOnArrayElements);
3732 SetFlag(kUseGVN); 3760 SetFlag(kUseGVN);
3733 } 3761 }
3734 3762
3735 HValue* object() { return OperandAt(0); } 3763 HValue* object() { return OperandAt(0); }
3736 HValue* key() { return OperandAt(1); } 3764 HValue* key() { return OperandAt(1); }
3737 3765
3738 virtual Representation RequiredInputRepresentation(int index) { 3766 virtual Representation RequiredInputRepresentation(int index) {
3739 // The key is supposed to be Integer32. 3767 // The key is supposed to be Integer32.
3740 return index == 0 3768 return index == 0
3741 ? Representation::Tagged() 3769 ? Representation::Tagged()
(...skipping 10 matching lines...) Expand all
3752 virtual bool DataEquals(HValue* other) { return true; } 3780 virtual bool DataEquals(HValue* other) { return true; }
3753 }; 3781 };
3754 3782
3755 3783
3756 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> { 3784 class HLoadKeyedFastDoubleElement: public HTemplateInstruction<2> {
3757 public: 3785 public:
3758 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) { 3786 HLoadKeyedFastDoubleElement(HValue* elements, HValue* key) {
3759 SetOperandAt(0, elements); 3787 SetOperandAt(0, elements);
3760 SetOperandAt(1, key); 3788 SetOperandAt(1, key);
3761 set_representation(Representation::Double()); 3789 set_representation(Representation::Double());
3762 SetFlag(kDependsOnDoubleArrayElements); 3790 SetGVNFlag(kDependsOnDoubleArrayElements);
3763 SetFlag(kUseGVN); 3791 SetFlag(kUseGVN);
3764 } 3792 }
3765 3793
3766 HValue* elements() { return OperandAt(0); } 3794 HValue* elements() { return OperandAt(0); }
3767 HValue* key() { return OperandAt(1); } 3795 HValue* key() { return OperandAt(1); }
3768 3796
3769 virtual Representation RequiredInputRepresentation(int index) { 3797 virtual Representation RequiredInputRepresentation(int index) {
3770 // The key is supposed to be Integer32. 3798 // The key is supposed to be Integer32.
3771 return index == 0 3799 return index == 0
3772 ? Representation::Tagged() 3800 ? Representation::Tagged()
(...skipping 16 matching lines...) Expand all
3789 ElementsKind elements_kind) 3817 ElementsKind elements_kind)
3790 : elements_kind_(elements_kind) { 3818 : elements_kind_(elements_kind) {
3791 SetOperandAt(0, external_elements); 3819 SetOperandAt(0, external_elements);
3792 SetOperandAt(1, key); 3820 SetOperandAt(1, key);
3793 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || 3821 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS ||
3794 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { 3822 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) {
3795 set_representation(Representation::Double()); 3823 set_representation(Representation::Double());
3796 } else { 3824 } else {
3797 set_representation(Representation::Integer32()); 3825 set_representation(Representation::Integer32());
3798 } 3826 }
3799 SetFlag(kDependsOnSpecializedArrayElements); 3827 SetGVNFlag(kDependsOnSpecializedArrayElements);
3800 // Native code could change the specialized array. 3828 // Native code could change the specialized array.
3801 SetFlag(kDependsOnCalls); 3829 SetGVNFlag(kDependsOnCalls);
3802 SetFlag(kUseGVN); 3830 SetFlag(kUseGVN);
3803 } 3831 }
3804 3832
3805 virtual void PrintDataTo(StringStream* stream); 3833 virtual void PrintDataTo(StringStream* stream);
3806 3834
3807 virtual Representation RequiredInputRepresentation(int index) { 3835 virtual Representation RequiredInputRepresentation(int index) {
3808 // The key is supposed to be Integer32, but the base pointer 3836 // The key is supposed to be Integer32, but the base pointer
3809 // for the element load is a naked pointer. 3837 // for the element load is a naked pointer.
3810 return index == 0 3838 return index == 0
3811 ? Representation::External() 3839 ? Representation::External()
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3861 Handle<String> name, 3889 Handle<String> name,
3862 HValue* val, 3890 HValue* val,
3863 bool in_object, 3891 bool in_object,
3864 int offset) 3892 int offset)
3865 : name_(name), 3893 : name_(name),
3866 is_in_object_(in_object), 3894 is_in_object_(in_object),
3867 offset_(offset) { 3895 offset_(offset) {
3868 SetOperandAt(0, obj); 3896 SetOperandAt(0, obj);
3869 SetOperandAt(1, val); 3897 SetOperandAt(1, val);
3870 if (is_in_object_) { 3898 if (is_in_object_) {
3871 SetFlag(kChangesInobjectFields); 3899 SetGVNFlag(kChangesInobjectFields);
3872 } else { 3900 } else {
3873 SetFlag(kChangesBackingStoreFields); 3901 SetGVNFlag(kChangesBackingStoreFields);
3874 } 3902 }
3875 } 3903 }
3876 3904
3877 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) 3905 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField)
3878 3906
3879 virtual Representation RequiredInputRepresentation(int index) { 3907 virtual Representation RequiredInputRepresentation(int index) {
3880 return Representation::Tagged(); 3908 return Representation::Tagged();
3881 } 3909 }
3882 virtual void PrintDataTo(StringStream* stream); 3910 virtual void PrintDataTo(StringStream* stream);
3883 3911
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3938 3966
3939 3967
3940 class HStoreKeyedFastElement: public HTemplateInstruction<3> { 3968 class HStoreKeyedFastElement: public HTemplateInstruction<3> {
3941 public: 3969 public:
3942 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val, 3970 HStoreKeyedFastElement(HValue* obj, HValue* key, HValue* val,
3943 ElementsKind elements_kind = FAST_ELEMENTS) 3971 ElementsKind elements_kind = FAST_ELEMENTS)
3944 : elements_kind_(elements_kind) { 3972 : elements_kind_(elements_kind) {
3945 SetOperandAt(0, obj); 3973 SetOperandAt(0, obj);
3946 SetOperandAt(1, key); 3974 SetOperandAt(1, key);
3947 SetOperandAt(2, val); 3975 SetOperandAt(2, val);
3948 SetFlag(kChangesArrayElements); 3976 SetGVNFlag(kChangesArrayElements);
3949 } 3977 }
3950 3978
3951 virtual Representation RequiredInputRepresentation(int index) { 3979 virtual Representation RequiredInputRepresentation(int index) {
3952 // The key is supposed to be Integer32. 3980 // The key is supposed to be Integer32.
3953 return index == 1 3981 return index == 1
3954 ? Representation::Integer32() 3982 ? Representation::Integer32()
3955 : Representation::Tagged(); 3983 : Representation::Tagged();
3956 } 3984 }
3957 3985
3958 HValue* object() { return OperandAt(0); } 3986 HValue* object() { return OperandAt(0); }
(...skipping 21 matching lines...) Expand all
3980 4008
3981 4009
3982 class HStoreKeyedFastDoubleElement: public HTemplateInstruction<3> { 4010 class HStoreKeyedFastDoubleElement: public HTemplateInstruction<3> {
3983 public: 4011 public:
3984 HStoreKeyedFastDoubleElement(HValue* elements, 4012 HStoreKeyedFastDoubleElement(HValue* elements,
3985 HValue* key, 4013 HValue* key,
3986 HValue* val) { 4014 HValue* val) {
3987 SetOperandAt(0, elements); 4015 SetOperandAt(0, elements);
3988 SetOperandAt(1, key); 4016 SetOperandAt(1, key);
3989 SetOperandAt(2, val); 4017 SetOperandAt(2, val);
3990 SetFlag(kChangesDoubleArrayElements); 4018 SetGVNFlag(kChangesDoubleArrayElements);
3991 } 4019 }
3992 4020
3993 virtual Representation RequiredInputRepresentation(int index) { 4021 virtual Representation RequiredInputRepresentation(int index) {
3994 if (index == 1) { 4022 if (index == 1) {
3995 return Representation::Integer32(); 4023 return Representation::Integer32();
3996 } else if (index == 2) { 4024 } else if (index == 2) {
3997 return Representation::Double(); 4025 return Representation::Double();
3998 } else { 4026 } else {
3999 return Representation::Tagged(); 4027 return Representation::Tagged();
4000 } 4028 }
(...skipping 13 matching lines...) Expand all
4014 }; 4042 };
4015 4043
4016 4044
4017 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> { 4045 class HStoreKeyedSpecializedArrayElement: public HTemplateInstruction<3> {
4018 public: 4046 public:
4019 HStoreKeyedSpecializedArrayElement(HValue* external_elements, 4047 HStoreKeyedSpecializedArrayElement(HValue* external_elements,
4020 HValue* key, 4048 HValue* key,
4021 HValue* val, 4049 HValue* val,
4022 ElementsKind elements_kind) 4050 ElementsKind elements_kind)
4023 : elements_kind_(elements_kind) { 4051 : elements_kind_(elements_kind) {
4024 SetFlag(kChangesSpecializedArrayElements); 4052 SetGVNFlag(kChangesSpecializedArrayElements);
4025 SetOperandAt(0, external_elements); 4053 SetOperandAt(0, external_elements);
4026 SetOperandAt(1, key); 4054 SetOperandAt(1, key);
4027 SetOperandAt(2, val); 4055 SetOperandAt(2, val);
4028 } 4056 }
4029 4057
4030 virtual void PrintDataTo(StringStream* stream); 4058 virtual void PrintDataTo(StringStream* stream);
4031 4059
4032 virtual Representation RequiredInputRepresentation(int index) { 4060 virtual Representation RequiredInputRepresentation(int index) {
4033 if (index == 0) { 4061 if (index == 0) {
4034 return Representation::External(); 4062 return Representation::External();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4092 4120
4093 class HTransitionElementsKind: public HTemplateInstruction<1> { 4121 class HTransitionElementsKind: public HTemplateInstruction<1> {
4094 public: 4122 public:
4095 HTransitionElementsKind(HValue* object, 4123 HTransitionElementsKind(HValue* object,
4096 Handle<Map> original_map, 4124 Handle<Map> original_map,
4097 Handle<Map> transitioned_map) 4125 Handle<Map> transitioned_map)
4098 : original_map_(original_map), 4126 : original_map_(original_map),
4099 transitioned_map_(transitioned_map) { 4127 transitioned_map_(transitioned_map) {
4100 SetOperandAt(0, object); 4128 SetOperandAt(0, object);
4101 SetFlag(kUseGVN); 4129 SetFlag(kUseGVN);
4102 SetFlag(kChangesElementsKind); 4130 SetGVNFlag(kChangesMaps);
4131 SetGVNFlag(kChangesElementsKind);
4103 set_representation(Representation::Tagged()); 4132 set_representation(Representation::Tagged());
4104 } 4133 }
4105 4134
4106 virtual Representation RequiredInputRepresentation(int index) { 4135 virtual Representation RequiredInputRepresentation(int index) {
4107 return Representation::Tagged(); 4136 return Representation::Tagged();
4108 } 4137 }
4109 4138
4110 HValue* object() { return OperandAt(0); } 4139 HValue* object() { return OperandAt(0); }
4111 Handle<Map> original_map() { return original_map_; } 4140 Handle<Map> original_map() { return original_map_; }
4112 Handle<Map> transitioned_map() { return transitioned_map_; } 4141 Handle<Map> transitioned_map() { return transitioned_map_; }
(...skipping 14 matching lines...) Expand all
4127 Handle<Map> transitioned_map_; 4156 Handle<Map> transitioned_map_;
4128 }; 4157 };
4129 4158
4130 4159
4131 class HStringAdd: public HBinaryOperation { 4160 class HStringAdd: public HBinaryOperation {
4132 public: 4161 public:
4133 HStringAdd(HValue* context, HValue* left, HValue* right) 4162 HStringAdd(HValue* context, HValue* left, HValue* right)
4134 : HBinaryOperation(context, left, right) { 4163 : HBinaryOperation(context, left, right) {
4135 set_representation(Representation::Tagged()); 4164 set_representation(Representation::Tagged());
4136 SetFlag(kUseGVN); 4165 SetFlag(kUseGVN);
4137 SetFlag(kDependsOnMaps); 4166 SetGVNFlag(kDependsOnMaps);
4138 } 4167 }
4139 4168
4140 virtual Representation RequiredInputRepresentation(int index) { 4169 virtual Representation RequiredInputRepresentation(int index) {
4141 return Representation::Tagged(); 4170 return Representation::Tagged();
4142 } 4171 }
4143 4172
4144 virtual HType CalculateInferredType() { 4173 virtual HType CalculateInferredType() {
4145 return HType::String(); 4174 return HType::String();
4146 } 4175 }
4147 4176
4148 DECLARE_CONCRETE_INSTRUCTION(StringAdd) 4177 DECLARE_CONCRETE_INSTRUCTION(StringAdd)
4149 4178
4150 protected: 4179 protected:
4151 virtual bool DataEquals(HValue* other) { return true; } 4180 virtual bool DataEquals(HValue* other) { return true; }
4152 }; 4181 };
4153 4182
4154 4183
4155 class HStringCharCodeAt: public HTemplateInstruction<3> { 4184 class HStringCharCodeAt: public HTemplateInstruction<3> {
4156 public: 4185 public:
4157 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { 4186 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) {
4158 SetOperandAt(0, context); 4187 SetOperandAt(0, context);
4159 SetOperandAt(1, string); 4188 SetOperandAt(1, string);
4160 SetOperandAt(2, index); 4189 SetOperandAt(2, index);
4161 set_representation(Representation::Integer32()); 4190 set_representation(Representation::Integer32());
4162 SetFlag(kUseGVN); 4191 SetFlag(kUseGVN);
4163 SetFlag(kDependsOnMaps); 4192 SetGVNFlag(kDependsOnMaps);
4164 } 4193 }
4165 4194
4166 virtual Representation RequiredInputRepresentation(int index) { 4195 virtual Representation RequiredInputRepresentation(int index) {
4167 // The index is supposed to be Integer32. 4196 // The index is supposed to be Integer32.
4168 return index == 2 4197 return index == 2
4169 ? Representation::Integer32() 4198 ? Representation::Integer32()
4170 : Representation::Tagged(); 4199 : Representation::Tagged();
4171 } 4200 }
4172 4201
4173 HValue* context() { return OperandAt(0); } 4202 HValue* context() { return OperandAt(0); }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4208 4237
4209 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode) 4238 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode)
4210 }; 4239 };
4211 4240
4212 4241
4213 class HStringLength: public HUnaryOperation { 4242 class HStringLength: public HUnaryOperation {
4214 public: 4243 public:
4215 explicit HStringLength(HValue* string) : HUnaryOperation(string) { 4244 explicit HStringLength(HValue* string) : HUnaryOperation(string) {
4216 set_representation(Representation::Tagged()); 4245 set_representation(Representation::Tagged());
4217 SetFlag(kUseGVN); 4246 SetFlag(kUseGVN);
4218 SetFlag(kDependsOnMaps); 4247 SetGVNFlag(kDependsOnMaps);
4219 } 4248 }
4220 4249
4221 virtual Representation RequiredInputRepresentation(int index) { 4250 virtual Representation RequiredInputRepresentation(int index) {
4222 return Representation::Tagged(); 4251 return Representation::Tagged();
4223 } 4252 }
4224 4253
4225 virtual HType CalculateInferredType() { 4254 virtual HType CalculateInferredType() {
4226 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 4255 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
4227 return HType::Smi(); 4256 return HType::Smi();
4228 } 4257 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
4523 4552
4524 DECLARE_CONCRETE_INSTRUCTION(In) 4553 DECLARE_CONCRETE_INSTRUCTION(In)
4525 }; 4554 };
4526 4555
4527 #undef DECLARE_INSTRUCTION 4556 #undef DECLARE_INSTRUCTION
4528 #undef DECLARE_CONCRETE_INSTRUCTION 4557 #undef DECLARE_CONCRETE_INSTRUCTION
4529 4558
4530 } } // namespace v8::internal 4559 } } // namespace v8::internal
4531 4560
4532 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 4561 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698