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

Side by Side Diff: src/ia32/lithium-ia32.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/ia32/lithium-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.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 21 matching lines...) Expand all
32 #include "lithium-allocator.h" 32 #include "lithium-allocator.h"
33 #include "lithium.h" 33 #include "lithium.h"
34 #include "safepoint-table.h" 34 #include "safepoint-table.h"
35 35
36 namespace v8 { 36 namespace v8 {
37 namespace internal { 37 namespace internal {
38 38
39 // Forward declarations. 39 // Forward declarations.
40 class LCodeGen; 40 class LCodeGen;
41 41
42
43 // Type hierarchy:
44 //
45 // LInstruction
46 // LTemplateInstruction
47 // LControlInstruction
48 // LBranch
49 // LClassOfTestAndBranch
50 // LCmpJSObjectEqAndBranch
51 // LCmpIDAndBranch
52 // LHasCachedArrayIndexAndBranch
53 // LHasInstanceTypeAndBranch
54 // LInstanceOfAndBranch
55 // LIsNullAndBranch
56 // LIsObjectAndBranch
57 // LIsSmiAndBranch
58 // LTypeofIsAndBranch
59 // LAccessArgumentsAt
60 // LArgumentsElements
61 // LArgumentsLength
62 // LAddI
63 // LApplyArguments
64 // LArithmeticD
65 // LArithmeticT
66 // LBitI
67 // LBoundsCheck
68 // LCmpID
69 // LCmpJSObjectEq
70 // LCmpT
71 // LDivI
72 // LInstanceOf
73 // LInstanceOfKnownGlobal
74 // LLoadKeyedFastElement
75 // LLoadKeyedGeneric
76 // LModI
77 // LMulI
78 // LPower
79 // LShiftI
80 // LSubI
81 // LCallConstantFunction
82 // LCallFunction
83 // LCallGlobal
84 // LCallKeyed
85 // LCallKnownGlobal
86 // LCallNamed
87 // LCallRuntime
88 // LCallStub
89 // LConstant
90 // LConstantD
91 // LConstantI
92 // LConstantT
93 // LDeoptimize
94 // LFunctionLiteral
95 // LGap
96 // LLabel
97 // LGlobalObject
98 // LGlobalReceiver
99 // LGoto
100 // LLazyBailout
101 // LLoadGlobal
102 // LCheckPrototypeMaps
103 // LLoadContextSlot
104 // LArrayLiteral
105 // LObjectLiteral
106 // LRegExpLiteral
107 // LOsrEntry
108 // LParameter
109 // LRegExpConstructResult
110 // LStackCheck
111 // LStoreKeyed
112 // LStoreKeyedFastElement
113 // LStoreKeyedGeneric
114 // LStoreNamed
115 // LStoreNamedField
116 // LStoreNamedGeneric
117 // LStringCharCodeAt
118 // LBitNotI
119 // LCallNew
120 // LCheckFunction
121 // LCheckPrototypeMaps
122 // LCheckInstanceType
123 // LCheckMap
124 // LCheckSmi
125 // LClassOfTest
126 // LDeleteProperty
127 // LDoubleToI
128 // LFixedArrayLength
129 // LHasCachedArrayIndex
130 // LHasInstanceType
131 // LInteger32ToDouble
132 // LIsNull
133 // LIsObject
134 // LIsSmi
135 // LJSArrayLength
136 // LLoadNamedField
137 // LLoadNamedGeneric
138 // LLoadFunctionPrototype
139 // LNumberTagD
140 // LNumberTagI
141 // LPushArgument
142 // LReturn
143 // LSmiTag
144 // LStoreGlobal
145 // LStringLength
146 // LTaggedToI
147 // LThrow
148 // LTypeof
149 // LTypeofIs
150 // LUnaryMathOperation
151 // LValueOf
152 // LUnknownOSRValue
153
154 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \ 42 #define LITHIUM_ALL_INSTRUCTION_LIST(V) \
155 V(ControlInstruction) \ 43 V(ControlInstruction) \
156 V(Constant) \
157 V(Call) \ 44 V(Call) \
158 V(StoreKeyed) \ 45 V(StoreKeyed) \
159 V(StoreNamed) \ 46 V(StoreNamed) \
160 LITHIUM_CONCRETE_INSTRUCTION_LIST(V) 47 LITHIUM_CONCRETE_INSTRUCTION_LIST(V)
161 48
162 49
163 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ 50 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \
164 V(AccessArgumentsAt) \ 51 V(AccessArgumentsAt) \
165 V(AddI) \ 52 V(AddI) \
166 V(ApplyArguments) \ 53 V(ApplyArguments) \
(...skipping 13 matching lines...) Expand all
180 V(CallKnownGlobal) \ 67 V(CallKnownGlobal) \
181 V(CallNamed) \ 68 V(CallNamed) \
182 V(CallNew) \ 69 V(CallNew) \
183 V(CallRuntime) \ 70 V(CallRuntime) \
184 V(CallStub) \ 71 V(CallStub) \
185 V(CheckFunction) \ 72 V(CheckFunction) \
186 V(CheckInstanceType) \ 73 V(CheckInstanceType) \
187 V(CheckMap) \ 74 V(CheckMap) \
188 V(CheckPrototypeMaps) \ 75 V(CheckPrototypeMaps) \
189 V(CheckSmi) \ 76 V(CheckSmi) \
77 V(ClassOfTest) \
78 V(ClassOfTestAndBranch) \
190 V(CmpID) \ 79 V(CmpID) \
191 V(CmpIDAndBranch) \ 80 V(CmpIDAndBranch) \
192 V(CmpJSObjectEq) \ 81 V(CmpJSObjectEq) \
193 V(CmpJSObjectEqAndBranch) \ 82 V(CmpJSObjectEqAndBranch) \
194 V(CmpMapAndBranch) \ 83 V(CmpMapAndBranch) \
195 V(CmpT) \ 84 V(CmpT) \
196 V(CmpTAndBranch) \ 85 V(CmpTAndBranch) \
197 V(ConstantD) \ 86 V(ConstantD) \
198 V(ConstantI) \ 87 V(ConstantI) \
199 V(ConstantT) \ 88 V(ConstantT) \
89 V(Context) \
200 V(DeleteProperty) \ 90 V(DeleteProperty) \
201 V(Deoptimize) \ 91 V(Deoptimize) \
202 V(DivI) \ 92 V(DivI) \
203 V(DoubleToI) \ 93 V(DoubleToI) \
94 V(FixedArrayLength) \
204 V(FunctionLiteral) \ 95 V(FunctionLiteral) \
205 V(Gap) \ 96 V(Gap) \
206 V(GlobalObject) \ 97 V(GlobalObject) \
207 V(GlobalReceiver) \ 98 V(GlobalReceiver) \
208 V(Goto) \ 99 V(Goto) \
209 V(FixedArrayLength) \ 100 V(HasCachedArrayIndex) \
101 V(HasCachedArrayIndexAndBranch) \
102 V(HasInstanceType) \
103 V(HasInstanceTypeAndBranch) \
210 V(InstanceOf) \ 104 V(InstanceOf) \
211 V(InstanceOfAndBranch) \ 105 V(InstanceOfAndBranch) \
212 V(InstanceOfKnownGlobal) \ 106 V(InstanceOfKnownGlobal) \
213 V(Integer32ToDouble) \ 107 V(Integer32ToDouble) \
214 V(IsNull) \ 108 V(IsNull) \
215 V(IsNullAndBranch) \ 109 V(IsNullAndBranch) \
216 V(IsObject) \ 110 V(IsObject) \
217 V(IsObjectAndBranch) \ 111 V(IsObjectAndBranch) \
218 V(IsSmi) \ 112 V(IsSmi) \
219 V(IsSmiAndBranch) \ 113 V(IsSmiAndBranch) \
114 V(IsConstructCall) \
115 V(IsConstructCallAndBranch) \
220 V(JSArrayLength) \ 116 V(JSArrayLength) \
221 V(HasInstanceType) \
222 V(HasInstanceTypeAndBranch) \
223 V(HasCachedArrayIndex) \
224 V(HasCachedArrayIndexAndBranch) \
225 V(ClassOfTest) \
226 V(ClassOfTestAndBranch) \
227 V(Label) \ 117 V(Label) \
228 V(LazyBailout) \ 118 V(LazyBailout) \
229 V(LoadContextSlot) \ 119 V(LoadContextSlot) \
230 V(LoadElements) \ 120 V(LoadElements) \
121 V(LoadFunctionPrototype) \
231 V(LoadGlobal) \ 122 V(LoadGlobal) \
232 V(LoadKeyedFastElement) \ 123 V(LoadKeyedFastElement) \
233 V(LoadKeyedGeneric) \ 124 V(LoadKeyedGeneric) \
234 V(LoadNamedField) \ 125 V(LoadNamedField) \
235 V(LoadNamedGeneric) \ 126 V(LoadNamedGeneric) \
236 V(LoadFunctionPrototype) \
237 V(ModI) \ 127 V(ModI) \
238 V(MulI) \ 128 V(MulI) \
239 V(NumberTagD) \ 129 V(NumberTagD) \
240 V(NumberTagI) \ 130 V(NumberTagI) \
241 V(NumberUntagD) \ 131 V(NumberUntagD) \
242 V(ObjectLiteral) \ 132 V(ObjectLiteral) \
243 V(OsrEntry) \ 133 V(OsrEntry) \
134 V(OuterContext) \
244 V(Parameter) \ 135 V(Parameter) \
245 V(Power) \ 136 V(Power) \
246 V(PushArgument) \ 137 V(PushArgument) \
247 V(RegExpLiteral) \ 138 V(RegExpLiteral) \
248 V(Return) \ 139 V(Return) \
249 V(ShiftI) \ 140 V(ShiftI) \
250 V(SmiTag) \ 141 V(SmiTag) \
251 V(SmiUntag) \ 142 V(SmiUntag) \
252 V(StackCheck) \ 143 V(StackCheck) \
144 V(StoreContextSlot) \
253 V(StoreGlobal) \ 145 V(StoreGlobal) \
254 V(StoreKeyedFastElement) \ 146 V(StoreKeyedFastElement) \
255 V(StoreKeyedGeneric) \ 147 V(StoreKeyedGeneric) \
256 V(StoreNamedField) \ 148 V(StoreNamedField) \
257 V(StoreNamedGeneric) \ 149 V(StoreNamedGeneric) \
258 V(StringCharCodeAt) \ 150 V(StringCharCodeAt) \
259 V(StringLength) \ 151 V(StringLength) \
260 V(SubI) \ 152 V(SubI) \
261 V(TaggedToI) \ 153 V(TaggedToI) \
262 V(Throw) \ 154 V(Throw) \
(...skipping 21 matching lines...) Expand all
284 176
285 #define DECLARE_HYDROGEN_ACCESSOR(type) \ 177 #define DECLARE_HYDROGEN_ACCESSOR(type) \
286 H##type* hydrogen() const { \ 178 H##type* hydrogen() const { \
287 return H##type::cast(hydrogen_value()); \ 179 return H##type::cast(hydrogen_value()); \
288 } 180 }
289 181
290 182
291 class LInstruction: public ZoneObject { 183 class LInstruction: public ZoneObject {
292 public: 184 public:
293 LInstruction() 185 LInstruction()
294 : hydrogen_value_(NULL) { } 186 : environment_(NULL),
187 hydrogen_value_(NULL),
188 is_call_(false),
189 is_save_doubles_(false) { }
295 virtual ~LInstruction() { } 190 virtual ~LInstruction() { }
296 191
297 virtual void CompileToNative(LCodeGen* generator) = 0; 192 virtual void CompileToNative(LCodeGen* generator) = 0;
298 virtual const char* Mnemonic() const = 0; 193 virtual const char* Mnemonic() const = 0;
299 virtual void PrintTo(StringStream* stream); 194 virtual void PrintTo(StringStream* stream);
300 virtual void PrintDataTo(StringStream* stream) = 0; 195 virtual void PrintDataTo(StringStream* stream) = 0;
301 virtual void PrintOutputOperandTo(StringStream* stream) = 0; 196 virtual void PrintOutputOperandTo(StringStream* stream) = 0;
302 197
303 // Declare virtual type testers. 198 // Declare virtual type testers.
304 #define DECLARE_DO(type) virtual bool Is##type() const { return false; } 199 #define DECLARE_DO(type) virtual bool Is##type() const { return false; }
305 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO) 200 LITHIUM_ALL_INSTRUCTION_LIST(DECLARE_DO)
306 #undef DECLARE_DO 201 #undef DECLARE_DO
307 202
308 virtual bool IsControl() const { return false; } 203 virtual bool IsControl() const { return false; }
309 virtual void SetBranchTargets(int true_block_id, int false_block_id) { } 204 virtual void SetBranchTargets(int true_block_id, int false_block_id) { }
310 205
311 void set_environment(LEnvironment* env) { environment_.set(env); } 206 void set_environment(LEnvironment* env) { environment_ = env; }
312 LEnvironment* environment() const { return environment_.get(); } 207 LEnvironment* environment() const { return environment_; }
313 bool HasEnvironment() const { return environment_.is_set(); } 208 bool HasEnvironment() const { return environment_ != NULL; }
314 209
315 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); } 210 void set_pointer_map(LPointerMap* p) { pointer_map_.set(p); }
316 LPointerMap* pointer_map() const { return pointer_map_.get(); } 211 LPointerMap* pointer_map() const { return pointer_map_.get(); }
317 bool HasPointerMap() const { return pointer_map_.is_set(); } 212 bool HasPointerMap() const { return pointer_map_.is_set(); }
318 213
319 virtual bool HasResult() const = 0;
320 214
321 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; } 215 void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
322 HValue* hydrogen_value() const { return hydrogen_value_; } 216 HValue* hydrogen_value() const { return hydrogen_value_; }
323 217
324 void set_deoptimization_environment(LEnvironment* env) { 218 void set_deoptimization_environment(LEnvironment* env) {
325 deoptimization_environment_.set(env); 219 deoptimization_environment_.set(env);
326 } 220 }
327 LEnvironment* deoptimization_environment() const { 221 LEnvironment* deoptimization_environment() const {
328 return deoptimization_environment_.get(); 222 return deoptimization_environment_.get();
329 } 223 }
330 bool HasDeoptimizationEnvironment() const { 224 bool HasDeoptimizationEnvironment() const {
331 return deoptimization_environment_.is_set(); 225 return deoptimization_environment_.is_set();
332 } 226 }
333 227
228 void MarkAsCall() { is_call_ = true; }
229 void MarkAsSaveDoubles() { is_save_doubles_ = true; }
230
231 // Interface to the register allocator and iterators.
232 bool IsMarkedAsCall() const { return is_call_; }
233 bool IsMarkedAsSaveDoubles() const { return is_save_doubles_; }
234
235 virtual bool HasResult() const = 0;
236 virtual LOperand* result() = 0;
237
238 virtual int InputCount() = 0;
239 virtual LOperand* InputAt(int i) = 0;
240 virtual int TempCount() = 0;
241 virtual LOperand* TempAt(int i) = 0;
242
243 LOperand* FirstInput() { return InputAt(0); }
244 LOperand* Output() { return HasResult() ? result() : NULL; }
245
246 #ifdef DEBUG
247 void VerifyCall();
248 #endif
249
334 private: 250 private:
335 SetOncePointer<LEnvironment> environment_; 251 LEnvironment* environment_;
336 SetOncePointer<LPointerMap> pointer_map_; 252 SetOncePointer<LPointerMap> pointer_map_;
337 HValue* hydrogen_value_; 253 HValue* hydrogen_value_;
338 SetOncePointer<LEnvironment> deoptimization_environment_; 254 SetOncePointer<LEnvironment> deoptimization_environment_;
255 bool is_call_;
256 bool is_save_doubles_;
339 }; 257 };
340 258
341 259
342 template<typename ElementType, int NumElements> 260 template<typename ElementType, int NumElements>
343 class OperandContainer { 261 class OperandContainer {
344 public: 262 public:
345 OperandContainer() { 263 OperandContainer() {
346 for (int i = 0; i < NumElements; i++) elems_[i] = NULL; 264 for (int i = 0; i < NumElements; i++) elems_[i] = NULL;
347 } 265 }
348 int length() { return NumElements; } 266 int length() { return NumElements; }
349 ElementType& operator[](int i) { 267 ElementType& operator[](int i) {
350 ASSERT(i < length()); 268 ASSERT(i < length());
351 return elems_[i]; 269 return elems_[i];
352 } 270 }
353 void PrintOperandsTo(StringStream* stream); 271 void PrintOperandsTo(StringStream* stream);
354 272
355 private: 273 private:
356 ElementType elems_[NumElements]; 274 ElementType elems_[NumElements];
357 }; 275 };
358 276
359 277
360 template<typename ElementType> 278 template<typename ElementType>
361 class OperandContainer<ElementType, 0> { 279 class OperandContainer<ElementType, 0> {
362 public: 280 public:
363 int length() { return 0; } 281 int length() { return 0; }
364 void PrintOperandsTo(StringStream* stream) { } 282 void PrintOperandsTo(StringStream* stream) { }
283 ElementType& operator[](int i) {
284 UNREACHABLE();
285 static ElementType t = 0;
286 return t;
287 }
365 }; 288 };
366 289
367 290
368 // R = number of result operands (0 or 1). 291 // R = number of result operands (0 or 1).
369 // I = number of input operands. 292 // I = number of input operands.
370 // T = number of temporary operands. 293 // T = number of temporary operands.
371 template<int R, int I, int T> 294 template<int R, int I, int T>
372 class LTemplateInstruction: public LInstruction { 295 class LTemplateInstruction: public LInstruction {
373 public: 296 public:
374 // Allow 0 or 1 output operands. 297 // Allow 0 or 1 output operands.
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 explicit LHasCachedArrayIndexAndBranch(LOperand* value) { 749 explicit LHasCachedArrayIndexAndBranch(LOperand* value) {
827 inputs_[0] = value; 750 inputs_[0] = value;
828 } 751 }
829 752
830 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch, 753 DECLARE_CONCRETE_INSTRUCTION(HasCachedArrayIndexAndBranch,
831 "has-cached-array-index-and-branch") 754 "has-cached-array-index-and-branch")
832 virtual void PrintDataTo(StringStream* stream); 755 virtual void PrintDataTo(StringStream* stream);
833 }; 756 };
834 757
835 758
759 class LIsConstructCall: public LTemplateInstruction<1, 0, 0> {
760 public:
761 DECLARE_CONCRETE_INSTRUCTION(IsConstructCall, "is-construct-call")
762 DECLARE_HYDROGEN_ACCESSOR(IsConstructCall)
763 };
764
765
766 class LIsConstructCallAndBranch: public LControlInstruction<0, 1> {
767 public:
768 explicit LIsConstructCallAndBranch(LOperand* temp) {
769 temps_[0] = temp;
770 }
771
772 DECLARE_CONCRETE_INSTRUCTION(IsConstructCallAndBranch,
773 "is-construct-call-and-branch")
774 };
775
776
836 class LClassOfTest: public LTemplateInstruction<1, 1, 1> { 777 class LClassOfTest: public LTemplateInstruction<1, 1, 1> {
837 public: 778 public:
838 LClassOfTest(LOperand* value, LOperand* temp) { 779 LClassOfTest(LOperand* value, LOperand* temp) {
839 inputs_[0] = value; 780 inputs_[0] = value;
840 temps_[0] = temp; 781 temps_[0] = temp;
841 } 782 }
842 783
843 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test") 784 DECLARE_CONCRETE_INSTRUCTION(ClassOfTest, "class-of-test")
844 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest) 785 DECLARE_HYDROGEN_ACCESSOR(ClassOfTest)
845 786
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 LSubI(LOperand* left, LOperand* right) { 925 LSubI(LOperand* left, LOperand* right) {
985 inputs_[0] = left; 926 inputs_[0] = left;
986 inputs_[1] = right; 927 inputs_[1] = right;
987 } 928 }
988 929
989 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i") 930 DECLARE_CONCRETE_INSTRUCTION(SubI, "sub-i")
990 DECLARE_HYDROGEN_ACCESSOR(Sub) 931 DECLARE_HYDROGEN_ACCESSOR(Sub)
991 }; 932 };
992 933
993 934
994 class LConstant: public LTemplateInstruction<1, 0, 0> { 935 class LConstantI: public LTemplateInstruction<1, 0, 0> {
995 DECLARE_INSTRUCTION(Constant) 936 public:
937 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i")
938 DECLARE_HYDROGEN_ACCESSOR(Constant)
939
940 int32_t value() const { return hydrogen()->Integer32Value(); }
996 }; 941 };
997 942
998 943
999 class LConstantI: public LConstant { 944 class LConstantD: public LTemplateInstruction<1, 0, 1> {
1000 public: 945 public:
1001 explicit LConstantI(int32_t value) : value_(value) { } 946 explicit LConstantD(LOperand* temp) {
1002 int32_t value() const { return value_; } 947 temps_[0] = temp;
948 }
1003 949
1004 DECLARE_CONCRETE_INSTRUCTION(ConstantI, "constant-i") 950 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d")
951 DECLARE_HYDROGEN_ACCESSOR(Constant)
1005 952
1006 private: 953 double value() const { return hydrogen()->DoubleValue(); }
1007 int32_t value_;
1008 }; 954 };
1009 955
1010 956
1011 class LConstantD: public LConstant { 957 class LConstantT: public LTemplateInstruction<1, 0, 0> {
1012 public: 958 public:
1013 explicit LConstantD(double value) : value_(value) { } 959 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1014 double value() const { return value_; } 960 DECLARE_HYDROGEN_ACCESSOR(Constant)
1015 961
1016 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") 962 Handle<Object> value() const { return hydrogen()->handle(); }
1017
1018 private:
1019 double value_;
1020 }; 963 };
1021 964
1022 965
1023 class LConstantT: public LConstant {
1024 public:
1025 explicit LConstantT(Handle<Object> value) : value_(value) { }
1026 Handle<Object> value() const { return value_; }
1027
1028 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t")
1029
1030 private:
1031 Handle<Object> value_;
1032 };
1033
1034
1035 class LBranch: public LControlInstruction<1, 0> { 966 class LBranch: public LControlInstruction<1, 0> {
1036 public: 967 public:
1037 explicit LBranch(LOperand* value) { 968 explicit LBranch(LOperand* value) {
1038 inputs_[0] = value; 969 inputs_[0] = value;
1039 } 970 }
1040 971
1041 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch") 972 DECLARE_CONCRETE_INSTRUCTION(Branch, "branch")
1042 DECLARE_HYDROGEN_ACCESSOR(Value) 973 DECLARE_HYDROGEN_ACCESSOR(Value)
1043 974
1044 virtual void PrintDataTo(StringStream* stream); 975 virtual void PrintDataTo(StringStream* stream);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 public: 1210 public:
1280 explicit LStoreGlobal(LOperand* value) { 1211 explicit LStoreGlobal(LOperand* value) {
1281 inputs_[0] = value; 1212 inputs_[0] = value;
1282 } 1213 }
1283 1214
1284 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global") 1215 DECLARE_CONCRETE_INSTRUCTION(StoreGlobal, "store-global")
1285 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal) 1216 DECLARE_HYDROGEN_ACCESSOR(StoreGlobal)
1286 }; 1217 };
1287 1218
1288 1219
1289 class LLoadContextSlot: public LTemplateInstruction<1, 0, 0> { 1220 class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> {
1290 public: 1221 public:
1222 explicit LLoadContextSlot(LOperand* context) {
1223 inputs_[0] = context;
1224 }
1225
1291 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") 1226 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot")
1292 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) 1227 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot)
1293 1228
1294 int context_chain_length() { return hydrogen()->context_chain_length(); } 1229 LOperand* context() { return InputAt(0); }
1295 int slot_index() { return hydrogen()->slot_index(); } 1230 int slot_index() { return hydrogen()->slot_index(); }
1296 1231
1297 virtual void PrintDataTo(StringStream* stream); 1232 virtual void PrintDataTo(StringStream* stream);
1298 }; 1233 };
1299 1234
1300 1235
1236 class LStoreContextSlot: public LTemplateInstruction<0, 2, 1> {
1237 public:
1238 LStoreContextSlot(LOperand* context, LOperand* value, LOperand* temp) {
1239 inputs_[0] = context;
1240 inputs_[1] = value;
1241 temps_[0] = temp;
1242 }
1243
1244 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot, "store-context-slot")
1245 DECLARE_HYDROGEN_ACCESSOR(StoreContextSlot)
1246
1247 LOperand* context() { return InputAt(0); }
1248 LOperand* value() { return InputAt(1); }
1249 int slot_index() { return hydrogen()->slot_index(); }
1250 int needs_write_barrier() { return hydrogen()->NeedsWriteBarrier(); }
1251
1252 virtual void PrintDataTo(StringStream* stream);
1253 };
1254
1255
1301 class LPushArgument: public LTemplateInstruction<0, 1, 0> { 1256 class LPushArgument: public LTemplateInstruction<0, 1, 0> {
1302 public: 1257 public:
1303 explicit LPushArgument(LOperand* value) { 1258 explicit LPushArgument(LOperand* value) {
1304 inputs_[0] = value; 1259 inputs_[0] = value;
1305 } 1260 }
1306 1261
1307 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument") 1262 DECLARE_CONCRETE_INSTRUCTION(PushArgument, "push-argument")
1308 }; 1263 };
1309 1264
1310 1265
1311 class LGlobalObject: public LTemplateInstruction<1, 0, 0> { 1266 class LContext: public LTemplateInstruction<1, 0, 0> {
1312 public: 1267 public:
1313 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object") 1268 DECLARE_CONCRETE_INSTRUCTION(Context, "context")
1314 }; 1269 };
1315 1270
1316 1271
1317 class LGlobalReceiver: public LTemplateInstruction<1, 0, 0> { 1272 class LOuterContext: public LTemplateInstruction<1, 1, 0> {
1318 public: 1273 public:
1319 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver") 1274 explicit LOuterContext(LOperand* context) {
1275 inputs_[0] = context;
1276 }
1277
1278 DECLARE_CONCRETE_INSTRUCTION(OuterContext, "outer-context")
1279
1280 LOperand* context() { return InputAt(0); }
1320 }; 1281 };
1321 1282
1322 1283
1284 class LGlobalObject: public LTemplateInstruction<1, 1, 0> {
1285 public:
1286 explicit LGlobalObject(LOperand* context) {
1287 inputs_[0] = context;
1288 }
1289
1290 DECLARE_CONCRETE_INSTRUCTION(GlobalObject, "global-object")
1291
1292 LOperand* context() { return InputAt(0); }
1293 };
1294
1295
1296 class LGlobalReceiver: public LTemplateInstruction<1, 1, 0> {
1297 public:
1298 explicit LGlobalReceiver(LOperand* global_object) {
1299 inputs_[0] = global_object;
1300 }
1301
1302 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver, "global-receiver")
1303
1304 LOperand* global() { return InputAt(0); }
1305 };
1306
1307
1323 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> { 1308 class LCallConstantFunction: public LTemplateInstruction<1, 0, 0> {
1324 public: 1309 public:
1325 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function") 1310 DECLARE_CONCRETE_INSTRUCTION(CallConstantFunction, "call-constant-function")
1326 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction) 1311 DECLARE_HYDROGEN_ACCESSOR(CallConstantFunction)
1327 1312
1328 virtual void PrintDataTo(StringStream* stream); 1313 virtual void PrintDataTo(StringStream* stream);
1329 1314
1330 Handle<JSFunction> function() { return hydrogen()->function(); } 1315 Handle<JSFunction> function() { return hydrogen()->function(); }
1331 int arity() const { return hydrogen()->argument_count() - 1; } 1316 int arity() const { return hydrogen()->argument_count() - 1; }
1332 }; 1317 };
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 class LChunkBuilder; 1793 class LChunkBuilder;
1809 class LChunk: public ZoneObject { 1794 class LChunk: public ZoneObject {
1810 public: 1795 public:
1811 explicit LChunk(HGraph* graph) 1796 explicit LChunk(HGraph* graph)
1812 : spill_slot_count_(0), 1797 : spill_slot_count_(0),
1813 graph_(graph), 1798 graph_(graph),
1814 instructions_(32), 1799 instructions_(32),
1815 pointer_maps_(8), 1800 pointer_maps_(8),
1816 inlined_closures_(1) { } 1801 inlined_closures_(1) { }
1817 1802
1818 int AddInstruction(LInstruction* instruction, HBasicBlock* block); 1803 void AddInstruction(LInstruction* instruction, HBasicBlock* block);
1819 LConstantOperand* DefineConstantOperand(HConstant* constant); 1804 LConstantOperand* DefineConstantOperand(HConstant* constant);
1820 Handle<Object> LookupLiteral(LConstantOperand* operand) const; 1805 Handle<Object> LookupLiteral(LConstantOperand* operand) const;
1821 Representation LookupLiteralRepresentation(LConstantOperand* operand) const; 1806 Representation LookupLiteralRepresentation(LConstantOperand* operand) const;
1822 1807
1823 int GetNextSpillIndex(bool is_double); 1808 int GetNextSpillIndex(bool is_double);
1824 LOperand* GetNextSpillSlot(bool is_double); 1809 LOperand* GetNextSpillSlot(bool is_double);
1825 1810
1826 int ParameterAt(int index); 1811 int ParameterAt(int index);
1827 int GetParameterStackSlot(int index) const; 1812 int GetParameterStackSlot(int index) const;
1828 int spill_slot_count() const { return spill_slot_count_; } 1813 int spill_slot_count() const { return spill_slot_count_; }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 LChunkBuilder(HGraph* graph, LAllocator* allocator) 1859 LChunkBuilder(HGraph* graph, LAllocator* allocator)
1875 : chunk_(NULL), 1860 : chunk_(NULL),
1876 graph_(graph), 1861 graph_(graph),
1877 status_(UNUSED), 1862 status_(UNUSED),
1878 current_instruction_(NULL), 1863 current_instruction_(NULL),
1879 current_block_(NULL), 1864 current_block_(NULL),
1880 next_block_(NULL), 1865 next_block_(NULL),
1881 argument_count_(0), 1866 argument_count_(0),
1882 allocator_(allocator), 1867 allocator_(allocator),
1883 position_(RelocInfo::kNoPosition), 1868 position_(RelocInfo::kNoPosition),
1884 instructions_pending_deoptimization_environment_(NULL), 1869 instruction_pending_deoptimization_environment_(NULL),
1885 pending_deoptimization_ast_id_(AstNode::kNoNumber) { } 1870 pending_deoptimization_ast_id_(AstNode::kNoNumber) { }
1886 1871
1887 // Build the sequence for the graph. 1872 // Build the sequence for the graph.
1888 LChunk* Build(); 1873 LChunk* Build();
1889 1874
1890 // Declare methods that deal with the individual node types. 1875 // Declare methods that deal with the individual node types.
1891 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node); 1876 #define DECLARE_DO(type) LInstruction* Do##type(H##type* node);
1892 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 1877 HYDROGEN_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
1893 #undef DECLARE_DO 1878 #undef DECLARE_DO
1894 1879
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 1993
2009 LChunk* chunk_; 1994 LChunk* chunk_;
2010 HGraph* const graph_; 1995 HGraph* const graph_;
2011 Status status_; 1996 Status status_;
2012 HInstruction* current_instruction_; 1997 HInstruction* current_instruction_;
2013 HBasicBlock* current_block_; 1998 HBasicBlock* current_block_;
2014 HBasicBlock* next_block_; 1999 HBasicBlock* next_block_;
2015 int argument_count_; 2000 int argument_count_;
2016 LAllocator* allocator_; 2001 LAllocator* allocator_;
2017 int position_; 2002 int position_;
2018 LInstruction* instructions_pending_deoptimization_environment_; 2003 LInstruction* instruction_pending_deoptimization_environment_;
2019 int pending_deoptimization_ast_id_; 2004 int pending_deoptimization_ast_id_;
2020 2005
2021 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); 2006 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder);
2022 }; 2007 };
2023 2008
2024 #undef DECLARE_HYDROGEN_ACCESSOR 2009 #undef DECLARE_HYDROGEN_ACCESSOR
2025 #undef DECLARE_INSTRUCTION 2010 #undef DECLARE_INSTRUCTION
2026 #undef DECLARE_CONCRETE_INSTRUCTION 2011 #undef DECLARE_CONCRETE_INSTRUCTION
2027 2012
2028 } } // namespace v8::internal 2013 } } // namespace v8::internal
2029 2014
2030 #endif // V8_IA32_LITHIUM_IA32_H_ 2015 #endif // V8_IA32_LITHIUM_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698