Bug 725550: remove obsolete typedef jsdouble, r=jwalden

This commit is contained in:
David Mandelin 2012-02-24 14:19:52 -08:00
parent f35da5b2e3
commit ec012300ff
66 changed files with 411 additions and 412 deletions

View File

@ -272,7 +272,7 @@ nsIDOMCanvasRenderingContext2D_CreateImageData(JSContext *cx, uintN argc, jsval
return CreateImageData(cx, data_width, data_height, NULL, 0, 0, vp);
}
jsdouble width, height;
double width, height;
if (!JS_ValueToNumber(cx, argv[0], &width) ||
!JS_ValueToNumber(cx, argv[1], &height))
return false;
@ -311,7 +311,7 @@ nsIDOMCanvasRenderingContext2D_GetImageData(JSContext *cx, uintN argc, jsval *vp
jsval *argv = JS_ARGV(cx, vp);
jsdouble xd, yd, width, height;
double xd, yd, width, height;
if (!JS_ValueToNumber(cx, argv[0], &xd) ||
!JS_ValueToNumber(cx, argv[1], &yd) ||
!JS_ValueToNumber(cx, argv[2], &width) ||

View File

@ -4472,7 +4472,7 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, jsid id, bool *aIsNumber)
JSAutoRequest ar(cx);
jsval idval;
jsdouble array_index;
double array_index;
if (!::JS_IdToValue(cx, id, &idval) ||
!::JS_ValueToNumber(cx, idval, &array_index) ||
!::JS_DoubleIsInt32(array_index, &i)) {

View File

@ -1450,5 +1450,5 @@ nsresult
CountHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal)
{
return JS_NewNumberValue(aCx, static_cast<jsdouble>(mCount), aVal);
return JS_NewNumberValue(aCx, static_cast<double>(mCount), aVal);
}

View File

@ -900,7 +900,7 @@ SwapBytes(PRUint32 u)
#endif
}
static inline jsdouble
static inline double
SwapBytes(PRUint64 u)
{
#ifdef IS_BIG_ENDIAN
@ -913,7 +913,7 @@ SwapBytes(PRUint64 u)
((u & 0x00ff000000000000LLU) >> 40) |
((u & 0xff00000000000000LLU) >> 56);
#else
return jsdouble(u);
return double(u);
#endif
}
@ -2019,7 +2019,7 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
// This is a duplicate of the js engine's byte munging here
union {
jsdouble d;
double d;
PRUint64 u;
} pun;
@ -2851,5 +2851,5 @@ nsresult
CountHelper::GetSuccessResult(JSContext* aCx,
jsval* aVal)
{
return JS_NewNumberValue(aCx, static_cast<jsdouble>(mCount), aVal);
return JS_NewNumberValue(aCx, static_cast<double>(mCount), aVal);
}

View File

@ -248,7 +248,7 @@ Key::DecodeJSVal(const unsigned char*& aPos, const unsigned char* aEnd,
}
}
else if (*aPos - aTypeOffset == eDate) {
jsdouble msec = static_cast<jsdouble>(DecodeNumber(aPos, aEnd));
double msec = static_cast<double>(DecodeNumber(aPos, aEnd));
JSObject* date = JS_NewDateObjectMsec(aCx, msec);
if (!date) {
NS_WARNING("Failed to make date!");

View File

@ -457,7 +457,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, jsval val, NPVariant *variant)
} else if (JSVAL_IS_INT(val)) {
INT32_TO_NPVARIANT(JSVAL_TO_INT(val), *variant);
} else if (JSVAL_IS_DOUBLE(val)) {
jsdouble d = JSVAL_TO_DOUBLE(val);
double d = JSVAL_TO_DOUBLE(val);
jsint i;
if (JS_DoubleIsInt32(d, &i)) {
INT32_TO_NPVARIANT(i, *variant);

View File

@ -108,7 +108,7 @@ SmsMessage::Create(PRInt32 aId,
if (!aTimestamp.isNumber()) {
return NS_ERROR_INVALID_ARG;
}
jsdouble number = aTimestamp.toNumber();
double number = aTimestamp.toNumber();
if (static_cast<PRUint64>(number) != number) {
return NS_ERROR_INVALID_ARG;
}

View File

@ -850,7 +850,7 @@ public:
static JSObject*
Create(JSContext* aCx, JSObject* aParent, JSString* aType,
bool aLengthComputable, jsdouble aLoaded, jsdouble aTotal)
bool aLengthComputable, double aLoaded, double aTotal)
{
JSString* type = JS_InternJSString(aCx, aType);
if (!type) {
@ -907,8 +907,8 @@ private:
static void
InitProgressEventCommon(JSObject* aObj, Event* aEvent, JSString* aType,
JSBool aBubbles, JSBool aCancelable,
JSBool aLengthComputable, jsdouble aLoaded,
jsdouble aTotal, bool aIsTrusted)
JSBool aLengthComputable, double aLoaded,
double aTotal, bool aIsTrusted)
{
Event::InitEventCommon(aObj, aEvent, aType, aBubbles, aCancelable,
aIsTrusted);
@ -967,7 +967,7 @@ private:
JSString* type;
JSBool bubbles, cancelable, lengthComputable;
jsdouble loaded, total;
double loaded, total;
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "Sbbbdd", &type,
&bubbles, &cancelable, &lengthComputable, &loaded,
&total)) {
@ -1065,7 +1065,7 @@ CreateErrorEvent(JSContext* aCx, JSString* aMessage, JSString* aFilename,
JSObject*
CreateProgressEvent(JSContext* aCx, JSString* aType, bool aLengthComputable,
jsdouble aLoaded, jsdouble aTotal)
double aLoaded, double aTotal)
{
JSObject* global = JS_GetGlobalForScopeChain(aCx);
return ProgressEvent::Create(aCx, global, aType, aLengthComputable, aLoaded,

View File

@ -69,7 +69,7 @@ CreateErrorEvent(JSContext* aCx, JSString* aMessage, JSString* aFilename,
JSObject*
CreateProgressEvent(JSContext* aCx, JSString* aType, bool aLengthComputable,
jsdouble aLoaded, jsdouble aTotal);
double aLoaded, double aTotal);
bool
IsSupportedEventClass(JSObject* aEvent);

View File

@ -140,7 +140,7 @@ private:
ThrowFileExceptionForCode(aCx, FILE_NOT_READABLE_ERR);
}
if (!JS_NewNumberValue(aCx, jsdouble(size), aVp)) {
if (!JS_NewNumberValue(aCx, double(size), aVp)) {
return false;
}
@ -183,7 +183,7 @@ private:
return false;
}
jsdouble start = 0, end = 0;
double start = 0, end = 0;
JSString* jsContentType = JS_GetEmptyString(JS_GetRuntime(aCx));
if (!JS_ConvertArguments(aCx, aArgc, JS_ARGV(aCx, aVp), "/IIS", &start,
&end, &jsContentType)) {

View File

@ -3533,7 +3533,7 @@ WorkerPrivate::SetTimeout(JSContext* aCx, uintN aArgc, jsval* aVp,
// See if any of the optional arguments were passed.
if (aArgc > 1) {
jsdouble intervalMS = 0;
double intervalMS = 0;
if (!JS_ValueToNumber(aCx, argv[1], &intervalMS)) {
return false;
}

View File

@ -210,12 +210,12 @@ struct JSDProfileData
uintN callCount;
uintN recurseDepth;
uintN maxRecurseDepth;
jsdouble minExecutionTime;
jsdouble maxExecutionTime;
jsdouble totalExecutionTime;
jsdouble minOwnExecutionTime;
jsdouble maxOwnExecutionTime;
jsdouble totalOwnExecutionTime;
double minExecutionTime;
double maxExecutionTime;
double totalExecutionTime;
double minOwnExecutionTime;
double maxOwnExecutionTime;
double totalOwnExecutionTime;
};
struct JSDSourceText
@ -417,22 +417,22 @@ jsd_GetScriptCallCount(JSDContext* jsdc, JSDScript *script);
extern uintN
jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script);
extern jsdouble
extern double
jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script);
extern jsdouble
extern double
jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script);
extern jsdouble
extern double
jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script);
extern jsdouble
extern double
jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
extern jsdouble
extern double
jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
extern jsdouble
extern double
jsd_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
extern void
@ -972,7 +972,7 @@ jsd_GetValueBoolean(JSDContext* jsdc, JSDValue* jsdval);
extern int32_t
jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval);
extern jsdouble
extern double
jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval);
extern JSString*

View File

@ -367,7 +367,7 @@ jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script)
return 0;
}
jsdouble
double
jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
@ -376,7 +376,7 @@ jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script)
return 0.0;
}
jsdouble
double
jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
@ -385,7 +385,7 @@ jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script)
return 0.0;
}
jsdouble
double
jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
@ -394,7 +394,7 @@ jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script)
return 0.0;
}
jsdouble
double
jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
@ -403,7 +403,7 @@ jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
return 0.0;
}
jsdouble
double
jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
@ -412,7 +412,7 @@ jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
return 0.0;
}
jsdouble
double
jsd_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)

View File

@ -187,7 +187,7 @@ _callHook(JSDContext *jsdc, JSContext *cx, JSStackFrame *fp, JSBool before,
hookresult = JS_TRUE;
} else if (!pdata->recurseDepth && pdata->lastCallStart) {
int64_t now, ll_delta;
jsdouble delta;
double delta;
now = JS_Now();
ll_delta = now - pdata->lastCallStart;
delta = ll_delta;

View File

@ -197,7 +197,7 @@ jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval)
return JSVAL_TO_INT(val);
}
jsdouble
double
jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval)
{
if(!JSVAL_IS_DOUBLE(jsdval->val))

View File

@ -211,42 +211,42 @@ JSD_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script)
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
return jsd_GetScriptMinExecutionTime(jsdc, script);
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
return jsd_GetScriptMaxExecutionTime(jsdc, script);
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
return jsd_GetScriptTotalExecutionTime(jsdc, script);
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
return jsd_GetScriptMinOwnExecutionTime(jsdc, script);
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
return jsd_GetScriptMaxOwnExecutionTime(jsdc, script);
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
@ -1110,7 +1110,7 @@ JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval)
return jsd_GetValueInt(jsdc, jsdval);
}
JSD_PUBLIC_API(jsdouble)
JSD_PUBLIC_API(double)
JSD_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);

View File

@ -333,40 +333,40 @@ JSD_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script);
/*
* Get the shortest execution time recorded.
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script);
/*
* Get the longest execution time recorded.
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script);
/*
* Get the total amount of time spent in this script.
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script);
/*
* Get the shortest execution time recorded, excluding time spent in called
* functions.
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
/*
* Get the longest execution time recorded, excluding time spent in called
* functions.
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
/*
* Get the total amount of time spent in this script, excluding time spent
* in called functions.
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script);
/*
@ -1293,7 +1293,7 @@ JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval);
* Return double value (does NOT do conversion).
* *** new for version 1.1 ****
*/
extern JSD_PUBLIC_API(jsdouble)
extern JSD_PUBLIC_API(double)
JSD_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval);
/*

View File

@ -86,7 +86,7 @@ HashableValue::setValue(JSContext *cx, const Value &v)
return false;
value = StringValue(str);
} else if (v.isDouble()) {
jsdouble d = v.toDouble();
double d = v.toDouble();
int32_t i;
if (JSDOUBLE_IS_INT32(d, &i)) {
/* Normalize int32-valued doubles to int32 for faster hashing and testing. */

View File

@ -602,7 +602,7 @@ ExecuteRegExp(JSContext *cx, Native native, uintN argc, Value *vp)
const Value &lastIndex = reobj.getLastIndex();
/* Step 5. */
jsdouble i;
double i;
if (!ToInteger(cx, lastIndex, &i))
return false;

View File

@ -457,7 +457,7 @@ static JSFunctionSpec sModuleFunctions[] = {
JS_FS_END
};
static inline bool FloatIsFinite(jsdouble f) {
static inline bool FloatIsFinite(double f) {
#ifdef WIN32
return _finite(f) != 0;
#else
@ -1004,8 +1004,8 @@ struct ConvertImpl {
// MSVC can't perform double to unsigned __int64 conversion when the
// double is greater than 2^63 - 1. Help it along a little.
template<>
struct ConvertImpl<uint64_t, jsdouble> {
static JS_ALWAYS_INLINE uint64_t Convert(jsdouble d) {
struct ConvertImpl<uint64_t, double> {
static JS_ALWAYS_INLINE uint64_t Convert(double d) {
return d > 0x7fffffffffffffffui64 ?
uint64_t(d - 0x8000000000000000ui64) + 0x8000000000000000ui64 :
uint64_t(d);
@ -1020,16 +1020,16 @@ struct ConvertImpl<uint64_t, jsdouble> {
#ifdef SPARC
// Simulate x86 overflow behavior
template<>
struct ConvertImpl<uint64_t, jsdouble> {
static JS_ALWAYS_INLINE uint64_t Convert(jsdouble d) {
struct ConvertImpl<uint64_t, double> {
static JS_ALWAYS_INLINE uint64_t Convert(double d) {
return d >= 0xffffffffffffffff ?
0x8000000000000000 : uint64_t(d);
}
};
template<>
struct ConvertImpl<int64_t, jsdouble> {
static JS_ALWAYS_INLINE int64_t Convert(jsdouble d) {
struct ConvertImpl<int64_t, double> {
static JS_ALWAYS_INLINE int64_t Convert(double d) {
return d >= 0x7fffffffffffffff ?
0x8000000000000000 : int64_t(d);
}
@ -1141,7 +1141,7 @@ static JS_ALWAYS_INLINE bool IsNegative(Type i)
return IsNegativeImpl<Type, numeric_limits<Type>::is_signed>::Test(i);
}
// Implicitly convert val to bool, allowing JSBool, jsint, and jsdouble
// Implicitly convert val to bool, allowing JSBool, jsint, and double
// arguments numerically equal to 0 or 1.
static bool
jsvalToBool(JSContext* cx, jsval val, bool* result)
@ -1156,7 +1156,7 @@ jsvalToBool(JSContext* cx, jsval val, bool* result)
return i == 0 || i == 1;
}
if (JSVAL_IS_DOUBLE(val)) {
jsdouble d = JSVAL_TO_DOUBLE(val);
double d = JSVAL_TO_DOUBLE(val);
*result = d != 0;
// Allow -0.
return d == 1 || d == 0;
@ -1165,7 +1165,7 @@ jsvalToBool(JSContext* cx, jsval val, bool* result)
return false;
}
// Implicitly convert val to IntegerType, allowing JSBool, jsint, jsdouble,
// Implicitly convert val to IntegerType, allowing JSBool, jsint, double,
// Int64, UInt64, and CData integer types 't' where all values of 't' are
// representable by IntegerType.
template<class IntegerType>
@ -1183,7 +1183,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
if (JSVAL_IS_DOUBLE(val)) {
// Don't silently lose bits here -- check that val really is an
// integer value, and has the right sign.
jsdouble d = JSVAL_TO_DOUBLE(val);
double d = JSVAL_TO_DOUBLE(val);
return ConvertExact(d, result);
}
if (!JSVAL_IS_PRIMITIVE(val)) {
@ -1246,7 +1246,7 @@ jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
return false;
}
// Implicitly convert val to FloatType, allowing jsint, jsdouble,
// Implicitly convert val to FloatType, allowing jsint, double,
// Int64, UInt64, and CData numeric types 't' where all values of 't' are
// representable by FloatType.
template<class FloatType>
@ -1359,7 +1359,7 @@ StringToInteger(JSContext* cx, JSString* string, IntegerType* result)
return true;
}
// Implicitly convert val to IntegerType, allowing jsint, jsdouble,
// Implicitly convert val to IntegerType, allowing jsint, double,
// Int64, UInt64, and optionally a decimal or hexadecimal string argument.
// (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.)
template<class IntegerType>
@ -1380,7 +1380,7 @@ jsvalToBigInteger(JSContext* cx,
if (JSVAL_IS_DOUBLE(val)) {
// Don't silently lose bits here -- check that val really is an
// integer value, and has the right sign.
jsdouble d = JSVAL_TO_DOUBLE(val);
double d = JSVAL_TO_DOUBLE(val);
return ConvertExact(d, result);
}
if (allowString && JSVAL_IS_STRING(val)) {
@ -1410,18 +1410,18 @@ jsvalToBigInteger(JSContext* cx,
}
// Implicitly convert val to a size value, where the size value is represented
// by size_t but must also fit in a jsdouble.
// by size_t but must also fit in a double.
static bool
jsvalToSize(JSContext* cx, jsval val, bool allowString, size_t* result)
{
if (!jsvalToBigInteger(cx, val, allowString, result))
return false;
// Also check that the result fits in a jsdouble.
return Convert<size_t>(jsdouble(*result)) == *result;
// Also check that the result fits in a double.
return Convert<size_t>(double(*result)) == *result;
}
// Implicitly convert val to IntegerType, allowing jsint, jsdouble,
// Implicitly convert val to IntegerType, allowing jsint, double,
// Int64, UInt64, and optionally a decimal or hexadecimal string argument.
// (This is common code shared by jsvalToSize and the Int64/UInt64 constructors.)
template<class IntegerType>
@ -1466,28 +1466,28 @@ jsidToBigInteger(JSContext* cx,
}
// Implicitly convert val to a size value, where the size value is represented
// by size_t but must also fit in a jsdouble.
// by size_t but must also fit in a double.
static bool
jsidToSize(JSContext* cx, jsid val, bool allowString, size_t* result)
{
if (!jsidToBigInteger(cx, val, allowString, result))
return false;
// Also check that the result fits in a jsdouble.
return Convert<size_t>(jsdouble(*result)) == *result;
// Also check that the result fits in a double.
return Convert<size_t>(double(*result)) == *result;
}
// Implicitly convert a size value to a jsval, ensuring that the size_t value
// fits in a jsdouble.
// fits in a double.
static JSBool
SizeTojsval(JSContext* cx, size_t size, jsval* result)
{
if (Convert<size_t>(jsdouble(size)) != size) {
if (Convert<size_t>(double(size)) != size) {
JS_ReportError(cx, "size overflow");
return false;
}
return JS_NewNumberValue(cx, jsdouble(size), result);
return JS_NewNumberValue(cx, double(size), result);
}
// Forcefully convert val to IntegerType when explicitly requested.
@ -1499,7 +1499,7 @@ jsvalToIntegerExplicit(jsval val, IntegerType* result)
if (JSVAL_IS_DOUBLE(val)) {
// Convert -Inf, Inf, and NaN to 0; otherwise, convert by C-style cast.
jsdouble d = JSVAL_TO_DOUBLE(val);
double d = JSVAL_TO_DOUBLE(val);
*result = FloatIsFinite(d) ? IntegerType(d) : 0;
return true;
}
@ -1532,11 +1532,11 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
return true;
}
if (JSVAL_IS_DOUBLE(val)) {
jsdouble d = JSVAL_TO_DOUBLE(val);
double d = JSVAL_TO_DOUBLE(val);
if (d < 0) {
// Cast through an intptr_t intermediate to sign-extend.
intptr_t i = Convert<intptr_t>(d);
if (jsdouble(i) != d)
if (double(i) != d)
return false;
*result = uintptr_t(i);
@ -1546,7 +1546,7 @@ jsvalToPtrExplicit(JSContext* cx, jsval val, uintptr_t* result)
// Don't silently lose bits here -- check that val really is an
// integer value, and has the right sign.
*result = Convert<uintptr_t>(d);
return jsdouble(*result) == d;
return double(*result) == d;
}
if (!JSVAL_IS_PRIMITIVE(val)) {
JSObject* obj = JSVAL_TO_OBJECT(val);
@ -1651,7 +1651,7 @@ ConvertToJS(JSContext* cx,
type value = *static_cast<type*>(data); \
if (sizeof(type) < 4) \
*result = INT_TO_JSVAL(jsint(value)); \
else if (!JS_NewNumberValue(cx, jsdouble(value), result)) \
else if (!JS_NewNumberValue(cx, double(value), result)) \
return false; \
break; \
}
@ -1680,7 +1680,7 @@ ConvertToJS(JSContext* cx,
#define DEFINE_FLOAT_TYPE(name, type, ffiType) \
case TYPE_##name: { \
type value = *static_cast<type*>(data); \
if (!JS_NewNumberValue(cx, jsdouble(value), result)) \
if (!JS_NewNumberValue(cx, double(value), result)) \
return false; \
break; \
}
@ -2929,7 +2929,7 @@ CType::GetSafeSize(JSObject* obj, size_t* result)
jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
// The "size" property can be a jsint, a jsdouble, or JSVAL_VOID
// The "size" property can be a jsint, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
if (JSVAL_IS_INT(size)) {
*result = JSVAL_TO_INT(size);
@ -2953,7 +2953,7 @@ CType::GetSize(JSObject* obj)
JS_ASSERT(!JSVAL_IS_VOID(size));
// The "size" property can be a jsint, a jsdouble, or JSVAL_VOID
// The "size" property can be a jsint, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
// For callers who know it can never be JSVAL_VOID, return a size_t directly.
if (JSVAL_IS_INT(size))
@ -2968,7 +2968,7 @@ CType::IsSizeDefined(JSObject* obj)
jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
// The "size" property can be a jsint, a jsdouble, or JSVAL_VOID
// The "size" property can be a jsint, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
JS_ASSERT(JSVAL_IS_INT(size) || JSVAL_IS_DOUBLE(size) || JSVAL_IS_VOID(size));
return !JSVAL_IS_VOID(size);
@ -3599,7 +3599,7 @@ ArrayType::CreateInternal(JSContext* cx,
jsval sizeVal = JSVAL_VOID;
jsval lengthVal = JSVAL_VOID;
if (lengthDefined) {
// Check for overflow, and convert to a jsint or jsdouble as required.
// Check for overflow, and convert to a jsint or double as required.
size_t size = length * baseSize;
if (length > 0 && size / length != baseSize) {
JS_ReportError(cx, "size overflow");
@ -3750,7 +3750,7 @@ ArrayType::GetSafeLength(JSObject* obj, size_t* result)
jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH);
// The "length" property can be a jsint, a jsdouble, or JSVAL_VOID
// The "length" property can be a jsint, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
if (JSVAL_IS_INT(length)) {
*result = JSVAL_TO_INT(length);
@ -3775,7 +3775,7 @@ ArrayType::GetLength(JSObject* obj)
JS_ASSERT(!JSVAL_IS_VOID(length));
// The "length" property can be a jsint, a jsdouble, or JSVAL_VOID
// The "length" property can be a jsint, a double, or JSVAL_VOID
// (for arrays of undefined length), and must always fit in a size_t.
// For callers who know it can never be JSVAL_VOID, return a size_t directly.
if (JSVAL_IS_INT(length))
@ -6207,7 +6207,7 @@ Int64::Lo(JSContext* cx, uintN argc, jsval* vp)
JSObject* obj = JSVAL_TO_OBJECT(argv[0]);
int64_t u = Int64Base::GetInt(obj);
jsdouble d = uint32_t(INT64_LO(u));
double d = uint32_t(INT64_LO(u));
jsval result;
if (!JS_NewNumberValue(cx, d, &result))
@ -6229,7 +6229,7 @@ Int64::Hi(JSContext* cx, uintN argc, jsval* vp)
JSObject* obj = JSVAL_TO_OBJECT(argv[0]);
int64_t u = Int64Base::GetInt(obj);
jsdouble d = int32_t(INT64_HI(u));
double d = int32_t(INT64_HI(u));
jsval result;
if (!JS_NewNumberValue(cx, d, &result))
@ -6374,7 +6374,7 @@ UInt64::Lo(JSContext* cx, uintN argc, jsval* vp)
JSObject* obj = JSVAL_TO_OBJECT(argv[0]);
uint64_t u = Int64Base::GetInt(obj);
jsdouble d = uint32_t(INT64_LO(u));
double d = uint32_t(INT64_LO(u));
jsval result;
if (!JS_NewNumberValue(cx, d, &result))
@ -6396,7 +6396,7 @@ UInt64::Hi(JSContext* cx, uintN argc, jsval* vp)
JSObject* obj = JSVAL_TO_OBJECT(argv[0]);
uint64_t u = Int64Base::GetInt(obj);
jsdouble d = uint32_t(INT64_HI(u));
double d = uint32_t(INT64_HI(u));
jsval result;
if (!JS_NewNumberValue(cx, d, &result))

View File

@ -2301,7 +2301,7 @@ EmitElemIncDec(JSContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
}
static JSBool
EmitNumberOp(JSContext *cx, jsdouble dval, BytecodeEmitter *bce)
EmitNumberOp(JSContext *cx, double dval, BytecodeEmitter *bce)
{
int32_t ival;
uint32_t u;

View File

@ -109,7 +109,7 @@ FoldType(JSContext *cx, ParseNode *pn, ParseNodeKind kind)
switch (kind) {
case PNK_NUMBER:
if (pn->isKind(PNK_STRING)) {
jsdouble d;
double d;
if (!ToNumber(cx, StringValue(pn->pn_atom), &d))
return JS_FALSE;
pn->pn_dval = d;
@ -146,7 +146,7 @@ static JSBool
FoldBinaryNumeric(JSContext *cx, JSOp op, ParseNode *pn1, ParseNode *pn2,
ParseNode *pn, TreeContext *tc)
{
jsdouble d, d2;
double d, d2;
int32_t i, j;
JS_ASSERT(pn1->isKind(PNK_NUMBER) && pn2->isKind(PNK_NUMBER));
@ -822,7 +822,7 @@ js::FoldConstants(JSContext *cx, ParseNode *pn, TreeContext *tc, bool inCond)
case PNK_POS:
case PNK_NEG:
if (pn1->isKind(PNK_NUMBER)) {
jsdouble d;
double d;
/* Operate on one numeric constant. */
d = pn1->pn_dval;

View File

@ -619,7 +619,7 @@ struct ParseNode {
AtomDefnMapPtr defnMap;
ParseNode *tree; /* sub-tree containing name uses */
} nameset;
jsdouble dval; /* aligned numeric literal value */
double dval; /* aligned numeric literal value */
class {
friend class LoopControlStatement;
PropertyName *label; /* target of break/continue statement */

View File

@ -1732,7 +1732,7 @@ TokenStream::getTokenInternal()
* chars, so we don't need to use tokenbuf. Instead we can just
* convert the jschars in userbuf directly to the numeric value.
*/
jsdouble dval;
double dval;
const jschar *dummy;
if (!hasFracOrExp) {
if (!GetPrefixInteger(cx, numStart, userbuf.addressOfNextRawChar(), 10, &dummy, &dval))
@ -1823,7 +1823,7 @@ TokenStream::getTokenInternal()
goto error;
}
jsdouble dval;
double dval;
const jschar *dummy;
if (!GetPrefixInteger(cx, numStart, userbuf.addressOfNextRawChar(), radix, &dummy, &dval))
goto error;

View File

@ -322,7 +322,7 @@ struct Token {
PropertyName *target; /* non-empty */
JSAtom *data; /* maybe empty, never null */
} xmlpi;
jsdouble number; /* floating point number */
double number; /* floating point number */
RegExpFlag reflags; /* regexp flags, use tokenbuf to access
regexp chars */
} u;
@ -359,7 +359,7 @@ struct Token {
u.reflags = flags;
}
void setNumber(jsdouble n) {
void setNumber(double n) {
u.number = n;
}
@ -396,7 +396,7 @@ struct Token {
return u.reflags;
}
jsdouble number() const {
double number() const {
JS_ASSERT(type == TOK_NUMBER);
return u.number;
}

View File

@ -51,7 +51,7 @@ BEGIN_TEST(testParseJSON_success)
CHECK(TryParse(cx, "1", DOUBLE_TO_JSVAL(1)));
CHECK(TryParse(cx, "1.75", DOUBLE_TO_JSVAL(1.75)));
CHECK(TryParse(cx, "9e9", DOUBLE_TO_JSVAL(9e9)));
CHECK(TryParse(cx, "9e99999", DOUBLE_TO_JSVAL(std::numeric_limits<jsdouble>::infinity())));
CHECK(TryParse(cx, "9e99999", DOUBLE_TO_JSVAL(std::numeric_limits<double>::infinity())));
JSFlatString *str;

View File

@ -285,7 +285,7 @@ JS_ConvertArgumentsVA(JSContext *cx, uintN argc, jsval *argv, const char *format
JSBool required;
char c;
JSFunction *fun;
jsdouble d;
double d;
JSString *str;
JSObject *obj;
@ -338,13 +338,13 @@ JS_ConvertArgumentsVA(JSContext *cx, uintN argc, jsval *argv, const char *format
return JS_FALSE;
break;
case 'd':
if (!JS_ValueToNumber(cx, *sp, va_arg(ap, jsdouble *)))
if (!JS_ValueToNumber(cx, *sp, va_arg(ap, double *)))
return JS_FALSE;
break;
case 'I':
if (!JS_ValueToNumber(cx, *sp, &d))
return JS_FALSE;
*va_arg(ap, jsdouble *) = js_DoubleToInteger(d);
*va_arg(ap, double *) = js_DoubleToInteger(d);
break;
case 'S':
case 'W':
@ -445,7 +445,7 @@ JS_ConvertValue(JSContext *cx, jsval v, JSType type, jsval *vp)
JSBool ok;
JSObject *obj;
JSString *str;
jsdouble d;
double d;
AssertNoGC(cx);
CHECK_REQUEST(cx);
@ -536,7 +536,7 @@ JS_ValueToSource(JSContext *cx, jsval v)
}
JS_PUBLIC_API(JSBool)
JS_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp)
JS_ValueToNumber(JSContext *cx, jsval v, double *dp)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);
@ -547,19 +547,19 @@ JS_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp)
}
JS_PUBLIC_API(JSBool)
JS_DoubleIsInt32(jsdouble d, jsint *ip)
JS_DoubleIsInt32(double d, jsint *ip)
{
return JSDOUBLE_IS_INT32(d, (int32_t *)ip);
}
JS_PUBLIC_API(int32_t)
JS_DoubleToInt32(jsdouble d)
JS_DoubleToInt32(double d)
{
return js_DoubleToECMAInt32(d);
}
JS_PUBLIC_API(uint32_t)
JS_DoubleToUint32(jsdouble d)
JS_DoubleToUint32(double d)
{
return js_DoubleToECMAUint32(d);
}
@ -2248,7 +2248,7 @@ JS_strdup(JSContext *cx, const char *s)
}
JS_PUBLIC_API(JSBool)
JS_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval)
JS_NewNumberValue(JSContext *cx, double d, jsval *rval)
{
AssertNoGC(cx);
d = JS_CANONICALIZE_NAN(d);
@ -6285,7 +6285,7 @@ JS_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min,
}
JS_PUBLIC_API(JSObject *)
JS_NewDateObjectMsec(JSContext *cx, jsdouble msec)
JS_NewDateObjectMsec(JSContext *cx, double msec)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);

View File

@ -1662,7 +1662,7 @@ JSVAL_IS_DOUBLE(jsval v)
return JSVAL_IS_DOUBLE_IMPL(JSVAL_TO_IMPL(v));
}
static JS_ALWAYS_INLINE jsdouble
static JS_ALWAYS_INLINE double
JSVAL_TO_DOUBLE(jsval v)
{
jsval_layout l;
@ -1672,7 +1672,7 @@ JSVAL_TO_DOUBLE(jsval v)
}
static JS_ALWAYS_INLINE jsval
DOUBLE_TO_JSVAL(jsdouble d)
DOUBLE_TO_JSVAL(double d)
{
/* This is a manually inlined version of:
* d = JS_CANONICALIZE_NAN(d);
@ -1692,7 +1692,7 @@ UINT_TO_JSVAL(uint32_t i)
{
if (i <= JSVAL_INT_MAX)
return INT_TO_JSVAL((int32_t)i);
return DOUBLE_TO_JSVAL((jsdouble)i);
return DOUBLE_TO_JSVAL((double)i);
}
static JS_ALWAYS_INLINE JSBool
@ -2131,8 +2131,8 @@ JS_GetEmptyString(JSRuntime *rt);
* i int32_t ECMA int32_t
* u uint32_t ECMA uint32_t
* j int32_t Rounded int32_t (coordinate)
* d jsdouble IEEE double
* I jsdouble Integral IEEE double
* d double IEEE double
* I double Integral IEEE double
* S JSString * Unicode string, accessed by a JSString pointer
* W jschar * Unicode character vector, 0-terminated (W for wide)
* o JSObject * Object reference
@ -2233,16 +2233,16 @@ extern JS_PUBLIC_API(JSString *)
JS_ValueToSource(JSContext *cx, jsval v);
extern JS_PUBLIC_API(JSBool)
JS_ValueToNumber(JSContext *cx, jsval v, jsdouble *dp);
JS_ValueToNumber(JSContext *cx, jsval v, double *dp);
extern JS_PUBLIC_API(JSBool)
JS_DoubleIsInt32(jsdouble d, jsint *ip);
JS_DoubleIsInt32(double d, jsint *ip);
extern JS_PUBLIC_API(int32_t)
JS_DoubleToInt32(jsdouble d);
JS_DoubleToInt32(double d);
extern JS_PUBLIC_API(uint32_t)
JS_DoubleToUint32(jsdouble d);
JS_DoubleToUint32(double d);
/*
* Convert a value to a number, then to an int32_t, according to the ECMA rules
@ -2894,7 +2894,7 @@ extern JS_PUBLIC_API(char *)
JS_strdup(JSContext *cx, const char *s);
extern JS_PUBLIC_API(JSBool)
JS_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval);
JS_NewNumberValue(JSContext *cx, double d, jsval *rval);
/*
* A GC root is a pointer to a jsval, JSObject * or JSString * that itself
@ -3596,7 +3596,7 @@ extern JS_PUBLIC_API(void)
JS_FinalizeStub(JSContext *cx, JSObject *obj);
struct JSConstDoubleSpec {
jsdouble dval;
double dval;
const char *name;
uint8_t flags;
uint8_t spare[3];
@ -5172,7 +5172,7 @@ extern JS_PUBLIC_API(JSObject *)
JS_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min, int sec);
extern JS_PUBLIC_API(JSObject *)
JS_NewDateObjectMsec(JSContext *cx, jsdouble msec);
JS_NewDateObjectMsec(JSContext *cx, double msec);
/*
* Infallible predicate to test whether obj is a date object.

View File

@ -305,13 +305,13 @@ JSObject::willBeSparseDenseArray(uintN requiredCapacity, uintN newElementsHint)
}
static bool
ReallyBigIndexToId(JSContext* cx, jsdouble index, jsid* idp)
ReallyBigIndexToId(JSContext* cx, double index, jsid* idp)
{
return js_ValueToStringId(cx, DoubleValue(index), idp);
}
static bool
IndexToId(JSContext* cx, JSObject* obj, jsdouble index, JSBool* hole, jsid* idp,
IndexToId(JSContext* cx, JSObject* obj, double index, JSBool* hole, jsid* idp,
JSBool createAtom = JS_FALSE)
{
if (index <= JSID_INT_MAX) {
@ -363,7 +363,7 @@ JSObject::arrayGetOwnDataElement(JSContext *cx, size_t i, Value *vp)
* properly rooted and can be used as GC-protected storage for temporaries.
*/
static inline JSBool
DoGetElement(JSContext *cx, JSObject *obj, jsdouble index, JSBool *hole, Value *vp)
DoGetElement(JSContext *cx, JSObject *obj, double index, JSBool *hole, Value *vp)
{
AutoIdRooter idr(cx);
@ -468,7 +468,7 @@ GetElements(JSContext *cx, JSObject *aobj, jsuint length, Value *vp)
* Set the value of the property at the given index to v assuming v is rooted.
*/
static JSBool
SetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, const Value &v)
SetArrayElement(JSContext *cx, JSObject *obj, double index, const Value &v)
{
JS_ASSERT(index >= 0);
@ -519,7 +519,7 @@ SetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, const Value &v)
* - Return -1 if an exception occurs (that is, [[Delete]] would throw).
*/
static int
DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index, bool strict)
DeleteArrayElement(JSContext *cx, JSObject *obj, double index, bool strict)
{
JS_ASSERT(index >= 0);
JS_ASSERT(floor(index) == index);
@ -554,7 +554,7 @@ DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index, bool strict)
* its value to v assuming v is rooted.
*/
static JSBool
SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index,
SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, double index,
JSBool hole, const Value &v)
{
if (hole) {
@ -565,7 +565,7 @@ SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index,
}
JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length)
js_SetLengthProperty(JSContext *cx, JSObject *obj, double length)
{
Value v = NumberValue(length);
@ -604,7 +604,7 @@ array_length_setter(JSContext *cx, JSObject *obj, jsid id, JSBool strict, Value
if (!ToUint32(cx, *vp, &newlen))
return false;
jsdouble d;
double d;
if (!ToNumber(cx, *vp, &d))
return false;
@ -2168,7 +2168,7 @@ SortComparatorFunction::operator()(const Value &a, const Value &b, bool *lessOrE
if (!Invoke(cx, ag))
return false;
jsdouble cmp;
double cmp;
if (!ToNumber(cx, ag.rval(), &cmp))
return false;
@ -2374,7 +2374,7 @@ array_push_slowly(JSContext *cx, JSObject *obj, CallArgs &args)
return false;
/* Per ECMA-262, return the new array length. */
jsdouble newlength = length + jsdouble(args.length());
double newlength = length + double(args.length());
args.rval().setNumber(newlength);
return js_SetLengthProperty(cx, obj, newlength);
}
@ -2593,7 +2593,7 @@ array_unshift(JSContext *cx, uintN argc, Value *vp)
if (!js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
jsdouble newlen = length;
double newlen = length;
if (args.length() > 0) {
/* Slide up the array to make room for all args at the bottom. */
if (length > 0) {
@ -2617,8 +2617,8 @@ array_unshift(JSContext *cx, uintN argc, Value *vp)
} while (false);
if (!optimized) {
jsdouble last = length;
jsdouble upperIndex = last + args.length();
double last = length;
double upperIndex = last + args.length();
AutoValueRooter tvr(cx);
do {
--last, --upperIndex;
@ -2731,7 +2731,7 @@ array_splice(JSContext *cx, uintN argc, Value *vp)
/* Step 7. */
uint32_t actualDeleteCount;
if (argc != 1) {
jsdouble deleteCountDouble;
double deleteCountDouble;
if (!ToInteger(cx, argc >= 2 ? args[1] : Int32Value(0), &deleteCountDouble))
return false;
actualDeleteCount = JS_MIN(JS_MAX(deleteCountDouble, 0), len - actualStart);
@ -2853,9 +2853,9 @@ array_splice(JSContext *cx, uintN argc, Value *vp)
if (cx->typeInferenceEnabled())
obj->setDenseArrayInitializedLength(len + itemCount - actualDeleteCount);
} else {
for (jsdouble k = len - actualDeleteCount; k > actualStart; k--) {
jsdouble from = k + actualDeleteCount - 1;
jsdouble to = k + itemCount - 1;
for (double k = len - actualDeleteCount; k > actualStart; k--) {
double from = k + actualDeleteCount - 1;
double to = k + itemCount - 1;
JSBool hole;
Value fromValue;
@ -2879,7 +2879,7 @@ array_splice(JSContext *cx, uintN argc, Value *vp)
}
/* Step 16. */
jsdouble finalLength = jsdouble(len) - actualDeleteCount + itemCount;
double finalLength = double(len) - actualDeleteCount + itemCount;
if (!js_SetLengthProperty(cx, obj, finalLength))
return false;
@ -3014,7 +3014,7 @@ array_slice(JSContext *cx, uintN argc, Value *vp)
end = length;
if (args.length() > 0) {
jsdouble d;
double d;
if (!ToInteger(cx, args[0], &d))
return false;
if (d < 0) {
@ -3097,7 +3097,7 @@ array_indexOfHelper(JSContext *cx, IndexOfKind mode, CallArgs &args)
i = (mode == LastIndexOf) ? length - 1 : 0;
tosearch = (args.length() != 0) ? args[0] : UndefinedValue();
} else {
jsdouble start;
double start;
tosearch = args[0];
if (!ToInteger(cx, args[1], &start))
@ -3663,9 +3663,9 @@ js_Array(JSContext *cx, uintN argc, Value *vp)
}
length = uint32_t(i);
} else {
jsdouble d = args[0].toDouble();
double d = args[0].toDouble();
length = js_DoubleToECMAUint32(d);
if (d != jsdouble(length)) {
if (d != double(length)) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_ARRAY_LENGTH);
return false;
}

View File

@ -141,7 +141,7 @@ extern JSBool
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
extern JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length);
js_SetLengthProperty(JSContext *cx, JSObject *obj, double length);
namespace js {

View File

@ -232,7 +232,7 @@ js_ValueToBoolean(const Value &v)
if (v.isNullOrUndefined())
return JS_FALSE;
if (v.isDouble()) {
jsdouble d;
double d;
d = v.toDouble();
return !JSDOUBLE_IS_NaN(d) && d != 0;

View File

@ -195,11 +195,11 @@ CanonicalizeNan(double d)
}
bool
SCInput::readDouble(jsdouble *p)
SCInput::readDouble(double *p)
{
union {
uint64_t u;
jsdouble d;
double d;
} pun;
if (!read(&pun.u))
return false;
@ -265,7 +265,7 @@ SCOutput::writePair(uint32_t tag, uint32_t data)
{
/*
* As it happens, the tag word appears after the data word in the output.
* This is because exponents occupy the last 2 bytes of jsdoubles on the
* This is because exponents occupy the last 2 bytes of doubles on the
* little-endian platforms we care most about.
*
* For example, JSVAL_TRUE is written using writePair(SCTAG_BOOLEAN, 1).
@ -276,35 +276,35 @@ SCOutput::writePair(uint32_t tag, uint32_t data)
}
static inline uint64_t
ReinterpretDoubleAsUInt64(jsdouble d)
ReinterpretDoubleAsUInt64(double d)
{
union {
jsdouble d;
double d;
uint64_t u;
} pun;
pun.d = d;
return pun.u;
}
static inline jsdouble
static inline double
ReinterpretUInt64AsDouble(uint64_t u)
{
union {
uint64_t u;
jsdouble d;
double d;
} pun;
pun.u = u;
return pun.d;
}
static inline jsdouble
static inline double
ReinterpretPairAsDouble(uint32_t tag, uint32_t data)
{
return ReinterpretUInt64AsDouble(PairToUInt64(tag, data));
}
bool
SCOutput::writeDouble(jsdouble d)
SCOutput::writeDouble(double d)
{
return write(ReinterpretDoubleAsUInt64(CanonicalizeNan(d)));
}
@ -530,7 +530,7 @@ JSStructuredCloneWriter::startWrite(const js::Value &v)
return out.writePair(SCTAG_REGEXP_OBJECT, reobj.getFlags()) &&
writeString(SCTAG_STRING, reobj.getSource());
} else if (obj->isDate()) {
jsdouble d = js_DateGetMsecSinceEpoch(context(), obj);
double d = js_DateGetMsecSinceEpoch(context(), obj);
return out.writePair(SCTAG_DATE_OBJECT, 0) && out.writeDouble(d);
} else if (obj->isObject() || obj->isArray()) {
return startObject(obj);
@ -603,7 +603,7 @@ JSStructuredCloneWriter::write(const Value &v)
}
bool
JSStructuredCloneReader::checkDouble(jsdouble d)
JSStructuredCloneReader::checkDouble(double d)
{
jsval_layout l;
l.asDouble = d;
@ -731,7 +731,7 @@ JSStructuredCloneReader::startRead(Value *vp)
}
case SCTAG_NUMBER_OBJECT: {
jsdouble d;
double d;
if (!in.readDouble(&d) || !checkDouble(d))
return false;
vp->setDouble(d);
@ -741,7 +741,7 @@ JSStructuredCloneReader::startRead(Value *vp)
}
case SCTAG_DATE_OBJECT: {
jsdouble d;
double d;
if (!in.readDouble(&d) || !checkDouble(d))
return false;
if (d == d && d != TIMECLIP(d)) {
@ -808,7 +808,7 @@ JSStructuredCloneReader::startRead(Value *vp)
default: {
if (tag <= SCTAG_FLOAT_MAX) {
jsdouble d = ReinterpretPairAsDouble(tag, data);
double d = ReinterpretPairAsDouble(tag, data);
if (!checkDouble(d))
return false;
vp->setNumber(d);

View File

@ -63,7 +63,7 @@ struct SCOutput {
bool write(uint64_t u);
bool writePair(uint32_t tag, uint32_t data);
bool writeDouble(jsdouble d);
bool writeDouble(double d);
bool writeBytes(const void *p, size_t nbytes);
bool writeChars(const jschar *p, size_t nchars);
@ -87,7 +87,7 @@ struct SCInput {
bool read(uint64_t *p);
bool readPair(uint32_t *tagp, uint32_t *datap);
bool readDouble(jsdouble *p);
bool readDouble(double *p);
bool readBytes(void *p, size_t nbytes);
bool readChars(jschar *p, size_t nchars);
@ -100,7 +100,7 @@ struct SCInput {
void staticAssertions() {
JS_STATIC_ASSERT(sizeof(jschar) == 2);
JS_STATIC_ASSERT(sizeof(uint32_t) == 4);
JS_STATIC_ASSERT(sizeof(jsdouble) == 8);
JS_STATIC_ASSERT(sizeof(double) == 8);
}
JSContext *cx;
@ -123,7 +123,7 @@ struct JSStructuredCloneReader {
private:
JSContext *context() { return in.context(); }
bool checkDouble(jsdouble d);
bool checkDouble(double d);
JSString *readString(uint32_t nchars);
bool readTypedArray(uint32_t tag, uint32_t nelems, js::Value *vp);
bool readArrayBuffer(uint32_t nbytes, js::Value *vp);

View File

@ -176,10 +176,10 @@ using namespace js::types;
* computing the reciprocal and multiplying instead of dividing - this loses
* when the reciprocal isn't representable in a double.
*/
static jsdouble msPerSecond = 1000.0;
static jsdouble msPerDay = SecondsPerDay * 1000.0;
static jsdouble msPerHour = SecondsPerHour * 1000.0;
static jsdouble msPerMinute = SecondsPerMinute * 1000.0;
static double msPerSecond = 1000.0;
static double msPerDay = SecondsPerDay * 1000.0;
static double msPerHour = SecondsPerHour * 1000.0;
static double msPerMinute = SecondsPerMinute * 1000.0;
#else
#define msPerDay (SecondsPerDay * msPerSecond)
#define msPerHour (SecondsPerHour * msPerSecond)
@ -189,10 +189,10 @@ static jsdouble msPerMinute = SecondsPerMinute * 1000.0;
#define Day(t) floor((t) / msPerDay)
static jsdouble
TimeWithinDay(jsdouble t)
static double
TimeWithinDay(double t)
{
jsdouble result;
double result;
result = fmod(t, msPerDay);
if (result < 0)
result += msPerDay;
@ -225,10 +225,10 @@ DaysInFebruary(jsint year)
#define TimeFromYear(y) (DayFromYear(y) * msPerDay)
static jsint
YearFromTime(jsdouble t)
YearFromTime(double t)
{
jsint y = (jsint) floor(t /(msPerDay*365.2425)) + 1970;
jsdouble t2 = (jsdouble) TimeFromYear(y);
double t2 = (double) TimeFromYear(y);
/*
* Adjust the year if the approximation was wrong. Since the year was
@ -250,7 +250,7 @@ YearFromTime(jsdouble t)
* The following array contains the day of year for the first day of
* each month, where index 0 is January, and day 0 is January 1.
*/
static jsdouble firstDayOfMonth[2][13] = {
static double firstDayOfMonth[2][13] = {
{0.0, 31.0, 59.0, 90.0, 120.0, 151.0, 181.0, 212.0, 243.0, 273.0, 304.0, 334.0, 365.0},
{0.0, 31.0, 60.0, 91.0, 121.0, 152.0, 182.0, 213.0, 244.0, 274.0, 305.0, 335.0, 366.0}
};
@ -266,7 +266,7 @@ DaysInMonth(jsint year, jsint month)
}
static intN
MonthFromTime(jsdouble t)
MonthFromTime(double t)
{
intN d, step;
jsint year = YearFromTime(t);
@ -298,7 +298,7 @@ MonthFromTime(jsdouble t)
}
static intN
DateFromTime(jsdouble t)
DateFromTime(double t)
{
intN d, step, next;
jsint year = YearFromTime(t);
@ -341,7 +341,7 @@ DateFromTime(jsdouble t)
}
static intN
WeekDay(jsdouble t)
WeekDay(double t)
{
jsint result;
result = (jsint) Day(t) + 4;
@ -354,12 +354,12 @@ WeekDay(jsdouble t)
#define MakeTime(hour, min, sec, ms) \
((((hour) * MinutesPerHour + (min)) * SecondsPerMinute + (sec)) * msPerSecond + (ms))
static jsdouble
MakeDay(jsdouble year, jsdouble month, jsdouble date)
static double
MakeDay(double year, double month, double date)
{
JSBool leap;
jsdouble yearday;
jsdouble monthday;
double yearday;
double monthday;
year += floor(month / 12);
@ -412,10 +412,10 @@ EquivalentYearForDST(jsint year)
}
/* LocalTZA gets set by js_InitDateClass() */
static jsdouble LocalTZA;
static double LocalTZA;
static jsdouble
DaylightSavingTA(jsdouble t, JSContext *cx)
static double
DaylightSavingTA(double t, JSContext *cx)
{
/* abort if NaN */
if (JSDOUBLE_IS_NaN(t))
@ -427,37 +427,37 @@ DaylightSavingTA(jsdouble t, JSContext *cx)
*/
if (t < 0.0 || t > 2145916800000.0) {
jsint year = EquivalentYearForDST(YearFromTime(t));
jsdouble day = MakeDay(year, MonthFromTime(t), DateFromTime(t));
double day = MakeDay(year, MonthFromTime(t), DateFromTime(t));
t = MakeDate(day, TimeWithinDay(t));
}
int64_t timeMilliseconds = static_cast<int64_t>(t);
int64_t offsetMilliseconds = cx->dstOffsetCache.getDSTOffsetMilliseconds(timeMilliseconds, cx);
return static_cast<jsdouble>(offsetMilliseconds);
return static_cast<double>(offsetMilliseconds);
}
static jsdouble
AdjustTime(jsdouble date, JSContext *cx)
static double
AdjustTime(double date, JSContext *cx)
{
jsdouble t = DaylightSavingTA(date, cx) + LocalTZA;
double t = DaylightSavingTA(date, cx) + LocalTZA;
t = (LocalTZA >= 0) ? fmod(t, msPerDay) : -fmod(msPerDay - t, msPerDay);
return t;
}
static jsdouble
LocalTime(jsdouble t, JSContext *cx)
static double
LocalTime(double t, JSContext *cx)
{
return t + AdjustTime(t, cx);
}
static jsdouble
UTC(jsdouble t, JSContext *cx)
static double
UTC(double t, JSContext *cx)
{
return t - AdjustTime(t - LocalTZA, cx);
}
static intN
HourFromTime(jsdouble t)
HourFromTime(double t)
{
intN result = (intN) fmod(floor(t/msPerHour), HoursPerDay);
if (result < 0)
@ -466,7 +466,7 @@ HourFromTime(jsdouble t)
}
static intN
MinFromTime(jsdouble t)
MinFromTime(double t)
{
intN result = (intN) fmod(floor(t / msPerMinute), MinutesPerHour);
if (result < 0)
@ -475,7 +475,7 @@ MinFromTime(jsdouble t)
}
static intN
SecFromTime(jsdouble t)
SecFromTime(double t)
{
intN result = (intN) fmod(floor(t / msPerSecond), SecondsPerMinute);
if (result < 0)
@ -484,7 +484,7 @@ SecFromTime(jsdouble t)
}
static intN
msFromTime(jsdouble t)
msFromTime(double t)
{
intN result = (intN) fmod(t, msPerSecond);
if (result < 0)
@ -578,13 +578,13 @@ date_regionMatches(const char* s1, int s1off, const jschar* s2, int s2off,
}
/* find UTC time from given date... no 1900 correction! */
static jsdouble
date_msecFromDate(jsdouble year, jsdouble mon, jsdouble mday, jsdouble hour,
jsdouble min, jsdouble sec, jsdouble msec)
static double
date_msecFromDate(double year, double mon, double mday, double hour,
double min, double sec, double msec)
{
jsdouble day;
jsdouble msec_time;
jsdouble result;
double day;
double msec_time;
double result;
day = MakeDay(year, mon, mday);
msec_time = MakeTime(hour, min, sec, msec);
@ -599,12 +599,12 @@ static JSBool
date_msecFromArgs(JSContext *cx, CallArgs args, double *rval)
{
uintN loop;
jsdouble array[MAXARGS];
jsdouble msec_time;
double array[MAXARGS];
double msec_time;
for (loop = 0; loop < MAXARGS; loop++) {
if (loop < args.length()) {
jsdouble d;
double d;
if (!ToNumber(cx, args[loop], &d))
return JS_FALSE;
/* return NaN if any arg is not finite */
@ -640,7 +640,7 @@ date_UTC(JSContext *cx, uintN argc, Value *vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
jsdouble msec_time;
double msec_time;
if (!date_msecFromArgs(cx, args, &msec_time))
return JS_FALSE;
@ -680,9 +680,9 @@ digits(size_t *result, const jschar *s, size_t *i, size_t limit)
* as digits are consumed.
*/
static JSBool
fractional(jsdouble *result, const jschar *s, size_t *i, size_t limit)
fractional(double *result, const jschar *s, size_t *i, size_t limit)
{
jsdouble factor = 0.1;
double factor = 0.1;
size_t init = *i;
*result = 0.0;
while (*i < limit &&
@ -770,9 +770,9 @@ ndigits(size_t n, size_t *result, const jschar *s, size_t* i, size_t limit)
*/
static JSBool
date_parseISOString(JSLinearString *str, jsdouble *result, JSContext *cx)
date_parseISOString(JSLinearString *str, double *result, JSContext *cx)
{
jsdouble msec;
double msec;
const jschar *s;
size_t limit;
@ -785,7 +785,7 @@ date_parseISOString(JSLinearString *str, jsdouble *result, JSContext *cx)
size_t hour = 0;
size_t min = 0;
size_t sec = 0;
jsdouble frac = 0;
double frac = 0;
bool isLocalTime = JS_FALSE;
size_t tzHour = 0;
size_t tzMin = 0;
@ -879,7 +879,7 @@ date_parseISOString(JSLinearString *str, jsdouble *result, JSContext *cx)
month -= 1; /* convert month to 0-based */
msec = date_msecFromDate(dateMul * (jsdouble)year, month, day,
msec = date_msecFromDate(dateMul * (double)year, month, day,
hour, min, sec,
frac * 1000.0);;
@ -909,9 +909,9 @@ date_parseISOString(JSLinearString *str, jsdouble *result, JSContext *cx)
}
static JSBool
date_parseString(JSLinearString *str, jsdouble *result, JSContext *cx)
date_parseString(JSLinearString *str, double *result, JSContext *cx)
{
jsdouble msec;
double msec;
const jschar *s;
size_t limit;
@ -1184,7 +1184,7 @@ static JSBool
date_parse(JSContext *cx, uintN argc, Value *vp)
{
JSString *str;
jsdouble result;
double result;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -1208,10 +1208,10 @@ date_parse(JSContext *cx, uintN argc, Value *vp)
return true;
}
static inline jsdouble
static inline double
NowAsMillis()
{
return (jsdouble) (PRMJ_Now() / PRMJ_USEC_PER_MSEC);
return (double) (PRMJ_Now() / PRMJ_USEC_PER_MSEC);
}
static JSBool
@ -1225,7 +1225,7 @@ date_now(JSContext *cx, uintN argc, Value *vp)
* Set UTC time to a given time and invalidate cached local time.
*/
static JSBool
SetUTCTime(JSContext *cx, JSObject *obj, jsdouble t, Value *vp = NULL)
SetUTCTime(JSContext *cx, JSObject *obj, double t, Value *vp = NULL)
{
JS_ASSERT(obj->isDate());
@ -1244,7 +1244,7 @@ SetUTCTime(JSContext *cx, JSObject *obj, jsdouble t, Value *vp = NULL)
static void
SetDateToNaN(JSContext *cx, JSObject *obj, Value *vp = NULL)
{
jsdouble NaN = cx->runtime->NaNValue.getDoubleRef();
double NaN = cx->runtime->NaNValue.getDoubleRef();
SetUTCTime(cx, obj, NaN, vp);
}
@ -1258,7 +1258,7 @@ FillLocalTimes(JSContext *cx, JSObject *obj)
{
JS_ASSERT(obj->isDate());
jsdouble utcTime = obj->getDateUTCTime().toNumber();
double utcTime = obj->getDateUTCTime().toNumber();
if (!JSDOUBLE_IS_FINITE(utcTime)) {
for (size_t ind = JSObject::JSSLOT_DATE_COMPONENTS_START;
@ -1269,12 +1269,12 @@ FillLocalTimes(JSContext *cx, JSObject *obj)
return true;
}
jsdouble localTime = LocalTime(utcTime, cx);
double localTime = LocalTime(utcTime, cx);
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_TIME, DoubleValue(localTime));
jsint year = (jsint) floor(localTime /(msPerDay*365.2425)) + 1970;
jsdouble yearStartTime = (jsdouble) TimeFromYear(year);
double yearStartTime = (double) TimeFromYear(year);
/* Adjust the year in case the approximation was wrong, as in YearFromTime. */
jsint yearDays;
@ -1284,7 +1284,7 @@ FillLocalTimes(JSContext *cx, JSObject *obj)
yearDays = DaysInYear(year);
} else {
yearDays = DaysInYear(year);
jsdouble nextStart = yearStartTime + (msPerDay * yearDays);
double nextStart = yearStartTime + (msPerDay * yearDays);
if (nextStart <= localTime) {
year++;
yearStartTime = nextStart;
@ -1582,7 +1582,7 @@ date_getUTCDay(JSContext *cx, uintN argc, Value *vp)
if (!obj)
return ok;
jsdouble result = obj->getDateUTCTime().toNumber();
double result = obj->getDateUTCTime().toNumber();
if (JSDOUBLE_IS_FINITE(result))
result = WeekDay(result);
@ -1740,7 +1740,7 @@ date_setTime(JSContext *cx, uintN argc, Value *vp)
return true;
}
jsdouble result;
double result;
if (!ToNumber(cx, args[0], &result))
return false;
@ -2044,7 +2044,7 @@ static const char* months[] =
// Avoid dependence on PRMJ_FormatTimeUSEnglish, because it
// requires a PRMJTime... which only has 16-bit years. Sub-ECMA.
static void
print_gmt_string(char* buf, size_t size, jsdouble utctime)
print_gmt_string(char* buf, size_t size, double utctime)
{
JS_snprintf(buf, size, "%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
days[WeekDay(utctime)],
@ -2057,7 +2057,7 @@ print_gmt_string(char* buf, size_t size, jsdouble utctime)
}
static void
print_iso_string(char* buf, size_t size, jsdouble utctime)
print_iso_string(char* buf, size_t size, double utctime)
{
JS_snprintf(buf, size, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2d.%.3dZ",
YearFromTime(utctime),
@ -2071,7 +2071,7 @@ print_iso_string(char* buf, size_t size, jsdouble utctime)
static JSBool
date_utc_format(JSContext *cx, Native native, CallArgs args,
void (*printFunc)(char*, size_t, jsdouble))
void (*printFunc)(char*, size_t, double))
{
bool ok;
JSObject *obj = NonGenericMethodGuard(cx, args, native, &DateClass, &ok);
@ -2160,7 +2160,7 @@ date_toJSON(JSContext *cx, uintN argc, Value *vp)
/* for Date.toLocaleString; interface to PRMJTime date struct.
*/
static void
new_explode(jsdouble timeval, PRMJTime *split, JSContext *cx)
new_explode(double timeval, PRMJTime *split, JSContext *cx)
{
jsint year = YearFromTime(timeval);
@ -2185,7 +2185,7 @@ typedef enum formatspec {
/* helper function */
static JSBool
date_format(JSContext *cx, jsdouble date, formatspec format, CallReceiver call)
date_format(JSContext *cx, double date, formatspec format, CallReceiver call)
{
char buf[100];
JSString *str;
@ -2197,7 +2197,7 @@ date_format(JSContext *cx, jsdouble date, formatspec format, CallReceiver call)
if (!JSDOUBLE_IS_FINITE(date)) {
JS_snprintf(buf, sizeof buf, js_NaN_date_str);
} else {
jsdouble local = LocalTime(date, cx);
double local = LocalTime(date, cx);
/* offset from GMT in minutes. The offset includes daylight savings,
if it applies. */
@ -2307,7 +2307,7 @@ ToLocaleHelper(JSContext *cx, CallReceiver call, JSObject *obj, const char *form
JS_snprintf(buf, sizeof buf, js_NaN_date_str);
} else {
intN result_len;
jsdouble local = LocalTime(utctime, cx);
double local = LocalTime(utctime, cx);
PRMJTime split;
new_explode(local, &split, cx);
@ -2595,7 +2595,7 @@ js_Date(JSContext *cx, uintN argc, Value *vp)
return date_format(cx, NowAsMillis(), FORMATSPEC_FULL, args);
/* Date called as constructor. */
jsdouble d;
double d;
if (args.length() == 0) {
d = NowAsMillis();
} else if (args.length() == 1) {
@ -2620,7 +2620,7 @@ js_Date(JSContext *cx, uintN argc, Value *vp)
d = TIMECLIP(d);
}
} else {
jsdouble msec_time;
double msec_time;
if (!date_msecFromArgs(cx, args, &msec_time))
return false;
@ -2689,7 +2689,7 @@ js_InitDateClass(JSContext *cx, JSObject *obj)
}
JS_FRIEND_API(JSObject *)
js_NewDateObjectMsec(JSContext *cx, jsdouble msec_time)
js_NewDateObjectMsec(JSContext *cx, double msec_time)
{
JSObject *obj = NewBuiltinClassInstance(cx, &DateClass);
if (!obj)
@ -2704,7 +2704,7 @@ js_NewDateObject(JSContext* cx, int year, int mon, int mday,
int hour, int min, int sec)
{
JSObject *obj;
jsdouble msec_time;
double msec_time;
JS_ASSERT(mon < 12);
msec_time = date_msecFromDate(year, mon, mday, hour, min, sec, 0);
@ -2721,7 +2721,7 @@ js_DateIsValid(JSContext *cx, JSObject* obj)
JS_FRIEND_API(int)
js_DateGetYear(JSContext *cx, JSObject* obj)
{
jsdouble localtime;
double localtime;
/* Preserve legacy API behavior of returning 0 for invalid dates. */
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
@ -2735,7 +2735,7 @@ js_DateGetYear(JSContext *cx, JSObject* obj)
JS_FRIEND_API(int)
js_DateGetMonth(JSContext *cx, JSObject* obj)
{
jsdouble localtime;
double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
@ -2748,7 +2748,7 @@ js_DateGetMonth(JSContext *cx, JSObject* obj)
JS_FRIEND_API(int)
js_DateGetDate(JSContext *cx, JSObject* obj)
{
jsdouble localtime;
double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
@ -2761,7 +2761,7 @@ js_DateGetDate(JSContext *cx, JSObject* obj)
JS_FRIEND_API(int)
js_DateGetHours(JSContext *cx, JSObject* obj)
{
jsdouble localtime;
double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
@ -2774,7 +2774,7 @@ js_DateGetHours(JSContext *cx, JSObject* obj)
JS_FRIEND_API(int)
js_DateGetMinutes(JSContext *cx, JSObject* obj)
{
jsdouble localtime;
double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
@ -2796,7 +2796,7 @@ js_DateGetSeconds(JSContext *cx, JSObject* obj)
return (int) SecFromTime(utctime);
}
JS_FRIEND_API(jsdouble)
JS_FRIEND_API(double)
js_DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj)
{
return obj->isDate() ? obj->getDateUTCTime().toNumber() : 0;

View File

@ -64,7 +64,7 @@ js_InitDateClass(JSContext *cx, JSObject *obj);
* since the epoch.
*/
extern JS_FRIEND_API(JSObject*)
js_NewDateObjectMsec(JSContext* cx, jsdouble msec_time);
js_NewDateObjectMsec(JSContext* cx, double msec_time);
/*
* Construct a new Date Object from an exploded local time value.

View File

@ -2367,7 +2367,7 @@ BEGIN_CASE(JSOP_NEG)
/*
* When the operand is int jsval, INT32_FITS_IN_JSVAL(i) implies
* INT32_FITS_IN_JSVAL(-i) unless i is 0 or INT32_MIN when the
* results, -0.0 or INT32_MAX + 1, are jsdouble values.
* results, -0.0 or INT32_MAX + 1, are double values.
*/
Value ref = regs.sp[-1];
int32_t i;

View File

@ -119,7 +119,7 @@ Class js::MathClass = {
JSBool
js_math_abs(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -135,7 +135,7 @@ js_math_abs(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_acos(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -160,7 +160,7 @@ math_acos(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_asin(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -185,7 +185,7 @@ math_asin(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_atan(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -201,8 +201,8 @@ math_atan(JSContext *cx, uintN argc, Value *vp)
return JS_TRUE;
}
static inline jsdouble JS_FASTCALL
math_atan2_kernel(jsdouble x, jsdouble y)
static inline double JS_FASTCALL
math_atan2_kernel(double x, double y)
{
#if defined(_MSC_VER)
/*
@ -213,7 +213,7 @@ math_atan2_kernel(jsdouble x, jsdouble y)
* - The sign of y determines the multiplicator, 1 or 3.
*/
if (JSDOUBLE_IS_INFINITE(x) && JSDOUBLE_IS_INFINITE(y)) {
jsdouble z = js_copysign(M_PI / 4, x);
double z = js_copysign(M_PI / 4, x);
if (y < 0)
z *= 3;
return z;
@ -234,7 +234,7 @@ math_atan2_kernel(jsdouble x, jsdouble y)
static JSBool
math_atan2(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, y, z;
double x, y, z;
if (argc <= 1) {
vp->setDouble(js_NaN);
@ -247,8 +247,8 @@ math_atan2(JSContext *cx, uintN argc, Value *vp)
return JS_TRUE;
}
jsdouble
js_math_ceil_impl(jsdouble x)
double
js_math_ceil_impl(double x)
{
#ifdef __APPLE__
if (x < 0 && x > -1.0)
@ -260,7 +260,7 @@ js_math_ceil_impl(jsdouble x)
JSBool
js_math_ceil(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -276,7 +276,7 @@ js_math_ceil(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_cos(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -309,7 +309,7 @@ math_exp_body(double d)
static JSBool
math_exp(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -325,8 +325,8 @@ math_exp(JSContext *cx, uintN argc, Value *vp)
return JS_TRUE;
}
jsdouble
js_math_floor_impl(jsdouble x)
double
js_math_floor_impl(double x)
{
return floor(x);
}
@ -334,7 +334,7 @@ js_math_floor_impl(jsdouble x)
JSBool
js_math_floor(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -350,7 +350,7 @@ js_math_floor(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_log(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -375,7 +375,7 @@ math_log(JSContext *cx, uintN argc, Value *vp)
JSBool
js_math_max(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z = js_NegativeInfinity;
double x, z = js_NegativeInfinity;
Value *argv;
uintN i;
@ -405,7 +405,7 @@ js_math_max(JSContext *cx, uintN argc, Value *vp)
JSBool
js_math_min(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z = js_PositiveInfinity;
double x, z = js_PositiveInfinity;
Value *argv;
uintN i;
@ -432,12 +432,12 @@ js_math_min(JSContext *cx, uintN argc, Value *vp)
return JS_TRUE;
}
static jsdouble
powi(jsdouble x, jsint y)
static double
powi(double x, jsint y)
{
jsuint n = (y < 0) ? -y : y;
jsdouble m = x;
jsdouble p = 1;
double m = x;
double p = 1;
while (true) {
if ((n & 1) != 0) p *= m;
n >>= 1;
@ -448,9 +448,9 @@ powi(jsdouble x, jsint y)
// internal precision in the pow() implementation would have
// given us a finite p. This happens very rarely.
jsdouble result = 1.0 / p;
double result = 1.0 / p;
return (result == 0 && JSDOUBLE_IS_INFINITE(p))
? pow(x, static_cast<jsdouble>(y)) // Avoid pow(double, int).
? pow(x, static_cast<double>(y)) // Avoid pow(double, int).
: result;
}
@ -463,7 +463,7 @@ powi(jsdouble x, jsint y)
JSBool
js_math_pow(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, y, z;
double x, y, z;
if (argc <= 1) {
vp->setDouble(js_NaN);
@ -511,7 +511,7 @@ js_math_pow(JSContext *cx, uintN argc, Value *vp)
static const int64_t RNG_MULTIPLIER = 0x5DEECE66DLL;
static const int64_t RNG_ADDEND = 0xBLL;
static const int64_t RNG_MASK = (1LL << 48) - 1;
static const jsdouble RNG_DSCALE = jsdouble(1LL << 53);
static const double RNG_DSCALE = double(1LL << 53);
/*
* Math.random() support, lifted from java.util.Random.java.
@ -544,17 +544,17 @@ random_next(int64_t *rngSeed, int bits)
return nextseed >> (48 - bits);
}
static inline jsdouble
static inline double
random_nextDouble(JSContext *cx)
{
return jsdouble((random_next(&cx->rngSeed, 26) << 27) + random_next(&cx->rngSeed, 27)) /
return double((random_next(&cx->rngSeed, 26) << 27) + random_next(&cx->rngSeed, 27)) /
RNG_DSCALE;
}
static JSBool
math_random(JSContext *cx, uintN argc, Value *vp)
{
jsdouble z = random_nextDouble(cx);
double z = random_nextDouble(cx);
vp->setDouble(z);
return JS_TRUE;
}
@ -612,7 +612,7 @@ js_math_round(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_sin(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -631,7 +631,7 @@ math_sin(JSContext *cx, uintN argc, Value *vp)
JSBool
js_math_sqrt(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
@ -650,7 +650,7 @@ js_math_sqrt(JSContext *cx, uintN argc, Value *vp)
static JSBool
math_tan(JSContext *cx, uintN argc, Value *vp)
{
jsdouble x, z;
double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);

View File

@ -115,10 +115,10 @@ js_math_sqrt(JSContext *cx, uintN argc, js::Value *vp);
extern JSBool
js_math_pow(JSContext *cx, uintN argc, js::Value *vp);
extern jsdouble
js_math_ceil_impl(jsdouble x);
extern double
js_math_ceil_impl(double x);
extern jsdouble
js_math_floor_impl(jsdouble x);
extern double
js_math_floor_impl(double x);
#endif /* jsmath_h___ */

View File

@ -93,7 +93,7 @@ using namespace js::types;
* js_strtod_harder to get the correct answer.
*/
static bool
ComputeAccurateDecimalInteger(JSContext *cx, const jschar *start, const jschar *end, jsdouble *dp)
ComputeAccurateDecimalInteger(JSContext *cx, const jschar *start, const jschar *end, double *dp)
{
size_t length = end - start;
char *cstr = static_cast<char *>(cx->malloc_(length + 1));
@ -167,7 +167,7 @@ class BinaryDigitReader
* down. An example occurs when reading the number 0x1000000000000081, which
* rounds to 0x1000000000000000 instead of 0x1000000000000100.
*/
static jsdouble
static double
ComputeAccurateBinaryBaseInteger(JSContext *cx, const jschar *start, const jschar *end, int base)
{
BinaryDigitReader bdr(base, start, end);
@ -181,7 +181,7 @@ ComputeAccurateBinaryBaseInteger(JSContext *cx, const jschar *start, const jscha
JS_ASSERT(bit == 1); // guaranteed by GetPrefixInteger
/* Gather the 53 significant bits (including the leading 1). */
jsdouble value = 1.0;
double value = 1.0;
for (int j = 52; j > 0; j--) {
bit = bdr.nextDigit();
if (bit < 0)
@ -192,7 +192,7 @@ ComputeAccurateBinaryBaseInteger(JSContext *cx, const jschar *start, const jscha
/* bit2 is the 54th bit (the first dropped from the mantissa). */
int bit2 = bdr.nextDigit();
if (bit2 >= 0) {
jsdouble factor = 2.0;
double factor = 2.0;
int sticky = 0; /* sticky is 1 if any bit beyond the 54th is 1 */
int bit3;
@ -211,13 +211,13 @@ namespace js {
bool
GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base,
const jschar **endp, jsdouble *dp)
const jschar **endp, double *dp)
{
JS_ASSERT(start <= end);
JS_ASSERT(2 <= base && base <= 36);
const jschar *s = start;
jsdouble d = 0.0;
double d = 0.0;
for (; s < end; s++) {
int digit;
jschar c = *s;
@ -263,7 +263,7 @@ num_isNaN(JSContext *cx, uintN argc, Value *vp)
vp->setBoolean(true);
return JS_TRUE;
}
jsdouble x;
double x;
if (!ToNumber(cx, vp[2], &x))
return false;
vp->setBoolean(JSDOUBLE_IS_NaN(x));
@ -277,7 +277,7 @@ num_isFinite(JSContext *cx, uintN argc, Value *vp)
vp->setBoolean(false);
return JS_TRUE;
}
jsdouble x;
double x;
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
vp->setBoolean(JSDOUBLE_IS_FINITE(x));
@ -288,7 +288,7 @@ static JSBool
num_parseFloat(JSContext *cx, uintN argc, Value *vp)
{
JSString *str;
jsdouble d;
double d;
const jschar *bp, *end, *ep;
if (argc == 0) {
@ -314,7 +314,7 @@ num_parseFloat(JSContext *cx, uintN argc, Value *vp)
static bool
ParseIntStringHelper(JSContext *cx, const jschar *ws, const jschar *end, int maybeRadix,
bool stripPrefix, jsdouble *dp)
bool stripPrefix, double *dp)
{
JS_ASSERT(maybeRadix == 0 || (2 <= maybeRadix && maybeRadix <= 36));
JS_ASSERT(ws <= end);
@ -439,7 +439,7 @@ js::num_parseInt(JSContext *cx, uintN argc, Value *vp)
return false;
const jschar *end = ws + inputString->length();
jsdouble number;
double number;
if (!ParseIntStringHelper(cx, ws, end, radix, stripPrefix, &number))
return false;
@ -610,7 +610,7 @@ IntToCString(ToCStringBuf *cbuf, jsint i, jsint base = 10)
}
static JSString * JS_FASTCALL
js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base);
js_NumberToStringWithBase(JSContext *cx, double d, jsint base);
static JS_ALWAYS_INLINE bool
num_toStringHelper(JSContext *cx, Native native, uintN argc, Value *vp)
@ -624,7 +624,7 @@ num_toStringHelper(JSContext *cx, Native native, uintN argc, Value *vp)
int32_t base = 10;
if (args.length() != 0 && !args[0].isUndefined()) {
jsdouble d2;
double d2;
if (!ToInteger(cx, args[0], &d2))
return false;
@ -893,9 +893,9 @@ static JSConstDoubleSpec number_constants[] = {
{0,0,0,{0,0,0}}
};
jsdouble js_NaN;
jsdouble js_PositiveInfinity;
jsdouble js_NegativeInfinity;
double js_NaN;
double js_PositiveInfinity;
double js_NegativeInfinity;
#if (defined __GNUC__ && defined __i386__) || \
(defined __SUNPRO_CC && defined __i386)
@ -1064,7 +1064,7 @@ extern char* DoubleToCString(double v, char* buffer, int buflen);
namespace js {
static char *
FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base = 10)
FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base = 10)
{
#ifdef DEBUG
{
@ -1096,7 +1096,7 @@ FracNumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base =
}
char *
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base/* = 10*/)
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base/* = 10*/)
{
int32_t i;
return (JSDOUBLE_IS_INT32(d, &i))
@ -1107,7 +1107,7 @@ NumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base/* = 10
}
static JSString * JS_FASTCALL
js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base)
js_NumberToStringWithBase(JSContext *cx, double d, jsint base)
{
ToCStringBuf cbuf;
char *numStr;
@ -1160,7 +1160,7 @@ js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base)
}
JSString * JS_FASTCALL
js_NumberToString(JSContext *cx, jsdouble d)
js_NumberToString(JSContext *cx, double d)
{
return js_NumberToStringWithBase(cx, d, 10);
}
@ -1168,7 +1168,7 @@ js_NumberToString(JSContext *cx, jsdouble d)
namespace js {
JSFixedString *
NumberToString(JSContext *cx, jsdouble d)
NumberToString(JSContext *cx, double d)
{
if (JSString *str = js_NumberToStringWithBase(cx, d, 10))
return &str->asFixed();
@ -1239,7 +1239,7 @@ ToNumberSlow(JSContext *cx, Value v, double *out)
}
skip_int_double:
if (v.isString())
return StringToNumberType<jsdouble>(cx, v.toString(), out);
return StringToNumberType<double>(cx, v.toString(), out);
if (v.isBoolean()) {
if (v.toBoolean()) {
*out = 1.0;
@ -1270,7 +1270,7 @@ bool
ToInt32Slow(JSContext *cx, const Value &v, int32_t *out)
{
JS_ASSERT(!v.isInt32());
jsdouble d;
double d;
if (v.isDouble()) {
d = v.toDouble();
} else {
@ -1285,7 +1285,7 @@ bool
ToUint32Slow(JSContext *cx, const Value &v, uint32_t *out)
{
JS_ASSERT(!v.isInt32());
jsdouble d;
double d;
if (v.isDouble()) {
d = v.toDouble();
} else {
@ -1304,7 +1304,7 @@ bool
NonstandardToInt32Slow(JSContext *cx, const Value &v, int32_t *out)
{
JS_ASSERT(!v.isInt32());
jsdouble d;
double d;
if (v.isDouble()) {
d = v.toDouble();
} else if (!ToNumberSlow(cx, v, &d)) {
@ -1324,7 +1324,7 @@ bool
ValueToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
{
JS_ASSERT(!v.isInt32());
jsdouble d;
double d;
if (v.isDouble()) {
d = v.toDouble();
} else if (!ToNumberSlow(cx, v, &d)) {
@ -1337,7 +1337,7 @@ ValueToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
}
uint16_t u = (uint16_t) d;
if ((jsdouble)u == d) {
if ((double)u == d) {
*out = u;
return true;
}
@ -1357,13 +1357,13 @@ ValueToUint16Slow(JSContext *cx, const Value &v, uint16_t *out)
JSBool
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
const jschar **ep, jsdouble *dp)
const jschar **ep, double *dp)
{
size_t i;
char cbuf[32];
char *cstr, *istr, *estr;
JSBool negative;
jsdouble d;
double d;
const jschar *s1 = SkipSpace(s, send);
size_t length = send - s1;

View File

@ -83,11 +83,11 @@ typedef union jsdpun {
#endif
} s;
uint64_t u64;
jsdouble d;
double d;
} jsdpun;
static inline int
JSDOUBLE_IS_NaN(jsdouble d)
JSDOUBLE_IS_NaN(double d)
{
jsdpun u;
u.d = d;
@ -96,7 +96,7 @@ JSDOUBLE_IS_NaN(jsdouble d)
}
static inline int
JSDOUBLE_IS_FINITE(jsdouble d)
JSDOUBLE_IS_FINITE(double d)
{
/* -0 is finite. NaNs are not. */
jsdpun u;
@ -105,7 +105,7 @@ JSDOUBLE_IS_FINITE(jsdouble d)
}
static inline int
JSDOUBLE_IS_INFINITE(jsdouble d)
JSDOUBLE_IS_INFINITE(double d)
{
jsdpun u;
u.d = d;
@ -113,7 +113,7 @@ JSDOUBLE_IS_INFINITE(jsdouble d)
}
static inline bool
JSDOUBLE_IS_NEG(jsdouble d)
JSDOUBLE_IS_NEG(double d)
{
jsdpun u;
u.d = d;
@ -121,16 +121,16 @@ JSDOUBLE_IS_NEG(jsdouble d)
}
static inline uint32_t
JS_HASH_DOUBLE(jsdouble d)
JS_HASH_DOUBLE(double d)
{
jsdpun u;
u.d = d;
return u.s.lo ^ u.s.hi;
}
extern jsdouble js_NaN;
extern jsdouble js_PositiveInfinity;
extern jsdouble js_NegativeInfinity;
extern double js_NaN;
extern double js_PositiveInfinity;
extern double js_NegativeInfinity;
namespace js {
@ -168,7 +168,7 @@ js_IntToString(JSContext *cx, jsint i);
* performance. See also js::NumberToCString().
*/
extern JSString * JS_FASTCALL
js_NumberToString(JSContext *cx, jsdouble d);
js_NumberToString(JSContext *cx, double d);
namespace js {
@ -181,7 +181,7 @@ NumberValueToStringBuffer(JSContext *cx, const Value &v, StringBuffer &sb);
/* Same as js_NumberToString, different signature. */
extern JSFixedString *
NumberToString(JSContext *cx, jsdouble d);
NumberToString(JSContext *cx, double d);
extern JSFixedString *
IndexToString(JSContext *cx, uint32_t index);
@ -213,7 +213,7 @@ struct ToCStringBuf
* js_NumberToCString().
*/
extern char *
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, jsdouble d, jsint base = 10);
NumberToCString(JSContext *cx, ToCStringBuf *cbuf, double d, jsint base = 10);
/*
* The largest positive integer such that all positive integers less than it
@ -235,7 +235,7 @@ const double DOUBLE_INTEGRAL_PRECISION_LIMIT = uint64_t(1) << 53;
*/
extern bool
GetPrefixInteger(JSContext *cx, const jschar *start, const jschar *end, int base,
const jschar **endp, jsdouble *dp);
const jschar **endp, double *dp);
/* ES5 9.3 ToNumber. */
JS_ALWAYS_INLINE bool
@ -341,7 +341,7 @@ num_parseInt(JSContext *cx, uintN argc, Value *vp);
* otherwise return Result(4).
*/
static inline int32_t
js_DoubleToECMAInt32(jsdouble d)
js_DoubleToECMAInt32(double d)
{
#if defined(__i386__) || defined(__i386) || defined(__x86_64__) || \
defined(_M_IX86) || defined(_M_X64)
@ -539,13 +539,13 @@ js_DoubleToECMAInt32(jsdouble d)
return i;
#else
int32_t i;
jsdouble two32, two31;
double two32, two31;
if (!JSDOUBLE_IS_FINITE(d))
return 0;
i = (int32_t) d;
if ((jsdouble) i == d)
if ((double) i == d)
return i;
two32 = 4294967296.0;
@ -557,17 +557,17 @@ js_DoubleToECMAInt32(jsdouble d)
}
inline uint32_t
js_DoubleToECMAUint32(jsdouble d)
js_DoubleToECMAUint32(double d)
{
return uint32_t(js_DoubleToECMAInt32(d));
}
/*
* Convert a jsdouble to an integral number, stored in a jsdouble.
* Convert a double to an integral number, stored in a double.
* If d is NaN, return 0. If d is an infinity, return it without conversion.
*/
static inline jsdouble
js_DoubleToInteger(jsdouble d)
static inline double
js_DoubleToInteger(double d)
{
if (d == 0)
return d;
@ -596,7 +596,7 @@ js_DoubleToInteger(jsdouble d)
*/
extern JSBool
js_strtod(JSContext *cx, const jschar *s, const jschar *send,
const jschar **ep, jsdouble *dp);
const jschar **ep, double *dp);
extern JSBool
js_num_valueOf(JSContext *cx, uintN argc, js::Value *vp);
@ -641,7 +641,7 @@ IsDefinitelyIndex(const Value &v, uint32_t *indexp)
/* ES5 9.4 ToInteger. */
static inline bool
ToInteger(JSContext *cx, const js::Value &v, jsdouble *dp)
ToInteger(JSContext *cx, const js::Value &v, double *dp)
{
if (v.isInt32()) {
*dp = v.toInt32();

View File

@ -51,12 +51,12 @@ template<typename T> struct NumberTraits { };
template<> struct NumberTraits<int32_t> {
static JS_ALWAYS_INLINE int32_t NaN() { return 0; }
static JS_ALWAYS_INLINE int32_t toSelfType(int32_t i) { return i; }
static JS_ALWAYS_INLINE int32_t toSelfType(jsdouble d) { return js_DoubleToECMAUint32(d); }
static JS_ALWAYS_INLINE int32_t toSelfType(double d) { return js_DoubleToECMAUint32(d); }
};
template<> struct NumberTraits<jsdouble> {
static JS_ALWAYS_INLINE jsdouble NaN() { return js_NaN; }
static JS_ALWAYS_INLINE jsdouble toSelfType(int32_t i) { return i; }
static JS_ALWAYS_INLINE jsdouble toSelfType(jsdouble d) { return d; }
template<> struct NumberTraits<double> {
static JS_ALWAYS_INLINE double NaN() { return js_NaN; }
static JS_ALWAYS_INLINE double toSelfType(int32_t i) { return i; }
static JS_ALWAYS_INLINE double toSelfType(double d) { return d; }
};
template<typename T>

View File

@ -709,7 +709,7 @@ js_Stringify(JSContext *cx, Value *vp, JSObject *replacer, Value space, StringBu
if (space.isObject()) {
JSObject &spaceObj = space.toObject();
if (ObjectClassIs(spaceObj, ESClass_Number, cx)) {
jsdouble d;
double d;
if (!ToNumber(cx, space, &d))
return false;
space = NumberValue(d);
@ -725,7 +725,7 @@ js_Stringify(JSContext *cx, Value *vp, JSObject *replacer, Value space, StringBu
if (space.isNumber()) {
/* Step 6. */
jsdouble d;
double d;
JS_ALWAYS_TRUE(ToInteger(cx, space, &d));
d = JS_MIN(10, d);
if (d >= 1 && !gap.appendN(' ', uint32_t(d)))

View File

@ -217,7 +217,7 @@ JSONParser::readNumber()
/* Fast path: no fractional or exponent part. */
if (current == end || (*current != '.' && *current != 'e' && *current != 'E')) {
const jschar *dummy;
jsdouble d;
double d;
if (!GetPrefixInteger(cx, digitStart.get(), current.get(), 10, &dummy, &d))
return token(OOM);
JS_ASSERT(current == dummy);
@ -262,7 +262,7 @@ JSONParser::readNumber()
}
}
jsdouble d;
double d;
const jschar *finish;
if (!js_strtod(cx, digitStart.get(), current.get(), &finish, &d))
return token(OOM);

View File

@ -152,7 +152,7 @@ class JSONParser
return String;
}
Token numberToken(jsdouble d) {
Token numberToken(double d) {
this->v = js::NumberValue(d);
#ifdef DEBUG
lastToken = Number;

View File

@ -1598,7 +1598,7 @@ CompareTableEntries(const TableEntry &a, const TableEntry &b, bool *lessOrEqualp
static ptrdiff_t
SprintDoubleValue(Sprinter *sp, jsval v, JSOp *opp)
{
jsdouble d;
double d;
ptrdiff_t todo;
char *s;

View File

@ -97,7 +97,6 @@ JS_BEGIN_EXTERN_C
/* Scalar typedefs. */
typedef int32_t jsint;
typedef uint32_t jsuint;
typedef double jsdouble;
typedef int32_t jsrefcount; /* PRInt32 if JS_THREADSAFE, see jslock.h */
#ifdef WIN32

View File

@ -1065,7 +1065,7 @@ JSScript::NewScript(JSContext *cx, uint32_t length, uint32_t nsrcnotes, uint32_t
* We assume that calloc aligns on sizeof(Value) if the size we ask to
* allocate divides sizeof(Value).
*/
JS_STATIC_ASSERT(sizeof(Value) == sizeof(jsdouble));
JS_STATIC_ASSERT(sizeof(Value) == sizeof(double));
data = static_cast<uint8_t *>(cx->calloc_(JS_ROUNDUP(size, sizeof(Value))));
if (!data)
return NULL;

View File

@ -1178,7 +1178,7 @@ str_indexOf(JSContext *cx, uintN argc, Value *vp)
textlen -= start;
}
} else {
jsdouble d;
double d;
if (!ToInteger(cx, args[1], &d))
return false;
if (d <= 0) {
@ -2556,7 +2556,7 @@ js::str_split(JSContext *cx, uintN argc, Value *vp)
/* Step 5: Use the second argument as the split limit, if given. */
uint32_t limit;
if (args.length() > 1 && !args[1].isUndefined()) {
jsdouble d;
double d;
if (!ToNumber(cx, args[1], &d))
return false;
limit = js_DoubleToECMAUint32(d);

View File

@ -93,12 +93,12 @@ ValueIsLength(JSContext *cx, const Value &v, jsuint *len)
}
if (v.isDouble()) {
jsdouble d = v.toDouble();
double d = v.toDouble();
if (JSDOUBLE_IS_NaN(d))
return false;
jsuint length = jsuint(d);
if (d != jsdouble(length))
if (d != double(length))
return false;
*len = length;
@ -951,7 +951,7 @@ js_TypedArray_uint8_clamp_double(const double x)
if (x > 255)
return 255;
jsdouble toTruncate = x + 0.5;
double toTruncate = x + 0.5;
uint8_t y = uint8_t(toTruncate);
/*
@ -987,7 +987,7 @@ struct uint8_clamped {
uint8_clamped(int8_t x) { *this = x; }
uint8_clamped(int16_t x) { *this = x; }
uint8_clamped(int32_t x) { *this = x; }
uint8_clamped(jsdouble x) { *this = x; }
uint8_clamped(double x) { *this = x; }
inline uint8_clamped& operator= (const uint8_clamped& x) {
val = x.val;
@ -1032,7 +1032,7 @@ struct uint8_clamped {
return *this;
}
inline uint8_clamped& operator= (const jsdouble x) {
inline uint8_clamped& operator= (const double x) {
val = uint8_t(js_TypedArray_uint8_clamp_double(x));
return *this;
}
@ -1209,7 +1209,7 @@ class TypedArrayTemplate
return true;
}
jsdouble d;
double d;
if (vp->isDouble()) {
d = vp->toDouble();
} else if (vp->isNull()) {
@ -1811,7 +1811,7 @@ class TypedArrayTemplate
* are treated identically.
*/
if (v.isPrimitive() && !v.isMagic() && !v.isUndefined()) {
jsdouble dval;
double dval;
JS_ALWAYS_TRUE(ToNumber(cx, v, &dval));
return nativeFromDouble(dval);
}

View File

@ -473,7 +473,7 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSString **strp)
}
JS_PUBLIC_API(JSBool)
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
JS_XDRDouble(JSXDRState *xdr, double *dp)
{
jsdpun u;

View File

@ -158,7 +158,7 @@ extern JS_PUBLIC_API(JSBool)
JS_XDRStringOrNull(JSXDRState *xdr, JSString **strp);
extern JS_PUBLIC_API(JSBool)
JS_XDRDouble(JSXDRState *xdr, jsdouble *dp);
JS_XDRDouble(JSXDRState *xdr, double *dp);
extern JS_PUBLIC_API(JSBool)
JS_XDRFunctionObject(JSXDRState *xdr, JSObject **objp);

View File

@ -5242,7 +5242,7 @@ js_TestXMLEquality(JSContext *cx, const Value &v1, const Value &v2, JSBool *bp)
JSObject *vobj;
JSBool ok;
JSString *str, *vstr;
jsdouble d, d2;
double d, d2;
JSObject *obj;
jsval v;

View File

@ -82,10 +82,10 @@ ConstantFoldForFloatArray(JSContext *cx, ValueRemat *vr)
if (vr->knownType() == JSVAL_TYPE_DOUBLE)
return true;
jsdouble d = 0;
double d = 0;
Value v = vr->value();
if (v.isString()) {
if (!StringToNumberType<jsdouble>(cx, v.toString(), &d))
if (!StringToNumberType<double>(cx, v.toString(), &d))
return false;
} else if (v.isBoolean()) {
d = v.toBoolean() ? 1 : 0;

View File

@ -91,7 +91,7 @@ pm_finalize(JSContext* cx, JSObject* obj)
PerfMeasurement* p = GetPM(cx, obj, #name); \
if (!p) \
return JS_FALSE; \
return JS_NewNumberValue(cx, jsdouble(p->name), vp); \
return JS_NewNumberValue(cx, double(p->name), vp); \
}
GETTER(cpu_cycles)

View File

@ -150,8 +150,8 @@ static uintptr_t gStackBase;
* Limit the timeout to 30 minutes to prevent an overflow on platfoms
* that represent the time internally in microseconds using 32-bit int.
*/
static jsdouble MAX_TIMEOUT_INTERVAL = 1800.0;
static jsdouble gTimeoutInterval = -1.0;
static double MAX_TIMEOUT_INTERVAL = 1800.0;
static double gTimeoutInterval = -1.0;
static volatile bool gCanceled = false;
static bool enableMethodJit = false;
@ -161,7 +161,7 @@ static bool enableDisassemblyDumps = false;
static bool printTiming = false;
static JSBool
SetTimeoutValue(JSContext *cx, jsdouble t);
SetTimeoutValue(JSContext *cx, double t);
static bool
InitWatchdog(JSRuntime *rt);
@ -170,7 +170,7 @@ static void
KillWatchdog();
static bool
ScheduleWatchdog(JSRuntime *rt, jsdouble t);
ScheduleWatchdog(JSRuntime *rt, double t);
static void
CancelExecution(JSRuntime *rt);
@ -683,7 +683,7 @@ Version(JSContext *cx, uintN argc, jsval *vp)
if (JSVAL_IS_INT(argv[0])) {
v = JSVAL_TO_INT(argv[0]);
} else if (JSVAL_IS_DOUBLE(argv[0])) {
jsdouble fv = JSVAL_TO_DOUBLE(argv[0]);
double fv = JSVAL_TO_DOUBLE(argv[0]);
if (int32_t(fv) == fv)
v = int32_t(fv);
}
@ -1113,7 +1113,7 @@ PutStr(JSContext *cx, uintN argc, jsval *vp)
static JSBool
Now(JSContext *cx, uintN argc, jsval *vp)
{
jsdouble now = PRMJ_Now() / double(PRMJ_USEC_PER_MSEC);
double now = PRMJ_Now() / double(PRMJ_USEC_PER_MSEC);
JS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(now));
return true;
}
@ -1613,7 +1613,7 @@ CountHeap(JSContext *cx, uintN argc, jsval *vp)
}
JS_DHashTableFinish(&countTracer.visited);
return countTracer.ok && JS_NewNumberValue(cx, (jsdouble) counter, vp);
return countTracer.ok && JS_NewNumberValue(cx, (double) counter, vp);
}
static jsrefcount finalizeCount = 0;
@ -2659,7 +2659,7 @@ ZZ_formatter(JSContext *cx, const char *format, JSBool fromJS, jsval **vpp,
{
jsval *vp;
va_list ap;
jsdouble re, im;
double re, im;
printf("entering ZZ_formatter");
vp = *vpp;
@ -2669,11 +2669,11 @@ ZZ_formatter(JSContext *cx, const char *format, JSBool fromJS, jsval **vpp,
return JS_FALSE;
if (!JS_ValueToNumber(cx, vp[1], &im))
return JS_FALSE;
*va_arg(ap, jsdouble *) = re;
*va_arg(ap, jsdouble *) = im;
*va_arg(ap, double *) = re;
*va_arg(ap, double *) = im;
} else {
re = va_arg(ap, jsdouble);
im = va_arg(ap, jsdouble);
re = va_arg(ap, double);
im = va_arg(ap, double);
if (!JS_NewNumberValue(cx, re, &vp[0]))
return JS_FALSE;
if (!JS_NewNumberValue(cx, im, &vp[1]))
@ -2692,7 +2692,7 @@ ConvertArgs(JSContext *cx, uintN argc, jsval *vp)
jschar c = 0;
int32_t i = 0, j = 0;
uint32_t u = 0;
jsdouble d = 0, I = 0, re = 0, im = 0;
double d = 0, I = 0, re = 0, im = 0;
JSString *str = NULL;
jschar *w = NULL;
JSObject *obj2 = NULL;
@ -3318,7 +3318,7 @@ Sleep_fn(JSContext *cx, uintN argc, jsval *vp)
if (argc == 0) {
t_ticks = 0;
} else {
jsdouble t_secs;
double t_secs;
if (!JS_ValueToNumber(cx, argc == 0 ? JSVAL_VOID : vp[2], &t_secs))
return JS_FALSE;
@ -3426,7 +3426,7 @@ WatchdogMain(void *arg)
}
static bool
ScheduleWatchdog(JSRuntime *rt, jsdouble t)
ScheduleWatchdog(JSRuntime *rt, double t)
{
if (t <= 0) {
PR_Lock(gWatchdogLock);
@ -3495,7 +3495,7 @@ KillWatchdog()
}
static bool
ScheduleWatchdog(JSRuntime *rt, jsdouble t)
ScheduleWatchdog(JSRuntime *rt, double t)
{
#ifdef XP_WIN
if (gTimerHandle) {
@ -3552,7 +3552,7 @@ CancelExecution(JSRuntime *rt)
}
static JSBool
SetTimeoutValue(JSContext *cx, jsdouble t)
SetTimeoutValue(JSContext *cx, double t)
{
/* NB: The next condition also filter out NaNs. */
if (!(t <= MAX_TIMEOUT_INTERVAL)) {
@ -3578,7 +3578,7 @@ Timeout(JSContext *cx, uintN argc, jsval *vp)
return JS_FALSE;
}
jsdouble t;
double t;
if (!JS_ValueToNumber(cx, JS_ARGV(cx, vp)[0], &t))
return JS_FALSE;
@ -3912,7 +3912,7 @@ MJitChunkLimit(JSContext *cx, uintN argc, jsval *vp)
return JS_FALSE;
}
jsdouble t;
double t;
if (!JS_ValueToNumber(cx, JS_ARGV(cx, vp)[0], &t))
return JS_FALSE;

View File

@ -1967,7 +1967,7 @@ DebuggerScript_getLineCount(JSContext *cx, uintN argc, Value *vp)
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "getLineCount", args, obj, script);
uintN maxLine = js_GetScriptLineExtent(script);
args.rval().setNumber(jsdouble(maxLine));
args.rval().setNumber(double(maxLine));
return true;
}
@ -2243,7 +2243,7 @@ DebuggerScript_getLineOffsets(JSContext *cx, uintN argc, Value *vp)
size_t lineno;
bool ok = false;
if (args[0].isNumber()) {
jsdouble d = args[0].toNumber();
double d = args[0].toNumber();
lineno = size_t(d);
ok = (lineno == d);
}

View File

@ -53,7 +53,7 @@ JSObject::asNumber()
namespace js {
inline NumberObject *
NumberObject::create(JSContext *cx, jsdouble d)
NumberObject::create(JSContext *cx, double d)
{
JSObject *obj = NewBuiltinClassInstance(cx, &NumberClass);
if (!obj)
@ -64,7 +64,7 @@ NumberObject::create(JSContext *cx, jsdouble d)
}
inline NumberObject *
NumberObject::createWithProto(JSContext *cx, jsdouble d, JSObject &proto)
NumberObject::createWithProto(JSContext *cx, double d, JSObject &proto)
{
JSObject *obj = NewObjectWithClassProto(cx, &NumberClass, &proto, NULL,
gc::GetGCObjectKind(RESERVED_SLOTS));

View File

@ -59,20 +59,20 @@ class NumberObject : public JSObject
* Creates a new Number object boxing the given number. The object's
* [[Prototype]] is determined from context.
*/
static inline NumberObject *create(JSContext *cx, jsdouble d);
static inline NumberObject *create(JSContext *cx, double d);
/*
* Identical to create(), but uses |proto| as [[Prototype]]. This method
* must not be used to create |Number.prototype|.
*/
static inline NumberObject *createWithProto(JSContext *cx, jsdouble d, JSObject &proto);
static inline NumberObject *createWithProto(JSContext *cx, double d, JSObject &proto);
double unbox() const {
return getFixedSlot(PRIMITIVE_VALUE_SLOT).toNumber();
}
private:
inline void setPrimitiveValue(jsdouble d) {
inline void setPrimitiveValue(double d) {
setFixedSlot(PRIMITIVE_VALUE_SLOT, NumberValue(d));
}

View File

@ -1428,7 +1428,7 @@ nsXPCComponents_Results::NewResolve(nsIXPConnectWrappedNative *wrapper,
jsval val;
*objp = obj;
if (!JS_NewNumberValue(cx, (jsdouble)rv, &val) ||
if (!JS_NewNumberValue(cx, (double)rv, &val) ||
!JS_DefinePropertyById(cx, obj, id, val,
nsnull, nsnull,
JSPROP_ENUMERATE |
@ -4165,7 +4165,7 @@ nsXPCComponents::GetProperty(nsIXPConnectWrappedNative *wrapper,
nsresult rv = NS_OK;
if (doResult) {
if (!JS_NewNumberValue(cx, (jsdouble) res, vp))
if (!JS_NewNumberValue(cx, (double) res, vp))
return NS_ERROR_OUT_OF_MEMORY;
rv = NS_SUCCESS_I_DID_SOMETHING;
}

View File

@ -144,11 +144,11 @@ XPCConvert::NativeData2JS(XPCLazyCallContext& lccx, jsval* d, const void* s,
case nsXPTType::T_I8 : *d = INT_TO_JSVAL(int32_t(*((int8_t*)s))); break;
case nsXPTType::T_I16 : *d = INT_TO_JSVAL(int32_t(*((int16_t*)s))); break;
case nsXPTType::T_I32 : *d = INT_TO_JSVAL(*((int32_t*)s)); break;
case nsXPTType::T_I64 : *d = DOUBLE_TO_JSVAL(jsdouble(*((int64_t*)s))); break;
case nsXPTType::T_I64 : *d = DOUBLE_TO_JSVAL(double(*((int64_t*)s))); break;
case nsXPTType::T_U8 : *d = INT_TO_JSVAL(int32_t(*((uint8_t*)s))); break;
case nsXPTType::T_U16 : *d = INT_TO_JSVAL(int32_t(*((uint16_t*)s))); break;
case nsXPTType::T_U32 : *d = UINT_TO_JSVAL(*((uint32_t*)s)); break;
case nsXPTType::T_U64 : *d = DOUBLE_TO_JSVAL(jsdouble(*((uint64_t*)s))); break;
case nsXPTType::T_U64 : *d = DOUBLE_TO_JSVAL(double(*((uint64_t*)s))); break;
case nsXPTType::T_FLOAT : *d = DOUBLE_TO_JSVAL(*((float*)s)); break;
case nsXPTType::T_DOUBLE: *d = DOUBLE_TO_JSVAL(*((double*)s)); break;
case nsXPTType::T_BOOL :
@ -410,7 +410,7 @@ XPCConvert::JSData2Native(XPCCallContext& ccx, void* d, jsval s,
int32_t ti;
uint32_t tu;
jsdouble td;
double td;
JSBool tb;
JSBool isDOMString = true;

View File

@ -235,13 +235,13 @@ xpc_qsGetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool stric
inline JSBool
xpc_qsInt64ToJsval(JSContext *cx, PRInt64 i, jsval *rv)
{
return JS_NewNumberValue(cx, static_cast<jsdouble>(i), rv);
return JS_NewNumberValue(cx, static_cast<double>(i), rv);
}
inline JSBool
xpc_qsUint64ToJsval(JSContext *cx, PRUint64 u, jsval *rv)
{
return JS_NewNumberValue(cx, static_cast<jsdouble>(u), rv);
return JS_NewNumberValue(cx, static_cast<double>(u), rv);
}
@ -667,7 +667,7 @@ xpc_qsValueToInt64(JSContext *cx,
return false;
*result = static_cast<PRInt64>(intval);
} else {
jsdouble doubleval;
double doubleval;
if (!JS_ValueToNumber(cx, v, &doubleval))
return false;
*result = static_cast<PRInt64>(doubleval);
@ -689,7 +689,7 @@ xpc_qsValueToUint64(JSContext *cx,
return false;
*result = static_cast<PRUint64>(intval);
} else {
jsdouble doubleval;
double doubleval;
if (!JS_ValueToNumber(cx, v, &doubleval))
return false;
*result = static_cast<PRUint64>(doubleval);

View File

@ -137,13 +137,13 @@ argumentUnboxingTemplates = {
" return JS_FALSE;\n",
'float':
" jsdouble ${name}_dbl;\n"
" double ${name}_dbl;\n"
" if (!JS_ValueToNumber(cx, ${argVal}, &${name}_dbl))\n"
" return JS_FALSE;\n"
" float ${name} = (float) ${name}_dbl;\n",
'double':
" jsdouble ${name};\n"
" double ${name};\n"
" if (!JS_ValueToNumber(cx, ${argVal}, &${name}))\n"
" return JS_FALSE;\n",

View File

@ -603,7 +603,7 @@ IdToInt32(JSContext *cx, jsid id)
JSAutoRequest ar(cx);
jsval idval;
jsdouble array_index;
double array_index;
int32_t i;
if (!::JS_IdToValue(cx, id, &idval) ||
!::JS_ValueToNumber(cx, idval, &array_index) ||

View File

@ -466,13 +466,13 @@ argumentUnboxingTemplates = {
" return JS_FALSE;\n",
'float':
" jsdouble ${name}_dbl;\n"
" double ${name}_dbl;\n"
" if (!JS_ValueToNumber(cx, ${argVal}, &${name}_dbl))\n"
" return JS_FALSE;\n"
" float ${name} = (float) ${name}_dbl;\n",
'double':
" jsdouble ${name};\n"
" double ${name};\n"
" if (!JS_ValueToNumber(cx, ${argVal}, &${name}))\n"
" return JS_FALSE;\n",

View File

@ -469,7 +469,7 @@ livemarkInfoToJSVal(PRInt64 aId,
NS_ENSURE_TRUE(obj, JSVAL_NULL);
jsval id;
NS_ENSURE_TRUE(JS_NewNumberValue(cx, jsdouble(aId), &id), JSVAL_NULL);
NS_ENSURE_TRUE(JS_NewNumberValue(cx, double(aId), &id), JSVAL_NULL);
JSString* guid = JS_NewStringCopyN(cx, PromiseFlatCString(aGUID).get(),
aGUID.Length());
@ -480,7 +480,7 @@ livemarkInfoToJSVal(PRInt64 aId,
NS_ENSURE_TRUE(title, JSVAL_NULL);
jsval parentId;
NS_ENSURE_TRUE(JS_NewNumberValue(cx, jsdouble(aParentId), &parentId), JSVAL_NULL);
NS_ENSURE_TRUE(JS_NewNumberValue(cx, double(aParentId), &parentId), JSVAL_NULL);
jsval feedURI;
rv = nsContentUtils::WrapNative(cx, JS_GetGlobalForScopeChain(cx),

View File

@ -292,7 +292,7 @@ GetIntFromJSObject(JSContext* aCtx,
NS_ENSURE_ARG(JSVAL_IS_PRIMITIVE(value));
NS_ENSURE_ARG(JSVAL_IS_NUMBER(value));
jsdouble num;
double num;
rc = JS_ValueToNumber(aCtx, value, &num);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
NS_ENSURE_ARG(IntType(num) == num);