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 3801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3812 | 3812 |
3813 void LCodeGen::DoMathLog(LMathLog* instr) { | 3813 void LCodeGen::DoMathLog(LMathLog* instr) { |
3814 DCHECK(instr->value()->Equals(instr->result())); | 3814 DCHECK(instr->value()->Equals(instr->result())); |
3815 XMMRegister input_reg = ToDoubleRegister(instr->value()); | 3815 XMMRegister input_reg = ToDoubleRegister(instr->value()); |
3816 XMMRegister xmm_scratch = double_scratch0(); | 3816 XMMRegister xmm_scratch = double_scratch0(); |
3817 Label positive, done, zero; | 3817 Label positive, done, zero; |
3818 __ Xorpd(xmm_scratch, xmm_scratch); | 3818 __ Xorpd(xmm_scratch, xmm_scratch); |
3819 __ Ucomisd(input_reg, xmm_scratch); | 3819 __ Ucomisd(input_reg, xmm_scratch); |
3820 __ j(above, &positive, Label::kNear); | 3820 __ j(above, &positive, Label::kNear); |
3821 __ j(not_carry, &zero, Label::kNear); | 3821 __ j(not_carry, &zero, Label::kNear); |
3822 __ pcmpeqd(input_reg, input_reg); | 3822 __ Pcmpeqd(input_reg, input_reg); |
3823 __ jmp(&done, Label::kNear); | 3823 __ jmp(&done, Label::kNear); |
3824 __ bind(&zero); | 3824 __ bind(&zero); |
3825 ExternalReference ninf = | 3825 ExternalReference ninf = |
3826 ExternalReference::address_of_negative_infinity(); | 3826 ExternalReference::address_of_negative_infinity(); |
3827 Operand ninf_operand = masm()->ExternalOperand(ninf); | 3827 Operand ninf_operand = masm()->ExternalOperand(ninf); |
3828 __ Movsd(input_reg, ninf_operand); | 3828 __ Movsd(input_reg, ninf_operand); |
3829 __ jmp(&done, Label::kNear); | 3829 __ jmp(&done, Label::kNear); |
3830 __ bind(&positive); | 3830 __ bind(&positive); |
3831 __ fldln2(); | 3831 __ fldln2(); |
3832 __ subp(rsp, Immediate(kDoubleSize)); | 3832 __ subp(rsp, Immediate(kDoubleSize)); |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4933 } | 4933 } |
4934 __ jmp(&done, Label::kNear); | 4934 __ jmp(&done, Label::kNear); |
4935 | 4935 |
4936 if (can_convert_undefined_to_nan) { | 4936 if (can_convert_undefined_to_nan) { |
4937 __ bind(&convert); | 4937 __ bind(&convert); |
4938 | 4938 |
4939 // Convert undefined (and hole) to NaN. Compute NaN as 0/0. | 4939 // Convert undefined (and hole) to NaN. Compute NaN as 0/0. |
4940 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); | 4940 __ CompareRoot(input_reg, Heap::kUndefinedValueRootIndex); |
4941 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumberUndefined); | 4941 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumberUndefined); |
4942 | 4942 |
4943 __ pcmpeqd(result_reg, result_reg); | 4943 __ Pcmpeqd(result_reg, result_reg); |
4944 __ jmp(&done, Label::kNear); | 4944 __ jmp(&done, Label::kNear); |
4945 } | 4945 } |
4946 } else { | 4946 } else { |
4947 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); | 4947 DCHECK(mode == NUMBER_CANDIDATE_IS_SMI); |
4948 } | 4948 } |
4949 | 4949 |
4950 // Smi to XMM conversion | 4950 // Smi to XMM conversion |
4951 __ bind(&load_smi); | 4951 __ bind(&load_smi); |
4952 __ SmiToInteger32(kScratchRegister, input_reg); | 4952 __ SmiToInteger32(kScratchRegister, input_reg); |
4953 __ Cvtlsi2sd(result_reg, kScratchRegister); | 4953 __ Cvtlsi2sd(result_reg, kScratchRegister); |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5904 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5904 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5905 } | 5905 } |
5906 | 5906 |
5907 | 5907 |
5908 #undef __ | 5908 #undef __ |
5909 | 5909 |
5910 } // namespace internal | 5910 } // namespace internal |
5911 } // namespace v8 | 5911 } // namespace v8 |
5912 | 5912 |
5913 #endif // V8_TARGET_ARCH_X64 | 5913 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |