зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 14c76164f4c2 - patch for bug 524346 caused test fails
This commit is contained in:
Родитель
9b985d2bb0
Коммит
4532c5ebba
|
@ -127,19 +127,19 @@ JS_Now()
|
||||||
JS_PUBLIC_API(jsval)
|
JS_PUBLIC_API(jsval)
|
||||||
JS_GetNaNValue(JSContext *cx)
|
JS_GetNaNValue(JSContext *cx)
|
||||||
{
|
{
|
||||||
return cx->runtime->NaNValue;
|
return DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(jsval)
|
JS_PUBLIC_API(jsval)
|
||||||
JS_GetNegativeInfinityValue(JSContext *cx)
|
JS_GetNegativeInfinityValue(JSContext *cx)
|
||||||
{
|
{
|
||||||
return cx->runtime->negativeInfinityValue;
|
return DOUBLE_TO_JSVAL(cx->runtime->jsNegativeInfinity);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(jsval)
|
JS_PUBLIC_API(jsval)
|
||||||
JS_GetPositiveInfinityValue(JSContext *cx)
|
JS_GetPositiveInfinityValue(JSContext *cx)
|
||||||
{
|
{
|
||||||
return cx->runtime->positiveInfinityValue;
|
return DOUBLE_TO_JSVAL(cx->runtime->jsPositiveInfinity);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_PUBLIC_API(jsval)
|
JS_PUBLIC_API(jsval)
|
||||||
|
|
|
@ -1708,11 +1708,11 @@ InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint count, jsva
|
||||||
|
|
||||||
JS_ASSERT(start == MAXINDEX);
|
JS_ASSERT(start == MAXINDEX);
|
||||||
jsval tmp[2] = {JSVAL_NULL, JSVAL_NULL};
|
jsval tmp[2] = {JSVAL_NULL, JSVAL_NULL};
|
||||||
JSAutoTempValueRooter tvr(cx, JS_ARRAY_LENGTH(tmp), tmp);
|
jsdouble* dp = js_NewWeaklyRootedDouble(cx, MAXINDEX);
|
||||||
if (!js_NewDoubleInRootedValue(cx, MAXINDEX, &tmp[0]))
|
if (!dp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
jsdouble *dp = JSVAL_TO_DOUBLE(tmp[0]);
|
tmp[0] = DOUBLE_TO_JSVAL(dp);
|
||||||
JS_ASSERT(*dp == MAXINDEX);
|
JSAutoTempValueRooter tvr(cx, JS_ARRAY_LENGTH(tmp), tmp);
|
||||||
JSAutoTempIdRooter idr(cx);
|
JSAutoTempIdRooter idr(cx);
|
||||||
do {
|
do {
|
||||||
tmp[1] = *vector++;
|
tmp[1] = *vector++;
|
||||||
|
|
|
@ -66,6 +66,8 @@
|
||||||
using namespace avmplus;
|
using namespace avmplus;
|
||||||
using namespace nanojit;
|
using namespace nanojit;
|
||||||
|
|
||||||
|
extern jsdouble js_NaN;
|
||||||
|
|
||||||
JS_FRIEND_API(void)
|
JS_FRIEND_API(void)
|
||||||
js_SetTraceableNativeFailed(JSContext *cx)
|
js_SetTraceableNativeFailed(JSContext *cx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -533,9 +533,9 @@ struct JSRuntime {
|
||||||
JSSetSlotRequest *setSlotRequests;
|
JSSetSlotRequest *setSlotRequests;
|
||||||
|
|
||||||
/* Well-known numbers held for use by this runtime's contexts. */
|
/* Well-known numbers held for use by this runtime's contexts. */
|
||||||
jsval NaNValue;
|
jsdouble *jsNaN;
|
||||||
jsval negativeInfinityValue;
|
jsdouble *jsNegativeInfinity;
|
||||||
jsval positiveInfinityValue;
|
jsdouble *jsPositiveInfinity;
|
||||||
|
|
||||||
#ifdef JS_THREADSAFE
|
#ifdef JS_THREADSAFE
|
||||||
JSLock *deflatedStringCacheLock;
|
JSLock *deflatedStringCacheLock;
|
||||||
|
|
|
@ -478,7 +478,7 @@ msFromTime(jsdouble t)
|
||||||
|
|
||||||
#define TIMECLIP(d) ((JSDOUBLE_IS_FINITE(d) \
|
#define TIMECLIP(d) ((JSDOUBLE_IS_FINITE(d) \
|
||||||
&& !((d < 0 ? -d : d) > HalfTimeDomain)) \
|
&& !((d < 0 ? -d : d) > HalfTimeDomain)) \
|
||||||
? js_DoubleToInteger(d + (+0.)) : js_NaN)
|
? js_DoubleToInteger(d + (+0.)) : *cx->runtime->jsNaN)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* end of ECMA 'support' functions
|
* end of ECMA 'support' functions
|
||||||
|
@ -595,7 +595,7 @@ date_msecFromArgs(JSContext *cx, uintN argc, jsval *argv, jsdouble *rval)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
/* return NaN if any arg is not finite */
|
/* return NaN if any arg is not finite */
|
||||||
if (!JSDOUBLE_IS_FINITE(d)) {
|
if (!JSDOUBLE_IS_FINITE(d)) {
|
||||||
*rval = js_NaN;
|
*rval = *cx->runtime->jsNaN;
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
array[loop] = js_DoubleToInteger(d);
|
array[loop] = js_DoubleToInteger(d);
|
||||||
|
@ -1164,16 +1164,16 @@ date_parse(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble result;
|
jsdouble result;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return true;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
str = js_ValueToString(cx, vp[2]);
|
str = js_ValueToString(cx, vp[2]);
|
||||||
if (!str)
|
if (!str)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
vp[2] = STRING_TO_JSVAL(str);
|
vp[2] = STRING_TO_JSVAL(str);
|
||||||
if (!date_parseString(str, &result)) {
|
if (!date_parseString(str, &result)) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return true;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = TIMECLIP(result);
|
result = TIMECLIP(result);
|
||||||
|
@ -1218,10 +1218,11 @@ SetDateToNaN(JSContext *cx, JSObject *obj, jsval *vp = NULL)
|
||||||
{
|
{
|
||||||
JS_ASSERT(OBJ_GET_CLASS(cx, obj) == &js_DateClass);
|
JS_ASSERT(OBJ_GET_CLASS(cx, obj) == &js_DateClass);
|
||||||
|
|
||||||
obj->fslots[JSSLOT_LOCAL_TIME] = cx->runtime->NaNValue;
|
jsval nan = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
obj->fslots[JSSLOT_UTC_TIME] = cx->runtime->NaNValue;
|
obj->fslots[JSSLOT_LOCAL_TIME] = nan;
|
||||||
|
obj->fslots[JSSLOT_UTC_TIME] = nan;
|
||||||
if (vp)
|
if (vp)
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = nan;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1232,7 +1233,7 @@ SetUTCTime(JSContext *cx, JSObject *obj, jsdouble t, jsval *vp = NULL)
|
||||||
{
|
{
|
||||||
JS_ASSERT(OBJ_GET_CLASS(cx, obj) == &js_DateClass);
|
JS_ASSERT(OBJ_GET_CLASS(cx, obj) == &js_DateClass);
|
||||||
|
|
||||||
obj->fslots[JSSLOT_LOCAL_TIME] = cx->runtime->NaNValue;
|
obj->fslots[JSSLOT_LOCAL_TIME] = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
if (!js_NewDoubleInRootedValue(cx, t, &obj->fslots[JSSLOT_UTC_TIME]))
|
if (!js_NewDoubleInRootedValue(cx, t, &obj->fslots[JSSLOT_UTC_TIME]))
|
||||||
return false;
|
return false;
|
||||||
if (vp)
|
if (vp)
|
||||||
|
@ -1247,24 +1248,33 @@ SetUTCTime(JSContext *cx, JSObject *obj, jsdouble t, jsval *vp = NULL)
|
||||||
static JSBool
|
static JSBool
|
||||||
GetAndCacheLocalTime(JSContext *cx, JSObject *obj, jsval *vp, jsdouble *dp)
|
GetAndCacheLocalTime(JSContext *cx, JSObject *obj, jsval *vp, jsdouble *dp)
|
||||||
{
|
{
|
||||||
if (!obj || !JS_InstanceOf(cx, obj, &js_DateClass, vp ? vp + 2 : NULL))
|
jsval v;
|
||||||
return false;
|
jsdouble result;
|
||||||
|
jsdouble *cached;
|
||||||
|
|
||||||
|
if (!obj || !JS_InstanceOf(cx, obj, &js_DateClass, vp ? vp + 2 : NULL))
|
||||||
|
return JS_FALSE;
|
||||||
|
v = obj->fslots[JSSLOT_LOCAL_TIME];
|
||||||
|
|
||||||
|
result = *JSVAL_TO_DOUBLE(v);
|
||||||
|
|
||||||
jsval *slotp = &obj->fslots[JSSLOT_LOCAL_TIME];
|
|
||||||
jsdouble result = *JSVAL_TO_DOUBLE(*vp);
|
|
||||||
if (JSDOUBLE_IS_NaN(result)) {
|
if (JSDOUBLE_IS_NaN(result)) {
|
||||||
result = *JSVAL_TO_DOUBLE(obj->fslots[JSSLOT_UTC_TIME]);
|
if (!GetUTCTime(cx, obj, vp, &result))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
/* if result is NaN, it couldn't be finite. */
|
/* if result is NaN, it couldn't be finite. */
|
||||||
if (JSDOUBLE_IS_FINITE(result))
|
if (JSDOUBLE_IS_FINITE(result))
|
||||||
result = LocalTime(result);
|
result = LocalTime(result);
|
||||||
|
|
||||||
if (!js_NewDoubleInRootedValue(cx, result, slotp))
|
cached = js_NewWeaklyRootedDouble(cx, result);
|
||||||
return false;
|
if (!cached)
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
obj->fslots[JSSLOT_LOCAL_TIME] = DOUBLE_TO_JSVAL(cached);
|
||||||
}
|
}
|
||||||
|
|
||||||
*dp = result;
|
*dp = result;
|
||||||
return true;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -56,6 +56,8 @@
|
||||||
#include "jslibmath.h"
|
#include "jslibmath.h"
|
||||||
#include "jsobj.h"
|
#include "jsobj.h"
|
||||||
|
|
||||||
|
extern jsdouble js_NaN;
|
||||||
|
|
||||||
#ifndef M_E
|
#ifndef M_E
|
||||||
#define M_E 2.7182818284590452354
|
#define M_E 2.7182818284590452354
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,7 +109,7 @@ math_abs(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -123,7 +125,7 @@ math_acos(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -131,7 +133,7 @@ math_acos(JSContext *cx, uintN argc, jsval *vp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
#if defined(SOLARIS) && defined(__GNUC__)
|
#if defined(SOLARIS) && defined(__GNUC__)
|
||||||
if (x < -1 || 1 < x) {
|
if (x < -1 || 1 < x) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,7 +147,7 @@ math_asin(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -153,7 +155,7 @@ math_asin(JSContext *cx, uintN argc, jsval *vp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
#if defined(SOLARIS) && defined(__GNUC__)
|
#if defined(SOLARIS) && defined(__GNUC__)
|
||||||
if (x < -1 || 1 < x) {
|
if (x < -1 || 1 < x) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -167,7 +169,7 @@ math_atan(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -213,7 +215,7 @@ math_atan2(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, y;
|
jsdouble x, y;
|
||||||
|
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -241,7 +243,7 @@ js_math_ceil(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -257,7 +259,7 @@ math_cos(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -273,7 +275,7 @@ math_exp(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -281,11 +283,11 @@ math_exp(JSContext *cx, uintN argc, jsval *vp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (!JSDOUBLE_IS_NaN(x)) {
|
if (!JSDOUBLE_IS_NaN(x)) {
|
||||||
if (x == js_PositiveInfinity) {
|
if (x == *cx->runtime->jsPositiveInfinity) {
|
||||||
*vp = cx->runtime->positiveInfinityValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsPositiveInfinity);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
if (x == js_NegativeInfinity) {
|
if (x == *cx->runtime->jsNegativeInfinity) {
|
||||||
*vp = JSVAL_ZERO;
|
*vp = JSVAL_ZERO;
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +303,7 @@ js_math_floor(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -317,7 +319,7 @@ math_log(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -325,7 +327,7 @@ math_log(JSContext *cx, uintN argc, jsval *vp)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
#if defined(SOLARIS) && defined(__GNUC__)
|
#if defined(SOLARIS) && defined(__GNUC__)
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -336,12 +338,12 @@ math_log(JSContext *cx, uintN argc, jsval *vp)
|
||||||
JSBool
|
JSBool
|
||||||
js_math_max(JSContext *cx, uintN argc, jsval *vp)
|
js_math_max(JSContext *cx, uintN argc, jsval *vp)
|
||||||
{
|
{
|
||||||
jsdouble x, z = js_NegativeInfinity;
|
jsdouble x, z = *cx->runtime->jsNegativeInfinity;
|
||||||
jsval *argv;
|
jsval *argv;
|
||||||
uintN i;
|
uintN i;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->negativeInfinityValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNegativeInfinity);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
argv = vp + 2;
|
argv = vp + 2;
|
||||||
|
@ -350,7 +352,7 @@ js_math_max(JSContext *cx, uintN argc, jsval *vp)
|
||||||
if (JSVAL_IS_NULL(argv[i]))
|
if (JSVAL_IS_NULL(argv[i]))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
if (JSDOUBLE_IS_NaN(x)) {
|
if (JSDOUBLE_IS_NaN(x)) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
if (x == 0 && x == z) {
|
if (x == 0 && x == z) {
|
||||||
|
@ -366,12 +368,12 @@ js_math_max(JSContext *cx, uintN argc, jsval *vp)
|
||||||
JSBool
|
JSBool
|
||||||
js_math_min(JSContext *cx, uintN argc, jsval *vp)
|
js_math_min(JSContext *cx, uintN argc, jsval *vp)
|
||||||
{
|
{
|
||||||
jsdouble x, z = js_PositiveInfinity;
|
jsdouble x, z = *cx->runtime->jsPositiveInfinity;
|
||||||
jsval *argv;
|
jsval *argv;
|
||||||
uintN i;
|
uintN i;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->positiveInfinityValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsPositiveInfinity);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
argv = vp + 2;
|
argv = vp + 2;
|
||||||
|
@ -380,7 +382,7 @@ js_math_min(JSContext *cx, uintN argc, jsval *vp)
|
||||||
if (JSVAL_IS_NULL(argv[i]))
|
if (JSVAL_IS_NULL(argv[i]))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
if (JSDOUBLE_IS_NaN(x)) {
|
if (JSDOUBLE_IS_NaN(x)) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
if (x == 0 && x == z) {
|
if (x == 0 && x == z) {
|
||||||
|
@ -399,7 +401,7 @@ math_pow(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, y, z;
|
jsdouble x, y, z;
|
||||||
|
|
||||||
if (argc <= 1) {
|
if (argc <= 1) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -413,7 +415,7 @@ math_pow(JSContext *cx, uintN argc, jsval *vp)
|
||||||
* we need to wrap the libm call to make it ECMA compliant.
|
* we need to wrap the libm call to make it ECMA compliant.
|
||||||
*/
|
*/
|
||||||
if (!JSDOUBLE_IS_FINITE(y) && (x == 1.0 || x == -1.0)) {
|
if (!JSDOUBLE_IS_FINITE(y) && (x == 1.0 || x == -1.0)) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
/* pow(x, +-0) is always 1, even for x = NaN. */
|
/* pow(x, +-0) is always 1, even for x = NaN. */
|
||||||
|
@ -490,7 +492,7 @@ js_math_round(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -506,7 +508,7 @@ math_sin(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -522,7 +524,7 @@ math_sqrt(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -538,7 +540,7 @@ math_tan(JSContext *cx, uintN argc, jsval *vp)
|
||||||
jsdouble x, z;
|
jsdouble x, z;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
x = js_ValueToNumber(cx, &vp[2]);
|
x = js_ValueToNumber(cx, &vp[2]);
|
||||||
|
@ -600,10 +602,12 @@ static jsdouble FASTCALL
|
||||||
math_exp_tn(JSContext *cx, jsdouble d)
|
math_exp_tn(JSContext *cx, jsdouble d)
|
||||||
{
|
{
|
||||||
if (!JSDOUBLE_IS_NaN(d)) {
|
if (!JSDOUBLE_IS_NaN(d)) {
|
||||||
if (d == js_PositiveInfinity)
|
if (d == *cx->runtime->jsPositiveInfinity) {
|
||||||
return js_PositiveInfinity;
|
return *cx->runtime->jsPositiveInfinity;
|
||||||
if (d == js_NegativeInfinity)
|
}
|
||||||
|
if (d == *cx->runtime->jsNegativeInfinity) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return exp(d);
|
return exp(d);
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ num_parseFloat(JSContext *cx, uintN argc, jsval *vp)
|
||||||
const jschar *bp, *end, *ep;
|
const jschar *bp, *end, *ep;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
str = js_ValueToString(cx, vp[2]);
|
str = js_ValueToString(cx, vp[2]);
|
||||||
|
@ -151,7 +151,7 @@ num_parseFloat(JSContext *cx, uintN argc, jsval *vp)
|
||||||
if (!js_strtod(cx, bp, end, &ep, &d))
|
if (!js_strtod(cx, bp, end, &ep, &d))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
if (ep == bp) {
|
if (ep == bp) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
return js_NewNumberInRootedValue(cx, d, vp);
|
return js_NewNumberInRootedValue(cx, d, vp);
|
||||||
|
@ -183,7 +183,7 @@ num_parseInt(JSContext *cx, uintN argc, jsval *vp)
|
||||||
const jschar *bp, *end, *ep;
|
const jschar *bp, *end, *ep;
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -194,7 +194,7 @@ num_parseInt(JSContext *cx, uintN argc, jsval *vp)
|
||||||
radix = 0;
|
radix = 0;
|
||||||
}
|
}
|
||||||
if (radix != 0 && (radix < 2 || radix > 36)) {
|
if (radix != 0 && (radix < 2 || radix > 36)) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ num_parseInt(JSContext *cx, uintN argc, jsval *vp)
|
||||||
if (!js_strtointeger(cx, bp, end, &ep, radix, &d))
|
if (!js_strtointeger(cx, bp, end, &ep, radix, &d))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
if (ep == bp) {
|
if (ep == bp) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
return js_NewNumberInRootedValue(cx, d, vp);
|
return js_NewNumberInRootedValue(cx, d, vp);
|
||||||
|
@ -669,8 +669,7 @@ static JSConstDoubleSpec number_constants[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
jsdouble js_NaN;
|
jsdouble js_NaN;
|
||||||
jsdouble js_PositiveInfinity;
|
|
||||||
jsdouble js_NegativeInfinity;
|
|
||||||
|
|
||||||
#if (defined __GNUC__ && defined __i386__)
|
#if (defined __GNUC__ && defined __i386__)
|
||||||
|
|
||||||
|
@ -695,37 +694,41 @@ inline void FIX_FPU() {
|
||||||
JSBool
|
JSBool
|
||||||
js_InitRuntimeNumberState(JSContext *cx)
|
js_InitRuntimeNumberState(JSContext *cx)
|
||||||
{
|
{
|
||||||
JS_STATIC_ASSERT(JSVAL_NULL == jsval(0));
|
JSRuntime *rt;
|
||||||
|
jsdpun u;
|
||||||
|
struct lconv *locale;
|
||||||
|
|
||||||
JSRuntime *rt = cx->runtime;
|
rt = cx->runtime;
|
||||||
JS_ASSERT(JSVAL_IS_NULL(rt->NaNValue));
|
JS_ASSERT(!rt->jsNaN);
|
||||||
|
|
||||||
FIX_FPU();
|
FIX_FPU();
|
||||||
|
|
||||||
jsdpun u;
|
|
||||||
u.s.hi = JSDOUBLE_HI32_EXPMASK | JSDOUBLE_HI32_MANTMASK;
|
u.s.hi = JSDOUBLE_HI32_EXPMASK | JSDOUBLE_HI32_MANTMASK;
|
||||||
u.s.lo = 0xffffffff;
|
u.s.lo = 0xffffffff;
|
||||||
number_constants[NC_NaN].dval = js_NaN = u.d;
|
number_constants[NC_NaN].dval = js_NaN = u.d;
|
||||||
if (!js_NewDoubleInRootedValue(cx, u.d, &rt->NaNValue))
|
rt->jsNaN = js_NewWeaklyRootedDouble(cx, js_NaN);
|
||||||
return false;
|
if (!rt->jsNaN)
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
u.s.hi = JSDOUBLE_HI32_EXPMASK;
|
u.s.hi = JSDOUBLE_HI32_EXPMASK;
|
||||||
u.s.lo = 0x00000000;
|
u.s.lo = 0x00000000;
|
||||||
number_constants[NC_POSITIVE_INFINITY].dval = js_PositiveInfinity = u.d;
|
number_constants[NC_POSITIVE_INFINITY].dval = u.d;
|
||||||
if (!js_NewDoubleInRootedValue(cx, u.d, &rt->positiveInfinityValue))
|
rt->jsPositiveInfinity = js_NewWeaklyRootedDouble(cx, u.d);
|
||||||
return false;
|
if (!rt->jsPositiveInfinity)
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
u.s.hi = JSDOUBLE_HI32_SIGNBIT | JSDOUBLE_HI32_EXPMASK;
|
u.s.hi = JSDOUBLE_HI32_SIGNBIT | JSDOUBLE_HI32_EXPMASK;
|
||||||
u.s.lo = 0x00000000;
|
u.s.lo = 0x00000000;
|
||||||
number_constants[NC_NEGATIVE_INFINITY].dval = js_NegativeInfinity = u.d;
|
number_constants[NC_NEGATIVE_INFINITY].dval = u.d;
|
||||||
if (!js_NewDoubleInRootedValue(cx, u.d, &rt->negativeInfinityValue))
|
rt->jsNegativeInfinity = js_NewWeaklyRootedDouble(cx, u.d);
|
||||||
return false;
|
if (!rt->jsNegativeInfinity)
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
u.s.hi = 0;
|
u.s.hi = 0;
|
||||||
u.s.lo = 1;
|
u.s.lo = 1;
|
||||||
number_constants[NC_MIN_VALUE].dval = u.d;
|
number_constants[NC_MIN_VALUE].dval = u.d;
|
||||||
|
|
||||||
struct lconv *locale = localeconv();
|
locale = localeconv();
|
||||||
rt->thousandsSeparator =
|
rt->thousandsSeparator =
|
||||||
JS_strdup(cx, locale->thousands_sep ? locale->thousands_sep : "'");
|
JS_strdup(cx, locale->thousands_sep ? locale->thousands_sep : "'");
|
||||||
rt->decimalSeparator =
|
rt->decimalSeparator =
|
||||||
|
@ -739,18 +742,15 @@ js_InitRuntimeNumberState(JSContext *cx)
|
||||||
void
|
void
|
||||||
js_TraceRuntimeNumberState(JSTracer *trc)
|
js_TraceRuntimeNumberState(JSTracer *trc)
|
||||||
{
|
{
|
||||||
JSRuntime *rt = trc->context->runtime;
|
JSRuntime *rt;
|
||||||
|
|
||||||
if (!JSVAL_IS_NULL(rt->NaNValue))
|
rt = trc->context->runtime;
|
||||||
JS_CALL_DOUBLE_TRACER(trc, JSVAL_TO_DOUBLE(rt->NaNValue), "NaN");
|
if (rt->jsNaN)
|
||||||
if (!JSVAL_IS_NULL(rt->positiveInfinityValue)) {
|
JS_CALL_DOUBLE_TRACER(trc, rt->jsNaN, "NaN");
|
||||||
JS_CALL_DOUBLE_TRACER(trc, JSVAL_TO_DOUBLE(rt->positiveInfinityValue),
|
if (rt->jsPositiveInfinity)
|
||||||
"+Infinity");
|
JS_CALL_DOUBLE_TRACER(trc, rt->jsPositiveInfinity, "+Infinity");
|
||||||
}
|
if (rt->jsNegativeInfinity)
|
||||||
if (!JSVAL_IS_NULL(rt->negativeInfinityValue)) {
|
JS_CALL_DOUBLE_TRACER(trc, rt->jsNegativeInfinity, "-Infinity");
|
||||||
JS_CALL_DOUBLE_TRACER(trc, JSVAL_TO_DOUBLE(rt->negativeInfinityValue),
|
|
||||||
"-Infinity");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -758,13 +758,13 @@ js_FinishRuntimeNumberState(JSContext *cx)
|
||||||
{
|
{
|
||||||
JSRuntime *rt = cx->runtime;
|
JSRuntime *rt = cx->runtime;
|
||||||
|
|
||||||
rt->NaNValue = JSVAL_NULL;
|
rt->jsNaN = NULL;
|
||||||
rt->negativeInfinityValue = JSVAL_NULL;
|
rt->jsNegativeInfinity = NULL;
|
||||||
rt->positiveInfinityValue = JSVAL_NULL;
|
rt->jsPositiveInfinity = NULL;
|
||||||
|
|
||||||
cx->free((void *) rt->thousandsSeparator);
|
cx->free((void *)rt->thousandsSeparator);
|
||||||
cx->free((void *) rt->decimalSeparator);
|
cx->free((void *)rt->decimalSeparator);
|
||||||
cx->free((void *) rt->numGrouping);
|
cx->free((void *)rt->numGrouping);
|
||||||
rt->thousandsSeparator = rt->decimalSeparator = rt->numGrouping = NULL;
|
rt->thousandsSeparator = rt->decimalSeparator = rt->numGrouping = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -790,13 +790,14 @@ js_InitNumberClass(JSContext *cx, JSObject *obj)
|
||||||
|
|
||||||
/* ECMA 15.1.1.1 */
|
/* ECMA 15.1.1.1 */
|
||||||
rt = cx->runtime;
|
rt = cx->runtime;
|
||||||
if (!JS_DefineProperty(cx, obj, js_NaN_str, rt->NaNValue,
|
if (!JS_DefineProperty(cx, obj, js_NaN_str, DOUBLE_TO_JSVAL(rt->jsNaN),
|
||||||
NULL, NULL, JSPROP_PERMANENT)) {
|
NULL, NULL, JSPROP_PERMANENT)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ECMA 15.1.1.2 */
|
/* ECMA 15.1.1.2 */
|
||||||
if (!JS_DefineProperty(cx, obj, js_Infinity_str, rt->positiveInfinityValue,
|
if (!JS_DefineProperty(cx, obj, js_Infinity_str,
|
||||||
|
DOUBLE_TO_JSVAL(rt->jsPositiveInfinity),
|
||||||
NULL, NULL, JSPROP_PERMANENT)) {
|
NULL, NULL, JSPROP_PERMANENT)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -941,7 +942,7 @@ js_ValueToNumber(JSContext *cx, jsval *vp)
|
||||||
jsval v;
|
jsval v;
|
||||||
JSString *str;
|
JSString *str;
|
||||||
const jschar *bp, *end, *ep;
|
const jschar *bp, *end, *ep;
|
||||||
jsdouble d;
|
jsdouble d, *dp;
|
||||||
JSObject *obj;
|
JSObject *obj;
|
||||||
|
|
||||||
v = *vp;
|
v = *vp;
|
||||||
|
@ -1019,8 +1020,9 @@ js_ValueToNumber(JSContext *cx, jsval *vp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*vp = cx->runtime->NaNValue;
|
dp = cx->runtime->jsNaN;
|
||||||
return js_NaN;
|
*vp = DOUBLE_TO_JSVAL(dp);
|
||||||
|
return *dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
|
@ -1191,15 +1193,15 @@ js_strtod(JSContext *cx, const jschar *s, const jschar *send,
|
||||||
if ((negative = (*istr == '-')) != 0 || *istr == '+')
|
if ((negative = (*istr == '-')) != 0 || *istr == '+')
|
||||||
istr++;
|
istr++;
|
||||||
if (*istr == 'I' && !strncmp(istr, js_Infinity_str, sizeof js_Infinity_str - 1)) {
|
if (*istr == 'I' && !strncmp(istr, js_Infinity_str, sizeof js_Infinity_str - 1)) {
|
||||||
d = negative ? js_NegativeInfinity : js_PositiveInfinity;
|
d = *(negative ? cx->runtime->jsNegativeInfinity : cx->runtime->jsPositiveInfinity);
|
||||||
estr = istr + 8;
|
estr = istr + 8;
|
||||||
} else {
|
} else {
|
||||||
int err;
|
int err;
|
||||||
d = JS_strtod(cstr, &estr, &err);
|
d = JS_strtod(cstr, &estr, &err);
|
||||||
if (d == HUGE_VAL)
|
if (d == HUGE_VAL)
|
||||||
d = js_PositiveInfinity;
|
d = *cx->runtime->jsPositiveInfinity;
|
||||||
else if (d == -HUGE_VAL)
|
else if (d == -HUGE_VAL)
|
||||||
d = js_NegativeInfinity;
|
d = *cx->runtime->jsNegativeInfinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = estr - cstr;
|
i = estr - cstr;
|
||||||
|
@ -1334,7 +1336,7 @@ js_strtointeger(JSContext *cx, const jschar *s, const jschar *send,
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
if (err == JS_DTOA_ERANGE && value == HUGE_VAL)
|
if (err == JS_DTOA_ERANGE && value == HUGE_VAL)
|
||||||
value = js_PositiveInfinity;
|
value = *cx->runtime->jsPositiveInfinity;
|
||||||
cx->free(cstr);
|
cx->free(cstr);
|
||||||
} else if ((base & (base - 1)) == 0) {
|
} else if ((base & (base - 1)) == 0) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -169,8 +169,6 @@ JS_HASH_DOUBLE(jsdouble d)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern jsdouble js_NaN;
|
extern jsdouble js_NaN;
|
||||||
extern jsdouble js_PositiveInfinity;
|
|
||||||
extern jsdouble js_NegativeInfinity;
|
|
||||||
|
|
||||||
/* Initialize number constants and runtime state for the first context. */
|
/* Initialize number constants and runtime state for the first context. */
|
||||||
extern JSBool
|
extern JSBool
|
||||||
|
|
|
@ -1095,15 +1095,15 @@ BEGIN_CASE(JSOP_DIV)
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
/* XXX MSVC miscompiles such that (NaN == 0) */
|
/* XXX MSVC miscompiles such that (NaN == 0) */
|
||||||
if (JSDOUBLE_IS_NaN(d2))
|
if (JSDOUBLE_IS_NaN(d2))
|
||||||
rval = rt->NaNValue;
|
rval = DOUBLE_TO_JSVAL(rt->jsNaN);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (d == 0 || JSDOUBLE_IS_NaN(d))
|
if (d == 0 || JSDOUBLE_IS_NaN(d))
|
||||||
rval = rt->NaNValue;
|
rval = DOUBLE_TO_JSVAL(rt->jsNaN);
|
||||||
else if (JSDOUBLE_IS_NEG(d) != JSDOUBLE_IS_NEG(d2))
|
else if (JSDOUBLE_IS_NEG(d) != JSDOUBLE_IS_NEG(d2))
|
||||||
rval = rt->negativeInfinityValue;
|
rval = DOUBLE_TO_JSVAL(rt->jsNegativeInfinity);
|
||||||
else
|
else
|
||||||
rval = rt->positiveInfinityValue;
|
rval = DOUBLE_TO_JSVAL(rt->jsPositiveInfinity);
|
||||||
STORE_OPND(-1, rval);
|
STORE_OPND(-1, rval);
|
||||||
} else {
|
} else {
|
||||||
d /= d2;
|
d /= d2;
|
||||||
|
@ -1116,7 +1116,7 @@ BEGIN_CASE(JSOP_MOD)
|
||||||
FETCH_NUMBER(cx, -2, d);
|
FETCH_NUMBER(cx, -2, d);
|
||||||
regs.sp--;
|
regs.sp--;
|
||||||
if (d2 == 0) {
|
if (d2 == 0) {
|
||||||
STORE_OPND(-1, rt->NaNValue);
|
STORE_OPND(-1, DOUBLE_TO_JSVAL(rt->jsNaN));
|
||||||
} else {
|
} else {
|
||||||
d = js_fmod(d, d2);
|
d = js_fmod(d, d2);
|
||||||
STORE_NUMBER(cx, -1, d);
|
STORE_NUMBER(cx, -1, d);
|
||||||
|
|
|
@ -8449,15 +8449,15 @@ FoldBinaryNumeric(JSContext *cx, JSOp op, JSParseNode *pn1, JSParseNode *pn2,
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
/* XXX MSVC miscompiles such that (NaN == 0) */
|
/* XXX MSVC miscompiles such that (NaN == 0) */
|
||||||
if (JSDOUBLE_IS_NaN(d2))
|
if (JSDOUBLE_IS_NaN(d2))
|
||||||
d = js_NaN;
|
d = *cx->runtime->jsNaN;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (d == 0 || JSDOUBLE_IS_NaN(d))
|
if (d == 0 || JSDOUBLE_IS_NaN(d))
|
||||||
d = js_NaN;
|
d = *cx->runtime->jsNaN;
|
||||||
else if (JSDOUBLE_IS_NEG(d) != JSDOUBLE_IS_NEG(d2))
|
else if (JSDOUBLE_IS_NEG(d) != JSDOUBLE_IS_NEG(d2))
|
||||||
d = js_NegativeInfinity;
|
d = *cx->runtime->jsNegativeInfinity;
|
||||||
else
|
else
|
||||||
d = js_PositiveInfinity;
|
d = *cx->runtime->jsPositiveInfinity;
|
||||||
} else {
|
} else {
|
||||||
d /= d2;
|
d /= d2;
|
||||||
}
|
}
|
||||||
|
@ -8465,7 +8465,7 @@ FoldBinaryNumeric(JSContext *cx, JSOp op, JSParseNode *pn1, JSParseNode *pn2,
|
||||||
|
|
||||||
case JSOP_MOD:
|
case JSOP_MOD:
|
||||||
if (d2 == 0) {
|
if (d2 == 0) {
|
||||||
d = js_NaN;
|
d = *cx->runtime->jsNaN;
|
||||||
} else {
|
} else {
|
||||||
d = js_fmod(d, d2);
|
d = js_fmod(d, d2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1004,6 +1004,7 @@ out_of_range:
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef JS_TRACER
|
#ifdef JS_TRACER
|
||||||
|
extern jsdouble js_NaN;
|
||||||
|
|
||||||
jsdouble FASTCALL
|
jsdouble FASTCALL
|
||||||
js_String_p_charCodeAt(JSString* str, jsdouble d)
|
js_String_p_charCodeAt(JSString* str, jsdouble d)
|
||||||
|
|
|
@ -8659,7 +8659,7 @@ TraceRecorder::equalityHelper(jsval l, jsval r, LIns* l_ins, LIns* r_ins,
|
||||||
args[0] = l_ins, args[1] = cx_ins;
|
args[0] = l_ins, args[1] = cx_ins;
|
||||||
l_ins = lir->insCall(&js_BooleanOrUndefinedToNumber_ci, args);
|
l_ins = lir->insCall(&js_BooleanOrUndefinedToNumber_ci, args);
|
||||||
l = (l == JSVAL_VOID)
|
l = (l == JSVAL_VOID)
|
||||||
? cx->runtime->NaNValue
|
? DOUBLE_TO_JSVAL(cx->runtime->jsNaN)
|
||||||
: INT_TO_JSVAL(l == JSVAL_TRUE);
|
: INT_TO_JSVAL(l == JSVAL_TRUE);
|
||||||
return equalityHelper(l, r, l_ins, r_ins, negate,
|
return equalityHelper(l, r, l_ins, r_ins, negate,
|
||||||
tryBranchAfterCond, rval);
|
tryBranchAfterCond, rval);
|
||||||
|
@ -8673,7 +8673,7 @@ TraceRecorder::equalityHelper(jsval l, jsval r, LIns* l_ins, LIns* r_ins,
|
||||||
args[0] = r_ins, args[1] = cx_ins;
|
args[0] = r_ins, args[1] = cx_ins;
|
||||||
r_ins = lir->insCall(&js_BooleanOrUndefinedToNumber_ci, args);
|
r_ins = lir->insCall(&js_BooleanOrUndefinedToNumber_ci, args);
|
||||||
r = (r == JSVAL_VOID)
|
r = (r == JSVAL_VOID)
|
||||||
? cx->runtime->NaNValue
|
? DOUBLE_TO_JSVAL(cx->runtime->jsNaN)
|
||||||
: INT_TO_JSVAL(r == JSVAL_TRUE);
|
: INT_TO_JSVAL(r == JSVAL_TRUE);
|
||||||
return equalityHelper(l, r, l_ins, r_ins, negate,
|
return equalityHelper(l, r, l_ins, r_ins, negate,
|
||||||
tryBranchAfterCond, rval);
|
tryBranchAfterCond, rval);
|
||||||
|
|
|
@ -5578,7 +5578,7 @@ xml_childIndex(JSContext *cx, uintN argc, jsval *vp)
|
||||||
NON_LIST_XML_METHOD_PROLOG;
|
NON_LIST_XML_METHOD_PROLOG;
|
||||||
parent = xml->parent;
|
parent = xml->parent;
|
||||||
if (!parent || xml->xml_class == JSXML_CLASS_ATTRIBUTE) {
|
if (!parent || xml->xml_class == JSXML_CLASS_ATTRIBUTE) {
|
||||||
*vp = cx->runtime->NaNValue;
|
*vp = DOUBLE_TO_JSVAL(cx->runtime->jsNaN);
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
for (i = 0, n = JSXML_LENGTH(parent); i < n; i++) {
|
for (i = 0, n = JSXML_LENGTH(parent); i < n; i++) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче