OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 <limits> |
| 6 |
5 #include "src/v8.h" | 7 #include "src/v8.h" |
6 | 8 |
7 #if V8_TARGET_ARCH_PPC | 9 #if V8_TARGET_ARCH_PPC |
8 | 10 |
9 #include "src/base/bits.h" | 11 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
11 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" |
12 #include "src/codegen.h" | 14 #include "src/codegen.h" |
13 #include "src/ic/handler-compiler.h" | 15 #include "src/ic/handler-compiler.h" |
14 #include "src/ic/ic.h" | 16 #include "src/ic/ic.h" |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // for non-constant cases of +/-0.5 as these hardly occur. | 793 // for non-constant cases of +/-0.5 as these hardly occur. |
792 Label not_plus_half, not_minus_inf1, not_minus_inf2; | 794 Label not_plus_half, not_minus_inf1, not_minus_inf2; |
793 | 795 |
794 // Test for 0.5. | 796 // Test for 0.5. |
795 __ LoadDoubleLiteral(double_scratch, 0.5, scratch); | 797 __ LoadDoubleLiteral(double_scratch, 0.5, scratch); |
796 __ fcmpu(double_exponent, double_scratch); | 798 __ fcmpu(double_exponent, double_scratch); |
797 __ bne(¬_plus_half); | 799 __ bne(¬_plus_half); |
798 | 800 |
799 // Calculates square root of base. Check for the special case of | 801 // Calculates square root of base. Check for the special case of |
800 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). | 802 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). |
801 __ LoadDoubleLiteral(double_scratch, -V8_INFINITY, scratch); | 803 __ LoadDoubleLiteral(double_scratch, |
| 804 -std::numeric_limits<double>::infinity(), scratch); |
802 __ fcmpu(double_base, double_scratch); | 805 __ fcmpu(double_base, double_scratch); |
803 __ bne(¬_minus_inf1); | 806 __ bne(¬_minus_inf1); |
804 __ fneg(double_result, double_scratch); | 807 __ fneg(double_result, double_scratch); |
805 __ b(&done); | 808 __ b(&done); |
806 __ bind(¬_minus_inf1); | 809 __ bind(¬_minus_inf1); |
807 | 810 |
808 // Add +0 to convert -0 to +0. | 811 // Add +0 to convert -0 to +0. |
809 __ fadd(double_scratch, double_base, kDoubleRegZero); | 812 __ fadd(double_scratch, double_base, kDoubleRegZero); |
810 __ fsqrt(double_result, double_scratch); | 813 __ fsqrt(double_result, double_scratch); |
811 __ b(&done); | 814 __ b(&done); |
812 | 815 |
813 __ bind(¬_plus_half); | 816 __ bind(¬_plus_half); |
814 __ LoadDoubleLiteral(double_scratch, -0.5, scratch); | 817 __ LoadDoubleLiteral(double_scratch, -0.5, scratch); |
815 __ fcmpu(double_exponent, double_scratch); | 818 __ fcmpu(double_exponent, double_scratch); |
816 __ bne(&call_runtime); | 819 __ bne(&call_runtime); |
817 | 820 |
818 // Calculates square root of base. Check for the special case of | 821 // Calculates square root of base. Check for the special case of |
819 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). | 822 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). |
820 __ LoadDoubleLiteral(double_scratch, -V8_INFINITY, scratch); | 823 __ LoadDoubleLiteral(double_scratch, |
| 824 -std::numeric_limits<double>::infinity(), scratch); |
821 __ fcmpu(double_base, double_scratch); | 825 __ fcmpu(double_base, double_scratch); |
822 __ bne(¬_minus_inf2); | 826 __ bne(¬_minus_inf2); |
823 __ fmr(double_result, kDoubleRegZero); | 827 __ fmr(double_result, kDoubleRegZero); |
824 __ b(&done); | 828 __ b(&done); |
825 __ bind(¬_minus_inf2); | 829 __ bind(¬_minus_inf2); |
826 | 830 |
827 // Add +0 to convert -0 to +0. | 831 // Add +0 to convert -0 to +0. |
828 __ fadd(double_scratch, double_base, kDoubleRegZero); | 832 __ fadd(double_scratch, double_base, kDoubleRegZero); |
829 __ LoadDoubleLiteral(double_result, 1.0, scratch); | 833 __ LoadDoubleLiteral(double_result, 1.0, scratch); |
830 __ fsqrt(double_scratch, double_scratch); | 834 __ fsqrt(double_scratch, double_scratch); |
(...skipping 4053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4884 kStackUnwindSpace, | 4888 kStackUnwindSpace, |
4885 MemOperand(fp, 6 * kPointerSize), NULL); | 4889 MemOperand(fp, 6 * kPointerSize), NULL); |
4886 } | 4890 } |
4887 | 4891 |
4888 | 4892 |
4889 #undef __ | 4893 #undef __ |
4890 } | 4894 } |
4891 } // namespace v8::internal | 4895 } // namespace v8::internal |
4892 | 4896 |
4893 #endif // V8_TARGET_ARCH_PPC | 4897 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |