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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 m *= m; | 1696 m *= m; |
1697 if ((n & 2) != 0) p *= m; | 1697 if ((n & 2) != 0) p *= m; |
1698 m *= m; | 1698 m *= m; |
1699 n >>= 2; | 1699 n >>= 2; |
1700 } | 1700 } |
1701 return p; | 1701 return p; |
1702 } | 1702 } |
1703 | 1703 |
1704 | 1704 |
1705 double power_double_double(double x, double y) { | 1705 double power_double_double(double x, double y) { |
1706 #if (defined(__MINGW64_VERSION_MAJOR) && \ | |
1707 (!defined(__MINGW64_VERSION_RC) || __MINGW64_VERSION_RC < 1)) || \ | |
1708 defined(V8_OS_AIX) | |
1709 // MinGW64 and AIX have a custom implementation for pow. This handles certain | |
1710 // special cases that are different. | |
1711 if ((x == 0.0 || std::isinf(x)) && y != 0.0 && std::isfinite(y)) { | |
1712 double f; | |
1713 double result = ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0; | |
1714 /* retain sign if odd integer exponent */ | |
1715 return ((std::modf(y, &f) == 0.0) && (static_cast<int64_t>(y) & 1)) | |
1716 ? copysign(result, x) | |
1717 : result; | |
1718 } | |
1719 | |
1720 if (x == 2.0) { | |
1721 int y_int = static_cast<int>(y); | |
1722 if (y == y_int) { | |
1723 return std::ldexp(1.0, y_int); | |
1724 } | |
1725 } | |
1726 #endif | |
1727 | |
1728 // The checks for special cases can be dropped in ia32 because it has already | 1706 // The checks for special cases can be dropped in ia32 because it has already |
1729 // been done in generated code before bailing out here. | 1707 // been done in generated code before bailing out here. |
1730 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { | 1708 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { |
1731 return std::numeric_limits<double>::quiet_NaN(); | 1709 return std::numeric_limits<double>::quiet_NaN(); |
1732 } | 1710 } |
1733 return std::pow(x, y); | 1711 return Pow(x, y); |
1734 } | 1712 } |
1735 | 1713 |
1736 | 1714 |
1737 ExternalReference ExternalReference::power_double_double_function( | 1715 ExternalReference ExternalReference::power_double_double_function( |
1738 Isolate* isolate) { | 1716 Isolate* isolate) { |
1739 return ExternalReference(Redirect(isolate, | 1717 return ExternalReference(Redirect(isolate, |
1740 FUNCTION_ADDR(power_double_double), | 1718 FUNCTION_ADDR(power_double_double), |
1741 BUILTIN_FP_FP_CALL)); | 1719 BUILTIN_FP_FP_CALL)); |
1742 } | 1720 } |
1743 | 1721 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 | 2055 |
2078 | 2056 |
2079 void Assembler::DataAlign(int m) { | 2057 void Assembler::DataAlign(int m) { |
2080 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); | 2058 DCHECK(m >= 2 && base::bits::IsPowerOfTwo32(m)); |
2081 while ((pc_offset() & (m - 1)) != 0) { | 2059 while ((pc_offset() & (m - 1)) != 0) { |
2082 db(0); | 2060 db(0); |
2083 } | 2061 } |
2084 } | 2062 } |
2085 } // namespace internal | 2063 } // namespace internal |
2086 } // namespace v8 | 2064 } // namespace v8 |
OLD | NEW |