OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 XMMRegister result = ToDoubleRegister(instr->result()); | 3666 XMMRegister result = ToDoubleRegister(instr->result()); |
3667 XMMRegister temp0 = double_scratch0(); | 3667 XMMRegister temp0 = double_scratch0(); |
3668 Register temp1 = ToRegister(instr->temp1()); | 3668 Register temp1 = ToRegister(instr->temp1()); |
3669 Register temp2 = ToRegister(instr->temp2()); | 3669 Register temp2 = ToRegister(instr->temp2()); |
3670 | 3670 |
3671 MathExpGenerator::EmitMathExp(masm(), input, result, temp0, temp1, temp2); | 3671 MathExpGenerator::EmitMathExp(masm(), input, result, temp0, temp1, temp2); |
3672 } | 3672 } |
3673 | 3673 |
3674 | 3674 |
3675 void LCodeGen::DoMathLog(LMathLog* instr) { | 3675 void LCodeGen::DoMathLog(LMathLog* instr) { |
3676 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3676 ASSERT(instr->value()->Equals(instr->result())); |
3677 TranscendentalCacheStub stub(TranscendentalCache::LOG, | 3677 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
3678 TranscendentalCacheStub::UNTAGGED); | 3678 XMMRegister xmm_scratch = double_scratch0(); |
3679 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3679 Label positive, done, zero; |
| 3680 __ xorps(xmm_scratch, xmm_scratch); |
| 3681 __ ucomisd(input_reg, xmm_scratch); |
| 3682 __ j(above, &positive, Label::kNear); |
| 3683 __ j(equal, &zero, Label::kNear); |
| 3684 ExternalReference nan = |
| 3685 ExternalReference::address_of_canonical_non_hole_nan(); |
| 3686 Operand nan_operand = masm()->ExternalOperand(nan); |
| 3687 __ movsd(input_reg, nan_operand); |
| 3688 __ jmp(&done, Label::kNear); |
| 3689 __ bind(&zero); |
| 3690 ExternalReference ninf = |
| 3691 ExternalReference::address_of_negative_infinity(); |
| 3692 Operand ninf_operand = masm()->ExternalOperand(ninf); |
| 3693 __ movsd(input_reg, ninf_operand); |
| 3694 __ jmp(&done, Label::kNear); |
| 3695 __ bind(&positive); |
| 3696 __ fldln2(); |
| 3697 __ subq(rsp, Immediate(kDoubleSize)); |
| 3698 __ movsd(Operand(rsp, 0), input_reg); |
| 3699 __ fld_d(Operand(rsp, 0)); |
| 3700 __ fyl2x(); |
| 3701 __ fstp_d(Operand(rsp, 0)); |
| 3702 __ movsd(input_reg, Operand(rsp, 0)); |
| 3703 __ addq(rsp, Immediate(kDoubleSize)); |
| 3704 __ bind(&done); |
3680 } | 3705 } |
3681 | 3706 |
3682 | 3707 |
3683 void LCodeGen::DoMathTan(LMathTan* instr) { | 3708 void LCodeGen::DoMathTan(LMathTan* instr) { |
3684 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); | 3709 ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
3685 TranscendentalCacheStub stub(TranscendentalCache::TAN, | 3710 TranscendentalCacheStub stub(TranscendentalCache::TAN, |
3686 TranscendentalCacheStub::UNTAGGED); | 3711 TranscendentalCacheStub::UNTAGGED); |
3687 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); | 3712 CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
3688 } | 3713 } |
3689 | 3714 |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5458 FixedArray::kHeaderSize - kPointerSize)); | 5483 FixedArray::kHeaderSize - kPointerSize)); |
5459 __ bind(&done); | 5484 __ bind(&done); |
5460 } | 5485 } |
5461 | 5486 |
5462 | 5487 |
5463 #undef __ | 5488 #undef __ |
5464 | 5489 |
5465 } } // namespace v8::internal | 5490 } } // namespace v8::internal |
5466 | 5491 |
5467 #endif // V8_TARGET_ARCH_X64 | 5492 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |