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