| 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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 __ vdivsd(result, left, right); | 1880 __ vdivsd(result, left, right); |
| 1881 } else { | 1881 } else { |
| 1882 DCHECK(result.is(left)); | 1882 DCHECK(result.is(left)); |
| 1883 __ divsd(left, right); | 1883 __ divsd(left, right); |
| 1884 } | 1884 } |
| 1885 // Don't delete this mov. It may improve performance on some CPUs, | 1885 // Don't delete this mov. It may improve performance on some CPUs, |
| 1886 // when there is a (v)mulsd depending on the result | 1886 // when there is a (v)mulsd depending on the result |
| 1887 __ Movapd(result, result); | 1887 __ Movapd(result, result); |
| 1888 break; | 1888 break; |
| 1889 case Token::MOD: { | 1889 case Token::MOD: { |
| 1890 XMMRegister xmm_scratch = double_scratch0(); | 1890 DCHECK(left.is(xmm0)); |
| 1891 DCHECK(right.is(xmm1)); |
| 1892 DCHECK(result.is(xmm0)); |
| 1891 __ PrepareCallCFunction(2); | 1893 __ PrepareCallCFunction(2); |
| 1892 __ Movapd(xmm_scratch, left); | |
| 1893 DCHECK(right.is(xmm1)); | |
| 1894 __ CallCFunction( | 1894 __ CallCFunction( |
| 1895 ExternalReference::mod_two_doubles_operation(isolate()), 2); | 1895 ExternalReference::mod_two_doubles_operation(isolate()), 2); |
| 1896 __ Movapd(result, xmm_scratch); | |
| 1897 break; | 1896 break; |
| 1898 } | 1897 } |
| 1899 default: | 1898 default: |
| 1900 UNREACHABLE(); | 1899 UNREACHABLE(); |
| 1901 break; | 1900 break; |
| 1902 } | 1901 } |
| 1903 } | 1902 } |
| 1904 | 1903 |
| 1905 | 1904 |
| 1906 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { | 1905 void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
| (...skipping 2854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4761 __ Set(input_reg, 1); | 4760 __ Set(input_reg, 1); |
| 4762 __ jmp(done); | 4761 __ jmp(done); |
| 4763 | 4762 |
| 4764 __ bind(&check_false); | 4763 __ bind(&check_false); |
| 4765 __ CompareRoot(input_reg, Heap::kFalseValueRootIndex); | 4764 __ CompareRoot(input_reg, Heap::kFalseValueRootIndex); |
| 4766 DeoptimizeIf(not_equal, instr, | 4765 DeoptimizeIf(not_equal, instr, |
| 4767 Deoptimizer::kNotAHeapNumberUndefinedBoolean); | 4766 Deoptimizer::kNotAHeapNumberUndefinedBoolean); |
| 4768 __ Set(input_reg, 0); | 4767 __ Set(input_reg, 0); |
| 4769 } else { | 4768 } else { |
| 4770 XMMRegister scratch = ToDoubleRegister(instr->temp()); | 4769 XMMRegister scratch = ToDoubleRegister(instr->temp()); |
| 4771 DCHECK(!scratch.is(xmm0)); | 4770 DCHECK(!scratch.is(double_scratch0())); |
| 4772 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), | 4771 __ CompareRoot(FieldOperand(input_reg, HeapObject::kMapOffset), |
| 4773 Heap::kHeapNumberMapRootIndex); | 4772 Heap::kHeapNumberMapRootIndex); |
| 4774 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); | 4773 DeoptimizeIf(not_equal, instr, Deoptimizer::kNotAHeapNumber); |
| 4775 __ Movsd(xmm0, FieldOperand(input_reg, HeapNumber::kValueOffset)); | 4774 __ Movsd(double_scratch0(), |
| 4776 __ Cvttsd2si(input_reg, xmm0); | 4775 FieldOperand(input_reg, HeapNumber::kValueOffset)); |
| 4776 __ Cvttsd2si(input_reg, double_scratch0()); |
| 4777 __ Cvtlsi2sd(scratch, input_reg); | 4777 __ Cvtlsi2sd(scratch, input_reg); |
| 4778 __ Ucomisd(xmm0, scratch); | 4778 __ Ucomisd(double_scratch0(), scratch); |
| 4779 DeoptimizeIf(not_equal, instr, Deoptimizer::kLostPrecision); | 4779 DeoptimizeIf(not_equal, instr, Deoptimizer::kLostPrecision); |
| 4780 DeoptimizeIf(parity_even, instr, Deoptimizer::kNaN); | 4780 DeoptimizeIf(parity_even, instr, Deoptimizer::kNaN); |
| 4781 if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) { | 4781 if (instr->hydrogen()->GetMinusZeroMode() == FAIL_ON_MINUS_ZERO) { |
| 4782 __ testl(input_reg, input_reg); | 4782 __ testl(input_reg, input_reg); |
| 4783 __ j(not_zero, done); | 4783 __ j(not_zero, done); |
| 4784 __ Movmskpd(input_reg, xmm0); | 4784 __ Movmskpd(input_reg, double_scratch0()); |
| 4785 __ andl(input_reg, Immediate(1)); | 4785 __ andl(input_reg, Immediate(1)); |
| 4786 DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero); | 4786 DeoptimizeIf(not_zero, instr, Deoptimizer::kMinusZero); |
| 4787 } | 4787 } |
| 4788 } | 4788 } |
| 4789 } | 4789 } |
| 4790 | 4790 |
| 4791 | 4791 |
| 4792 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4792 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
| 4793 class DeferredTaggedToI final : public LDeferredCode { | 4793 class DeferredTaggedToI final : public LDeferredCode { |
| 4794 public: | 4794 public: |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5614 __ bind(deferred->exit()); | 5614 __ bind(deferred->exit()); |
| 5615 __ bind(&done); | 5615 __ bind(&done); |
| 5616 } | 5616 } |
| 5617 | 5617 |
| 5618 #undef __ | 5618 #undef __ |
| 5619 | 5619 |
| 5620 } // namespace internal | 5620 } // namespace internal |
| 5621 } // namespace v8 | 5621 } // namespace v8 |
| 5622 | 5622 |
| 5623 #endif // V8_TARGET_ARCH_X64 | 5623 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |