| 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 26 matching lines...) Expand all Loading... |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 // Forward declarations. | 40 // Forward declarations. |
| 41 class LCodeGen; | 41 class LCodeGen; |
| 42 | 42 |
| 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ | 43 #define LITHIUM_CONCRETE_INSTRUCTION_LIST(V) \ |
| 44 V(AccessArgumentsAt) \ | 44 V(AccessArgumentsAt) \ |
| 45 V(AddI) \ | 45 V(AddI) \ |
| 46 V(Allocate) \ | 46 V(Allocate) \ |
| 47 V(AllocateObject) \ | |
| 48 V(ApplyArguments) \ | 47 V(ApplyArguments) \ |
| 49 V(ArgumentsElements) \ | 48 V(ArgumentsElements) \ |
| 50 V(ArgumentsLength) \ | 49 V(ArgumentsLength) \ |
| 51 V(ArithmeticD) \ | 50 V(ArithmeticD) \ |
| 52 V(ArithmeticT) \ | 51 V(ArithmeticT) \ |
| 53 V(BitI) \ | 52 V(BitI) \ |
| 54 V(BitNotI) \ | 53 V(BitNotI) \ |
| 55 V(BoundsCheck) \ | 54 V(BoundsCheck) \ |
| 56 V(Branch) \ | 55 V(Branch) \ |
| 57 V(CallConstantFunction) \ | 56 V(CallConstantFunction) \ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 V(MathFloorOfDiv) \ | 133 V(MathFloorOfDiv) \ |
| 135 V(MathLog) \ | 134 V(MathLog) \ |
| 136 V(MathMinMax) \ | 135 V(MathMinMax) \ |
| 137 V(MathPowHalf) \ | 136 V(MathPowHalf) \ |
| 138 V(MathRound) \ | 137 V(MathRound) \ |
| 139 V(MathSin) \ | 138 V(MathSin) \ |
| 140 V(MathSqrt) \ | 139 V(MathSqrt) \ |
| 141 V(MathTan) \ | 140 V(MathTan) \ |
| 142 V(ModI) \ | 141 V(ModI) \ |
| 143 V(MulI) \ | 142 V(MulI) \ |
| 144 V(NegateNoSSE2D) \ | |
| 145 V(NumberTagD) \ | 143 V(NumberTagD) \ |
| 146 V(NumberTagI) \ | 144 V(NumberTagI) \ |
| 147 V(NumberTagU) \ | 145 V(NumberTagU) \ |
| 148 V(NumberUntagD) \ | 146 V(NumberUntagD) \ |
| 149 V(OsrEntry) \ | 147 V(OsrEntry) \ |
| 150 V(OuterContext) \ | 148 V(OuterContext) \ |
| 151 V(Parameter) \ | 149 V(Parameter) \ |
| 152 V(Power) \ | 150 V(Power) \ |
| 153 V(Random) \ | 151 V(Random) \ |
| 154 V(PushArgument) \ | 152 V(PushArgument) \ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 HValue* hydrogen_value() const { return hydrogen_value_; } | 256 HValue* hydrogen_value() const { return hydrogen_value_; } |
| 259 | 257 |
| 260 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } | 258 virtual void SetDeferredLazyDeoptimizationEnvironment(LEnvironment* env) { } |
| 261 | 259 |
| 262 void MarkAsCall() { is_call_ = true; } | 260 void MarkAsCall() { is_call_ = true; } |
| 263 | 261 |
| 264 // Interface to the register allocator and iterators. | 262 // Interface to the register allocator and iterators. |
| 265 bool ClobbersTemps() const { return is_call_; } | 263 bool ClobbersTemps() const { return is_call_; } |
| 266 bool ClobbersRegisters() const { return is_call_; } | 264 bool ClobbersRegisters() const { return is_call_; } |
| 267 virtual bool ClobbersDoubleRegisters() const { | 265 virtual bool ClobbersDoubleRegisters() const { |
| 268 return is_call_ || !CpuFeatures::IsSupported(SSE2); | 266 return is_call_ || |
| 267 (!CpuFeatures::IsSupported(SSE2) && |
| 268 // We only have rudimentary X87Stack tracking, thus in general |
| 269 // cannot handle deoptimization nor phi-nodes. |
| 270 (HasEnvironment() || IsControl())); |
| 269 } | 271 } |
| 270 | 272 |
| 271 virtual bool HasResult() const = 0; | 273 virtual bool HasResult() const = 0; |
| 272 virtual LOperand* result() = 0; | 274 virtual LOperand* result() = 0; |
| 273 | 275 |
| 274 bool HasDoubleRegisterResult(); | 276 bool HasDoubleRegisterResult(); |
| 275 bool HasDoubleRegisterInput(); | 277 bool HasDoubleRegisterInput(); |
| 278 bool IsDoubleInput(X87Register reg, LCodeGen* cgen); |
| 276 | 279 |
| 277 LOperand* FirstInput() { return InputAt(0); } | 280 LOperand* FirstInput() { return InputAt(0); } |
| 278 LOperand* Output() { return HasResult() ? result() : NULL; } | 281 LOperand* Output() { return HasResult() ? result() : NULL; } |
| 279 | 282 |
| 280 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } | 283 virtual bool HasInterestingComment(LCodeGen* gen) const { return true; } |
| 281 | 284 |
| 282 #ifdef DEBUG | 285 #ifdef DEBUG |
| 283 void VerifyCall(); | 286 void VerifyCall(); |
| 284 #endif | 287 #endif |
| 285 | 288 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 | 373 |
| 371 private: | 374 private: |
| 372 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; | 375 LParallelMove* parallel_moves_[LAST_INNER_POSITION + 1]; |
| 373 HBasicBlock* block_; | 376 HBasicBlock* block_; |
| 374 }; | 377 }; |
| 375 | 378 |
| 376 | 379 |
| 377 class LInstructionGap: public LGap { | 380 class LInstructionGap: public LGap { |
| 378 public: | 381 public: |
| 379 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } | 382 explicit LInstructionGap(HBasicBlock* block) : LGap(block) { } |
| 380 virtual bool ClobbersDoubleRegisters() const { return false; } | |
| 381 | 383 |
| 382 virtual bool HasInterestingComment(LCodeGen* gen) const { | 384 virtual bool HasInterestingComment(LCodeGen* gen) const { |
| 383 return !IsRedundant(); | 385 return !IsRedundant(); |
| 384 } | 386 } |
| 385 | 387 |
| 386 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") | 388 DECLARE_CONCRETE_INSTRUCTION(InstructionGap, "gap") |
| 387 }; | 389 }; |
| 388 | 390 |
| 389 | 391 |
| 390 class LGoto: public LTemplateInstruction<0, 0, 0> { | 392 class LGoto: public LTemplateInstruction<0, 0, 0> { |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 654 |
| 653 LOperand* left() { return inputs_[0]; } | 655 LOperand* left() { return inputs_[0]; } |
| 654 LOperand* right() { return inputs_[1]; } | 656 LOperand* right() { return inputs_[1]; } |
| 655 LOperand* temp() { return temps_[0]; } | 657 LOperand* temp() { return temps_[0]; } |
| 656 | 658 |
| 657 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") | 659 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv, "math-floor-of-div") |
| 658 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) | 660 DECLARE_HYDROGEN_ACCESSOR(MathFloorOfDiv) |
| 659 }; | 661 }; |
| 660 | 662 |
| 661 | 663 |
| 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> { | 664 class LMulI: public LTemplateInstruction<1, 2, 1> { |
| 675 public: | 665 public: |
| 676 LMulI(LOperand* left, LOperand* right, LOperand* temp) { | 666 LMulI(LOperand* left, LOperand* right, LOperand* temp) { |
| 677 inputs_[0] = left; | 667 inputs_[0] = left; |
| 678 inputs_[1] = right; | 668 inputs_[1] = right; |
| 679 temps_[0] = temp; | 669 temps_[0] = temp; |
| 680 } | 670 } |
| 681 | 671 |
| 682 LOperand* left() { return inputs_[0]; } | 672 LOperand* left() { return inputs_[0]; } |
| 683 LOperand* right() { return inputs_[1]; } | 673 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()); } | 1205 Smi* value() const { return Smi::FromInt(hydrogen()->Integer32Value()); } |
| 1216 }; | 1206 }; |
| 1217 | 1207 |
| 1218 | 1208 |
| 1219 class LConstantD: public LTemplateInstruction<1, 0, 1> { | 1209 class LConstantD: public LTemplateInstruction<1, 0, 1> { |
| 1220 public: | 1210 public: |
| 1221 explicit LConstantD(LOperand* temp) { | 1211 explicit LConstantD(LOperand* temp) { |
| 1222 temps_[0] = temp; | 1212 temps_[0] = temp; |
| 1223 } | 1213 } |
| 1224 | 1214 |
| 1225 virtual bool ClobbersDoubleRegisters() const { | |
| 1226 return false; | |
| 1227 } | |
| 1228 | |
| 1229 LOperand* temp() { return temps_[0]; } | 1215 LOperand* temp() { return temps_[0]; } |
| 1230 | 1216 |
| 1231 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") | 1217 DECLARE_CONCRETE_INSTRUCTION(ConstantD, "constant-d") |
| 1232 DECLARE_HYDROGEN_ACCESSOR(Constant) | 1218 DECLARE_HYDROGEN_ACCESSOR(Constant) |
| 1233 | 1219 |
| 1234 double value() const { return hydrogen()->DoubleValue(); } | 1220 double value() const { return hydrogen()->DoubleValue(); } |
| 1235 }; | 1221 }; |
| 1236 | 1222 |
| 1237 | 1223 |
| 1238 class LConstantT: public LTemplateInstruction<1, 0, 0> { | 1224 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> { | 2185 class LNumberUntagD: public LTemplateInstruction<1, 1, 1> { |
| 2200 public: | 2186 public: |
| 2201 explicit LNumberUntagD(LOperand* value, LOperand* temp) { | 2187 explicit LNumberUntagD(LOperand* value, LOperand* temp) { |
| 2202 inputs_[0] = value; | 2188 inputs_[0] = value; |
| 2203 temps_[0] = temp; | 2189 temps_[0] = temp; |
| 2204 } | 2190 } |
| 2205 | 2191 |
| 2206 LOperand* value() { return inputs_[0]; } | 2192 LOperand* value() { return inputs_[0]; } |
| 2207 LOperand* temp() { return temps_[0]; } | 2193 LOperand* temp() { return temps_[0]; } |
| 2208 | 2194 |
| 2209 virtual bool ClobbersDoubleRegisters() const { | 2195 virtual bool ClobbersDoubleRegisters() const { return false; } |
| 2210 return false; | |
| 2211 } | |
| 2212 | 2196 |
| 2213 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") | 2197 DECLARE_CONCRETE_INSTRUCTION(NumberUntagD, "double-untag") |
| 2214 DECLARE_HYDROGEN_ACCESSOR(Change); | 2198 DECLARE_HYDROGEN_ACCESSOR(Change); |
| 2215 }; | 2199 }; |
| 2216 | 2200 |
| 2217 | 2201 |
| 2218 class LSmiUntag: public LTemplateInstruction<1, 1, 0> { | 2202 class LSmiUntag: public LTemplateInstruction<1, 1, 0> { |
| 2219 public: | 2203 public: |
| 2220 LSmiUntag(LOperand* value, bool needs_check) | 2204 LSmiUntag(LOperand* value, bool needs_check) |
| 2221 : needs_check_(needs_check) { | 2205 : needs_check_(needs_check) { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2580 inputs_[0] = value; | 2564 inputs_[0] = value; |
| 2581 } | 2565 } |
| 2582 | 2566 |
| 2583 LOperand* value() { return inputs_[0]; } | 2567 LOperand* value() { return inputs_[0]; } |
| 2584 | 2568 |
| 2585 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") | 2569 DECLARE_CONCRETE_INSTRUCTION(CheckNonSmi, "check-non-smi") |
| 2586 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) | 2570 DECLARE_HYDROGEN_ACCESSOR(CheckHeapObject) |
| 2587 }; | 2571 }; |
| 2588 | 2572 |
| 2589 | 2573 |
| 2590 class LAllocateObject: public LTemplateInstruction<1, 1, 1> { | |
| 2591 public: | |
| 2592 LAllocateObject(LOperand* context, LOperand* temp) { | |
| 2593 inputs_[0] = context; | |
| 2594 temps_[0] = temp; | |
| 2595 } | |
| 2596 | |
| 2597 LOperand* context() { return inputs_[0]; } | |
| 2598 LOperand* temp() { return temps_[0]; } | |
| 2599 | |
| 2600 DECLARE_CONCRETE_INSTRUCTION(AllocateObject, "allocate-object") | |
| 2601 DECLARE_HYDROGEN_ACCESSOR(AllocateObject) | |
| 2602 }; | |
| 2603 | |
| 2604 | |
| 2605 class LAllocate: public LTemplateInstruction<1, 2, 1> { | 2574 class LAllocate: public LTemplateInstruction<1, 2, 1> { |
| 2606 public: | 2575 public: |
| 2607 LAllocate(LOperand* context, LOperand* size, LOperand* temp) { | 2576 LAllocate(LOperand* context, LOperand* size, LOperand* temp) { |
| 2608 inputs_[0] = context; | 2577 inputs_[0] = context; |
| 2609 inputs_[1] = size; | 2578 inputs_[1] = size; |
| 2610 temps_[0] = temp; | 2579 temps_[0] = temp; |
| 2611 } | 2580 } |
| 2612 | 2581 |
| 2613 LOperand* context() { return inputs_[0]; } | 2582 LOperand* context() { return inputs_[0]; } |
| 2614 LOperand* size() { return inputs_[1]; } | 2583 LOperand* size() { return inputs_[1]; } |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2845 bool is_unused() const { return status_ == UNUSED; } | 2814 bool is_unused() const { return status_ == UNUSED; } |
| 2846 bool is_building() const { return status_ == BUILDING; } | 2815 bool is_building() const { return status_ == BUILDING; } |
| 2847 bool is_done() const { return status_ == DONE; } | 2816 bool is_done() const { return status_ == DONE; } |
| 2848 bool is_aborted() const { return status_ == ABORTED; } | 2817 bool is_aborted() const { return status_ == ABORTED; } |
| 2849 | 2818 |
| 2850 void Abort(const char* reason); | 2819 void Abort(const char* reason); |
| 2851 | 2820 |
| 2852 // Methods for getting operands for Use / Define / Temp. | 2821 // Methods for getting operands for Use / Define / Temp. |
| 2853 LUnallocated* ToUnallocated(Register reg); | 2822 LUnallocated* ToUnallocated(Register reg); |
| 2854 LUnallocated* ToUnallocated(XMMRegister reg); | 2823 LUnallocated* ToUnallocated(XMMRegister reg); |
| 2855 LUnallocated* ToUnallocated(X87TopOfStackRegister reg); | 2824 LUnallocated* ToUnallocated(X87Register reg); |
| 2856 | 2825 |
| 2857 // Methods for setting up define-use relationships. | 2826 // Methods for setting up define-use relationships. |
| 2858 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); | 2827 MUST_USE_RESULT LOperand* Use(HValue* value, LUnallocated* operand); |
| 2859 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); | 2828 MUST_USE_RESULT LOperand* UseFixed(HValue* value, Register fixed_register); |
| 2860 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, | 2829 MUST_USE_RESULT LOperand* UseFixedDouble(HValue* value, |
| 2861 XMMRegister fixed_register); | 2830 XMMRegister fixed_register); |
| 2862 MUST_USE_RESULT LOperand* UseX87TopOfStack(HValue* value); | |
| 2863 | 2831 |
| 2864 // A value that is guaranteed to be allocated to a register. | 2832 // 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 | 2833 // 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 | 2834 // instruction. This means that register allocator will not reuse it's |
| 2867 // register for any other operand inside instruction. | 2835 // register for any other operand inside instruction. |
| 2868 // Operand created by UseRegisterAtStart is guaranteed to be live only at | 2836 // Operand created by UseRegisterAtStart is guaranteed to be live only at |
| 2869 // instruction start. Register allocator is free to assign the same register | 2837 // instruction start. Register allocator is free to assign the same register |
| 2870 // to some other operand used inside instruction (i.e. temporary or | 2838 // to some other operand used inside instruction (i.e. temporary or |
| 2871 // output). | 2839 // output). |
| 2872 MUST_USE_RESULT LOperand* UseRegister(HValue* value); | 2840 MUST_USE_RESULT LOperand* UseRegister(HValue* value); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2966 | 2934 |
| 2967 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); | 2935 DISALLOW_COPY_AND_ASSIGN(LChunkBuilder); |
| 2968 }; | 2936 }; |
| 2969 | 2937 |
| 2970 #undef DECLARE_HYDROGEN_ACCESSOR | 2938 #undef DECLARE_HYDROGEN_ACCESSOR |
| 2971 #undef DECLARE_CONCRETE_INSTRUCTION | 2939 #undef DECLARE_CONCRETE_INSTRUCTION |
| 2972 | 2940 |
| 2973 } } // namespace v8::internal | 2941 } } // namespace v8::internal |
| 2974 | 2942 |
| 2975 #endif // V8_IA32_LITHIUM_IA32_H_ | 2943 #endif // V8_IA32_LITHIUM_IA32_H_ |
| OLD | NEW |