Backed out changeset f3b11c2b7dbf (bug 933257)
authorTooru Fujisawa <arai_a@mac.com>
Tue, 15 Mar 2016 08:15:09 +0900
changeset 288653 411f737c193b6293fbeaa1e661c52ed85f812372
parent 288652 b65f1f3dae5b913ff4715859cf369f92d5c828c8
child 288654 715c21f88a31cba2fa5b1f7fc65debcf72e1ca95
push id30087
push usercbook@mozilla.com
push dateTue, 15 Mar 2016 09:43:43 +0000
treeherdermozilla-central@5e14887312d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs933257
milestone48.0a1
backs outf3b11c2b7dbff4219c77adbba9b881481d2f7044
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset f3b11c2b7dbf (bug 933257)
config/check_spidermonkey_style.py
js/src/jsmath.cpp
--- a/config/check_spidermonkey_style.py
+++ b/config/check_spidermonkey_style.py
@@ -61,17 +61,16 @@ included_inclnames_to_ignore = set([
     'ffi.h',                    # generated in ctypes/libffi/
     'devtools/sharkctl.h',      # we ignore devtools/ in general
     'devtools/Instruments.h',   # we ignore devtools/ in general
     'double-conversion.h',      # strange MFBT case
     'javascript-trace.h',       # generated in $OBJDIR if HAVE_DTRACE is defined
     'jsautokw.h',               # generated in $OBJDIR
     'jscustomallocator.h',      # provided by embedders;  allowed to be missing
     'js-config.h',              # generated in $OBJDIR
-    'fdlibm.h',                 # fdlibm
     'pratom.h',                 # NSPR
     'prcvar.h',                 # NSPR
     'prerror.h',                # NSPR
     'prinit.h',                 # NSPR
     'prlink.h',                 # NSPR
     'prlock.h',                 # NSPR
     'prprf.h',                  # NSPR
     'prthread.h',               # NSPR
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -17,18 +17,16 @@
 
 #include <algorithm>  // for std::max
 #include <fcntl.h>
 
 #ifdef XP_UNIX
 # include <unistd.h>
 #endif
 
-#include "fdlibm.h"
-
 #ifdef XP_WIN
 # include "jswin.h"
 #endif
 
 #include "jsapi.h"
 #include "jsatom.h"
 #include "jscntxt.h"
 #include "jscompartment.h"
@@ -136,24 +134,24 @@ js::math_abs(JSContext* cx, unsigned arg
 #else
 #define ACOS_IF_OUT_OF_RANGE(x)
 #endif
 
 double
 js::math_acos_impl(MathCache* cache, double x)
 {
     ACOS_IF_OUT_OF_RANGE(x);
-    return cache->lookup(fdlibm::acos, x, MathCache::Acos);
+    return cache->lookup(acos, x, MathCache::Acos);
 }
 
 double
 js::math_acos_uncached(double x)
 {
     ACOS_IF_OUT_OF_RANGE(x);
-    return fdlibm::acos(x);
+    return acos(x);
 }
 
 #undef ACOS_IF_OUT_OF_RANGE
 
 bool
 js::math_acos(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -181,24 +179,24 @@ js::math_acos(JSContext* cx, unsigned ar
 #else
 #define ASIN_IF_OUT_OF_RANGE(x)
 #endif
 
 double
 js::math_asin_impl(MathCache* cache, double x)
 {
     ASIN_IF_OUT_OF_RANGE(x);
-    return cache->lookup(fdlibm::asin, x, MathCache::Asin);
+    return cache->lookup(asin, x, MathCache::Asin);
 }
 
 double
 js::math_asin_uncached(double x)
 {
     ASIN_IF_OUT_OF_RANGE(x);
-    return fdlibm::asin(x);
+    return asin(x);
 }
 
 #undef ASIN_IF_OUT_OF_RANGE
 
 bool
 js::math_asin(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -219,23 +217,23 @@ js::math_asin(JSContext* cx, unsigned ar
     double z = math_asin_impl(mathCache, x);
     args.rval().setDouble(z);
     return true;
 }
 
 double
 js::math_atan_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::atan, x, MathCache::Atan);
+    return cache->lookup(atan, x, MathCache::Atan);
 }
 
 double
 js::math_atan_uncached(double x)
 {
-    return fdlibm::atan(x);
+    return atan(x);
 }
 
 bool
 js::math_atan(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0) {
@@ -278,17 +276,17 @@ js::ecmaAtan2(double y, double x)
 #if defined(SOLARIS) && defined(__GNUC__)
     if (y == 0) {
         if (IsNegativeZero(x))
             return js_copysign(M_PI, y);
         if (x == 0)
             return y;
     }
 #endif
-    return fdlibm::atan2(y, x);
+    return atan2(y, x);
 }
 
 bool
 js::math_atan2_handle(JSContext* cx, HandleValue y, HandleValue x, MutableHandleValue res)
 {
     double dy;
     if (!ToNumber(cx, y, &dy))
         return false;
@@ -312,17 +310,17 @@ js::math_atan2(JSContext* cx, unsigned a
 
 double
 js::math_ceil_impl(double x)
 {
 #ifdef __APPLE__
     if (x < 0 && x > -1.0)
         return js_copysign(0, -1);
 #endif
-    return fdlibm::ceil(x);
+    return ceil(x);
 }
 
 bool
 js::math_ceil_handle(JSContext* cx, HandleValue v, MutableHandleValue res)
 {
     double d;
     if(!ToNumber(cx, v, &d))
         return false;
@@ -366,23 +364,23 @@ js::math_clz32(JSContext* cx, unsigned a
 
     args.rval().setInt32(mozilla::CountLeadingZeroes32(n));
     return true;
 }
 
 double
 js::math_cos_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::cos, x, MathCache::Cos);
+    return cache->lookup(cos, x, MathCache::Cos);
 }
 
 double
 js::math_cos_uncached(double x)
 {
-    return fdlibm::cos(x);
+    return cos(x);
 }
 
 bool
 js::math_cos(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0) {
@@ -414,24 +412,24 @@ js::math_cos(JSContext* cx, unsigned arg
 #else
 #define EXP_IF_OUT_OF_RANGE(x)
 #endif
 
 double
 js::math_exp_impl(MathCache* cache, double x)
 {
     EXP_IF_OUT_OF_RANGE(x);
-    return cache->lookup(fdlibm::exp, x, MathCache::Exp);
+    return cache->lookup(exp, x, MathCache::Exp);
 }
 
 double
 js::math_exp_uncached(double x)
 {
     EXP_IF_OUT_OF_RANGE(x);
-    return fdlibm::exp(x);
+    return exp(x);
 }
 
 #undef EXP_IF_OUT_OF_RANGE
 
 bool
 js::math_exp(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -452,17 +450,17 @@ js::math_exp(JSContext* cx, unsigned arg
     double z = math_exp_impl(mathCache, x);
     args.rval().setNumber(z);
     return true;
 }
 
 double
 js::math_floor_impl(double x)
 {
-    return fdlibm::floor(x);
+    return floor(x);
 }
 
 bool
 js::math_floor_handle(JSContext* cx, HandleValue v, MutableHandleValue r)
 {
     double d;
     if (!ToNumber(cx, v, &d))
         return false;
@@ -556,17 +554,17 @@ js::math_log_impl(MathCache* cache, doub
     LOG_IF_OUT_OF_RANGE(x);
     return cache->lookup(math_log_uncached, x, MathCache::Log);
 }
 
 double
 js::math_log_uncached(double x)
 {
     LOG_IF_OUT_OF_RANGE(x);
-    return fdlibm::log(x);
+    return log(x);
 }
 
 #undef LOG_IF_OUT_OF_RANGE
 
 bool
 js::math_log_handle(JSContext* cx, HandleValue val, MutableHandleValue res)
 {
     double in;
@@ -676,17 +674,17 @@ js::powi(double x, int y)
             if (y < 0) {
                 // Unfortunately, we have to be careful when p has reached
                 // infinity in the computation, because sometimes the higher
                 // internal precision in the pow() implementation would have
                 // given us a finite p. This happens very rarely.
 
                 double result = 1.0 / p;
                 return (result == 0 && IsInfinite(p))
-                       ? fdlibm::pow(x, static_cast<double>(y))  // Avoid pow(double, int).
+                       ? pow(x, static_cast<double>(y))  // Avoid pow(double, int).
                        : result;
             }
 
             return p;
         }
         m *= m;
     }
 }
@@ -714,21 +712,21 @@ js::ecmaPow(double x, double y)
         return 1;
 
     /*
      * Special case for square roots. Note that pow(x, 0.5) != sqrt(x)
      * when x = -0.0, so we have to guard for this.
      */
     if (IsFinite(x) && x != 0.0) {
         if (y == 0.5)
-            return fdlibm::sqrt(x);
+            return sqrt(x);
         if (y == -0.5)
-            return 1.0 / fdlibm::sqrt(x);
+            return 1.0 / sqrt(x);
     }
-    return fdlibm::pow(x, y);
+    return pow(x, y);
 }
 
 bool
 js::math_pow_handle(JSContext* cx, HandleValue base, HandleValue power, MutableHandleValue result)
 {
     double x;
     if (!ToNumber(cx, base, &x))
         return false;
@@ -840,32 +838,32 @@ js::math_round_impl(double x)
     if (NumberIsInt32(x, &ignored))
         return x;
 
     /* Some numbers are so big that adding 0.5 would give the wrong number. */
     if (ExponentComponent(x) >= int_fast16_t(FloatingPoint<double>::kExponentShift))
         return x;
 
     double add = (x >= 0) ? GetBiggestNumberLessThan(0.5) : 0.5;
-    return js_copysign(fdlibm::floor(x + add), x);
+    return js_copysign(floor(x + add), x);
 }
 
 float
 js::math_roundf_impl(float x)
 {
     int32_t ignored;
     if (NumberIsInt32(x, &ignored))
         return x;
 
     /* Some numbers are so big that adding 0.5 would give the wrong number. */
     if (ExponentComponent(x) >= int_fast16_t(FloatingPoint<float>::kExponentShift))
         return x;
 
     float add = (x >= 0) ? GetBiggestNumberLessThan(0.5f) : 0.5f;
-    return js_copysign(fdlibm::floorf(x + add), x);
+    return js_copysign(floorf(x + add), x);
 }
 
 bool /* ES5 15.8.2.15. */
 js::math_round(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0) {
@@ -880,17 +878,23 @@ double
 js::math_sin_impl(MathCache* cache, double x)
 {
     return cache->lookup(math_sin_uncached, x, MathCache::Sin);
 }
 
 double
 js::math_sin_uncached(double x)
 {
-    return fdlibm::sin(x);
+#ifdef _WIN64
+    // Workaround MSVC bug where sin(-0) is +0 instead of -0 on x64 on
+    // CPUs without FMA3 (pre-Haswell). See bug 1076670.
+    if (IsNegativeZero(x))
+        return -0.0;
+#endif
+    return sin(x);
 }
 
 bool
 js::math_sin_handle(JSContext* cx, HandleValue val, MutableHandleValue res)
 {
     double in;
     if (!ToNumber(cx, val, &in))
         return false;
@@ -957,17 +961,17 @@ js::math_sqrt_handle(JSContext* cx, Hand
     double x;
     if (!ToNumber(cx, number, &x))
         return false;
 
     MathCache* mathCache = cx->runtime()->getMathCache(cx);
     if (!mathCache)
         return false;
 
-    double z = mathCache->lookup(fdlibm::sqrt, x, MathCache::Sqrt);
+    double z = mathCache->lookup(sqrt, x, MathCache::Sqrt);
     result.setDouble(z);
     return true;
 }
 
 bool
 js::math_sqrt(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
@@ -978,23 +982,23 @@ js::math_sqrt(JSContext* cx, unsigned ar
     }
 
     return math_sqrt_handle(cx, args[0], args.rval());
 }
 
 double
 js::math_tan_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::tan, x, MathCache::Tan);
+    return cache->lookup(tan, x, MathCache::Tan);
 }
 
 double
 js::math_tan_uncached(double x)
 {
-    return fdlibm::tan(x);
+    return tan(x);
 }
 
 bool
 js::math_tan(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     if (args.length() == 0) {
@@ -1037,23 +1041,23 @@ static bool math_function(JSContext* cx,
     args.rval().setNumber(z);
 
     return true;
 }
 
 double
 js::math_log10_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::log10, x, MathCache::Log10);
+    return cache->lookup(log10, x, MathCache::Log10);
 }
 
 double
 js::math_log10_uncached(double x)
 {
-    return fdlibm::log10(x);
+    return log10(x);
 }
 
 bool
 js::math_log10(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_log10_impl>(cx, argc, vp);
 }
 
@@ -1062,23 +1066,23 @@ double log2(double x)
 {
     return log(x) / M_LN2;
 }
 #endif
 
 double
 js::math_log2_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::log2, x, MathCache::Log2);
+    return cache->lookup(log2, x, MathCache::Log2);
 }
 
 double
 js::math_log2_uncached(double x)
 {
-    return fdlibm::log2(x);
+    return log2(x);
 }
 
 bool
 js::math_log2(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_log2_impl>(cx, argc, vp);
 }
 
@@ -1105,24 +1109,24 @@ double log1p(double x)
 #else
 #define LOG1P_IF_OUT_OF_RANGE(x)
 #endif
 
 double
 js::math_log1p_impl(MathCache* cache, double x)
 {
     LOG1P_IF_OUT_OF_RANGE(x);
-    return cache->lookup(fdlibm::log1p, x, MathCache::Log1p);
+    return cache->lookup(log1p, x, MathCache::Log1p);
 }
 
 double
 js::math_log1p_uncached(double x)
 {
     LOG1P_IF_OUT_OF_RANGE(x);
-    return fdlibm::log1p(x);
+    return log1p(x);
 }
 
 #undef LOG1P_IF_OUT_OF_RANGE
 
 bool
 js::math_log1p(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_log1p_impl>(cx, argc, vp);
@@ -1147,23 +1151,23 @@ double expm1(double x)
         return exp(x) - 1.0;
     }
 }
 #endif
 
 double
 js::math_expm1_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::expm1, x, MathCache::Expm1);
+    return cache->lookup(expm1, x, MathCache::Expm1);
 }
 
 double
 js::math_expm1_uncached(double x)
 {
-    return fdlibm::expm1(x);
+    return expm1(x);
 }
 
 bool
 js::math_expm1(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_expm1_impl>(cx, argc, vp);
 }
 
@@ -1176,59 +1180,59 @@ double sqrt1pm1(double x)
 
     return expm1(log1p(x) / 2);
 }
 #endif
 
 double
 js::math_cosh_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::cosh, x, MathCache::Cosh);
