WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
23624
Expose a cross-platform NaN in MathExtras.h
https://bugs.webkit.org/show_bug.cgi?id=23624
Summary
Expose a cross-platform NaN in MathExtras.h
Simon Fraser (smfr)
Reported
2009-01-29 11:27:33 PST
MathExtras.h should expose a NaN that works everywhere.
Attachments
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2009-01-29 11:54:40 PST
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.
Darin Adler
Comment 2
2009-01-29 12:14:15 PST
(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.
Simon Fraser (smfr)
Comment 3
2009-01-29 13:11:17 PST
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() .
Alexey Proskuryakov
Comment 4
2009-01-30 07:32:04 PST
FWIW, we also have "extern const double NaN", which is used in several places.
Darin Adler
Comment 5
2009-01-30 09:09:53 PST
(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.
Simon Fraser (smfr)
Comment 6
2009-01-30 09:12:52 PST
OK, this is a WONTFIX then.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug