Backing out changeset 043ea4ef249c to try to fix failed mochitests on Windows and Linux

This commit is contained in:
Robert O'Callahan 2008-08-26 01:06:15 +12:00
parent 2b4f50f46f
commit 5c0b889677
5 changed files with 90 additions and 82 deletions

View File

@ -1,4 +1,3 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**************************************************************** /****************************************************************
* *
* The author of this software is David M. Gay. * The author of this software is David M. Gay.
@ -142,6 +141,11 @@
* floating-point numbers and flushes underflows to zero rather * floating-point numbers and flushes underflows to zero rather
* than implementing gradual underflow, then you must also #define * than implementing gradual underflow, then you must also #define
* Sudden_Underflow. * Sudden_Underflow.
* #define YES_ALIAS to permit aliasing certain double values with
* arrays of ULongs. This leads to slightly better code with
* some compilers and was always used prior to 19990916, but it
* is not strictly legal and can cause trouble with aggressively
* optimizing compilers (e.g., gcc 2.95.1 under -O2).
* #define USE_LOCALE to use the current locale's decimal_point value. * #define USE_LOCALE to use the current locale's decimal_point value.
* #define SET_INEXACT if IEEE arithmetic is being used and extra * #define SET_INEXACT if IEEE arithmetic is being used and extra
* computation should be done to set the inexact flag when the * computation should be done to set the inexact flag when the
@ -273,13 +277,24 @@ Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
typedef union { double d; ULong L[2]; } U; typedef union { double d; ULong L[2]; } U;
#define dval(x) ((x).d) #ifdef YES_ALIAS
#define dval(x) x
#ifdef IEEE_8087 #ifdef IEEE_8087
#define word0(x) ((x).L[1]) #define word0(x) ((ULong *)&x)[1]
#define word1(x) ((x).L[0]) #define word1(x) ((ULong *)&x)[0]
#else #else
#define word0(x) ((x).L[0]) #define word0(x) ((ULong *)&x)[0]
#define word1(x) ((x).L[1]) #define word1(x) ((ULong *)&x)[1]
#endif
#else
#ifdef IEEE_8087
#define word0(x) ((U*)&x)->L[1]
#define word1(x) ((U*)&x)->L[0]
#else
#define word0(x) ((U*)&x)->L[0]
#define word1(x) ((U*)&x)->L[1]
#endif
#define dval(x) ((U*)&x)->d
#endif #endif
/* The following definition of Storeinc is appropriate for MIPS processors. /* The following definition of Storeinc is appropriate for MIPS processors.
@ -1088,13 +1103,13 @@ diff
static double static double
ulp ulp
#ifdef KR_headers #ifdef KR_headers
(x) U x; (x) double x;
#else #else
(U x) (double x)
#endif #endif
{ {
register Long L; register Long L;
U a; double a;
L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1;
#ifndef Avoid_Underflow #ifndef Avoid_Underflow
@ -1137,7 +1152,7 @@ b2d
{ {
ULong *xa, *xa0, w, y, z; ULong *xa, *xa0, w, y, z;
int k; int k;
U d; double d;
#ifdef VAX #ifdef VAX
ULong d0, d1; ULong d0, d1;
#else #else
@ -1200,9 +1215,9 @@ b2d
static Bigint * static Bigint *
d2b d2b
#ifdef KR_headers #ifdef KR_headers
(d, e, bits) U d; int *e, *bits; (d, e, bits) double d; int *e, *bits;
#else #else
(U d, int *e, int *bits) (double d, int *e, int *bits)
#endif #endif
{ {
Bigint *b; Bigint *b;
@ -1343,7 +1358,7 @@ ratio
(Bigint *a, Bigint *b) (Bigint *a, Bigint *b)
#endif #endif
{ {
U da, db; double da, db;
int k, ka, kb; int k, ka, kb;
dval(da) = b2d(a, &ka); dval(da) = b2d(a, &ka);
@ -1448,9 +1463,9 @@ match
static void static void
hexnan hexnan
#ifdef KR_headers #ifdef KR_headers
(rvp, sp) U *rvp; CONST char **sp; (rvp, sp) double *rvp; CONST char **sp;
#else #else
(U *rvp, CONST char **sp) (double *rvp, CONST char **sp)
#endif #endif
{ {
ULong c, x[2]; ULong c, x[2];
@ -1530,8 +1545,7 @@ _strtod
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign,
e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
CONST char *s, *s0, *s1; CONST char *s, *s0, *s1;
double aadj, adj; double aadj, aadj1, adj, rv, rv0;
U aadj1, rv, rv0;
Long L; Long L;
ULong y, z; ULong y, z;
Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
@ -1546,7 +1560,7 @@ _strtod
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
delta = bb = bd = bs = 0; delta = bb = bd = bs = 0;
#endif #endif
sign = nz0 = nz = 0; sign = nz0 = nz = 0;
@ -1948,7 +1962,7 @@ _strtod
for(;;) { for(;;) {
bd = Balloc(bd0->k); bd = Balloc(bd0->k);
Bcopy(bd, bd0); Bcopy(bd, bd0);
bb = d2b(rv, &bbe, &bbbits); /* rv = bb * 2^bbe */ bb = d2b(dval(rv), &bbe, &bbbits); /* rv = bb * 2^bbe */
bs = i2b(1); bs = i2b(1);
if (e >= 0) { if (e >= 0) {
@ -2065,13 +2079,13 @@ _strtod
if ((word0(rv) & Exp_mask) <= if ((word0(rv) & Exp_mask) <=
P*Exp_msk1) { P*Exp_msk1) {
word0(rv) += P*Exp_msk1; word0(rv) += P*Exp_msk1;
dval(rv) += adj*ulp(rv); dval(rv) += adj*ulp(dval(rv));
word0(rv) -= P*Exp_msk1; word0(rv) -= P*Exp_msk1;
} }
else else
#endif /*Sudden_Underflow*/ #endif /*Sudden_Underflow*/
#endif /*Avoid_Underflow*/ #endif /*Avoid_Underflow*/
dval(rv) += adj*ulp(rv); dval(rv) += adj*ulp(dval(rv));
} }
break; break;
} }
@ -2094,7 +2108,7 @@ _strtod
#ifdef Sudden_Underflow #ifdef Sudden_Underflow
if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { if ((word0(rv) & Exp_mask) <= P*Exp_msk1) {
word0(rv) += P*Exp_msk1; word0(rv) += P*Exp_msk1;
adj *= ulp(rv); adj *= ulp(dval(rv));
if (dsign) if (dsign)
dval(rv) += adj; dval(rv) += adj;
else else
@ -2104,7 +2118,7 @@ _strtod
} }
#endif /*Sudden_Underflow*/ #endif /*Sudden_Underflow*/
#endif /*Avoid_Underflow*/ #endif /*Avoid_Underflow*/
adj *= ulp(rv); adj *= ulp(dval(rv));
if (dsign) if (dsign)
dval(rv) += adj; dval(rv) += adj;
else else
@ -2213,10 +2227,10 @@ _strtod
break; break;
#endif #endif
if (dsign) if (dsign)
dval(rv) += ulp(rv); dval(rv) += ulp(dval(rv));
#ifndef ROUND_BIASED #ifndef ROUND_BIASED
else { else {
dval(rv) -= ulp(rv); dval(rv) -= ulp(dval(rv));
#ifndef Sudden_Underflow #ifndef Sudden_Underflow
if (!dval(rv)) if (!dval(rv))
goto undfl; goto undfl;
@ -2230,14 +2244,14 @@ _strtod
} }
if ((aadj = ratio(delta, bs)) <= 2.) { if ((aadj = ratio(delta, bs)) <= 2.) {
if (dsign) if (dsign)
aadj = dval(aadj1) = 1.; aadj = aadj1 = 1.;
else if (word1(rv) || word0(rv) & Bndry_mask) { else if (word1(rv) || word0(rv) & Bndry_mask) {
#ifndef Sudden_Underflow #ifndef Sudden_Underflow
if (word1(rv) == Tiny1 && !word0(rv)) if (word1(rv) == Tiny1 && !word0(rv))
goto undfl; goto undfl;
#endif #endif
aadj = 1.; aadj = 1.;
dval(aadj1) = -1.; aadj1 = -1.;
} }
else { else {
/* special case -- power of FLT_RADIX to be */ /* special case -- power of FLT_RADIX to be */
@ -2247,24 +2261,24 @@ _strtod
aadj = 1./FLT_RADIX; aadj = 1./FLT_RADIX;
else else
aadj *= 0.5; aadj *= 0.5;
dval(aadj1) = -aadj; aadj1 = -aadj;
} }
} }
else { else {
aadj *= 0.5; aadj *= 0.5;
dval(aadj1) = dsign ? aadj : -aadj; aadj1 = dsign ? aadj : -aadj;
#ifdef Check_FLT_ROUNDS #ifdef Check_FLT_ROUNDS
switch(Rounding) { switch(Rounding) {
case 2: /* towards +infinity */ case 2: /* towards +infinity */
dval(aadj1) -= 0.5; aadj1 -= 0.5;
break; break;
case 0: /* towards 0 */ case 0: /* towards 0 */
case 3: /* towards -infinity */ case 3: /* towards -infinity */
dval(aadj1) += 0.5; aadj1 += 0.5;
} }
#else #else
if (Flt_Rounds == 0) if (Flt_Rounds == 0)
dval(aadj1) += 0.5; aadj1 += 0.5;
#endif /*Check_FLT_ROUNDS*/ #endif /*Check_FLT_ROUNDS*/
} }
y = word0(rv) & Exp_mask; y = word0(rv) & Exp_mask;
@ -2274,7 +2288,7 @@ _strtod
if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) {
dval(rv0) = dval(rv); dval(rv0) = dval(rv);
word0(rv) -= P*Exp_msk1; word0(rv) -= P*Exp_msk1;
adj = dval(aadj1) * ulp(rv); adj = aadj1 * ulp(dval(rv));
dval(rv) += adj; dval(rv) += adj;
if ((word0(rv) & Exp_mask) >= if ((word0(rv) & Exp_mask) >=
Exp_msk1*(DBL_MAX_EXP+Bias-P)) { Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
@ -2294,18 +2308,18 @@ _strtod
if ((z = (ULong) aadj) <= 0) if ((z = (ULong) aadj) <= 0)
z = 1; z = 1;
aadj = z; aadj = z;
dval(aadj1) = dsign ? aadj : -aadj; aadj1 = dsign ? aadj : -aadj;
} }
word0(aadj1) += (2*P+1)*Exp_msk1 - y; word0(aadj1) += (2*P+1)*Exp_msk1 - y;
} }
adj = dval(aadj1) * ulp(rv); adj = aadj1 * ulp(dval(rv));
dval(rv) += adj; dval(rv) += adj;
#else #else
#ifdef Sudden_Underflow #ifdef Sudden_Underflow
if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { if ((word0(rv) & Exp_mask) <= P*Exp_msk1) {
dval(rv0) = dval(rv); dval(rv0) = dval(rv);
word0(rv) += P*Exp_msk1; word0(rv) += P*Exp_msk1;
adj = dval(aadj1) * ulp(rv); adj = aadj1 * ulp(dval(rv));
dval(rv) += adj; dval(rv) += adj;
#ifdef IBM #ifdef IBM
if ((word0(rv) & Exp_mask) < P*Exp_msk1) if ((word0(rv) & Exp_mask) < P*Exp_msk1)
@ -2324,7 +2338,7 @@ _strtod
word0(rv) -= P*Exp_msk1; word0(rv) -= P*Exp_msk1;
} }
else { else {
adj = dval(aadj1) * ulp(rv); adj = aadj1 * ulp(dval(rv));
dval(rv) += adj; dval(rv) += adj;
} }
#else /*Sudden_Underflow*/ #else /*Sudden_Underflow*/
@ -2336,11 +2350,11 @@ _strtod
* example: 1.2e-307 . * example: 1.2e-307 .
*/ */
if (y <= (P-1)*Exp_msk1 && aadj > 1.) { if (y <= (P-1)*Exp_msk1 && aadj > 1.) {
dval(aadj1) = (double)(int)(aadj + 0.5); aadj1 = (double)(int)(aadj + 0.5);
if (!dsign) if (!dsign)
dval(aadj1) = -dval(aadj1); aadj1 = -aadj1;
} }
adj = dval(aadj1) * ulp(rv); adj = aadj1 * ulp(dval(rv));
dval(rv) += adj; dval(rv) += adj;
#endif /*Sudden_Underflow*/ #endif /*Sudden_Underflow*/
#endif /*Avoid_Underflow*/ #endif /*Avoid_Underflow*/
@ -2632,9 +2646,9 @@ freedtoa(char *s)
dtoa dtoa
#ifdef KR_headers #ifdef KR_headers
(d, mode, ndigits, decpt, sign, rve) (d, mode, ndigits, decpt, sign, rve)
U d; int mode, ndigits, *decpt, *sign; char **rve; double d; int mode, ndigits, *decpt, *sign; char **rve;
#else #else
(U d, int mode, int ndigits, int *decpt, int *sign, char **rve) (double d, int mode, int ndigits, int *decpt, int *sign, char **rve)
#endif #endif
{ {
/* Arguments ndigits, decpt, sign are similar to those /* Arguments ndigits, decpt, sign are similar to those
@ -2680,8 +2694,7 @@ dtoa
ULong x; ULong x;
#endif #endif
Bigint *b, *b1, *delta, *mlo, *mhi, *S; Bigint *b, *b1, *delta, *mlo, *mhi, *S;
U d2, eps; double d2, ds, eps;
double ds;
char *s, *s0; char *s, *s0;
#ifdef Honor_FLT_ROUNDS #ifdef Honor_FLT_ROUNDS
int rounding; int rounding;
@ -2691,8 +2704,8 @@ dtoa
#endif #endif
#ifdef __GNUC__ #ifdef __GNUC__
ilim = ilim1 = 0; ilim = ilim1 = 0;
mlo = NULL; mlo = NULL;
#endif #endif
#ifndef MULTIPLE_THREADS #ifndef MULTIPLE_THREADS
@ -2748,7 +2761,7 @@ dtoa
} }
#endif #endif
b = d2b(d, &be, &bbits); b = d2b(dval(d), &be, &bbits);
#ifdef Sudden_Underflow #ifdef Sudden_Underflow
i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
#else #else

View File

@ -1361,12 +1361,10 @@ JS_InitStandardClasses(JSContext *cx, JSObject *obj)
js_InitDateClass(cx, obj); js_InitDateClass(cx, obj);
} }
#define CLASP(name) (&js_##name##Class) #define CLASP(name) ((JSClass *)&js_##name##Class)
#define EXT_CLASP(name) (&js_##name##Class.base)
#define EAGER_ATOM(name) ATOM_OFFSET(name), NULL #define EAGER_ATOM(name) ATOM_OFFSET(name), NULL
#define EAGER_CLASS_ATOM(name) CLASS_ATOM_OFFSET(name), NULL #define EAGER_CLASS_ATOM(name) CLASS_ATOM_OFFSET(name), NULL
#define EAGER_ATOM_AND_CLASP(name) EAGER_CLASS_ATOM(name), CLASP(name) #define EAGER_ATOM_AND_CLASP(name) EAGER_CLASS_ATOM(name), CLASP(name)
#define EAGER_ATOM_AND_EXT_CLASP(name) EAGER_CLASS_ATOM(name), EXT_CLASP(name)
#define LAZY_ATOM(name) ATOM_OFFSET(lazy.name), js_##name##_str #define LAZY_ATOM(name) ATOM_OFFSET(lazy.name), js_##name##_str
typedef struct JSStdName { typedef struct JSStdName {
@ -1417,8 +1415,8 @@ static JSStdName standard_class_atoms[] = {
#endif #endif
#if JS_HAS_XML_SUPPORT #if JS_HAS_XML_SUPPORT
{js_InitXMLClass, EAGER_ATOM_AND_CLASP(XML)}, {js_InitXMLClass, EAGER_ATOM_AND_CLASP(XML)},
{js_InitNamespaceClass, EAGER_ATOM_AND_EXT_CLASP(Namespace)}, {js_InitNamespaceClass, EAGER_ATOM_AND_CLASP(Namespace)},
{js_InitQNameClass, EAGER_ATOM_AND_EXT_CLASP(QName)}, {js_InitQNameClass, EAGER_ATOM_AND_CLASP(QName)},
#endif #endif
#if JS_HAS_FILE_OBJECT #if JS_HAS_FILE_OBJECT
{js_InitFileClass, EAGER_ATOM_AND_CLASP(File)}, {js_InitFileClass, EAGER_ATOM_AND_CLASP(File)},

View File

@ -510,7 +510,9 @@ js_ContextIterator(JSRuntime *rt, JSBool unlocked, JSContext **iterp)
if (unlocked) if (unlocked)
JS_LOCK_GC(rt); JS_LOCK_GC(rt);
cx = (JSContext *) (cx ? cx->links.next : rt->contextList.next); if (!cx)
cx = (JSContext *)&rt->contextList;
cx = (JSContext *)cx->links.next;
if (&cx->links == &rt->contextList) if (&cx->links == &rt->contextList)
cx = NULL; cx = NULL;
*iterp = cx; *iterp = cx;

View File

@ -86,7 +86,7 @@ FindTrap(JSRuntime *rt, JSScript *script, jsbytecode *pc)
JSTrap *trap; JSTrap *trap;
for (trap = (JSTrap *)rt->trapList.next; for (trap = (JSTrap *)rt->trapList.next;
&trap->links != &rt->trapList; trap != (JSTrap *)&rt->trapList;
trap = (JSTrap *)trap->links.next) { trap = (JSTrap *)trap->links.next) {
if (trap->script == script && trap->pc == pc) if (trap->script == script && trap->pc == pc)
return trap; return trap;
@ -105,8 +105,7 @@ js_UntrapScriptCode(JSContext *cx, JSScript *script)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (trap = (JSTrap *)rt->trapList.next; for (trap = (JSTrap *)rt->trapList.next;
&trap->links != trap != (JSTrap *)&rt->trapList;
&rt->trapList;
trap = (JSTrap *)trap->links.next) { trap = (JSTrap *)trap->links.next) {
if (trap->script == script && if (trap->script == script &&
(size_t)(trap->pc - script->code) < script->length) { (size_t)(trap->pc - script->code) < script->length) {
@ -241,7 +240,7 @@ JS_ClearScriptTraps(JSContext *cx, JSScript *script)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (trap = (JSTrap *)rt->trapList.next; for (trap = (JSTrap *)rt->trapList.next;
&trap->links != &rt->trapList; trap != (JSTrap *)&rt->trapList;
trap = next) { trap = next) {
next = (JSTrap *)trap->links.next; next = (JSTrap *)trap->links.next;
if (trap->script == script) { if (trap->script == script) {
@ -265,7 +264,7 @@ JS_ClearAllTraps(JSContext *cx)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (trap = (JSTrap *)rt->trapList.next; for (trap = (JSTrap *)rt->trapList.next;
&trap->links != &rt->trapList; trap != (JSTrap *)&rt->trapList;
trap = next) { trap = next) {
next = (JSTrap *)trap->links.next; next = (JSTrap *)trap->links.next;
sample = rt->debuggerMutations; sample = rt->debuggerMutations;
@ -431,7 +430,7 @@ js_TraceWatchPoints(JSTracer *trc, JSObject *obj)
rt = trc->context->runtime; rt = trc->context->runtime;
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) { wp = (JSWatchPoint *)wp->links.next) {
if (wp->object == obj) { if (wp->object == obj) {
TRACE_SCOPE_PROPERTY(trc, wp->sprop); TRACE_SCOPE_PROPERTY(trc, wp->sprop);
@ -455,7 +454,7 @@ js_SweepWatchPoints(JSContext *cx)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = next) { wp = next) {
next = (JSWatchPoint *)wp->links.next; next = (JSWatchPoint *)wp->links.next;
if (js_IsAboutToBeFinalized(cx, wp->object)) { if (js_IsAboutToBeFinalized(cx, wp->object)) {
@ -482,7 +481,7 @@ FindWatchPoint(JSRuntime *rt, JSScope *scope, jsid id)
JSWatchPoint *wp; JSWatchPoint *wp;
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) { wp = (JSWatchPoint *)wp->links.next) {
if (wp->object == scope->object && wp->sprop->id == id) if (wp->object == scope->object && wp->sprop->id == id)
return wp; return wp;
@ -518,7 +517,7 @@ js_GetWatchedSetter(JSRuntime *rt, JSScope *scope,
if (scope) if (scope)
DBG_LOCK(rt); DBG_LOCK(rt);
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) { wp = (JSWatchPoint *)wp->links.next) {
if ((!scope || wp->object == scope->object) && wp->sprop == sprop) { if ((!scope || wp->object == scope->object) && wp->sprop == sprop) {
setter = wp->setter; setter = wp->setter;
@ -543,7 +542,7 @@ js_watch_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) { wp = (JSWatchPoint *)wp->links.next) {
sprop = wp->sprop; sprop = wp->sprop;
if (wp->object == obj && SPROP_USERID(sprop) == id && if (wp->object == obj && SPROP_USERID(sprop) == id &&
@ -861,7 +860,7 @@ JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id,
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = (JSWatchPoint *)wp->links.next) { wp = (JSWatchPoint *)wp->links.next) {
if (wp->object == obj && SPROP_USERID(wp->sprop) == id) { if (wp->object == obj && SPROP_USERID(wp->sprop) == id) {
if (handlerp) if (handlerp)
@ -889,7 +888,7 @@ JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = next) { wp = next) {
next = (JSWatchPoint *)wp->links.next; next = (JSWatchPoint *)wp->links.next;
if (wp->object == obj) { if (wp->object == obj) {
@ -915,7 +914,7 @@ JS_ClearAllWatchPoints(JSContext *cx)
rt = cx->runtime; rt = cx->runtime;
DBG_LOCK(rt); DBG_LOCK(rt);
for (wp = (JSWatchPoint *)rt->watchPointList.next; for (wp = (JSWatchPoint *)rt->watchPointList.next;
&wp->links != &rt->watchPointList; wp != (JSWatchPoint *)&rt->watchPointList;
wp = next) { wp = next) {
next = (JSWatchPoint *)wp->links.next; next = (JSWatchPoint *)wp->links.next;
sample = rt->debuggerMutations; sample = rt->debuggerMutations;

View File

@ -139,9 +139,8 @@ JS_strtod(const char *s00, char **se, int *err)
} }
JS_FRIEND_API(char *) JS_FRIEND_API(char *)
JS_dtostr(char *buffer, size_t bufferSize, JSDToStrMode mode, int precision, double dinput) JS_dtostr(char *buffer, size_t bufferSize, JSDToStrMode mode, int precision, double d)
{ {
U d;
int decPt; /* Offset of decimal point from first digit */ int decPt; /* Offset of decimal point from first digit */
int sign; /* Nonzero if the sign bit was set in d */ int sign; /* Nonzero if the sign bit was set in d */
int nDigits; /* Number of significand digits returned by js_dtoa */ int nDigits; /* Number of significand digits returned by js_dtoa */
@ -156,11 +155,10 @@ JS_dtostr(char *buffer, size_t bufferSize, JSDToStrMode mode, int precision, dou
* Change mode here rather than below because the buffer may not be large * Change mode here rather than below because the buffer may not be large
* enough to hold a large integer. * enough to hold a large integer.
*/ */
if (mode == DTOSTR_FIXED && (dinput >= 1e21 || dinput <= -1e21)) if (mode == DTOSTR_FIXED && (d >= 1e21 || d <= -1e21))
mode = DTOSTR_STANDARD; mode = DTOSTR_STANDARD;
LOCK_DTOA(); LOCK_DTOA();
dval(d) = dinput;
numBegin = dtoa(d, dtoaModes[mode], precision, &decPt, &sign, &numEnd); numBegin = dtoa(d, dtoaModes[mode], precision, &decPt, &sign, &numEnd);
if (!numBegin) { if (!numBegin) {
UNLOCK_DTOA(); UNLOCK_DTOA();
@ -354,30 +352,28 @@ static uint32 quorem2(Bigint *b, int32 k)
#define BASEDIGIT(digit) ((char)(((digit) >= 10) ? 'a' - 10 + (digit) : '0' + (digit))) #define BASEDIGIT(digit) ((char)(((digit) >= 10) ? 'a' - 10 + (digit) : '0' + (digit)))
JS_FRIEND_API(char *) JS_FRIEND_API(char *)
JS_dtobasestr(int base, double dinput) JS_dtobasestr(int base, double d)
{ {
U d;
char *buffer; /* The output string */ char *buffer; /* The output string */
char *p; /* Pointer to current position in the buffer */ char *p; /* Pointer to current position in the buffer */
char *pInt; /* Pointer to the beginning of the integer part of the string */ char *pInt; /* Pointer to the beginning of the integer part of the string */
char *q; char *q;
uint32 digit; uint32 digit;
U di; /* d truncated to an integer */ double di; /* d truncated to an integer */
U df; /* The fractional part of d */ double df; /* The fractional part of d */
JS_ASSERT(base >= 2 && base <= 36); JS_ASSERT(base >= 2 && base <= 36);
dval(d) = dinput;
buffer = (char*) malloc(DTOBASESTR_BUFFER_SIZE); buffer = (char*) malloc(DTOBASESTR_BUFFER_SIZE);
if (buffer) { if (buffer) {
p = buffer; p = buffer;
if (dval(d) < 0.0 if (d < 0.0
#if defined(XP_WIN) || defined(XP_OS2) #if defined(XP_WIN) || defined(XP_OS2)
&& !((word0(d) & Exp_mask) == Exp_mask && ((word0(d) & Frac_mask) || word1(d))) /* Visual C++ doesn't know how to compare against NaN */ && !((word0(d) & Exp_mask) == Exp_mask && ((word0(d) & Frac_mask) || word1(d))) /* Visual C++ doesn't know how to compare against NaN */
#endif #endif
) { ) {
*p++ = '-'; *p++ = '-';
dval(d) = -dval(d); d = -d;
} }
/* Check for Infinity and NaN */ /* Check for Infinity and NaN */
@ -389,9 +385,9 @@ JS_dtobasestr(int base, double dinput)
LOCK_DTOA(); LOCK_DTOA();
/* Output the integer part of d with the digits in reverse order. */ /* Output the integer part of d with the digits in reverse order. */
pInt = p; pInt = p;
dval(di) = fd_floor(dval(d)); di = fd_floor(d);
if (dval(di) <= 4294967295.0) { if (di <= 4294967295.0) {
uint32 n = (uint32)dval(di); uint32 n = (uint32)di;
if (n) if (n)
do { do {
uint32 m = n / base; uint32 m = n / base;
@ -430,8 +426,8 @@ JS_dtobasestr(int base, double dinput)
*q-- = ch; *q-- = ch;
} }
dval(df) = dval(d) - dval(di); df = d - di;
if (dval(df) != 0.0) { if (df != 0.0) {
/* We have a fraction. */ /* We have a fraction. */
int e, bbits; int e, bbits;
int32 s2, done; int32 s2, done;