+    return cache->lookup(cosh, x, MathCache::Cosh);
 }
 
 double
 js::math_cosh_uncached(double x)
 {
-    return fdlibm::cosh(x);
+    return cosh(x);
 }
 
 bool
 js::math_cosh(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_cosh_impl>(cx, argc, vp);
 }
 
 double
 js::math_sinh_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::sinh, x, MathCache::Sinh);
+    return cache->lookup(sinh, x, MathCache::Sinh);
 }
 
 double
 js::math_sinh_uncached(double x)
 {
-    return fdlibm::sinh(x);
+    return sinh(x);
 }
 
 bool
 js::math_sinh(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_sinh_impl>(cx, argc, vp);
 }
 
 double
 js::math_tanh_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::tanh, x, MathCache::Tanh);
+    return cache->lookup(tanh, x, MathCache::Tanh);
 }
 
 double
 js::math_tanh_uncached(double x)
 {
-    return fdlibm::tanh(x);
+    return tanh(x);
 }
 
 bool
 js::math_tanh(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_tanh_impl>(cx, argc, vp);
 }
 
@@ -1261,23 +1265,23 @@ double acosh(double x)
         return sqrt(2 * y) * (1 - y / 12 + 3 * y * y / 160);
     }
 }
 #endif
 
 double
 js::math_acosh_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::acosh, x, MathCache::Acosh);
+    return cache->lookup(acosh, x, MathCache::Acosh);
 }
 
 double
 js::math_acosh_uncached(double x)
 {
-    return fdlibm::acosh(x);
+    return acosh(x);
 }
 
 bool
 js::math_acosh(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_acosh_impl>(cx, argc, vp);
 }
 
@@ -1315,27 +1319,27 @@ static double my_asinh(double x)
     }
 }
 #endif
 
 double
 js::math_asinh_impl(MathCache* cache, double x)
 {
 #ifdef HAVE_ASINH
-    return cache->lookup(fdlibm::asinh, x, MathCache::Asinh);
+    return cache->lookup(asinh, x, MathCache::Asinh);
 #else
     return cache->lookup(my_asinh, x, MathCache::Asinh);
 #endif
 }
 
 double
 js::math_asinh_uncached(double x)
 {
 #ifdef HAVE_ASINH
-    return fdlibm::asinh(x);
+    return asinh(x);
 #else
     return my_asinh(x);
 #endif
 }
 
 bool
 js::math_asinh(JSContext* cx, unsigned argc, Value* vp)
 {
@@ -1368,23 +1372,23 @@ double atanh(double x)
         return result;
     }
 }
 #endif
 
 double
 js::math_atanh_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::atanh, x, MathCache::Atanh);
+    return cache->lookup(atanh, x, MathCache::Atanh);
 }
 
 double
 js::math_atanh_uncached(double x)
 {
-    return fdlibm::atanh(x);
+    return atanh(x);
 }
 
 bool
 js::math_atanh(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_atanh_impl>(cx, argc, vp);
 }
 
@@ -1396,17 +1400,17 @@ js::ecmaHypot(double x, double y)
     /*
      * Workaround MS hypot bug, where hypot(Infinity, NaN or Math.MIN_VALUE)
      * is NaN, not Infinity.
      */
     if (mozilla::IsInfinite(x) || mozilla::IsInfinite(y)) {
         return mozilla::PositiveInfinity<double>();
     }
 #endif
-    return fdlibm::hypot(x, y);
+    return hypot(x, y);
 }
 
 static inline
 void
 hypot_step(double& scale, double& sumsq, double x)
 {
     double xabs = mozilla::Abs(x);
     if (scale < xabs) {
@@ -1434,17 +1438,17 @@ js::hypot4(double x, double y, double z,
     double scale = 0;
     double sumsq = 1;
 
     hypot_step(scale, sumsq, x);
     hypot_step(scale, sumsq, y);
     hypot_step(scale, sumsq, z);
     hypot_step(scale, sumsq, w);
 
-    return scale * fdlibm::sqrt(sumsq);
+    return scale * sqrt(sumsq);
 }
 
 double
 js::hypot3(double x, double y, double z)
 {
     return hypot4(x, y, z, 0.0);
 }
 
@@ -1488,31 +1492,31 @@ js::math_hypot_handle(JSContext* cx, Han
         if (isInfinite || isNaN)
             continue;
 
         hypot_step(scale, sumsq, x);
     }
 
     double result = isInfinite ? PositiveInfinity<double>() :
                     isNaN ? GenericNaN() :
-                    scale * fdlibm::sqrt(sumsq);
+                    scale * sqrt(sumsq);
     res.setNumber(result);
     return true;
 }
 
 double
 js::math_trunc_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::trunc, x, MathCache::Trunc);
+    return cache->lookup(trunc, x, MathCache::Trunc);
 }
 
 double
 js::math_trunc_uncached(double x)
 {
-    return fdlibm::trunc(x);
+    return trunc(x);
 }
 
 bool
 js::math_trunc(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_trunc_impl>(cx, argc, vp);
 }
 
@@ -1553,23 +1557,23 @@ double cbrt(double x)
         return -pow(-x, 1.0 / 3.0);
     }
 }
 #endif
 
 double
 js::math_cbrt_impl(MathCache* cache, double x)
 {
-    return cache->lookup(fdlibm::cbrt, x, MathCache::Cbrt);
+    return cache->lookup(cbrt, x, MathCache::Cbrt);
 }
 
 double
 js::math_cbrt_uncached(double x)
 {
-    return fdlibm::cbrt(x);
+    return cbrt(x);
 }
 
 bool
 js::math_cbrt(JSContext* cx, unsigned argc, Value* vp)
 {
     return math_function<math_cbrt_impl>(cx, argc, vp);
 }