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

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

Issue 196133017: Experimental parser: merge r19949 (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 6 years, 9 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-gvn.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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 V(CheckValue) \ 95 V(CheckValue) \
96 V(ClampToUint8) \ 96 V(ClampToUint8) \
97 V(ClassOfTestAndBranch) \ 97 V(ClassOfTestAndBranch) \
98 V(CompareNumericAndBranch) \ 98 V(CompareNumericAndBranch) \
99 V(CompareHoleAndBranch) \ 99 V(CompareHoleAndBranch) \
100 V(CompareGeneric) \ 100 V(CompareGeneric) \
101 V(CompareMinusZeroAndBranch) \ 101 V(CompareMinusZeroAndBranch) \
102 V(CompareObjectEqAndBranch) \ 102 V(CompareObjectEqAndBranch) \
103 V(CompareMap) \ 103 V(CompareMap) \
104 V(Constant) \ 104 V(Constant) \
105 V(ConstructDouble) \
105 V(Context) \ 106 V(Context) \
106 V(DateField) \ 107 V(DateField) \
107 V(DebugBreak) \ 108 V(DebugBreak) \
108 V(DeclareGlobals) \ 109 V(DeclareGlobals) \
109 V(Deoptimize) \ 110 V(Deoptimize) \
110 V(Div) \ 111 V(Div) \
112 V(DoubleBits) \
111 V(DummyUse) \ 113 V(DummyUse) \
112 V(EnterInlined) \ 114 V(EnterInlined) \
113 V(EnvironmentMarker) \ 115 V(EnvironmentMarker) \
114 V(ForceRepresentation) \ 116 V(ForceRepresentation) \
115 V(ForInCacheArray) \ 117 V(ForInCacheArray) \
116 V(ForInPrepareMap) \ 118 V(ForInPrepareMap) \
117 V(FunctionLiteral) \ 119 V(FunctionLiteral) \
118 V(GetCachedArrayIndex) \ 120 V(GetCachedArrayIndex) \
119 V(Goto) \ 121 V(Goto) \
120 V(HasCachedArrayIndexAndBranch) \ 122 V(HasCachedArrayIndexAndBranch) \
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // implement DataEquals(), which will be used to determine if other 615 // implement DataEquals(), which will be used to determine if other
614 // occurrences of the instruction are indeed the same. 616 // occurrences of the instruction are indeed the same.
615 kUseGVN, 617 kUseGVN,
616 // Track instructions that are dominating side effects. If an instruction 618 // Track instructions that are dominating side effects. If an instruction
617 // sets this flag, it must implement HandleSideEffectDominator() and should 619 // sets this flag, it must implement HandleSideEffectDominator() and should
618 // indicate which side effects to track by setting GVN flags. 620 // indicate which side effects to track by setting GVN flags.
619 kTrackSideEffectDominators, 621 kTrackSideEffectDominators,
620 kCanOverflow, 622 kCanOverflow,
621 kBailoutOnMinusZero, 623 kBailoutOnMinusZero,
622 kCanBeDivByZero, 624 kCanBeDivByZero,
625 kLeftCanBeMinInt,
626 kLeftCanBeNegative,
623 kAllowUndefinedAsNaN, 627 kAllowUndefinedAsNaN,
624 kIsArguments, 628 kIsArguments,
625 kTruncatingToInt32, 629 kTruncatingToInt32,
626 kAllUsesTruncatingToInt32, 630 kAllUsesTruncatingToInt32,
627 kTruncatingToSmi, 631 kTruncatingToSmi,
628 kAllUsesTruncatingToSmi, 632 kAllUsesTruncatingToSmi,
629 // Set after an instruction is killed. 633 // Set after an instruction is killed.
630 kIsDead, 634 kIsDead,
631 // Instructions that are allowed to produce full range unsigned integer 635 // Instructions that are allowed to produce full range unsigned integer
632 // values are marked with kUint32 flag. If arithmetic shift or a load from 636 // values are marked with kUint32 flag. If arithmetic shift or a load from
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 HType type() const { return type_; } 734 HType type() const { return type_; }
731 void set_type(HType new_type) { 735 void set_type(HType new_type) {
732 ASSERT(new_type.IsSubtypeOf(type_)); 736 ASSERT(new_type.IsSubtypeOf(type_));
733 type_ = new_type; 737 type_ = new_type;
734 } 738 }
735 739
736 bool IsHeapObject() { 740 bool IsHeapObject() {
737 return representation_.IsHeapObject() || type_.IsHeapObject(); 741 return representation_.IsHeapObject() || type_.IsHeapObject();
738 } 742 }
739 743
740 // An operation needs to override this function iff:
741 // 1) it can produce an int32 output.
742 // 2) the true value of its output can potentially be minus zero.
743 // The implementation must set a flag so that it bails out in the case where
744 // it would otherwise output what should be a minus zero as an int32 zero.
745 // If the operation also exists in a form that takes int32 and outputs int32
746 // then the operation should return its input value so that we can propagate
747 // back. There are three operations that need to propagate back to more than
748 // one input. They are phi and binary div and mul. They always return NULL
749 // and expect the caller to take care of things.
750 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited) {
751 visited->Add(id());
752 return NULL;
753 }
754
755 // There are HInstructions that do not really change a value, they 744 // There are HInstructions that do not really change a value, they
756 // only add pieces of information to it (like bounds checks, map checks, 745 // only add pieces of information to it (like bounds checks, map checks,
757 // smi checks...). 746 // smi checks...).
758 // We call these instructions "informative definitions", or "iDef". 747 // We call these instructions "informative definitions", or "iDef".
759 // One of the iDef operands is special because it is the value that is 748 // One of the iDef operands is special because it is the value that is
760 // "transferred" to the output, we call it the "redefined operand". 749 // "transferred" to the output, we call it the "redefined operand".
761 // If an HValue is an iDef it must override RedefinedOperandIndex() so that 750 // If an HValue is an iDef it must override RedefinedOperandIndex() so that
762 // it does not return kNoRedefinedOperand; 751 // it does not return kNoRedefinedOperand;
763 static const int kNoRedefinedOperand = -1; 752 static const int kNoRedefinedOperand = -1;
764 virtual int RedefinedOperandIndex() { return kNoRedefinedOperand; } 753 virtual int RedefinedOperandIndex() { return kNoRedefinedOperand; }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 849
861 GVNFlagSet ObservableChangesFlags() const { 850 GVNFlagSet ObservableChangesFlags() const {
862 GVNFlagSet result = ChangesFlags(); 851 GVNFlagSet result = ChangesFlags();
863 result.Intersect(AllObservableSideEffectsFlagSet()); 852 result.Intersect(AllObservableSideEffectsFlagSet());
864 return result; 853 return result;
865 } 854 }
866 855
867 Range* range() const { return range_; } 856 Range* range() const { return range_; }
868 // TODO(svenpanne) We should really use the null object pattern here. 857 // TODO(svenpanne) We should really use the null object pattern here.
869 bool HasRange() const { return range_ != NULL; } 858 bool HasRange() const { return range_ != NULL; }
870 bool CanBeNegative() const { return !HasRange() || range()->CanBeNegative(); }
871 bool CanBeZero() const { return !HasRange() || range()->CanBeZero(); }
872 bool RangeCanInclude(int value) const {
873 return !HasRange() || range()->Includes(value);
874 }
875 void AddNewRange(Range* r, Zone* zone); 859 void AddNewRange(Range* r, Zone* zone);
876 void RemoveLastAddedRange(); 860 void RemoveLastAddedRange();
877 void ComputeInitialRange(Zone* zone); 861 void ComputeInitialRange(Zone* zone);
878 862
879 // Escape analysis helpers. 863 // Escape analysis helpers.
880 virtual bool HasEscapingOperandAt(int index) { return true; } 864 virtual bool HasEscapingOperandAt(int index) { return true; }
881 virtual bool HasOutOfBoundsAccess(int size) { return false; } 865 virtual bool HasOutOfBoundsAccess(int size) { return false; }
882 866
883 // Representation helpers. 867 // Representation helpers.
884 virtual Representation observed_input_representation(int index) { 868 virtual Representation observed_input_representation(int index) {
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 }; 1694 };
1711 1695
1712 1696
1713 class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> { 1697 class HForceRepresentation V8_FINAL : public HTemplateInstruction<1> {
1714 public: 1698 public:
1715 static HInstruction* New(Zone* zone, HValue* context, HValue* value, 1699 static HInstruction* New(Zone* zone, HValue* context, HValue* value,
1716 Representation required_representation); 1700 Representation required_representation);
1717 1701
1718 HValue* value() { return OperandAt(0); } 1702 HValue* value() { return OperandAt(0); }
1719 1703
1720 virtual HValue* EnsureAndPropagateNotMinusZero(
1721 BitVector* visited) V8_OVERRIDE;
1722
1723 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1704 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1724 return representation(); // Same as the output representation. 1705 return representation(); // Same as the output representation.
1725 } 1706 }
1726 1707
1727 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1708 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1728 1709
1729 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) 1710 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation)
1730 1711
1731 private: 1712 private:
1732 HForceRepresentation(HValue* value, Representation required_representation) { 1713 HForceRepresentation(HValue* value, Representation required_representation) {
1733 SetOperandAt(0, value); 1714 SetOperandAt(0, value);
1734 set_representation(required_representation); 1715 set_representation(required_representation);
1735 } 1716 }
1736 }; 1717 };
1737 1718
1738 1719
1739 class HChange V8_FINAL : public HUnaryOperation { 1720 class HChange V8_FINAL : public HUnaryOperation {
1740 public: 1721 public:
1741 HChange(HValue* value, 1722 HChange(HValue* value,
1742 Representation to, 1723 Representation to,
1743 bool is_truncating_to_smi, 1724 bool is_truncating_to_smi,
1744 bool is_truncating_to_int32) 1725 bool is_truncating_to_int32)
1745 : HUnaryOperation(value) { 1726 : HUnaryOperation(value) {
1746 ASSERT(!value->representation().IsNone()); 1727 ASSERT(!value->representation().IsNone());
1747 ASSERT(!to.IsNone()); 1728 ASSERT(!to.IsNone());
1748 ASSERT(!value->representation().Equals(to)); 1729 ASSERT(!value->representation().Equals(to));
1749 set_representation(to); 1730 set_representation(to);
1750 SetFlag(kUseGVN); 1731 SetFlag(kUseGVN);
1732 SetFlag(kCanOverflow);
1751 if (is_truncating_to_smi) { 1733 if (is_truncating_to_smi) {
1752 SetFlag(kTruncatingToSmi); 1734 SetFlag(kTruncatingToSmi);
1753 SetFlag(kTruncatingToInt32); 1735 SetFlag(kTruncatingToInt32);
1754 } 1736 }
1755 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); 1737 if (is_truncating_to_int32) SetFlag(kTruncatingToInt32);
1756 if (value->representation().IsSmi() || value->type().IsSmi()) { 1738 if (value->representation().IsSmi() || value->type().IsSmi()) {
1757 set_type(HType::Smi()); 1739 set_type(HType::Smi());
1758 } else { 1740 } else {
1759 set_type(HType::TaggedNumber()); 1741 set_type(HType::TaggedNumber());
1760 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion); 1742 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
1761 } 1743 }
1762 } 1744 }
1763 1745
1764 bool can_convert_undefined_to_nan() { 1746 bool can_convert_undefined_to_nan() {
1765 return CheckUsesForFlag(kAllowUndefinedAsNaN); 1747 return CheckUsesForFlag(kAllowUndefinedAsNaN);
1766 } 1748 }
1767 1749
1768 virtual HValue* EnsureAndPropagateNotMinusZero(
1769 BitVector* visited) V8_OVERRIDE;
1770 virtual HType CalculateInferredType() V8_OVERRIDE; 1750 virtual HType CalculateInferredType() V8_OVERRIDE;
1771 virtual HValue* Canonicalize() V8_OVERRIDE; 1751 virtual HValue* Canonicalize() V8_OVERRIDE;
1772 1752
1773 Representation from() const { return value()->representation(); } 1753 Representation from() const { return value()->representation(); }
1774 Representation to() const { return representation(); } 1754 Representation to() const { return representation(); }
1775 bool deoptimize_on_minus_zero() const { 1755 bool deoptimize_on_minus_zero() const {
1776 return CheckFlag(kBailoutOnMinusZero); 1756 return CheckFlag(kBailoutOnMinusZero);
1777 } 1757 }
1778 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1758 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1779 return from(); 1759 return from();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 : HUnaryOperation(value) { 1793 : HUnaryOperation(value) {
1814 set_representation(Representation::Integer32()); 1794 set_representation(Representation::Integer32());
1815 SetFlag(kAllowUndefinedAsNaN); 1795 SetFlag(kAllowUndefinedAsNaN);
1816 SetFlag(kUseGVN); 1796 SetFlag(kUseGVN);
1817 } 1797 }
1818 1798
1819 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 1799 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1820 }; 1800 };
1821 1801
1822 1802
1803 class HDoubleBits V8_FINAL : public HUnaryOperation {
1804 public:
1805 enum Bits { HIGH, LOW };
1806 DECLARE_INSTRUCTION_FACTORY_P2(HDoubleBits, HValue*, Bits);
1807
1808 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1809 return Representation::Double();
1810 }
1811
1812 DECLARE_CONCRETE_INSTRUCTION(DoubleBits)
1813
1814 Bits bits() { return bits_; }
1815
1816 protected:
1817 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
1818 return other->IsDoubleBits() && HDoubleBits::cast(other)->bits() == bits();
1819 }
1820
1821 private:
1822 HDoubleBits(HValue* value, Bits bits)
1823 : HUnaryOperation(value), bits_(bits) {
1824 set_representation(Representation::Integer32());
1825 SetFlag(kUseGVN);
1826 }
1827
1828 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1829
1830 Bits bits_;
1831 };
1832
1833
1834 class HConstructDouble V8_FINAL : public HTemplateInstruction<2> {
1835 public:
1836 DECLARE_INSTRUCTION_FACTORY_P2(HConstructDouble, HValue*, HValue*);
1837
1838 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1839 return Representation::Integer32();
1840 }
1841
1842 DECLARE_CONCRETE_INSTRUCTION(ConstructDouble)
1843
1844 HValue* hi() { return OperandAt(0); }
1845 HValue* lo() { return OperandAt(1); }
1846
1847 protected:
1848 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
1849
1850 private:
1851 explicit HConstructDouble(HValue* hi, HValue* lo) {
1852 set_representation(Representation::Double());
1853 SetFlag(kUseGVN);
1854 SetOperandAt(0, hi);
1855 SetOperandAt(1, lo);
1856 }
1857
1858 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
1859 };
1860
1861
1823 enum RemovableSimulate { 1862 enum RemovableSimulate {
1824 REMOVABLE_SIMULATE, 1863 REMOVABLE_SIMULATE,
1825 FIXED_SIMULATE 1864 FIXED_SIMULATE
1826 }; 1865 };
1827 1866
1828 1867
1829 class HSimulate V8_FINAL : public HInstruction { 1868 class HSimulate V8_FINAL : public HInstruction {
1830 public: 1869 public:
1831 HSimulate(BailoutId ast_id, 1870 HSimulate(BailoutId ast_id,
1832 int pop_count, 1871 int pop_count,
1833 Zone* zone, 1872 Zone* zone,
1834 RemovableSimulate removable) 1873 RemovableSimulate removable)
1835 : ast_id_(ast_id), 1874 : ast_id_(ast_id),
1836 pop_count_(pop_count), 1875 pop_count_(pop_count),
1837 values_(2, zone), 1876 values_(2, zone),
1838 assigned_indexes_(2, zone), 1877 assigned_indexes_(2, zone),
1839 zone_(zone), 1878 zone_(zone),
1840 removable_(removable) {} 1879 removable_(removable),
1880 done_with_replay_(false) {}
1841 ~HSimulate() {} 1881 ~HSimulate() {}
1842 1882
1843 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1883 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1844 1884
1845 bool HasAstId() const { return !ast_id_.IsNone(); } 1885 bool HasAstId() const { return !ast_id_.IsNone(); }
1846 BailoutId ast_id() const { return ast_id_; } 1886 BailoutId ast_id() const { return ast_id_; }
1847 void set_ast_id(BailoutId id) { 1887 void set_ast_id(BailoutId id) {
1848 ASSERT(!HasAstId()); 1888 ASSERT(!HasAstId());
1849 ast_id_ = id; 1889 ast_id_ = id;
1850 } 1890 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 for (int i = 0; i < assigned_indexes_.length(); ++i) { 1953 for (int i = 0; i < assigned_indexes_.length(); ++i) {
1914 if (assigned_indexes_[i] == index) return true; 1954 if (assigned_indexes_[i] == index) return true;
1915 } 1955 }
1916 return false; 1956 return false;
1917 } 1957 }
1918 BailoutId ast_id_; 1958 BailoutId ast_id_;
1919 int pop_count_; 1959 int pop_count_;
1920 ZoneList<HValue*> values_; 1960 ZoneList<HValue*> values_;
1921 ZoneList<int> assigned_indexes_; 1961 ZoneList<int> assigned_indexes_;
1922 Zone* zone_; 1962 Zone* zone_;
1923 RemovableSimulate removable_; 1963 RemovableSimulate removable_ : 2;
1964 bool done_with_replay_ : 1;
1924 1965
1925 #ifdef DEBUG 1966 #ifdef DEBUG
1926 Handle<JSFunction> closure_; 1967 Handle<JSFunction> closure_;
1927 #endif 1968 #endif
1928 }; 1969 };
1929 1970
1930 1971
1931 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> { 1972 class HEnvironmentMarker V8_FINAL : public HTemplateInstruction<1> {
1932 public: 1973 public:
1933 enum Kind { BIND, LOOKUP }; 1974 enum Kind { BIND, LOOKUP };
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 static HInstruction* New(Zone* zone, 2604 static HInstruction* New(Zone* zone,
2564 HValue* context, 2605 HValue* context,
2565 HValue* value, 2606 HValue* value,
2566 BuiltinFunctionId op); 2607 BuiltinFunctionId op);
2567 2608
2568 HValue* context() { return OperandAt(0); } 2609 HValue* context() { return OperandAt(0); }
2569 HValue* value() { return OperandAt(1); } 2610 HValue* value() { return OperandAt(1); }
2570 2611
2571 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2612 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2572 2613
2573 virtual HValue* EnsureAndPropagateNotMinusZero(
2574 BitVector* visited) V8_OVERRIDE;
2575
2576 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2614 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2577 if (index == 0) { 2615 if (index == 0) {
2578 return Representation::Tagged(); 2616 return Representation::Tagged();
2579 } else { 2617 } else {
2580 switch (op_) { 2618 switch (op_) {
2581 case kMathFloor: 2619 case kMathFloor:
2582 case kMathRound: 2620 case kMathRound:
2583 case kMathSqrt: 2621 case kMathSqrt:
2584 case kMathPowHalf: 2622 case kMathPowHalf:
2585 case kMathLog: 2623 case kMathLog:
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 HInstruction* instruction) { 3444 HInstruction* instruction) {
3407 return instruction->Prepend(HConstant::New( 3445 return instruction->Prepend(HConstant::New(
3408 zone, context, value, representation)); 3446 zone, context, value, representation));
3409 } 3447 }
3410 3448
3411 static HConstant* CreateAndInsertBefore(Zone* zone, 3449 static HConstant* CreateAndInsertBefore(Zone* zone,
3412 Unique<Object> unique, 3450 Unique<Object> unique,
3413 bool is_not_in_new_space, 3451 bool is_not_in_new_space,
3414 HInstruction* instruction) { 3452 HInstruction* instruction) {
3415 return instruction->Prepend(new(zone) HConstant( 3453 return instruction->Prepend(new(zone) HConstant(
3416 unique, Representation::Tagged(), HType::Tagged(), false, 3454 unique, Representation::Tagged(), HType::Tagged(),
3417 is_not_in_new_space, false, false)); 3455 is_not_in_new_space, false, false, kUnknownInstanceType));
3418 } 3456 }
3419 3457
3420 Handle<Object> handle(Isolate* isolate) { 3458 Handle<Object> handle(Isolate* isolate) {
3421 if (object_.handle().is_null()) { 3459 if (object_.handle().is_null()) {
3422 // Default arguments to is_not_in_new_space depend on this heap number 3460 // Default arguments to is_not_in_new_space depend on this heap number
3423 // to be tenured so that it's guaranteed not to be located in new space. 3461 // to be tenured so that it's guaranteed not to be located in new space.
3424 object_ = Unique<Object>::CreateUninitialized( 3462 object_ = Unique<Object>::CreateUninitialized(
3425 isolate->factory()->NewNumber(double_value_, TENURED)); 3463 isolate->factory()->NewNumber(double_value_, TENURED));
3426 } 3464 }
3427 AllowDeferredHandleDereference smi_check; 3465 AllowDeferredHandleDereference smi_check;
(...skipping 14 matching lines...) Expand all
3442 std::isnan(double_value_)); 3480 std::isnan(double_value_));
3443 } 3481 }
3444 3482
3445 bool NotInNewSpace() const { 3483 bool NotInNewSpace() const {
3446 return is_not_in_new_space_; 3484 return is_not_in_new_space_;
3447 } 3485 }
3448 3486
3449 bool ImmortalImmovable() const; 3487 bool ImmortalImmovable() const;
3450 3488
3451 bool IsCell() const { 3489 bool IsCell() const {
3452 return is_cell_; 3490 return instance_type_ == CELL_TYPE || instance_type_ == PROPERTY_CELL_TYPE;
3453 } 3491 }
3454 3492
3455 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 3493 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
3456 return Representation::None(); 3494 return Representation::None();
3457 } 3495 }
3458 3496
3459 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE { 3497 virtual Representation KnownOptimalRepresentation() V8_OVERRIDE {
3460 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi(); 3498 if (HasSmiValue() && SmiValuesAre31Bits()) return Representation::Smi();
3461 if (HasInteger32Value()) return Representation::Integer32(); 3499 if (HasInteger32Value()) return Representation::Integer32();
3462 if (HasNumberValue()) return Representation::Double(); 3500 if (HasNumberValue()) return Representation::Double();
(...skipping 27 matching lines...) Expand all
3490 int32_t NumberValueAsInteger32() const { 3528 int32_t NumberValueAsInteger32() const {
3491 ASSERT(HasNumberValue()); 3529 ASSERT(HasNumberValue());
3492 // Irrespective of whether a numeric HConstant can be safely 3530 // Irrespective of whether a numeric HConstant can be safely
3493 // represented as an int32, we store the (in some cases lossy) 3531 // represented as an int32, we store the (in some cases lossy)
3494 // representation of the number in int32_value_. 3532 // representation of the number in int32_value_.
3495 return int32_value_; 3533 return int32_value_;
3496 } 3534 }
3497 bool HasStringValue() const { 3535 bool HasStringValue() const {
3498 if (has_double_value_ || has_int32_value_) return false; 3536 if (has_double_value_ || has_int32_value_) return false;
3499 ASSERT(!object_.handle().is_null()); 3537 ASSERT(!object_.handle().is_null());
3500 return type_.IsString(); 3538 return instance_type_ < FIRST_NONSTRING_TYPE;
3501 } 3539 }
3502 Handle<String> StringValue() const { 3540 Handle<String> StringValue() const {
3503 ASSERT(HasStringValue()); 3541 ASSERT(HasStringValue());
3504 return Handle<String>::cast(object_.handle()); 3542 return Handle<String>::cast(object_.handle());
3505 } 3543 }
3506 bool HasInternalizedStringValue() const { 3544 bool HasInternalizedStringValue() const {
3507 return HasStringValue() && is_internalized_string_; 3545 return HasStringValue() && StringShape(instance_type_).IsInternalized();
3508 } 3546 }
3509 3547
3510 bool HasExternalReferenceValue() const { 3548 bool HasExternalReferenceValue() const {
3511 return has_external_reference_value_; 3549 return has_external_reference_value_;
3512 } 3550 }
3513 ExternalReference ExternalReferenceValue() const { 3551 ExternalReference ExternalReferenceValue() const {
3514 return external_reference_value_; 3552 return external_reference_value_;
3515 } 3553 }
3516 3554
3517 bool HasBooleanValue() const { return type_.IsBoolean(); } 3555 bool HasBooleanValue() const { return type_.IsBoolean(); }
3518 bool BooleanValue() const { return boolean_value_; } 3556 bool BooleanValue() const { return boolean_value_; }
3557 bool IsUndetectable() const { return is_undetectable_; }
3558 InstanceType GetInstanceType() const { return instance_type_; }
3519 3559
3520 virtual intptr_t Hashcode() V8_OVERRIDE { 3560 virtual intptr_t Hashcode() V8_OVERRIDE {
3521 if (has_int32_value_) { 3561 if (has_int32_value_) {
3522 return static_cast<intptr_t>(int32_value_); 3562 return static_cast<intptr_t>(int32_value_);
3523 } else if (has_double_value_) { 3563 } else if (has_double_value_) {
3524 return static_cast<intptr_t>(BitCast<int64_t>(double_value_)); 3564 return static_cast<intptr_t>(BitCast<int64_t>(double_value_));
3525 } else if (has_external_reference_value_) { 3565 } else if (has_external_reference_value_) {
3526 return reinterpret_cast<intptr_t>(external_reference_value_.address()); 3566 return reinterpret_cast<intptr_t>(external_reference_value_.address());
3527 } else { 3567 } else {
3528 ASSERT(!object_.handle().is_null()); 3568 ASSERT(!object_.handle().is_null());
3529 return object_.Hashcode(); 3569 return object_.Hashcode();
3530 } 3570 }
3531 } 3571 }
3532 3572
3533 virtual void FinalizeUniqueness() V8_OVERRIDE { 3573 virtual void FinalizeUniqueness() V8_OVERRIDE {
3534 if (!has_double_value_ && !has_external_reference_value_) { 3574 if (!has_double_value_ && !has_external_reference_value_) {
3535 ASSERT(!object_.handle().is_null()); 3575 ASSERT(!object_.handle().is_null());
3536 object_ = Unique<Object>(object_.handle()); 3576 object_ = Unique<Object>(object_.handle());
3537 } 3577 }
3538 } 3578 }
3539 3579
3540 Unique<Object> GetUnique() const { 3580 Unique<Object> GetUnique() const {
3541 return object_; 3581 return object_;
3542 } 3582 }
3543 3583
3544 #ifdef DEBUG 3584 bool EqualsUnique(Unique<Object> other) const {
3545 virtual void Verify() V8_OVERRIDE { } 3585 return object_.IsInitialized() && object_ == other;
3546 #endif 3586 }
3547
3548 DECLARE_CONCRETE_INSTRUCTION(Constant)
3549
3550 protected:
3551 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
3552 3587
3553 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 3588 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
3554 HConstant* other_constant = HConstant::cast(other); 3589 HConstant* other_constant = HConstant::cast(other);
3555 if (has_int32_value_) { 3590 if (has_int32_value_) {
3556 return other_constant->has_int32_value_ && 3591 return other_constant->has_int32_value_ &&
3557 int32_value_ == other_constant->int32_value_; 3592 int32_value_ == other_constant->int32_value_;
3558 } else if (has_double_value_) { 3593 } else if (has_double_value_) {
3559 return other_constant->has_double_value_ && 3594 return other_constant->has_double_value_ &&
3560 BitCast<int64_t>(double_value_) == 3595 BitCast<int64_t>(double_value_) ==
3561 BitCast<int64_t>(other_constant->double_value_); 3596 BitCast<int64_t>(other_constant->double_value_);
3562 } else if (has_external_reference_value_) { 3597 } else if (has_external_reference_value_) {
3563 return other_constant->has_external_reference_value_ && 3598 return other_constant->has_external_reference_value_ &&
3564 external_reference_value_ == 3599 external_reference_value_ ==
3565 other_constant->external_reference_value_; 3600 other_constant->external_reference_value_;
3566 } else { 3601 } else {
3567 if (other_constant->has_int32_value_ || 3602 if (other_constant->has_int32_value_ ||
3568 other_constant->has_double_value_ || 3603 other_constant->has_double_value_ ||
3569 other_constant->has_external_reference_value_) { 3604 other_constant->has_external_reference_value_) {
3570 return false; 3605 return false;
3571 } 3606 }
3572 ASSERT(!object_.handle().is_null()); 3607 ASSERT(!object_.handle().is_null());
3573 return other_constant->object_ == object_; 3608 return other_constant->object_ == object_;
3574 } 3609 }
3575 } 3610 }
3576 3611
3612 #ifdef DEBUG
3613 virtual void Verify() V8_OVERRIDE { }
3614 #endif
3615
3616 DECLARE_CONCRETE_INSTRUCTION(Constant)
3617
3618 protected:
3619 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
3620
3577 private: 3621 private:
3578 friend class HGraph; 3622 friend class HGraph;
3579 HConstant(Handle<Object> handle, Representation r = Representation::None()); 3623 HConstant(Handle<Object> handle, Representation r = Representation::None());
3580 HConstant(int32_t value, 3624 HConstant(int32_t value,
3581 Representation r = Representation::None(), 3625 Representation r = Representation::None(),
3582 bool is_not_in_new_space = true, 3626 bool is_not_in_new_space = true,
3583 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); 3627 Unique<Object> optional = Unique<Object>(Handle<Object>::null()));
3584 HConstant(double value, 3628 HConstant(double value,
3585 Representation r = Representation::None(), 3629 Representation r = Representation::None(),
3586 bool is_not_in_new_space = true, 3630 bool is_not_in_new_space = true,
3587 Unique<Object> optional = Unique<Object>(Handle<Object>::null())); 3631 Unique<Object> optional = Unique<Object>(Handle<Object>::null()));
3588 HConstant(Unique<Object> unique, 3632 HConstant(Unique<Object> unique,
3589 Representation r, 3633 Representation r,
3590 HType type, 3634 HType type,
3591 bool is_internalized_string,
3592 bool is_not_in_new_space, 3635 bool is_not_in_new_space,
3593 bool is_cell, 3636 bool boolean_value,
3594 bool boolean_value); 3637 bool is_undetectable,
3638 InstanceType instance_type);
3595 3639
3596 explicit HConstant(ExternalReference reference); 3640 explicit HConstant(ExternalReference reference);
3597 3641
3598 void Initialize(Representation r); 3642 void Initialize(Representation r);
3599 3643
3600 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 3644 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
3601 3645
3602 // If this is a numerical constant, object_ either points to the 3646 // If this is a numerical constant, object_ either points to the
3603 // HeapObject the constant originated from or is null. If the 3647 // HeapObject the constant originated from or is null. If the
3604 // constant is non-numeric, object_ always points to a valid 3648 // constant is non-numeric, object_ always points to a valid
3605 // constant HeapObject. 3649 // constant HeapObject.
3606 Unique<Object> object_; 3650 Unique<Object> object_;
3607 3651
3608 // We store the HConstant in the most specific form safely possible. 3652 // We store the HConstant in the most specific form safely possible.
3609 // The two flags, has_int32_value_ and has_double_value_ tell us if 3653 // The two flags, has_int32_value_ and has_double_value_ tell us if
3610 // int32_value_ and double_value_ hold valid, safe representations 3654 // int32_value_ and double_value_ hold valid, safe representations
3611 // of the constant. has_int32_value_ implies has_double_value_ but 3655 // of the constant. has_int32_value_ implies has_double_value_ but
3612 // not the converse. 3656 // not the converse.
3613 bool has_smi_value_ : 1; 3657 bool has_smi_value_ : 1;
3614 bool has_int32_value_ : 1; 3658 bool has_int32_value_ : 1;
3615 bool has_double_value_ : 1; 3659 bool has_double_value_ : 1;
3616 bool has_external_reference_value_ : 1; 3660 bool has_external_reference_value_ : 1;
3617 bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType.
3618 bool is_not_in_new_space_ : 1; 3661 bool is_not_in_new_space_ : 1;
3619 bool is_cell_ : 1;
3620 bool boolean_value_ : 1; 3662 bool boolean_value_ : 1;
3663 bool is_undetectable_: 1;
3621 int32_t int32_value_; 3664 int32_t int32_value_;
3622 double double_value_; 3665 double double_value_;
3623 ExternalReference external_reference_value_; 3666 ExternalReference external_reference_value_;
3667
3668 static const InstanceType kUnknownInstanceType = FILLER_TYPE;
3669 InstanceType instance_type_;
3624 }; 3670 };
3625 3671
3626 3672
3627 class HBinaryOperation : public HTemplateInstruction<3> { 3673 class HBinaryOperation : public HTemplateInstruction<3> {
3628 public: 3674 public:
3629 HBinaryOperation(HValue* context, HValue* left, HValue* right, 3675 HBinaryOperation(HValue* context, HValue* left, HValue* right,
3630 HType type = HType::Tagged()) 3676 HType type = HType::Tagged())
3631 : HTemplateInstruction<3>(type), 3677 : HTemplateInstruction<3>(type),
3632 observed_output_representation_(Representation::None()) { 3678 observed_output_representation_(Representation::None()) {
3633 ASSERT(left != NULL && right != NULL); 3679 ASSERT(left != NULL && right != NULL);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3702 return representation(); 3748 return representation();
3703 } 3749 }
3704 3750
3705 void SetOperandPositions(Zone* zone, 3751 void SetOperandPositions(Zone* zone,
3706 HSourcePosition left_pos, 3752 HSourcePosition left_pos,
3707 HSourcePosition right_pos) { 3753 HSourcePosition right_pos) {
3708 set_operand_position(zone, 1, left_pos); 3754 set_operand_position(zone, 1, left_pos);
3709 set_operand_position(zone, 2, right_pos); 3755 set_operand_position(zone, 2, right_pos);
3710 } 3756 }
3711 3757
3758 bool RightIsPowerOf2() {
3759 if (!right()->IsInteger32Constant()) return false;
3760 int32_t value = right()->GetInteger32Constant();
3761 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
3762 }
3763
3712 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) 3764 DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation)
3713 3765
3714 private: 3766 private:
3715 bool IgnoreObservedOutputRepresentation(Representation current_rep); 3767 bool IgnoreObservedOutputRepresentation(Representation current_rep);
3716 3768
3717 Representation observed_input_representation_[2]; 3769 Representation observed_input_representation_[2];
3718 Representation observed_output_representation_; 3770 Representation observed_output_representation_;
3719 }; 3771 };
3720 3772
3721 3773
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
3990 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, 4042 HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right,
3991 HType type = HType::Tagged()) 4043 HType type = HType::Tagged())
3992 : HBinaryOperation(context, left, right, type) { 4044 : HBinaryOperation(context, left, right, type) {
3993 SetFlag(kFlexibleRepresentation); 4045 SetFlag(kFlexibleRepresentation);
3994 SetFlag(kTruncatingToInt32); 4046 SetFlag(kTruncatingToInt32);
3995 SetFlag(kAllowUndefinedAsNaN); 4047 SetFlag(kAllowUndefinedAsNaN);
3996 SetAllSideEffects(); 4048 SetAllSideEffects();
3997 } 4049 }
3998 4050
3999 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4051 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4000 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4001 if (to.IsTagged() && 4052 if (to.IsTagged() &&
4002 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 4053 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4003 SetAllSideEffects(); 4054 SetAllSideEffects();
4004 ClearFlag(kUseGVN); 4055 ClearFlag(kUseGVN);
4005 } else { 4056 } else {
4006 ClearAllSideEffects(); 4057 ClearAllSideEffects();
4007 SetFlag(kUseGVN); 4058 SetFlag(kUseGVN);
4008 } 4059 }
4060 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4009 } 4061 }
4010 4062
4011 virtual void UpdateRepresentation(Representation new_rep, 4063 virtual void UpdateRepresentation(Representation new_rep,
4012 HInferRepresentationPhase* h_infer, 4064 HInferRepresentationPhase* h_infer,
4013 const char* reason) V8_OVERRIDE { 4065 const char* reason) V8_OVERRIDE {
4014 // We only generate either int32 or generic tagged bitwise operations. 4066 // We only generate either int32 or generic tagged bitwise operations.
4015 if (new_rep.IsDouble()) new_rep = Representation::Integer32(); 4067 if (new_rep.IsDouble()) new_rep = Representation::Integer32();
4016 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4068 HBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4017 } 4069 }
4018 4070
(...skipping 14 matching lines...) Expand all
4033 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4085 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4034 }; 4086 };
4035 4087
4036 4088
4037 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation { 4089 class HMathFloorOfDiv V8_FINAL : public HBinaryOperation {
4038 public: 4090 public:
4039 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv, 4091 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HMathFloorOfDiv,
4040 HValue*, 4092 HValue*,
4041 HValue*); 4093 HValue*);
4042 4094
4043 virtual HValue* EnsureAndPropagateNotMinusZero(
4044 BitVector* visited) V8_OVERRIDE;
4045
4046 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) 4095 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv)
4047 4096
4048 protected: 4097 protected:
4049 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4098 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4050 4099
4051 private: 4100 private:
4052 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) 4101 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right)
4053 : HBinaryOperation(context, left, right) { 4102 : HBinaryOperation(context, left, right) {
4054 set_representation(Representation::Integer32()); 4103 set_representation(Representation::Integer32());
4055 SetFlag(kUseGVN); 4104 SetFlag(kUseGVN);
4056 SetFlag(kCanOverflow); 4105 SetFlag(kCanOverflow);
4057 if (!right->IsConstant()) { 4106 SetFlag(kCanBeDivByZero);
4058 SetFlag(kCanBeDivByZero); 4107 SetFlag(kLeftCanBeMinInt);
4059 }
4060 SetFlag(kAllowUndefinedAsNaN); 4108 SetFlag(kAllowUndefinedAsNaN);
4061 } 4109 }
4062 4110
4111 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
4112
4063 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4113 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4064 }; 4114 };
4065 4115
4066 4116
4067 class HArithmeticBinaryOperation : public HBinaryOperation { 4117 class HArithmeticBinaryOperation : public HBinaryOperation {
4068 public: 4118 public:
4069 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) 4119 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right)
4070 : HBinaryOperation(context, left, right, HType::TaggedNumber()) { 4120 : HBinaryOperation(context, left, right, HType::TaggedNumber()) {
4071 SetAllSideEffects(); 4121 SetAllSideEffects();
4072 SetFlag(kFlexibleRepresentation); 4122 SetFlag(kFlexibleRepresentation);
4073 SetFlag(kAllowUndefinedAsNaN); 4123 SetFlag(kAllowUndefinedAsNaN);
4074 } 4124 }
4075 4125
4076 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4126 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4077 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4078 if (to.IsTagged() && 4127 if (to.IsTagged() &&
4079 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) { 4128 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved())) {
4080 SetAllSideEffects(); 4129 SetAllSideEffects();
4081 ClearFlag(kUseGVN); 4130 ClearFlag(kUseGVN);
4082 } else { 4131 } else {
4083 ClearAllSideEffects(); 4132 ClearAllSideEffects();
4084 SetFlag(kUseGVN); 4133 SetFlag(kUseGVN);
4085 } 4134 }
4086 } 4135 if (to.IsTagged()) SetChangesFlag(kNewSpacePromotion);
4087
4088 bool RightIsPowerOf2() {
4089 if (!right()->IsInteger32Constant()) return false;
4090 int32_t value = right()->GetInteger32Constant();
4091 return value != 0 && (IsPowerOf2(value) || IsPowerOf2(-value));
4092 } 4136 }
4093 4137
4094 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation) 4138 DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
4095 4139
4096 private: 4140 private:
4097 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 4141 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
4098 }; 4142 };
4099 4143
4100 4144
4101 class HCompareGeneric V8_FINAL : public HBinaryOperation { 4145 class HCompareGeneric V8_FINAL : public HBinaryOperation {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
4231 4275
4232 private: 4276 private:
4233 explicit HCompareMinusZeroAndBranch(HValue* value) 4277 explicit HCompareMinusZeroAndBranch(HValue* value)
4234 : HUnaryControlInstruction(value, NULL, NULL) { 4278 : HUnaryControlInstruction(value, NULL, NULL) {
4235 } 4279 }
4236 }; 4280 };
4237 4281
4238 4282
4239 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> { 4283 class HCompareObjectEqAndBranch : public HTemplateControlInstruction<2, 2> {
4240 public: 4284 public:
4241 HCompareObjectEqAndBranch(HValue* left,
4242 HValue* right,
4243 HBasicBlock* true_target = NULL,
4244 HBasicBlock* false_target = NULL) {
4245 // TODO(danno): make this private when the IfBuilder properly constructs
4246 // control flow instructions.
4247 ASSERT(!left->IsConstant() ||
4248 (!HConstant::cast(left)->HasInteger32Value() ||
4249 HConstant::cast(left)->HasSmiValue()));
4250 ASSERT(!right->IsConstant() ||
4251 (!HConstant::cast(right)->HasInteger32Value() ||
4252 HConstant::cast(right)->HasSmiValue()));
4253 SetOperandAt(0, left);
4254 SetOperandAt(1, right);
4255 SetSuccessorAt(0, true_target);
4256 SetSuccessorAt(1, false_target);
4257 }
4258
4259 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); 4285 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*);
4260 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*, 4286 DECLARE_INSTRUCTION_FACTORY_P4(HCompareObjectEqAndBranch, HValue*, HValue*,
4261 HBasicBlock*, HBasicBlock*); 4287 HBasicBlock*, HBasicBlock*);
4262 4288
4263 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4289 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4264 4290
4265 HValue* left() { return OperandAt(0); } 4291 HValue* left() { return OperandAt(0); }
4266 HValue* right() { return OperandAt(1); } 4292 HValue* right() { return OperandAt(1); }
4267 4293
4268 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4294 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4269 4295
4270 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4296 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4271 return Representation::Tagged(); 4297 return Representation::Tagged();
4272 } 4298 }
4273 4299
4274 virtual Representation observed_input_representation(int index) V8_OVERRIDE { 4300 virtual Representation observed_input_representation(int index) V8_OVERRIDE {
4275 return Representation::Tagged(); 4301 return Representation::Tagged();
4276 } 4302 }
4277 4303
4278 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch) 4304 DECLARE_CONCRETE_INSTRUCTION(CompareObjectEqAndBranch)
4305
4306 private:
4307 HCompareObjectEqAndBranch(HValue* left,
4308 HValue* right,
4309 HBasicBlock* true_target = NULL,
4310 HBasicBlock* false_target = NULL) {
4311 ASSERT(!left->IsConstant() ||
4312 (!HConstant::cast(left)->HasInteger32Value() ||
4313 HConstant::cast(left)->HasSmiValue()));
4314 ASSERT(!right->IsConstant() ||
4315 (!HConstant::cast(right)->HasInteger32Value() ||
4316 HConstant::cast(right)->HasSmiValue()));
4317 SetOperandAt(0, left);
4318 SetOperandAt(1, right);
4319 SetSuccessorAt(0, true_target);
4320 SetSuccessorAt(1, false_target);
4321 }
4279 }; 4322 };
4280 4323
4281 4324
4282 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction { 4325 class HIsObjectAndBranch V8_FINAL : public HUnaryControlInstruction {
4283 public: 4326 public:
4284 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*); 4327 DECLARE_INSTRUCTION_FACTORY_P1(HIsObjectAndBranch, HValue*);
4285 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*, 4328 DECLARE_INSTRUCTION_FACTORY_P3(HIsObjectAndBranch, HValue*,
4286 HBasicBlock*, HBasicBlock*); 4329 HBasicBlock*, HBasicBlock*);
4287 4330
4288 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4331 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4289 return Representation::Tagged(); 4332 return Representation::Tagged();
4290 } 4333 }
4291 4334
4335 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4336
4292 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch) 4337 DECLARE_CONCRETE_INSTRUCTION(IsObjectAndBranch)
4293 4338
4294 private: 4339 private:
4295 HIsObjectAndBranch(HValue* value, 4340 HIsObjectAndBranch(HValue* value,
4296 HBasicBlock* true_target = NULL, 4341 HBasicBlock* true_target = NULL,
4297 HBasicBlock* false_target = NULL) 4342 HBasicBlock* false_target = NULL)
4298 : HUnaryControlInstruction(value, true_target, false_target) {} 4343 : HUnaryControlInstruction(value, true_target, false_target) {}
4299 }; 4344 };
4300 4345
4301 4346
4302 class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction { 4347 class HIsStringAndBranch V8_FINAL : public HUnaryControlInstruction {
4303 public: 4348 public:
4304 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*); 4349 DECLARE_INSTRUCTION_FACTORY_P1(HIsStringAndBranch, HValue*);
4305 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*, 4350 DECLARE_INSTRUCTION_FACTORY_P3(HIsStringAndBranch, HValue*,
4306 HBasicBlock*, HBasicBlock*); 4351 HBasicBlock*, HBasicBlock*);
4307 4352
4308 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4353 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4309 return Representation::Tagged(); 4354 return Representation::Tagged();
4310 } 4355 }
4311 4356
4357 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4358
4312 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch) 4359 DECLARE_CONCRETE_INSTRUCTION(IsStringAndBranch)
4313 4360
4314 protected: 4361 protected:
4315 virtual int RedefinedOperandIndex() { return 0; } 4362 virtual int RedefinedOperandIndex() { return 0; }
4316 4363
4317 private: 4364 private:
4318 HIsStringAndBranch(HValue* value, 4365 HIsStringAndBranch(HValue* value,
4319 HBasicBlock* true_target = NULL, 4366 HBasicBlock* true_target = NULL,
4320 HBasicBlock* false_target = NULL) 4367 HBasicBlock* false_target = NULL)
4321 : HUnaryControlInstruction(value, true_target, false_target) {} 4368 : HUnaryControlInstruction(value, true_target, false_target) {}
(...skipping 27 matching lines...) Expand all
4349 class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction { 4396 class HIsUndetectableAndBranch V8_FINAL : public HUnaryControlInstruction {
4350 public: 4397 public:
4351 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*); 4398 DECLARE_INSTRUCTION_FACTORY_P1(HIsUndetectableAndBranch, HValue*);
4352 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*, 4399 DECLARE_INSTRUCTION_FACTORY_P3(HIsUndetectableAndBranch, HValue*,
4353 HBasicBlock*, HBasicBlock*); 4400 HBasicBlock*, HBasicBlock*);
4354 4401
4355 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4402 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4356 return Representation::Tagged(); 4403 return Representation::Tagged();
4357 } 4404 }
4358 4405
4406 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4407
4359 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch) 4408 DECLARE_CONCRETE_INSTRUCTION(IsUndetectableAndBranch)
4360 4409
4361 private: 4410 private:
4362 HIsUndetectableAndBranch(HValue* value, 4411 HIsUndetectableAndBranch(HValue* value,
4363 HBasicBlock* true_target = NULL, 4412 HBasicBlock* true_target = NULL,
4364 HBasicBlock* false_target = NULL) 4413 HBasicBlock* false_target = NULL)
4365 : HUnaryControlInstruction(value, true_target, false_target) {} 4414 : HUnaryControlInstruction(value, true_target, false_target) {}
4366 }; 4415 };
4367 4416
4368 4417
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
4431 4480
4432 InstanceType from() { return from_; } 4481 InstanceType from() { return from_; }
4433 InstanceType to() { return to_; } 4482 InstanceType to() { return to_; }
4434 4483
4435 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4484 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4436 4485
4437 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4486 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4438 return Representation::Tagged(); 4487 return Representation::Tagged();
4439 } 4488 }
4440 4489
4490 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4491
4441 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch) 4492 DECLARE_CONCRETE_INSTRUCTION(HasInstanceTypeAndBranch)
4442 4493
4443 private: 4494 private:
4444 HHasInstanceTypeAndBranch(HValue* value, InstanceType type) 4495 HHasInstanceTypeAndBranch(HValue* value, InstanceType type)
4445 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { } 4496 : HUnaryControlInstruction(value, NULL, NULL), from_(type), to_(type) { }
4446 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to) 4497 HHasInstanceTypeAndBranch(HValue* value, InstanceType from, InstanceType to)
4447 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) { 4498 : HUnaryControlInstruction(value, NULL, NULL), from_(from), to_(to) {
4448 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. 4499 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
4449 } 4500 }
4450 4501
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
4512 class_name_(class_name) { } 4563 class_name_(class_name) { }
4513 4564
4514 Handle<String> class_name_; 4565 Handle<String> class_name_;
4515 }; 4566 };
4516 4567
4517 4568
4518 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction { 4569 class HTypeofIsAndBranch V8_FINAL : public HUnaryControlInstruction {
4519 public: 4570 public:
4520 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>); 4571 DECLARE_INSTRUCTION_FACTORY_P2(HTypeofIsAndBranch, HValue*, Handle<String>);
4521 4572
4522 Handle<String> type_literal() { return type_literal_; } 4573 Handle<String> type_literal() { return type_literal_.handle(); }
4523 bool compares_number_type() { return compares_number_type_; }
4524 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 4574 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
4525 4575
4526 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch) 4576 DECLARE_CONCRETE_INSTRUCTION(TypeofIsAndBranch)
4527 4577
4528 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4578 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4529 return Representation::None(); 4579 return Representation::None();
4530 } 4580 }
4531 4581
4532 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE; 4582 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE;
4533 4583
4584 virtual void FinalizeUniqueness() V8_OVERRIDE {
4585 type_literal_ = Unique<String>(type_literal_.handle());
4586 }
4587
4534 private: 4588 private:
4535 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal) 4589 HTypeofIsAndBranch(HValue* value, Handle<String> type_literal)
4536 : HUnaryControlInstruction(value, NULL, NULL), 4590 : HUnaryControlInstruction(value, NULL, NULL),
4537 type_literal_(type_literal) { 4591 type_literal_(Unique<String>::CreateUninitialized(type_literal)) { }
4538 Heap* heap = type_literal->GetHeap();
4539 compares_number_type_ = type_literal->Equals(heap->number_string());
4540 }
4541 4592
4542 Handle<String> type_literal_; 4593 Unique<String> type_literal_;
4543 bool compares_number_type_ : 1;
4544 }; 4594 };
4545 4595
4546 4596
4547 class HInstanceOf V8_FINAL : public HBinaryOperation { 4597 class HInstanceOf V8_FINAL : public HBinaryOperation {
4548 public: 4598 public:
4549 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*); 4599 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P2(HInstanceOf, HValue*, HValue*);
4550 4600
4551 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 4601 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
4552 return Representation::Tagged(); 4602 return Representation::Tagged();
4553 } 4603 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
4642 HValue* left, 4692 HValue* left,
4643 HValue* right); 4693 HValue* right);
4644 4694
4645 // Add is only commutative if two integer values are added and not if two 4695 // Add is only commutative if two integer values are added and not if two
4646 // tagged values are added (because it might be a String concatenation). 4696 // tagged values are added (because it might be a String concatenation).
4647 // We also do not commute (pointer + offset). 4697 // We also do not commute (pointer + offset).
4648 virtual bool IsCommutative() const V8_OVERRIDE { 4698 virtual bool IsCommutative() const V8_OVERRIDE {
4649 return !representation().IsTagged() && !representation().IsExternal(); 4699 return !representation().IsTagged() && !representation().IsExternal();
4650 } 4700 }
4651 4701
4652 virtual HValue* EnsureAndPropagateNotMinusZero(
4653 BitVector* visited) V8_OVERRIDE;
4654
4655 virtual HValue* Canonicalize() V8_OVERRIDE; 4702 virtual HValue* Canonicalize() V8_OVERRIDE;
4656 4703
4657 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { 4704 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE {
4658 if (left()->IsInteger32Constant()) { 4705 if (left()->IsInteger32Constant()) {
4659 decomposition->Apply(right(), left()->GetInteger32Constant()); 4706 decomposition->Apply(right(), left()->GetInteger32Constant());
4660 return true; 4707 return true;
4661 } else if (right()->IsInteger32Constant()) { 4708 } else if (right()->IsInteger32Constant()) {
4662 decomposition->Apply(left(), right()->GetInteger32Constant()); 4709 decomposition->Apply(left(), right()->GetInteger32Constant());
4663 return true; 4710 return true;
4664 } else { 4711 } else {
4665 return false; 4712 return false;
4666 } 4713 }
4667 } 4714 }
4668 4715
4669 virtual void RepresentationChanged(Representation to) V8_OVERRIDE { 4716 virtual void RepresentationChanged(Representation to) V8_OVERRIDE {
4670 if (to.IsTagged()) {
4671 SetChangesFlag(kNewSpacePromotion);
4672 ClearFlag(kAllowUndefinedAsNaN);
4673 }
4674 if (to.IsTagged() && 4717 if (to.IsTagged() &&
4675 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() || 4718 (left()->ToNumberCanBeObserved() || right()->ToNumberCanBeObserved() ||
4676 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) { 4719 left()->ToStringCanBeObserved() || right()->ToStringCanBeObserved())) {
4677 SetAllSideEffects(); 4720 SetAllSideEffects();
4678 ClearFlag(kUseGVN); 4721 ClearFlag(kUseGVN);
4679 } else { 4722 } else {
4680 ClearAllSideEffects(); 4723 ClearAllSideEffects();
4681 SetFlag(kUseGVN); 4724 SetFlag(kUseGVN);
4682 } 4725 }
4726 if (to.IsTagged()) {
4727 SetChangesFlag(kNewSpacePromotion);
4728 ClearFlag(kAllowUndefinedAsNaN);
4729 }
4683 } 4730 }
4684 4731
4685 virtual Representation RepresentationFromInputs() V8_OVERRIDE; 4732 virtual Representation RepresentationFromInputs() V8_OVERRIDE;
4686 4733
4687 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE; 4734 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE;
4688 4735
4689 DECLARE_CONCRETE_INSTRUCTION(Add) 4736 DECLARE_CONCRETE_INSTRUCTION(Add)
4690 4737
4691 protected: 4738 protected:
4692 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4739 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4693 4740
4694 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4741 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
4695 4742
4696 private: 4743 private:
4697 HAdd(HValue* context, HValue* left, HValue* right) 4744 HAdd(HValue* context, HValue* left, HValue* right)
4698 : HArithmeticBinaryOperation(context, left, right) { 4745 : HArithmeticBinaryOperation(context, left, right) {
4699 SetFlag(kCanOverflow); 4746 SetFlag(kCanOverflow);
4700 } 4747 }
4701 }; 4748 };
4702 4749
4703 4750
4704 class HSub V8_FINAL : public HArithmeticBinaryOperation { 4751 class HSub V8_FINAL : public HArithmeticBinaryOperation {
4705 public: 4752 public:
4706 static HInstruction* New(Zone* zone, 4753 static HInstruction* New(Zone* zone,
4707 HValue* context, 4754 HValue* context,
4708 HValue* left, 4755 HValue* left,
4709 HValue* right); 4756 HValue* right);
4710 4757
4711 virtual HValue* EnsureAndPropagateNotMinusZero(
4712 BitVector* visited) V8_OVERRIDE;
4713
4714 virtual HValue* Canonicalize() V8_OVERRIDE; 4758 virtual HValue* Canonicalize() V8_OVERRIDE;
4715 4759
4716 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE { 4760 virtual bool TryDecompose(DecompositionResult* decomposition) V8_OVERRIDE {
4717 if (right()->IsInteger32Constant()) { 4761 if (right()->IsInteger32Constant()) {
4718 decomposition->Apply(left(), -right()->GetInteger32Constant()); 4762 decomposition->Apply(left(), -right()->GetInteger32Constant());
4719 return true; 4763 return true;
4720 } else { 4764 } else {
4721 return false; 4765 return false;
4722 } 4766 }
4723 } 4767 }
(...skipping 26 matching lines...) Expand all
4750 HValue* right) { 4794 HValue* right) {
4751 HInstruction* instr = HMul::New(zone, context, left, right); 4795 HInstruction* instr = HMul::New(zone, context, left, right);
4752 if (!instr->IsMul()) return instr; 4796 if (!instr->IsMul()) return instr;
4753 HMul* mul = HMul::cast(instr); 4797 HMul* mul = HMul::cast(instr);
4754 // TODO(mstarzinger): Prevent bailout on minus zero for imul. 4798 // TODO(mstarzinger): Prevent bailout on minus zero for imul.
4755 mul->AssumeRepresentation(Representation::Integer32()); 4799 mul->AssumeRepresentation(Representation::Integer32());
4756 mul->ClearFlag(HValue::kCanOverflow); 4800 mul->ClearFlag(HValue::kCanOverflow);
4757 return mul; 4801 return mul;
4758 } 4802 }
4759 4803
4760 virtual HValue* EnsureAndPropagateNotMinusZero(
4761 BitVector* visited) V8_OVERRIDE;
4762
4763 virtual HValue* Canonicalize() V8_OVERRIDE; 4804 virtual HValue* Canonicalize() V8_OVERRIDE;
4764 4805
4765 // Only commutative if it is certain that not two objects are multiplicated. 4806 // Only commutative if it is certain that not two objects are multiplicated.
4766 virtual bool IsCommutative() const V8_OVERRIDE { 4807 virtual bool IsCommutative() const V8_OVERRIDE {
4767 return !representation().IsTagged(); 4808 return !representation().IsTagged();
4768 } 4809 }
4769 4810
4770 virtual void UpdateRepresentation(Representation new_rep, 4811 virtual void UpdateRepresentation(Representation new_rep,
4771 HInferRepresentationPhase* h_infer, 4812 HInferRepresentationPhase* h_infer,
4772 const char* reason) V8_OVERRIDE { 4813 const char* reason) V8_OVERRIDE {
(...skipping 17 matching lines...) Expand all
4790 }; 4831 };
4791 4832
4792 4833
4793 class HMod V8_FINAL : public HArithmeticBinaryOperation { 4834 class HMod V8_FINAL : public HArithmeticBinaryOperation {
4794 public: 4835 public:
4795 static HInstruction* New(Zone* zone, 4836 static HInstruction* New(Zone* zone,
4796 HValue* context, 4837 HValue* context,
4797 HValue* left, 4838 HValue* left,
4798 HValue* right); 4839 HValue* right);
4799 4840
4800 virtual HValue* EnsureAndPropagateNotMinusZero(
4801 BitVector* visited) V8_OVERRIDE;
4802
4803 virtual HValue* Canonicalize() V8_OVERRIDE; 4841 virtual HValue* Canonicalize() V8_OVERRIDE;
4804 4842
4805 virtual void UpdateRepresentation(Representation new_rep, 4843 virtual void UpdateRepresentation(Representation new_rep,
4806 HInferRepresentationPhase* h_infer, 4844 HInferRepresentationPhase* h_infer,
4807 const char* reason) V8_OVERRIDE { 4845 const char* reason) V8_OVERRIDE {
4808 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 4846 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
4809 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4847 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4810 } 4848 }
4811 4849
4812 DECLARE_CONCRETE_INSTRUCTION(Mod) 4850 DECLARE_CONCRETE_INSTRUCTION(Mod)
4813 4851
4814 protected: 4852 protected:
4815 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; } 4853 virtual bool DataEquals(HValue* other) V8_OVERRIDE { return true; }
4816 4854
4817 virtual Range* InferRange(Zone* zone) V8_OVERRIDE; 4855 virtual Range* InferRange(Zone* zone) V8_OVERRIDE;
4818 4856
4819 private: 4857 private:
4820 HMod(HValue* context, 4858 HMod(HValue* context,
4821 HValue* left, 4859 HValue* left,
4822 HValue* right) : HArithmeticBinaryOperation(context, left, right) { 4860 HValue* right) : HArithmeticBinaryOperation(context, left, right) {
4823 SetFlag(kCanBeDivByZero); 4861 SetFlag(kCanBeDivByZero);
4824 SetFlag(kCanOverflow); 4862 SetFlag(kCanOverflow);
4863 SetFlag(kLeftCanBeNegative);
4825 } 4864 }
4826 }; 4865 };
4827 4866
4828 4867
4829 class HDiv V8_FINAL : public HArithmeticBinaryOperation { 4868 class HDiv V8_FINAL : public HArithmeticBinaryOperation {
4830 public: 4869 public:
4831 static HInstruction* New(Zone* zone, 4870 static HInstruction* New(Zone* zone,
4832 HValue* context, 4871 HValue* context,
4833 HValue* left, 4872 HValue* left,
4834 HValue* right); 4873 HValue* right);
4835 4874
4836 virtual HValue* EnsureAndPropagateNotMinusZero(
4837 BitVector* visited) V8_OVERRIDE;
4838
4839 virtual HValue* Canonicalize() V8_OVERRIDE; 4875 virtual HValue* Canonicalize() V8_OVERRIDE;
4840 4876
4841 virtual void UpdateRepresentation(Representation new_rep, 4877 virtual void UpdateRepresentation(Representation new_rep,
4842 HInferRepresentationPhase* h_infer, 4878 HInferRepresentationPhase* h_infer,
4843 const char* reason) V8_OVERRIDE { 4879 const char* reason) V8_OVERRIDE {
4844 if (new_rep.IsSmi()) new_rep = Representation::Integer32(); 4880 if (new_rep.IsSmi()) new_rep = Representation::Integer32();
4845 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason); 4881 HArithmeticBinaryOperation::UpdateRepresentation(new_rep, h_infer, reason);
4846 } 4882 }
4847 4883
4848 DECLARE_CONCRETE_INSTRUCTION(Div) 4884 DECLARE_CONCRETE_INSTRUCTION(Div)
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5640 // Load and check the value of the context slot. Return undefined if it's 5676 // Load and check the value of the context slot. Return undefined if it's
5641 // the hole value. This is used for non-harmony const assignments 5677 // the hole value. This is used for non-harmony const assignments
5642 kCheckReturnUndefined 5678 kCheckReturnUndefined
5643 }; 5679 };
5644 5680
5645 HLoadContextSlot(HValue* context, Variable* var) 5681 HLoadContextSlot(HValue* context, Variable* var)
5646 : HUnaryOperation(context), slot_index_(var->index()) { 5682 : HUnaryOperation(context), slot_index_(var->index()) {
5647 ASSERT(var->IsContextSlot()); 5683 ASSERT(var->IsContextSlot());
5648 switch (var->mode()) { 5684 switch (var->mode()) {
5649 case LET: 5685 case LET:
5650 case CONST_HARMONY: 5686 case CONST:
5651 mode_ = kCheckDeoptimize; 5687 mode_ = kCheckDeoptimize;
5652 break; 5688 break;
5653 case CONST: 5689 case CONST_LEGACY:
5654 mode_ = kCheckReturnUndefined; 5690 mode_ = kCheckReturnUndefined;
5655 break; 5691 break;
5656 default: 5692 default:
5657 mode_ = kNoCheck; 5693 mode_ = kNoCheck;
5658 } 5694 }
5659 set_representation(Representation::Tagged()); 5695 set_representation(Representation::Tagged());
5660 SetFlag(kUseGVN); 5696 SetFlag(kUseGVN);
5661 SetDependsOnFlag(kContextSlots); 5697 SetDependsOnFlag(kContextSlots);
5662 } 5698 }
5663 5699
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
5819 } 5855 }
5820 5856
5821 static HObjectAccess ForNextFunctionLinkPointer() { 5857 static HObjectAccess ForNextFunctionLinkPointer() {
5822 return HObjectAccess(kInobject, JSFunction::kNextFunctionLinkOffset); 5858 return HObjectAccess(kInobject, JSFunction::kNextFunctionLinkOffset);
5823 } 5859 }
5824 5860
5825 static HObjectAccess ForArrayLength(ElementsKind elements_kind) { 5861 static HObjectAccess ForArrayLength(ElementsKind elements_kind) {
5826 return HObjectAccess( 5862 return HObjectAccess(
5827 kArrayLengths, 5863 kArrayLengths,
5828 JSArray::kLengthOffset, 5864 JSArray::kLengthOffset,
5829 IsFastElementsKind(elements_kind) && 5865 IsFastElementsKind(elements_kind)
5830 FLAG_track_fields 5866 ? Representation::Smi() : Representation::Tagged());
5831 ? Representation::Smi() : Representation::Tagged());
5832 } 5867 }
5833 5868
5834 static HObjectAccess ForAllocationSiteOffset(int offset); 5869 static HObjectAccess ForAllocationSiteOffset(int offset);
5835 5870
5836 static HObjectAccess ForAllocationSiteList() { 5871 static HObjectAccess ForAllocationSiteList() {
5837 return HObjectAccess(kExternalMemory, 0, Representation::Tagged(), 5872 return HObjectAccess(kExternalMemory, 0, Representation::Tagged(),
5838 Handle<String>::null(), false, false); 5873 Handle<String>::null(), false, false);
5839 } 5874 }
5840 5875
5841 static HObjectAccess ForFixedArrayLength() { 5876 static HObjectAccess ForFixedArrayLength() {
5842 return HObjectAccess( 5877 return HObjectAccess(
5843 kArrayLengths, 5878 kArrayLengths,
5844 FixedArray::kLengthOffset, 5879 FixedArray::kLengthOffset,
5845 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); 5880 Representation::Smi());
5846 } 5881 }
5847 5882
5848 static HObjectAccess ForStringHashField() { 5883 static HObjectAccess ForStringHashField() {
5849 return HObjectAccess(kInobject, 5884 return HObjectAccess(kInobject,
5850 String::kHashFieldOffset, 5885 String::kHashFieldOffset,
5851 Representation::Integer32()); 5886 Representation::Integer32());
5852 } 5887 }
5853 5888
5854 static HObjectAccess ForStringLength() { 5889 static HObjectAccess ForStringLength() {
5855 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); 5890 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
5856 return HObjectAccess( 5891 return HObjectAccess(
5857 kStringLengths, 5892 kStringLengths,
5858 String::kLengthOffset, 5893 String::kLengthOffset,
5859 FLAG_track_fields ? Representation::Smi() : Representation::Tagged()); 5894 Representation::Smi());
5860 } 5895 }
5861 5896
5862 static HObjectAccess ForConsStringFirst() { 5897 static HObjectAccess ForConsStringFirst() {
5863 return HObjectAccess(kInobject, ConsString::kFirstOffset); 5898 return HObjectAccess(kInobject, ConsString::kFirstOffset);
5864 } 5899 }
5865 5900
5866 static HObjectAccess ForConsStringSecond() { 5901 static HObjectAccess ForConsStringSecond() {
5867 return HObjectAccess(kInobject, ConsString::kSecondOffset); 5902 return HObjectAccess(kInobject, ConsString::kSecondOffset);
5868 } 5903 }
5869 5904
(...skipping 10 matching lines...) Expand all
5880 } 5915 }
5881 5916
5882 static HObjectAccess ForCodeEntryPointer() { 5917 static HObjectAccess ForCodeEntryPointer() {
5883 return HObjectAccess(kInobject, JSFunction::kCodeEntryOffset); 5918 return HObjectAccess(kInobject, JSFunction::kCodeEntryOffset);
5884 } 5919 }
5885 5920
5886 static HObjectAccess ForCodeOffset() { 5921 static HObjectAccess ForCodeOffset() {
5887 return HObjectAccess(kInobject, SharedFunctionInfo::kCodeOffset); 5922 return HObjectAccess(kInobject, SharedFunctionInfo::kCodeOffset);
5888 } 5923 }
5889 5924
5890 static HObjectAccess ForFirstCodeSlot() {
5891 return HObjectAccess(kInobject, SharedFunctionInfo::kFirstCodeSlot);
5892 }
5893
5894 static HObjectAccess ForFirstContextSlot() {
5895 return HObjectAccess(kInobject, SharedFunctionInfo::kFirstContextSlot);
5896 }
5897
5898 static HObjectAccess ForFirstOsrAstIdSlot() {
5899 return HObjectAccess(kInobject, SharedFunctionInfo::kFirstOsrAstIdSlot);
5900 }
5901
5902 static HObjectAccess ForOptimizedCodeMap() { 5925 static HObjectAccess ForOptimizedCodeMap() {
5903 return HObjectAccess(kInobject, 5926 return HObjectAccess(kInobject,
5904 SharedFunctionInfo::kOptimizedCodeMapOffset); 5927 SharedFunctionInfo::kOptimizedCodeMapOffset);
5905 } 5928 }
5906 5929
5907 static HObjectAccess ForFunctionContextPointer() { 5930 static HObjectAccess ForFunctionContextPointer() {
5908 return HObjectAccess(kInobject, JSFunction::kContextOffset); 5931 return HObjectAccess(kInobject, JSFunction::kContextOffset);
5909 } 5932 }
5910 5933
5911 static HObjectAccess ForMap() { 5934 static HObjectAccess ForMap() {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
6140 set_type(HType::Smi()); 6163 set_type(HType::Smi());
6141 if (SmiValuesAre32Bits()) { 6164 if (SmiValuesAre32Bits()) {
6142 set_representation(Representation::Integer32()); 6165 set_representation(Representation::Integer32());
6143 } else { 6166 } else {
6144 set_representation(representation); 6167 set_representation(representation);
6145 } 6168 }
6146 } else if (representation.IsDouble() || 6169 } else if (representation.IsDouble() ||
6147 representation.IsExternal() || 6170 representation.IsExternal() ||
6148 representation.IsInteger32()) { 6171 representation.IsInteger32()) {
6149 set_representation(representation); 6172 set_representation(representation);
6150 } else if (FLAG_track_heap_object_fields && 6173 } else if (representation.IsHeapObject()) {
6151 representation.IsHeapObject()) {
6152 set_type(HType::NonPrimitive()); 6174 set_type(HType::NonPrimitive());
6153 set_representation(Representation::Tagged()); 6175 set_representation(Representation::Tagged());
6154 } else { 6176 } else {
6155 set_representation(Representation::Tagged()); 6177 set_representation(Representation::Tagged());
6156 } 6178 }
6157 access.SetGVNFlags(this, LOAD); 6179 access.SetGVNFlags(this, LOAD);
6158 } 6180 }
6159 6181
6160 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 6182 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
6161 6183
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
6539 ASSERT(!has_transition()); // Only set once. 6561 ASSERT(!has_transition()); // Only set once.
6540 Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate())); 6562 Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate()));
6541 if (map->CanBeDeprecated()) { 6563 if (map->CanBeDeprecated()) {
6542 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); 6564 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info);
6543 } 6565 }
6544 SetOperandAt(2, map_constant); 6566 SetOperandAt(2, map_constant);
6545 has_transition_ = true; 6567 has_transition_ = true;
6546 } 6568 }
6547 6569
6548 bool NeedsWriteBarrier() { 6570 bool NeedsWriteBarrier() {
6549 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || 6571 ASSERT(!field_representation().IsDouble() || !has_transition());
6550 !has_transition());
6551 if (IsSkipWriteBarrier()) return false; 6572 if (IsSkipWriteBarrier()) return false;
6552 if (field_representation().IsDouble()) return false; 6573 if (field_representation().IsDouble()) return false;
6553 if (field_representation().IsSmi()) return false; 6574 if (field_representation().IsSmi()) return false;
6554 if (field_representation().IsInteger32()) return false; 6575 if (field_representation().IsInteger32()) return false;
6555 if (field_representation().IsExternal()) return false; 6576 if (field_representation().IsExternal()) return false;
6556 return StoringValueNeedsWriteBarrier(value()) && 6577 return StoringValueNeedsWriteBarrier(value()) &&
6557 ReceiverObjectNeedsWriteBarrier(object(), value(), 6578 ReceiverObjectNeedsWriteBarrier(object(), value(),
6558 new_space_dominator()); 6579 new_space_dominator());
6559 } 6580 }
6560 6581
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
6597 WriteBarrierMode write_barrier_mode_ : 1; 6618 WriteBarrierMode write_barrier_mode_ : 1;
6598 bool has_transition_ : 1; 6619 bool has_transition_ : 1;
6599 StoreFieldOrKeyedMode store_mode_ : 1; 6620 StoreFieldOrKeyedMode store_mode_ : 1;
6600 }; 6621 };
6601 6622
6602 6623
6603 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6624 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6604 public: 6625 public:
6605 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, 6626 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6606 Handle<String>, HValue*, 6627 Handle<String>, HValue*,
6607 StrictModeFlag); 6628 StrictMode);
6608 HValue* object() { return OperandAt(0); } 6629 HValue* object() { return OperandAt(0); }
6609 HValue* value() { return OperandAt(1); } 6630 HValue* value() { return OperandAt(1); }
6610 HValue* context() { return OperandAt(2); } 6631 HValue* context() { return OperandAt(2); }
6611 Handle<String> name() { return name_; } 6632 Handle<String> name() { return name_; }
6612 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } 6633 StrictMode strict_mode() { return strict_mode_; }
6613 6634
6614 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6635 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6615 6636
6616 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6637 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6617 return Representation::Tagged(); 6638 return Representation::Tagged();
6618 } 6639 }
6619 6640
6620 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric) 6641 DECLARE_CONCRETE_INSTRUCTION(StoreNamedGeneric)
6621 6642
6622 private: 6643 private:
6623 HStoreNamedGeneric(HValue* context, 6644 HStoreNamedGeneric(HValue* context,
6624 HValue* object, 6645 HValue* object,
6625 Handle<String> name, 6646 Handle<String> name,
6626 HValue* value, 6647 HValue* value,
6627 StrictModeFlag strict_mode_flag) 6648 StrictMode strict_mode)
6628 : name_(name), 6649 : name_(name),
6629 strict_mode_flag_(strict_mode_flag) { 6650 strict_mode_(strict_mode) {
6630 SetOperandAt(0, object); 6651 SetOperandAt(0, object);
6631 SetOperandAt(1, value); 6652 SetOperandAt(1, value);
6632 SetOperandAt(2, context); 6653 SetOperandAt(2, context);
6633 SetAllSideEffects(); 6654 SetAllSideEffects();
6634 } 6655 }
6635 6656
6636 Handle<String> name_; 6657 Handle<String> name_;
6637 StrictModeFlag strict_mode_flag_; 6658 StrictMode strict_mode_;
6638 }; 6659 };
6639 6660
6640 6661
6641 class HStoreKeyed V8_FINAL 6662 class HStoreKeyed V8_FINAL
6642 : public HTemplateInstruction<3>, public ArrayInstructionInterface { 6663 : public HTemplateInstruction<3>, public ArrayInstructionInterface {
6643 public: 6664 public:
6644 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, 6665 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*,
6645 ElementsKind); 6666 ElementsKind);
6646 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*, 6667 DECLARE_INSTRUCTION_FACTORY_P5(HStoreKeyed, HValue*, HValue*, HValue*,
6647 ElementsKind, StoreFieldOrKeyedMode); 6668 ElementsKind, StoreFieldOrKeyedMode);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
6809 bool is_dehoisted_ : 1; 6830 bool is_dehoisted_ : 1;
6810 bool is_uninitialized_ : 1; 6831 bool is_uninitialized_ : 1;
6811 StoreFieldOrKeyedMode store_mode_: 1; 6832 StoreFieldOrKeyedMode store_mode_: 1;
6812 HValue* new_space_dominator_; 6833 HValue* new_space_dominator_;
6813 }; 6834 };
6814 6835
6815 6836
6816 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> { 6837 class HStoreKeyedGeneric V8_FINAL : public HTemplateInstruction<4> {
6817 public: 6838 public:
6818 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*, 6839 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreKeyedGeneric, HValue*,
6819 HValue*, HValue*, StrictModeFlag); 6840 HValue*, HValue*, StrictMode);
6820 6841
6821 HValue* object() { return OperandAt(0); } 6842 HValue* object() { return OperandAt(0); }
6822 HValue* key() { return OperandAt(1); } 6843 HValue* key() { return OperandAt(1); }
6823 HValue* value() { return OperandAt(2); } 6844 HValue* value() { return OperandAt(2); }
6824 HValue* context() { return OperandAt(3); } 6845 HValue* context() { return OperandAt(3); }
6825 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } 6846 StrictMode strict_mode() { return strict_mode_; }
6826 6847
6827 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 6848 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
6828 // tagged[tagged] = tagged 6849 // tagged[tagged] = tagged
6829 return Representation::Tagged(); 6850 return Representation::Tagged();
6830 } 6851 }
6831 6852
6832 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 6853 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
6833 6854
6834 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) 6855 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric)
6835 6856
6836 private: 6857 private:
6837 HStoreKeyedGeneric(HValue* context, 6858 HStoreKeyedGeneric(HValue* context,
6838 HValue* object, 6859 HValue* object,
6839 HValue* key, 6860 HValue* key,
6840 HValue* value, 6861 HValue* value,
6841 StrictModeFlag strict_mode_flag) 6862 StrictMode strict_mode)
6842 : strict_mode_flag_(strict_mode_flag) { 6863 : strict_mode_(strict_mode) {
6843 SetOperandAt(0, object); 6864 SetOperandAt(0, object);
6844 SetOperandAt(1, key); 6865 SetOperandAt(1, key);
6845 SetOperandAt(2, value); 6866 SetOperandAt(2, value);
6846 SetOperandAt(3, context); 6867 SetOperandAt(3, context);
6847 SetAllSideEffects(); 6868 SetAllSideEffects();
6848 } 6869 }
6849 6870
6850 StrictModeFlag strict_mode_flag_; 6871 StrictMode strict_mode_;
6851 }; 6872 };
6852 6873
6853 6874
6854 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> { 6875 class HTransitionElementsKind V8_FINAL : public HTemplateInstruction<2> {
6855 public: 6876 public:
6856 inline static HTransitionElementsKind* New(Zone* zone, 6877 inline static HTransitionElementsKind* New(Zone* zone,
6857 HValue* context, 6878 HValue* context,
6858 HValue* object, 6879 HValue* object,
6859 Handle<Map> original_map, 6880 Handle<Map> original_map,
6860 Handle<Map> transitioned_map) { 6881 Handle<Map> transitioned_map) {
(...skipping 16 matching lines...) Expand all
6877 6898
6878 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) 6899 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind)
6879 6900
6880 protected: 6901 protected:
6881 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 6902 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
6882 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); 6903 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other);
6883 return original_map_ == instr->original_map_ && 6904 return original_map_ == instr->original_map_ &&
6884 transitioned_map_ == instr->transitioned_map_; 6905 transitioned_map_ == instr->transitioned_map_;
6885 } 6906 }
6886 6907
6908 virtual int RedefinedOperandIndex() { return 0; }
6909
6887 private: 6910 private:
6888 HTransitionElementsKind(HValue* context, 6911 HTransitionElementsKind(HValue* context,
6889 HValue* object, 6912 HValue* object,
6890 Handle<Map> original_map, 6913 Handle<Map> original_map,
6891 Handle<Map> transitioned_map) 6914 Handle<Map> transitioned_map)
6892 : original_map_(Unique<Map>(original_map)), 6915 : original_map_(Unique<Map>(original_map)),
6893 transitioned_map_(Unique<Map>(transitioned_map)), 6916 transitioned_map_(Unique<Map>(transitioned_map)),
6894 from_kind_(original_map->elements_kind()), 6917 from_kind_(original_map->elements_kind()),
6895 to_kind_(transitioned_map->elements_kind()) { 6918 to_kind_(transitioned_map->elements_kind()) {
6896 SetOperandAt(0, object); 6919 SetOperandAt(0, object);
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
7126 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 7149 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
7127 return Representation::Tagged(); 7150 return Representation::Tagged();
7128 } 7151 }
7129 7152
7130 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral) 7153 DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
7131 7154
7132 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; } 7155 Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
7133 bool pretenure() const { return pretenure_; } 7156 bool pretenure() const { return pretenure_; }
7134 bool has_no_literals() const { return has_no_literals_; } 7157 bool has_no_literals() const { return has_no_literals_; }
7135 bool is_generator() const { return is_generator_; } 7158 bool is_generator() const { return is_generator_; }
7136 LanguageMode language_mode() const { return language_mode_; } 7159 StrictMode strict_mode() const { return strict_mode_; }
7137 7160
7138 private: 7161 private:
7139 HFunctionLiteral(HValue* context, 7162 HFunctionLiteral(HValue* context,
7140 Handle<SharedFunctionInfo> shared, 7163 Handle<SharedFunctionInfo> shared,
7141 bool pretenure) 7164 bool pretenure)
7142 : HTemplateInstruction<1>(HType::JSObject()), 7165 : HTemplateInstruction<1>(HType::JSObject()),
7143 shared_info_(shared), 7166 shared_info_(shared),
7144 pretenure_(pretenure), 7167 pretenure_(pretenure),
7145 has_no_literals_(shared->num_literals() == 0), 7168 has_no_literals_(shared->num_literals() == 0),
7146 is_generator_(shared->is_generator()), 7169 is_generator_(shared->is_generator()),
7147 language_mode_(shared->language_mode()) { 7170 strict_mode_(shared->strict_mode()) {
7148 SetOperandAt(0, context); 7171 SetOperandAt(0, context);
7149 set_representation(Representation::Tagged()); 7172 set_representation(Representation::Tagged());
7150 SetChangesFlag(kNewSpacePromotion); 7173 SetChangesFlag(kNewSpacePromotion);
7151 } 7174 }
7152 7175
7153 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7176 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7154 7177
7155 Handle<SharedFunctionInfo> shared_info_; 7178 Handle<SharedFunctionInfo> shared_info_;
7156 bool pretenure_ : 1; 7179 bool pretenure_ : 1;
7157 bool has_no_literals_ : 1; 7180 bool has_no_literals_ : 1;
7158 bool is_generator_ : 1; 7181 bool is_generator_ : 1;
7159 LanguageMode language_mode_; 7182 StrictMode strict_mode_;
7160 }; 7183 };
7161 7184
7162 7185
7163 class HTypeof V8_FINAL : public HTemplateInstruction<2> { 7186 class HTypeof V8_FINAL : public HTemplateInstruction<2> {
7164 public: 7187 public:
7165 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*); 7188 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P1(HTypeof, HValue*);
7166 7189
7167 HValue* context() { return OperandAt(0); } 7190 HValue* context() { return OperandAt(0); }
7168 HValue* value() { return OperandAt(1); } 7191 HValue* value() { return OperandAt(1); }
7169 7192
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
7482 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7505 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7483 }; 7506 };
7484 7507
7485 7508
7486 #undef DECLARE_INSTRUCTION 7509 #undef DECLARE_INSTRUCTION
7487 #undef DECLARE_CONCRETE_INSTRUCTION 7510 #undef DECLARE_CONCRETE_INSTRUCTION
7488 7511
7489 } } // namespace v8::internal 7512 } } // namespace v8::internal
7490 7513
7491 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7514 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-gvn.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698