--- a/content/canvas/src/CustomQS_Canvas2D.h
+++ b/content/canvas/src/CustomQS_Canvas2D.h
@@ -267,17 +267,17 @@ nsIDOMCanvasRenderingContext2D_CreateIma
uint32_t data_width, data_height;
if (!GetImageDataDimensions(cx, dataObject, &data_width, &data_height))
return false;
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;
if (!NS_finite(width) || !NS_finite(height))
return xpc_qsThrow(cx, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
if (!width || !height)
@@ -306,17 +306,17 @@ nsIDOMCanvasRenderingContext2D_GetImageD
if (!xpc_qsUnwrapThis(cx, obj, &self, &selfref.ptr, tvr.jsval_addr(), nsnull))
return JS_FALSE;
if (argc < 4)
return xpc_qsThrow(cx, NS_ERROR_XPC_NOT_ENOUGH_ARGS);
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) ||
!JS_ValueToNumber(cx, argv[3], &height))
return false;
if (!NS_finite(xd) || !NS_finite(yd) ||
!NS_finite(width) || !NS_finite(height))
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -4467,17 +4467,17 @@ nsDOMClassInfo::GetArrayIndexFromId(JSCo
jsint i;
if (JSID_IS_INT(id)) {
i = JSID_TO_INT(id);
} else {
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)) {
return -1;
}
}
if (aIsNumber) {
--- a/dom/indexedDB/IDBIndex.cpp
+++ b/dom/indexedDB/IDBIndex.cpp
@@ -1445,10 +1445,10 @@ CountHelper::DoDatabaseWork(mozIStorageC
mCount = stmt->AsInt64(0);
return NS_OK;
}
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);
}
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -895,30 +895,30 @@ SwapBytes(PRUint32 u)
((u & 0x0000ff00U) << 8) |
((u & 0x00ff0000U) >> 8) |
((u & 0xff000000U) >> 24);
#else
return u;
#endif
}
-static inline jsdouble
+static inline double
SwapBytes(PRUint64 u)
{
#ifdef IS_BIG_ENDIAN
return ((u & 0x00000000000000ffLLU) << 56) |
((u & 0x000000000000ff00LLU) << 40) |
((u & 0x0000000000ff0000LLU) << 24) |
((u & 0x00000000ff000000LLU) << 8) |
((u & 0x000000ff00000000LLU) >> 8) |
((u & 0x0000ff0000000000LLU) >> 24) |
((u & 0x00ff000000000000LLU) >> 40) |
((u & 0xff00000000000000LLU) >> 56);
#else
- return jsdouble(u);
+ return double(u);
#endif
}
static inline bool
StructuredCloneReadString(JSStructuredCloneReader* aReader,
nsCString& aString)
{
PRUint32 length;
@@ -2014,17 +2014,17 @@ AddHelper::DoDatabaseWork(mozIStorageCon
if (keyUnset && !keyPath.IsEmpty()) {
// Special case where someone put an object into an autoIncrement'ing
// objectStore with no key in its keyPath set. We needed to figure out
// which row id we would get above before we could set that properly.
// This is a duplicate of the js engine's byte munging here
union {
- jsdouble d;
+ double d;
PRUint64 u;
} pun;
pun.d = SwapBytes(static_cast<PRUint64>(autoIncrementNum));
JSAutoStructuredCloneBuffer& buffer = mCloneWriteInfo.mCloneBuffer;
PRUint64 offsetToKeyProp = mCloneWriteInfo.mOffsetToKeyProp;
@@ -2846,10 +2846,10 @@ CountHelper::DoDatabaseWork(mozIStorageC
mCount = stmt->AsInt64(0);
return NS_OK;
}
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);
}
--- a/dom/indexedDB/Key.cpp
+++ b/dom/indexedDB/Key.cpp
@@ -243,17 +243,17 @@ Key::DecodeJSVal(const unsigned char*& a
else if (*aPos - aTypeOffset == eString) {
nsString key;
DecodeString(aPos, aEnd, key);
if (!xpc::StringToJsval(aCx, key, aVal)) {
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
}
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!");
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
*aVal = OBJECT_TO_JSVAL(date);
}
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -452,17 +452,17 @@ JSValToNPVariant(NPP npp, JSContext *cx,
VOID_TO_NPVARIANT(*variant);
} else if (JSVAL_IS_NULL(val)) {
NULL_TO_NPVARIANT(*variant);
} else if (JSVAL_IS_BOOLEAN(val)) {
BOOLEAN_TO_NPVARIANT(JSVAL_TO_BOOLEAN(val), *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);
} else {
DOUBLE_TO_NPVARIANT(d, *variant);
}
} else if (JSVAL_IS_STRING(val)) {
JSString *jsstr = JSVAL_TO_STRING(val);
--- a/dom/sms/src/SmsMessage.cpp
+++ b/dom/sms/src/SmsMessage.cpp
@@ -103,17 +103,17 @@ SmsMessage::Create(PRInt32 aId,
if (!JS_ObjectIsDate(aCx, &obj)) {
return NS_ERROR_INVALID_ARG;
}
data.timestamp() = js_DateGetMsecSinceEpoch(aCx, &obj);
} else {
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;
}
data.timestamp() = static_cast<PRUint64>(number);
}
nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(data);
message.swap(*aMessage);
--- a/dom/workers/Events.cpp
+++ b/dom/workers/Events.cpp
@@ -845,17 +845,17 @@ public:
InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto)
{
return JS_InitClass(aCx, aObj, aParentProto, &sClass, Construct, 0,
sProperties, sFunctions, NULL, NULL);
}
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) {
return NULL;
}
JSObject* obj = JS_NewObject(aCx, &sClass, NULL, aParent);
if (!obj) {
@@ -902,18 +902,18 @@ private:
JSMSG_INCOMPATIBLE_PROTO, sClass.name, aFunctionName,
classPtr->name);
return NULL;
}
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);
JS_SetReservedSlot(aObj, SLOT_lengthComputable,
aLengthComputable ? JSVAL_TRUE : JSVAL_FALSE);
JS_SetReservedSlot(aObj, SLOT_loaded, DOUBLE_TO_JSVAL(aLoaded));
JS_SetReservedSlot(aObj, SLOT_total, DOUBLE_TO_JSVAL(aTotal));
}
@@ -962,17 +962,17 @@ private:
ProgressEvent* event = GetInstancePrivate(aCx, obj, sFunctions[0].name);
if (!event) {
return false;
}
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)) {
return false;
}
InitProgressEventCommon(obj, event, type, bubbles, cancelable,
lengthComputable, loaded, total, false);
@@ -1060,17 +1060,17 @@ CreateErrorEvent(JSContext* aCx, JSStrin
{
JSObject* global = JS_GetGlobalForScopeChain(aCx);
return ErrorEvent::Create(aCx, global, aMessage, aFilename, aLineNumber,
aMainRuntime);
}
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,
aTotal);
}
bool
IsSupportedEventClass(JSObject* aEvent)
--- a/dom/workers/Events.h
+++ b/dom/workers/Events.h
@@ -64,17 +64,17 @@ CreateMessageEvent(JSContext* aCx, JSAut
bool aMainRuntime);
JSObject*
CreateErrorEvent(JSContext* aCx, JSString* aMessage, JSString* aFilename,
uint32 aLineNumber, bool aMainRuntime);
JSObject*
CreateProgressEvent(JSContext* aCx, JSString* aType, bool aLengthComputable,
- jsdouble aLoaded, jsdouble aTotal);
+ double aLoaded, double aTotal);
bool
IsSupportedEventClass(JSObject* aEvent);
void
SetEventTarget(JSObject* aEvent, JSObject* aTarget);
bool
--- a/dom/workers/File.cpp
+++ b/dom/workers/File.cpp
@@ -135,17 +135,17 @@ private:
return false;
}
PRUint64 size;
if (NS_FAILED(blob->GetSize(&size))) {
ThrowFileExceptionForCode(aCx, FILE_NOT_READABLE_ERR);
}
- if (!JS_NewNumberValue(aCx, jsdouble(size), aVp)) {
+ if (!JS_NewNumberValue(aCx, double(size), aVp)) {
return false;
}
return true;
}
static JSBool
GetType(JSContext* aCx, JSObject* aObj, jsid aIdval, jsval* aVp)
@@ -178,17 +178,17 @@ private:
return false;
}
nsIDOMBlob* blob = GetInstancePrivate(aCx, obj, "slice");
if (!blob) {
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)) {
return false;
}
nsDependentJSString contentType;
if (!contentType.init(aCx, jsContentType)) {
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -3528,17 +3528,17 @@ WorkerPrivate::SetTimeout(JSContext* aCx
else {
JS_ReportError(aCx, "Useless %s call (missing quotes around argument?)",
aIsInterval ? "setInterval" : "setTimeout");
return false;
}
// 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;
}
newInfo->mInterval = TimeDuration::FromMilliseconds(intervalMS);
if (aArgc > 2 && JSVAL_IS_OBJECT(newInfo->mTimeoutVal)) {
nsTArray<jsval> extraArgVals(aArgc - 2);
for (uintN index = 2; index < aArgc; index++) {
--- a/js/jsd/jsd.h
+++ b/js/jsd/jsd.h
@@ -205,22 +205,22 @@ struct JSDScript
struct JSDProfileData
{
JSDProfileData* caller;
int64_t lastCallStart;
int64_t runningTime;
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
{
JSCList links; /* we are part of a JSCList */
char* url;
char* text;
uintN textLength;
@@ -412,32 +412,32 @@ extern void
jsd_SetScriptFlags(JSDContext *jsdc, JSDScript *script, uint32_t flags);
extern uintN
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
jsd_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script);
extern JSScript *
jsd_GetJSScript (JSDContext *jsdc, JSDScript *script);
@@ -967,17 +967,17 @@ jsd_IsValueNative(JSDContext* jsdc, JSDV
/**************************************************/
extern JSBool
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*
jsd_GetValueString(JSDContext* jsdc, JSDValue* jsdval);
extern JSString*
jsd_GetValueFunctionId(JSDContext* jsdc, JSDValue* jsdval);
--- a/js/jsd/jsd_scpt.c
+++ b/js/jsd/jsd_scpt.c
@@ -362,62 +362,62 @@ uintN
jsd_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->maxRecurseDepth;
return 0;
}
-jsdouble
+double
jsd_GetScriptMinExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->minExecutionTime;
return 0.0;
}
-jsdouble
+double
jsd_GetScriptMaxExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->maxExecutionTime;
return 0.0;
}
-jsdouble
+double
jsd_GetScriptTotalExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->totalExecutionTime;
return 0.0;
}
-jsdouble
+double
jsd_GetScriptMinOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->minOwnExecutionTime;
return 0.0;
}
-jsdouble
+double
jsd_GetScriptMaxOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->maxOwnExecutionTime;
return 0.0;
}
-jsdouble
+double
jsd_GetScriptTotalOwnExecutionTime(JSDContext* jsdc, JSDScript *script)
{
if (script->profileData)
return script->profileData->totalOwnExecutionTime;
return 0.0;
}
--- a/js/jsd/jsd_step.c
+++ b/js/jsd/jsd_step.c
@@ -182,17 +182,17 @@ JSBool
} else {
if (++pdata->recurseDepth > pdata->maxRecurseDepth)
pdata->maxRecurseDepth = pdata->recurseDepth;
}
/* make sure we're called for the return too. */
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;
delta /= 1000.0;
pdata->totalExecutionTime += delta;
/* minExecutionTime starts as 0, so we need to overwrite
* it on the first call always. */
if ((0 == pdata->callCount) ||
--- a/js/jsd/jsd_val.c
+++ b/js/jsd/jsd_val.c
@@ -192,17 +192,17 @@ int32_t
jsd_GetValueInt(JSDContext* jsdc, JSDValue* jsdval)
{
jsval val = jsdval->val;
if(!JSVAL_IS_INT(val))
return 0;
return JSVAL_TO_INT(val);
}
-jsdouble
+double
jsd_GetValueDouble(JSDContext* jsdc, JSDValue* jsdval)
{
if(!JSVAL_IS_DOUBLE(jsdval->val))
return 0;
return JSVAL_TO_DOUBLE(jsdval->val);
}
JSString*
--- a/js/jsd/jsdebug.c
+++ b/js/jsd/jsdebug.c
@@ -206,52 +206,52 @@ JSD_GetScriptCallCount(JSDContext* jsdc,
JSD_PUBLIC_API(uintN)
JSD_GetScriptMaxRecurseDepth(JSDContext* jsdc, JSDScript *script)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
return jsd_GetScriptMaxRecurseDepth(jsdc, 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);
return jsd_GetScriptTotalOwnExecutionTime(jsdc, script);
}
JSD_PUBLIC_API(void)
JSD_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script)
@@ -1105,17 +1105,17 @@ JSD_GetValueBoolean(JSDContext* jsdc, JS
JSD_PUBLIC_API(int32_t)
JSD_GetValueInt(JSDContext* jsdc, JSDValue* jsdval)
{
JSD_ASSERT_VALID_CONTEXT(jsdc);
JSD_ASSERT_VALID_VALUE(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);
JSD_ASSERT_VALID_VALUE(jsdval);
return jsd_GetValueDouble(jsdc, jsdval);
}
JSD_PUBLIC_API(JSString*)
--- a/js/jsd/jsdebug.h
+++ b/js/jsd/jsdebug.h
@@ -328,50 +328,50 @@ JSD_GetScriptCallCount(JSDContext* jsdc,
* Get the max number of times this script called itself, directly or indirectly.
*/
extern JSD_PUBLIC_API(uintN)
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);
/*
* Clear profile data for this script.
*/
extern JSD_PUBLIC_API(void)
JSD_ClearScriptProfileData(JSDContext* jsdc, JSDScript *script);
@@ -1288,17 +1288,17 @@ JSD_GetValueBoolean(JSDContext* jsdc, JS
*/
extern JSD_PUBLIC_API(int32_t)
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);
/*
* Return JSString value (DOES do conversion if necessary).
* NOTE that the JSString returned is not protected from garbage
* collection. It should be immediately read or wrapped using
* JSD_NewValue(jsdc,STRING_TO_JSVAL(str)) if necessary.
* *** new for version 1.1 ****
--- a/js/src/builtin/MapObject.cpp
+++ b/js/src/builtin/MapObject.cpp
@@ -81,17 +81,17 @@ HashableValue::setValue(JSContext *cx, c
{
if (v.isString() && v.toString()->isRope()) {
/* Flatten this rope so that equals() is infallible. */
JSString *str = v.toString()->ensureLinear(cx);
if (!str)
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. */
value = Int32Value(i);
} else if (JSDOUBLE_IS_NaN(d)) {
/* NaNs with different bits must hash and test identically. */
value = DoubleValue(js_NaN);
} else {
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -597,17 +597,17 @@ ExecuteRegExp(JSContext *cx, Native nati
return false;
const jschar *chars = linearInput->chars();
size_t length = input->length();
/* Step 4. */
const Value &lastIndex = reobj.getLastIndex();
/* Step 5. */
- jsdouble i;
+ double i;
if (!ToInteger(cx, lastIndex, &i))
return false;
/* Steps 6-7 (with sticky extension). */
if (!re->global() && !re->sticky())
i = 0;
/* Step 9a. */
--- a/js/src/ctypes/CTypes.cpp
+++ b/js/src/ctypes/CTypes.cpp
@@ -452,17 +452,17 @@ static JSFunctionSpec sUInt64Functions[]
static JSFunctionSpec sModuleFunctions[] = {
JS_FN("open", Library::Open, 1, CTYPESFN_FLAGS),
JS_FN("cast", CData::Cast, 2, CTYPESFN_FLAGS),
JS_FN("getRuntime", CData::GetRuntime, 1, CTYPESFN_FLAGS),
JS_FN("libraryName", Library::Name, 1, CTYPESFN_FLAGS),
JS_FS_END
};
-static inline bool FloatIsFinite(jsdouble f) {
+static inline bool FloatIsFinite(double f) {
#ifdef WIN32
return _finite(f) != 0;
#else
return finite(f);
#endif
}
JS_ALWAYS_INLINE JSString*
@@ -999,42 +999,42 @@ struct ConvertImpl {
return TargetType(d);
}
};
#ifdef _MSC_VER
// 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);
}
};
#endif
// C++ doesn't guarantee that exact values are the only ones that will
// round-trip. In fact, on some platforms, including SPARC, there are pairs of
// values, a uint64_t and a double, such that neither value is exactly
// representable in the other type, but they cast to each other.
#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);
}
};
#endif
template<class TargetType, class FromType>
static JS_ALWAYS_INLINE TargetType Convert(FromType d)
@@ -1136,41 +1136,41 @@ struct IsNegativeImpl<Type, true> {
// Determine whether Type 'i' is negative.
template<class Type>
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)
{
if (JSVAL_IS_BOOLEAN(val)) {
*result = JSVAL_TO_BOOLEAN(val) != JS_FALSE;
return true;
}
if (JSVAL_IS_INT(val)) {
jsint i = JSVAL_TO_INT(val);
*result = i != 0;
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;
}
// Don't silently convert null to bool. It's probably a mistake.
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>
static bool
jsvalToInteger(JSContext* cx, jsval val, IntegerType* result)
{
JS_STATIC_ASSERT(numeric_limits<IntegerType>::is_exact);
@@ -1178,17 +1178,17 @@ jsvalToInteger(JSContext* cx, jsval val,
// Make sure the integer fits in the alotted precision, and has the right
// sign.
jsint i = JSVAL_TO_INT(val);
return ConvertExact(i, 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)) {
JSObject* obj = JSVAL_TO_OBJECT(val);
if (CData::IsCData(obj)) {
JSObject* typeObj = CData::GetCType(obj);
void* data = CData::GetData(obj);
@@ -1241,17 +1241,17 @@ jsvalToInteger(JSContext* cx, jsval val,
*result = JSVAL_TO_BOOLEAN(val);
JS_ASSERT(*result == 0 || *result == 1);
return true;
}
// Don't silently convert null to an integer. It's probably a mistake.
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>
static bool
jsvalToFloat(JSContext *cx, jsval val, FloatType* result)
{
JS_STATIC_ASSERT(!numeric_limits<FloatType>::is_exact);
@@ -1354,17 +1354,17 @@ StringToInteger(JSContext* cx, JSString*
if (i / base != ii) // overflow
return false;
}
*result = i;
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>
static bool
jsvalToBigInteger(JSContext* cx,
jsval val,
bool allowString,
IntegerType* result)
@@ -1375,17 +1375,17 @@ jsvalToBigInteger(JSContext* cx,
// Make sure the integer fits in the alotted precision, and has the right
// sign.
jsint i = JSVAL_TO_INT(val);
return ConvertExact(i, 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 (allowString && JSVAL_IS_STRING(val)) {
// Allow conversion from base-10 or base-16 strings, provided the result
// fits in IntegerType. (This allows an Int64 or UInt64 object to be passed
// to the JS array element operator, which will automatically call
// toString() on the object for us.)
return StringToInteger(cx, JSVAL_TO_STRING(val), result);
@@ -1405,28 +1405,28 @@ jsvalToBigInteger(JSContext* cx,
int64_t i = Int64Base::GetInt(obj);
return ConvertExact(i, result);
}
}
return false;
}
// 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;
-}
-
-// Implicitly convert val to IntegerType, allowing jsint, jsdouble,
+ // Also check that the result fits in a double.
+ return Convert<size_t>(double(*result)) == *result;
+}
+
+// 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>
static bool
jsidToBigInteger(JSContext* cx,
jsid val,
bool allowString,
IntegerType* result)
@@ -1461,50 +1461,50 @@ jsidToBigInteger(JSContext* cx,
int64_t i = Int64Base::GetInt(obj);
return ConvertExact(i, result);
}
}
return false;
}
// 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.
template<class IntegerType>
static bool
jsvalToIntegerExplicit(jsval val, IntegerType* result)
{
JS_STATIC_ASSERT(numeric_limits<IntegerType>::is_exact);
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;
}
if (!JSVAL_IS_PRIMITIVE(val)) {
// Convert Int64 and UInt64 values by C-style cast.
JSObject* obj = JSVAL_TO_OBJECT(val);
if (Int64::IsInt64(obj)) {
int64_t i = Int64Base::GetInt(obj);
@@ -1527,31 +1527,31 @@ jsvalToPtrExplicit(JSContext* cx, jsval
if (JSVAL_IS_INT(val)) {
// jsint always fits in intptr_t. If the integer is negative, cast through
// an intptr_t intermediate to sign-extend.
jsint i = JSVAL_TO_INT(val);
*result = i < 0 ? uintptr_t(intptr_t(i)) : uintptr_t(i);
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);
return true;
}
// 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);
if (Int64::IsInt64(obj)) {
int64_t i = Int64Base::GetInt(obj);
intptr_t p = intptr_t(i);
// Make sure the integer fits in the alotted precision.
@@ -1646,17 +1646,17 @@ ConvertToJS(JSContext* cx,
case TYPE_bool:
*result = *static_cast<bool*>(data) ? JSVAL_TRUE : JSVAL_FALSE;
break;
#define DEFINE_INT_TYPE(name, type, ffiType) \
case TYPE_##name: { \
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; \
}
#define DEFINE_WRAPPED_INT_TYPE(name, type, ffiType) \
case TYPE_##name: { \
/* Return an Int64 or UInt64 object - do not convert to a JS number. */ \
uint64_t value; \
JSObject* proto; \
@@ -1675,17 +1675,17 @@ ConvertToJS(JSContext* cx,
if (!obj) \
return false; \
*result = OBJECT_TO_JSVAL(obj); \
break; \
}
#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; \
}
#define DEFINE_CHAR_TYPE(name, type, ffiType) \
case TYPE_##name: \
/* Convert to an integer. We have no idea what character encoding to */ \
/* use, if any. */ \
*result = INT_TO_JSVAL(*static_cast<type*>(data)); \
@@ -2924,17 +2924,17 @@ CType::TypesEqual(JSObject* t1, JSObject
bool
CType::GetSafeSize(JSObject* obj, size_t* result)
{
JS_ASSERT(CType::IsCType(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.
if (JSVAL_IS_INT(size)) {
*result = JSVAL_TO_INT(size);
return true;
}
if (JSVAL_IS_DOUBLE(size)) {
*result = Convert<size_t>(JSVAL_TO_DOUBLE(size));
return true;
@@ -2948,32 +2948,32 @@ size_t
CType::GetSize(JSObject* obj)
{
JS_ASSERT(CType::IsCType(obj));
jsval size = JS_GetReservedSlot(obj, SLOT_SIZE);
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))
return JSVAL_TO_INT(size);
return Convert<size_t>(JSVAL_TO_DOUBLE(size));
}
bool
CType::IsSizeDefined(JSObject* obj)
{
JS_ASSERT(CType::IsCType(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);
}
size_t
CType::GetAlignment(JSObject* obj)
{
@@ -3594,17 +3594,17 @@ ArrayType::CreateInternal(JSContext* cx,
if (!CType::GetSafeSize(baseType, &baseSize)) {
JS_ReportError(cx, "base size must be defined");
return NULL;
}
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");
return NULL;
}
if (!SizeTojsval(cx, size, &sizeVal) ||
!SizeTojsval(cx, length, &lengthVal))
return NULL;
@@ -3745,17 +3745,17 @@ ArrayType::GetBaseType(JSObject* obj)
bool
ArrayType::GetSafeLength(JSObject* obj, size_t* result)
{
JS_ASSERT(CType::IsCType(obj));
JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array);
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);
return true;
}
if (JSVAL_IS_DOUBLE(length)) {
*result = Convert<size_t>(JSVAL_TO_DOUBLE(length));
return true;
@@ -3770,17 +3770,17 @@ ArrayType::GetLength(JSObject* obj)
{
JS_ASSERT(CType::IsCType(obj));
JS_ASSERT(CType::GetTypeCode(obj) == TYPE_array);
jsval length = JS_GetReservedSlot(obj, SLOT_LENGTH);
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))
return JSVAL_TO_INT(length);
return Convert<size_t>(JSVAL_TO_DOUBLE(length));
}
ffi_type*
@@ -6202,17 +6202,17 @@ Int64::Lo(JSContext* cx, uintN argc, jsv
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
!Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) {
JS_ReportError(cx, "lo takes one Int64 argument");
return JS_FALSE;
}
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))
return JS_FALSE;
JS_SET_RVAL(cx, vp, result);
return JS_TRUE;
}
@@ -6224,17 +6224,17 @@ Int64::Hi(JSContext* cx, uintN argc, jsv
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
!Int64::IsInt64(JSVAL_TO_OBJECT(argv[0]))) {
JS_ReportError(cx, "hi takes one Int64 argument");
return JS_FALSE;
}
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))
return JS_FALSE;
JS_SET_RVAL(cx, vp, result);
return JS_TRUE;
}
@@ -6369,17 +6369,17 @@ UInt64::Lo(JSContext* cx, uintN argc, js
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
!UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) {
JS_ReportError(cx, "lo takes one UInt64 argument");
return JS_FALSE;
}
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))
return JS_FALSE;
JS_SET_RVAL(cx, vp, result);
return JS_TRUE;
}
@@ -6391,17 +6391,17 @@ UInt64::Hi(JSContext* cx, uintN argc, js
if (argc != 1 || JSVAL_IS_PRIMITIVE(argv[0]) ||
!UInt64::IsUInt64(JSVAL_TO_OBJECT(argv[0]))) {
JS_ReportError(cx, "hi takes one UInt64 argument");
return JS_FALSE;
}
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))
return JS_FALSE;
JS_SET_RVAL(cx, vp, result);
return JS_TRUE;
}
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -2296,17 +2296,17 @@ EmitElemIncDec(JSContext *cx, ParseNode
return false;
UpdateDecomposeLength(bce, start);
return true;
}
static JSBool
-EmitNumberOp(JSContext *cx, jsdouble dval, BytecodeEmitter *bce)
+EmitNumberOp(JSContext *cx, double dval, BytecodeEmitter *bce)
{
int32_t ival;
uint32_t u;
ptrdiff_t off;
jsbytecode *pc;
if (JSDOUBLE_IS_INT32(dval, &ival)) {
if (ival == 0)
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -104,17 +104,17 @@ ContainsVarOrConst(ParseNode *pn)
*/
static JSBool
FoldType(JSContext *cx, ParseNode *pn, ParseNodeKind kind)
{
if (!pn->isKind(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;
pn->setKind(PNK_NUMBER);
pn->setOp(JSOP_DOUBLE);
}
break;
@@ -141,17 +141,17 @@ FoldType(JSContext *cx, ParseNode *pn, P
* Fold two numeric constants. Beware that pn1 and pn2 are recycled, unless
* one of them aliases pn, so you can't safely fetch pn2->pn_next, e.g., after
* a successful call to this function.
*/
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));
d = pn1->pn_dval;
d2 = pn2->pn_dval;
switch (op) {
case JSOP_LSH:
case JSOP_RSH:
@@ -817,17 +817,17 @@ js::FoldConstants(JSContext *cx, ParseNo
case PNK_TYPEOF:
case PNK_VOID:
case PNK_NOT:
case PNK_BITNOT:
case PNK_POS:
case PNK_NEG:
if (pn1->isKind(PNK_NUMBER)) {
- jsdouble d;
+ double d;
/* Operate on one numeric constant. */
d = pn1->pn_dval;
switch (pn->getOp()) {
case JSOP_BITNOT:
d = ~js_DoubleToECMAInt32(d);
break;
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -614,17 +614,17 @@ struct ParseNode {
uint32_t dflags:12, /* definition/use flags, see below */
blockid:20; /* block number, for subset dominance
computation */
} name;
struct { /* lexical dependencies + sub-tree */
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 */
} loopControl;
class { /* E4X <?target data?> XML PI */
friend class XMLProcessingInstruction;
PropertyName *target; /* non-empty */
JSAtom *data; /* may be empty, never null */
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -1727,17 +1727,17 @@ TokenStream::getTokenInternal()
goto error;
}
/*
* Unlike identifiers and strings, numbers cannot contain escaped
* 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))
goto error;
} else {
if (!js_strtod(cx, numStart, userbuf.addressOfNextRawChar(), &dummy, &dval))
goto error;
}
@@ -1818,17 +1818,17 @@ TokenStream::getTokenInternal()
}
ungetCharIgnoreEOL(c);
if (c != EOF && IsIdentifierStart(c)) {
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR, JSMSG_IDSTART_AFTER_NUMBER);
goto error;
}
- jsdouble dval;
+ double dval;
const jschar *dummy;
if (!GetPrefixInteger(cx, numStart, userbuf.addressOfNextRawChar(), radix, &dummy, &dval))
goto error;
tp->setNumber(dval);
tt = TOK_NUMBER;
goto out;
}
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -317,17 +317,17 @@ struct Token {
} s;
private:
friend struct Token;
struct { /* pair for <?target data?> XML PI */
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;
/* Mutators */
/*
* FIXME: Init type early enough such that all mutators can assert
@@ -354,17 +354,17 @@ struct Token {
u.xmlpi.data = data;
}
void setRegExpFlags(js::RegExpFlag flags) {
JS_ASSERT((flags & AllFlags) == flags);
u.reflags = flags;
}
- void setNumber(jsdouble n) {
+ void setNumber(double n) {
u.number = n;
}
/* Type-safe accessors */
PropertyName *name() const {
JS_ASSERT(type == TOK_NAME);
return u.s.n.name->asPropertyName(); /* poor-man's type verification */
@@ -391,17 +391,17 @@ struct Token {
}
js::RegExpFlag regExpFlags() const {
JS_ASSERT(type == TOK_REGEXP);
JS_ASSERT((u.reflags & AllFlags) == u.reflags);
return u.reflags;
}
- jsdouble number() const {
+ double number() const {
JS_ASSERT(type == TOK_NUMBER);
return u.number;
}
};
#define t_op u.s.op
enum TokenStreamFlags
--- a/js/src/jsapi-tests/testParseJSON.cpp
+++ b/js/src/jsapi-tests/testParseJSON.cpp
@@ -46,17 +46,17 @@ BEGIN_TEST(testParseJSON_success)
CHECK(TryParse(cx, "false", JSVAL_FALSE));
CHECK(TryParse(cx, "null", JSVAL_NULL));
CHECK(TryParse(cx, "0", INT_TO_JSVAL(0)));
CHECK(TryParse(cx, "1", INT_TO_JSVAL(1)));
CHECK(TryParse(cx, "-1", INT_TO_JSVAL(-1)));
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;
const jschar emptystr[] = { '\0' };
str = js_NewStringCopyN(cx, emptystr, 0);
CHECK(str);
CHECK(TryParse(cx, "\"\"", STRING_TO_JSVAL(str)));
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -280,17 +280,17 @@ JS_ConvertArguments(JSContext *cx, uintN
JS_PUBLIC_API(JSBool)
JS_ConvertArgumentsVA(JSContext *cx, uintN argc, jsval *argv, const char *format, va_list ap)
{
jsval *sp;
JSBool required;
char c;
JSFunction *fun;
- jsdouble d;
+ double d;
JSString *str;
JSObject *obj;
AssertNoGC(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, JSValueArray(argv - 2, argc + 2));
sp = argv;
required = JS_TRUE;
@@ -333,23 +333,23 @@ JS_ConvertArgumentsVA(JSContext *cx, uin
if (!JS_ValueToECMAUint32(cx, *sp, va_arg(ap, uint32_t *)))
return JS_FALSE;
break;
case 'j':
if (!JS_ValueToInt32(cx, *sp, va_arg(ap, int32_t *)))
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':
str = ToString(cx, *sp);
if (!str)
return JS_FALSE;
*sp = STRING_TO_JSVAL(str);
if (c == 'W') {
@@ -440,17 +440,17 @@ JS_RemoveArgumentFormatter(JSContext *cx
}
JS_PUBLIC_API(JSBool)
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);
assertSameCompartment(cx, v);
switch (type) {
case JSTYPE_VOID:
*vp = JSVAL_VOID;
ok = JS_TRUE;
@@ -531,40 +531,40 @@ JS_ValueToSource(JSContext *cx, jsval v)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, v);
return js_ValueToSource(cx, 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);
assertSameCompartment(cx, v);
AutoValueRooter tvr(cx, v);
return ToNumber(cx, tvr.value(), 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);
}
JS_PUBLIC_API(JSBool)
JS_ValueToECMAInt32(JSContext *cx, jsval v, int32_t *ip)
{
AssertNoGC(cx);
@@ -2243,17 +2243,17 @@ JS_strdup(JSContext *cx, const char *s)
size_t n = strlen(s) + 1;
void *p = cx->malloc_(n);
if (!p)
return NULL;
return (char *)js_memcpy(p, s, n);
}
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);
rval->setNumber(d);
return JS_TRUE;
}
#undef JS_AddRoot
@@ -6280,17 +6280,17 @@ JS_PUBLIC_API(JSObject *)
JS_NewDateObject(JSContext *cx, int year, int mon, int mday, int hour, int min, int sec)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);
return js_NewDateObject(cx, year, mon, mday, hour, min, sec);
}
JS_PUBLIC_API(JSObject *)
-JS_NewDateObjectMsec(JSContext *cx, jsdouble msec)
+JS_NewDateObjectMsec(JSContext *cx, double msec)
{
AssertNoGC(cx);
CHECK_REQUEST(cx);
return js_NewDateObjectMsec(cx, msec);
}
JS_PUBLIC_API(JSBool)
JS_ObjectIsDate(JSContext *cx, JSObject *obj)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -1657,27 +1657,27 @@ INT_TO_JSVAL(int32_t i)
}
static JS_ALWAYS_INLINE JSBool
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;
JS_ASSERT(JSVAL_IS_DOUBLE(v));
l = JSVAL_TO_IMPL(v);
return l.asDouble;
}
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);
* return IMPL_TO_JSVAL(DOUBLE_TO_JSVAL_IMPL(d));
* because GCC from XCode 3.1.4 miscompiles the above code. */
jsval_layout l;
if (JS_UNLIKELY(d != d)) {
l.asBits = 0x7FF8000000000000LL;
@@ -1687,17 +1687,17 @@ DOUBLE_TO_JSVAL(jsdouble d)
return IMPL_TO_JSVAL(l);
}
static JS_ALWAYS_INLINE jsval
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
JSVAL_IS_NUMBER(jsval v)
{
return JSVAL_IS_NUMBER_IMPL(JSVAL_TO_IMPL(v));
}
@@ -2126,18 +2126,18 @@ JS_GetEmptyString(JSRuntime *rt);
* Format is a string of the following characters (spaces are insignificant),
* specifying the tabulated type conversions:
*
* b JSBool Boolean
* c uint16_t/jschar ECMA uint16_t, Unicode char
* 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
* f JSFunction * Function private
* v jsval Argument value (no conversion)
* * N/A Skip this argument (no vararg)
* / N/A End of required arguments
*
@@ -2228,26 +2228,26 @@ JS_ValueToConstructor(JSContext *cx, jsv
extern JS_PUBLIC_API(JSString *)
JS_ValueToString(JSContext *cx, jsval v);
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
* for ToInt32.
*/
extern JS_PUBLIC_API(JSBool)
JS_ValueToECMAInt32(JSContext *cx, jsval v, int32_t *ip);
@@ -2889,17 +2889,17 @@ JS_free(JSContext *cx, void *p);
extern JS_PUBLIC_API(void)
JS_updateMallocCounter(JSContext *cx, size_t nbytes);
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
* points into the GC heap. JS_AddValueRoot takes a pointer to a jsval and
* JS_AddGCThingRoot takes a pointer to a JSObject * or JString *.
*
* Note that, since JS_Add*Root stores the address of a variable (of type
* jsval, JSString *, or JSObject *), that variable must live until
@@ -3591,17 +3591,17 @@ JS_ResolveStub(JSContext *cx, JSObject *
extern JS_PUBLIC_API(JSBool)
JS_ConvertStub(JSContext *cx, JSObject *obj, JSType type, jsval *vp);
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];
};
/*
* To define an array element rather than a named property member, cast the
* element's index to (const char *) and initialize name with it, and set the
@@ -5167,17 +5167,17 @@ JS_SetErrorReporter(JSContext *cx, JSErr
/*
* Dates.
*/
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.
*/
extern JS_PUBLIC_API(JSBool)
JS_ObjectIsDate(JSContext *cx, JSObject *obj);
/************************************************************************/
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -300,23 +300,23 @@ JSObject::willBeSparseDenseArray(uintN r
for (uintN i = 0; i < len; i++) {
if (!elems[i].isMagic(JS_ARRAY_HOLE) && !--minimalDenseCount)
return false;
}
return true;
}
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) {
*idp = INT_TO_JSID(int(index));
return JS_TRUE;
}
if (index <= jsuint(-1)) {
@@ -358,17 +358,17 @@ JSObject::arrayGetOwnDataElement(JSConte
/*
* If the property at the given index exists, get its value into location
* pointed by vp and set *hole to false. Otherwise set *hole to true and *vp
* to JSVAL_VOID. This function assumes that the location pointed by vp is
* 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);
*hole = JS_FALSE;
if (!IndexToId(cx, obj, index, hole, idr.addr()))
return JS_FALSE;
if (*hole) {
vp->setUndefined();
@@ -463,17 +463,17 @@ GetElements(JSContext *cx, JSObject *aob
}
}
/*
* 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);
if (obj->isDenseArray()) {
/* Predicted/prefetched code should favor the remains-dense case. */
JSObject::EnsureDenseResult result = JSObject::ED_SPARSE;
do {
if (index > jsuint(-1))
@@ -514,17 +514,17 @@ SetArrayElement(JSContext *cx, JSObject
*
* - Return 0 if the deletion fails because the property is not
* configurable (that is, [[Delete]] would return false). Note that if
* |strict| is true we will throw, not return zero.
*
* - 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);
if (obj->isDenseArray()) {
if (index <= UINT32_MAX) {
uint32_t idx = uint32_t(index);
if (idx < obj->getDenseArrayInitializedLength()) {
@@ -549,28 +549,28 @@ DeleteArrayElement(JSContext *cx, JSObje
return v.isTrue() ? 1 : 0;
}
/*
* When hole is true, delete the property at the given index. Otherwise set
* 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) {
JS_ASSERT(v.isUndefined());
return DeleteArrayElement(cx, obj, index, true) >= 0;
}
return SetArrayElement(cx, obj, index, v);
}
JSBool
-js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length)
+js_SetLengthProperty(JSContext *cx, JSObject *obj, double length)
{
Value v = NumberValue(length);
/* We don't support read-only array length yet. */
return obj->setProperty(cx, cx->runtime->atomState.lengthAtom, &v, false);
}
/*
@@ -599,17 +599,17 @@ array_length_setter(JSContext *cx, JSObj
return obj->defineProperty(cx, cx->runtime->atomState.lengthAtom, *vp,
NULL, NULL, JSPROP_ENUMERATE);
}
uint32_t newlen;
if (!ToUint32(cx, *vp, &newlen))
return false;
- jsdouble d;
+ double d;
if (!ToNumber(cx, *vp, &d))
return false;
if (d != newlen) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_ARRAY_LENGTH);
return false;
}
@@ -2163,17 +2163,17 @@ SortComparatorFunction::operator()(const
ag.setCallee(fval);
ag.thisv() = UndefinedValue();
ag[0] = a;
ag[1] = b;
if (!Invoke(cx, ag))
return false;
- jsdouble cmp;
+ double cmp;
if (!ToNumber(cx, ag.rval(), &cmp))
return false;
/*
* XXX eport some kind of error here if cmp is NaN? ECMA talks about
* 'consistent compare functions' that don't return NaN, but is silent
* about what the result should be. So we currently ignore it.
*/
@@ -2369,17 +2369,17 @@ array_push_slowly(JSContext *cx, JSObjec
jsuint length;
if (!js_GetLengthProperty(cx, obj, &length))
return false;
if (!InitArrayElements(cx, obj, length, args.length(), args.array(), UpdateTypes))
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);
}
static bool
array_push1_dense(JSContext* cx, JSObject* obj, CallArgs &args)
{
JS_ASSERT(args.length() == 1);
@@ -2588,17 +2588,17 @@ array_unshift(JSContext *cx, uintN argc,
JSObject *obj = ToObject(cx, &args.thisv());
if (!obj)
return false;
jsuint length;
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) {
bool optimized = false;
do {
if (!obj->isDenseArray())
break;
if (js_PrototypeHasIndexedProperties(cx, obj))
@@ -2612,18 +2612,18 @@ array_unshift(JSContext *cx, uintN argc,
}
obj->moveDenseArrayElements(args.length(), 0, length);
for (uint32_t i = 0; i < args.length(); i++)
obj->setDenseArrayElement(i, MagicValue(JS_ARRAY_HOLE));
optimized = true;
} 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;
JSBool hole;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, last, &hole, tvr.addr()) ||
!SetOrDeleteArrayElement(cx, obj, upperIndex, hole, tvr.value())) {
return JS_FALSE;
@@ -2726,17 +2726,17 @@ array_splice(JSContext *cx, uintN argc,
if (relativeStart < 0)
actualStart = JS_MAX(len + relativeStart, 0);
else
actualStart = JS_MIN(relativeStart, len);
/* 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);
} else {
/*
* Non-standard: if start was specified but deleteCount was omitted,
* delete to the end of the array. See bug 668024 for discussion.
*/
@@ -2848,19 +2848,19 @@ array_splice(JSContext *cx, uintN argc,
if (CanOptimizeForDenseStorage(obj, len, itemCount - actualDeleteCount, cx)) {
obj->moveDenseArrayElements(actualStart + itemCount,
actualStart + actualDeleteCount,
len - (actualStart + actualDeleteCount));
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;
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!GetElement(cx, obj, from, &hole, &fromValue) ||
!SetOrDeleteArrayElement(cx, obj, to, hole, fromValue))
{
return false;
@@ -2874,17 +2874,17 @@ array_splice(JSContext *cx, uintN argc,
/* Steps 14-15. */
for (uint32_t k = actualStart, i = 0; i < itemCount; i++, k++) {
if (!SetArrayElement(cx, obj, k, items[i]))
return false;
}
/* Step 16. */
- jsdouble finalLength = jsdouble(len) - actualDeleteCount + itemCount;
+ double finalLength = double(len) - actualDeleteCount + itemCount;
if (!js_SetLengthProperty(cx, obj, finalLength))
return false;
/* Step 17. */
args.rval().setObject(*arr);
return true;
}
@@ -3009,17 +3009,17 @@ array_slice(JSContext *cx, uintN argc, V
return false;
if (!js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
begin = 0;
end = length;
if (args.length() > 0) {
- jsdouble d;
+ double d;
if (!ToInteger(cx, args[0], &d))
return false;
if (d < 0) {
d += length;
if (d < 0)
d = 0;
} else if (d > length) {
d = length;
@@ -3092,17 +3092,17 @@ array_indexOfHelper(JSContext *cx, Index
return JS_FALSE;
if (length == 0)
goto not_found;
if (args.length() <= 1) {
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))
return false;
if (start < 0) {
start += length;
if (start < 0) {
if (mode == LastIndexOf)
@@ -3658,19 +3658,19 @@ js_Array(JSContext *cx, uintN argc, Valu
if (args[0].isInt32()) {
int32_t i = args[0].toInt32();
if (i < 0) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_ARRAY_LENGTH);
return false;
}
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;
}
}
JSObject *obj = NewDenseUnallocatedArray(cx, length);
if (!obj)
return false;
--- a/js/src/jsarray.h
+++ b/js/src/jsarray.h
@@ -136,17 +136,17 @@ extern JSObject *
NewSlowEmptyArray(JSContext *cx);
} /* namespace js */
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 {
extern JSBool
array_defineElement(JSContext *cx, JSObject *obj, uint32_t index, const Value *value,
PropertyOp getter, StrictPropertyOp setter, uintN attrs);
extern JSBool
--- a/js/src/jsbool.cpp
+++ b/js/src/jsbool.cpp
@@ -227,16 +227,16 @@ js_ValueToBoolean(const Value &v)
return v.toInt32() != 0;
if (v.isString())
return v.toString()->length() != 0;
if (v.isObject())
return JS_TRUE;
if (v.isNullOrUndefined())
return JS_FALSE;
if (v.isDouble()) {
- jsdouble d;
+ double d;
d = v.toDouble();
return !JSDOUBLE_IS_NaN(d) && d != 0;
}
JS_ASSERT(v.isBoolean());
return v.toBoolean();
}
--- a/js/src/jsclone.cpp
+++ b/js/src/jsclone.cpp
@@ -190,21 +190,21 @@ SCInput::readPair(uint32_t *tagp, uint32
*/
static JS_NEVER_INLINE double
CanonicalizeNan(double d)
{
return JS_CANONICALIZE_NAN(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;
*p = CanonicalizeNan(pun.d);
return true;
}
template <class T>
@@ -260,56 +260,56 @@ PairToUInt64(uint32_t tag, uint32_t data
return uint64_t(data) | (uint64_t(tag) << 32);
}
bool
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).
* PairToUInt64 produces the number 0xFFFF000200000001.
* That is written out as the bytes 01 00 00 00 02 00 FF FF.
*/
return write(PairToUInt64(tag, 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)));
}
template <class T>
bool
SCOutput::writeArray(const T *p, size_t nelems)
{
@@ -525,17 +525,17 @@ JSStructuredCloneWriter::startWrite(cons
return out.writePair(SCTAG_UNDEFINED, 0);
} else if (v.isObject()) {
JSObject *obj = &v.toObject();
if (obj->isRegExp()) {
RegExpObject &reobj = obj->asRegExp();
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);
} else if (js_IsTypedArray(obj)) {
return writeTypedArray(obj);
} else if (js_IsArrayBuffer(obj)) {
return writeArrayBuffer(obj);
} else if (obj->isBoolean()) {
@@ -598,17 +598,17 @@ JSStructuredCloneWriter::write(const Val
}
memory.clear();
return true;
}
bool
-JSStructuredCloneReader::checkDouble(jsdouble d)
+JSStructuredCloneReader::checkDouble(double d)
{
jsval_layout l;
l.asDouble = d;
if (!JSVAL_IS_DOUBLE_IMPL(l)) {
JS_ReportErrorNumber(context(), js_GetErrorMessage, NULL,
JSMSG_SC_BAD_SERIALIZED_DATA, "unrecognized NaN");
return false;
}
@@ -726,27 +726,27 @@ JSStructuredCloneReader::startRead(Value
return false;
vp->setString(str);
if (tag == SCTAG_STRING_OBJECT && !js_PrimitiveToObject(context(), vp))
return false;
break;
}
case SCTAG_NUMBER_OBJECT: {
- jsdouble d;
+ double d;
if (!in.readDouble(&d) || !checkDouble(d))
return false;
vp->setDouble(d);
if (!js_PrimitiveToObject(context(), vp))
return false;
break;
}
case SCTAG_DATE_OBJECT: {
- jsdouble d;
+ double d;
if (!in.readDouble(&d) || !checkDouble(d))
return false;
if (d == d && d != TIMECLIP(d)) {
JS_ReportErrorNumber(context(), js_GetErrorMessage, NULL, JSMSG_SC_BAD_SERIALIZED_DATA,
"date");
return false;
}
JSObject *obj = js_NewDateObjectMsec(context(), d);
@@ -803,17 +803,17 @@ JSStructuredCloneReader::startRead(Value
break;
}
case SCTAG_ARRAY_BUFFER_OBJECT:
return readArrayBuffer(data, 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);
break;
}
if (SCTAG_TYPED_ARRAY_MIN <= tag && tag <= SCTAG_TYPED_ARRAY_MAX)
return readTypedArray(tag, data, vp);
--- a/js/src/jsclone.h
+++ b/js/src/jsclone.h
@@ -58,17 +58,17 @@ ReadStructuredClone(JSContext *cx, const
struct SCOutput {
public:
explicit SCOutput(JSContext *cx);
JSContext *context() const { return cx; }
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);
template <class T>
bool writeArray(const T *p, size_t nbytes);
bool extractBuffer(uint64_t **datap, size_t *sizep);
@@ -82,30 +82,30 @@ struct SCOutput {
struct SCInput {
public:
SCInput(JSContext *cx, const uint64_t *data, size_t nbytes);
JSContext *context() const { return cx; }
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);
template <class T>
bool readArray(T *p, size_t nelems);
private:
bool eof();
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;
const uint64_t *point;
const uint64_t *end;
};
}
@@ -118,17 +118,17 @@ struct JSStructuredCloneReader {
callbacks(cb), closure(cbClosure) { }
js::SCInput &input() { return in; }
bool read(js::Value *vp);
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);
bool readId(jsid *idp);
bool startRead(js::Value *vp);
js::SCInput ∈
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -171,33 +171,33 @@ using namespace js::types;
#define SecondsPerMinute 60.0
#if defined(XP_WIN) || defined(XP_OS2)
/* Work around msvc double optimization bug by making these runtime values; if
* they're available at compile time, msvc optimizes division by them by
* 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)
#define msPerMinute (SecondsPerMinute * msPerSecond)
#define msPerSecond 1000.0
#endif
#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;
return result;
}
static inline bool
IsLeapYear(jsint year)
@@ -220,20 +220,20 @@ DaysInFebruary(jsint year)
/* math here has to be f.p, because we need
* floor((1968 - 1969) / 4) == -1
*/
#define DayFromYear(y) (365 * ((y)-1970) + floor(((y)-1969)/4.0) \
- floor(((y)-1901)/100.0) + floor(((y)-1601)/400.0))
#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
* computed using the average number of ms per year, it will usually
* be wrong for dates within several hours of a year transition.
*/
if (t2 > t) {
y--;
@@ -245,33 +245,33 @@ YearFromTime(jsdouble t)
}
#define DayWithinYear(t, year) ((intN) (Day(t) - DayFromYear(year)))
/*
* 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}
};
#define DayFromMonth(m, leap) firstDayOfMonth[leap][(intN)m]
static intN
DaysInMonth(jsint year, jsint month)
{
JSBool leap = IsLeapYear(year);
intN result = intN(DayFromMonth(month, leap) - DayFromMonth(month-1, leap));
return result;
}
static intN
-MonthFromTime(jsdouble t)
+MonthFromTime(double t)
{
intN d, step;
jsint year = YearFromTime(t);
d = DayWithinYear(t, year);
if (d < (step = 31))
return 0;
if (d < (step += DaysInFebruary(year)))
@@ -293,17 +293,17 @@ MonthFromTime(jsdouble t)
if (d < (step += 31))
return 9;
if (d < (step += 30))
return 10;
return 11;
}
static intN
-DateFromTime(jsdouble t)
+DateFromTime(double t)
{
intN d, step, next;
jsint year = YearFromTime(t);
d = DayWithinYear(t, year);
if (d <= (next = 30))
return d + 1;
step = next;
@@ -336,35 +336,35 @@ DateFromTime(jsdouble t)
step = next;
if (d <= (next += 30))
return d - step;
step = next;
return d - step;
}
static intN
-WeekDay(jsdouble t)
+WeekDay(double t)
{
jsint result;
result = (jsint) Day(t) + 4;
result = result % 7;
if (result < 0)
result += 7;
return (intN) result;
}
#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);
month = fmod(month, 12.0);
if (month < 0)
month += 12;
leap = IsLeapYear((jsint) year);
@@ -407,89 +407,89 @@ EquivalentYearForDST(jsint year)
day = day % 7;
if (day < 0)
day += 7;
return yearStartingWith[IsLeapYear(year)][day];
}
/* LocalTZA gets set by js_InitDateClass() */
-static jsdouble LocalTZA;
-
-static jsdouble
-DaylightSavingTA(jsdouble t, JSContext *cx)
+static double LocalTZA;
+
+static double
+DaylightSavingTA(double t, JSContext *cx)
{
/* abort if NaN */
if (JSDOUBLE_IS_NaN(t))
return t;
/*
* If earlier than 1970 or after 2038, potentially beyond the ken of
* many OSes, map it to an equivalent year before asking.
*/
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)
result += (intN)HoursPerDay;
return result;
}
static intN
-MinFromTime(jsdouble t)
+MinFromTime(double t)
{
intN result = (intN) fmod(floor(t / msPerMinute), MinutesPerHour);
if (result < 0)
result += (intN)MinutesPerHour;
return result;
}
static intN
-SecFromTime(jsdouble t)
+SecFromTime(double t)
{
intN result = (intN) fmod(floor(t / msPerSecond), SecondsPerMinute);
if (result < 0)
result += (intN)SecondsPerMinute;
return result;
}
static intN
-msFromTime(jsdouble t)
+msFromTime(double t)
{
intN result = (intN) fmod(t, msPerSecond);
if (result < 0)
result += (intN)msPerSecond;
return result;
}
/**
@@ -573,43 +573,43 @@ date_regionMatches(const char* s1, int s
if (count == 0) {
result = JS_TRUE;
}
return result;
}
/* 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);
result = MakeDate(day, msec_time);
return result;
}
/* compute the time in msec (unclipped) from the given args */
#define MAXARGS 7
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 */
if (!JSDOUBLE_IS_FINITE(d)) {
*rval = js_NaN;
return JS_TRUE;
}
array[loop] = js_DoubleToInteger(d);
@@ -635,17 +635,17 @@ date_msecFromArgs(JSContext *cx, CallArg
/*
* See ECMA 15.9.4.[3-10];
*/
static JSBool
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;
msec_time = TIMECLIP(msec_time);
args.rval().setNumber(msec_time);
return JS_TRUE;
}
@@ -675,19 +675,19 @@ digits(size_t *result, const jschar *s,
* Read and convert decimal digits to the right of a decimal point,
* representing a fractional integer, from s[*i] into *result
* while *i < limit.
*
* Succeed if any digits are converted. Advance *i only
* 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 &&
('0' <= s[*i] && s[*i] <= '9')) {
*result += (s[*i] - '0') * factor;
factor *= 0.1;
++(*i);
}
@@ -765,32 +765,32 @@ ndigits(size_t n, size_t *result, const
* hh = two digits of hour (00 through 23) (am/pm NOT allowed)
* mm = two digits of minute (00 through 59)
* ss = two digits of second (00 through 59)
* s = one or more digits representing a decimal fraction of a second
* TZD = time zone designator (Z or +hh:mm or -hh:mm or missing for local)
*/
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;
size_t i = 0;
int tzMul = 1;
int dateMul = 1;
size_t year = 1970;
size_t month = 1;
size_t day = 1;
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;
#define PEEK(ch) (i < limit && s[i] == ch)
#define NEED(ch) \
JS_BEGIN_MACRO \
@@ -874,17 +874,17 @@ date_parseISOString(JSLinearString *str,
|| tzMin > 59)
goto syntax;
if (i != limit)
goto syntax;
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);;
if (isLocalTime) {
msec = UTC(msec, cx);
} else {
msec -= ((tzMul) * ((tzHour * msPerHour)
+ (tzMin * msPerMinute)));
@@ -904,19 +904,19 @@ date_parseISOString(JSLinearString *str,
#undef PEEK
#undef NEED
#undef DONE_UNLESS
#undef NEED_NDIGITS
}
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;
size_t i = 0;
int year = -1;
int mon = -1;
int mday = -1;
int hour = -1;
@@ -1179,17 +1179,17 @@ syntax:
*result = 0;
return JS_FALSE;
}
static JSBool
date_parse(JSContext *cx, uintN argc, Value *vp)
{
JSString *str;
- jsdouble result;
+ double result;
if (argc == 0) {
vp->setDouble(js_NaN);
return true;
}
str = ToString(cx, vp[2]);
if (!str)
return JS_FALSE;
@@ -1203,34 +1203,34 @@ date_parse(JSContext *cx, uintN argc, Va
return true;
}
result = TIMECLIP(result);
vp->setNumber(result);
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
date_now(JSContext *cx, uintN argc, Value *vp)
{
vp->setDouble(NowAsMillis());
return JS_TRUE;
}
/*
* 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());
for (size_t ind = JSObject::JSSLOT_DATE_COMPONENTS_START;
ind < JSObject::DATE_CLASS_RESERVED_SLOTS;
ind++) {
obj->setSlot(ind, UndefinedValue());
}
@@ -1239,57 +1239,57 @@ SetUTCTime(JSContext *cx, JSObject *obj,
if (vp)
vp->setDouble(t);
return true;
}
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);
}
/*
* Cache the local time, year, month, and so forth of the object.
* If UTC time is not finite (e.g., NaN), the local time
* slots will be set to the UTC time without conversion.
*/
static bool
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;
ind < JSObject::DATE_CLASS_RESERVED_SLOTS;
ind++) {
obj->setSlot(ind, DoubleValue(utcTime));
}
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;
if (yearStartTime > localTime) {
year--;
yearStartTime -= (msPerDay * DaysInYear(year));
yearDays = DaysInYear(year);
} else {
yearDays = DaysInYear(year);
- jsdouble nextStart = yearStartTime + (msPerDay * yearDays);
+ double nextStart = yearStartTime + (msPerDay * yearDays);
if (nextStart <= localTime) {
year++;
yearStartTime = nextStart;
yearDays = DaysInYear(year);
}
}
obj->setSlot(JSObject::JSSLOT_DATE_LOCAL_YEAR, Int32Value(year));
@@ -1577,17 +1577,17 @@ date_getUTCDay(JSContext *cx, uintN argc
{
CallArgs args = CallArgsFromVp(argc, vp);
bool ok;
JSObject *obj = NonGenericMethodGuard(cx, args, date_getUTCDay, &DateClass, &ok);
if (!obj)
return ok;
- jsdouble result = obj->getDateUTCTime().toNumber();
+ double result = obj->getDateUTCTime().toNumber();
if (JSDOUBLE_IS_FINITE(result))
result = WeekDay(result);
args.rval().setNumber(result);
return true;
}
static JSBool
@@ -1735,17 +1735,17 @@ date_setTime(JSContext *cx, uintN argc,
if (!obj)
return ok;
if (args.length() == 0) {
SetDateToNaN(cx, obj, &args.rval());
return true;
}
- jsdouble result;
+ double result;
if (!ToNumber(cx, args[0], &result))
return false;
return SetUTCTime(cx, obj, TIMECLIP(result), &args.rval());
}
static JSBool
date_makeTime(JSContext *cx, Native native, uintN maxargs, JSBool local, uintN argc, Value *vp)
@@ -2039,44 +2039,44 @@ static const char* months[] =
{
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
// 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)],
DateFromTime(utctime),
months[MonthFromTime(utctime)],
YearFromTime(utctime),
HourFromTime(utctime),
MinFromTime(utctime),
SecFromTime(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),
MonthFromTime(utctime) + 1,
DateFromTime(utctime),
HourFromTime(utctime),
MinFromTime(utctime),
SecFromTime(utctime),
msFromTime(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);
if (!obj)
return ok;
double utctime = obj->getDateUTCTime().toNumber();
@@ -2155,17 +2155,17 @@ date_toJSON(JSContext *cx, uintN argc, V
return false;
*vp = args.rval();
return true;
}
/* 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);
split->tm_usec = int32_t(msFromTime(timeval)) * 1000;
split->tm_sec = int8_t(SecFromTime(timeval));
split->tm_min = int8_t(MinFromTime(timeval));
split->tm_hour = int8_t(HourFromTime(timeval));
split->tm_mday = int8_t(DateFromTime(timeval));
@@ -2180,29 +2180,29 @@ new_explode(jsdouble timeval, PRMJTime *
}
typedef enum formatspec {
FORMATSPEC_FULL, FORMATSPEC_DATE, FORMATSPEC_TIME
} 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;
char tzbuf[100];
JSBool usetz;
size_t i, tzlen;
PRMJTime split;
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. */
jsint minutes = (jsint) floor(AdjustTime(date, cx) / msPerMinute);
/* map 510 minutes to 0830 hours */
intN offset = (minutes / 60) * 100 + minutes % 60;
@@ -2302,17 +2302,17 @@ ToLocaleHelper(JSContext *cx, CallReceiv
{
double utctime = obj->getDateUTCTime().toNumber();
char buf[100];
if (!JSDOUBLE_IS_FINITE(utctime)) {
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);
/* let PRMJTime format it. */
result_len = PRMJ_FormatTime(buf, sizeof buf, format, &split);
/* If it failed, default to toString. */
if (result_len == 0)
@@ -2590,17 +2590,17 @@ js_Date(JSContext *cx, uintN argc, Value
{
CallArgs args = CallArgsFromVp(argc, vp);
/* Date called as function. */
if (!IsConstructing(args))
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) {
if (!args[0].isString()) {
/* the argument is a millisecond number */
if (!ToNumber(cx, args[0], &d))
return false;
d = TIMECLIP(d);
@@ -2615,17 +2615,17 @@ js_Date(JSContext *cx, uintN argc, Value
return false;
if (!date_parseString(linearStr, &d, cx))
d = js_NaN;
else
d = TIMECLIP(d);
}
} else {
- jsdouble msec_time;
+ double msec_time;
if (!date_msecFromArgs(cx, args, &msec_time))
return false;
if (JSDOUBLE_IS_FINITE(msec_time)) {
msec_time = UTC(msec_time, cx);
msec_time = TIMECLIP(msec_time);
}
d = msec_time;
@@ -2684,102 +2684,102 @@ js_InitDateClass(JSContext *cx, JSObject
if (!DefineConstructorAndPrototype(cx, global, JSProto_Date, ctor, dateProto))
return NULL;
return dateProto;
}
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)
return NULL;
if (!SetUTCTime(cx, obj, msec_time))
return NULL;
return obj;
}
JS_FRIEND_API(JSObject *)
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);
obj = js_NewDateObjectMsec(cx, UTC(msec_time, cx));
return obj;
}
JS_FRIEND_API(JSBool)
js_DateIsValid(JSContext *cx, JSObject* obj)
{
return obj->isDate() && !JSDOUBLE_IS_NaN(obj->getDateUTCTime().toNumber());
}
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) ||
JSDOUBLE_IS_NaN(localtime)) {
return 0;
}
return (int) YearFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetMonth(JSContext *cx, JSObject* obj)
{
- jsdouble localtime;
+ double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
return 0;
}
return (int) MonthFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetDate(JSContext *cx, JSObject* obj)
{
- jsdouble localtime;
+ double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
return 0;
}
return (int) DateFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetHours(JSContext *cx, JSObject* obj)
{
- jsdouble localtime;
+ double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
return 0;
}
return (int) HourFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetMinutes(JSContext *cx, JSObject* obj)
{
- jsdouble localtime;
+ double localtime;
if (!GetAndCacheLocalTime(cx, obj, &localtime) ||
JSDOUBLE_IS_NaN(localtime)) {
return 0;
}
return (int) MinFromTime(localtime);
}
@@ -2791,17 +2791,17 @@ js_DateGetSeconds(JSContext *cx, JSObjec
return 0;
double utctime = obj->getDateUTCTime().toNumber();
if (JSDOUBLE_IS_NaN(utctime))
return 0;
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;
}
#ifdef JS_THREADSAFE
#include "prinrval.h"
--- a/js/src/jsdate.h
+++ b/js/src/jsdate.h
@@ -59,17 +59,17 @@ js_InitDateClass(JSContext *cx, JSObject
* These functions provide a C interface to the date/time object
*/
/*
* Construct a new Date Object from a time value given in milliseconds UTC
* 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.
*
* Assert that mon < 12 to help catch off-by-one user errors, which are common
* due to the 0-based month numbering copied into JS from Java (java.util.Date
* in 1995).
*/
--- a/js/src/jsinterp.cpp
+++ b/js/src/jsinterp.cpp
@@ -2362,17 +2362,17 @@ BEGIN_CASE(JSOP_BITNOT)
}
END_CASE(JSOP_BITNOT)
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;
if (ref.isInt32() && (i = ref.toInt32()) != 0 && i != INT32_MIN) {
i = -i;
regs.sp[-1].setInt32(i);
} else {
double d;
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -114,33 +114,33 @@ Class js::MathClass = {
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub
};
JSBool
js_math_abs(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
z = fabs(x);
vp->setNumber(z);
return JS_TRUE;
}
static JSBool
math_acos(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
#if defined(SOLARIS) && defined(__GNUC__)
@@ -155,17 +155,17 @@ math_acos(JSContext *cx, uintN argc, Val
z = mathCache->lookup(acos, x);
vp->setDouble(z);
return JS_TRUE;
}
static JSBool
math_asin(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
#if defined(SOLARIS) && defined(__GNUC__)
@@ -180,45 +180,45 @@ math_asin(JSContext *cx, uintN argc, Val
z = mathCache->lookup(asin, x);
vp->setDouble(z);
return JS_TRUE;
}
static JSBool
math_atan(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
MathCache *mathCache = GetMathCache(cx);
if (!mathCache)
return JS_FALSE;
z = mathCache->lookup(atan, x);
vp->setDouble(z);
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)
/*
* MSVC's atan2 does not yield the result demanded by ECMA when both x
* and y are infinite.
* - The result is a multiple of pi/4.
* - The sign of x determines the sign of the result.
* - 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;
}
#endif
#if defined(SOLARIS) && defined(__GNUC__)
if (x == 0) {
@@ -229,59 +229,59 @@ math_atan2_kernel(jsdouble x, jsdouble y
}
#endif
return atan2(x, 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);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x) || !ToNumber(cx, vp[3], &y))
return JS_FALSE;
z = math_atan2_kernel(x, y);
vp->setDouble(z);
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)
return js_copysign(0, -1);
#endif
return ceil(x);
}
JSBool
js_math_ceil(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
z = js_math_ceil_impl(x);
vp->setNumber(z);
return JS_TRUE;
}
static JSBool
math_cos(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
MathCache *mathCache = GetMathCache(cx);
@@ -304,58 +304,58 @@ math_exp_body(double d)
}
#endif
return exp(d);
}
static JSBool
math_exp(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
MathCache *mathCache = GetMathCache(cx);
if (!mathCache)
return JS_FALSE;
z = mathCache->lookup(math_exp_body, x);
vp->setNumber(z);
return JS_TRUE;
}
-jsdouble
-js_math_floor_impl(jsdouble x)
+double
+js_math_floor_impl(double x)
{
return floor(x);
}
JSBool
js_math_floor(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
z = js_math_floor_impl(x);
vp->setNumber(z);
return JS_TRUE;
}
static JSBool
math_log(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
#if defined(SOLARIS) && defined(__GNUC__)
@@ -370,17 +370,17 @@ math_log(JSContext *cx, uintN argc, Valu
z = mathCache->lookup(log, x);
vp->setNumber(z);
return JS_TRUE;
}
JSBool
js_math_max(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z = js_NegativeInfinity;
+ double x, z = js_NegativeInfinity;
Value *argv;
uintN i;
if (argc == 0) {
vp->setDouble(js_NegativeInfinity);
return JS_TRUE;
}
argv = vp + 2;
@@ -400,17 +400,17 @@ js_math_max(JSContext *cx, uintN argc, V
}
vp->setNumber(z);
return JS_TRUE;
}
JSBool
js_math_min(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z = js_PositiveInfinity;
+ double x, z = js_PositiveInfinity;
Value *argv;
uintN i;
if (argc == 0) {
vp->setDouble(js_PositiveInfinity);
return JS_TRUE;
}
argv = vp + 2;
@@ -427,48 +427,48 @@ js_math_min(JSContext *cx, uintN argc, V
} else {
z = (x < z) ? x : z;
}
}
vp->setNumber(z);
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;
if (n == 0) {
if (y < 0) {
// Unfortunately, we have to be careful when p has reached
// infinity in the computation, because sometimes the higher
// 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;
}
return p;
}
m *= m;
}
}
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);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x) || !ToNumber(cx, vp[3], &y))
return JS_FALSE;
/*
@@ -506,17 +506,17 @@ js_math_pow(JSContext *cx, uintN argc, V
vp->setNumber(z);
return JS_TRUE;
}
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.
*/
extern void
random_setSeed(int64_t *rngSeed, int64_t seed)
{
*rngSeed = (seed ^ RNG_MULTIPLIER) & RNG_MASK;
@@ -539,27 +539,27 @@ random_next(int64_t *rngSeed, int bits)
{
uint64_t nextseed = *rngSeed * RNG_MULTIPLIER;
nextseed += RNG_ADDEND;
nextseed &= RNG_MASK;
*rngSeed = nextseed;
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;
}
#if defined _WIN32 && _MSC_VER < 1400
/* Try to work around apparent _copysign bustage in VC7.x. */
double
js_copysign(double x, double y)
@@ -607,17 +607,17 @@ js_math_round(JSContext *cx, uintN argc,
args.rval().setNumber(js_copysign(floor(x + 0.5), x));
return true;
}
static JSBool
math_sin(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
MathCache *mathCache = GetMathCache(cx);
@@ -626,17 +626,17 @@ math_sin(JSContext *cx, uintN argc, Valu
z = mathCache->lookup(sin, x);
vp->setDouble(z);
return JS_TRUE;
}
JSBool
js_math_sqrt(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
MathCache *mathCache = GetMathCache(cx);
@@ -645,17 +645,17 @@ js_math_sqrt(JSContext *cx, uintN argc,
z = mathCache->lookup(sqrt, x);
vp->setDouble(z);
return JS_TRUE;
}
static JSBool
math_tan(JSContext *cx, uintN argc, Value *vp)
{
- jsdouble x, z;
+ double x, z;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
if (!ToNumber(cx, vp[2], &x))
return JS_FALSE;
MathCache *mathCache = GetMathCache(cx);
--- a/js/src/jsmath.h
+++ b/js/src/jsmath.h
@@ -110,15 +110,15 @@ extern JSBool
js_math_round(JSContext *cx, uintN argc, js::Value *vp);
extern JSBool
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___ */
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -88,17 +88,17 @@ using namespace js;
using namespace js::types;
/*
* If we're accumulating a decimal number and the number is >= 2^53, then the
* fast result from the loop in GetPrefixInteger may be inaccurate. Call
* 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));
if (!cstr)
return false;
for (size_t i = 0; i < length; i++) {
char c = char(start[i]);
@@ -162,42 +162,42 @@ class BinaryDigitReader
* The fast result might also have been inaccurate for power-of-two bases. This
* happens if the addition in value * 2 + digit causes a round-down to an even
* least significant mantissa bit when the first dropped bit is a one. If any
* of the following digits in the number (which haven't been added in yet) are
* nonzero, then the correct action would have been to round up instead of
* 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);
/* Skip leading zeroes. */
int bit;
do {
bit = bdr.nextDigit();
} while (bit == 0);
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)
return value;
value = value * 2 + bit;
}
/* 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;
while ((bit3 = bdr.nextDigit()) >= 0) {
sticky |= bit3;
factor *= 2;
}
value += bit2 & (bit | sticky);
@@ -206,23 +206,23 @@ ComputeAccurateBinaryBaseInteger(JSConte
return value;
}
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;
if ('0' <= c && c <= '9')
digit = c - '0';
else if ('a' <= c && c <= 'z')
digit = c - 'a' + 10;
else if ('A' <= c && c <= 'Z')
@@ -258,42 +258,42 @@ GetPrefixInteger(JSContext *cx, const js
static JSBool
num_isNaN(JSContext *cx, uintN argc, Value *vp)
{
if (argc == 0) {
vp->setBoolean(true);
return JS_TRUE;
}
- jsdouble x;
+ double x;
if (!ToNumber(cx, vp[2], &x))
return false;
vp->setBoolean(JSDOUBLE_IS_NaN(x));
return JS_TRUE;
}
static JSBool
num_isFinite(JSContext *cx, uintN argc, Value *vp)
{
if (argc == 0) {
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));
return JS_TRUE;
}
static JSBool
num_parseFloat(JSContext *cx, uintN argc, Value *vp)
{
JSString *str;
- jsdouble d;
+ double d;
const jschar *bp, *end, *ep;
if (argc == 0) {
vp->setDouble(js_NaN);
return JS_TRUE;
}
str = ToString(cx, vp[2]);
if (!str)
@@ -309,17 +309,17 @@ num_parseFloat(JSContext *cx, uintN argc
return JS_TRUE;
}
vp->setNumber(d);
return JS_TRUE;
}
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);
const jschar *s = SkipSpace(ws, end);
JS_ASSERT(ws <= s);
JS_ASSERT(s <= end);
@@ -434,17 +434,17 @@ js::num_parseInt(JSContext *cx, uintN ar
}
/* Steps 2-5, 9-14. */
const jschar *ws = inputString->getChars(cx);
if (!ws)
return false;
const jschar *end = ws + inputString->length();
- jsdouble number;
+ double number;
if (!ParseIntStringHelper(cx, ws, end, radix, stripPrefix, &number))
return false;
/* Step 15. */
args.rval().setNumber(number);
return true;
}
@@ -605,31 +605,31 @@ IntToCString(ToCStringBuf *cbuf, jsint i
}
if (i < 0)
*--cp = '-';
return cp.get();
}
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)
{
CallArgs args = CallArgsFromVp(argc, vp);
double d;
bool ok;
if (!BoxedPrimitiveMethodGuard(cx, args, native, &d, &ok))
return ok;
int32_t base = 10;
if (args.length() != 0 && !args[0].isUndefined()) {
- jsdouble d2;
+ double d2;
if (!ToInteger(cx, args[0], &d2))
return false;
if (d2 < 2 || d2 > 36) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_BAD_RADIX);
return false;
}
@@ -888,19 +888,19 @@ static JSConstDoubleSpec number_constant
{0, js_NaN_str, 0,{0,0,0}},
{0, "POSITIVE_INFINITY", 0,{0,0,0}},
{0, "NEGATIVE_INFINITY", 0,{0,0,0}},
{1.7976931348623157E+308, "MAX_VALUE", 0,{0,0,0}},
{0, "MIN_VALUE", 0,{0,0,0}},
{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)
/*
* Set the exception mask to mask all exceptions and set the FPU precision
* to 53 bit mantissa (64 bit doubles).
*/
@@ -1059,17 +1059,17 @@ namespace v8 {
namespace internal {
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
{
int32_t _;
JS_ASSERT(!JSDOUBLE_IS_INT32(d, &_));
}
#endif
@@ -1091,28 +1091,28 @@ FracNumberToCString(JSContext *cx, ToCSt
DTOSTR_STANDARD, 0, d);
} else {
numStr = cbuf->dbuf = js_dtobasestr(cx->runtime->dtoaState, base, d);
}
return numStr;
}
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))
? IntToCString(cbuf, i, base)
: FracNumberToCString(cx, cbuf, d, base);
}
}
static JSString * JS_FASTCALL
-js_NumberToStringWithBase(JSContext *cx, jsdouble d, jsint base)
+js_NumberToStringWithBase(JSContext *cx, double d, jsint base)
{
ToCStringBuf cbuf;
char *numStr;
/*
* Caller is responsible for error reporting. When called from trace,
* returning NULL here will cause us to fall of trace and then retry
* from the interpreter (which will report the error).
@@ -1155,25 +1155,25 @@ js_NumberToStringWithBase(JSContext *cx,
}
JSFixedString *s = js_NewStringCopyZ(cx, numStr);
c->dtoaCache.cache(base, d, s);
return s;
}
JSString * JS_FASTCALL
-js_NumberToString(JSContext *cx, jsdouble d)
+js_NumberToString(JSContext *cx, double d)
{
return js_NumberToStringWithBase(cx, d, 10);
}
namespace js {
JSFixedString *
-NumberToString(JSContext *cx, jsdouble d)
+NumberToString(JSContext *cx, double d)
{
if (JSString *str = js_NumberToStringWithBase(cx, d, 10))
return &str->asFixed();
return NULL;
}
JSFixedString *
IndexToString(JSContext *cx, uint32_t index)
@@ -1234,17 +1234,17 @@ ToNumberSlow(JSContext *cx, Value v, dou
goto skip_int_double;
for (;;) {
if (v.isNumber()) {
*out = v.toNumber();
return true;
}
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;
return true;
}
*out = 0.0;
return true;
}
@@ -1265,32 +1265,32 @@ ToNumberSlow(JSContext *cx, Value v, dou
*out = js_NaN;
return true;
}
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 {
if (!ToNumberSlow(cx, v, &d))
return false;
}
*out = js_DoubleToECMAInt32(d);
return true;
}
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 {
if (!ToNumberSlow(cx, v, &d))
return false;
}
*out = js_DoubleToECMAUint32(d);
return true;
@@ -1299,17 +1299,17 @@ ToUint32Slow(JSContext *cx, const Value
} /* namespace js */
namespace js {
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)) {
return false;
}
if (JSDOUBLE_IS_NaN(d) || d <= -2147483649.0 || 2147483648.0 <= d) {
js_ReportValueError(cx, JSMSG_CANT_CONVERT,
@@ -1319,30 +1319,30 @@ NonstandardToInt32Slow(JSContext *cx, co
*out = (int32_t) floor(d + 0.5); /* Round to nearest */
return true;
}
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)) {
return false;
}
if (d == 0 || !JSDOUBLE_IS_FINITE(d)) {
*out = 0;
return true;
}
uint16_t u = (uint16_t) d;
- if ((jsdouble)u == d) {
+ if ((double)u == d) {
*out = u;
return true;
}
bool neg = (d < 0);
d = floor(neg ? -d : d);
d = neg ? -d : d;
jsuint m = JS_BIT(16);
@@ -1352,23 +1352,23 @@ ValueToUint16Slow(JSContext *cx, const V
*out = (uint16_t) d;
return true;
}
} /* namespace js */
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;
/* Use cbuf to avoid malloc */
if (length >= sizeof cbuf) {
cstr = (char *) cx->malloc_(length + 1);
if (!cstr)
--- a/js/src/jsnum.h
+++ b/js/src/jsnum.h
@@ -78,64 +78,64 @@ typedef union jsdpun {
struct {
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
uint32_t lo, hi;
#else
uint32_t hi, lo;
#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;
return (u.u64 & JSDOUBLE_EXPMASK) == JSDOUBLE_EXPMASK &&
(u.u64 & JSDOUBLE_MANTMASK) != 0;
}
static inline int
-JSDOUBLE_IS_FINITE(jsdouble d)
+JSDOUBLE_IS_FINITE(double d)
{
/* -0 is finite. NaNs are not. */
jsdpun u;
u.d = d;
return (u.u64 & JSDOUBLE_EXPMASK) != JSDOUBLE_EXPMASK;
}
static inline int
-JSDOUBLE_IS_INFINITE(jsdouble d)
+JSDOUBLE_IS_INFINITE(double d)
{
jsdpun u;
u.d = d;
return (u.u64 & ~JSDOUBLE_SIGNBIT) == JSDOUBLE_EXPMASK;
}
static inline bool
-JSDOUBLE_IS_NEG(jsdouble d)
+JSDOUBLE_IS_NEG(double d)
{
jsdpun u;
u.d = d;
return (u.s.hi & JSDOUBLE_HI32_SIGNBIT) != 0;
}
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 {
extern bool
InitRuntimeNumberState(JSRuntime *rt);
extern void
FinishRuntimeNumberState(JSRuntime *rt);
@@ -163,30 +163,30 @@ extern JSString * JS_FASTCALL
js_IntToString(JSContext *cx, jsint i);
/*
* When base == 10, this function implements ToString() as specified by
* ECMA-262-5 section 9.8.1; but note that it handles integers specially for
* performance. See also js::NumberToCString().
*/
extern JSString * JS_FASTCALL
-js_NumberToString(JSContext *cx, jsdouble d);
+js_NumberToString(JSContext *cx, double d);
namespace js {
/*
* Convert an integer or double (contained in the given value) to a string and
* append to the given buffer.
*/
extern bool JS_FASTCALL
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);
/*
* Usually a small amount of static storage is enough, but sometimes we need
* to dynamically allocate much more. This struct encapsulates that.
* Dynamically allocated memory will be freed when the object is destroyed.
@@ -208,17 +208,17 @@ struct ToCStringBuf
/*
* Convert a number to a C string. When base==10, this function implements
* ToString() as specified by ECMA-262-5 section 9.8.1. It handles integral
* values cheaply. Return NULL if we ran out of memory. See also
* 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
* may be precisely represented using the IEEE-754 double-precision format.
*/
const double DOUBLE_INTEGRAL_PRECISION_LIMIT = uint64_t(1) << 53;
/*
@@ -230,17 +230,17 @@ const double DOUBLE_INTEGRAL_PRECISION_L
* base is 10 or a power of two the returned integer is the closest possible
* double; otherwise extremely large integers may be slightly inaccurate.
*
* If [start, end) does not begin with a number with the specified base,
* *dp == 0 and *endp == start upon return.
*/
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
ToNumber(JSContext *cx, const Value &v, double *out)
{
if (v.isNumber()) {
*out = v.toNumber();
return true;
@@ -336,17 +336,17 @@ num_parseInt(JSContext *cx, uintN argc,
* 3. Compute sign(Result(1)) * floor(abs(Result(1))).
* 4. Compute Result(3) modulo 2^32; that is, a finite integer value k of Number
* type with positive sign and less than 2^32 in magnitude such the mathematical
* difference of Result(3) and k is mathematically an integer multiple of 2^32.
* 5. If Result(4) is greater than or equal to 2^31, return Result(4)- 2^32,
* 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)
jsdpun du, duh, two32;
uint32_t di_h, u_tmp, expon, shift_amount;
int32_t mask32;
/*
@@ -534,45 +534,45 @@ js_DoubleToECMAInt32(jsdouble d)
"9:\n"
: "=r" (i), "=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2)
: "r" (d)
: "cc"
);
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;
two31 = 2147483648.0;
d = fmod(d, two32);
d = (d >= 0) ? floor(d) : ceil(d) + two32;
return (int32_t) (d >= two31 ? d - two32 : d);
#endif
}
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;
if (!JSDOUBLE_IS_FINITE(d)) {
if (JSDOUBLE_IS_NaN(d))
return 0;
return d;
@@ -591,17 +591,17 @@ js_DoubleToInteger(jsdouble d)
*
* Also allows inputs of the form [+|-]Infinity, which produce an infinity of
* the appropriate sign. The case of the "Infinity" string must match exactly.
* If the string does not contain a number, set *ep to s and return 0.0 in dp.
* Return false if out of memory.
*/
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);
namespace js {
static JS_ALWAYS_INLINE bool
ValueFitsInInt32(const Value &v, int32_t *pi)
@@ -636,17 +636,17 @@ IsDefinitelyIndex(const Value &v, uint32
return true;
}
return false;
}
/* 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();
return true;
}
if (v.isDouble()) {
*dp = v.toDouble();
} else {
--- a/js/src/jsnuminlines.h
+++ b/js/src/jsnuminlines.h
@@ -46,22 +46,22 @@
namespace js {
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>
static JS_ALWAYS_INLINE bool
StringToNumberType(JSContext *cx, JSString *str, T *result)
{
size_t length = str->length();
const jschar *chars = str->getChars(NULL);
--- a/js/src/json.cpp
+++ b/js/src/json.cpp
@@ -704,33 +704,33 @@ js_Stringify(JSContext *cx, Value *vp, J
replacer = NULL;
}
}
/* Step 5. */
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);
} else if (ObjectClassIs(spaceObj, ESClass_String, cx)) {
JSString *str = ToStringSlow(cx, space);
if (!str)
return false;
space = StringValue(str);
}
}
StringBuffer gap(cx);
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)))
return false;
} else if (space.isString()) {
/* Step 7. */
JSLinearString *str = space.toString()->ensureLinear(cx);
if (!str)
--- a/js/src/jsonparser.cpp
+++ b/js/src/jsonparser.cpp
@@ -212,17 +212,17 @@ JSONParser::readNumber()
if (!JS7_ISDEC(*current))
break;
}
}
/* 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);
return numberToken(negative ? -d : d);
}
/* (\.[0-9]+)? */
if (current < end && *current == '.') {
@@ -257,17 +257,17 @@ JSONParser::readNumber()
return token(Error);
}
while (++current < end) {
if (!JS7_ISDEC(*current))
break;
}
}
- jsdouble d;
+ double d;
const jschar *finish;
if (!js_strtod(cx, digitStart.get(), current.get(), &finish, &d))
return token(OOM);
JS_ASSERT(current == finish);
return numberToken(negative ? -d : d);
}
static inline bool
--- a/js/src/jsonparser.h
+++ b/js/src/jsonparser.h
@@ -147,17 +147,17 @@ class JSONParser
Token stringToken(JSString *str) {
this->v = js::StringValue(str);
#ifdef DEBUG
lastToken = String;
#endif
return String;
}
- Token numberToken(jsdouble d) {
+ Token numberToken(double d) {
this->v = js::NumberValue(d);
#ifdef DEBUG
lastToken = Number;
#endif
return Number;
}
enum StringType { PropertyName, LiteralValue };
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -1593,17 +1593,17 @@ CompareTableEntries(const TableEntry &a,
{
*lessOrEqualp = (a.offset != b.offset) ? a.offset <= b.offset : a.order <= b.order;
return true;
}
static ptrdiff_t
SprintDoubleValue(Sprinter *sp, jsval v, JSOp *opp)
{
- jsdouble d;
+ double d;
ptrdiff_t todo;
char *s;
JS_ASSERT(JSVAL_IS_DOUBLE(v));
d = JSVAL_TO_DOUBLE(v);
if (JSDOUBLE_IS_NEGZERO(d)) {
todo = sp->put("-0");
*opp = JSOP_NEG;
--- a/js/src/jspubtd.h
+++ b/js/src/jspubtd.h
@@ -92,17 +92,16 @@ typedef ptrdiff_t jsid;
# define JSID_BITS(id) (id)
#endif
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
typedef wchar_t jschar;
#else
typedef uint16_t jschar;
#endif
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1060,17 +1060,17 @@ JSScript::NewScript(JSContext *cx, uint3
offsetof(JSScript, inlineData) % sizeof(Value) == 0);
} else
#endif
{
/*
* 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;
}
JSScript *script = js_NewGCScript(cx);
if (!script) {
Foreground::free_(data);
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -1173,17 +1173,17 @@ str_indexOf(JSContext *cx, uintN argc, V
start = textlen;
textlen = 0;
} else {
start = i;
text += start;
textlen -= start;
}
} else {
- jsdouble d;
+ double d;
if (!ToInteger(cx, args[1], &d))
return false;
if (d <= 0) {
start = 0;
} else if (d > textlen) {
start = textlen;
textlen = 0;
} else {
@@ -2551,17 +2551,17 @@ js::str_split(JSContext *cx, uintN argc,
TypeObject *type = GetTypeCallerInitObject(cx, JSProto_Array);
if (!type)
return false;
AddTypeProperty(cx, type, NULL, Type::StringType());
/* 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);
} else {
limit = UINT32_MAX;
}
/* Step 8. */
--- a/js/src/jstypedarray.cpp
+++ b/js/src/jstypedarray.cpp
@@ -88,22 +88,22 @@ ValueIsLength(JSContext *cx, const Value
int32_t i = v.toInt32();
if (i < 0)
return false;
*len = i;
return true;
}
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;
return true;
}
return false;
}
@@ -946,17 +946,17 @@ js_TypedArray_uint8_clamp_double(const d
{
// Not < so that NaN coerces to 0
if (!(x >= 0))
return 0;
if (x > 255)
return 255;
- jsdouble toTruncate = x + 0.5;
+ double toTruncate = x + 0.5;
uint8_t y = uint8_t(toTruncate);
/*
* now val is rounded to nearest, ties rounded up. We want
* rounded to nearest ties to even, so check whether we had a
* tie.
*/
if (y == toTruncate) {
@@ -982,17 +982,17 @@ struct uint8_clamped {
// invoke our assignment helpers for constructor conversion
uint8_clamped(uint8_t x) { *this = x; }
uint8_clamped(uint16_t x) { *this = x; }
uint8_clamped(uint32_t x) { *this = x; }
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;
return *this;
}
inline uint8_clamped& operator= (uint8_t x) {
val = x;
@@ -1027,17 +1027,17 @@ struct uint8_clamped {
val = (x >= 0)
? ((x < 255)
? uint8_t(x)
: 255)
: 0;
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;
}
inline operator uint8_t() const {
return val;
}
};
@@ -1204,17 +1204,17 @@ class TypedArrayTemplate
JS_ASSERT(tarray);
JS_ASSERT(index < getLength(tarray));
if (vp->isInt32()) {
setIndex(tarray, index, NativeType(vp->toInt32()));
return true;
}
- jsdouble d;
+ double d;
if (vp->isDouble()) {
d = vp->toDouble();
} else if (vp->isNull()) {
d = 0.0;
} else if (vp->isPrimitive()) {
JS_ASSERT(vp->isString() || vp->isUndefined() || vp->isBoolean());
if (vp->isString()) {
JS_ALWAYS_TRUE(ToNumber(cx, *vp, &d));
@@ -1806,17 +1806,17 @@ class TypedArrayTemplate
if (v.isDouble())
return nativeFromDouble(v.toDouble());
/*
* The condition guarantees that holes and undefined values
* are treated identically.
*/
if (v.isPrimitive() && !v.isMagic() && !v.isUndefined()) {
- jsdouble dval;
+ double dval;
JS_ALWAYS_TRUE(ToNumber(cx, v, &dval));
return nativeFromDouble(dval);
}
return ArrayTypeIsFloatingPoint()
? NativeType(js_NaN)
: NativeType(int32_t(0));
}
--- a/js/src/jsxdrapi.cpp
+++ b/js/src/jsxdrapi.cpp
@@ -468,17 +468,17 @@ JS_XDRStringOrNull(JSXDRState *xdr, JSSt
if (null) {
*strp = NULL;
return JS_TRUE;
}
return JS_XDRString(xdr, strp);
}
JS_PUBLIC_API(JSBool)
-JS_XDRDouble(JSXDRState *xdr, jsdouble *dp)
+JS_XDRDouble(JSXDRState *xdr, double *dp)
{
jsdpun u;
u.d = (xdr->mode == JSXDR_ENCODE) ? *dp : 0.0;
if (!JS_XDRUint32(xdr, &u.s.lo) || !JS_XDRUint32(xdr, &u.s.hi))
return false;
if (xdr->mode == JSXDR_DECODE)
*dp = u.d;
--- a/js/src/jsxdrapi.h
+++ b/js/src/jsxdrapi.h
@@ -153,17 +153,17 @@ JS_XDRCString(JSXDRState *xdr, char **sp
extern JS_PUBLIC_API(JSBool)
JS_XDRString(JSXDRState *xdr, JSString **strp);
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);
extern JS_PUBLIC_API(JSBool)
JS_XDRScript(JSXDRState *xdr, JSScript **scriptp);
/*
--- a/js/src/jsxml.cpp
+++ b/js/src/jsxml.cpp
@@ -5237,17 +5237,17 @@ js_GetXMLMethod(JSContext *cx, JSObject
JSBool
js_TestXMLEquality(JSContext *cx, const Value &v1, const Value &v2, JSBool *bp)
{
JSXML *xml, *vxml;
JSObject *vobj;
JSBool ok;
JSString *str, *vstr;
- jsdouble d, d2;
+ double d, d2;
JSObject *obj;
jsval v;
if (v1.isObject() && v1.toObject().isXML()) {
obj = &v1.toObject();
v = v2;
} else {
v = v1;
--- a/js/src/methodjit/TypedArrayIC.h
+++ b/js/src/methodjit/TypedArrayIC.h
@@ -77,20 +77,20 @@ ConstantFoldForFloatArray(JSContext *cx,
}
if (!vr->isConstant())
return true;
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;
} else if (v.isInt32()) {
d = v.toInt32();
} else {
JS_NOT_REACHED("unknown constant type");
}
--- a/js/src/perf/jsperf.cpp
+++ b/js/src/perf/jsperf.cpp
@@ -86,17 +86,17 @@ pm_finalize(JSContext* cx, JSObject* obj
#define GETTER(name) \
static JSBool \
pm_get_##name(JSContext* cx, JSObject* obj, jsid /*unused*/, jsval* vp) \
{ \
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)
GETTER(instructions)
GETTER(cache_references)
GETTER(cache_misses)
GETTER(branch_instructions)
GETTER(branch_misses)
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -145,37 +145,37 @@ static PRUintn gStackBaseThreadIndex;
#else
static uintptr_t gStackBase;
#endif
/*
* 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;
static bool enableTypeInference = false;
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);
static void
KillWatchdog();
static bool
-ScheduleWatchdog(JSRuntime *rt, jsdouble t);
+ScheduleWatchdog(JSRuntime *rt, double t);
static void
CancelExecution(JSRuntime *rt);
/*
* Watchdog thread state.
*/
#ifdef JS_THREADSAFE
@@ -678,17 +678,17 @@ Version(JSContext *cx, uintN argc, jsval
/* Get version. */
*vp = INT_TO_JSVAL(JS_GetVersion(cx));
} else {
/* Set version. */
int32_t v = -1;
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);
}
if (v < 0 || v > JSVERSION_LATEST) {
JS_ReportErrorNumber(cx, my_GetErrorMessage, NULL, JSSMSG_INVALID_ARGS, "version");
return false;
}
*vp = INT_TO_JSVAL(JS_SetVersion(cx, JSVersion(v)));
@@ -1108,17 +1108,17 @@ PutStr(JSContext *cx, uintN argc, jsval
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return JS_TRUE;
}
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;
}
static JSBool
PrintInternal(JSContext *cx, uintN argc, jsval *vp, FILE *file)
{
jsval *argv;
@@ -1608,17 +1608,17 @@ CountHeap(JSContext *cx, uintN argc, jsv
JS_TraceChildren(&countTracer.base, node->thing, node->kind);
}
while ((node = countTracer.recycleList) != NULL) {
countTracer.recycleList = node->next;
js_free(node);
}
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;
static void
finalize_counter_finalize(JSContext *cx, JSObject *obj)
{
JS_ATOMIC_INCREMENT(&finalizeCount);
@@ -2654,31 +2654,31 @@ EscapeWideString(jschar *w)
#include <stdarg.h>
static JSBool
ZZ_formatter(JSContext *cx, const char *format, JSBool fromJS, jsval **vpp,
va_list *app)
{
jsval *vp;
va_list ap;
- jsdouble re, im;
+ double re, im;
printf("entering ZZ_formatter");
vp = *vpp;
ap = *app;
if (fromJS) {
if (!JS_ValueToNumber(cx, vp[0], &re))
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]))
return JS_FALSE;
}
*vpp = vp + 2;
*app = ap;
printf("leaving ZZ_formatter");
@@ -2687,17 +2687,17 @@ ZZ_formatter(JSContext *cx, const char *
static JSBool
ConvertArgs(JSContext *cx, uintN argc, jsval *vp)
{
JSBool b = JS_FALSE;
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;
JSFunction *fun = NULL;
jsval v = JSVAL_VOID;
JSBool ok;
if (!JS_AddArgumentFormatter(cx, "ZZ", ZZ_formatter))
@@ -3313,17 +3313,17 @@ IsBefore(PRIntervalTime t1, PRIntervalTi
static JSBool
Sleep_fn(JSContext *cx, uintN argc, jsval *vp)
{
PRIntervalTime t_ticks;
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;
/* NB: The next condition also filter out NaNs. */
if (!(t_secs <= MAX_TIMEOUT_INTERVAL)) {
JS_ReportError(cx, "Excessive sleep interval");
return JS_FALSE;
@@ -3421,17 +3421,17 @@ WatchdogMain(void *arg)
PR_WaitCondVar(gWatchdogWakeup, sleepDuration);
JS_ASSERT(status == PR_SUCCESS);
}
}
PR_Unlock(gWatchdogLock);
}
static bool
-ScheduleWatchdog(JSRuntime *rt, jsdouble t)
+ScheduleWatchdog(JSRuntime *rt, double t)
{
if (t <= 0) {
PR_Lock(gWatchdogLock);
gWatchdogHasTimeout = false;
PR_Unlock(gWatchdogLock);
return true;
}
@@ -3490,17 +3490,17 @@ InitWatchdog(JSRuntime *rt)
static void
KillWatchdog()
{
ScheduleWatchdog(gRuntime, -1);
}
static bool
-ScheduleWatchdog(JSRuntime *rt, jsdouble t)
+ScheduleWatchdog(JSRuntime *rt, double t)
{
#ifdef XP_WIN
if (gTimerHandle) {
DeleteTimerQueueTimer(NULL, gTimerHandle, NULL);
gTimerHandle = 0;
}
if (t > 0 &&
!CreateTimerQueueTimer(&gTimerHandle,
@@ -3547,17 +3547,17 @@ CancelExecution(JSRuntime *rt)
ssize_t dummy = write(2, msg, sizeof(msg) - 1);
(void)dummy;
#else
fputs(msg, stderr);
#endif
}
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)) {
JS_ReportError(cx, "Excessive timeout value");
return JS_FALSE;
}
gTimeoutInterval = t;
if (!ScheduleWatchdog(cx->runtime, t)) {
@@ -3573,17 +3573,17 @@ Timeout(JSContext *cx, uintN argc, jsval
if (argc == 0)
return JS_NewNumberValue(cx, gTimeoutInterval, vp);
if (argc > 1) {
JS_ReportError(cx, "Wrong number of arguments");
return JS_FALSE;
}
- jsdouble t;
+ double t;
if (!JS_ValueToNumber(cx, JS_ARGV(cx, vp)[0], &t))
return JS_FALSE;
*vp = JSVAL_VOID;
return SetTimeoutValue(cx, t);
}
static JSBool
@@ -3907,17 +3907,17 @@ MJitCodeStats(JSContext *cx, uintN argc,
JSBool
MJitChunkLimit(JSContext *cx, uintN argc, jsval *vp)
{
if (argc > 1 || argc == 0) {
JS_ReportError(cx, "Wrong number of arguments");
return JS_FALSE;
}
- jsdouble t;
+ double t;
if (!JS_ValueToNumber(cx, JS_ARGV(cx, vp)[0], &t))
return JS_FALSE;
#ifdef JS_METHODJIT
mjit::SetChunkLimit((uint32_t) t);
#endif
// Clear out analysis information which might refer to code compiled with
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1962,17 +1962,17 @@ DebuggerScript_getStartLine(JSContext *c
}
static JSBool
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;
}
static JSBool
DebuggerScript_getChildScripts(JSContext *cx, uintN argc, Value *vp)
{
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "getChildScripts", args, obj, script);
Debugger *dbg = Debugger::fromChildJSObject(obj);
@@ -2238,17 +2238,17 @@ DebuggerScript_getLineOffsets(JSContext
{
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "getLineOffsets", args, obj, script);
REQUIRE_ARGC("Debugger.Script.getLineOffsets", 1);
/* Parse lineno argument. */
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);
}
if (!ok) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_DEBUG_BAD_LINE);
return false;
}
--- a/js/src/vm/NumberObject-inl.h
+++ b/js/src/vm/NumberObject-inl.h
@@ -48,28 +48,28 @@ JSObject::asNumber()
{
JS_ASSERT(isNumber());
return *static_cast<js::NumberObject *>(this);
}
namespace js {
inline NumberObject *
-NumberObject::create(JSContext *cx, jsdouble d)
+NumberObject::create(JSContext *cx, double d)
{
JSObject *obj = NewBuiltinClassInstance(cx, &NumberClass);
if (!obj)
return NULL;
NumberObject &numobj = obj->asNumber();
numobj.setPrimitiveValue(d);
return &numobj;
}
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));
if (!obj)
return NULL;
NumberObject &numobj = obj->asNumber();
numobj.setPrimitiveValue(d);
return &numobj;
--- a/js/src/vm/NumberObject.h
+++ b/js/src/vm/NumberObject.h
@@ -54,30 +54,30 @@ class NumberObject : public JSObject
public:
static const uintN RESERVED_SLOTS = 1;
/*
* 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));
}
/* For access to init, as Number.prototype is special. */
friend JSObject *
::js_InitNumberClass(JSContext *cx, JSObject *global);
private:
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -1423,17 +1423,17 @@ nsXPCComponents_Results::NewResolve(nsIX
const char* rv_name;
void* iter = nsnull;
nsresult rv;
while (nsXPCException::IterateNSResults(&rv, &rv_name, nsnull, &iter)) {
if (!strcmp(name.ptr(), rv_name)) {
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 |
JSPROP_READONLY |
JSPROP_PERMANENT)) {
return NS_ERROR_UNEXPECTED;
}
}
@@ -4160,17 +4160,17 @@ nsXPCComponents::GetProperty(nsIXPConnec
doResult = true;
} else if (id == rt->GetStringID(XPCJSRuntime::IDX_RETURN_CODE)) {
res = xpcc->GetPendingResult();
doResult = true;
}
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;
}
return rv;
}
/* bool setProperty (in nsIXPConnectWrappedNative wrapper, in JSContextPtr cx, in JSObjectPtr obj, in jsid id, in JSValPtr vp); */
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -139,21 +139,21 @@ XPCConvert::NativeData2JS(XPCLazyCallCon
if (pErr)
*pErr = NS_ERROR_XPC_BAD_CONVERT_NATIVE;
switch (type.TagPart()) {
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 :
{
bool b = *((bool*)s);
NS_WARN_IF_FALSE(b == 1 || b == 0,
"Passing a malformed bool through XPConnect");
@@ -405,17 +405,17 @@ XPCConvert::JSData2Native(XPCCallContext
nsresult* pErr)
{
NS_PRECONDITION(d, "bad param");
JSContext* cx = ccx.GetJSContext();
int32_t ti;
uint32_t tu;
- jsdouble td;
+ double td;
JSBool tb;
JSBool isDOMString = true;
if (pErr)
*pErr = NS_ERROR_XPC_BAD_CONVERT_JS;
switch (type.TagPart()) {
case nsXPTType::T_I8 :
--- a/js/xpconnect/src/XPCQuickStubs.h
+++ b/js/xpconnect/src/XPCQuickStubs.h
@@ -230,23 +230,23 @@ xpc_qsThrowBadSetterValue(JSContext *cx,
JSBool
xpc_qsGetterOnlyPropertyStub(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp);
/* Functions for converting values between COM and JS. */
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);
}
/* Classes for converting jsvals to string types. */
template <class S, class T>
class xpc_qsBasicString
{
@@ -662,17 +662,17 @@ xpc_qsValueToInt64(JSContext *cx,
PRInt64 *result)
{
if (JSVAL_IS_INT(v)) {
int32_t intval;
if (!JS_ValueToECMAInt32(cx, v, &intval))
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);
}
return true;
}
/**
@@ -684,17 +684,17 @@ xpc_qsValueToUint64(JSContext *cx,
PRUint64 *result)
{
if (JSVAL_IS_INT(v)) {
uint32_t intval;
if (!JS_ValueToECMAUint32(cx, v, &intval))
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);
}
return true;
}
#ifdef DEBUG
--- a/js/xpconnect/src/codegen.py
+++ b/js/xpconnect/src/codegen.py
@@ -132,23 +132,23 @@ argumentUnboxingTemplates = {
" return JS_FALSE;\n",
'unsigned long long':
" PRUint64 ${name};\n"
" if (!xpc_qsValueToUint64(cx, ${argVal}, &${name}))\n"
" 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",
'boolean':
" bool ${name};\n"
" JS_ValueToBoolean(cx, ${argVal}, &${name});\n",
'[astring]':
--- a/js/xpconnect/src/dombindings.cpp
+++ b/js/xpconnect/src/dombindings.cpp
@@ -598,17 +598,17 @@ getExpandoObject(JSObject *obj)
}
static int32_t
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) ||
!::JS_DoubleIsInt32(array_index, &i)) {
return -1;
}
return i;
--- a/js/xpconnect/src/qsgen.py
+++ b/js/xpconnect/src/qsgen.py
@@ -461,23 +461,23 @@ argumentUnboxingTemplates = {
" return JS_FALSE;\n",
'unsigned long long':
" PRUint64 ${name};\n"
" if (!xpc_qsValueToUint64(cx, ${argVal}, &${name}))\n"
" 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",
'boolean':
" JSBool ${name};\n"
" JS_ValueToBoolean(cx, ${argVal}, &${name});\n",
'[astring]':
--- a/toolkit/components/places/Helpers.cpp
+++ b/toolkit/components/places/Helpers.cpp
@@ -464,28 +464,28 @@ livemarkInfoToJSVal(PRInt64 aId,
NS_ENSURE_SUCCESS(rv, JSVAL_NULL);
JSContext *cx = nsnull;
rv = ncc->GetJSContext(&cx);
NS_ENSURE_SUCCESS(rv, JSVAL_NULL);
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
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());
NS_ENSURE_TRUE(guid, JSVAL_NULL);
JSString* title = JS_NewUCStringCopyN(cx, PromiseFlatString(aTitle).get(),
aTitle.Length());
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),
NS_ISUPPORTS_CAST(nsIURI*, aFeedURI), &feedURI);
NS_ENSURE_SUCCESS(rv, JSVAL_NULL);
jsval siteURI;
rv = nsContentUtils::WrapNative(cx, JS_GetGlobalForScopeChain(cx),
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -287,17 +287,17 @@ GetIntFromJSObject(JSContext* aCtx,
JSBool rc = JS_GetProperty(aCtx, aObject, aProperty, &value);
NS_ENSURE_TRUE(rc, NS_ERROR_UNEXPECTED);
if (JSVAL_IS_VOID(value)) {
return NS_ERROR_INVALID_ARG;
}
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);
*_int = IntType(num);
return NS_OK;
}