| 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 "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 scratch2, | 837 scratch2, |
| 838 kCheckForInexactConversion); | 838 kCheckForInexactConversion); |
| 839 // scratch2 == 0 means there was no conversion error. | 839 // scratch2 == 0 means there was no conversion error. |
| 840 __ Branch(&int_exponent_convert, eq, scratch2, Operand(zero_reg)); | 840 __ Branch(&int_exponent_convert, eq, scratch2, Operand(zero_reg)); |
| 841 | 841 |
| 842 if (exponent_type() == ON_STACK) { | 842 if (exponent_type() == ON_STACK) { |
| 843 // Detect square root case. Crankshaft detects constant +/-0.5 at | 843 // Detect square root case. Crankshaft detects constant +/-0.5 at |
| 844 // compile time and uses DoMathPowHalf instead. We then skip this check | 844 // compile time and uses DoMathPowHalf instead. We then skip this check |
| 845 // for non-constant cases of +/-0.5 as these hardly occur. | 845 // for non-constant cases of +/-0.5 as these hardly occur. |
| 846 Label not_plus_half; | 846 Label not_plus_half; |
| 847 | |
| 848 // Test for 0.5. | 847 // Test for 0.5. |
| 849 __ Move(double_scratch, 0.5); | 848 __ Move(double_scratch, 0.5); |
| 850 __ BranchF(USE_DELAY_SLOT, | 849 __ BranchF(USE_DELAY_SLOT, |
| 851 ¬_plus_half, | 850 ¬_plus_half, |
| 852 NULL, | 851 NULL, |
| 853 ne, | 852 ne, |
| 854 double_exponent, | 853 double_exponent, |
| 855 double_scratch); | 854 double_scratch); |
| 856 // double_scratch can be overwritten in the delay slot. | 855 // double_scratch can be overwritten in the delay slot. |
| 857 // Calculates square root of base. Check for the special case of | 856 // Calculates square root of base. Check for the special case of |
| 858 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). | 857 // Math.pow(-Infinity, 0.5) == Infinity (ECMA spec, 15.8.2.13). |
| 859 __ Move(double_scratch, -V8_INFINITY); | 858 __ Move(double_scratch, static_cast<double>(-V8_INFINITY)); |
| 860 __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch); | 859 __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch); |
| 861 __ neg_d(double_result, double_scratch); | 860 __ neg_d(double_result, double_scratch); |
| 862 | 861 |
| 863 // Add +0 to convert -0 to +0. | 862 // Add +0 to convert -0 to +0. |
| 864 __ add_d(double_scratch, double_base, kDoubleRegZero); | 863 __ add_d(double_scratch, double_base, kDoubleRegZero); |
| 865 __ sqrt_d(double_result, double_scratch); | 864 __ sqrt_d(double_result, double_scratch); |
| 866 __ jmp(&done); | 865 __ jmp(&done); |
| 867 | 866 |
| 868 __ bind(¬_plus_half); | 867 __ bind(¬_plus_half); |
| 869 __ Move(double_scratch, -0.5); | 868 __ Move(double_scratch, -0.5); |
| 870 __ BranchF(USE_DELAY_SLOT, | 869 __ BranchF(USE_DELAY_SLOT, |
| 871 &call_runtime, | 870 &call_runtime, |
| 872 NULL, | 871 NULL, |
| 873 ne, | 872 ne, |
| 874 double_exponent, | 873 double_exponent, |
| 875 double_scratch); | 874 double_scratch); |
| 876 // double_scratch can be overwritten in the delay slot. | 875 // double_scratch can be overwritten in the delay slot. |
| 877 // Calculates square root of base. Check for the special case of | 876 // Calculates square root of base. Check for the special case of |
| 878 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). | 877 // Math.pow(-Infinity, -0.5) == 0 (ECMA spec, 15.8.2.13). |
| 879 __ Move(double_scratch, -V8_INFINITY); | 878 __ Move(double_scratch, static_cast<double>(-V8_INFINITY)); |
| 880 __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch); | 879 __ BranchF(USE_DELAY_SLOT, &done, NULL, eq, double_base, double_scratch); |
| 881 __ Move(double_result, kDoubleRegZero); | 880 __ Move(double_result, kDoubleRegZero); |
| 882 | 881 |
| 883 // Add +0 to convert -0 to +0. | 882 // Add +0 to convert -0 to +0. |
| 884 __ add_d(double_scratch, double_base, kDoubleRegZero); | 883 __ add_d(double_scratch, double_base, kDoubleRegZero); |
| 885 __ Move(double_result, 1.); | 884 __ Move(double_result, 1.); |
| 886 __ sqrt_d(double_scratch, double_scratch); | 885 __ sqrt_d(double_scratch, double_scratch); |
| 887 __ div_d(double_result, double_result, double_scratch); | 886 __ div_d(double_result, double_result, double_scratch); |
| 888 __ jmp(&done); | 887 __ jmp(&done); |
| 889 } | 888 } |
| (...skipping 4042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4932 MemOperand(fp, 6 * kPointerSize), | 4931 MemOperand(fp, 6 * kPointerSize), |
| 4933 NULL); | 4932 NULL); |
| 4934 } | 4933 } |
| 4935 | 4934 |
| 4936 | 4935 |
| 4937 #undef __ | 4936 #undef __ |
| 4938 | 4937 |
| 4939 } } // namespace v8::internal | 4938 } } // namespace v8::internal |
| 4940 | 4939 |
| 4941 #endif // V8_TARGET_ARCH_MIPS | 4940 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |