OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 3594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3605 XMMRegister result = ToDoubleRegister(instr->result()); | 3605 XMMRegister result = ToDoubleRegister(instr->result()); |
3606 XMMRegister temp0 = double_scratch0(); | 3606 XMMRegister temp0 = double_scratch0(); |
3607 Register temp1 = ToRegister(instr->temp1()); | 3607 Register temp1 = ToRegister(instr->temp1()); |
3608 Register temp2 = ToRegister(instr->temp2()); | 3608 Register temp2 = ToRegister(instr->temp2()); |
3609 | 3609 |
3610 MathExpGenerator::EmitMathExp(masm(), input, result, temp0, temp1, temp2); | 3610 MathExpGenerator::EmitMathExp(masm(), input, result, temp0, temp1, temp2); |
3611 } | 3611 } |
3612 | 3612 |
3613 | 3613 |
3614 void LCodeGen::DoMathLog(LMathLog* instr) { | 3614 void LCodeGen::DoMathLog(LMathLog* instr) { |
3615 DCHECK(instr->value()->Equals(instr->result())); | 3615 DCHECK(ToDoubleRegister(instr->value()).is(xmm0)); |
3616 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3616 DCHECK(ToDoubleRegister(instr->result()).is(xmm0)); |
3617 XMMRegister xmm_scratch = double_scratch0(); | 3617 __ PrepareCallCFunction(1); |
3618 Label positive, done, zero; | 3618 __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 1); |
3619 __ Xorpd(xmm_scratch, xmm_scratch); | |
3620 __ Ucomisd(input_reg, xmm_scratch); | |
3621 __ j(above, &positive, Label::kNear); | |
3622 __ j(not_carry, &zero, Label::kNear); | |
3623 __ Pcmpeqd(input_reg, input_reg); | |
3624 __ jmp(&done, Label::kNear); | |
3625 __ bind(&zero); | |
3626 ExternalReference ninf = | |
3627 ExternalReference::address_of_negative_infinity(); | |
3628 Operand ninf_operand = masm()->ExternalOperand(ninf); | |
3629 __ Movsd(input_reg, ninf_operand); | |
3630 __ jmp(&done, Label::kNear); | |
3631 __ bind(&positive); | |
3632 __ fldln2(); | |
3633 __ subp(rsp, Immediate(kDoubleSize)); | |
3634 __ Movsd(Operand(rsp, 0), input_reg); | |
3635 __ fld_d(Operand(rsp, 0)); | |
3636 __ fyl2x(); | |
3637 __ fstp_d(Operand(rsp, 0)); | |
3638 __ Movsd(input_reg, Operand(rsp, 0)); | |
3639 __ addp(rsp, Immediate(kDoubleSize)); | |
3640 __ bind(&done); | |
3641 } | 3619 } |
3642 | 3620 |
3643 | 3621 |
3644 void LCodeGen::DoMathClz32(LMathClz32* instr) { | 3622 void LCodeGen::DoMathClz32(LMathClz32* instr) { |
3645 Register input = ToRegister(instr->value()); | 3623 Register input = ToRegister(instr->value()); |
3646 Register result = ToRegister(instr->result()); | 3624 Register result = ToRegister(instr->result()); |
3647 | 3625 |
3648 __ Lzcntl(result, input); | 3626 __ Lzcntl(result, input); |
3649 } | 3627 } |
3650 | 3628 |
(...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5623 __ bind(deferred->exit()); | 5601 __ bind(deferred->exit()); |
5624 __ bind(&done); | 5602 __ bind(&done); |
5625 } | 5603 } |
5626 | 5604 |
5627 #undef __ | 5605 #undef __ |
5628 | 5606 |
5629 } // namespace internal | 5607 } // namespace internal |
5630 } // namespace v8 | 5608 } // namespace v8 |
5631 | 5609 |
5632 #endif // V8_TARGET_ARCH_X64 | 5610 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |