OLD | NEW |
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 2758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2769 // Return value is in st(0) on ia32. | 2769 // Return value is in st(0) on ia32. |
2770 // Store it into the (fixed) result register. | 2770 // Store it into the (fixed) result register. |
2771 __ sub(Operand(esp), Immediate(kDoubleSize)); | 2771 __ sub(Operand(esp), Immediate(kDoubleSize)); |
2772 __ fstp_d(Operand(esp, 0)); | 2772 __ fstp_d(Operand(esp, 0)); |
2773 __ movdbl(result_reg, Operand(esp, 0)); | 2773 __ movdbl(result_reg, Operand(esp, 0)); |
2774 __ add(Operand(esp), Immediate(kDoubleSize)); | 2774 __ add(Operand(esp), Immediate(kDoubleSize)); |
2775 } | 2775 } |
2776 | 2776 |
2777 | 2777 |
2778 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { | 2778 void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
2779 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2779 ASSERT(instr->InputAt(0)->Equals(instr->result())); |
2780 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 2780 XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
2781 TranscendentalCacheStub::UNTAGGED); | 2781 NearLabel positive, done, zero, negative; |
2782 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); | 2782 __ xorpd(xmm0, xmm0); |
| 2783 __ ucomisd(input_reg, xmm0); |
| 2784 __ j(above, &positive); |
| 2785 __ j(equal, &zero); |
| 2786 ExternalReference nan = ExternalReference::address_of_nan(); |
| 2787 __ movdbl(input_reg, Operand::StaticVariable(nan)); |
| 2788 __ jmp(&done); |
| 2789 __ bind(&zero); |
| 2790 __ push(Immediate(0xFFF00000)); |
| 2791 __ push(Immediate(0)); |
| 2792 __ movdbl(input_reg, Operand(esp, 0)); |
| 2793 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 2794 __ jmp(&done); |
| 2795 __ bind(&positive); |
| 2796 __ fldln2(); |
| 2797 __ sub(Operand(esp), Immediate(kDoubleSize)); |
| 2798 __ movdbl(Operand(esp, 0), input_reg); |
| 2799 __ fld_d(Operand(esp, 0)); |
| 2800 __ fyl2x(); |
| 2801 __ fstp_d(Operand(esp, 0)); |
| 2802 __ movdbl(input_reg, Operand(esp, 0)); |
| 2803 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 2804 __ bind(&done); |
2783 } | 2805 } |
2784 | 2806 |
2785 | 2807 |
2786 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { | 2808 void LCodeGen::DoMathCos(LUnaryMathOperation* instr) { |
2787 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 2809 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
2788 TranscendentalCacheStub stub(TranscendentalCache::COS, | 2810 TranscendentalCacheStub stub(TranscendentalCache::COS, |
2789 TranscendentalCacheStub::UNTAGGED); | 2811 TranscendentalCacheStub::UNTAGGED); |
2790 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); | 2812 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); |
2791 } | 2813 } |
2792 | 2814 |
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4116 ASSERT(osr_pc_offset_ == -1); | 4138 ASSERT(osr_pc_offset_ == -1); |
4117 osr_pc_offset_ = masm()->pc_offset(); | 4139 osr_pc_offset_ = masm()->pc_offset(); |
4118 } | 4140 } |
4119 | 4141 |
4120 | 4142 |
4121 #undef __ | 4143 #undef __ |
4122 | 4144 |
4123 } } // namespace v8::internal | 4145 } } // namespace v8::internal |
4124 | 4146 |
4125 #endif // V8_TARGET_ARCH_IA32 | 4147 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |