| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ | 28 #ifndef V8_HYDROGEN_INSTRUCTIONS_H_ |
| 29 #define V8_HYDROGEN_INSTRUCTIONS_H_ | 29 #define V8_HYDROGEN_INSTRUCTIONS_H_ |
| 30 | 30 |
| 31 #include "v8.h" | 31 #include "v8.h" |
| 32 | 32 |
| 33 #include "allocation.h" |
| 33 #include "code-stubs.h" | 34 #include "code-stubs.h" |
| 34 #include "data-flow.h" | 35 #include "data-flow.h" |
| 35 #include "small-pointer-list.h" | 36 #include "small-pointer-list.h" |
| 36 #include "string-stream.h" | 37 #include "string-stream.h" |
| 37 #include "zone.h" | 38 #include "zone.h" |
| 38 | 39 |
| 39 namespace v8 { | 40 namespace v8 { |
| 40 namespace internal { | 41 namespace internal { |
| 41 | 42 |
| 42 // Forward declarations. | 43 // Forward declarations. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 V(CallNew) \ | 80 V(CallNew) \ |
| 80 V(CallRuntime) \ | 81 V(CallRuntime) \ |
| 81 V(CallStub) \ | 82 V(CallStub) \ |
| 82 V(Change) \ | 83 V(Change) \ |
| 83 V(CheckFunction) \ | 84 V(CheckFunction) \ |
| 84 V(CheckInstanceType) \ | 85 V(CheckInstanceType) \ |
| 85 V(CheckMap) \ | 86 V(CheckMap) \ |
| 86 V(CheckNonSmi) \ | 87 V(CheckNonSmi) \ |
| 87 V(CheckPrototypeMaps) \ | 88 V(CheckPrototypeMaps) \ |
| 88 V(CheckSmi) \ | 89 V(CheckSmi) \ |
| 90 V(ClampToUint8) \ |
| 89 V(ClassOfTest) \ | 91 V(ClassOfTest) \ |
| 90 V(Compare) \ | 92 V(Compare) \ |
| 91 V(CompareJSObjectEq) \ | 93 V(CompareJSObjectEq) \ |
| 92 V(CompareMap) \ | 94 V(CompareMap) \ |
| 95 V(CompareSymbolEq) \ |
| 93 V(Constant) \ | 96 V(Constant) \ |
| 94 V(Context) \ | 97 V(Context) \ |
| 95 V(DeleteProperty) \ | 98 V(DeleteProperty) \ |
| 96 V(Deoptimize) \ | 99 V(Deoptimize) \ |
| 97 V(Div) \ | 100 V(Div) \ |
| 98 V(EnterInlined) \ | 101 V(EnterInlined) \ |
| 99 V(ExternalArrayLength) \ | 102 V(ExternalArrayLength) \ |
| 100 V(FixedArrayLength) \ | 103 V(FixedArrayLength) \ |
| 104 V(ForceRepresentation) \ |
| 101 V(FunctionLiteral) \ | 105 V(FunctionLiteral) \ |
| 102 V(GetCachedArrayIndex) \ | 106 V(GetCachedArrayIndex) \ |
| 103 V(GlobalObject) \ | 107 V(GlobalObject) \ |
| 104 V(GlobalReceiver) \ | 108 V(GlobalReceiver) \ |
| 105 V(Goto) \ | 109 V(Goto) \ |
| 106 V(HasInstanceType) \ | 110 V(HasInstanceType) \ |
| 107 V(HasCachedArrayIndex) \ | 111 V(HasCachedArrayIndex) \ |
| 108 V(In) \ | 112 V(In) \ |
| 109 V(InstanceOf) \ | 113 V(InstanceOf) \ |
| 110 V(InstanceOfKnownGlobal) \ | 114 V(InstanceOfKnownGlobal) \ |
| 111 V(InvokeFunction) \ | 115 V(InvokeFunction) \ |
| 116 V(IsConstructCall) \ |
| 112 V(IsNull) \ | 117 V(IsNull) \ |
| 113 V(IsObject) \ | 118 V(IsObject) \ |
| 114 V(IsSmi) \ | 119 V(IsSmi) \ |
| 115 V(IsConstructCall) \ | 120 V(IsUndetectable) \ |
| 116 V(JSArrayLength) \ | 121 V(JSArrayLength) \ |
| 117 V(LeaveInlined) \ | 122 V(LeaveInlined) \ |
| 118 V(LoadContextSlot) \ | 123 V(LoadContextSlot) \ |
| 119 V(LoadElements) \ | 124 V(LoadElements) \ |
| 120 V(LoadExternalArrayPointer) \ | 125 V(LoadExternalArrayPointer) \ |
| 121 V(LoadFunctionPrototype) \ | 126 V(LoadFunctionPrototype) \ |
| 122 V(LoadGlobalCell) \ | 127 V(LoadGlobalCell) \ |
| 123 V(LoadGlobalGeneric) \ | 128 V(LoadGlobalGeneric) \ |
| 124 V(LoadKeyedFastElement) \ | 129 V(LoadKeyedFastElement) \ |
| 125 V(LoadKeyedGeneric) \ | 130 V(LoadKeyedGeneric) \ |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 546 |
| 542 int id() const { return id_; } | 547 int id() const { return id_; } |
| 543 void set_id(int id) { id_ = id; } | 548 void set_id(int id) { id_ = id; } |
| 544 | 549 |
| 545 HUseIterator uses() const { return HUseIterator(use_list_); } | 550 HUseIterator uses() const { return HUseIterator(use_list_); } |
| 546 | 551 |
| 547 virtual bool EmitAtUses() { return false; } | 552 virtual bool EmitAtUses() { return false; } |
| 548 Representation representation() const { return representation_; } | 553 Representation representation() const { return representation_; } |
| 549 void ChangeRepresentation(Representation r) { | 554 void ChangeRepresentation(Representation r) { |
| 550 // Representation was already set and is allowed to be changed. | 555 // Representation was already set and is allowed to be changed. |
| 551 ASSERT(!representation_.IsNone()); | |
| 552 ASSERT(!r.IsNone()); | 556 ASSERT(!r.IsNone()); |
| 553 ASSERT(CheckFlag(kFlexibleRepresentation)); | 557 ASSERT(CheckFlag(kFlexibleRepresentation)); |
| 554 RepresentationChanged(r); | 558 RepresentationChanged(r); |
| 555 representation_ = r; | 559 representation_ = r; |
| 556 } | 560 } |
| 561 void AssumeRepresentation(Representation r); |
| 557 | 562 |
| 558 virtual bool IsConvertibleToInteger() const { return true; } | 563 virtual bool IsConvertibleToInteger() const { return true; } |
| 559 | 564 |
| 560 HType type() const { return type_; } | 565 HType type() const { return type_; } |
| 561 void set_type(HType type) { | 566 void set_type(HType type) { |
| 562 ASSERT(HasNoUses()); | 567 ASSERT(HasNoUses()); |
| 563 type_ = type; | 568 type_ = type; |
| 564 } | 569 } |
| 565 | 570 |
| 566 // An operation needs to override this function iff: | 571 // An operation needs to override this function iff: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // instruction with a new one, first add the new instruction to the graph, | 625 // instruction with a new one, first add the new instruction to the graph, |
| 621 // then return it. Return NULL to have the instruction deleted. | 626 // then return it. Return NULL to have the instruction deleted. |
| 622 virtual HValue* Canonicalize() { return this; } | 627 virtual HValue* Canonicalize() { return this; } |
| 623 | 628 |
| 624 bool Equals(HValue* other); | 629 bool Equals(HValue* other); |
| 625 virtual intptr_t Hashcode(); | 630 virtual intptr_t Hashcode(); |
| 626 | 631 |
| 627 // Printing support. | 632 // Printing support. |
| 628 virtual void PrintTo(StringStream* stream) = 0; | 633 virtual void PrintTo(StringStream* stream) = 0; |
| 629 void PrintNameTo(StringStream* stream); | 634 void PrintNameTo(StringStream* stream); |
| 630 static void PrintTypeTo(HType type, StringStream* stream); | 635 void PrintTypeTo(StringStream* stream); |
| 636 void PrintRangeTo(StringStream* stream); |
| 637 void PrintChangesTo(StringStream* stream); |
| 631 | 638 |
| 632 const char* Mnemonic() const; | 639 const char* Mnemonic() const; |
| 633 | 640 |
| 634 // Updated the inferred type of this instruction and returns true if | 641 // Updated the inferred type of this instruction and returns true if |
| 635 // it has changed. | 642 // it has changed. |
| 636 bool UpdateInferredType(); | 643 bool UpdateInferredType(); |
| 637 | 644 |
| 638 virtual HType CalculateInferredType(); | 645 virtual HType CalculateInferredType(); |
| 639 | 646 |
| 640 #ifdef DEBUG | 647 #ifdef DEBUG |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 } | 740 } |
| 734 | 741 |
| 735 virtual void DeleteFromGraph() { Unlink(); } | 742 virtual void DeleteFromGraph() { Unlink(); } |
| 736 | 743 |
| 737 private: | 744 private: |
| 738 void InitializeAsFirst(HBasicBlock* block) { | 745 void InitializeAsFirst(HBasicBlock* block) { |
| 739 ASSERT(!IsLinked()); | 746 ASSERT(!IsLinked()); |
| 740 SetBlock(block); | 747 SetBlock(block); |
| 741 } | 748 } |
| 742 | 749 |
| 750 void PrintMnemonicTo(StringStream* stream); |
| 751 |
| 743 HInstruction* next_; | 752 HInstruction* next_; |
| 744 HInstruction* previous_; | 753 HInstruction* previous_; |
| 745 int position_; | 754 int position_; |
| 746 | 755 |
| 747 friend class HBasicBlock; | 756 friend class HBasicBlock; |
| 748 }; | 757 }; |
| 749 | 758 |
| 750 | 759 |
| 751 class HControlInstruction: public HInstruction { | 760 class HControlInstruction: public HInstruction { |
| 752 public: | 761 public: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 virtual int OperandCount() { return values_.length(); } | 857 virtual int OperandCount() { return values_.length(); } |
| 849 virtual HValue* OperandAt(int index) { return values_[index]; } | 858 virtual HValue* OperandAt(int index) { return values_[index]; } |
| 850 | 859 |
| 851 void AddEnvironmentValue(HValue* value) { | 860 void AddEnvironmentValue(HValue* value) { |
| 852 values_.Add(NULL); | 861 values_.Add(NULL); |
| 853 SetOperandAt(values_.length() - 1, value); | 862 SetOperandAt(values_.length() - 1, value); |
| 854 } | 863 } |
| 855 | 864 |
| 856 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 865 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
| 857 | 866 |
| 867 enum UseEnvironment { |
| 868 kNoUses, |
| 869 kUseAll |
| 870 }; |
| 871 |
| 858 protected: | 872 protected: |
| 859 virtual void InternalSetOperandAt(int index, HValue* value) { | 873 virtual void InternalSetOperandAt(int index, HValue* value) { |
| 860 values_[index] = value; | 874 values_[index] = value; |
| 861 } | 875 } |
| 862 | 876 |
| 863 private: | 877 private: |
| 864 ZoneList<HValue*> values_; | 878 ZoneList<HValue*> values_; |
| 865 }; | 879 }; |
| 866 | 880 |
| 867 | 881 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 } | 1003 } |
| 990 | 1004 |
| 991 virtual Representation RequiredInputRepresentation(int index) const { | 1005 virtual Representation RequiredInputRepresentation(int index) const { |
| 992 return Representation::Tagged(); | 1006 return Representation::Tagged(); |
| 993 } | 1007 } |
| 994 | 1008 |
| 995 DECLARE_CONCRETE_INSTRUCTION(Throw) | 1009 DECLARE_CONCRETE_INSTRUCTION(Throw) |
| 996 }; | 1010 }; |
| 997 | 1011 |
| 998 | 1012 |
| 1013 class HForceRepresentation: public HTemplateInstruction<1> { |
| 1014 public: |
| 1015 HForceRepresentation(HValue* value, Representation required_representation) { |
| 1016 SetOperandAt(0, value); |
| 1017 set_representation(required_representation); |
| 1018 } |
| 1019 |
| 1020 HValue* value() { return OperandAt(0); } |
| 1021 |
| 1022 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
| 1023 |
| 1024 virtual Representation RequiredInputRepresentation(int index) const { |
| 1025 return representation(); // Same as the output representation. |
| 1026 } |
| 1027 |
| 1028 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
| 1029 }; |
| 1030 |
| 1031 |
| 999 class HChange: public HUnaryOperation { | 1032 class HChange: public HUnaryOperation { |
| 1000 public: | 1033 public: |
| 1001 HChange(HValue* value, | 1034 HChange(HValue* value, |
| 1002 Representation from, | 1035 Representation from, |
| 1003 Representation to, | 1036 Representation to, |
| 1004 bool is_truncating) | 1037 bool is_truncating) |
| 1005 : HUnaryOperation(value), from_(from) { | 1038 : HUnaryOperation(value), from_(from) { |
| 1006 ASSERT(!from.IsNone() && !to.IsNone()); | 1039 ASSERT(!from.IsNone() && !to.IsNone()); |
| 1007 ASSERT(!from.Equals(to)); | 1040 ASSERT(!from.Equals(to)); |
| 1008 set_representation(to); | 1041 set_representation(to); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1034 HChange* change = HChange::cast(other); | 1067 HChange* change = HChange::cast(other); |
| 1035 return value() == change->value() | 1068 return value() == change->value() |
| 1036 && to().Equals(change->to()); | 1069 && to().Equals(change->to()); |
| 1037 } | 1070 } |
| 1038 | 1071 |
| 1039 private: | 1072 private: |
| 1040 Representation from_; | 1073 Representation from_; |
| 1041 }; | 1074 }; |
| 1042 | 1075 |
| 1043 | 1076 |
| 1077 class HClampToUint8: public HUnaryOperation { |
| 1078 public: |
| 1079 explicit HClampToUint8(HValue* value) |
| 1080 : HUnaryOperation(value), |
| 1081 input_rep_(Representation::None()) { |
| 1082 SetFlag(kFlexibleRepresentation); |
| 1083 set_representation(Representation::Tagged()); |
| 1084 SetFlag(kUseGVN); |
| 1085 } |
| 1086 |
| 1087 virtual Representation RequiredInputRepresentation(int index) const { |
| 1088 return input_rep_; |
| 1089 } |
| 1090 |
| 1091 virtual Representation InferredRepresentation() { |
| 1092 // TODO(danno): Inference on input types should happen separately from |
| 1093 // return representation. |
| 1094 Representation new_rep = value()->representation(); |
| 1095 if (input_rep_.IsNone()) { |
| 1096 if (!new_rep.IsNone()) { |
| 1097 input_rep_ = new_rep; |
| 1098 return Representation::Integer32(); |
| 1099 } else { |
| 1100 return Representation::None(); |
| 1101 } |
| 1102 } else { |
| 1103 return Representation::Integer32(); |
| 1104 } |
| 1105 } |
| 1106 |
| 1107 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
| 1108 |
| 1109 protected: |
| 1110 virtual bool DataEquals(HValue* other) { return true; } |
| 1111 |
| 1112 private: |
| 1113 Representation input_rep_; |
| 1114 }; |
| 1115 |
| 1116 |
| 1044 class HSimulate: public HInstruction { | 1117 class HSimulate: public HInstruction { |
| 1045 public: | 1118 public: |
| 1046 HSimulate(int ast_id, int pop_count) | 1119 HSimulate(int ast_id, int pop_count) |
| 1047 : ast_id_(ast_id), | 1120 : ast_id_(ast_id), |
| 1048 pop_count_(pop_count), | 1121 pop_count_(pop_count), |
| 1049 values_(2), | 1122 values_(2), |
| 1050 assigned_indexes_(2) {} | 1123 assigned_indexes_(2) {} |
| 1051 virtual ~HSimulate() {} | 1124 virtual ~HSimulate() {} |
| 1052 | 1125 |
| 1053 virtual void PrintDataTo(StringStream* stream); | 1126 virtual void PrintDataTo(StringStream* stream); |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 return target_.is_identical_to(b->target()); | 1822 return target_.is_identical_to(b->target()); |
| 1750 } | 1823 } |
| 1751 | 1824 |
| 1752 private: | 1825 private: |
| 1753 Handle<JSFunction> target_; | 1826 Handle<JSFunction> target_; |
| 1754 }; | 1827 }; |
| 1755 | 1828 |
| 1756 | 1829 |
| 1757 class HCheckInstanceType: public HUnaryOperation { | 1830 class HCheckInstanceType: public HUnaryOperation { |
| 1758 public: | 1831 public: |
| 1759 // Check that the instance type is in the range [first, last] where | 1832 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value) { |
| 1760 // both first and last are included. | 1833 return new HCheckInstanceType(value, IS_JS_OBJECT_OR_JS_FUNCTION); |
| 1761 HCheckInstanceType(HValue* value, InstanceType first, InstanceType last) | 1834 } |
| 1762 : HUnaryOperation(value), first_(first), last_(last) { | 1835 static HCheckInstanceType* NewIsJSArray(HValue* value) { |
| 1763 ASSERT(first <= last); | 1836 return new HCheckInstanceType(value, IS_JS_ARRAY); |
| 1764 set_representation(Representation::Tagged()); | 1837 } |
| 1765 SetFlag(kUseGVN); | 1838 static HCheckInstanceType* NewIsString(HValue* value) { |
| 1766 if ((FIRST_STRING_TYPE < first && last <= LAST_STRING_TYPE) || | 1839 return new HCheckInstanceType(value, IS_STRING); |
| 1767 (FIRST_STRING_TYPE <= first && last < LAST_STRING_TYPE)) { | 1840 } |
| 1768 // A particular string instance type can change because of GC or | 1841 static HCheckInstanceType* NewIsSymbol(HValue* value) { |
| 1769 // externalization, but the value still remains a string. | 1842 return new HCheckInstanceType(value, IS_SYMBOL); |
| 1770 SetFlag(kDependsOnMaps); | |
| 1771 } | |
| 1772 } | 1843 } |
| 1773 | 1844 |
| 1774 virtual bool IsCheckInstruction() const { return true; } | 1845 virtual bool IsCheckInstruction() const { return true; } |
| 1775 | 1846 |
| 1776 virtual Representation RequiredInputRepresentation(int index) const { | 1847 virtual Representation RequiredInputRepresentation(int index) const { |
| 1777 return Representation::Tagged(); | 1848 return Representation::Tagged(); |
| 1778 } | 1849 } |
| 1779 | 1850 |
| 1780 #ifdef DEBUG | 1851 #ifdef DEBUG |
| 1781 virtual void Verify(); | 1852 virtual void Verify(); |
| 1782 #endif | 1853 #endif |
| 1783 | 1854 |
| 1784 virtual HValue* Canonicalize() { | 1855 virtual HValue* Canonicalize() { |
| 1785 if (!value()->type().IsUninitialized() && | 1856 if (!value()->type().IsUninitialized() && |
| 1786 value()->type().IsString() && | 1857 value()->type().IsString() && |
| 1787 first() == FIRST_STRING_TYPE && | 1858 check_ == IS_STRING) { |
| 1788 last() == LAST_STRING_TYPE) { | |
| 1789 return NULL; | 1859 return NULL; |
| 1790 } | 1860 } |
| 1791 return this; | 1861 return this; |
| 1792 } | 1862 } |
| 1793 | 1863 |
| 1794 static HCheckInstanceType* NewIsJSObjectOrJSFunction(HValue* value); | 1864 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } |
| 1795 | 1865 void GetCheckInterval(InstanceType* first, InstanceType* last); |
| 1796 InstanceType first() const { return first_; } | 1866 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); |
| 1797 InstanceType last() const { return last_; } | |
| 1798 | 1867 |
| 1799 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) | 1868 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) |
| 1800 | 1869 |
| 1801 protected: | 1870 protected: |
| 1802 // TODO(ager): It could be nice to allow the ommision of instance | 1871 // TODO(ager): It could be nice to allow the ommision of instance |
| 1803 // type checks if we have already performed an instance type check | 1872 // type checks if we have already performed an instance type check |
| 1804 // with a larger range. | 1873 // with a larger range. |
| 1805 virtual bool DataEquals(HValue* other) { | 1874 virtual bool DataEquals(HValue* other) { |
| 1806 HCheckInstanceType* b = HCheckInstanceType::cast(other); | 1875 HCheckInstanceType* b = HCheckInstanceType::cast(other); |
| 1807 return (first_ == b->first()) && (last_ == b->last()); | 1876 return check_ == b->check_; |
| 1808 } | 1877 } |
| 1809 | 1878 |
| 1810 private: | 1879 private: |
| 1811 InstanceType first_; | 1880 enum Check { |
| 1812 InstanceType last_; | 1881 IS_JS_OBJECT_OR_JS_FUNCTION, |
| 1882 IS_JS_ARRAY, |
| 1883 IS_STRING, |
| 1884 IS_SYMBOL, |
| 1885 LAST_INTERVAL_CHECK = IS_JS_ARRAY |
| 1886 }; |
| 1887 |
| 1888 HCheckInstanceType(HValue* value, Check check) |
| 1889 : HUnaryOperation(value), check_(check) { |
| 1890 set_representation(Representation::Tagged()); |
| 1891 SetFlag(kUseGVN); |
| 1892 } |
| 1893 |
| 1894 const Check check_; |
| 1813 }; | 1895 }; |
| 1814 | 1896 |
| 1815 | 1897 |
| 1816 class HCheckNonSmi: public HUnaryOperation { | 1898 class HCheckNonSmi: public HUnaryOperation { |
| 1817 public: | 1899 public: |
| 1818 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { | 1900 explicit HCheckNonSmi(HValue* value) : HUnaryOperation(value) { |
| 1819 set_representation(Representation::Tagged()); | 1901 set_representation(Representation::Tagged()); |
| 1820 SetFlag(kUseGVN); | 1902 SetFlag(kUseGVN); |
| 1821 } | 1903 } |
| 1822 | 1904 |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 } | 2470 } |
| 2389 virtual HType CalculateInferredType(); | 2471 virtual HType CalculateInferredType(); |
| 2390 | 2472 |
| 2391 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq) | 2473 DECLARE_CONCRETE_INSTRUCTION(CompareJSObjectEq) |
| 2392 | 2474 |
| 2393 protected: | 2475 protected: |
| 2394 virtual bool DataEquals(HValue* other) { return true; } | 2476 virtual bool DataEquals(HValue* other) { return true; } |
| 2395 }; | 2477 }; |
| 2396 | 2478 |
| 2397 | 2479 |
| 2480 class HCompareSymbolEq: public HBinaryOperation { |
| 2481 public: |
| 2482 HCompareSymbolEq(HValue* left, HValue* right, Token::Value op) |
| 2483 : HBinaryOperation(left, right), op_(op) { |
| 2484 ASSERT(op == Token::EQ || op == Token::EQ_STRICT); |
| 2485 set_representation(Representation::Tagged()); |
| 2486 SetFlag(kUseGVN); |
| 2487 SetFlag(kDependsOnMaps); |
| 2488 } |
| 2489 |
| 2490 Token::Value op() const { return op_; } |
| 2491 |
| 2492 virtual bool EmitAtUses() { |
| 2493 return !HasSideEffects() && !HasMultipleUses(); |
| 2494 } |
| 2495 |
| 2496 virtual Representation RequiredInputRepresentation(int index) const { |
| 2497 return Representation::Tagged(); |
| 2498 } |
| 2499 |
| 2500 virtual HType CalculateInferredType() { return HType::Boolean(); } |
| 2501 |
| 2502 DECLARE_CONCRETE_INSTRUCTION(CompareSymbolEq); |
| 2503 |
| 2504 protected: |
| 2505 virtual bool DataEquals(HValue* other) { |
| 2506 return op_ == HCompareSymbolEq::cast(other)->op_; |
| 2507 } |
| 2508 |
| 2509 private: |
| 2510 const Token::Value op_; |
| 2511 }; |
| 2512 |
| 2513 |
| 2398 class HUnaryPredicate: public HUnaryOperation { | 2514 class HUnaryPredicate: public HUnaryOperation { |
| 2399 public: | 2515 public: |
| 2400 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { | 2516 explicit HUnaryPredicate(HValue* value) : HUnaryOperation(value) { |
| 2401 set_representation(Representation::Tagged()); | 2517 set_representation(Representation::Tagged()); |
| 2402 SetFlag(kUseGVN); | 2518 SetFlag(kUseGVN); |
| 2403 } | 2519 } |
| 2404 | 2520 |
| 2405 virtual bool EmitAtUses() { | 2521 virtual bool EmitAtUses() { |
| 2406 return !HasSideEffects() && !HasMultipleUses(); | 2522 return !HasSideEffects() && !HasMultipleUses(); |
| 2407 } | 2523 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 public: | 2564 public: |
| 2449 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } | 2565 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } |
| 2450 | 2566 |
| 2451 DECLARE_CONCRETE_INSTRUCTION(IsSmi) | 2567 DECLARE_CONCRETE_INSTRUCTION(IsSmi) |
| 2452 | 2568 |
| 2453 protected: | 2569 protected: |
| 2454 virtual bool DataEquals(HValue* other) { return true; } | 2570 virtual bool DataEquals(HValue* other) { return true; } |
| 2455 }; | 2571 }; |
| 2456 | 2572 |
| 2457 | 2573 |
| 2574 class HIsUndetectable: public HUnaryPredicate { |
| 2575 public: |
| 2576 explicit HIsUndetectable(HValue* value) : HUnaryPredicate(value) { } |
| 2577 |
| 2578 DECLARE_CONCRETE_INSTRUCTION(IsUndetectable) |
| 2579 |
| 2580 protected: |
| 2581 virtual bool DataEquals(HValue* other) { return true; } |
| 2582 }; |
| 2583 |
| 2584 |
| 2458 class HIsConstructCall: public HTemplateInstruction<0> { | 2585 class HIsConstructCall: public HTemplateInstruction<0> { |
| 2459 public: | 2586 public: |
| 2460 HIsConstructCall() { | 2587 HIsConstructCall() { |
| 2461 set_representation(Representation::Tagged()); | 2588 set_representation(Representation::Tagged()); |
| 2462 SetFlag(kUseGVN); | 2589 SetFlag(kUseGVN); |
| 2463 } | 2590 } |
| 2464 | 2591 |
| 2465 virtual bool EmitAtUses() { | 2592 virtual bool EmitAtUses() { |
| 2466 return !HasSideEffects() && !HasMultipleUses(); | 2593 return !HasSideEffects() && !HasMultipleUses(); |
| 2467 } | 2594 } |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3246 HValue* key() { return OperandAt(1); } | 3373 HValue* key() { return OperandAt(1); } |
| 3247 | 3374 |
| 3248 virtual Representation RequiredInputRepresentation(int index) const { | 3375 virtual Representation RequiredInputRepresentation(int index) const { |
| 3249 // The key is supposed to be Integer32. | 3376 // The key is supposed to be Integer32. |
| 3250 return (index == 1) ? Representation::Integer32() | 3377 return (index == 1) ? Representation::Integer32() |
| 3251 : Representation::Tagged(); | 3378 : Representation::Tagged(); |
| 3252 } | 3379 } |
| 3253 | 3380 |
| 3254 virtual void PrintDataTo(StringStream* stream); | 3381 virtual void PrintDataTo(StringStream* stream); |
| 3255 | 3382 |
| 3383 bool RequiresHoleCheck() const; |
| 3384 |
| 3256 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) | 3385 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement) |
| 3257 | 3386 |
| 3258 protected: | 3387 protected: |
| 3259 virtual bool DataEquals(HValue* other) { return true; } | 3388 virtual bool DataEquals(HValue* other) { return true; } |
| 3260 }; | 3389 }; |
| 3261 | 3390 |
| 3262 | 3391 |
| 3263 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { | 3392 class HLoadKeyedSpecializedArrayElement: public HBinaryOperation { |
| 3264 public: | 3393 public: |
| 3265 HLoadKeyedSpecializedArrayElement(HValue* external_elements, | 3394 HLoadKeyedSpecializedArrayElement(HValue* external_elements, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3302 return array_type_ == cast_other->array_type(); | 3431 return array_type_ == cast_other->array_type(); |
| 3303 } | 3432 } |
| 3304 | 3433 |
| 3305 private: | 3434 private: |
| 3306 ExternalArrayType array_type_; | 3435 ExternalArrayType array_type_; |
| 3307 }; | 3436 }; |
| 3308 | 3437 |
| 3309 | 3438 |
| 3310 class HLoadKeyedGeneric: public HTemplateInstruction<3> { | 3439 class HLoadKeyedGeneric: public HTemplateInstruction<3> { |
| 3311 public: | 3440 public: |
| 3312 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) { | 3441 HLoadKeyedGeneric(HValue* context, HValue* obj, HValue* key) { |
| 3313 set_representation(Representation::Tagged()); | 3442 set_representation(Representation::Tagged()); |
| 3314 SetOperandAt(0, obj); | 3443 SetOperandAt(0, obj); |
| 3315 SetOperandAt(1, key); | 3444 SetOperandAt(1, key); |
| 3316 SetOperandAt(2, context); | 3445 SetOperandAt(2, context); |
| 3317 SetAllSideEffects(); | 3446 SetAllSideEffects(); |
| 3318 } | 3447 } |
| 3319 | 3448 |
| 3320 HValue* object() { return OperandAt(0); } | 3449 HValue* object() { return OperandAt(0); } |
| 3321 HValue* key() { return OperandAt(1); } | 3450 HValue* key() { return OperandAt(1); } |
| 3322 HValue* context() { return OperandAt(2); } | 3451 HValue* context() { return OperandAt(2); } |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3826 | 3955 |
| 3827 DECLARE_CONCRETE_INSTRUCTION(In) | 3956 DECLARE_CONCRETE_INSTRUCTION(In) |
| 3828 }; | 3957 }; |
| 3829 | 3958 |
| 3830 #undef DECLARE_INSTRUCTION | 3959 #undef DECLARE_INSTRUCTION |
| 3831 #undef DECLARE_CONCRETE_INSTRUCTION | 3960 #undef DECLARE_CONCRETE_INSTRUCTION |
| 3832 | 3961 |
| 3833 } } // namespace v8::internal | 3962 } } // namespace v8::internal |
| 3834 | 3963 |
| 3835 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 3964 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
| OLD | NEW |