Bug 384244 - Updating dtoa from David M. Gay's latest code, and refactoring to

accept patches from this upstream source more easily. r=mrbkap, r=igor
This commit is contained in:
Brian Crowder 2008-07-24 12:43:41 -07:00
Родитель 2355faa1e9
Коммит 9088022ac6
5 изменённых файлов: 3459 добавлений и 2733 удалений

3332
js/src/dtoa.c Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -741,6 +741,8 @@ JS_NewRuntime(uint32 maxbytes)
JS_INIT_CLIST(&rt->trapList); JS_INIT_CLIST(&rt->trapList);
JS_INIT_CLIST(&rt->watchPointList); JS_INIT_CLIST(&rt->watchPointList);
if (!js_InitDtoa())
goto bad;
if (!js_InitGC(rt, maxbytes)) if (!js_InitGC(rt, maxbytes))
goto bad; goto bad;
if (!js_InitAtomState(rt)) if (!js_InitAtomState(rt))

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -123,7 +123,8 @@ JS_dtobasestr(int base, double d);
* Clean up any persistent RAM allocated during the execution of DtoA * Clean up any persistent RAM allocated during the execution of DtoA
* routines, and remove any locks that might have been created. * routines, and remove any locks that might have been created.
*/ */
extern void js_FinishDtoa(void); JS_FRIEND_API(JSBool) js_InitDtoa(void);
JS_FRIEND_API(void) js_FinishDtoa(void);
JS_END_EXTERN_C JS_END_EXTERN_C

Просмотреть файл

@ -1015,18 +1015,10 @@ js_strtod(JSContext *cx, const jschar *s, const jschar *send,
} else { } else {
int err; int err;
d = JS_strtod(cstr, &estr, &err); d = JS_strtod(cstr, &estr, &err);
if (err == JS_DTOA_ENOMEM) { if (d == HUGE_VAL)
JS_ReportOutOfMemory(cx); d = *cx->runtime->jsPositiveInfinity;
if (cstr != cbuf) else if (d == -HUGE_VAL)
JS_free(cx, cstr); d = *cx->runtime->jsNegativeInfinity;
return JS_FALSE;
}
if (err == JS_DTOA_ERANGE) {
if (d == HUGE_VAL)
d = *cx->runtime->jsPositiveInfinity;
else if (d == -HUGE_VAL)
d = *cx->runtime->jsNegativeInfinity;
}
#ifdef HPUX #ifdef HPUX
if (d == 0.0 && negative) { if (d == 0.0 && negative) {
/* /*