OLD | NEW |
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 V(ClampDToUint8) \ | 73 V(ClampDToUint8) \ |
74 V(ClampIToUint8) \ | 74 V(ClampIToUint8) \ |
75 V(ClampTToUint8) \ | 75 V(ClampTToUint8) \ |
76 V(ClampTToUint8NoSSE2) \ | 76 V(ClampTToUint8NoSSE2) \ |
77 V(ClassOfTestAndBranch) \ | 77 V(ClassOfTestAndBranch) \ |
78 V(CompareNumericAndBranch) \ | 78 V(CompareNumericAndBranch) \ |
79 V(CmpObjectEqAndBranch) \ | 79 V(CmpObjectEqAndBranch) \ |
80 V(CmpMapAndBranch) \ | 80 V(CmpMapAndBranch) \ |
81 V(CmpT) \ | 81 V(CmpT) \ |
82 V(ConstantD) \ | 82 V(ConstantD) \ |
| 83 V(ConstantE) \ |
83 V(ConstantI) \ | 84 V(ConstantI) \ |
84 V(ConstantS) \ | 85 V(ConstantS) \ |
85 V(ConstantT) \ | 86 V(ConstantT) \ |
86 V(Context) \ | 87 V(Context) \ |
87 V(DateField) \ | 88 V(DateField) \ |
88 V(DebugBreak) \ | 89 V(DebugBreak) \ |
89 V(DeclareGlobals) \ | 90 V(DeclareGlobals) \ |
90 V(Deoptimize) \ | 91 V(Deoptimize) \ |
91 V(DivI) \ | 92 V(DivI) \ |
92 V(DoubleToI) \ | 93 V(DoubleToI) \ |
(...skipping 19 matching lines...) Expand all Loading... |
112 V(Integer32ToSmi) \ | 113 V(Integer32ToSmi) \ |
113 V(InvokeFunction) \ | 114 V(InvokeFunction) \ |
114 V(IsConstructCallAndBranch) \ | 115 V(IsConstructCallAndBranch) \ |
115 V(IsObjectAndBranch) \ | 116 V(IsObjectAndBranch) \ |
116 V(IsStringAndBranch) \ | 117 V(IsStringAndBranch) \ |
117 V(IsSmiAndBranch) \ | 118 V(IsSmiAndBranch) \ |
118 V(IsNumberAndBranch) \ | 119 V(IsNumberAndBranch) \ |
119 V(IsUndetectableAndBranch) \ | 120 V(IsUndetectableAndBranch) \ |
120 V(Label) \ | 121 V(Label) \ |
121 V(LazyBailout) \ | 122 V(LazyBailout) \ |
122 V(LinkObjectInList) \ | |
123 V(LoadContextSlot) \ | 123 V(LoadContextSlot) \ |
124 V(LoadExternalArrayPointer) \ | 124 V(LoadExternalArrayPointer) \ |
125 V(LoadFieldByIndex) \ | 125 V(LoadFieldByIndex) \ |
126 V(LoadFunctionPrototype) \ | 126 V(LoadFunctionPrototype) \ |
127 V(LoadGlobalCell) \ | 127 V(LoadGlobalCell) \ |
128 V(LoadGlobalGeneric) \ | 128 V(LoadGlobalGeneric) \ |
129 V(LoadKeyed) \ | 129 V(LoadKeyed) \ |
130 V(LoadKeyedGeneric) \ | 130 V(LoadKeyedGeneric) \ |
131 V(LoadNamedField) \ | 131 V(LoadNamedField) \ |
132 V(LoadNamedFieldPolymorphic) \ | 132 V(LoadNamedFieldPolymorphic) \ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 V(StoreGlobalCell) \ | 167 V(StoreGlobalCell) \ |
168 V(StoreGlobalGeneric) \ | 168 V(StoreGlobalGeneric) \ |
169 V(StoreKeyed) \ | 169 V(StoreKeyed) \ |
170 V(StoreKeyedGeneric) \ | 170 V(StoreKeyedGeneric) \ |
171 V(StoreNamedField) \ | 171 V(StoreNamedField) \ |
172 V(StoreNamedGeneric) \ | 172 V(StoreNamedGeneric) \ |
173 V(StringAdd) \ | 173 V(StringAdd) \ |
174 V(StringCharCodeAt) \ | 174 V(StringCharCodeAt) \ |
175 V(StringCharFromCode) \ | 175 V(StringCharFromCode) \ |
176 V(StringCompareAndBranch) \ | 176 V(StringCompareAndBranch) \ |
177 V(StringLength) \ | |
178 V(SubI) \ | 177 V(SubI) \ |
179 V(TaggedToI) \ | 178 V(TaggedToI) \ |
180 V(TaggedToINoSSE2) \ | 179 V(TaggedToINoSSE2) \ |
181 V(ThisFunction) \ | 180 V(ThisFunction) \ |
182 V(Throw) \ | 181 V(Throw) \ |
183 V(ToFastProperties) \ | 182 V(ToFastProperties) \ |
184 V(TransitionElementsKind) \ | 183 V(TransitionElementsKind) \ |
185 V(TrapAllocationMemento) \ | 184 V(TrapAllocationMemento) \ |
186 V(Typeof) \ | 185 V(Typeof) \ |
187 V(TypeofIsAndBranch) \ | 186 V(TypeofIsAndBranch) \ |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 bool ClobbersRegisters() const { return is_call_; } | 263 bool ClobbersRegisters() const { return is_call_; } |
265 virtual bool ClobbersDoubleRegisters() const { | 264 virtual bool ClobbersDoubleRegisters() const { |
266 return is_call_ || | 265 return is_call_ || |
267 (!CpuFeatures::IsSupported(SSE2) && | 266 (!CpuFeatures::IsSupported(SSE2) && |
268 // We only have rudimentary X87Stack tracking, thus in general | 267 // We only have rudimentary X87Stack tracking, thus in general |
269 // cannot handle deoptimization nor phi-nodes. | 268 // cannot handle deoptimization nor phi-nodes. |
270 (HasEnvironment() || IsControl())); | 269 (HasEnvironment() || IsControl())); |
271 } | 270 } |
272 | 271 |
273 virtual bool HasResult() const = 0; | 272 virtual bool HasResult() const = 0; |
274 virtual LOperand* result() = 0; | 273 virtual LOperand* result() const = 0; |
275 | 274 |
276 bool HasDoubleRegisterResult(); | 275 bool HasDoubleRegisterResult(); |
277 bool HasDoubleRegisterInput(); | 276 bool HasDoubleRegisterInput(); |
278 bool IsDoubleInput(X87Register reg, LCodeGen* cgen); | 277 bool IsDoubleInput(X87Register reg, LCodeGen* cgen); |
279 | 278 |
280 LOperand* FirstInput() { return InputAt(0); } | 279 LOperand* FirstInput() { return InputAt(0); } |
281 LOperand* Output() { return HasResult() ? result() : NULL; } | 280 LOperand* Output() { return HasResult() ? result() : NULL; } |
282 | 281 |
283 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 282 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
284 | 283 |
(...skipping 19 matching lines...) Expand all Loading... |
304 | 303 |
305 | 304 |
306 // R = number of result operands (0 or 1). | 305 // R = number of result operands (0 or 1). |
307 // I = number of input operands. | 306 // I = number of input operands. |
308 // T = number of temporary operands. | 307 // T = number of temporary operands. |
309 template<int R, int I, int T> | 308 template<int R, int I, int T> |
310 class LTemplateInstruction: public LInstruction { | 309 class LTemplateInstruction: public LInstruction { |
311 public: | 310 public: |
312 // Allow 0 or 1 output operands. | 311 // Allow 0 or 1 output operands. |
313 STATIC_ASSERT(R == 0 || R == 1); | 312 STATIC_ASSERT(R == 0 || R == 1); |
314 virtual bool HasResult() const { return R != 0; } | 313 virtual bool HasResult() const { return R != 0 && result() != NULL; } |
315 void set_result(LOperand* operand) { results_[0] = operand; } | 314 void set_result(LOperand* operand) { results_[0] = operand; } |
316 LOperand* result() { return results_[0]; } | 315 LOperand* result() const { return results_[0]; } |
317 | 316 |
318 protected: | 317 protected: |
319 EmbeddedContainer<LOperand*, R> results_; | 318 EmbeddedContainer<LOperand*, R> results_; |
320 EmbeddedContainer<LOperand*, I> inputs_; | 319 EmbeddedContainer<LOperand*, I> inputs_; |
321 EmbeddedContainer<LOperand*, T> temps_; | 320 EmbeddedContainer<LOperand*, T> temps_; |
322 | 321 |
323 private: | 322 private: |
324 // Iterator support. | 323 // Iterator support. |
325 virtual int InputCount() { return I; } | 324 virtual int InputCount() { return I; } |
326 virtual LOperand* InputAt(int i) { return inputs_[i]; } | 325 virtual LOperand* InputAt(int i) { return inputs_[i]; } |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 | 1200 |
1202 LOperand* temp() { return temps_[0]; } | 1201 LOperand* temp() { return temps_[0]; } |
1203 | 1202 |
1204 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") | 1203 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
1205 DECLARE_HYDROGEN_ACCESSOR(Constant) | 1204 DECLARE_HYDROGEN_ACCESSOR(Constant) |
1206 | 1205 |
1207 double value() const { return hydrogen()->DoubleValue(); } | 1206 double value() const { return hydrogen()->DoubleValue(); } |
1208 }; | 1207 }; |
1209 | 1208 |
1210 | 1209 |
| 1210 class LConstantE: public LTemplateInstruction<1, 0, 0> { |
| 1211 public: |
| 1212 DECLARE_CONCRETE_INSTRUCTION(ConstantE, "constant-e") |
| 1213 DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 1214 |
| 1215 ExternalReference value() const { |
| 1216 return hydrogen()->ExternalReferenceValue(); |
| 1217 } |
| 1218 }; |
| 1219 |
| 1220 |
1211 class LConstantT: public LTemplateInstruction<1, 0, 0> { | 1221 class LConstantT: public LTemplateInstruction<1, 0, 0> { |
1212 public: | 1222 public: |
1213 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") | 1223 DECLARE_CONCRETE_INSTRUCTION(ConstantT, "constant-t") |
1214 DECLARE_HYDROGEN_ACCESSOR(Constant) | 1224 DECLARE_HYDROGEN_ACCESSOR(Constant) |
1215 | 1225 |
1216 Handle<Object> value() const { return hydrogen()->handle(); } | 1226 Handle<Object> value() const { return hydrogen()->handle(); } |
1217 }; | 1227 }; |
1218 | 1228 |
1219 | 1229 |
1220 class LBranch: public LControlInstruction<1, 1> { | 1230 class LBranch: public LControlInstruction<1, 1> { |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 LOperand* value() { return inputs_[2]; } | 1696 LOperand* value() { return inputs_[2]; } |
1687 | 1697 |
1688 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic") | 1698 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric, "store-global-generic") |
1689 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric) | 1699 DECLARE_HYDROGEN_ACCESSOR(StoreGlobalGeneric) |
1690 | 1700 |
1691 Handle<Object> name() const { return hydrogen()->name(); } | 1701 Handle<Object> name() const { return hydrogen()->name(); } |
1692 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } | 1702 StrictModeFlag strict_mode_flag() { return hydrogen()->strict_mode_flag(); } |
1693 }; | 1703 }; |
1694 | 1704 |
1695 | 1705 |
1696 class LLinkObjectInList: public LTemplateInstruction<0, 1, 1> { | |
1697 public: | |
1698 explicit LLinkObjectInList(LOperand* object, LOperand* temp) { | |
1699 inputs_[0] = object; | |
1700 temps_[0] = temp; | |
1701 } | |
1702 | |
1703 LOperand* object() { return inputs_[0]; } | |
1704 LOperand* temp() { return temps_[0]; } | |
1705 | |
1706 ExternalReference GetReference(Isolate* isolate); | |
1707 | |
1708 DECLARE_CONCRETE_INSTRUCTION(LinkObjectInList, "link-object-in-list") | |
1709 DECLARE_HYDROGEN_ACCESSOR(LinkObjectInList) | |
1710 | |
1711 virtual void PrintDataTo(StringStream* stream); | |
1712 }; | |
1713 | |
1714 | |
1715 class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { | 1706 class LLoadContextSlot: public LTemplateInstruction<1, 1, 0> { |
1716 public: | 1707 public: |
1717 explicit LLoadContextSlot(LOperand* context) { | 1708 explicit LLoadContextSlot(LOperand* context) { |
1718 inputs_[0] = context; | 1709 inputs_[0] = context; |
1719 } | 1710 } |
1720 | 1711 |
1721 LOperand* context() { return inputs_[0]; } | 1712 LOperand* context() { return inputs_[0]; } |
1722 | 1713 |
1723 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") | 1714 DECLARE_CONCRETE_INSTRUCTION(LoadContextSlot, "load-context-slot") |
1724 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) | 1715 DECLARE_HYDROGEN_ACCESSOR(LoadContextSlot) |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 } | 2403 } |
2413 | 2404 |
2414 LOperand* context() { return inputs_[0]; } | 2405 LOperand* context() { return inputs_[0]; } |
2415 LOperand* char_code() { return inputs_[1]; } | 2406 LOperand* char_code() { return inputs_[1]; } |
2416 | 2407 |
2417 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") | 2408 DECLARE_CONCRETE_INSTRUCTION(StringCharFromCode, "string-char-from-code") |
2418 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) | 2409 DECLARE_HYDROGEN_ACCESSOR(StringCharFromCode) |
2419 }; | 2410 }; |
2420 | 2411 |
2421 | 2412 |
2422 class LStringLength: public LTemplateInstruction<1, 1, 0> { | |
2423 public: | |
2424 explicit LStringLength(LOperand* string) { | |
2425 inputs_[0] = string; | |
2426 } | |
2427 | |
2428 LOperand* string() { return inputs_[0]; } | |
2429 | |
2430 DECLARE_CONCRETE_INSTRUCTION(StringLength, "string-length") | |
2431 DECLARE_HYDROGEN_ACCESSOR(StringLength) | |
2432 }; | |
2433 | |
2434 | |
2435 class LCheckFunction: public LTemplateInstruction<0, 1, 0> { | 2413 class LCheckFunction: public LTemplateInstruction<0, 1, 0> { |
2436 public: | 2414 public: |
2437 explicit LCheckFunction(LOperand* value) { | 2415 explicit LCheckFunction(LOperand* value) { |
2438 inputs_[0] = value; | 2416 inputs_[0] = value; |
2439 } | 2417 } |
2440 | 2418 |
2441 LOperand* value() { return inputs_[0]; } | 2419 LOperand* value() { return inputs_[0]; } |
2442 | 2420 |
2443 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") | 2421 DECLARE_CONCRETE_INSTRUCTION(CheckFunction, "check-function") |
2444 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) | 2422 DECLARE_HYDROGEN_ACCESSOR(CheckFunction) |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 LPlatformChunk* chunk() const { return chunk_; } | 2793 LPlatformChunk* chunk() const { return chunk_; } |
2816 CompilationInfo* info() const { return info_; } | 2794 CompilationInfo* info() const { return info_; } |
2817 HGraph* graph() const { return graph_; } | 2795 HGraph* graph() const { return graph_; } |
2818 Zone* zone() const { return zone_; } | 2796 Zone* zone() const { return zone_; } |
2819 | 2797 |
2820 bool is_unused() const { return status_ == UNUSED; } | 2798 bool is_unused() const { return status_ == UNUSED; } |
2821 bool is_building() const { return status_ == BUILDING; } | 2799 bool is_building() const { return status_ == BUILDING; } |
2822 bool is_done() const { return status_ == DONE; } | 2800 bool is_done() const { return status_ == DONE; } |
2823 bool is_aborted() const { return status_ == ABORTED; } | 2801 bool is_aborted() const { return status_ == ABORTED; } |
2824 | 2802 |
2825 void Abort(const char* reason); | 2803 void Abort(BailoutReason reason); |
2826 | 2804 |
2827 // Methods for getting operands for Use / Define / Temp. | 2805 // Methods for getting operands for Use / Define / Temp. |
2828 LUnallocated* ToUnallocated(Register reg); | 2806 LUnallocated* ToUnallocated(Register reg); |
2829 LUnallocated* ToUnallocated(XMMRegister reg); | 2807 LUnallocated* ToUnallocated(XMMRegister reg); |
2830 LUnallocated* ToUnallocated(X87Register reg); | 2808 LUnallocated* ToUnallocated(X87Register reg); |
2831 | 2809 |
2832 // Methods for setting up define-use relationships. | 2810 // Methods for setting up define-use relationships. |
2833 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); | 2811 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
2834 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); | 2812 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
2835 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, | 2813 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2940 | 2918 |
2941 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2919 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2942 }; | 2920 }; |
2943 | 2921 |
2944 #undef DECLARE_HYDROGEN_ACCESSOR | 2922 #undef DECLARE_HYDROGEN_ACCESSOR |
2945 #undef DECLARE_CONCRETE_INSTRUCTION | 2923 #undef DECLARE_CONCRETE_INSTRUCTION |
2946 | 2924 |
2947 } } // namespace v8::internal | 2925 } } // namespace v8::internal |
2948 | 2926 |
2949 #endif // V8_IA32_LITHIUM_IA32_H_ | 2927 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |