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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 V(MathFloorOfDiv) \ | 134 V(MathFloorOfDiv) \ |
135 V(MathLog) \ | 135 V(MathLog) \ |
136 V(MathMinMax) \ | 136 V(MathMinMax) \ |
137 V(MathPowHalf) \ | 137 V(MathPowHalf) \ |
138 V(MathRound) \ | 138 V(MathRound) \ |
139 V(MathSin) \ | 139 V(MathSin) \ |
140 V(MathSqrt) \ | 140 V(MathSqrt) \ |
141 V(MathTan) \ | 141 V(MathTan) \ |
142 V(ModI) \ | 142 V(ModI) \ |
143 V(MulI) \ | 143 V(MulI) \ |
144 V(NegateNoSSE2D) \ | |
145 V(NumberTagD) \ | 144 V(NumberTagD) \ |
146 V(NumberTagI) \ | 145 V(NumberTagI) \ |
147 V(NumberTagU) \ | 146 V(NumberTagU) \ |
148 V(NumberUntagD) \ | 147 V(NumberUntagD) \ |
149 V(OsrEntry) \ | 148 V(OsrEntry) \ |
150 V(OuterContext) \ | 149 V(OuterContext) \ |
151 V(Parameter) \ | 150 V(Parameter) \ |
152 V(Power) \ | 151 V(Power) \ |
153 V(Random) \ | 152 V(Random) \ |
154 V(PushArgument) \ | 153 V(PushArgument) \ |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 HValue* hydrogen_value() const { return hydrogen_value_; } | 257 HValue* hydrogen_value() const { return hydrogen_value_; } |
259 | 258 |
260 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 259 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
261 | 260 |
262 void MarkAsCall() { is_call_ = true; } | 261 void MarkAsCall() { is_call_ = true; } |
263 | 262 |
264 // Interface to the register allocator and iterators. | 263 // Interface to the register allocator and iterators. |
265 bool ClobbersTemps() const { return is_call_; } | 264 bool ClobbersTemps() const { return is_call_; } |
266 bool ClobbersRegisters() const { return is_call_; } | 265 bool ClobbersRegisters() const { return is_call_; } |
267 virtual bool ClobbersDoubleRegisters() const { | 266 virtual bool ClobbersDoubleRegisters() const { |
268 return is_call_ || !CpuFeatures::IsSupported(SSE2); | 267 return is_call_ || |
| 268 (!CpuFeatures::IsSupported(SSE2) && |
| 269 // We only have rudimentary X87Stack tracking, thus in general |
| 270 // cannot handle deoptimization nor phi-nodes. |
| 271 (HasEnvironment() || IsControl())); |
269 } | 272 } |
270 | 273 |
271 virtual bool HasResult() const = 0; | 274 virtual bool HasResult() const = 0; |
272 virtual LOperand* result() = 0; | 275 virtual LOperand* result() = 0; |
273 | 276 |
274 bool HasDoubleRegisterResult(); | 277 bool HasDoubleRegisterResult(); |
275 bool HasDoubleRegisterInput(); | 278 bool HasDoubleRegisterInput(); |
| 279 bool IsDoubleInput(X87Register reg, LCodeGen* cgen); |
276 | 280 |
277 LOperand* FirstInput() { return InputAt(0); } | 281 LOperand* FirstInput() { return InputAt(0); } |
278 LOperand* Output() { return HasResult() ? result() : NULL; } | 282 LOperand* Output() { return HasResult() ? result() : NULL; } |
279 | 283 |
280 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 284 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
281 | 285 |
282 #ifdef DEBUG | 286 #ifdef DEBUG |
283 void VerifyCall(); | 287 void VerifyCall(); |
284 #endif | 288 #endif |
285 | 289 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 374 |
371 private: | 375 private: |
372 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; | 376 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; |
373 HBasicBlock* block_; | 377 HBasicBlock* block_; |
374 }; | 378 }; |
375 | 379 |
376 | 380 |
377 class LInstructionGap: public LGap { | 381 class LInstructionGap: public LGap { |
378 public: | 382 public: |
379 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } | 383 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } |
380 virtual bool ClobbersDoubleRegisters() const { return false; } | |
381 | 384 |
382 virtual bool HasInterestingComment(LCodeGen* gen) const { | 385 virtual bool HasInterestingComment(LCodeGen* gen) const { |
383 return !IsRedundant(); | 386 return !IsRedundant(); |
384 } | 387 } |
385 | 388 |
386 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") | 389 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") |
387 }; | 390 }; |
388 | 391 |
389 | 392 |
390 class LGoto: public LTemplateInstruction<0, 0, 0> { | 393 class LGoto: public LTemplateInstruction<0, 0, 0> { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 | 655 |
653 LOperand* left() { return inputs_[0]; } | 656 LOperand* left() { return inputs_[0]; } |
654 LOperand* right() { return inputs_[1]; } | 657 LOperand* right() { return inputs_[1]; } |
655 LOperand* temp() { return temps_[0]; } | 658 LOperand* temp() { return temps_[0]; } |
656 | 659 |
657 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") | 660 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") |
658 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) | 661 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) |
659 }; | 662 }; |
660 | 663 |
661 | 664 |
662 class LNegateNoSSE2D: public LTemplateInstruction<1, 1, 0> { | |
663 public: | |
664 explicit LNegateNoSSE2D(LOperand* value) { | |
665 inputs_[0] = value; | |
666 } | |
667 | |
668 LOperand* value() { return inputs_[0]; } | |
669 | |
670 DECLARE_CONCRETE_INSTRUCTION(NegateNoSSE2D, "negate-no-sse2-d") | |
671 }; | |
672 | |
673 | |
674 class LMulI: public LTemplateInstruction<1, 2, 1> { | 665 class LMulI: public LTemplateInstruction<1, 2, 1> { |
675 public: | 666 public: |
676 LMulI(LOperand* left, LOperand* right, LOperand* temp) { | 667 LMulI(LOperand* left, LOperand* right, LOperand* temp) { |
677 inputs_[0] = left; | 668 inputs_[0] = left; |
678 inputs_[1] = right; | 669 inputs_[1] = right; |
679 temps_[0] = temp; | 670 temps_[0] = temp; |
680 } | 671 } |
681 | 672 |
682 LOperand* left() { return inputs_[0]; } | 673 LOperand* left() { return inputs_[0]; } |
683 LOperand* right() { return inputs_[1]; } | 674 LOperand* right() { return inputs_[1]; } |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); } | 1206 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); } |
1216 }; | 1207 }; |
1217 | 1208 |
1218 | 1209 |
1219 class LConstantD: public LTemplateInstruction<1, 0, 1> { | 1210 class LConstantD: public LTemplateInstruction<1, 0, 1> { |
1220 public: | 1211 public: |
1221 explicit LConstantD(LOperand* temp) { | 1212 explicit LConstantD(LOperand* temp) { |
1222 temps_[0] = temp; | 1213 temps_[0] = temp; |
1223 } | 1214 } |
1224 | 1215 |
1225 virtual bool ClobbersDoubleRegisters() const { | |
1226 return false; | |
1227 } | |
1228 | |
1229 LOperand* temp() { return temps_[0]; } | 1216 LOperand* temp() { return temps_[0]; } |
1230 | 1217 |
1231 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") | 1218 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
1232 DECLARE_HYDROGEN_ACCESSOR(Constant) | 1219 DECLARE_HYDROGEN_ACCESSOR(Constant) |
1233 | 1220 |
1234 double value() const { return hydrogen()->DoubleValue(); } | 1221 double value() const { return hydrogen()->DoubleValue(); } |
1235 }; | 1222 }; |
1236 | 1223 |
1237 | 1224 |
1238 class LConstantT: public LTemplateInstruction<1, 0, 0> { | 1225 class LConstantT: public LTemplateInstruction<1, 0, 0> { |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 class LNumberUntagD: public LTemplateInstruction<1, 1, 1> { | 2186 class LNumberUntagD: public LTemplateInstruction<1, 1, 1> { |
2200 public: | 2187 public: |
2201 explicit LNumberUntagD(LOperand* value, LOperand* temp) { | 2188 explicit LNumberUntagD(LOperand* value, LOperand* temp) { |
2202 inputs_[0] = value; | 2189 inputs_[0] = value; |
2203 temps_[0] = temp; | 2190 temps_[0] = temp; |
2204 } | 2191 } |
2205 | 2192 |
2206 LOperand* value() { return inputs_[0]; } | 2193 LOperand* value() { return inputs_[0]; } |
2207 LOperand* temp() { return temps_[0]; } | 2194 LOperand* temp() { return temps_[0]; } |
2208 | 2195 |
2209 virtual bool ClobbersDoubleRegisters() const { | 2196 virtual bool ClobbersDoubleRegisters() const { return false; } |
2210 return false; | |
2211 } | |
2212 | 2197 |
2213 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") | 2198 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") |
2214 DECLARE_HYDROGEN_ACCESSOR(Change); | 2199 DECLARE_HYDROGEN_ACCESSOR(Change); |
2215 }; | 2200 }; |
2216 | 2201 |
2217 | 2202 |
2218 class LSmiUntag: public LTemplateInstruction<1, 1, 0> { | 2203 class LSmiUntag: public LTemplateInstruction<1, 1, 0> { |
2219 public: | 2204 public: |
2220 LSmiUntag(LOperand* value, bool needs_check) | 2205 LSmiUntag(LOperand* value, bool needs_check) |
2221 : needs_check_(needs_check) { | 2206 : needs_check_(needs_check) { |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2845 bool is_unused() const { return status_ == UNUSED; } | 2830 bool is_unused() const { return status_ == UNUSED; } |
2846 bool is_building() const { return status_ == BUILDING; } | 2831 bool is_building() const { return status_ == BUILDING; } |
2847 bool is_done() const { return status_ == DONE; } | 2832 bool is_done() const { return status_ == DONE; } |
2848 bool is_aborted() const { return status_ == ABORTED; } | 2833 bool is_aborted() const { return status_ == ABORTED; } |
2849 | 2834 |
2850 void Abort(const char* reason); | 2835 void Abort(const char* reason); |
2851 | 2836 |
2852 // Methods for getting operands for Use / Define / Temp. | 2837 // Methods for getting operands for Use / Define / Temp. |
2853 LUnallocated* ToUnallocated(Register reg); | 2838 LUnallocated* ToUnallocated(Register reg); |
2854 LUnallocated* ToUnallocated(XMMRegister reg); | 2839 LUnallocated* ToUnallocated(XMMRegister reg); |
2855 LUnallocated* ToUnallocated(X87TopOfStackRegister reg); | 2840 LUnallocated* ToUnallocated(X87Register reg); |
2856 | 2841 |
2857 // Methods for setting up define-use relationships. | 2842 // Methods for setting up define-use relationships. |
2858 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); | 2843 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
2859 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); | 2844 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
2860 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, | 2845 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
2861 XMMRegister fixed_register); | 2846 XMMRegister fixed_register); |
2862 MUST_USE_RESULT LOperand* UseX87TopOfStack(HValue* value); | |
2863 | 2847 |
2864 // A value that is guaranteed to be allocated to a register. | 2848 // A value that is guaranteed to be allocated to a register. |
2865 // Operand created by UseRegister is guaranteed to be live until the end of | 2849 // Operand created by UseRegister is guaranteed to be live until the end of |
2866 // instruction. This means that register allocator will not reuse it's | 2850 // instruction. This means that register allocator will not reuse it's |
2867 // register for any other operand inside instruction. | 2851 // register for any other operand inside instruction. |
2868 // Operand created by UseRegisterAtStart is guaranteed to be live only at | 2852 // Operand created by UseRegisterAtStart is guaranteed to be live only at |
2869 // instruction start. Register allocator is free to assign the same register | 2853 // instruction start. Register allocator is free to assign the same register |
2870 // to some other operand used inside instruction (i.e. temporary or | 2854 // to some other operand used inside instruction (i.e. temporary or |
2871 // output). | 2855 // output). |
2872 MUST_USE_RESULT LOperand* UseRegister(HValue* value); | 2856 MUST_USE_RESULT LOperand* UseRegister(HValue* value); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 | 2950 |
2967 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2951 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
2968 }; | 2952 }; |
2969 | 2953 |
2970 #undef DECLARE_HYDROGEN_ACCESSOR | 2954 #undef DECLARE_HYDROGEN_ACCESSOR |
2971 #undef DECLARE_CONCRETE_INSTRUCTION | 2955 #undef DECLARE_CONCRETE_INSTRUCTION |
2972 | 2956 |
2973 } } // namespace v8::internal | 2957 } } // namespace v8::internal |
2974 | 2958 |
2975 #endif // V8_IA32_LITHIUM_IA32_H_ | 2959 #endif // V8_IA32_LITHIUM_IA32_H_ |
OLD | NEW |