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

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

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 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.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 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 V(MaterializedLiteral) \ 57 V(MaterializedLiteral) \
58 V(Phi) \ 58 V(Phi) \
59 V(StoreKeyed) \ 59 V(StoreKeyed) \
60 V(StoreNamed) \ 60 V(StoreNamed) \
61 V(UnaryControlInstruction) \ 61 V(UnaryControlInstruction) \
62 V(UnaryOperation) \ 62 V(UnaryOperation) \
63 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) 63 HYDROGEN_CONCRETE_INSTRUCTION_LIST(V)
64 64
65 65
66 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \ 66 #define HYDROGEN_CONCRETE_INSTRUCTION_LIST(V) \
67 V(AbnormalExit) \
67 V(AccessArgumentsAt) \ 68 V(AccessArgumentsAt) \
68 V(Add) \ 69 V(Add) \
69 V(ApplyArguments) \ 70 V(ApplyArguments) \
70 V(ArgumentsElements) \ 71 V(ArgumentsElements) \
71 V(ArgumentsLength) \ 72 V(ArgumentsLength) \
72 V(ArgumentsObject) \ 73 V(ArgumentsObject) \
73 V(ArrayLiteral) \ 74 V(ArrayLiteral) \
74 V(BitAnd) \ 75 V(BitAnd) \
75 V(BitNot) \ 76 V(BitNot) \
76 V(BitOr) \ 77 V(BitOr) \
(...skipping 13 matching lines...) Expand all
90 V(CheckFunction) \ 91 V(CheckFunction) \
91 V(CheckInstanceType) \ 92 V(CheckInstanceType) \
92 V(CheckMap) \ 93 V(CheckMap) \
93 V(CheckNonSmi) \ 94 V(CheckNonSmi) \
94 V(CheckPrototypeMaps) \ 95 V(CheckPrototypeMaps) \
95 V(CheckSmi) \ 96 V(CheckSmi) \
96 V(Compare) \ 97 V(Compare) \
97 V(CompareJSObjectEq) \ 98 V(CompareJSObjectEq) \
98 V(CompareMap) \ 99 V(CompareMap) \
99 V(Constant) \ 100 V(Constant) \
101 V(Context) \
100 V(DeleteProperty) \ 102 V(DeleteProperty) \
101 V(Deoptimize) \ 103 V(Deoptimize) \
102 V(Div) \ 104 V(Div) \
103 V(EnterInlined) \ 105 V(EnterInlined) \
104 V(FixedArrayLength) \ 106 V(FixedArrayLength) \
105 V(FunctionLiteral) \ 107 V(FunctionLiteral) \
106 V(GlobalObject) \ 108 V(GlobalObject) \
107 V(GlobalReceiver) \ 109 V(GlobalReceiver) \
108 V(Goto) \ 110 V(Goto) \
109 V(InstanceOf) \ 111 V(InstanceOf) \
110 V(InstanceOfKnownGlobal) \ 112 V(InstanceOfKnownGlobal) \
111 V(IsNull) \ 113 V(IsNull) \
112 V(IsObject) \ 114 V(IsObject) \
113 V(IsSmi) \ 115 V(IsSmi) \
116 V(IsConstructCall) \
114 V(HasInstanceType) \ 117 V(HasInstanceType) \
115 V(HasCachedArrayIndex) \ 118 V(HasCachedArrayIndex) \
116 V(JSArrayLength) \ 119 V(JSArrayLength) \
117 V(ClassOfTest) \ 120 V(ClassOfTest) \
118 V(LeaveInlined) \ 121 V(LeaveInlined) \
119 V(LoadContextSlot) \ 122 V(LoadContextSlot) \
120 V(LoadElements) \ 123 V(LoadElements) \
121 V(LoadFunctionPrototype) \ 124 V(LoadFunctionPrototype) \
122 V(LoadGlobal) \ 125 V(LoadGlobal) \
123 V(LoadKeyedFastElement) \ 126 V(LoadKeyedFastElement) \
124 V(LoadKeyedGeneric) \ 127 V(LoadKeyedGeneric) \
125 V(LoadNamedField) \ 128 V(LoadNamedField) \
126 V(LoadNamedGeneric) \ 129 V(LoadNamedGeneric) \
127 V(Mod) \ 130 V(Mod) \
128 V(Mul) \ 131 V(Mul) \
129 V(ObjectLiteral) \ 132 V(ObjectLiteral) \
130 V(OsrEntry) \ 133 V(OsrEntry) \
134 V(OuterContext) \
131 V(Parameter) \ 135 V(Parameter) \
132 V(Power) \ 136 V(Power) \
133 V(PushArgument) \ 137 V(PushArgument) \
134 V(RegExpLiteral) \ 138 V(RegExpLiteral) \
135 V(Return) \ 139 V(Return) \
136 V(Sar) \ 140 V(Sar) \
137 V(Shl) \ 141 V(Shl) \
138 V(Shr) \ 142 V(Shr) \
139 V(Simulate) \ 143 V(Simulate) \
140 V(StackCheck) \ 144 V(StackCheck) \
145 V(StoreContextSlot) \
141 V(StoreGlobal) \ 146 V(StoreGlobal) \
142 V(StoreKeyedFastElement) \ 147 V(StoreKeyedFastElement) \
143 V(StoreKeyedGeneric) \ 148 V(StoreKeyedGeneric) \
144 V(StoreNamedField) \ 149 V(StoreNamedField) \
145 V(StoreNamedGeneric) \ 150 V(StoreNamedGeneric) \
146 V(StringCharCodeAt) \ 151 V(StringCharCodeAt) \
147 V(StringLength) \ 152 V(StringLength) \
148 V(Sub) \ 153 V(Sub) \
149 V(Test) \ 154 V(Test) \
150 V(Throw) \ 155 V(Throw) \
151 V(Typeof) \ 156 V(Typeof) \
152 V(TypeofIs) \ 157 V(TypeofIs) \
153 V(UnaryMathOperation) \ 158 V(UnaryMathOperation) \
154 V(UnknownOSRValue) \ 159 V(UnknownOSRValue) \
155 V(ValueOf) 160 V(ValueOf)
156 161
157 #define GVN_FLAG_LIST(V) \ 162 #define GVN_FLAG_LIST(V) \
158 V(Calls) \ 163 V(Calls) \
159 V(InobjectFields) \ 164 V(InobjectFields) \
160 V(BackingStoreFields) \ 165 V(BackingStoreFields) \
161 V(ArrayElements) \ 166 V(ArrayElements) \
162 V(GlobalVars) \ 167 V(GlobalVars) \
163 V(Maps) \ 168 V(Maps) \
164 V(ArrayLengths) \ 169 V(ArrayLengths) \
170 V(ContextSlots) \
165 V(OsrEntries) 171 V(OsrEntries)
166 172
167 #define DECLARE_INSTRUCTION(type) \ 173 #define DECLARE_INSTRUCTION(type) \
168 virtual bool Is##type() const { return true; } \ 174 virtual bool Is##type() const { return true; } \
169 static H##type* cast(HValue* value) { \ 175 static H##type* cast(HValue* value) { \
170 ASSERT(value->Is##type()); \ 176 ASSERT(value->Is##type()); \
171 return reinterpret_cast<H##type*>(value); \ 177 return reinterpret_cast<H##type*>(value); \
172 } \ 178 } \
173 Opcode opcode() const { return HValue::k##type; } 179 Opcode opcode() const { return HValue::k##type; }
174 180
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 class HReturn: public HUnaryControlInstruction { 833 class HReturn: public HUnaryControlInstruction {
828 public: 834 public:
829 explicit HReturn(HValue* value) 835 explicit HReturn(HValue* value)
830 : HUnaryControlInstruction(value, NULL, NULL) { 836 : HUnaryControlInstruction(value, NULL, NULL) {
831 } 837 }
832 838
833 DECLARE_CONCRETE_INSTRUCTION(Return, "return") 839 DECLARE_CONCRETE_INSTRUCTION(Return, "return")
834 }; 840 };
835 841
836 842
837 class HThrow: public HUnaryControlInstruction { 843 class HAbnormalExit: public HControlInstruction {
838 public: 844 public:
839 explicit HThrow(HValue* value) 845 HAbnormalExit() : HControlInstruction(NULL, NULL) { }
840 : HUnaryControlInstruction(value, NULL, NULL) { }
841 846
842 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw") 847 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit, "abnormal_exit")
843 }; 848 };
844 849
845 850
846 class HUnaryOperation: public HInstruction { 851 class HUnaryOperation: public HInstruction {
847 public: 852 public:
848 explicit HUnaryOperation(HValue* value) { 853 explicit HUnaryOperation(HValue* value) {
849 SetOperandAt(0, value); 854 SetOperandAt(0, value);
850 } 855 }
851 856
852 HValue* value() const { return OperandAt(0); } 857 HValue* value() const { return OperandAt(0); }
853 virtual void PrintDataTo(StringStream* stream) const; 858 virtual void PrintDataTo(StringStream* stream) const;
854 virtual int OperandCount() const { return 1; } 859 virtual int OperandCount() const { return 1; }
855 virtual HValue* OperandAt(int index) const { return operands_[index]; } 860 virtual HValue* OperandAt(int index) const { return operands_[index]; }
856 861
857 DECLARE_INSTRUCTION(UnaryOperation) 862 DECLARE_INSTRUCTION(UnaryOperation)
858 863
859 protected: 864 protected:
860 virtual void InternalSetOperandAt(int index, HValue* value) { 865 virtual void InternalSetOperandAt(int index, HValue* value) {
861 operands_[index] = value; 866 operands_[index] = value;
862 } 867 }
863 868
864 private: 869 private:
865 HOperandVector<1> operands_; 870 HOperandVector<1> operands_;
866 }; 871 };
867 872
868 873
874 class HThrow: public HUnaryOperation {
875 public:
876 explicit HThrow(HValue* value) : HUnaryOperation(value) {
877 SetAllSideEffects();
878 }
879
880 virtual Representation RequiredInputRepresentation(int index) const {
881 return Representation::Tagged();
882 }
883
884 DECLARE_CONCRETE_INSTRUCTION(Throw, "throw")
885 };
886
887
869 class HChange: public HUnaryOperation { 888 class HChange: public HUnaryOperation {
870 public: 889 public:
871 HChange(HValue* value, 890 HChange(HValue* value,
872 Representation from, 891 Representation from,
873 Representation to) 892 Representation to)
874 : HUnaryOperation(value), from_(from), to_(to) { 893 : HUnaryOperation(value), from_(from), to_(to) {
875 ASSERT(!from.IsNone() && !to.IsNone()); 894 ASSERT(!from.IsNone() && !to.IsNone());
876 ASSERT(!from.Equals(to)); 895 ASSERT(!from.Equals(to));
877 set_representation(to); 896 set_representation(to);
878 SetFlag(kUseGVN); 897 SetFlag(kUseGVN);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 int environment_length_; 1001 int environment_length_;
983 ZoneList<HValue*> values_; 1002 ZoneList<HValue*> values_;
984 ZoneList<int> assigned_indexes_; 1003 ZoneList<int> assigned_indexes_;
985 }; 1004 };
986 1005
987 1006
988 class HStackCheck: public HInstruction { 1007 class HStackCheck: public HInstruction {
989 public: 1008 public:
990 HStackCheck() { } 1009 HStackCheck() { }
991 1010
992 DECLARE_CONCRETE_INSTRUCTION(Throw, "stack_check") 1011 DECLARE_CONCRETE_INSTRUCTION(StackCheck, "stack_check")
993 }; 1012 };
994 1013
995 1014
996 class HEnterInlined: public HInstruction { 1015 class HEnterInlined: public HInstruction {
997 public: 1016 public:
998 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function) 1017 HEnterInlined(Handle<JSFunction> closure, FunctionLiteral* function)
999 : closure_(closure), function_(function) { 1018 : closure_(closure), function_(function) {
1000 } 1019 }
1001 1020
1002 virtual void PrintDataTo(StringStream* stream) const; 1021 virtual void PrintDataTo(StringStream* stream) const;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 argument_index_ = index; 1058 argument_index_ = index;
1040 } 1059 }
1041 1060
1042 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument") 1061 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push_argument")
1043 1062
1044 private: 1063 private:
1045 int argument_index_; 1064 int argument_index_;
1046 }; 1065 };
1047 1066
1048 1067
1049 class HGlobalObject: public HInstruction { 1068 class HContext: public HInstruction {
1050 public: 1069 public:
1051 HGlobalObject() { 1070 HContext() {
1052 set_representation(Representation::Tagged()); 1071 set_representation(Representation::Tagged());
1053 SetFlag(kUseGVN); 1072 SetFlag(kUseGVN);
1054 SetFlag(kDependsOnCalls); 1073 }
1074
1075 DECLARE_CONCRETE_INSTRUCTION(Context, "context");
1076
1077 protected:
1078 virtual bool DataEquals(HValue* other) const { return true; }
1079 };
1080
1081
1082 class HOuterContext: public HUnaryOperation {
1083 public:
1084 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) {
1085 set_representation(Representation::Tagged());
1086 SetFlag(kUseGVN);
1087 }
1088
1089 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer_context");
1090
1091 protected:
1092 virtual bool DataEquals(HValue* other) const { return true; }
1093 };
1094
1095
1096 class HGlobalObject: public HUnaryOperation {
1097 public:
1098 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) {
1099 set_representation(Representation::Tagged());
1100 SetFlag(kUseGVN);
1055 } 1101 }
1056 1102
1057 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object") 1103 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global_object")
1058 1104
1059 protected: 1105 protected:
1060 virtual bool DataEquals(HValue* other) const { return true; } 1106 virtual bool DataEquals(HValue* other) const { return true; }
1061 }; 1107 };
1062 1108
1063 1109
1064 class HGlobalReceiver: public HInstruction { 1110 class HGlobalReceiver: public HUnaryOperation {
1065 public: 1111 public:
1066 HGlobalReceiver() { 1112 explicit HGlobalReceiver(HValue* global_object)
1113 : HUnaryOperation(global_object) {
1067 set_representation(Representation::Tagged()); 1114 set_representation(Representation::Tagged());
1068 SetFlag(kUseGVN); 1115 SetFlag(kUseGVN);
1069 SetFlag(kDependsOnCalls);
1070 } 1116 }
1071 1117
1072 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver") 1118 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global_receiver")
1073 1119
1074 protected: 1120 protected:
1075 virtual bool DataEquals(HValue* other) const { return true; } 1121 virtual bool DataEquals(HValue* other) const { return true; }
1076 }; 1122 };
1077 1123
1078 1124
1079 class HCall: public HInstruction { 1125 class HCall: public HInstruction {
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
1650 virtual Range* InferRange(); 1696 virtual Range* InferRange();
1651 virtual Representation RequiredInputRepresentation(int index) const { 1697 virtual Representation RequiredInputRepresentation(int index) const {
1652 return representation(); 1698 return representation();
1653 } 1699 }
1654 virtual HType CalculateInferredType() const; 1700 virtual HType CalculateInferredType() const;
1655 virtual int OperandCount() const { return inputs_.length(); } 1701 virtual int OperandCount() const { return inputs_.length(); }
1656 virtual HValue* OperandAt(int index) const { return inputs_[index]; } 1702 virtual HValue* OperandAt(int index) const { return inputs_[index]; }
1657 HValue* GetRedundantReplacement() const; 1703 HValue* GetRedundantReplacement() const;
1658 void AddInput(HValue* value); 1704 void AddInput(HValue* value);
1659 1705
1660 bool HasReceiverOperand(); 1706 bool IsReceiver() { return merged_index_ == 0; }
1661 1707
1662 int merged_index() const { return merged_index_; } 1708 int merged_index() const { return merged_index_; }
1663 1709
1664 virtual const char* Mnemonic() const { return "phi"; } 1710 virtual const char* Mnemonic() const { return "phi"; }
1665 1711
1666 virtual void PrintTo(StringStream* stream) const; 1712 virtual void PrintTo(StringStream* stream) const;
1667 1713
1668 #ifdef DEBUG 1714 #ifdef DEBUG
1669 virtual void Verify(); 1715 virtual void Verify();
1670 #endif 1716 #endif
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 public: 1871 public:
1826 HApplyArguments(HValue* function, 1872 HApplyArguments(HValue* function,
1827 HValue* receiver, 1873 HValue* receiver,
1828 HValue* length, 1874 HValue* length,
1829 HValue* elements) { 1875 HValue* elements) {
1830 set_representation(Representation::Tagged()); 1876 set_representation(Representation::Tagged());
1831 SetOperandAt(0, function); 1877 SetOperandAt(0, function);
1832 SetOperandAt(1, receiver); 1878 SetOperandAt(1, receiver);
1833 SetOperandAt(2, length); 1879 SetOperandAt(2, length);
1834 SetOperandAt(3, elements); 1880 SetOperandAt(3, elements);
1881 SetAllSideEffects();
1835 } 1882 }
1836 1883
1837 virtual Representation RequiredInputRepresentation(int index) const { 1884 virtual Representation RequiredInputRepresentation(int index) const {
1838 // The length is untagged, all other inputs are tagged. 1885 // The length is untagged, all other inputs are tagged.
1839 return (index == 2) 1886 return (index == 2)
1840 ? Representation::Integer32() 1887 ? Representation::Integer32()
1841 : Representation::Tagged(); 1888 : Representation::Tagged();
1842 } 1889 }
1843 1890
1844 HValue* function() const { return OperandAt(0); } 1891 HValue* function() const { return OperandAt(0); }
1845 HValue* receiver() const { return OperandAt(1); } 1892 HValue* receiver() const { return OperandAt(1); }
1846 HValue* length() const { return OperandAt(2); } 1893 HValue* length() const { return OperandAt(2); }
1847 HValue* elements() const { return OperandAt(3); } 1894 HValue* elements() const { return OperandAt(3); }
1848 1895
1849 virtual int OperandCount() const { return operands_.length(); } 1896 virtual int OperandCount() const { return operands_.length(); }
1850 virtual HValue* OperandAt(int index) const { return operands_[index]; } 1897 virtual HValue* OperandAt(int index) const { return operands_[index]; }
1851 1898
1852 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply_arguments") 1899 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments, "apply_arguments")
1853 1900
1854
1855
1856 protected: 1901 protected:
1857 virtual void InternalSetOperandAt(int index, HValue* value) { 1902 virtual void InternalSetOperandAt(int index, HValue* value) {
1858 operands_[index] = value; 1903 operands_[index] = value;
1859 } 1904 }
1860 1905
1861 private: 1906 private:
1862 HOperandVector<4> operands_; 1907 HOperandVector<4> operands_;
1863 }; 1908 };
1864 1909
1865 1910
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 public: 2174 public:
2130 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { } 2175 explicit HIsSmi(HValue* value) : HUnaryPredicate(value) { }
2131 2176
2132 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi") 2177 DECLARE_CONCRETE_INSTRUCTION(IsSmi, "is_smi")
2133 2178
2134 protected: 2179 protected:
2135 virtual bool DataEquals(HValue* other) const { return true; } 2180 virtual bool DataEquals(HValue* other) const { return true; }
2136 }; 2181 };
2137 2182
2138 2183
2184 class HIsConstructCall: public HInstruction {
2185 public:
2186 HIsConstructCall() {
2187 set_representation(Representation::Tagged());
2188 SetFlag(kUseGVN);
2189 }
2190
2191 virtual bool EmitAtUses() const { return uses()->length() <= 1; }
2192
2193 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is_construct_call")
2194
2195 protected:
2196 virtual bool DataEquals(HValue* other) const { return true; }
2197 };
2198
2199
2139 class HHasInstanceType: public HUnaryPredicate { 2200 class HHasInstanceType: public HUnaryPredicate {
2140 public: 2201 public:
2141 HHasInstanceType(HValue* value, InstanceType type) 2202 HHasInstanceType(HValue* value, InstanceType type)
2142 : HUnaryPredicate(value), from_(type), to_(type) { } 2203 : HUnaryPredicate(value), from_(type), to_(type) { }
2143 HHasInstanceType(HValue* value, InstanceType from, InstanceType to) 2204 HHasInstanceType(HValue* value, InstanceType from, InstanceType to)
2144 : HUnaryPredicate(value), from_(from), to_(to) { 2205 : HUnaryPredicate(value), from_(from), to_(to) {
2145 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend. 2206 ASSERT(to == LAST_TYPE); // Others not implemented yet in backend.
2146 } 2207 }
2147 2208
2148 InstanceType from() { return from_; } 2209 InstanceType from() { return from_; }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 } 2630 }
2570 2631
2571 private: 2632 private:
2572 Handle<JSGlobalPropertyCell> cell_; 2633 Handle<JSGlobalPropertyCell> cell_;
2573 bool check_hole_value_; 2634 bool check_hole_value_;
2574 }; 2635 };
2575 2636
2576 2637
2577 class HStoreGlobal: public HUnaryOperation { 2638 class HStoreGlobal: public HUnaryOperation {
2578 public: 2639 public:
2579 HStoreGlobal(HValue* value, Handle<JSGlobalPropertyCell> cell) 2640 HStoreGlobal(HValue* value,
2580 : HUnaryOperation(value), cell_(cell) { 2641 Handle<JSGlobalPropertyCell> cell,
2642 bool check_hole_value)
2643 : HUnaryOperation(value),
2644 cell_(cell),
2645 check_hole_value_(check_hole_value) {
2581 SetFlag(kChangesGlobalVars); 2646 SetFlag(kChangesGlobalVars);
2582 } 2647 }
2583 2648
2584 Handle<JSGlobalPropertyCell> cell() const { return cell_; } 2649 Handle<JSGlobalPropertyCell> cell() const { return cell_; }
2650 bool check_hole_value() const { return check_hole_value_; }
2585 2651
2586 virtual Representation RequiredInputRepresentation(int index) const { 2652 virtual Representation RequiredInputRepresentation(int index) const {
2587 return Representation::Tagged(); 2653 return Representation::Tagged();
2588 } 2654 }
2589 virtual void PrintDataTo(StringStream* stream) const; 2655 virtual void PrintDataTo(StringStream* stream) const;
2590 2656
2591 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global") 2657 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store_global")
2592 2658
2593 private: 2659 private:
2594 Handle<JSGlobalPropertyCell> cell_; 2660 Handle<JSGlobalPropertyCell> cell_;
2661 bool check_hole_value_;
2595 }; 2662 };
2596 2663
2597 2664
2598 class HLoadContextSlot: public HInstruction { 2665 class HLoadContextSlot: public HUnaryOperation {
2599 public: 2666 public:
2600 HLoadContextSlot(int context_chain_length , int slot_index) 2667 HLoadContextSlot(HValue* context , int slot_index)
2601 : context_chain_length_(context_chain_length), slot_index_(slot_index) { 2668 : HUnaryOperation(context), slot_index_(slot_index) {
2602 set_representation(Representation::Tagged()); 2669 set_representation(Representation::Tagged());
2603 SetFlag(kUseGVN); 2670 SetFlag(kUseGVN);
2604 SetFlag(kDependsOnCalls); 2671 SetFlag(kDependsOnContextSlots);
2605 } 2672 }
2606 2673
2607 int context_chain_length() const { return context_chain_length_; }
2608 int slot_index() const { return slot_index_; } 2674 int slot_index() const { return slot_index_; }
2609 2675
2676 virtual Representation RequiredInputRepresentation(int index) const {
2677 return Representation::Tagged();
2678 }
2679
2610 virtual void PrintDataTo(StringStream* stream) const; 2680 virtual void PrintDataTo(StringStream* stream) const;
2611 2681
2612 virtual intptr_t Hashcode() const {
2613 return context_chain_length() * 29 + slot_index();
2614 }
2615
2616 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot") 2682 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load_context_slot")
2617 2683
2618 protected: 2684 protected:
2619 virtual bool DataEquals(HValue* other) const { 2685 virtual bool DataEquals(HValue* other) const {
2620 HLoadContextSlot* b = HLoadContextSlot::cast(other); 2686 HLoadContextSlot* b = HLoadContextSlot::cast(other);
2621 return (context_chain_length() == b->context_chain_length()) 2687 return (slot_index() == b->slot_index());
2622 && (slot_index() == b->slot_index());
2623 } 2688 }
2624 2689
2625 private: 2690 private:
2626 int context_chain_length_; 2691 int slot_index_;
2692 };
2693
2694
2695 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
2696 return !value->type().IsSmi() &&
2697 !(value->IsConstant() && HConstant::cast(value)->InOldSpace());
2698 }
2699
2700
2701 class HStoreContextSlot: public HBinaryOperation {
2702 public:
2703 HStoreContextSlot(HValue* context, int slot_index, HValue* value)
2704 : HBinaryOperation(context, value), slot_index_(slot_index) {
2705 SetFlag(kChangesContextSlots);
2706 }
2707
2708 HValue* context() const { return OperandAt(0); }
2709 HValue* value() const { return OperandAt(1); }
2710 int slot_index() const { return slot_index_; }
2711
2712 bool NeedsWriteBarrier() const {
2713 return StoringValueNeedsWriteBarrier(value());
2714 }
2715
2716 virtual Representation RequiredInputRepresentation(int index) const {
2717 return Representation::Tagged();
2718 }
2719
2720 virtual void PrintDataTo(StringStream* stream) const;
2721
2722 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store_context_slot")
2723
2724 private:
2627 int slot_index_; 2725 int slot_index_;
2628 }; 2726 };
2629 2727
2630 2728
2631 class HLoadNamedField: public HUnaryOperation { 2729 class HLoadNamedField: public HUnaryOperation {
2632 public: 2730 public:
2633 HLoadNamedField(HValue* object, bool is_in_object, int offset) 2731 HLoadNamedField(HValue* object, bool is_in_object, int offset)
2634 : HUnaryOperation(object), 2732 : HUnaryOperation(object),
2635 is_in_object_(is_in_object), 2733 is_in_object_(is_in_object),
2636 offset_(offset) { 2734 offset_(offset) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 class HLoadKeyedGeneric: public HLoadKeyed { 2850 class HLoadKeyedGeneric: public HLoadKeyed {
2753 public: 2851 public:
2754 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2852 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
2755 SetAllSideEffects(); 2853 SetAllSideEffects();
2756 } 2854 }
2757 2855
2758 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") 2856 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
2759 }; 2857 };
2760 2858
2761 2859
2762 static inline bool StoringValueNeedsWriteBarrier(HValue* value) {
2763 return !value->type().IsSmi() &&
2764 !(value->IsConstant() && HConstant::cast(value)->InOldSpace());
2765 }
2766
2767
2768 class HStoreNamed: public HBinaryOperation { 2860 class HStoreNamed: public HBinaryOperation {
2769 public: 2861 public:
2770 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val) 2862 HStoreNamed(HValue* obj, Handle<Object> name, HValue* val)
2771 : HBinaryOperation(obj, val), name_(name) { 2863 : HBinaryOperation(obj, val), name_(name) {
2772 } 2864 }
2773 2865
2774 virtual Representation RequiredInputRepresentation(int index) const { 2866 virtual Representation RequiredInputRepresentation(int index) const {
2775 return Representation::Tagged(); 2867 return Representation::Tagged();
2776 } 2868 }
2777 2869
2778 virtual void PrintDataTo(StringStream* stream) const; 2870 virtual void PrintDataTo(StringStream* stream) const;
2779 2871
2780 HValue* object() const { return OperandAt(0); } 2872 HValue* object() const { return OperandAt(0); }
2781 Handle<Object> name() const { return name_; } 2873 Handle<Object> name() const { return name_; }
2782 HValue* value() const { return OperandAt(1); } 2874 HValue* value() const { return OperandAt(1); }
2783 void set_value(HValue* value) { SetOperandAt(1, value); } 2875 void set_value(HValue* value) { SetOperandAt(1, value); }
2784 2876
2785 bool NeedsWriteBarrier() const {
2786 return StoringValueNeedsWriteBarrier(value());
2787 }
2788
2789 DECLARE_INSTRUCTION(StoreNamed) 2877 DECLARE_INSTRUCTION(StoreNamed)
2790 2878
2791 private: 2879 private:
2792 Handle<Object> name_; 2880 Handle<Object> name_;
2793 }; 2881 };
2794 2882
2795 2883
2796 class HStoreNamedField: public HStoreNamed { 2884 class HStoreNamedField: public HStoreNamed {
2797 public: 2885 public:
2798 HStoreNamedField(HValue* obj, 2886 HStoreNamedField(HValue* obj,
2799 Handle<Object> name, 2887 Handle<Object> name,
2800 HValue* val, 2888 HValue* val,
2801 bool in_object, 2889 bool in_object,
2802 int offset) 2890 int offset)
2803 : HStoreNamed(obj, name, val), 2891 : HStoreNamed(obj, name, val),
2804 is_in_object_(in_object), 2892 is_in_object_(in_object),
2805 offset_(offset) { 2893 offset_(offset) {
2806 if (is_in_object_) { 2894 if (is_in_object_) {
2807 SetFlag(kChangesInobjectFields); 2895 SetFlag(kChangesInobjectFields);
2808 } else { 2896 } else {
2809 SetFlag(kChangesBackingStoreFields); 2897 SetFlag(kChangesBackingStoreFields);
2810 } 2898 }
2811 } 2899 }
2812 2900
2813 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field") 2901 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField, "store_named_field")
2814 2902
2815 virtual Representation RequiredInputRepresentation(int index) const { 2903 virtual Representation RequiredInputRepresentation(int index) const {
2816 return Representation::Tagged(); 2904 return Representation::Tagged();
2817 } 2905 }
2818 virtual void PrintDataTo(StringStream* stream) const; 2906 virtual void PrintDataTo(StringStream* stream) const;
2819 2907
2820 bool is_in_object() const { return is_in_object_; } 2908 bool is_in_object() const { return is_in_object_; }
2821 int offset() const { return offset_; } 2909 int offset() const { return offset_; }
2822 Handle<Map> transition() const { return transition_; } 2910 Handle<Map> transition() const { return transition_; }
2823 void set_transition(Handle<Map> map) { transition_ = map; } 2911 void set_transition(Handle<Map> map) { transition_ = map; }
2824 2912
2913 bool NeedsWriteBarrier() const {
2914 return StoringValueNeedsWriteBarrier(value());
2915 }
2916
2825 private: 2917 private:
2826 bool is_in_object_; 2918 bool is_in_object_;
2827 int offset_; 2919 int offset_;
2828 Handle<Map> transition_; 2920 Handle<Map> transition_;
2829 }; 2921 };
2830 2922
2831 2923
2832 class HStoreNamedGeneric: public HStoreNamed { 2924 class HStoreNamedGeneric: public HStoreNamed {
2833 public: 2925 public:
2834 HStoreNamedGeneric(HValue* obj, Handle<Object> name, HValue* val) 2926 HStoreNamedGeneric(HValue* obj, Handle<Object> name, HValue* val)
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 bool pretenure_; 3153 bool pretenure_;
3062 }; 3154 };
3063 3155
3064 3156
3065 class HTypeof: public HUnaryOperation { 3157 class HTypeof: public HUnaryOperation {
3066 public: 3158 public:
3067 explicit HTypeof(HValue* value) : HUnaryOperation(value) { 3159 explicit HTypeof(HValue* value) : HUnaryOperation(value) {
3068 set_representation(Representation::Tagged()); 3160 set_representation(Representation::Tagged());
3069 } 3161 }
3070 3162
3163 virtual Representation RequiredInputRepresentation(int index) const {
3164 return Representation::Tagged();
3165 }
3166
3071 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof") 3167 DECLARE_CONCRETE_INSTRUCTION(Typeof, "typeof")
3072 }; 3168 };
3073 3169
3074 3170
3075 class HValueOf: public HUnaryOperation { 3171 class HValueOf: public HUnaryOperation {
3076 public: 3172 public:
3077 explicit HValueOf(HValue* value) : HUnaryOperation(value) { 3173 explicit HValueOf(HValue* value) : HUnaryOperation(value) {
3078 set_representation(Representation::Tagged()); 3174 set_representation(Representation::Tagged());
3079 } 3175 }
3080 3176
(...skipping 18 matching lines...) Expand all
3099 HValue* object() const { return left(); } 3195 HValue* object() const { return left(); }
3100 HValue* key() const { return right(); } 3196 HValue* key() const { return right(); }
3101 }; 3197 };
3102 3198
3103 #undef DECLARE_INSTRUCTION 3199 #undef DECLARE_INSTRUCTION
3104 #undef DECLARE_CONCRETE_INSTRUCTION 3200 #undef DECLARE_CONCRETE_INSTRUCTION
3105 3201
3106 } } // namespace v8::internal 3202 } } // namespace v8::internal
3107 3203
3108 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3204 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698