OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 static double div_two_doubles(double x, double y) { | 809 static double div_two_doubles(double x, double y) { |
810 return x / y; | 810 return x / y; |
811 } | 811 } |
812 | 812 |
813 | 813 |
814 static double mod_two_doubles(double x, double y) { | 814 static double mod_two_doubles(double x, double y) { |
815 return modulo(x, y); | 815 return modulo(x, y); |
816 } | 816 } |
817 | 817 |
818 | 818 |
| 819 static double math_sin_double(double x) { |
| 820 return sin(x); |
| 821 } |
| 822 |
| 823 |
| 824 static double math_cos_double(double x) { |
| 825 return cos(x); |
| 826 } |
| 827 |
| 828 |
| 829 static double math_log_double(double x) { |
| 830 return log(x); |
| 831 } |
| 832 |
| 833 |
| 834 ExternalReference ExternalReference::math_sin_double_function() { |
| 835 return ExternalReference(Redirect(FUNCTION_ADDR(math_sin_double), |
| 836 FP_RETURN_CALL)); |
| 837 } |
| 838 |
| 839 |
| 840 ExternalReference ExternalReference::math_cos_double_function() { |
| 841 return ExternalReference(Redirect(FUNCTION_ADDR(math_cos_double), |
| 842 FP_RETURN_CALL)); |
| 843 } |
| 844 |
| 845 |
| 846 ExternalReference ExternalReference::math_log_double_function() { |
| 847 return ExternalReference(Redirect(FUNCTION_ADDR(math_log_double), |
| 848 FP_RETURN_CALL)); |
| 849 } |
| 850 |
| 851 |
819 // Helper function to compute x^y, where y is known to be an | 852 // Helper function to compute x^y, where y is known to be an |
820 // integer. Uses binary decomposition to limit the number of | 853 // integer. Uses binary decomposition to limit the number of |
821 // multiplications; see the discussion in "Hacker's Delight" by Henry | 854 // multiplications; see the discussion in "Hacker's Delight" by Henry |
822 // S. Warren, Jr., figure 11-6, page 213. | 855 // S. Warren, Jr., figure 11-6, page 213. |
823 double power_double_int(double x, int y) { | 856 double power_double_int(double x, int y) { |
824 double m = (y < 0) ? 1 / x : x; | 857 double m = (y < 0) ? 1 / x : x; |
825 unsigned n = (y < 0) ? -y : y; | 858 unsigned n = (y < 0) ? -y : y; |
826 double p = 1; | 859 double p = 1; |
827 while (n != 0) { | 860 while (n != 0) { |
828 if ((n & 1) != 0) p *= m; | 861 if ((n & 1) != 0) p *= m; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 997 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
965 state_.written_position = state_.current_position; | 998 state_.written_position = state_.current_position; |
966 written = true; | 999 written = true; |
967 } | 1000 } |
968 | 1001 |
969 // Return whether something was written. | 1002 // Return whether something was written. |
970 return written; | 1003 return written; |
971 } | 1004 } |
972 | 1005 |
973 } } // namespace v8::internal | 1006 } } // namespace v8::internal |
OLD | NEW |