зеркало из https://github.com/mozilla/gecko-dev.git
Bug 414531: The return value of some of math method of javascript is not IEEE standard on solaris, patch by Leon Sha <leon.sha@gmail.com>, r=brendan, a=damon
This commit is contained in:
Родитель
070f1a01b7
Коммит
69cf3bd0cb
|
@ -2410,12 +2410,12 @@ dnl the qsort routine under solaris is faulty
|
|||
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
|
||||
|
||||
if test "$CPU_ARCH" != "sparc"; then
|
||||
CFLAGS="$CFLAGS -xstrconst -xbuiltin=%all"
|
||||
CXXFLAGS="$CXXFLAGS -xbuiltin=%all -features=tmplife -norunpath"
|
||||
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
|
||||
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife -norunpath"
|
||||
else
|
||||
# Do not use -xbuiltin on SPARC to get around a bug of compiler
|
||||
CFLAGS="$CFLAGS -xstrconst -xbuiltin=%none"
|
||||
CXXFLAGS="$CXXFLAGS -xbuiltin=%none -features=tmplife -norunpath"
|
||||
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%none"
|
||||
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%none -features=tmplife -norunpath"
|
||||
fi
|
||||
|
||||
LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
|
||||
|
|
|
@ -120,6 +120,12 @@ math_acos(JSContext *cx, uintN argc, jsval *vp)
|
|||
x = js_ValueToNumber(cx, &vp[2]);
|
||||
if (JSVAL_IS_NULL(vp[2]))
|
||||
return JS_FALSE;
|
||||
#if !JS_USE_FDLIBM_MATH && defined(SOLARIS) && defined(__GNUC__)
|
||||
if (x < -1 || 1 < x) {
|
||||
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
z = fd_acos(x);
|
||||
return js_NewNumberInRootedValue(cx, z, vp);
|
||||
}
|
||||
|
@ -132,6 +138,12 @@ math_asin(JSContext *cx, uintN argc, jsval *vp)
|
|||
x = js_ValueToNumber(cx, &vp[2]);
|
||||
if (JSVAL_IS_NULL(vp[2]))
|
||||
return JS_FALSE;
|
||||
#if !JS_USE_FDLIBM_MATH && defined(SOLARIS) && defined(__GNUC__)
|
||||
if (x < -1 || 1 < x) {
|
||||
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
z = fd_asin(x);
|
||||
return js_NewNumberInRootedValue(cx, z, vp);
|
||||
}
|
||||
|
@ -174,6 +186,19 @@ math_atan2(JSContext *cx, uintN argc, jsval *vp)
|
|||
return js_NewDoubleInRootedValue(cx, z, vp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !JS_USE_FDLIBM_MATH && defined(SOLARIS) && defined(__GNUC__)
|
||||
if (x == 0) {
|
||||
if (JSDOUBLE_IS_NEGZERO(y)) {
|
||||
z = fd_copysign(M_PI, x);
|
||||
return js_NewDoubleInRootedValue(cx, z, vp);
|
||||
}
|
||||
if (y == 0) {
|
||||
z = x;
|
||||
return js_NewDoubleInRootedValue(cx, z, vp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
z = fd_atan2(x, y);
|
||||
return js_NewNumberInRootedValue(cx, z, vp);
|
||||
}
|
||||
|
@ -246,6 +271,12 @@ math_log(JSContext *cx, uintN argc, jsval *vp)
|
|||
x = js_ValueToNumber(cx, &vp[2]);
|
||||
if (JSVAL_IS_NULL(vp[2]))
|
||||
return JS_FALSE;
|
||||
#if !JS_USE_FDLIBM_MATH && defined(SOLARIS) && defined(__GNUC__)
|
||||
if (x < 0) {
|
||||
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||
return JS_TRUE;
|
||||
}
|
||||
#endif
|
||||
z = fd_log(x);
|
||||
return js_NewNumberInRootedValue(cx, z, vp);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче