OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 9 #if V8_TARGET_ARCH_ARM |
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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 // for non-constant cases of +/-0.5 as these hardly occur. | 777 // for non-constant cases of +/-0.5 as these hardly occur. |
776 Label not_plus_half; | 778 Label not_plus_half; |
777 | 779 |
778 // Test for 0.5. | 780 // Test for 0.5. |
779 __ vmov(double_scratch, 0.5, scratch); | 781 __ vmov(double_scratch, 0.5, scratch); |
780 __ VFPCompareAndSetFlags(double_exponent, double_scratch); | 782 __ VFPCompareAndSetFlags(double_exponent, double_scratch); |
781 __ b(ne, ¬_plus_half); | 783 __ b(ne, ¬_plus_half); |
782 | 784 |
783 // Calculates square root of base. Check for the special case of | 785 // Calculates square root of base. Check for the special case of |
784 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). | 786 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). |
785 __ vmov(double_scratch, -V8_INFINITY, scratch); | 787 __ vmov(double_scratch, -std::numeric_limits<double>::infinity(), |
| 788 scratch); |
786 __ VFPCompareAndSetFlags(double_base, double_scratch); | 789 __ VFPCompareAndSetFlags(double_base, double_scratch); |
787 __ vneg(double_result, double_scratch, eq); | 790 __ vneg(double_result, double_scratch, eq); |
788 __ b(eq, &done); | 791 __ b(eq, &done); |
789 | 792 |
790 // Add +0 to convert -0 to +0. | 793 // Add +0 to convert -0 to +0. |
791 __ vadd(double_scratch, double_base, kDoubleRegZero); | 794 __ vadd(double_scratch, double_base, kDoubleRegZero); |
792 __ vsqrt(double_result, double_scratch); | 795 __ vsqrt(double_result, double_scratch); |
793 __ jmp(&done); | 796 __ jmp(&done); |
794 | 797 |
795 __ bind(¬_plus_half); | 798 __ bind(¬_plus_half); |
796 __ vmov(double_scratch, -0.5, scratch); | 799 __ vmov(double_scratch, -0.5, scratch); |
797 __ VFPCompareAndSetFlags(double_exponent, double_scratch); | 800 __ VFPCompareAndSetFlags(double_exponent, double_scratch); |
798 __ b(ne, &call_runtime); | 801 __ b(ne, &call_runtime); |
799 | 802 |
800 // Calculates square root of base. Check for the special case of | 803 // Calculates square root of base. Check for the special case of |
801 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). | 804 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). |
802 __ vmov(double_scratch, -V8_INFINITY, scratch); | 805 __ vmov(double_scratch, -std::numeric_limits<double>::infinity(), |
| 806 scratch); |
803 __ VFPCompareAndSetFlags(double_base, double_scratch); | 807 __ VFPCompareAndSetFlags(double_base, double_scratch); |
804 __ vmov(double_result, kDoubleRegZero, eq); | 808 __ vmov(double_result, kDoubleRegZero, eq); |
805 __ b(eq, &done); | 809 __ b(eq, &done); |
806 | 810 |
807 // Add +0 to convert -0 to +0. | 811 // Add +0 to convert -0 to +0. |
808 __ vadd(double_scratch, double_base, kDoubleRegZero); | 812 __ vadd(double_scratch, double_base, kDoubleRegZero); |
809 __ vmov(double_result, 1.0, scratch); | 813 __ vmov(double_result, 1.0, scratch); |
810 __ vsqrt(double_scratch, double_scratch); | 814 __ vsqrt(double_scratch, double_scratch); |
811 __ vdiv(double_result, double_result, double_scratch); | 815 __ vdiv(double_result, double_result, double_scratch); |
812 __ jmp(&done); | 816 __ jmp(&done); |
(...skipping 3941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4754 MemOperand(fp, 6 * kPointerSize), | 4758 MemOperand(fp, 6 * kPointerSize), |
4755 NULL); | 4759 NULL); |
4756 } | 4760 } |
4757 | 4761 |
4758 | 4762 |
4759 #undef __ | 4763 #undef __ |
4760 | 4764 |
4761 } } // namespace v8::internal | 4765 } } // namespace v8::internal |
4762 | 4766 |
4763 #endif // V8_TARGET_ARCH_ARM | 4767 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |