From 26bc17006753347a5cde5b4897c9d245a38dd5a0 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 23 Sep 2011 14:27:21 +0200 Subject: [PATCH] Bug 653056 - Use a bitwise version of JSDOUBLE_IS_NaN that Visual Studio PGO doesn't miscompile. r=jimb --- js/src/jsnum.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/js/src/jsnum.h b/js/src/jsnum.h index 5f66deba161..405ea09ae7e 100644 --- a/js/src/jsnum.h +++ b/js/src/jsnum.h @@ -41,9 +41,6 @@ #define jsnum_h___ #include -#ifdef WIN32 -#include -#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) {