MathExtras.h should expose a NaN that works everywhere.
Ugh, std::numeric_limits<double>::quiet_NaN() is marked as throw(), which throws the JIT into a tizzy if I put it in a header.
(In reply to comment #1) > Ugh, std::numeric_limits<double>::quiet_NaN() is marked as throw(), which > throws the JIT into a tizzy if I put it in a header. Thows the JIT into a tizzy? Could you be more specific? I've used quiet_NaN() in many cases without having any problems. I don't think we need it in MathExtras.h -- I think we should just use it directly.
Sorry to be vague. With this patch: diff --git a/JavaScriptCore/wtf/MathExtras.h b/JavaScriptCore/wtf/MathExtras.h index 76488b4..9638b35 100644 --- a/JavaScriptCore/wtf/MathExtras.h +++ b/JavaScriptCore/wtf/MathExtras.h @@ -28,6 +28,7 @@ #include <math.h> #include <stdlib.h> +#include <limits> #if PLATFORM(SOLARIS) #include <ieeefp.h> @@ -44,7 +45,6 @@ #else #include <xmath.h> #endif -#include <limits> #if HAVE(FLOAT_H) #include <float.h> @@ -68,6 +68,8 @@ const double piOverFourDouble = M_PI_4; const float piOverFourFloat = static_cast<float>(M_PI_4); #endif +const double nanDouble = std::numeric_limits<double>::quiet_NaN(); + #if PLATFORM(DARWIN) // Work around a bug in the Mac OS X libc where ceil(-0.1) return +0. I get link errors: ld warning: symbol _ctiVMThrowTrampoline found in unsupported section in /Volumes/InternalData/Development/WebKit/WebKit.git/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/Objects-normal/i386/JIT.o ld warning: symbol _ctiTrampoline found in unsupported section in /Volumes/InternalData/Development/WebKit/WebKit.git/WebKitBuild/JavaScriptCore.build/Debug/JavaScriptCore.build/Objects-normal/i386/JIT.o Undefined symbols: "_ctiTrampoline", referenced from: __ZN3JSC3JIT7executeEPvPNS_12RegisterFileEPNS_9ExecStateEPNS_12JSGlobalDataEPNS_10JSValuePtrE in Interpreter.o "_ctiVMThrowTrampoline", referenced from: _ctiVMThrowTrampoline$non_lazy_ptr in Interpreter.o ld: symbol(s) not found I think this is because quiet_NaN() is declared as double quiet_NaN() throw() .
FWIW, we also have "extern const double NaN", which is used in several places.
(In reply to comment #3) > I think this is because quiet_NaN() is declared as > double quiet_NaN() throw() I don't think that's why. The CTI throw code has nothing to do with C++ exceptions; it's about JavaScript exceptions. I don't think we should define a new named NAN constant in MathExtras.h. I think we should change our C++ code to use the standard quiet_NaN() directly.
OK, this is a WONTFIX then.