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