[builtins] Unify Atanh, Cbrt and Expm1 as exports from flibm.
BUG=v8:5103 Review-Url: https://codereview.chromium.org/2068743002 Cr-Commit-Position: refs/heads/master@{#37058}
This commit is contained in:
parent
5c5f5c0835
commit
4d4eb61111
@ -1568,6 +1568,11 @@ ExternalReference ExternalReference::ieee754_atan2_function(Isolate* isolate) {
|
||||
isolate, FUNCTION_ADDR(base::ieee754::atan2), BUILTIN_FP_FP_CALL));
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::ieee754_atanh_function(Isolate* isolate) {
|
||||
return ExternalReference(Redirect(
|
||||
isolate, FUNCTION_ADDR(base::ieee754::atanh), BUILTIN_FP_FP_CALL));
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::ieee754_exp_function(Isolate* isolate) {
|
||||
return ExternalReference(
|
||||
Redirect(isolate, FUNCTION_ADDR(base::ieee754::exp), BUILTIN_FP_CALL));
|
||||
@ -1593,6 +1598,16 @@ ExternalReference ExternalReference::ieee754_log10_function(Isolate* isolate) {
|
||||
Redirect(isolate, FUNCTION_ADDR(base::ieee754::log10), BUILTIN_FP_CALL));
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::ieee754_cbrt_function(Isolate* isolate) {
|
||||
return ExternalReference(Redirect(isolate, FUNCTION_ADDR(base::ieee754::cbrt),
|
||||
BUILTIN_FP_FP_CALL));
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::ieee754_expm1_function(Isolate* isolate) {
|
||||
return ExternalReference(Redirect(
|
||||
isolate, FUNCTION_ADDR(base::ieee754::expm1), BUILTIN_FP_FP_CALL));
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::page_flags(Page* page) {
|
||||
return ExternalReference(reinterpret_cast<Address>(page) +
|
||||
MemoryChunk::kFlagsOffset);
|
||||
|
@ -1047,6 +1047,12 @@ class ExternalReference BASE_EMBEDDED {
|
||||
static ExternalReference ieee754_log1p_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_log2_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_log10_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_atanh_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_cbrt_function(Isolate* isolate);
|
||||
static ExternalReference ieee754_expm1_function(Isolate* isolate);
|
||||
|
||||
static ExternalReference math_exp_constants(int constant_index);
|
||||
static ExternalReference math_exp_log_table();
|
||||
|
||||
static ExternalReference page_flags(Page* page);
|
||||
|
||||
|
@ -538,6 +538,49 @@ double exp(double x) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Method :
|
||||
* 1.Reduced x to positive by atanh(-x) = -atanh(x)
|
||||
* 2.For x>=0.5
|
||||
* 1 2x x
|
||||
* atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
|
||||
* 2 1 - x 1 - x
|
||||
*
|
||||
* For x<0.5
|
||||
* atanh(x) = 0.5*log1p(2x+2x*x/(1-x))
|
||||
*
|
||||
* Special cases:
|
||||
* atanh(x) is NaN if |x| > 1 with signal;
|
||||
* atanh(NaN) is that NaN with no signal;
|
||||
* atanh(+-1) is +-INF with signal.
|
||||
*
|
||||
*/
|
||||
double atanh(double x) {
|
||||
static const double one = 1.0, huge = 1e300;
|
||||
static const double zero = 0.0;
|
||||
|
||||
double t;
|
||||
int32_t hx, ix;
|
||||
u_int32_t lx;
|
||||
EXTRACT_WORDS(hx, lx, x);
|
||||
ix = hx & 0x7fffffff;
|
||||
if ((ix | ((lx | -static_cast<int32_t>(lx)) >> 31)) > 0x3ff00000) /* |x|>1 */
|
||||
return (x - x) / (x - x);
|
||||
if (ix == 0x3ff00000) return x / zero;
|
||||
if (ix < 0x3e300000 && (huge + x) > zero) return x; /* x<2**-28 */
|
||||
SET_HIGH_WORD(x, ix);
|
||||
if (ix < 0x3fe00000) { /* x < 0.5 */
|
||||
t = x + x;
|
||||
t = 0.5 * log1p(t + t * x / (one - x));
|
||||
} else {
|
||||
t = 0.5 * log1p((x + x) / (one - x));
|
||||
}
|
||||
if (hx >= 0)
|
||||
return t;
|
||||
else
|
||||
return -t;
|
||||
}
|
||||
|
||||
/* log(x)
|
||||
* Return the logrithm of x
|
||||
*
|
||||
@ -831,88 +874,6 @@ double log1p(double x) {
|
||||
return k * ln2_hi - ((hfsq - (s * (hfsq + R) + (k * ln2_lo + c))) - f);
|
||||
}
|
||||
|
||||
/*
|
||||
* k_log1p(f):
|
||||
* Return log(1+f) - f for 1+f in ~[sqrt(2)/2, sqrt(2)].
|
||||
*
|
||||
* The following describes the overall strategy for computing
|
||||
* logarithms in base e. The argument reduction and adding the final
|
||||
* term of the polynomial are done by the caller for increased accuracy
|
||||
* when different bases are used.
|
||||
*
|
||||
* Method :
|
||||
* 1. Argument Reduction: find k and f such that
|
||||
* x = 2^k * (1+f),
|
||||
* where sqrt(2)/2 < 1+f < sqrt(2) .
|
||||
*
|
||||
* 2. Approximation of log(1+f).
|
||||
* Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)
|
||||
* = 2s + 2/3 s**3 + 2/5 s**5 + .....,
|
||||
* = 2s + s*R
|
||||
* We use a special Reme algorithm on [0,0.1716] to generate
|
||||
* a polynomial of degree 14 to approximate R The maximum error
|
||||
* of this polynomial approximation is bounded by 2**-58.45. In
|
||||
* other words,
|
||||
* 2 4 6 8 10 12 14
|
||||
* R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s +Lg6*s +Lg7*s
|
||||
* (the values of Lg1 to Lg7 are listed in the program)
|
||||
* and
|
||||
* | 2 14 | -58.45
|
||||
* | Lg1*s +...+Lg7*s - R(z) | <= 2
|
||||
* | |
|
||||
* Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.
|
||||
* In order to guarantee error in log below 1ulp, we compute log
|
||||
* by
|
||||
* log(1+f) = f - s*(f - R) (if f is not too large)
|
||||
* log(1+f) = f - (hfsq - s*(hfsq+R)). (better accuracy)
|
||||
*
|
||||
* 3. Finally, log(x) = k*ln2 + log(1+f).
|
||||
* = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))
|
||||
* Here ln2 is split into two floating point number:
|
||||
* ln2_hi + ln2_lo,
|
||||
* where n*ln2_hi is always exact for |n| < 2000.
|
||||
*
|
||||
* Special cases:
|
||||
* log(x) is NaN with signal if x < 0 (including -INF) ;
|
||||
* log(+INF) is +INF; log(0) is -INF with signal;
|
||||
* log(NaN) is that NaN with no signal.
|
||||
*
|
||||
* Accuracy:
|
||||
* according to an error analysis, the error is always less than
|
||||
* 1 ulp (unit in the last place).
|
||||
*
|
||||
* Constants:
|
||||
* The hexadecimal values are the intended ones for the following
|
||||
* constants. The decimal values may be used, provided that the
|
||||
* compiler will convert from decimal to binary accurately enough
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
static const double Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */
|
||||
Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */
|
||||
Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */
|
||||
Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */
|
||||
Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */
|
||||
Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */
|
||||
Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
|
||||
|
||||
/*
|
||||
* We always inline k_log1p(), since doing so produces a
|
||||
* substantial performance improvement (~40% on amd64).
|
||||
*/
|
||||
static inline double k_log1p(double f) {
|
||||
double hfsq, s, z, R, w, t1, t2;
|
||||
|
||||
s = f / (2.0 + f);
|
||||
z = s * s;
|
||||
w = z * z;
|
||||
t1 = w * (Lg2 + w * (Lg4 + w * Lg6));
|
||||
t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7)));
|
||||
R = t2 + t1;
|
||||
hfsq = 0.5 * f * f;
|
||||
return s * (hfsq + R);
|
||||
}
|
||||
|
||||
// ES6 draft 09-27-13, section 20.2.2.22.
|
||||
// Return the base 2 logarithm of x
|
||||
//
|
||||
@ -1026,72 +987,6 @@ double log2(double x) {
|
||||
return t1 + t2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the base 10 logarithm of x. See e_log.c and k_log.h for most
|
||||
* comments.
|
||||
*
|
||||
* log10(x) = (f - 0.5*f*f + k_log1p(f)) / ln10 + k * log10(2)
|
||||
* in not-quite-routine extra precision.
|
||||
*/
|
||||
double log10Old(double x) {
|
||||
static const double
|
||||
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
|
||||
ivln10hi = 4.34294481878168880939e-01, /* 0x3fdbcb7b, 0x15200000 */
|
||||
ivln10lo = 2.50829467116452752298e-11, /* 0x3dbb9438, 0xca9aadd5 */
|
||||
log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */
|
||||
log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
|
||||
|
||||
static const double zero = 0.0;
|
||||
static volatile double vzero = 0.0;
|
||||
|
||||
double f, hfsq, hi, lo, r, val_hi, val_lo, w, y, y2;
|
||||
int32_t i, k, hx;
|
||||
u_int32_t lx;
|
||||
|
||||
EXTRACT_WORDS(hx, lx, x);
|
||||
|
||||
k = 0;
|
||||
if (hx < 0x00100000) { /* x < 2**-1022 */
|
||||
if (((hx & 0x7fffffff) | lx) == 0)
|
||||
return -two54 / vzero; /* log(+-0)=-inf */
|
||||
if (hx < 0) return (x - x) / zero; /* log(-#) = NaN */
|
||||
k -= 54;
|
||||
x *= two54; /* subnormal number, scale up x */
|
||||
GET_HIGH_WORD(hx, x);
|
||||
}
|
||||
if (hx >= 0x7ff00000) return x + x;
|
||||
if (hx == 0x3ff00000 && lx == 0) return zero; /* log(1) = +0 */
|
||||
k += (hx >> 20) - 1023;
|
||||
hx &= 0x000fffff;
|
||||
i = (hx + 0x95f64) & 0x100000;
|
||||
SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */
|
||||
k += (i >> 20);
|
||||
y = static_cast<double>(k);
|
||||
f = x - 1.0;
|
||||
hfsq = 0.5 * f * f;
|
||||
r = k_log1p(f);
|
||||
|
||||
/* See e_log2.c for most details. */
|
||||
hi = f - hfsq;
|
||||
SET_LOW_WORD(hi, 0);
|
||||
lo = (f - hi) - hfsq + r;
|
||||
val_hi = hi * ivln10hi;
|
||||
y2 = y * log10_2hi;
|
||||
val_lo = y * log10_2lo + (lo + hi) * ivln10lo + lo * ivln10hi;
|
||||
|
||||
/*
|
||||
* Extra precision in for adding y*log10_2hi is not strictly needed
|
||||
* since there is no very large cancellation near x = sqrt(2) or
|
||||
* x = 1/sqrt(2), but we do it anyway since it costs little on CPUs
|
||||
* with some parallelism and it reduces the error for many args.
|
||||
*/
|
||||
w = y2 + val_hi;
|
||||
val_lo += (y2 - w) + val_hi;
|
||||
val_hi = w;
|
||||
|
||||
return val_lo + val_hi;
|
||||
}
|
||||
|
||||
double log10(double x) {
|
||||
static const double
|
||||
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
|
||||
@ -1132,6 +1027,305 @@ double log10(double x) {
|
||||
return z + y * log10_2hi;
|
||||
}
|
||||
|
||||
/* expm1(x)
|
||||
* Returns exp(x)-1, the exponential of x minus 1.
|
||||
*
|
||||
* Method
|
||||
* 1. Argument reduction:
|
||||
* Given x, find r and integer k such that
|
||||
*
|
||||
* x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658
|
||||
*
|
||||
* Here a correction term c will be computed to compensate
|
||||
* the error in r when rounded to a floating-point number.
|
||||
*
|
||||
* 2. Approximating expm1(r) by a special rational function on
|
||||
* the interval [0,0.34658]:
|
||||
* Since
|
||||
* r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ...
|
||||
* we define R1(r*r) by
|
||||
* r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r)
|
||||
* That is,
|
||||
* R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
|
||||
* = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
|
||||
* = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
|
||||
* We use a special Reme algorithm on [0,0.347] to generate
|
||||
* a polynomial of degree 5 in r*r to approximate R1. The
|
||||
* maximum error of this polynomial approximation is bounded
|
||||
* by 2**-61. In other words,
|
||||
* R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
|
||||
* where Q1 = -1.6666666666666567384E-2,
|
||||
* Q2 = 3.9682539681370365873E-4,
|
||||
* Q3 = -9.9206344733435987357E-6,
|
||||
* Q4 = 2.5051361420808517002E-7,
|
||||
* Q5 = -6.2843505682382617102E-9;
|
||||
* z = r*r,
|
||||
* with error bounded by
|
||||
* | 5 | -61
|
||||
* | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2
|
||||
* | |
|
||||
*
|
||||
* expm1(r) = exp(r)-1 is then computed by the following
|
||||
* specific way which minimize the accumulation rounding error:
|
||||
* 2 3
|
||||
* r r [ 3 - (R1 + R1*r/2) ]
|
||||
* expm1(r) = r + --- + --- * [--------------------]
|
||||
* 2 2 [ 6 - r*(3 - R1*r/2) ]
|
||||
*
|
||||
* To compensate the error in the argument reduction, we use
|
||||
* expm1(r+c) = expm1(r) + c + expm1(r)*c
|
||||
* ~ expm1(r) + c + r*c
|
||||
* Thus c+r*c will be added in as the correction terms for
|
||||
* expm1(r+c). Now rearrange the term to avoid optimization
|
||||
* screw up:
|
||||
* ( 2 2 )
|
||||
* ({ ( r [ R1 - (3 - R1*r/2) ] ) } r )
|
||||
* expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
|
||||
* ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 )
|
||||
* ( )
|
||||
*
|
||||
* = r - E
|
||||
* 3. Scale back to obtain expm1(x):
|
||||
* From step 1, we have
|
||||
* expm1(x) = either 2^k*[expm1(r)+1] - 1
|
||||
* = or 2^k*[expm1(r) + (1-2^-k)]
|
||||
* 4. Implementation notes:
|
||||
* (A). To save one multiplication, we scale the coefficient Qi
|
||||
* to Qi*2^i, and replace z by (x^2)/2.
|
||||
* (B). To achieve maximum accuracy, we compute expm1(x) by
|
||||
* (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
|
||||
* (ii) if k=0, return r-E
|
||||
* (iii) if k=-1, return 0.5*(r-E)-0.5
|
||||
* (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E)
|
||||
* else return 1.0+2.0*(r-E);
|
||||
* (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
|
||||
* (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else
|
||||
* (vii) return 2^k(1-((E+2^-k)-r))
|
||||
*
|
||||
* Special cases:
|
||||
* expm1(INF) is INF, expm1(NaN) is NaN;
|
||||
* expm1(-INF) is -1, and
|
||||
* for finite argument, only expm1(0)=0 is exact.
|
||||
*
|
||||
* Accuracy:
|
||||
* according to an error analysis, the error is always less than
|
||||
* 1 ulp (unit in the last place).
|
||||
*
|
||||
* Misc. info.
|
||||
* For IEEE double
|
||||
* if x > 7.09782712893383973096e+02 then expm1(x) overflow
|
||||
*
|
||||
* Constants:
|
||||
* The hexadecimal values are the intended ones for the following
|
||||
* constants. The decimal values may be used, provided that the
|
||||
* compiler will convert from decimal to binary accurately enough
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
double expm1(double x) {
|
||||
static const double
|
||||
one = 1.0,
|
||||
tiny = 1.0e-300,
|
||||
o_threshold = 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */
|
||||
ln2_hi = 6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
|
||||
ln2_lo = 1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
|
||||
invln2 = 1.44269504088896338700e+00, /* 0x3ff71547, 0x652b82fe */
|
||||
/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs =
|
||||
x*x/2: */
|
||||
Q1 = -3.33333333333331316428e-02, /* BFA11111 111110F4 */
|
||||
Q2 = 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */
|
||||
Q3 = -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */
|
||||
Q4 = 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */
|
||||
Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
|
||||
|
||||
static volatile double huge = 1.0e+300;
|
||||
|
||||
double y, hi, lo, c, t, e, hxs, hfx, r1, twopk;
|
||||
int32_t k, xsb;
|
||||
u_int32_t hx;
|
||||
|
||||
GET_HIGH_WORD(hx, x);
|
||||
xsb = hx & 0x80000000; /* sign bit of x */
|
||||
hx &= 0x7fffffff; /* high word of |x| */
|
||||
|
||||
/* filter out huge and non-finite argument */
|
||||
if (hx >= 0x4043687A) { /* if |x|>=56*ln2 */
|
||||
if (hx >= 0x40862E42) { /* if |x|>=709.78... */
|
||||
if (hx >= 0x7ff00000) {
|
||||
u_int32_t low;
|
||||
GET_LOW_WORD(low, x);
|
||||
if (((hx & 0xfffff) | low) != 0)
|
||||
return x + x; /* NaN */
|
||||
else
|
||||
return (xsb == 0) ? x : -1.0; /* exp(+-inf)={inf,-1} */
|
||||
}
|
||||
if (x > o_threshold) return huge * huge; /* overflow */
|
||||
}
|
||||
if (xsb != 0) { /* x < -56*ln2, return -1.0 with inexact */
|
||||
if (x + tiny < 0.0) /* raise inexact */
|
||||
return tiny - one; /* return -1 */
|
||||
}
|
||||
}
|
||||
|
||||
/* argument reduction */
|
||||
if (hx > 0x3fd62e42) { /* if |x| > 0.5 ln2 */
|
||||
if (hx < 0x3FF0A2B2) { /* and |x| < 1.5 ln2 */
|
||||
if (xsb == 0) {
|
||||
hi = x - ln2_hi;
|
||||
lo = ln2_lo;
|
||||
k = 1;
|
||||
} else {
|
||||
hi = x + ln2_hi;
|
||||
lo = -ln2_lo;
|
||||
k = -1;
|
||||
}
|
||||
} else {
|
||||
k = invln2 * x + ((xsb == 0) ? 0.5 : -0.5);
|
||||
t = k;
|
||||
hi = x - t * ln2_hi; /* t*ln2_hi is exact here */
|
||||
lo = t * ln2_lo;
|
||||
}
|
||||
STRICT_ASSIGN(double, x, hi - lo);
|
||||
c = (hi - x) - lo;
|
||||
} else if (hx < 0x3c900000) { /* when |x|<2**-54, return x */
|
||||
t = huge + x; /* return x with inexact flags when x!=0 */
|
||||
return x - (t - (huge + x));
|
||||
} else {
|
||||
k = 0;
|
||||
}
|
||||
|
||||
/* x is now in primary range */
|
||||
hfx = 0.5 * x;
|
||||
hxs = x * hfx;
|
||||
r1 = one + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5))));
|
||||
t = 3.0 - r1 * hfx;
|
||||
e = hxs * ((r1 - t) / (6.0 - x * t));
|
||||
if (k == 0) {
|
||||
return x - (x * e - hxs); /* c is 0 */
|
||||
} else {
|
||||
INSERT_WORDS(twopk, 0x3ff00000 + (k << 20), 0); /* 2^k */
|
||||
e = (x * (e - c) - c);
|
||||
e -= hxs;
|
||||
if (k == -1) return 0.5 * (x - e) - 0.5;
|
||||
if (k == 1) {
|
||||
if (x < -0.25)
|
||||
return -2.0 * (e - (x + 0.5));
|
||||
else
|
||||
return one + 2.0 * (x - e);
|
||||
}
|
||||
if (k <= -2 || k > 56) { /* suffice to return exp(x)-1 */
|
||||
y = one - (e - x);
|
||||
// TODO(mvstanton): is this replacement for the hex float
|
||||
// sufficient?
|
||||
// if (k == 1024) y = y*2.0*0x1p1023;
|
||||
if (k == 1024)
|
||||
y = y * 2.0 * 8.98846567431158e+307;
|
||||
else
|
||||
y = y * twopk;
|
||||
return y - one;
|
||||
}
|
||||
t = one;
|
||||
if (k < 20) {
|
||||
SET_HIGH_WORD(t, 0x3ff00000 - (0x200000 >> k)); /* t=1-2^-k */
|
||||
y = t - (e - x);
|
||||
y = y * twopk;
|
||||
} else {
|
||||
SET_HIGH_WORD(t, ((0x3ff - k) << 20)); /* 2^-k */
|
||||
y = x - (e + t);
|
||||
y += one;
|
||||
y = y * twopk;
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
double cbrt(double x) {
|
||||
static const u_int32_t
|
||||
B1 = 715094163, /* B1 = (1023-1023/3-0.03306235651)*2**20 */
|
||||
B2 = 696219795; /* B2 = (1023-1023/3-54/3-0.03306235651)*2**20 */
|
||||
|
||||
/* |1/cbrt(x) - p(x)| < 2**-23.5 (~[-7.93e-8, 7.929e-8]). */
|
||||
static const double P0 = 1.87595182427177009643, /* 0x3ffe03e6, 0x0f61e692 */
|
||||
P1 = -1.88497979543377169875, /* 0xbffe28e0, 0x92f02420 */
|
||||
P2 = 1.621429720105354466140, /* 0x3ff9f160, 0x4a49d6c2 */
|
||||
P3 = -0.758397934778766047437, /* 0xbfe844cb, 0xbee751d9 */
|
||||
P4 = 0.145996192886612446982; /* 0x3fc2b000, 0xd4e4edd7 */
|
||||
|
||||
int32_t hx;
|
||||
union {
|
||||
double value;
|
||||
uint64_t bits;
|
||||
} u;
|
||||
double r, s, t = 0.0, w;
|
||||
u_int32_t sign;
|
||||
u_int32_t high, low;
|
||||
|
||||
EXTRACT_WORDS(hx, low, x);
|
||||
sign = hx & 0x80000000; /* sign= sign(x) */
|
||||
hx ^= sign;
|
||||
if (hx >= 0x7ff00000) return (x + x); /* cbrt(NaN,INF) is itself */
|
||||
|
||||
/*
|
||||
* Rough cbrt to 5 bits:
|
||||
* cbrt(2**e*(1+m) ~= 2**(e/3)*(1+(e%3+m)/3)
|
||||
* where e is integral and >= 0, m is real and in [0, 1), and "/" and
|
||||
* "%" are integer division and modulus with rounding towards minus
|
||||
* infinity. The RHS is always >= the LHS and has a maximum relative
|
||||
* error of about 1 in 16. Adding a bias of -0.03306235651 to the
|
||||
* (e%3+m)/3 term reduces the error to about 1 in 32. With the IEEE
|
||||
* floating point representation, for finite positive normal values,
|
||||
* ordinary integer divison of the value in bits magically gives
|
||||
* almost exactly the RHS of the above provided we first subtract the
|
||||
* exponent bias (1023 for doubles) and later add it back. We do the
|
||||
* subtraction virtually to keep e >= 0 so that ordinary integer
|
||||
* division rounds towards minus infinity; this is also efficient.
|
||||
*/
|
||||
if (hx < 0x00100000) { /* zero or subnormal? */
|
||||
if ((hx | low) == 0) return (x); /* cbrt(0) is itself */
|
||||
SET_HIGH_WORD(t, 0x43500000); /* set t= 2**54 */
|
||||
t *= x;
|
||||
GET_HIGH_WORD(high, t);
|
||||
INSERT_WORDS(t, sign | ((high & 0x7fffffff) / 3 + B2), 0);
|
||||
} else {
|
||||
INSERT_WORDS(t, sign | (hx / 3 + B1), 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* New cbrt to 23 bits:
|
||||
* cbrt(x) = t*cbrt(x/t**3) ~= t*P(t**3/x)
|
||||
* where P(r) is a polynomial of degree 4 that approximates 1/cbrt(r)
|
||||
* to within 2**-23.5 when |r - 1| < 1/10. The rough approximation
|
||||
* has produced t such than |t/cbrt(x) - 1| ~< 1/32, and cubing this
|
||||
* gives us bounds for r = t**3/x.
|
||||
*
|
||||
* Try to optimize for parallel evaluation as in k_tanf.c.
|
||||
*/
|
||||
r = (t * t) * (t / x);
|
||||
t = t * ((P0 + r * (P1 + r * P2)) + ((r * r) * r) * (P3 + r * P4));
|
||||
|
||||
/*
|
||||
* Round t away from zero to 23 bits (sloppily except for ensuring that
|
||||
* the result is larger in magnitude than cbrt(x) but not much more than
|
||||
* 2 23-bit ulps larger). With rounding towards zero, the error bound
|
||||
* would be ~5/6 instead of ~4/6. With a maximum error of 2 23-bit ulps
|
||||
* in the rounded t, the infinite-precision error in the Newton
|
||||
* approximation barely affects third digit in the final error
|
||||
* 0.667; the error in the rounded t can be up to about 3 23-bit ulps
|
||||
* before the final error is larger than 0.667 ulps.
|
||||
*/
|
||||
u.value = t;
|
||||
u.bits = (u.bits + 0x80000000) & 0xffffffffc0000000ULL;
|
||||
t = u.value;
|
||||
|
||||
/* one step Newton iteration to 53 bits with error < 0.667 ulps */
|
||||
s = t * t; /* t*t is exact */
|
||||
r = x / s; /* error <= 0.5 ulps; |r| < |t| */
|
||||
w = t + t; /* t+t is exact */
|
||||
r = (r - t) / (w + r); /* r-t is exact; w+r ~= 3*t */
|
||||
t = t + t * r; /* error <= 0.5 + 0.5/3 + epsilon */
|
||||
|
||||
return (t);
|
||||
}
|
||||
|
||||
} // namespace ieee754
|
||||
} // namespace base
|
||||
} // namespace v8
|
||||
|
@ -20,6 +20,8 @@ double atan2(double y, double x);
|
||||
// Returns the base-e exponential of |x|.
|
||||
double exp(double x);
|
||||
|
||||
double atanh(double x);
|
||||
|
||||
// Returns the natural logarithm of |x|.
|
||||
double log(double x);
|
||||
|
||||
@ -33,6 +35,12 @@ double log2(double x);
|
||||
// Return the base 10 logarithm of |x|.
|
||||
double log10(double x);
|
||||
|
||||
// Return cube root of |x|.
|
||||
double cbrt(double x);
|
||||
|
||||
// Returns exp(x)-1, the exponential of |x| minus 1.
|
||||
double expm1(double x);
|
||||
|
||||
} // namespace ieee754
|
||||
} // namespace base
|
||||
} // namespace v8
|
||||
|
@ -1674,7 +1674,10 @@ void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
|
||||
SimpleInstallFunction(math, "asin", Builtins::kMathAsin, 1, true);
|
||||
SimpleInstallFunction(math, "atan", Builtins::kMathAtan, 1, true);
|
||||
SimpleInstallFunction(math, "atan2", Builtins::kMathAtan2, 2, true);
|
||||
SimpleInstallFunction(math, "atanh", Builtins::kMathAtanh, 1, true);
|
||||
SimpleInstallFunction(math, "ceil", Builtins::kMathCeil, 1, true);
|
||||
SimpleInstallFunction(math, "cbrt", Builtins::kMathCbrt, 1, true);
|
||||
SimpleInstallFunction(math, "expm1", Builtins::kMathExpm1, 1, true);
|
||||
SimpleInstallFunction(math, "clz32", Builtins::kMathClz32, 1, true);
|
||||
Handle<JSFunction> math_exp =
|
||||
SimpleInstallFunction(math, "exp", Builtins::kMathExp, 1, true);
|
||||
@ -2584,6 +2587,13 @@ void Bootstrapper::ExportFromRuntime(Isolate* isolate,
|
||||
script_map->AppendDescriptor(&d);
|
||||
}
|
||||
|
||||
{
|
||||
// TODO(mvstanton): Remove this when MathSinh, MathCosh and MathTanh are
|
||||
// no longer implemented in fdlibm.js.
|
||||
SimpleInstallFunction(container, "MathExpm1", Builtins::kMathExpm1, 1,
|
||||
true);
|
||||
}
|
||||
|
||||
{
|
||||
PrototypeIterator iter(native_context->sloppy_async_function_map());
|
||||
Handle<JSObject> async_function_prototype(iter.GetCurrent<JSObject>());
|
||||
|
@ -2316,6 +2316,18 @@ void Builtins::Generate_MathAtan2(CodeStubAssembler* assembler) {
|
||||
assembler->Return(result);
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.7 Math.atanh ( x )
|
||||
void Builtins::Generate_MathAtanh(CodeStubAssembler* assembler) {
|
||||
using compiler::Node;
|
||||
|
||||
Node* x = assembler->Parameter(1);
|
||||
Node* context = assembler->Parameter(4);
|
||||
Node* x_value = assembler->TruncateTaggedToFloat64(context, x);
|
||||
Node* value = assembler->Float64Atanh(x_value);
|
||||
Node* result = assembler->ChangeFloat64ToTagged(value);
|
||||
assembler->Return(result);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void Generate_MathRoundingOperation(
|
||||
@ -2384,6 +2396,18 @@ void Builtins::Generate_MathCeil(CodeStubAssembler* assembler) {
|
||||
Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Ceil);
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.9 Math.cbrt ( x )
|
||||
void Builtins::Generate_MathCbrt(CodeStubAssembler* assembler) {
|
||||
using compiler::Node;
|
||||
|
||||
Node* x = assembler->Parameter(1);
|
||||
Node* context = assembler->Parameter(4);
|
||||
Node* x_value = assembler->TruncateTaggedToFloat64(context, x);
|
||||
Node* value = assembler->Float64Cbrt(x_value);
|
||||
Node* result = assembler->ChangeFloat64ToTagged(value);
|
||||
assembler->Return(result);
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.11 Math.clz32 ( x )
|
||||
void Builtins::Generate_MathClz32(CodeStubAssembler* assembler) {
|
||||
typedef CodeStubAssembler::Label Label;
|
||||
@ -2539,6 +2563,18 @@ void Builtins::Generate_MathLog10(CodeStubAssembler* assembler) {
|
||||
assembler->Return(result);
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.15 Math.expm1 ( x )
|
||||
void Builtins::Generate_MathExpm1(CodeStubAssembler* assembler) {
|
||||
using compiler::Node;
|
||||
|
||||
Node* x = assembler->Parameter(1);
|
||||
Node* context = assembler->Parameter(4);
|
||||
Node* x_value = assembler->TruncateTaggedToFloat64(context, x);
|
||||
Node* value = assembler->Float64Expm1(x_value);
|
||||
Node* result = assembler->ChangeFloat64ToTagged(value);
|
||||
assembler->Return(result);
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.28 Math.round ( x )
|
||||
void Builtins::Generate_MathRound(CodeStubAssembler* assembler) {
|
||||
Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round);
|
||||
|
@ -318,7 +318,10 @@ inline bool operator&(BuiltinExtraArguments lhs, BuiltinExtraArguments rhs) {
|
||||
V(GeneratorPrototypeThrow, 2) \
|
||||
V(MathAtan, 2) \
|
||||
V(MathAtan2, 3) \
|
||||
V(MathAtanh, 2) \
|
||||
V(MathCeil, 2) \
|
||||
V(MathCbrt, 2) \
|
||||
V(MathExpm1, 2) \
|
||||
V(MathClz32, 2) \
|
||||
V(MathExp, 2) \
|
||||
V(MathFloor, 2) \
|
||||
@ -631,8 +634,14 @@ class Builtins {
|
||||
static void Generate_MathAtan(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.8 Math.atan2 ( y, x )
|
||||
static void Generate_MathAtan2(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.7 Math.atanh ( x )
|
||||
static void Generate_MathAtanh(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.10 Math.ceil ( x )
|
||||
static void Generate_MathCeil(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.9 Math.ceil ( x )
|
||||
static void Generate_MathCbrt(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.15 Math.expm1 ( x )
|
||||
static void Generate_MathExpm1(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.11 Math.clz32 ( x )
|
||||
static void Generate_MathClz32(CodeStubAssembler* assembler);
|
||||
// ES6 section 20.2.2.14 Math.exp ( x )
|
||||
|
@ -712,6 +712,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Exp:
|
||||
ASSEMBLE_IEEE754_UNOP(exp);
|
||||
break;
|
||||
case kIeee754Float64Atanh:
|
||||
ASSEMBLE_IEEE754_UNOP(atanh);
|
||||
break;
|
||||
case kIeee754Float64Log:
|
||||
ASSEMBLE_IEEE754_UNOP(log);
|
||||
break;
|
||||
@ -724,6 +727,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Log10:
|
||||
ASSEMBLE_IEEE754_UNOP(log10);
|
||||
break;
|
||||
case kIeee754Float64Cbrt:
|
||||
ASSEMBLE_IEEE754_UNOP(cbrt);
|
||||
break;
|
||||
case kIeee754Float64Expm1:
|
||||
ASSEMBLE_IEEE754_UNOP(expm1);
|
||||
break;
|
||||
case kArmAdd:
|
||||
__ add(i.OutputRegister(), i.InputRegister(0), i.InputOperand2(1),
|
||||
i.OutputSBit());
|
||||
|
@ -816,6 +816,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Exp:
|
||||
ASSEMBLE_IEEE754_UNOP(exp);
|
||||
break;
|
||||
case kIeee754Float64Atanh:
|
||||
ASSEMBLE_IEEE754_UNOP(atanh);
|
||||
break;
|
||||
case kIeee754Float64Log:
|
||||
ASSEMBLE_IEEE754_UNOP(log);
|
||||
break;
|
||||
@ -828,6 +831,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Log10:
|
||||
ASSEMBLE_IEEE754_UNOP(log10);
|
||||
break;
|
||||
case kIeee754Float64Cbrt:
|
||||
ASSEMBLE_IEEE754_UNOP(cbrt);
|
||||
break;
|
||||
case kIeee754Float64Expm1:
|
||||
ASSEMBLE_IEEE754_UNOP(expm1);
|
||||
break;
|
||||
case kArm64Float32RoundDown:
|
||||
__ Frintm(i.OutputFloat32Register(), i.InputFloat32Register(0));
|
||||
break;
|
||||
|
@ -108,11 +108,14 @@ class Schedule;
|
||||
|
||||
#define CODE_ASSEMBLER_UNARY_OP_LIST(V) \
|
||||
V(Float64Atan) \
|
||||
V(Float64Atanh) \
|
||||
V(Float64Exp) \
|
||||
V(Float64Expm1) \
|
||||
V(Float64Log) \
|
||||
V(Float64Log1p) \
|
||||
V(Float64Log2) \
|
||||
V(Float64Log10) \
|
||||
V(Float64Cbrt) \
|
||||
V(Float64Neg) \
|
||||
V(Float64Sqrt) \
|
||||
V(Float64ExtractLowWord32) \
|
||||
|
@ -658,6 +658,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Exp:
|
||||
ASSEMBLE_IEEE754_UNOP(exp);
|
||||
break;
|
||||
case kIeee754Float64Atanh:
|
||||
ASSEMBLE_IEEE754_UNOP(atanh);
|
||||
break;
|
||||
case kIeee754Float64Log:
|
||||
ASSEMBLE_IEEE754_UNOP(log);
|
||||
break;
|
||||
@ -670,6 +673,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Log10:
|
||||
ASSEMBLE_IEEE754_UNOP(log10);
|
||||
break;
|
||||
case kIeee754Float64Cbrt:
|
||||
ASSEMBLE_IEEE754_UNOP(cbrt);
|
||||
break;
|
||||
case kIeee754Float64Expm1:
|
||||
ASSEMBLE_IEEE754_UNOP(expm1);
|
||||
break;
|
||||
case kIA32Add:
|
||||
if (HasImmediateInput(instr, 1)) {
|
||||
__ add(i.InputOperand(0), i.InputImmediate(1));
|
||||
|
@ -91,11 +91,14 @@ enum class RecordWriteMode { kValueIsMap, kValueIsPointer, kValueIsAny };
|
||||
V(AtomicStoreWord32) \
|
||||
V(Ieee754Float64Atan) \
|
||||
V(Ieee754Float64Atan2) \
|
||||
V(Ieee754Float64Atanh) \
|
||||
V(Ieee754Float64Exp) \
|
||||
V(Ieee754Float64Expm1) \
|
||||
V(Ieee754Float64Log) \
|
||||
V(Ieee754Float64Log1p) \
|
||||
V(Ieee754Float64Log2) \
|
||||
V(Ieee754Float64Log10)
|
||||
V(Ieee754Float64Log10) \
|
||||
V(Ieee754Float64Cbrt)
|
||||
|
||||
#define ARCH_OPCODE_LIST(V) \
|
||||
COMMON_ARCH_OPCODE_LIST(V) \
|
||||
|
@ -226,11 +226,14 @@ int InstructionScheduler::GetInstructionFlags(const Instruction* instr) const {
|
||||
case kArchComment:
|
||||
case kIeee754Float64Atan:
|
||||
case kIeee754Float64Atan2:
|
||||
case kIeee754Float64Atanh:
|
||||
case kIeee754Float64Exp:
|
||||
case kIeee754Float64Expm1:
|
||||
case kIeee754Float64Log:
|
||||
case kIeee754Float64Log1p:
|
||||
case kIeee754Float64Log2:
|
||||
case kIeee754Float64Log10:
|
||||
case kIeee754Float64Cbrt:
|
||||
return kNoOpcodeFlags;
|
||||
|
||||
case kArchStackPointer:
|
||||
|
@ -1138,8 +1138,12 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
return MarkAsFloat64(node), VisitFloat64Atan(node);
|
||||
case IrOpcode::kFloat64Atan2:
|
||||
return MarkAsFloat64(node), VisitFloat64Atan2(node);
|
||||
case IrOpcode::kFloat64Atanh:
|
||||
return MarkAsFloat64(node), VisitFloat64Atanh(node);
|
||||
case IrOpcode::kFloat64Exp:
|
||||
return MarkAsFloat64(node), VisitFloat64Exp(node);
|
||||
case IrOpcode::kFloat64Expm1:
|
||||
return MarkAsFloat64(node), VisitFloat64Expm1(node);
|
||||
case IrOpcode::kFloat64Log:
|
||||
return MarkAsFloat64(node), VisitFloat64Log(node);
|
||||
case IrOpcode::kFloat64Log1p:
|
||||
@ -1148,6 +1152,8 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
return MarkAsFloat64(node), VisitFloat64Log2(node);
|
||||
case IrOpcode::kFloat64Log10:
|
||||
return MarkAsFloat64(node), VisitFloat64Log10(node);
|
||||
case IrOpcode::kFloat64Cbrt:
|
||||
return MarkAsFloat64(node), VisitFloat64Cbrt(node);
|
||||
case IrOpcode::kFloat64Sqrt:
|
||||
return MarkAsFloat64(node), VisitFloat64Sqrt(node);
|
||||
case IrOpcode::kFloat64Equal:
|
||||
@ -1261,10 +1267,18 @@ void InstructionSelector::VisitFloat64Atan2(Node* node) {
|
||||
VisitFloat64Ieee754Binop(node, kIeee754Float64Atan2);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat64Atanh(Node* node) {
|
||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Atanh);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat64Exp(Node* node) {
|
||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Exp);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat64Expm1(Node* node) {
|
||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Expm1);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat64Log(Node* node) {
|
||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Log);
|
||||
}
|
||||
@ -1281,6 +1295,10 @@ void InstructionSelector::VisitFloat64Log10(Node* node) {
|
||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Log10);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat64Cbrt(Node* node) {
|
||||
VisitFloat64Ieee754Unop(node, kIeee754Float64Cbrt);
|
||||
}
|
||||
|
||||
void InstructionSelector::EmitTableSwitch(const SwitchInfo& sw,
|
||||
InstructionOperand& index_operand) {
|
||||
OperandGenerator g(this);
|
||||
|
@ -118,6 +118,17 @@ Reduction JSBuiltinReducer::ReduceMathAtan2(Node* node) {
|
||||
return NoChange();
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.7 Math.atanh ( x )
|
||||
Reduction JSBuiltinReducer::ReduceMathAtanh(Node* node) {
|
||||
JSCallReduction r(node);
|
||||
if (r.InputsMatchOne(Type::Number())) {
|
||||
// Math.atanh(a:number) -> NumberAtanh(a)
|
||||
Node* value = graph()->NewNode(simplified()->NumberAtanh(), r.left());
|
||||
return Replace(value);
|
||||
}
|
||||
return NoChange();
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.10 Math.ceil ( x )
|
||||
Reduction JSBuiltinReducer::ReduceMathCeil(Node* node) {
|
||||
JSCallReduction r(node);
|
||||
@ -154,6 +165,17 @@ Reduction JSBuiltinReducer::ReduceMathExp(Node* node) {
|
||||
return NoChange();
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.15 Math.expm1 ( x )
|
||||
Reduction JSBuiltinReducer::ReduceMathExpm1(Node* node) {
|
||||
JSCallReduction r(node);
|
||||
if (r.InputsMatchOne(Type::Number())) {
|
||||
// Math.expm1(a:number) -> NumberExpm1(a)
|
||||
Node* value = graph()->NewNode(simplified()->NumberExpm1(), r.left());
|
||||
return Replace(value);
|
||||
}
|
||||
return NoChange();
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.16 Math.floor ( x )
|
||||
Reduction JSBuiltinReducer::ReduceMathFloor(Node* node) {
|
||||
JSCallReduction r(node);
|
||||
@ -293,6 +315,17 @@ Reduction JSBuiltinReducer::ReduceMathLog10(Node* node) {
|
||||
return NoChange();
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.9 Math.cbrt ( x )
|
||||
Reduction JSBuiltinReducer::ReduceMathCbrt(Node* node) {
|
||||
JSCallReduction r(node);
|
||||
if (r.InputsMatchOne(Type::Number())) {
|
||||
// Math.cbrt(a:number) -> NumberCbrt(a)
|
||||
Node* value = graph()->NewNode(simplified()->NumberCbrt(), r.left());
|
||||
return Replace(value);
|
||||
}
|
||||
return NoChange();
|
||||
}
|
||||
|
||||
// ES6 section 20.2.2.28 Math.round ( x )
|
||||
Reduction JSBuiltinReducer::ReduceMathRound(Node* node) {
|
||||
JSCallReduction r(node);
|
||||
@ -354,6 +387,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
|
||||
case kMathAtan2:
|
||||
reduction = ReduceMathAtan2(node);
|
||||
break;
|
||||
case kMathAtanh:
|
||||
reduction = ReduceMathAtanh(node);
|
||||
break;
|
||||
case kMathClz32:
|
||||
reduction = ReduceMathClz32(node);
|
||||
break;
|
||||
@ -363,6 +399,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
|
||||
case kMathExp:
|
||||
reduction = ReduceMathExp(node);
|
||||
break;
|
||||
case kMathExpm1:
|
||||
reduction = ReduceMathExpm1(node);
|
||||
break;
|
||||
case kMathFloor:
|
||||
reduction = ReduceMathFloor(node);
|
||||
break;
|
||||
@ -390,6 +429,9 @@ Reduction JSBuiltinReducer::Reduce(Node* node) {
|
||||
case kMathMin:
|
||||
reduction = ReduceMathMin(node);
|
||||
break;
|
||||
case kMathCbrt:
|
||||
reduction = ReduceMathCbrt(node);
|
||||
break;
|
||||
case kMathRound:
|
||||
reduction = ReduceMathRound(node);
|
||||
break;
|
||||
|
@ -31,6 +31,7 @@ class JSBuiltinReducer final : public AdvancedReducer {
|
||||
private:
|
||||
Reduction ReduceMathAtan(Node* node);
|
||||
Reduction ReduceMathAtan2(Node* node);
|
||||
Reduction ReduceMathAtanh(Node* node);
|
||||
Reduction ReduceMathCeil(Node* node);
|
||||
Reduction ReduceMathClz32(Node* node);
|
||||
Reduction ReduceMathExp(Node* node);
|
||||
@ -43,6 +44,8 @@ class JSBuiltinReducer final : public AdvancedReducer {
|
||||
Reduction ReduceMathLog10(Node* node);
|
||||
Reduction ReduceMathMax(Node* node);
|
||||
Reduction ReduceMathMin(Node* node);
|
||||
Reduction ReduceMathCbrt(Node* node);
|
||||
Reduction ReduceMathExpm1(Node* node);
|
||||
Reduction ReduceMathRound(Node* node);
|
||||
Reduction ReduceMathSqrt(Node* node);
|
||||
Reduction ReduceMathTrunc(Node* node);
|
||||
|
@ -396,11 +396,21 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kFloat64Atanh: {
|
||||
Float64Matcher m(node->InputAt(0));
|
||||
if (m.HasValue()) return ReplaceFloat64(base::ieee754::atanh(m.Value()));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kFloat64Exp: {
|
||||
Float64Matcher m(node->InputAt(0));
|
||||
if (m.HasValue()) return ReplaceFloat64(base::ieee754::exp(m.Value()));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kFloat64Expm1: {
|
||||
Float64Matcher m(node->InputAt(0));
|
||||
if (m.HasValue()) return ReplaceFloat64(base::ieee754::expm1(m.Value()));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kFloat64Log: {
|
||||
Float64Matcher m(node->InputAt(0));
|
||||
if (m.HasValue()) return ReplaceFloat64(base::ieee754::log(m.Value()));
|
||||
@ -421,6 +431,11 @@ Reduction MachineOperatorReducer::Reduce(Node* node) {
|
||||
if (m.HasValue()) return ReplaceFloat64(base::ieee754::log10(m.Value()));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kFloat64Cbrt: {
|
||||
Float64Matcher m(node->InputAt(0));
|
||||
if (m.HasValue()) return ReplaceFloat64(base::ieee754::cbrt(m.Value()));
|
||||
break;
|
||||
}
|
||||
case IrOpcode::kChangeFloat32ToFloat64: {
|
||||
Float32Matcher m(node->InputAt(0));
|
||||
if (m.HasValue()) return ReplaceFloat64(m.Value());
|
||||
|
@ -157,11 +157,14 @@ MachineRepresentation AtomicStoreRepresentationOf(Operator const* op) {
|
||||
V(Float64Abs, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Atan, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Atan2, Operator::kNoProperties, 2, 0, 1) \
|
||||
V(Float64Atanh, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Exp, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Expm1, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Log, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Log1p, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Log2, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Log10, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Cbrt, Operator::kNoProperties, 1, 0, 1) \
|
||||
V(Float64Add, Operator::kCommutative, 2, 0, 1) \
|
||||
V(Float64Sub, Operator::kNoProperties, 2, 0, 1) \
|
||||
V(Float64SubPreserveNan, Operator::kNoProperties, 2, 0, 1) \
|
||||
|
@ -371,6 +371,7 @@ class MachineOperatorBuilder final : public ZoneObject {
|
||||
// Floating point trigonometric functions (double-precision).
|
||||
const Operator* Float64Atan();
|
||||
const Operator* Float64Atan2();
|
||||
const Operator* Float64Atanh();
|
||||
|
||||
// Floating point exponential functions.
|
||||
const Operator* Float64Exp();
|
||||
@ -381,6 +382,9 @@ class MachineOperatorBuilder final : public ZoneObject {
|
||||
const Operator* Float64Log2();
|
||||
const Operator* Float64Log10();
|
||||
|
||||
const Operator* Float64Cbrt();
|
||||
const Operator* Float64Expm1();
|
||||
|
||||
// Floating point bit representation.
|
||||
const Operator* Float64ExtractLowWord32();
|
||||
const Operator* Float64ExtractHighWord32();
|
||||
|
@ -750,9 +750,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Exp:
|
||||
ASSEMBLE_IEEE754_UNOP(exp);
|
||||
break;
|
||||
case kIeee754Float64Atanh:
|
||||
ASSEMBLE_IEEE754_UNOP(atanh);
|
||||
break;
|
||||
case kIeee754Float64Log:
|
||||
ASSEMBLE_IEEE754_UNOP(log);
|
||||
break;
|
||||
case kIeee754Float64Cbrt:
|
||||
ASSEMBLE_IEEE754_UNOP(cbrt);
|
||||
break;
|
||||
case kIeee754Float64Expm1:
|
||||
ASSEMBLE_IEEE754_UNOP(expm1);
|
||||
break;
|
||||
case kIeee754Float64Log1p:
|
||||
ASSEMBLE_IEEE754_UNOP(log1p);
|
||||
break;
|
||||
|
@ -756,9 +756,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Atan2:
|
||||
ASSEMBLE_IEEE754_BINOP(atan2);
|
||||
break;
|
||||
case kIeee754Float64Atanh:
|
||||
ASSEMBLE_IEEE754_UNOP(atanh);
|
||||
break;
|
||||
case kIeee754Float64Exp:
|
||||
ASSEMBLE_IEEE754_UNOP(exp);
|
||||
break;
|
||||
case kIeee754Float64Expm1:
|
||||
ASSEMBLE_IEEE754_UNOP(expm1);
|
||||
break;
|
||||
case kIeee754Float64Log:
|
||||
ASSEMBLE_IEEE754_UNOP(log);
|
||||
break;
|
||||
@ -771,6 +777,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Log10:
|
||||
ASSEMBLE_IEEE754_UNOP(log10);
|
||||
break;
|
||||
case kIeee754Float64Cbrt:
|
||||
ASSEMBLE_IEEE754_UNOP(cbrt);
|
||||
break;
|
||||
case kMips64Add:
|
||||
__ Addu(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1));
|
||||
break;
|
||||
|
@ -203,11 +203,14 @@
|
||||
V(NumberFround) \
|
||||
V(NumberAtan) \
|
||||
V(NumberAtan2) \
|
||||
V(NumberAtanh) \
|
||||
V(NumberExp) \
|
||||
V(NumberExpm1) \
|
||||
V(NumberLog) \
|
||||
V(NumberLog1p) \
|
||||
V(NumberLog2) \
|
||||
V(NumberLog10) \
|
||||
V(NumberCbrt) \
|
||||
V(NumberRound) \
|
||||
V(NumberSqrt) \
|
||||
V(NumberTrunc) \
|
||||
@ -372,11 +375,14 @@
|
||||
V(Float64Abs) \
|
||||
V(Float64Atan) \
|
||||
V(Float64Atan2) \
|
||||
V(Float64Atanh) \
|
||||
V(Float64Exp) \
|
||||
V(Float64Expm1) \
|
||||
V(Float64Log) \
|
||||
V(Float64Log1p) \
|
||||
V(Float64Log2) \
|
||||
V(Float64Log10) \
|
||||
V(Float64Cbrt) \
|
||||
V(Float64Sqrt) \
|
||||
V(Float64RoundDown) \
|
||||
V(Float32RoundUp) \
|
||||
|
@ -464,11 +464,14 @@ class RawMachineAssembler {
|
||||
Node* Float64Atan2(Node* a, Node* b) {
|
||||
return AddNode(machine()->Float64Atan2(), a, b);
|
||||
}
|
||||
Node* Float64Atanh(Node* a) { return AddNode(machine()->Float64Atanh(), a); }
|
||||
Node* Float64Exp(Node* a) { return AddNode(machine()->Float64Exp(), a); }
|
||||
Node* Float64Expm1(Node* a) { return AddNode(machine()->Float64Expm1(), a); }
|
||||
Node* Float64Log(Node* a) { return AddNode(machine()->Float64Log(), a); }
|
||||
Node* Float64Log1p(Node* a) { return AddNode(machine()->Float64Log1p(), a); }
|
||||
Node* Float64Log2(Node* a) { return AddNode(machine()->Float64Log2(), a); }
|
||||
Node* Float64Log10(Node* a) { return AddNode(machine()->Float64Log10(), a); }
|
||||
Node* Float64Cbrt(Node* a) { return AddNode(machine()->Float64Cbrt(), a); }
|
||||
Node* Float64Sqrt(Node* a) { return AddNode(machine()->Float64Sqrt(), a); }
|
||||
Node* Float64Equal(Node* a, Node* b) {
|
||||
return AddNode(machine()->Float64Equal(), a, b);
|
||||
|
@ -675,6 +675,8 @@ const Operator* RepresentationChanger::Float64OperatorFor(
|
||||
return machine()->Float64Exp();
|
||||
case IrOpcode::kNumberFround:
|
||||
return machine()->TruncateFloat64ToFloat32();
|
||||
case IrOpcode::kNumberAtanh:
|
||||
return machine()->Float64Atanh();
|
||||
case IrOpcode::kNumberLog:
|
||||
return machine()->Float64Log();
|
||||
case IrOpcode::kNumberLog1p:
|
||||
@ -685,6 +687,10 @@ const Operator* RepresentationChanger::Float64OperatorFor(
|
||||
return machine()->Float64Log10();
|
||||
case IrOpcode::kNumberSqrt:
|
||||
return machine()->Float64Sqrt();
|
||||
case IrOpcode::kNumberCbrt:
|
||||
return machine()->Float64Cbrt();
|
||||
case IrOpcode::kNumberExpm1:
|
||||
return machine()->Float64Expm1();
|
||||
case IrOpcode::kNumberSilenceNaN:
|
||||
return machine()->Float64SilenceNaN();
|
||||
default:
|
||||
|
@ -1442,11 +1442,14 @@ class RepresentationSelector {
|
||||
return;
|
||||
}
|
||||
case IrOpcode::kNumberAtan:
|
||||
case IrOpcode::kNumberAtanh:
|
||||
case IrOpcode::kNumberExp:
|
||||
case IrOpcode::kNumberExpm1:
|
||||
case IrOpcode::kNumberLog:
|
||||
case IrOpcode::kNumberLog1p:
|
||||
case IrOpcode::kNumberLog2:
|
||||
case IrOpcode::kNumberLog10: {
|
||||
case IrOpcode::kNumberLog10:
|
||||
case IrOpcode::kNumberCbrt: {
|
||||
VisitUnop(node, UseInfo::TruncatingFloat64(),
|
||||
MachineRepresentation::kFloat64);
|
||||
if (lower()) NodeProperties::ChangeOp(node, Float64Op(node));
|
||||
|
@ -254,11 +254,14 @@ CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) {
|
||||
V(NumberFround, Operator::kNoProperties, 1) \
|
||||
V(NumberAtan, Operator::kNoProperties, 1) \
|
||||
V(NumberAtan2, Operator::kNoProperties, 2) \
|
||||
V(NumberAtanh, Operator::kNoProperties, 1) \
|
||||
V(NumberExp, Operator::kNoProperties, 1) \
|
||||
V(NumberExpm1, Operator::kNoProperties, 1) \
|
||||
V(NumberLog, Operator::kNoProperties, 1) \
|
||||
V(NumberLog1p, Operator::kNoProperties, 1) \
|
||||
V(NumberLog2, Operator::kNoProperties, 1) \
|
||||
V(NumberLog10, Operator::kNoProperties, 1) \
|
||||
V(NumberCbrt, Operator::kNoProperties, 1) \
|
||||
V(NumberRound, Operator::kNoProperties, 1) \
|
||||
V(NumberSqrt, Operator::kNoProperties, 1) \
|
||||
V(NumberTrunc, Operator::kNoProperties, 1) \
|
||||
|
@ -181,11 +181,14 @@ class SimplifiedOperatorBuilder final : public ZoneObject {
|
||||
const Operator* NumberFround();
|
||||
const Operator* NumberAtan();
|
||||
const Operator* NumberAtan2();
|
||||
const Operator* NumberAtanh();
|
||||
const Operator* NumberExp();
|
||||
const Operator* NumberExpm1();
|
||||
const Operator* NumberLog();
|
||||
const Operator* NumberLog1p();
|
||||
const Operator* NumberLog2();
|
||||
const Operator* NumberLog10();
|
||||
const Operator* NumberCbrt();
|
||||
const Operator* NumberRound();
|
||||
const Operator* NumberSqrt();
|
||||
const Operator* NumberTrunc();
|
||||
|
@ -1801,10 +1801,15 @@ Type* Typer::Visitor::TypeNumberAtan(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberAtan2(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberAtanh(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberExp(Node* node) {
|
||||
return Type::Union(Type::PlainNumber(), Type::NaN(), zone());
|
||||
}
|
||||
|
||||
// TODO(mvstanton): Is this type sufficient, or should it look like Exp()?
|
||||
Type* Typer::Visitor::TypeNumberExpm1(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberLog(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberLog1p(Node* node) { return Type::Number(); }
|
||||
@ -1813,6 +1818,8 @@ Type* Typer::Visitor::TypeNumberLog2(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberLog10(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberCbrt(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeNumberRound(Node* node) {
|
||||
return TypeUnaryOp(node, NumberRound);
|
||||
}
|
||||
@ -2564,8 +2571,12 @@ Type* Typer::Visitor::TypeFloat64Atan(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Atan2(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Atanh(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Exp(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Expm1(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Log(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Log1p(Node* node) { return Type::Number(); }
|
||||
@ -2574,6 +2585,8 @@ Type* Typer::Visitor::TypeFloat64Log2(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Log10(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Cbrt(Node* node) { return Type::Number(); }
|
||||
|
||||
Type* Typer::Visitor::TypeFloat64Sqrt(Node* node) { return Type::Number(); }
|
||||
|
||||
|
||||
|
@ -753,11 +753,14 @@ void Verifier::Visitor::Check(Node* node) {
|
||||
case IrOpcode::kNumberFloor:
|
||||
case IrOpcode::kNumberFround:
|
||||
case IrOpcode::kNumberAtan:
|
||||
case IrOpcode::kNumberAtanh:
|
||||
case IrOpcode::kNumberExp:
|
||||
case IrOpcode::kNumberExpm1:
|
||||
case IrOpcode::kNumberLog:
|
||||
case IrOpcode::kNumberLog1p:
|
||||
case IrOpcode::kNumberLog2:
|
||||
case IrOpcode::kNumberLog10:
|
||||
case IrOpcode::kNumberCbrt:
|
||||
case IrOpcode::kNumberRound:
|
||||
case IrOpcode::kNumberSqrt:
|
||||
case IrOpcode::kNumberTrunc:
|
||||
@ -1071,11 +1074,14 @@ void Verifier::Visitor::Check(Node* node) {
|
||||
case IrOpcode::kFloat64Abs:
|
||||
case IrOpcode::kFloat64Atan:
|
||||
case IrOpcode::kFloat64Atan2:
|
||||
case IrOpcode::kFloat64Atanh:
|
||||
case IrOpcode::kFloat64Exp:
|
||||
case IrOpcode::kFloat64Expm1:
|
||||
case IrOpcode::kFloat64Log:
|
||||
case IrOpcode::kFloat64Log1p:
|
||||
case IrOpcode::kFloat64Log2:
|
||||
case IrOpcode::kFloat64Log10:
|
||||
case IrOpcode::kFloat64Cbrt:
|
||||
case IrOpcode::kFloat64Sqrt:
|
||||
case IrOpcode::kFloat32RoundDown:
|
||||
case IrOpcode::kFloat64RoundDown:
|
||||
|
@ -873,9 +873,15 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Atan2:
|
||||
ASSEMBLE_IEEE754_BINOP(atan2);
|
||||
break;
|
||||
case kIeee754Float64Atanh:
|
||||
ASSEMBLE_IEEE754_UNOP(atanh);
|
||||
break;
|
||||
case kIeee754Float64Exp:
|
||||
ASSEMBLE_IEEE754_UNOP(exp);
|
||||
break;
|
||||
case kIeee754Float64Expm1:
|
||||
ASSEMBLE_IEEE754_UNOP(expm1);
|
||||
break;
|
||||
case kIeee754Float64Log:
|
||||
ASSEMBLE_IEEE754_UNOP(log);
|
||||
break;
|
||||
@ -888,6 +894,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Log10:
|
||||
ASSEMBLE_IEEE754_UNOP(log10);
|
||||
break;
|
||||
case kIeee754Float64Cbrt:
|
||||
ASSEMBLE_IEEE754_UNOP(cbrt);
|
||||
break;
|
||||
case kX64Add32:
|
||||
ASSEMBLE_BINOP(addl);
|
||||
break;
|
||||
|
@ -71,8 +71,12 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
|
||||
"base::ieee754::atan");
|
||||
Add(ExternalReference::ieee754_atan2_function(isolate).address(),
|
||||
"base::ieee754::atan2");
|
||||
Add(ExternalReference::ieee754_atanh_function(isolate).address(),
|
||||
"base::ieee754::atanh");
|
||||
Add(ExternalReference::ieee754_exp_function(isolate).address(),
|
||||
"base::ieee754::exp");
|
||||
Add(ExternalReference::ieee754_expm1_function(isolate).address(),
|
||||
"base::ieee754::expm1");
|
||||
Add(ExternalReference::ieee754_log_function(isolate).address(),
|
||||
"base::ieee754::log");
|
||||
Add(ExternalReference::ieee754_log1p_function(isolate).address(),
|
||||
@ -81,6 +85,8 @@ ExternalReferenceTable::ExternalReferenceTable(Isolate* isolate) {
|
||||
"base::ieee754::log2");
|
||||
Add(ExternalReference::ieee754_log10_function(isolate).address(),
|
||||
"base::ieee754::log10");
|
||||
Add(ExternalReference::ieee754_cbrt_function(isolate).address(),
|
||||
"base::ieee754::cbrt");
|
||||
Add(ExternalReference::store_buffer_top(isolate).address(),
|
||||
"store_buffer_top");
|
||||
Add(ExternalReference::address_of_the_hole_nan().address(), "the_hole_nan");
|
||||
|
@ -88,16 +88,6 @@ function MathAcosh(x) {
|
||||
return %math_log(x + %math_sqrt(x + 1) * %math_sqrt(x - 1));
|
||||
}
|
||||
|
||||
// ES6 draft 09-27-13, section 20.2.2.7.
|
||||
function MathAtanh(x) {
|
||||
x = TO_NUMBER(x);
|
||||
// Idempotent for +/-0.
|
||||
if (x === 0) return x;
|
||||
// Returns NaN for NaN and +/- Infinity.
|
||||
if (!NUMBER_IS_FINITE(x)) return NaN;
|
||||
return 0.5 * %math_log((1 + x) / (1 - x));
|
||||
}
|
||||
|
||||
// ES6 draft 09-27-13, section 20.2.2.17.
|
||||
function MathHypot(x, y) { // Function length is 2.
|
||||
// We may want to introduce fast paths for two arguments and when
|
||||
@ -127,29 +117,6 @@ function MathHypot(x, y) { // Function length is 2.
|
||||
return %math_sqrt(sum) * max;
|
||||
}
|
||||
|
||||
// ES6 draft 09-27-13, section 20.2.2.9.
|
||||
// Cube root approximation, refer to: http://metamerist.com/cbrt/cbrt.htm
|
||||
// Using initial approximation adapted from Kahan's cbrt and 4 iterations
|
||||
// of Newton's method.
|
||||
function MathCbrt(x) {
|
||||
x = TO_NUMBER(x);
|
||||
if (x == 0 || !NUMBER_IS_FINITE(x)) return x;
|
||||
return x >= 0 ? CubeRoot(x) : -CubeRoot(-x);
|
||||
}
|
||||
|
||||
macro NEWTON_ITERATION_CBRT(x, approx)
|
||||
(1.0 / 3.0) * (x / (approx * approx) + 2 * approx);
|
||||
endmacro
|
||||
|
||||
function CubeRoot(x) {
|
||||
var approx_hi = %math_floor(%_DoubleHi(x) / 3) + 0x2A9F7893;
|
||||
var approx = %_ConstructDouble(approx_hi | 0, 0);
|
||||
approx = NEWTON_ITERATION_CBRT(x, approx);
|
||||
approx = NEWTON_ITERATION_CBRT(x, approx);
|
||||
approx = NEWTON_ITERATION_CBRT(x, approx);
|
||||
return NEWTON_ITERATION_CBRT(x, approx);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
%InstallToContext([
|
||||
@ -183,9 +150,7 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
|
||||
"sign", MathSign,
|
||||
"asinh", MathAsinh,
|
||||
"acosh", MathAcosh,
|
||||
"atanh", MathAtanh,
|
||||
"hypot", MathHypot,
|
||||
"cbrt", MathCbrt
|
||||
]);
|
||||
|
||||
%SetForceInlineFlag(MathAbs);
|
||||
|
@ -6591,7 +6591,9 @@ class Script: public Struct {
|
||||
V(Math, log1p, MathLog1p) \
|
||||
V(Math, log2, MathLog2) \
|
||||
V(Math, log10, MathLog10) \
|
||||
V(Math, cbrt, MathCbrt) \
|
||||
V(Math, exp, MathExp) \
|
||||
V(Math, expm1, MathExpm1) \
|
||||
V(Math, sqrt, MathSqrt) \
|
||||
V(Math, pow, MathPow) \
|
||||
V(Math, max, MathMax) \
|
||||
@ -6603,6 +6605,7 @@ class Script: public Struct {
|
||||
V(Math, asin, MathAsin) \
|
||||
V(Math, atan, MathAtan) \
|
||||
V(Math, atan2, MathAtan2) \
|
||||
V(Math, atanh, MathAtanh) \
|
||||
V(Math, imul, MathImul) \
|
||||
V(Math, clz32, MathClz32) \
|
||||
V(Math, fround, MathFround) \
|
||||
|
201
src/third_party/fdlibm/fdlibm.js
vendored
201
src/third_party/fdlibm/fdlibm.js
vendored
@ -31,11 +31,13 @@
|
||||
var GlobalFloat64Array = global.Float64Array;
|
||||
var GlobalMath = global.Math;
|
||||
var MathAbs;
|
||||
var MathExpm1;
|
||||
var NaN = %GetRootNaN();
|
||||
var rempio2result;
|
||||
|
||||
utils.Import(function(from) {
|
||||
MathAbs = from.MathAbs;
|
||||
MathExpm1 = from.MathExpm1;
|
||||
});
|
||||
|
||||
utils.CreateDoubleResultArray = function(global) {
|
||||
@ -401,202 +403,6 @@ define LN2_LO = 1.90821492927058770002e-10;
|
||||
// 2^54
|
||||
define TWO54 = 18014398509481984;
|
||||
|
||||
// ES6 draft 09-27-13, section 20.2.2.14.
|
||||
// Math.expm1
|
||||
// Returns exp(x)-1, the exponential of x minus 1.
|
||||
//
|
||||
// Method
|
||||
// 1. Argument reduction:
|
||||
// Given x, find r and integer k such that
|
||||
//
|
||||
// x = k*ln2 + r, |r| <= 0.5*ln2 ~ 0.34658
|
||||
//
|
||||
// Here a correction term c will be computed to compensate
|
||||
// the error in r when rounded to a floating-point number.
|
||||
//
|
||||
// 2. Approximating expm1(r) by a special rational function on
|
||||
// the interval [0,0.34658]:
|
||||
// Since
|
||||
// r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 - r^4/360 + ...
|
||||
// we define R1(r*r) by
|
||||
// r*(exp(r)+1)/(exp(r)-1) = 2+ r^2/6 * R1(r*r)
|
||||
// That is,
|
||||
// R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
|
||||
// = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
|
||||
// = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
|
||||
// We use a special Remes algorithm on [0,0.347] to generate
|
||||
// a polynomial of degree 5 in r*r to approximate R1. The
|
||||
// maximum error of this polynomial approximation is bounded
|
||||
// by 2**-61. In other words,
|
||||
// R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
|
||||
// where Q1 = -1.6666666666666567384E-2,
|
||||
// Q2 = 3.9682539681370365873E-4,
|
||||
// Q3 = -9.9206344733435987357E-6,
|
||||
// Q4 = 2.5051361420808517002E-7,
|
||||
// Q5 = -6.2843505682382617102E-9;
|
||||
// (where z=r*r, and the values of Q1 to Q5 are listed below)
|
||||
// with error bounded by
|
||||
// | 5 | -61
|
||||
// | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2
|
||||
// | |
|
||||
//
|
||||
// expm1(r) = exp(r)-1 is then computed by the following
|
||||
// specific way which minimize the accumulation rounding error:
|
||||
// 2 3
|
||||
// r r [ 3 - (R1 + R1*r/2) ]
|
||||
// expm1(r) = r + --- + --- * [--------------------]
|
||||
// 2 2 [ 6 - r*(3 - R1*r/2) ]
|
||||
//
|
||||
// To compensate the error in the argument reduction, we use
|
||||
// expm1(r+c) = expm1(r) + c + expm1(r)*c
|
||||
// ~ expm1(r) + c + r*c
|
||||
// Thus c+r*c will be added in as the correction terms for
|
||||
// expm1(r+c). Now rearrange the term to avoid optimization
|
||||
// screw up:
|
||||
// ( 2 2 )
|
||||
// ({ ( r [ R1 - (3 - R1*r/2) ] ) } r )
|
||||
// expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
|
||||
// ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 )
|
||||
// ( )
|
||||
//
|
||||
// = r - E
|
||||
// 3. Scale back to obtain expm1(x):
|
||||
// From step 1, we have
|
||||
// expm1(x) = either 2^k*[expm1(r)+1] - 1
|
||||
// = or 2^k*[expm1(r) + (1-2^-k)]
|
||||
// 4. Implementation notes:
|
||||
// (A). To save one multiplication, we scale the coefficient Qi
|
||||
// to Qi*2^i, and replace z by (x^2)/2.
|
||||
// (B). To achieve maximum accuracy, we compute expm1(x) by
|
||||
// (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
|
||||
// (ii) if k=0, return r-E
|
||||
// (iii) if k=-1, return 0.5*(r-E)-0.5
|
||||
// (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E)
|
||||
// else return 1.0+2.0*(r-E);
|
||||
// (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
|
||||
// (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else
|
||||
// (vii) return 2^k(1-((E+2^-k)-r))
|
||||
//
|
||||
// Special cases:
|
||||
// expm1(INF) is INF, expm1(NaN) is NaN;
|
||||
// expm1(-INF) is -1, and
|
||||
// for finite argument, only expm1(0)=0 is exact.
|
||||
//
|
||||
// Accuracy:
|
||||
// according to an error analysis, the error is always less than
|
||||
// 1 ulp (unit in the last place).
|
||||
//
|
||||
// Misc. info.
|
||||
// For IEEE double
|
||||
// if x > 7.09782712893383973096e+02 then expm1(x) overflow
|
||||
//
|
||||
define KEXPM1_OVERFLOW = 7.09782712893383973096e+02;
|
||||
define INVLN2 = 1.44269504088896338700;
|
||||
define EXPM1_1 = -3.33333333333331316428e-02;
|
||||
define EXPM1_2 = 1.58730158725481460165e-03;
|
||||
define EXPM1_3 = -7.93650757867487942473e-05;
|
||||
define EXPM1_4 = 4.00821782732936239552e-06;
|
||||
define EXPM1_5 = -2.01099218183624371326e-07;
|
||||
|
||||
function MathExpm1(x) {
|
||||
x = x * 1; // Convert to number.
|
||||
var y;
|
||||
var hi;
|
||||
var lo;
|
||||
var k;
|
||||
var t;
|
||||
var c;
|
||||
|
||||
var hx = %_DoubleHi(x);
|
||||
var xsb = hx & 0x80000000; // Sign bit of x
|
||||
var y = (xsb === 0) ? x : -x; // y = |x|
|
||||
hx &= 0x7fffffff; // High word of |x|
|
||||
|
||||
// Filter out huge and non-finite argument
|
||||
if (hx >= 0x4043687a) { // if |x| ~=> 56 * ln2
|
||||
if (hx >= 0x40862e42) { // if |x| >= 709.78
|
||||
if (hx >= 0x7ff00000) {
|
||||
// expm1(inf) = inf; expm1(-inf) = -1; expm1(nan) = nan;
|
||||
return (x === -INFINITY) ? -1 : x;
|
||||
}
|
||||
if (x > KEXPM1_OVERFLOW) return INFINITY; // Overflow
|
||||
}
|
||||
if (xsb != 0) return -1; // x < -56 * ln2, return -1.
|
||||
}
|
||||
|
||||
// Argument reduction
|
||||
if (hx > 0x3fd62e42) { // if |x| > 0.5 * ln2
|
||||
if (hx < 0x3ff0a2b2) { // and |x| < 1.5 * ln2
|
||||
if (xsb === 0) {
|
||||
hi = x - LN2_HI;
|
||||
lo = LN2_LO;
|
||||
k = 1;
|
||||
} else {
|
||||
hi = x + LN2_HI;
|
||||
lo = -LN2_LO;
|
||||
k = -1;
|
||||
}
|
||||
} else {
|
||||
k = (INVLN2 * x + ((xsb === 0) ? 0.5 : -0.5)) | 0;
|
||||
t = k;
|
||||
// t * ln2_hi is exact here.
|
||||
hi = x - t * LN2_HI;
|
||||
lo = t * LN2_LO;
|
||||
}
|
||||
x = hi - lo;
|
||||
c = (hi - x) - lo;
|
||||
} else if (hx < 0x3c900000) {
|
||||
// When |x| < 2^-54, we can return x.
|
||||
return x;
|
||||
} else {
|
||||
// Fall through.
|
||||
k = 0;
|
||||
}
|
||||
|
||||
// x is now in primary range
|
||||
var hfx = 0.5 * x;
|
||||
var hxs = x * hfx;
|
||||
var r1 = 1 + hxs * (EXPM1_1 + hxs * (EXPM1_2 + hxs *
|
||||
(EXPM1_3 + hxs * (EXPM1_4 + hxs * EXPM1_5))));
|
||||
t = 3 - r1 * hfx;
|
||||
var e = hxs * ((r1 - t) / (6 - x * t));
|
||||
if (k === 0) { // c is 0
|
||||
return x - (x*e - hxs);
|
||||
} else {
|
||||
e = (x * (e - c) - c);
|
||||
e -= hxs;
|
||||
if (k === -1) return 0.5 * (x - e) - 0.5;
|
||||
if (k === 1) {
|
||||
if (x < -0.25) return -2 * (e - (x + 0.5));
|
||||
return 1 + 2 * (x - e);
|
||||
}
|
||||
|
||||
if (k <= -2 || k > 56) {
|
||||
// suffice to return exp(x) + 1
|
||||
y = 1 - (e - x);
|
||||
// Add k to y's exponent
|
||||
y = %_ConstructDouble(%_DoubleHi(y) + (k << 20), %_DoubleLo(y));
|
||||
return y - 1;
|
||||
}
|
||||
if (k < 20) {
|
||||
// t = 1 - 2^k
|
||||
t = %_ConstructDouble(0x3ff00000 - (0x200000 >> k), 0);
|
||||
y = t - (e - x);
|
||||
// Add k to y's exponent
|
||||
y = %_ConstructDouble(%_DoubleHi(y) + (k << 20), %_DoubleLo(y));
|
||||
} else {
|
||||
// t = 2^-k
|
||||
t = %_ConstructDouble((0x3ff - k) << 20, 0);
|
||||
y = x - (e + t);
|
||||
y += 1;
|
||||
// Add k to y's exponent
|
||||
y = %_ConstructDouble(%_DoubleHi(y) + (k << 20), %_DoubleLo(y));
|
||||
}
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
// ES6 draft 09-27-13, section 20.2.2.30.
|
||||
// Math.sinh
|
||||
// Method :
|
||||
@ -763,8 +569,7 @@ utils.InstallFunctions(GlobalMath, DONT_ENUM, [
|
||||
"tan", MathTan,
|
||||
"sinh", MathSinh,
|
||||
"cosh", MathCosh,
|
||||
"tanh", MathTanh,
|
||||
"expm1", MathExpm1
|
||||
"tanh", MathTanh
|
||||
]);
|
||||
|
||||
%SetForceInlineFlag(MathSin);
|
||||
|
@ -5517,6 +5517,18 @@ TEST(RunFloat64Atan2) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST(RunFloat64Atanh) {
|
||||
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
|
||||
m.Return(m.Float64Atanh(m.Parameter(0)));
|
||||
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
|
||||
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
|
||||
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(), m.Call(1.0));
|
||||
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0));
|
||||
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
|
||||
CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
|
||||
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::atanh(*i), m.Call(*i)); }
|
||||
}
|
||||
|
||||
TEST(RunFloat64Exp) {
|
||||
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
|
||||
m.Return(m.Float64Exp(m.Parameter(0)));
|
||||
@ -5530,6 +5542,17 @@ TEST(RunFloat64Exp) {
|
||||
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::exp(*i), m.Call(*i)); }
|
||||
}
|
||||
|
||||
TEST(RunFloat64Expm1) {
|
||||
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
|
||||
m.Return(m.Float64Expm1(m.Parameter(0)));
|
||||
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
|
||||
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
|
||||
CHECK_EQ(-1.0, m.Call(-std::numeric_limits<double>::infinity()));
|
||||
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
|
||||
m.Call(std::numeric_limits<double>::infinity()));
|
||||
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::expm1(*i), m.Call(*i)); }
|
||||
}
|
||||
|
||||
TEST(RunFloat64Log) {
|
||||
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
|
||||
m.Return(m.Float64Log(m.Parameter(0)));
|
||||
@ -5588,6 +5611,18 @@ TEST(RunFloat64Log10) {
|
||||
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::log10(*i), m.Call(*i)); }
|
||||
}
|
||||
|
||||
TEST(RunFloat64Cbrt) {
|
||||
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
|
||||
m.Return(m.Float64Cbrt(m.Parameter(0)));
|
||||
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
|
||||
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
|
||||
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
|
||||
m.Call(std::numeric_limits<double>::infinity()));
|
||||
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(),
|
||||
m.Call(-std::numeric_limits<double>::infinity()));
|
||||
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ieee754::cbrt(*i), m.Call(*i)); }
|
||||
}
|
||||
|
||||
static double two_30 = 1 << 30; // 2^30 is a smi boundary.
|
||||
static double two_52 = two_30 * (1 << 22); // 2^52 is a precision boundary.
|
||||
static double kValues[] = {0.1,
|
||||
|
@ -54,6 +54,15 @@ TEST(Ieee754, Atan2) {
|
||||
-std::numeric_limits<double>::infinity()));
|
||||
}
|
||||
|
||||
TEST(Ieee754, Atanh) {
|
||||
EXPECT_THAT(atanh(std::numeric_limits<double>::quiet_NaN()), IsNaN());
|
||||
EXPECT_THAT(atanh(std::numeric_limits<double>::signaling_NaN()), IsNaN());
|
||||
EXPECT_THAT(atanh(std::numeric_limits<double>::infinity()), IsNaN());
|
||||
EXPECT_EQ(std::numeric_limits<double>::infinity(), atanh(1));
|
||||
EXPECT_EQ(-std::numeric_limits<double>::infinity(), atanh(-1));
|
||||
EXPECT_DOUBLE_EQ(0.54930614433405478, atanh(0.5));
|
||||
}
|
||||
|
||||
TEST(Ieee754, Exp) {
|
||||
EXPECT_THAT(exp(std::numeric_limits<double>::quiet_NaN()), IsNaN());
|
||||
EXPECT_THAT(exp(std::numeric_limits<double>::signaling_NaN()), IsNaN());
|
||||
@ -82,6 +91,20 @@ TEST(Ieee754, Exp) {
|
||||
exp(std::numeric_limits<double>::infinity()));
|
||||
}
|
||||
|
||||
TEST(Ieee754, Expm1) {
|
||||
EXPECT_THAT(expm1(std::numeric_limits<double>::quiet_NaN()), IsNaN());
|
||||
EXPECT_THAT(expm1(std::numeric_limits<double>::signaling_NaN()), IsNaN());
|
||||
EXPECT_EQ(-1.0, expm1(-std::numeric_limits<double>::infinity()));
|
||||
EXPECT_EQ(std::numeric_limits<double>::infinity(),
|
||||
expm1(std::numeric_limits<double>::infinity()));
|
||||
EXPECT_EQ(0.0, expm1(-0.0));
|
||||
EXPECT_EQ(0.0, expm1(0.0));
|
||||
EXPECT_EQ(1.718281828459045, expm1(1.0));
|
||||
EXPECT_EQ(2.6881171418161356e+43, expm1(100.0));
|
||||
EXPECT_EQ(8.218407461554972e+307, expm1(709.0));
|
||||
EXPECT_EQ(std::numeric_limits<double>::infinity(), expm1(710.0));
|
||||
}
|
||||
|
||||
TEST(Ieee754, Log) {
|
||||
EXPECT_THAT(log(std::numeric_limits<double>::quiet_NaN()), IsNaN());
|
||||
EXPECT_THAT(log(std::numeric_limits<double>::signaling_NaN()), IsNaN());
|
||||
@ -146,6 +169,18 @@ TEST(Ieee754, Log10) {
|
||||
EXPECT_EQ(-0.9083828622192334, log10(0.12348583358871));
|
||||
}
|
||||
|
||||
TEST(Ieee754, cbrt) {
|
||||
EXPECT_THAT(cbrt(std::numeric_limits<double>::quiet_NaN()), IsNaN());
|
||||
EXPECT_THAT(cbrt(std::numeric_limits<double>::signaling_NaN()), IsNaN());
|
||||
EXPECT_EQ(std::numeric_limits<double>::infinity(),
|
||||
cbrt(std::numeric_limits<double>::infinity()));
|
||||
EXPECT_EQ(-std::numeric_limits<double>::infinity(),
|
||||
cbrt(-std::numeric_limits<double>::infinity()));
|
||||
EXPECT_EQ(1.4422495703074083, cbrt(3));
|
||||
EXPECT_EQ(100, cbrt(100 * 100 * 100));
|
||||
EXPECT_EQ(46.415888336127786, cbrt(100000));
|
||||
}
|
||||
|
||||
} // namespace ieee754
|
||||
} // namespace base
|
||||
} // namespace v8
|
||||
|
@ -2311,9 +2311,11 @@ IS_UNOP_MATCHER(Float64RoundTiesAway)
|
||||
IS_UNOP_MATCHER(Float64ExtractLowWord32)
|
||||
IS_UNOP_MATCHER(Float64ExtractHighWord32)
|
||||
IS_UNOP_MATCHER(NumberAtan)
|
||||
IS_UNOP_MATCHER(NumberAtanh)
|
||||
IS_UNOP_MATCHER(NumberCeil)
|
||||
IS_UNOP_MATCHER(NumberClz32)
|
||||
IS_UNOP_MATCHER(NumberExp)
|
||||
IS_UNOP_MATCHER(NumberExpm1)
|
||||
IS_UNOP_MATCHER(NumberFloor)
|
||||
IS_UNOP_MATCHER(NumberFround)
|
||||
IS_UNOP_MATCHER(NumberLog)
|
||||
@ -2322,6 +2324,7 @@ IS_UNOP_MATCHER(NumberLog2)
|
||||
IS_UNOP_MATCHER(NumberLog10)
|
||||
IS_UNOP_MATCHER(NumberRound)
|
||||
IS_UNOP_MATCHER(NumberSqrt)
|
||||
IS_UNOP_MATCHER(NumberCbrt)
|
||||
IS_UNOP_MATCHER(NumberTrunc)
|
||||
IS_UNOP_MATCHER(NumberToInt32)
|
||||
IS_UNOP_MATCHER(NumberToUint32)
|
||||
|
@ -227,9 +227,11 @@ Matcher<Node*> IsNumberImul(const Matcher<Node*>& lhs_matcher,
|
||||
Matcher<Node*> IsNumberAtan(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberAtan2(const Matcher<Node*>& lhs_matcher,
|
||||
const Matcher<Node*>& rhs_matcher);
|
||||
Matcher<Node*> IsNumberAtanh(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberCeil(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberClz32(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberExp(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberExpm1(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberFloor(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberFround(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberLog(const Matcher<Node*>& value_matcher);
|
||||
@ -237,6 +239,7 @@ Matcher<Node*> IsNumberLog1p(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberLog2(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberLog10(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberRound(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberCbrt(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberSqrt(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsNumberTrunc(const Matcher<Node*>& value_matcher);
|
||||
Matcher<Node*> IsStringFromCharCode(const Matcher<Node*>& value_matcher);
|
||||
|
Loading…
Reference in New Issue
Block a user