Bug 579647 - use canonical nan in js_dmod (r=dvander)

This commit is contained in:
Luke Wagner 2010-07-19 11:28:13 -07:00
parent 8c1b9cb83f
commit 015cd3448d
6 changed files with 27 additions and 12 deletions

View File

@ -85,8 +85,8 @@ js_dmod(jsdouble a, jsdouble b)
{
if (b == 0.0) {
jsdpun u;
u.s.hi = JSDOUBLE_HI32_EXPMASK | JSDOUBLE_HI32_MANTMASK;
u.s.lo = 0xffffffff;
u.s.hi = JSDOUBLE_HI32_NAN;
u.s.lo = JSDOUBLE_LO32_NAN;
return u.d;
}
return js_fmod(a, b);

View File

@ -677,8 +677,8 @@ js_InitRuntimeNumberState(JSContext *cx)
FIX_FPU();
jsdpun u;
u.s.hi = 0x7ff80000;
u.s.lo = 0x00000000;
u.s.hi = JSDOUBLE_HI32_NAN;
u.s.lo = JSDOUBLE_LO32_NAN;
number_constants[NC_NaN].dval = js_NaN = u.d;
rt->NaNValue.setDouble(u.d);

View File

@ -121,6 +121,8 @@ JSDOUBLE_IS_INFINITE(jsdouble d)
#define JSDOUBLE_HI32_SIGNBIT 0x80000000
#define JSDOUBLE_HI32_EXPMASK 0x7ff00000
#define JSDOUBLE_HI32_MANTMASK 0x000fffff
#define JSDOUBLE_HI32_NAN 0x7ff80000
#define JSDOUBLE_LO32_NAN 0x00000000
static inline bool
JSDOUBLE_IS_NEG(jsdouble d)

View File

@ -518,13 +518,13 @@ JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
}
enum XDRValueTag {
XDRTAG_OBJECT = 0x0,
XDRTAG_INT = 0x1,
XDRTAG_DOUBLE = 0x2,
XDRTAG_STRING = 0x4,
XDRTAG_SPECIAL = 0x6,
XDRTAG_XDRNULL = 0x8,
XDRTAG_XDRVOID = 0xA
XDRTAG_OBJECT = 0,
XDRTAG_INT = 1,
XDRTAG_DOUBLE = 2,
XDRTAG_STRING = 3,
XDRTAG_SPECIAL = 4,
XDRTAG_XDRNULL = 5,
XDRTAG_XDRVOID = 6
};
static XDRValueTag

View File

@ -205,7 +205,7 @@ JS_XDRFindClassById(JSXDRState *xdr, uint32 id);
* before deserialization of bytecode. If the saved version does not match
* the current version, abort deserialization and invalidate the file.
*/
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 65)
#define JSXDR_BYTECODE_VERSION (0xb973c0de - 66)
/*
* Library-private functions.

View File

@ -0,0 +1,13 @@
expected = "TypeError: NaN is not a function";
actual = "";
try {
a = ""
for each(x in [0, 0, 0, 0]) {
a %= x
} ( - a)()
} catch (e) {
actual = '' + e;
}
assertEq(expected, actual);