Bug 933257 - Part 5: Use fdlibm in jsmath.cpp. r=jwalden

This commit is contained in:
Tooru Fujisawa 2016-01-07 12:30:29 +09:00
Родитель 3779589b28
Коммит 3aedc7a677
2 изменённых файлов: 48 добавлений и 45 удалений

Просмотреть файл

@ -66,6 +66,7 @@ included_inclnames_to_ignore = set([
'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

Просмотреть файл

@ -22,6 +22,8 @@
# include <unistd.h>
#endif
#include "fdlibm.h"
#ifdef XP_WIN
# include "jswin.h"
#endif
@ -139,14 +141,14 @@ double
js::math_acos_impl(MathCache* cache, double x)
{
ACOS_IF_OUT_OF_RANGE(x);
return cache->lookup(acos, x, MathCache::Acos);
return cache->lookup(fdlibm::acos, x, MathCache::Acos);
}
double
js::math_acos_uncached(double x)
{
ACOS_IF_OUT_OF_RANGE(x);
return acos(x);
return fdlibm::acos(x);
}
#undef ACOS_IF_OUT_OF_RANGE
@ -184,14 +186,14 @@ double
js::math_asin_impl(MathCache* cache, double x)
{
ASIN_IF_OUT_OF_RANGE(x);
return cache->lookup(asin, x, MathCache::Asin);
return cache->lookup(fdlibm::asin, x, MathCache::Asin);
}
double
js::math_asin_uncached(double x)
{
ASIN_IF_OUT_OF_RANGE(x);
return asin(x);
return fdlibm::asin(x);
}
#undef ASIN_IF_OUT_OF_RANGE
@ -222,13 +224,13 @@ js::math_asin(JSContext* cx, unsigned argc, Value* vp)
double
js::math_atan_impl(MathCache* cache, double x)
{
return cache->lookup(atan, x, MathCache::Atan);
return cache->lookup(fdlibm::atan, x, MathCache::Atan);
}
double
js::math_atan_uncached(double x)
{
return atan(x);
return fdlibm::atan(x);
}
bool
@ -281,7 +283,7 @@ js::ecmaAtan2(double y, double x)
return y;
}
#endif
return atan2(y, x);
return fdlibm::atan2(y, x);
}
bool
@ -315,7 +317,7 @@ js::math_ceil_impl(double x)
if (x < 0 && x > -1.0)
return js_copysign(0, -1);
#endif
return ceil(x);
return fdlibm::ceil(x);
}
bool
@ -417,14 +419,14 @@ double
js::math_exp_impl(MathCache* cache, double x)
{
EXP_IF_OUT_OF_RANGE(x);
return cache->lookup(exp, x, MathCache::Exp);
return cache->lookup(fdlibm::exp, x, MathCache::Exp);
}
double
js::math_exp_uncached(double x)
{
EXP_IF_OUT_OF_RANGE(x);
return exp(x);
return fdlibm::exp(x);
}
#undef EXP_IF_OUT_OF_RANGE
@ -455,7 +457,7 @@ js::math_exp(JSContext* cx, unsigned argc, Value* vp)
double
js::math_floor_impl(double x)
{
return floor(x);
return fdlibm::floor(x);
}
bool
@ -559,7 +561,7 @@ double
js::math_log_uncached(double x)
{
LOG_IF_OUT_OF_RANGE(x);
return log(x);
return fdlibm::log(x);
}
#undef LOG_IF_OUT_OF_RANGE
@ -843,7 +845,7 @@ js::math_round_impl(double x)
return x;
double add = (x >= 0) ? GetBiggestNumberLessThan(0.5) : 0.5;
return js_copysign(floor(x + add), x);
return js_copysign(fdlibm::floor(x + add), x);
}
float
@ -858,7 +860,7 @@ js::math_roundf_impl(float x)
return x;
float add = (x >= 0) ? GetBiggestNumberLessThan(0.5f) : 0.5f;
return js_copysign(floorf(x + add), x);
return js_copysign(fdlibm::floorf(x + add), x);
}
bool /* ES5 15.8.2.15. */
@ -876,12 +878,6 @@ js::math_round(JSContext* cx, unsigned argc, Value* vp)
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)
{
#ifdef _WIN64
// Workaround MSVC bug where sin(-0) is +0 instead of -0 on x64 on
@ -889,6 +885,12 @@ js::math_sin_uncached(double x)
if (IsNegativeZero(x))
return -0.0;
#endif
return cache->lookup(math_sin_uncached, x, MathCache::Sin);
}
double
js::math_sin_uncached(double x)
{
return sin(x);
}
@ -1046,13 +1048,13 @@ static bool math_function(JSContext* cx, unsigned argc, Value* vp)
double
js::math_log10_impl(MathCache* cache, double x)
{
return cache->lookup(log10, x, MathCache::Log10);
return cache->lookup(fdlibm::log10, x, MathCache::Log10);
}
double
js::math_log10_uncached(double x)
{
return log10(x);
return fdlibm::log10(x);
}
bool
@ -1071,13 +1073,13 @@ double log2(double x)
double
js::math_log2_impl(MathCache* cache, double x)
{
return cache->lookup(log2, x, MathCache::Log2);
return cache->lookup(fdlibm::log2, x, MathCache::Log2);
}
double
js::math_log2_uncached(double x)
{
return log2(x);
return fdlibm::log2(x);
}
bool
@ -1114,14 +1116,14 @@ double
js::math_log1p_impl(MathCache* cache, double x)
{
LOG1P_IF_OUT_OF_RANGE(x);
return cache->lookup(log1p, x, MathCache::Log1p);
return cache->lookup(fdlibm::log1p, x, MathCache::Log1p);
}
double
js::math_log1p_uncached(double x)
{
LOG1P_IF_OUT_OF_RANGE(x);
return log1p(x);
return fdlibm::log1p(x);
}
#undef LOG1P_IF_OUT_OF_RANGE
@ -1156,13 +1158,13 @@ double expm1(double x)
double
js::math_expm1_impl(MathCache* cache, double x)
{
return cache->lookup(expm1, x, MathCache::Expm1);
return cache->lookup(fdlibm::expm1, x, MathCache::Expm1);
}
double
js::math_expm1_uncached(double x)
{
return expm1(x);
return fdlibm::expm1(x);
}
bool
@ -1185,13 +1187,13 @@ double sqrt1pm1(double x)
double
js::math_cosh_impl(MathCache* cache, double x)
{
return cache->lookup(cosh, x, MathCache::Cosh);
return cache->lookup(fdlibm::cosh, x, MathCache::Cosh);
}
double
js::math_cosh_uncached(double x)
{
return cosh(x);
return fdlibm::cosh(x);
}
bool
@ -1203,13 +1205,13 @@ js::math_cosh(JSContext* cx, unsigned argc, Value* vp)
double
js::math_sinh_impl(MathCache* cache, double x)
{
return cache->lookup(sinh, x, MathCache::Sinh);
return cache->lookup(fdlibm::sinh, x, MathCache::Sinh);
}
double
js::math_sinh_uncached(double x)
{
return sinh(x);
return fdlibm::sinh(x);
}
bool
@ -1221,13 +1223,13 @@ js::math_sinh(JSContext* cx, unsigned argc, Value* vp)
double
js::math_tanh_impl(MathCache* cache, double x)
{
return cache->lookup(tanh, x, MathCache::Tanh);
return cache->lookup(fdlibm::tanh, x, MathCache::Tanh);
}
double
js::math_tanh_uncached(double x)
{
return tanh(x);
return fdlibm::tanh(x);
}
bool
@ -1270,13 +1272,13 @@ double acosh(double x)
double
js::math_acosh_impl(MathCache* cache, double x)
{
return cache->lookup(acosh, x, MathCache::Acosh);
return cache->lookup(fdlibm::acosh, x, MathCache::Acosh);
}
double
js::math_acosh_uncached(double x)
{
return acosh(x);
return fdlibm::acosh(x);
}
bool
@ -1324,7 +1326,7 @@ double
js::math_asinh_impl(MathCache* cache, double x)
{
#ifdef HAVE_ASINH
return cache->lookup(asinh, x, MathCache::Asinh);
return cache->lookup(fdlibm::asinh, x, MathCache::Asinh);
#else
return cache->lookup(my_asinh, x, MathCache::Asinh);
#endif
@ -1334,7 +1336,7 @@ double
js::math_asinh_uncached(double x)
{
#ifdef HAVE_ASINH
return asinh(x);
return fdlibm::asinh(x);
#else
return my_asinh(x);
#endif
@ -1377,13 +1379,13 @@ double atanh(double x)
double
js::math_atanh_impl(MathCache* cache, double x)
{
return cache->lookup(atanh, x, MathCache::Atanh);
return cache->lookup(fdlibm::atanh, x, MathCache::Atanh);
}
double
js::math_atanh_uncached(double x)
{
return atanh(x);
return fdlibm::atanh(x);
}
bool
@ -1405,7 +1407,7 @@ js::ecmaHypot(double x, double y)
return mozilla::PositiveInfinity<double>();
}
#endif
return hypot(x, y);
return fdlibm::hypot(x, y);
}
static inline
@ -1505,13 +1507,13 @@ js::math_hypot_handle(JSContext* cx, HandleValueArray args, MutableHandleValue r
double
js::math_trunc_impl(MathCache* cache, double x)
{
return cache->lookup(trunc, x, MathCache::Trunc);
return cache->lookup(fdlibm::trunc, x, MathCache::Trunc);
}
double
js::math_trunc_uncached(double x)
{
return trunc(x);
return fdlibm::trunc(x);
}
bool
@ -1562,13 +1564,13 @@ double cbrt(double x)
double
js::math_cbrt_impl(MathCache* cache, double x)
{
return cache->lookup(cbrt, x, MathCache::Cbrt);
return cache->lookup(fdlibm::cbrt, x, MathCache::Cbrt);
}
double
js::math_cbrt_uncached(double x)
{
return cbrt(x);
return fdlibm::cbrt(x);
}
bool