| 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 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
| 6 | 6 |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 __ fld_d(MemOperand(eax, 0)); | 759 __ fld_d(MemOperand(eax, 0)); |
| 760 __ fstp_d(Operand(esp, 1 * kDoubleSize)); | 760 __ fstp_d(Operand(esp, 1 * kDoubleSize)); |
| 761 __ fld_d(MemOperand(eax, kDoubleSize)); | 761 __ fld_d(MemOperand(eax, kDoubleSize)); |
| 762 __ fstp_d(Operand(esp, 0)); | 762 __ fstp_d(Operand(esp, 0)); |
| 763 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), | 763 __ CallCFunction(ExternalReference::mod_two_doubles_operation(isolate()), |
| 764 4); | 764 4); |
| 765 __ lea(esp, Operand(esp, 2 * kDoubleSize)); | 765 __ lea(esp, Operand(esp, 2 * kDoubleSize)); |
| 766 break; | 766 break; |
| 767 } | 767 } |
| 768 case kX87Float64Max: { | 768 case kX87Float64Max: { |
| 769 Label check_nan_left, check_zero, return_left, return_right; | 769 Label check_zero, return_left, return_right; |
| 770 Condition condition = below; | 770 Condition condition = below; |
| 771 __ fstp(0); | 771 __ fstp(0); |
| 772 __ fld_d(MemOperand(esp, kDoubleSize)); | 772 __ fld_d(MemOperand(esp, kDoubleSize)); |
| 773 __ fld_d(MemOperand(esp, 0)); | 773 __ fld_d(MemOperand(esp, 0)); |
| 774 __ fld(1); | 774 __ fld(1); |
| 775 __ fld(1); | 775 __ fld(1); |
| 776 __ FCmp(); | 776 __ FCmp(); |
| 777 __ j(parity_even, &check_nan_left, Label::kNear); // At least one NaN. | 777 __ j(parity_even, &return_right, |
| 778 __ j(equal, &check_zero, Label::kNear); // left == right. | 778 Label::kNear); // At least one NaN, Return right. |
| 779 __ j(equal, &check_zero, Label::kNear); // left == right. |
| 779 __ j(condition, &return_left, Label::kNear); | 780 __ j(condition, &return_left, Label::kNear); |
| 780 __ jmp(&return_right, Label::kNear); | 781 __ jmp(&return_right, Label::kNear); |
| 781 | 782 |
| 782 __ bind(&check_zero); | 783 __ bind(&check_zero); |
| 783 __ fld(0); | 784 __ fld(0); |
| 784 __ fldz(); | 785 __ fldz(); |
| 785 __ FCmp(); | 786 __ FCmp(); |
| 786 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. | 787 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. |
| 787 | 788 |
| 788 __ fadd(1); | |
| 789 __ jmp(&return_left, Label::kNear); | |
| 790 | |
| 791 __ bind(&check_nan_left); | |
| 792 __ fld(0); | |
| 793 __ fld(0); | |
| 794 __ FCmp(); // NaN check. | |
| 795 __ j(parity_even, &return_left, Label::kNear); // left == NaN. | |
| 796 | |
| 797 __ bind(&return_right); | 789 __ bind(&return_right); |
| 798 __ fxch(); | 790 __ fxch(); |
| 799 | 791 |
| 800 __ bind(&return_left); | 792 __ bind(&return_left); |
| 801 __ fstp(0); | 793 __ fstp(0); |
| 802 __ lea(esp, Operand(esp, 2 * kDoubleSize)); | 794 __ lea(esp, Operand(esp, 2 * kDoubleSize)); |
| 803 break; | 795 break; |
| 804 } | 796 } |
| 805 case kX87Float64Min: { | 797 case kX87Float64Min: { |
| 806 Label check_nan_left, check_zero, return_left, return_right; | 798 Label check_zero, return_left, return_right; |
| 807 Condition condition = above; | 799 Condition condition = above; |
| 808 __ fstp(0); | 800 __ fstp(0); |
| 809 __ fld_d(MemOperand(esp, kDoubleSize)); | 801 __ fld_d(MemOperand(esp, kDoubleSize)); |
| 810 __ fld_d(MemOperand(esp, 0)); | 802 __ fld_d(MemOperand(esp, 0)); |
| 811 __ fld(1); | 803 __ fld(1); |
| 812 __ fld(1); | 804 __ fld(1); |
| 813 __ FCmp(); | 805 __ FCmp(); |
| 814 __ j(parity_even, &check_nan_left, Label::kNear); // At least one NaN. | 806 __ j(parity_even, &return_right, |
| 815 __ j(equal, &check_zero, Label::kNear); // left == right. | 807 Label::kNear); // At least one NaN, return right value. |
| 808 __ j(equal, &check_zero, Label::kNear); // left == right. |
| 816 __ j(condition, &return_left, Label::kNear); | 809 __ j(condition, &return_left, Label::kNear); |
| 817 __ jmp(&return_right, Label::kNear); | 810 __ jmp(&return_right, Label::kNear); |
| 818 | 811 |
| 819 __ bind(&check_zero); | 812 __ bind(&check_zero); |
| 820 __ fld(0); | 813 __ fld(0); |
| 821 __ fldz(); | 814 __ fldz(); |
| 822 __ FCmp(); | 815 __ FCmp(); |
| 823 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. | 816 __ j(not_equal, &return_left, Label::kNear); // left == right != 0. |
| 824 // At this point, both left and right are either 0 or -0. | |
| 825 // Push st0 and st1 to stack, then pop them to temp registers and OR them, | |
| 826 // load it to left. | |
| 827 __ push(eax); | |
| 828 __ fld(1); | |
| 829 __ fld(1); | |
| 830 __ sub(esp, Immediate(2 * kPointerSize)); | |
| 831 __ fstp_s(MemOperand(esp, 0)); | |
| 832 __ fstp_s(MemOperand(esp, kPointerSize)); | |
| 833 __ pop(eax); | |
| 834 __ xor_(MemOperand(esp, 0), eax); | |
| 835 __ fstp(0); | |
| 836 __ fld_s(MemOperand(esp, 0)); | |
| 837 __ pop(eax); // restore esp | |
| 838 __ pop(eax); // restore esp | |
| 839 __ jmp(&return_left, Label::kNear); | |
| 840 | |
| 841 __ bind(&check_nan_left); | |
| 842 __ fld(0); | |
| 843 __ fld(0); | |
| 844 __ FCmp(); // NaN check. | |
| 845 __ j(parity_even, &return_left, Label::kNear); // left == NaN. | |
| 846 | 817 |
| 847 __ bind(&return_right); | 818 __ bind(&return_right); |
| 848 __ fxch(); | 819 __ fxch(); |
| 849 | 820 |
| 850 __ bind(&return_left); | 821 __ bind(&return_left); |
| 851 __ fstp(0); | 822 __ fstp(0); |
| 852 __ lea(esp, Operand(esp, 2 * kDoubleSize)); | 823 __ lea(esp, Operand(esp, 2 * kDoubleSize)); |
| 853 break; | 824 break; |
| 854 } | 825 } |
| 855 case kX87Float64Abs: { | 826 case kX87Float64Abs: { |
| (...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 __ Nop(padding_size); | 1817 __ Nop(padding_size); |
| 1847 } | 1818 } |
| 1848 } | 1819 } |
| 1849 } | 1820 } |
| 1850 | 1821 |
| 1851 #undef __ | 1822 #undef __ |
| 1852 | 1823 |
| 1853 } // namespace compiler | 1824 } // namespace compiler |
| 1854 } // namespace internal | 1825 } // namespace internal |
| 1855 } // namespace v8 | 1826 } // namespace v8 |
| OLD | NEW |