Bug 653056 - Use a bitwise version of JSDOUBLE_IS_NaN that Visual Studio PGO doesn't miscompile. r=jimb

This commit is contained in:
Mike Hommey 2011-09-23 14:27:21 +02:00
Родитель 127cfe3a80
Коммит 26bc170067
1 изменённых файлов: 6 добавлений и 16 удалений

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

@ -41,9 +41,6 @@
#define jsnum_h___
#include <math.h>
#ifdef WIN32
#include <float.h>
#endif
#include "jsstdint.h"
#include "jsobj.h"
@ -81,19 +78,18 @@ typedef union jsdpun {
} jsdpun;
/* Low-level floating-point predicates. See bug 640494. */
#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 int
JSDOUBLE_IS_NaN(jsdouble d)
{
/* Visual Studio PGO miscompiles the bitwise version, so keep using _isnan
* from float.h until we figure out what's going on. */
#ifdef WIN32
return _isnan(d);
#else
jsdpun u;
u.d = d;
return (u.u64 & ~JSDOUBLE_SIGNBIT) > JSDOUBLE_EXPMASK;
#endif
return (u.s.hi & JSDOUBLE_HI32_NAN) == JSDOUBLE_HI32_NAN;
}
static inline int
@ -113,12 +109,6 @@ JSDOUBLE_IS_INFINITE(jsdouble d)
return (u.u64 & ~JSDOUBLE_SIGNBIT) == JSDOUBLE_EXPMASK;
}
#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)
{