Reviewed by Maciej and Tim.
Replace uses of isNaN and isInf with isnan and isinf, and
remove isNaN and isInf.
* kjs/config.h: Remove unused HAVE_'s
* kjs/date_object.cpp:
(KJS::DateInstance::getTime):
(KJS::DateInstance::getUTCTime):
(KJS::DateProtoFunc::callAsFunction):
(KJS::DateObjectImp::construct):
(KJS::DateObjectFuncImp::callAsFunction):
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
* kjs/math_object.cpp:
(MathFuncImp::callAsFunction):
* kjs/nodes2string.cpp:
(KJS::isParserRoundTripNumber):
* kjs/number_object.cpp:
(NumberProtoFunc::callAsFunction):
* kjs/operations.cpp:
* kjs/operations.h:
* kjs/string_object.cpp:
(KJS::StringProtoFunc::callAsFunction):
* kjs/ustring.cpp:
(KJS::UString::from):
* kjs/value.cpp:
(KJS::JSValue::toInteger):
(KJS::JSValue::toInt32SlowCase):
(KJS::JSValue::toUInt32SlowCase):
2007-10-28 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej.
Replace uses of isNaN and isInf with isnan and isinf.
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::setLength):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27201
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej and Tim.
+
+ Replace uses of isNaN and isInf with isnan and isinf, and
+ remove isNaN and isInf.
+
+ * kjs/config.h: Remove unused HAVE_'s.
+ * kjs/date_object.cpp:
+ (KJS::DateInstance::getTime):
+ (KJS::DateInstance::getUTCTime):
+ (KJS::DateProtoFunc::callAsFunction):
+ (KJS::DateObjectImp::construct):
+ (KJS::DateObjectFuncImp::callAsFunction):
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+ * kjs/math_object.cpp:
+ (MathFuncImp::callAsFunction):
+ * kjs/nodes2string.cpp:
+ (KJS::isParserRoundTripNumber):
+ * kjs/number_object.cpp:
+ (NumberProtoFunc::callAsFunction):
+ * kjs/operations.cpp:
+ * kjs/operations.h:
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+ * kjs/ustring.cpp:
+ (KJS::UString::from):
+ * kjs/value.cpp:
+ (KJS::JSValue::toInteger):
+ (KJS::JSValue::toInt32SlowCase):
+ (KJS::JSValue::toUInt32SlowCase):
+
2007-10-28 Geoffrey Garen <ggaren@apple.com>
Build fix: use the new-fangled missingSymbolMarker().
#if PLATFORM(DARWIN)
#define HAVE_ERRNO_H 1
-#define HAVE_FUNC_ISINF 1
-#define HAVE_FUNC_ISNAN 1
#define HAVE_MMAP 1
#define HAVE_MERGESORT 1
#define HAVE_SBRK 1
#define _CRT_RAND_S
#define HAVE_FLOAT_H 1
-#define HAVE_FUNC__FINITE 1
#define HAVE_SYS_TIMEB_H 1
#define HAVE_VIRTUALALLOC 1
/* FIXME: is this actually used or do other platforms generate their own config.h? */
#define HAVE_ERRNO_H 1
-#define HAVE_FUNC_ISINF 1
-#define HAVE_FUNC_ISNAN 1
#define HAVE_MMAP 1
#define HAVE_SBRK 1
#define HAVE_STRINGS_H 1
bool DateInstance::getTime(GregorianDateTime &t, int &offset) const
{
double milli = internalValue()->getNumber();
- if (isNaN(milli))
+ if (isnan(milli))
return false;
msToGregorianDateTime(milli, false, t);
bool DateInstance::getUTCTime(GregorianDateTime &t) const
{
double milli = internalValue()->getNumber();
- if (isNaN(milli))
+ if (isnan(milli))
return false;
msToGregorianDateTime(milli, true, t);
bool DateInstance::getTime(double &milli, int &offset) const
{
milli = internalValue()->getNumber();
- if (isNaN(milli))
+ if (isnan(milli))
return false;
GregorianDateTime t;
bool DateInstance::getUTCTime(double &milli) const
{
milli = internalValue()->getNumber();
- if (isNaN(milli))
+ if (isnan(milli))
return false;
return true;
UString s;
JSValue *v = thisDateObj->internalValue();
double milli = v->toNumber(exec);
- if (isNaN(milli)) {
+ if (isnan(milli)) {
switch (id) {
case ToString:
case ToDateString:
value = primitive->toNumber(exec);
}
} else {
- if (isNaN(args[0]->toNumber(exec))
- || isNaN(args[1]->toNumber(exec))
- || (numArgs >= 3 && isNaN(args[2]->toNumber(exec)))
- || (numArgs >= 4 && isNaN(args[3]->toNumber(exec)))
- || (numArgs >= 5 && isNaN(args[4]->toNumber(exec)))
- || (numArgs >= 6 && isNaN(args[5]->toNumber(exec)))
- || (numArgs >= 7 && isNaN(args[6]->toNumber(exec)))) {
+ if (isnan(args[0]->toNumber(exec))
+ || isnan(args[1]->toNumber(exec))
+ || (numArgs >= 3 && isnan(args[2]->toNumber(exec)))
+ || (numArgs >= 4 && isnan(args[3]->toNumber(exec)))
+ || (numArgs >= 5 && isnan(args[4]->toNumber(exec)))
+ || (numArgs >= 6 && isnan(args[5]->toNumber(exec)))
+ || (numArgs >= 7 && isnan(args[6]->toNumber(exec)))) {
value = NaN;
} else {
GregorianDateTime t;
}
else { // UTC
int n = args.size();
- if (isNaN(args[0]->toNumber(exec))
- || isNaN(args[1]->toNumber(exec))
- || (n >= 3 && isNaN(args[2]->toNumber(exec)))
- || (n >= 4 && isNaN(args[3]->toNumber(exec)))
- || (n >= 5 && isNaN(args[4]->toNumber(exec)))
- || (n >= 6 && isNaN(args[5]->toNumber(exec)))
- || (n >= 7 && isNaN(args[6]->toNumber(exec)))) {
+ if (isnan(args[0]->toNumber(exec))
+ || isnan(args[1]->toNumber(exec))
+ || (n >= 3 && isnan(args[2]->toNumber(exec)))
+ || (n >= 4 && isnan(args[3]->toNumber(exec)))
+ || (n >= 5 && isnan(args[4]->toNumber(exec)))
+ || (n >= 6 && isnan(args[5]->toNumber(exec)))
+ || (n >= 7 && isnan(args[6]->toNumber(exec)))) {
return jsNaN();
}
#include <string.h>
#include <wtf/ASCIICType.h>
#include <wtf/Assertions.h>
+#include <wtf/MathExtras.h>
#include <wtf/unicode/Unicode.h>
using namespace WTF;
res = jsNumber(parseFloat(args[0]->toString(exec)));
break;
case IsNaN:
- res = jsBoolean(isNaN(args[0]->toNumber(exec)));
+ res = jsBoolean(isnan(args[0]->toNumber(exec)));
break;
case IsFinite: {
double n = args[0]->toNumber(exec);
- res = jsBoolean(!isNaN(n) && !isInf(n));
+ res = jsBoolean(!isnan(n) && !isinf(n));
break;
}
case DecodeURI:
result = -Inf;
for ( unsigned int k = 0 ; k < argsCount ; ++k ) {
double val = args[k]->toNumber(exec);
- if ( isNaN( val ) )
+ if ( isnan( val ) )
{
result = NaN;
break;
result = +Inf;
for ( unsigned int k = 0 ; k < argsCount ; ++k ) {
double val = args[k]->toNumber(exec);
- if ( isNaN( val ) )
+ if ( isnan( val ) )
{
result = NaN;
break;
}
case MathObjectImp::Pow:
// ECMA 15.8.2.1.13
- if (isNaN(arg2))
+ if (isnan(arg2))
result = NaN;
- else if (isInf(arg2) && fabs(arg) == 1)
+ else if (isinf(arg2) && fabs(arg) == 1)
result = NaN;
else
result = pow(arg, arg2);
#include "config.h"
#include "nodes.h"
-#include "operations.h" // isNaN, isInf
+#include <wtf/MathExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/unicode/Unicode.h>
static bool isParserRoundTripNumber(const UString& string)
{
double number = string.toDouble(false, false);
- if (isNaN(number) || isInf(number))
+ if (isnan(number) || isinf(number))
return false;
return string == UString::from(number);
}
// unless someone finds a precise rule.
char s[2048 + 3];
double x = v->toNumber(exec);
- if (isNaN(x) || isInf(x))
+ if (isnan(x) || isinf(x))
return jsString(UString::from(x));
// apply algorithm on absolute value. add sign later.
int f = (int)df;
double x = v->toNumber(exec);
- if (isNaN(x))
+ if (isnan(x))
return jsString("NaN");
UString s = "";
case ToExponential: {
double x = v->toNumber(exec);
- if (isNaN(x) || isInf(x))
+ if (isnan(x) || isinf(x))
return jsString(UString::from(x));
JSValue *fractionDigits = args[0];
int decimalPoint;
int sign;
- if (isNaN(x))
+ if (isnan(x))
return jsString("NaN");
char *result = kjs_dtoa(x, 0, 0, &decimalPoint, &sign, NULL);
double dp = args[0]->toIntegerPreserveNaN(exec);
double x = v->toNumber(exec);
- if (isNaN(dp) || isNaN(x) || isInf(x))
+ if (isnan(dp) || isnan(x) || isinf(x))
return jsString(v->toString(exec));
UString s = "";
#include <stdio.h>
#include <wtf/MathExtras.h>
-#if HAVE(FUNC_ISINF) && HAVE(IEEEFP_H)
-#include <ieeefp.h>
-#endif
-
#if HAVE(FLOAT_H)
#include <float.h>
#endif
namespace KJS {
-
-#if !PLATFORM(DARWIN)
-
-// FIXME: Should probably be inlined on non-Darwin platforms too, and controlled exclusively
-// by HAVE macros rather than PLATFORM.
-
-// FIXME: Merge with isnan in MathExtras.h and remove this one entirely.
-bool isNaN(double d)
-{
-#if HAVE(FUNC_ISNAN)
- return isnan(d);
-#elif HAVE(FLOAT_H)
- return _isnan(d) != 0;
-#else
- return !(d == d);
-#endif
-}
-
-// FIXME: Merge with isinf in MathExtras.h and remove this one entirely.
-bool isInf(double d)
-{
- // FIXME: should be HAVE(_FPCLASS)
-#if PLATFORM(WIN_OS)
- int fpClass = _fpclass(d);
- return _FPCLASS_PINF == fpClass || _FPCLASS_NINF == fpClass;
-#elif HAVE(FUNC_ISINF)
- return isinf(d);
-#elif HAVE(FUNC_FINITE)
- return finite(d) == 0 && d == d;
-#elif HAVE(FUNC__FINITE)
- return _finite(d) == 0 && d == d;
-#else
- return false;
-#endif
-}
-
-bool isPosInf(double d)
-{
- // FIXME: should be HAVE(_FPCLASS)
-#if PLATFORM(WIN_OS)
- return _FPCLASS_PINF == _fpclass(d);
-#elif HAVE(FUNC_ISINF)
- return (isinf(d) == 1);
-#elif HAVE(FUNC_FINITE)
- return !finite(d) && d == d; // ### can we distinguish between + and - ?
-#elif HAVE(FUNC__FINITE)
- return !_finite(d) && d == d; // ###
-#else
- return false;
-#endif
-}
-
-bool isNegInf(double d)
-{
- // FIXME: should be HAVE(_FPCLASS)
-#if PLATFORM(WIN_OS)
- return _FPCLASS_NINF == _fpclass(d);
-#elif HAVE(FUNC_ISINF)
- return (isinf(d) == -1);
-#elif HAVE(FUNC_FINITE)
- return finite(d) == 0 && d == d; // ###
-#elif HAVE(FUNC__FINITE)
- return _finite(d) == 0 && d == d; // ###
-#else
- return false;
-#endif
-}
-
-#endif
// ECMA 11.9.3
bool equal(ExecState *exec, JSValue *v1, JSValue *v2)
#ifndef _KJS_OPERATIONS_H_
#define _KJS_OPERATIONS_H_
-#include <math.h>
-
namespace KJS {
class ExecState;
class JSValue;
-#if PLATFORM(DARWIN)
- inline bool isNaN(double d) { return isnan(d); }
- inline bool isInf(double d) { return isinf(d); }
- inline bool isPosInf(double d) { return isinf(d) && d > 0; }
- inline bool isNegInf(double d) { return isinf(d) && d < 0; }
-#else
- bool isNaN(double d);
- bool isInf(double d);
- bool isPosInf(double d);
- bool isNegInf(double d);
-#endif
-
bool equal(ExecState *exec, JSValue *v1, JSValue *v2);
bool strictEqual(ExecState *exec, JSValue *v1, JSValue *v2);
int maxInt(int d1, int d2);
case Substring: {
double start = a0->toNumber(exec);
double end = a1->toNumber(exec);
- if (isNaN(start))
+ if (isnan(start))
start = 0;
- if (isNaN(end))
+ if (isnan(end))
end = 0;
if (start < 0)
start = 0;
#include <stdlib.h>
#include <wtf/Assertions.h>
#include <wtf/ASCIICType.h>
+#include <wtf/MathExtras.h>
#include <wtf/Vector.h>
#if HAVE(STRING_H)
UString UString::from(double d)
{
// avoid ever printing -NaN, in JS conceptually there is only one NaN value
- if (isNaN(d))
+ if (isnan(d))
return "NaN";
char buf[80];
#include "error_object.h"
#include "nodes.h"
-#include "operations.h"
#include <stdio.h>
#include <string.h>
#include <wtf/MathExtras.h>
if (getTruncatedInt32(i))
return i;
double d = toNumber(exec);
- return isNaN(d) ? 0.0 : trunc(d);
+ return isnan(d) ? 0.0 : trunc(d);
}
double JSValue::toIntegerPreserveNaN(ExecState *exec) const
if (d >= -D32 / 2 && d < D32 / 2)
return static_cast<int32_t>(d);
- if (isNaN(d) || isInf(d)) {
+ if (isnan(d) || isinf(d)) {
ok = false;
return 0;
}
if (d >= 0.0 && d < D32)
return static_cast<uint32_t>(d);
- if (isNaN(d) || isInf(d)) {
+ if (isnan(d) || isinf(d)) {
ok = false;
return 0;
}
+2007-10-28 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Maciej.
+
+ Replace uses of isNaN and isInf with isnan and isinf.
+
+ * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+ (WebCore::JSHTMLOptionsCollection::setLength):
+
2007-10-28 Maciej Stachowiak <mjs@apple.com>
Reviewed by Mark.
#include "JSHTMLOptionElement.h"
#include "JSHTMLSelectElementCustom.h"
-#include <kjs/operations.h>
+#include <wtf/MathExtras.h>
using namespace KJS;
ExceptionCode ec = 0;
unsigned newLength = 0;
double lengthValue = value->toNumber(exec);
- if (!isNaN(lengthValue) && !isInf(lengthValue)) {
+ if (!isnan(lengthValue) && !isinf(lengthValue)) {
if (lengthValue < 0.0)
ec = INDEX_SIZE_ERR;
else if (lengthValue > static_cast<double>(UINT_MAX))