This commit is contained in:
brendan%mozilla.org 2004-12-09 01:32:19 +00:00
Родитель 158f44366a
Коммит e5f2626c46
28 изменённых файлов: 1010 добавлений и 1010 удалений

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

@ -78,11 +78,11 @@ JS_InitArenaPool(JSArenaPool *pool, const char *name, size_t size, size_t align)
}
#endif
if (align == 0)
align = JS_ARENA_DEFAULT_ALIGN;
align = JS_ARENA_DEFAULT_ALIGN;
pool->mask = JS_BITMASK(JS_CeilingLog2(align));
pool->first.next = NULL;
pool->first.base = pool->first.avail = pool->first.limit =
JS_ARENA_ALIGN(pool, &pool->first + 1);
JS_ARENA_ALIGN(pool, &pool->first + 1);
pool->current = &pool->first;
pool->arenasize = size;
#ifdef JS_ARENAMETER
@ -312,34 +312,34 @@ FreeArenaList(JSArenaPool *pool, JSArena *head, JSBool reallyFree)
ap = &head->next;
a = *ap;
if (!a)
return;
return;
#ifdef DEBUG
do {
JS_ASSERT(a->base <= a->avail && a->avail <= a->limit);
a->avail = a->base;
JS_CLEAR_UNUSED(a);
JS_ASSERT(a->base <= a->avail && a->avail <= a->limit);
a->avail = a->base;
JS_CLEAR_UNUSED(a);
} while ((a = a->next) != NULL);
a = *ap;
#endif
if (reallyFree) {
do {
*ap = a->next;
JS_CLEAR_ARENA(a);
JS_COUNT_ARENA(pool,--);
free(a);
} while ((a = *ap) != NULL);
do {
*ap = a->next;
JS_CLEAR_ARENA(a);
JS_COUNT_ARENA(pool,--);
free(a);
} while ((a = *ap) != NULL);
} else {
/* Insert the whole arena chain at the front of the freelist. */
do {
ap = &(*ap)->next;
} while (*ap);
/* Insert the whole arena chain at the front of the freelist. */
do {
ap = &(*ap)->next;
} while (*ap);
JS_ACQUIRE_LOCK(arena_freelist_lock);
*ap = arena_freelist;
arena_freelist = a;
*ap = arena_freelist;
arena_freelist = a;
JS_RELEASE_LOCK(arena_freelist_lock);
head->next = NULL;
head->next = NULL;
}
pool->current = head;
@ -351,14 +351,14 @@ JS_ArenaRelease(JSArenaPool *pool, char *mark)
JSArena *a;
for (a = &pool->first; a; a = a->next) {
JS_ASSERT(a->base <= a->avail && a->avail <= a->limit);
JS_ASSERT(a->base <= a->avail && a->avail <= a->limit);
if (JS_UPTRDIFF(mark, a->base) <= JS_UPTRDIFF(a->avail, a->base)) {
a->avail = JS_ARENA_ALIGN(pool, mark);
if (JS_UPTRDIFF(mark, a->base) <= JS_UPTRDIFF(a->avail, a->base)) {
a->avail = JS_ARENA_ALIGN(pool, mark);
JS_ASSERT(a->avail <= a->limit);
FreeArenaList(pool, a, JS_TRUE);
return;
}
FreeArenaList(pool, a, JS_TRUE);
return;
}
}
}
@ -439,17 +439,17 @@ JS_FinishArenaPool(JSArenaPool *pool)
FreeArenaList(pool, &pool->first, JS_TRUE);
#ifdef JS_ARENAMETER
{
JSArenaStats *stats, **statsp;
JSArenaStats *stats, **statsp;
if (pool->stats.name)
free(pool->stats.name);
for (statsp = &arena_stats_list; (stats = *statsp) != 0;
statsp = &stats->next) {
if (stats == &pool->stats) {
*statsp = stats->next;
return;
}
}
if (pool->stats.name)
free(pool->stats.name);
for (statsp = &arena_stats_list; (stats = *statsp) != 0;
statsp = &stats->next) {
if (stats == &pool->stats) {
*statsp = stats->next;
return;
}
}
}
#endif
}
@ -543,9 +543,9 @@ JS_DumpArenaStats(FILE *fp)
else
variance /= nallocs * (nallocs - 1);
sigma = sqrt(variance);
} else {
mean = variance = sigma = 0;
}
} else {
mean = variance = sigma = 0;
}
fprintf(fp, "\n%s allocation statistics:\n", stats->name);
fprintf(fp, " number of arenas: %u\n", stats->narenas);

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

@ -67,23 +67,23 @@ JSClass js_BooleanClass = {
static JSBool
bool_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
jsval *rval)
{
jsval v;
char buf[32];
JSString *str;
if (!JS_InstanceOf(cx, obj, &js_BooleanClass, argv))
return JS_FALSE;
return JS_FALSE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_BOOLEAN(v))
return js_obj_toSource(cx, obj, argc, argv, rval);
return js_obj_toSource(cx, obj, argc, argv, rval);
JS_snprintf(buf, sizeof buf, "(new %s(%s))",
js_BooleanClass.name,
js_boolean_str[JSVAL_TO_BOOLEAN(v) ? 1 : 0]);
js_BooleanClass.name,
js_boolean_str[JSVAL_TO_BOOLEAN(v) ? 1 : 0]);
str = JS_NewStringCopyZ(cx, buf);
if (!str)
return JS_FALSE;
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
@ -91,21 +91,21 @@ bool_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
static JSBool
bool_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
jsval *rval)
{
jsval v;
JSAtom *atom;
JSString *str;
if (!JS_InstanceOf(cx, obj, &js_BooleanClass, argv))
return JS_FALSE;
return JS_FALSE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
if (!JSVAL_IS_BOOLEAN(v))
return js_obj_toString(cx, obj, argc, argv, rval);
return js_obj_toString(cx, obj, argc, argv, rval);
atom = cx->runtime->atomState.booleanAtoms[JSVAL_TO_BOOLEAN(v) ? 1 : 0];
str = ATOM_TO_STRING(atom);
if (!str)
return JS_FALSE;
return JS_FALSE;
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
@ -114,7 +114,7 @@ static JSBool
bool_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
if (!JS_InstanceOf(cx, obj, &js_BooleanClass, argv))
return JS_FALSE;
return JS_FALSE;
*rval = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
return JS_TRUE;
}
@ -123,8 +123,8 @@ static JSFunctionSpec boolean_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, bool_toSource, 0,0,0},
#endif
{js_toString_str, bool_toString, 0,0,0},
{js_valueOf_str, bool_valueOf, 0,0,0},
{js_toString_str, bool_toString, 0,0,0},
{js_valueOf_str, bool_valueOf, 0,0,0},
{0,0,0,0,0}
};
@ -140,15 +140,15 @@ Boolean(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
jsval bval;
if (argc != 0) {
if (!js_ValueToBoolean(cx, argv[0], &b))
return JS_FALSE;
bval = BOOLEAN_TO_JSVAL(b);
if (!js_ValueToBoolean(cx, argv[0], &b))
return JS_FALSE;
bval = BOOLEAN_TO_JSVAL(b);
} else {
bval = JSVAL_FALSE;
bval = JSVAL_FALSE;
}
if (!(cx->fp->flags & JSFRAME_CONSTRUCTING)) {
*rval = bval;
return JS_TRUE;
*rval = bval;
return JS_TRUE;
}
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, bval);
return JS_TRUE;
@ -160,9 +160,9 @@ js_InitBooleanClass(JSContext *cx, JSObject *obj)
JSObject *proto;
proto = JS_InitClass(cx, obj, NULL, &js_BooleanClass, Boolean, 1,
NULL, boolean_methods, NULL, NULL);
NULL, boolean_methods, NULL, NULL);
if (!proto)
return NULL;
return NULL;
OBJ_SET_SLOT(cx, proto, JSSLOT_PRIVATE, JSVAL_FALSE);
return proto;
}
@ -174,7 +174,7 @@ js_BooleanToObject(JSContext *cx, JSBool b)
obj = js_NewObject(cx, &js_BooleanClass, NULL, NULL);
if (!obj)
return NULL;
return NULL;
OBJ_SET_SLOT(cx, obj, JSSLOT_PRIVATE, BOOLEAN_TO_JSVAL(b));
return obj;
}
@ -192,27 +192,27 @@ js_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp)
jsdouble d;
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v)) {
b = JS_FALSE;
b = JS_FALSE;
} else if (JSVAL_IS_OBJECT(v)) {
if (!JSVERSION_IS_ECMA(cx->version)) {
if (!OBJ_DEFAULT_VALUE(cx, JSVAL_TO_OBJECT(v), JSTYPE_BOOLEAN, &v))
return JS_FALSE;
if (!JSVAL_IS_BOOLEAN(v))
v = JSVAL_TRUE; /* non-null object is true */
b = JSVAL_TO_BOOLEAN(v);
} else {
b = JS_TRUE;
}
if (!JSVERSION_IS_ECMA(cx->version)) {
if (!OBJ_DEFAULT_VALUE(cx, JSVAL_TO_OBJECT(v), JSTYPE_BOOLEAN, &v))
return JS_FALSE;
if (!JSVAL_IS_BOOLEAN(v))
v = JSVAL_TRUE; /* non-null object is true */
b = JSVAL_TO_BOOLEAN(v);
} else {
b = JS_TRUE;
}
} else if (JSVAL_IS_STRING(v)) {
b = JSSTRING_LENGTH(JSVAL_TO_STRING(v)) ? JS_TRUE : JS_FALSE;
b = JSSTRING_LENGTH(JSVAL_TO_STRING(v)) ? JS_TRUE : JS_FALSE;
} else if (JSVAL_IS_INT(v)) {
b = JSVAL_TO_INT(v) ? JS_TRUE : JS_FALSE;
b = JSVAL_TO_INT(v) ? JS_TRUE : JS_FALSE;
} else if (JSVAL_IS_DOUBLE(v)) {
d = *JSVAL_TO_DOUBLE(v);
b = (!JSDOUBLE_IS_NaN(d) && d != 0) ? JS_TRUE : JS_FALSE;
d = *JSVAL_TO_DOUBLE(v);
b = (!JSDOUBLE_IS_NaN(d) && d != 0) ? JS_TRUE : JS_FALSE;
} else {
JS_ASSERT(JSVAL_IS_BOOLEAN(v));
b = JSVAL_TO_BOOLEAN(v);
b = JSVAL_TO_BOOLEAN(v);
}
*bp = b;

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

@ -52,35 +52,35 @@ typedef struct JSCListStr {
/*
** Insert element "_e" into the list, before "_l".
*/
#define JS_INSERT_BEFORE(_e,_l) \
JS_BEGIN_MACRO \
(_e)->next = (_l); \
(_e)->prev = (_l)->prev; \
(_l)->prev->next = (_e); \
(_l)->prev = (_e); \
#define JS_INSERT_BEFORE(_e,_l) \
JS_BEGIN_MACRO \
(_e)->next = (_l); \
(_e)->prev = (_l)->prev; \
(_l)->prev->next = (_e); \
(_l)->prev = (_e); \
JS_END_MACRO
/*
** Insert element "_e" into the list, after "_l".
*/
#define JS_INSERT_AFTER(_e,_l) \
JS_BEGIN_MACRO \
(_e)->next = (_l)->next; \
(_e)->prev = (_l); \
(_l)->next->prev = (_e); \
(_l)->next = (_e); \
#define JS_INSERT_AFTER(_e,_l) \
JS_BEGIN_MACRO \
(_e)->next = (_l)->next; \
(_e)->prev = (_l); \
(_l)->next->prev = (_e); \
(_l)->next = (_e); \
JS_END_MACRO
/*
** Return the element following element "_e"
*/
#define JS_NEXT_LINK(_e) \
((_e)->next)
#define JS_NEXT_LINK(_e) \
((_e)->next)
/*
** Return the element preceding element "_e"
*/
#define JS_PREV_LINK(_e) \
((_e)->prev)
#define JS_PREV_LINK(_e) \
((_e)->prev)
/*
** Append an element "_e" to the end of the list "_l"
@ -99,10 +99,10 @@ typedef struct JSCListStr {
/*
** Remove the element "_e" from it's circular list.
*/
#define JS_REMOVE_LINK(_e) \
JS_BEGIN_MACRO \
(_e)->prev->next = (_e)->next; \
(_e)->next->prev = (_e)->prev; \
#define JS_REMOVE_LINK(_e) \
JS_BEGIN_MACRO \
(_e)->prev->next = (_e)->next; \
(_e)->next->prev = (_e)->prev; \
JS_END_MACRO
/*
@ -110,11 +110,11 @@ typedef struct JSCListStr {
** linkage.
*/
#define JS_REMOVE_AND_INIT_LINK(_e) \
JS_BEGIN_MACRO \
(_e)->prev->next = (_e)->next; \
(_e)->next->prev = (_e)->prev; \
(_e)->next = (_e); \
(_e)->prev = (_e); \
JS_BEGIN_MACRO \
(_e)->prev->next = (_e)->next; \
(_e)->next->prev = (_e)->prev; \
(_e)->next = (_e); \
(_e)->prev = (_e); \
JS_END_MACRO
/*
@ -128,9 +128,9 @@ typedef struct JSCListStr {
** Initialize a circular list
*/
#define JS_INIT_CLIST(_l) \
JS_BEGIN_MACRO \
(_l)->next = (_l); \
(_l)->prev = (_l); \
JS_BEGIN_MACRO \
(_l)->next = (_l); \
(_l)->prev = (_l); \
JS_END_MACRO
#define JS_INIT_STATIC_CLIST(_l) \

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

@ -58,23 +58,23 @@
/* Generate cpucfg.h */
#ifdef XP_MAC
#include <Types.h>
#define INT64 UnsignedWide
#define INT64 UnsignedWide
#else
#if defined(XP_WIN) || defined(XP_OS2)
#ifdef WIN32
#if defined(__GNUC__)
#define INT64 long long
#else
#define INT64 _int64
#define INT64 _int64
#endif /* __GNUC__ */
#else
#define INT64 long
#define INT64 long
#endif
#else
#if defined(HPUX) || defined(__QNX__) || defined(_SCO_DS) || defined(UNIXWARE)
#define INT64 long
#define INT64 long
#else
#define INT64 long long
#define INT64 long long
#endif
#endif
#endif
@ -102,7 +102,7 @@ struct align_int64 {
struct align_fakelonglong {
char c;
struct {
long hi, lo;
long hi, lo;
} a;
};
struct align_float {
@ -132,17 +132,17 @@ static int Log2(unsigned int n)
int log2 = 0;
if (n & (n-1))
log2++;
log2++;
if (n >> 16)
log2 += 16, n >>= 16;
log2 += 16, n >>= 16;
if (n >> 8)
log2 += 8, n >>= 8;
log2 += 8, n >>= 8;
if (n >> 4)
log2 += 4, n >>= 4;
log2 += 4, n >>= 4;
if (n >> 2)
log2 += 2, n >>= 2;
log2 += 2, n >>= 2;
if (n >> 1)
log2++;
log2++;
return log2;
}
@ -190,26 +190,26 @@ int main(int argc, char **argv)
#error "Endianess not defined."
#endif
sizeof_char = PR_BYTES_PER_BYTE;
sizeof_short = PR_BYTES_PER_SHORT;
sizeof_int = PR_BYTES_PER_INT;
sizeof_int64 = PR_BYTES_PER_INT64;
sizeof_long = PR_BYTES_PER_LONG;
sizeof_float = PR_BYTES_PER_FLOAT;
sizeof_double = PR_BYTES_PER_DOUBLE;
sizeof_word = PR_BYTES_PER_WORD;
sizeof_dword = PR_BYTES_PER_DWORD;
sizeof_char = PR_BYTES_PER_BYTE;
sizeof_short = PR_BYTES_PER_SHORT;
sizeof_int = PR_BYTES_PER_INT;
sizeof_int64 = PR_BYTES_PER_INT64;
sizeof_long = PR_BYTES_PER_LONG;
sizeof_float = PR_BYTES_PER_FLOAT;
sizeof_double = PR_BYTES_PER_DOUBLE;
sizeof_word = PR_BYTES_PER_WORD;
sizeof_dword = PR_BYTES_PER_DWORD;
bits_per_int64_log2 = PR_BITS_PER_INT64_LOG2;
align_of_short = PR_ALIGN_OF_SHORT;
align_of_int = PR_ALIGN_OF_INT;
align_of_long = PR_ALIGN_OF_LONG;
align_of_int64 = PR_ALIGN_OF_INT64;
align_of_float = PR_ALIGN_OF_FLOAT;
align_of_double = PR_ALIGN_OF_DOUBLE;
align_of_pointer = PR_ALIGN_OF_POINTER;
align_of_word = PR_ALIGN_OF_WORD;
align_of_short = PR_ALIGN_OF_SHORT;
align_of_int = PR_ALIGN_OF_INT;
align_of_long = PR_ALIGN_OF_LONG;
align_of_int64 = PR_ALIGN_OF_INT64;
align_of_float = PR_ALIGN_OF_FLOAT;
align_of_double = PR_ALIGN_OF_DOUBLE;
align_of_pointer = PR_ALIGN_OF_POINTER;
align_of_word = PR_ALIGN_OF_WORD;
#else /* !CROSS_COMPILE */
@ -293,31 +293,31 @@ int main(int argc, char **argv)
}
}
sizeof_char = sizeof(char);
sizeof_short = sizeof(short);
sizeof_int = sizeof(int);
sizeof_int64 = 8;
sizeof_long = sizeof(long);
sizeof_float = sizeof(float);
sizeof_double = sizeof(double);
sizeof_word = sizeof(prword);
sizeof_dword = 8;
sizeof_char = sizeof(char);
sizeof_short = sizeof(short);
sizeof_int = sizeof(int);
sizeof_int64 = 8;
sizeof_long = sizeof(long);
sizeof_float = sizeof(float);
sizeof_double = sizeof(double);
sizeof_word = sizeof(prword);
sizeof_dword = 8;
bits_per_int64_log2 = 6;
align_of_short = ALIGN_OF(short);
align_of_int = ALIGN_OF(int);
align_of_long = ALIGN_OF(long);
align_of_short = ALIGN_OF(short);
align_of_int = ALIGN_OF(int);
align_of_long = ALIGN_OF(long);
if (sizeof(INT64) < 8) {
/* this machine doesn't actually support int64's */
align_of_int64 = ALIGN_OF(fakelonglong);
/* this machine doesn't actually support int64's */
align_of_int64 = ALIGN_OF(fakelonglong);
} else {
align_of_int64 = ALIGN_OF(int64);
align_of_int64 = ALIGN_OF(int64);
}
align_of_float = ALIGN_OF(float);
align_of_double = ALIGN_OF(double);
align_of_pointer = ALIGN_OF(pointer);
align_of_word = ALIGN_OF(prword);
align_of_float = ALIGN_OF(float);
align_of_double = ALIGN_OF(double);
align_of_pointer = ALIGN_OF(pointer);
align_of_word = ALIGN_OF(prword);
#endif /* CROSS_COMPILE */

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

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

@ -65,7 +65,7 @@ js_NewDateObjectMsec(JSContext* cx, jsdouble msec_time);
*/
extern JS_FRIEND_API(JSObject*)
js_NewDateObject(JSContext* cx, int year, int mon, int mday,
int hour, int min, int sec);
int hour, int min, int sec);
/*
* Detect whether the internal date value is NaN. (Because failure is

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

@ -53,14 +53,14 @@ js_PatchOpcode(JSContext *cx, JSScript *script, jsbytecode *pc, JSOp op);
extern JS_PUBLIC_API(JSBool)
JS_SetTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapHandler handler, void *closure);
JSTrapHandler handler, void *closure);
extern JS_PUBLIC_API(JSOp)
JS_GetTrapOpcode(JSContext *cx, JSScript *script, jsbytecode *pc);
extern JS_PUBLIC_API(void)
JS_ClearTrap(JSContext *cx, JSScript *script, jsbytecode *pc,
JSTrapHandler *handlerp, void **closurep);
JSTrapHandler *handlerp, void **closurep);
extern JS_PUBLIC_API(void)
JS_ClearScriptTraps(JSContext *cx, JSScript *script);
@ -81,11 +81,11 @@ JS_ClearInterrupt(JSRuntime *rt, JSTrapHandler *handlerp, void **closurep);
extern JS_PUBLIC_API(JSBool)
JS_SetWatchPoint(JSContext *cx, JSObject *obj, jsval id,
JSWatchPointHandler handler, void *closure);
JSWatchPointHandler handler, void *closure);
extern JS_PUBLIC_API(JSBool)
JS_ClearWatchPoint(JSContext *cx, JSObject *obj, jsval id,
JSWatchPointHandler *handlerp, void **closurep);
JSWatchPointHandler *handlerp, void **closurep);
extern JS_PUBLIC_API(JSBool)
JS_ClearWatchPointsForObject(JSContext *cx, JSObject *obj);
@ -250,7 +250,7 @@ JS_SetNewScriptHook(JSRuntime *rt, JSNewScriptHook hook, void *callerdata);
extern JS_PUBLIC_API(void)
JS_SetDestroyScriptHook(JSRuntime *rt, JSDestroyScriptHook hook,
void *callerdata);
void *callerdata);
/************************************************************************/
@ -262,9 +262,9 @@ JS_EvaluateUCInStackFrame(JSContext *cx, JSStackFrame *fp,
extern JS_PUBLIC_API(JSBool)
JS_EvaluateInStackFrame(JSContext *cx, JSStackFrame *fp,
const char *bytes, uintN length,
const char *filename, uintN lineno,
jsval *rval);
const char *bytes, uintN length,
const char *filename, uintN lineno,
jsval *rval);
/************************************************************************/
@ -298,7 +298,7 @@ JS_PropertyIterator(JSObject *obj, JSScopeProperty **iteratorp);
extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDesc(JSContext *cx, JSObject *obj, JSScopeProperty *sprop,
JSPropertyDesc *pd);
JSPropertyDesc *pd);
extern JS_PUBLIC_API(JSBool)
JS_GetPropertyDescArray(JSContext *cx, JSObject *obj, JSPropertyDescArray *pda);

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

@ -1248,7 +1248,7 @@ JS_strtod(CONST char *s00, char **se, int *err)
*err = 0;
bb = bd = bs = delta = NULL;
bb = bd = bs = delta = NULL;
sign = nz0 = nz = 0;
rv = 0.;

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

@ -118,7 +118,7 @@
#define STDOUTPUT_NAME "Standard output stream"
#define STDERROR_NAME "Standard error stream"
#define RESOLVE_PATH js_canonicalPath /* js_absolutePath */
#define RESOLVE_PATH js_canonicalPath /* js_absolutePath */
/* Error handling */
typedef enum JSFileErrNum {
@ -150,8 +150,8 @@ JSFile_GetErrorMessage(void *userRef, const char *locale,
{
if ((errorNumber > 0) && (errorNumber < JSFileErr_Limit))
return &JSFile_ErrorFormatString[errorNumber];
else
return NULL;
else
return NULL;
}
#define JSFILE_CHECK_NATIVE(op) \

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

@ -48,7 +48,7 @@
JS_BEGIN_EXTERN_C
struct JSFunction {
jsrefcount nrefs; /* number of referencing objects */
jsrefcount nrefs; /* number of referencing objects */
JSObject *object; /* back-pointer to GC'ed object header */
union {
JSNative native; /* native method pointer or null */
@ -99,7 +99,7 @@ js_InitCallClass(JSContext *cx, JSObject *obj);
extern JSFunction *
js_NewFunction(JSContext *cx, JSObject *funobj, JSNative native, uintN nargs,
uintN flags, JSObject *parent, JSAtom *atom);
uintN flags, JSObject *parent, JSAtom *atom);
extern JSObject *
js_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent);
@ -109,7 +109,7 @@ js_LinkFunctionObject(JSContext *cx, JSFunction *fun, JSObject *object);
extern JSFunction *
js_DefineFunction(JSContext *cx, JSObject *obj, JSAtom *atom, JSNative native,
uintN nargs, uintN flags);
uintN nargs, uintN flags);
/*
* Flags for js_ValueToFunction and js_ReportIsNotFunction. We depend on the

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

@ -114,7 +114,7 @@ JS_NewHashTable(uint32 n, JSHashFunction keyHash,
ht = (JSHashTable*) allocOps->allocTable(allocPriv, sizeof *ht);
if (!ht)
return NULL;
return NULL;
memset(ht, 0, sizeof *ht);
ht->shift = JS_HASH_BITS - n;
n = JS_BIT(n);
@ -211,7 +211,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep,
if (!ht->buckets) {
ht->buckets = oldbuckets;
return NULL;
}
}
memset(ht->buckets, 0, nb);
#ifdef HASHMETER
ht->ngrows++;
@ -237,7 +237,7 @@ JS_HashTableRawAdd(JSHashTable *ht, JSHashEntry **hep,
/* Make a new key value entry */
he = ht->allocOps->allocEntry(ht->allocPriv, key);
if (!he)
return NULL;
return NULL;
he->keyHash = keyHash;
he->key = key;
he->value = value;

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

@ -1131,7 +1131,7 @@ js_TransferScopeLock(JSContext *cx, JSScope *oldscope, JSScope *newscope)
* state update.
*/
if (!oldscope)
return;
return;
JS_ASSERT(JS_IS_SCOPE_LOCKED(cx, oldscope));
/*
@ -1141,7 +1141,7 @@ js_TransferScopeLock(JSContext *cx, JSScope *oldscope, JSScope *newscope)
* was actually locked.
*/
if (CX_THREAD_IS_RUNNING_GC(cx))
return;
return;
/*
* Special case in js_LockObj and js_UnlockScope for locking the sealed

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

@ -47,17 +47,17 @@ JS_PUBLIC_API(JSIntn) JS_CeilingLog2(JSUint32 n)
JSIntn log2 = 0;
if (n & (n-1))
log2++;
log2++;
if (n >> 16)
log2 += 16, n >>= 16;
log2 += 16, n >>= 16;
if (n >> 8)
log2 += 8, n >>= 8;
log2 += 8, n >>= 8;
if (n >> 4)
log2 += 4, n >>= 4;
log2 += 4, n >>= 4;
if (n >> 2)
log2 += 2, n >>= 2;
log2 += 2, n >>= 2;
if (n >> 1)
log2++;
log2++;
return log2;
}
@ -70,14 +70,14 @@ JS_PUBLIC_API(JSIntn) JS_FloorLog2(JSUint32 n)
JSIntn log2 = 0;
if (n >> 16)
log2 += 16, n >>= 16;
log2 += 16, n >>= 16;
if (n >> 8)
log2 += 8, n >>= 8;
log2 += 8, n >>= 8;
if (n >> 4)
log2 += 4, n >>= 4;
log2 += 4, n >>= 4;
if (n >> 2)
log2 += 2, n >>= 2;
log2 += 2, n >>= 2;
if (n >> 1)
log2++;
log2++;
return log2;
}

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

@ -74,10 +74,10 @@ static void norm_udivmod32(JSUint32 *qp, JSUint32 *rp, JSUint64 a, JSUint32 b)
r1 = (r1 << 16) | jshi16(a.lo);
if (r1 < m) {
q1--, r1 += b;
if (r1 >= b /* i.e., we didn't get a carry when adding to r1 */
&& r1 < m) {
q1--, r1 += b;
}
if (r1 >= b /* i.e., we didn't get a carry when adding to r1 */
&& r1 < m) {
q1--, r1 += b;
}
}
r1 -= m;
r0 = r1 % d1;
@ -87,9 +87,9 @@ static void norm_udivmod32(JSUint32 *qp, JSUint32 *rp, JSUint64 a, JSUint32 b)
if (r0 < m) {
q0--, r0 += b;
if (r0 >= b
&& r0 < m) {
q0--, r0 += b;
}
&& r0 < m) {
q0--, r0 += b;
}
}
*qp = (q1 << 16) | q0;
*rp = r0 - m;
@ -101,17 +101,17 @@ static JSUint32 CountLeadingZeros(JSUint32 a)
JSUint32 r = 32;
if ((t = a >> 16) != 0)
r -= 16, a = t;
r -= 16, a = t;
if ((t = a >> 8) != 0)
r -= 8, a = t;
r -= 8, a = t;
if ((t = a >> 4) != 0)
r -= 4, a = t;
r -= 4, a = t;
if ((t = a >> 2) != 0)
r -= 2, a = t;
r -= 2, a = t;
if ((t = a >> 1) != 0)
r -= 1, a = t;
r -= 1, a = t;
if (a & 1)
r--;
r--;
return r;
}
@ -125,157 +125,157 @@ JS_PUBLIC_API(void) jsll_udivmod(JSUint64 *qp, JSUint64 *rp, JSUint64 a, JSUint6
n1 = a.hi;
if (b.hi == 0) {
if (b.lo > n1) {
/* (0 q0) = (n1 n0) / (0 D0) */
if (b.lo > n1) {
/* (0 q0) = (n1 n0) / (0 D0) */
lsh = CountLeadingZeros(b.lo);
lsh = CountLeadingZeros(b.lo);
if (lsh) {
/*
* Normalize, i.e. make the most significant bit of the
* denominator be set.
*/
b.lo = b.lo << lsh;
n1 = (n1 << lsh) | (n0 >> (32 - lsh));
n0 = n0 << lsh;
}
if (lsh) {
/*
* Normalize, i.e. make the most significant bit of the
* denominator be set.
*/
b.lo = b.lo << lsh;
n1 = (n1 << lsh) | (n0 >> (32 - lsh));
n0 = n0 << lsh;
}
a.lo = n0, a.hi = n1;
norm_udivmod32(&q0, &n0, a, b.lo);
q1 = 0;
a.lo = n0, a.hi = n1;
norm_udivmod32(&q0, &n0, a, b.lo);
q1 = 0;
/* remainder is in n0 >> lsh */
} else {
/* (q1 q0) = (n1 n0) / (0 d0) */
/* remainder is in n0 >> lsh */
} else {
/* (q1 q0) = (n1 n0) / (0 d0) */
if (b.lo == 0) /* user wants to divide by zero! */
b.lo = 1 / b.lo; /* so go ahead and crash */
if (b.lo == 0) /* user wants to divide by zero! */
b.lo = 1 / b.lo; /* so go ahead and crash */
lsh = CountLeadingZeros(b.lo);
lsh = CountLeadingZeros(b.lo);
if (lsh == 0) {
/*
* From (n1 >= b.lo)
* && (the most significant bit of b.lo is set),
* conclude that
* (the most significant bit of n1 is set)
* && (the leading quotient digit q1 = 1).
*
* This special case is necessary, not an optimization
* (Shifts counts of 32 are undefined).
*/
n1 -= b.lo;
q1 = 1;
} else {
/*
* Normalize.
*/
rsh = 32 - lsh;
if (lsh == 0) {
/*
* From (n1 >= b.lo)
* && (the most significant bit of b.lo is set),
* conclude that
* (the most significant bit of n1 is set)
* && (the leading quotient digit q1 = 1).
*
* This special case is necessary, not an optimization
* (Shifts counts of 32 are undefined).
*/
n1 -= b.lo;
q1 = 1;
} else {
/*
* Normalize.
*/
rsh = 32 - lsh;
b.lo = b.lo << lsh;
n2 = n1 >> rsh;
n1 = (n1 << lsh) | (n0 >> rsh);
n0 = n0 << lsh;
b.lo = b.lo << lsh;
n2 = n1 >> rsh;
n1 = (n1 << lsh) | (n0 >> rsh);
n0 = n0 << lsh;
a.lo = n1, a.hi = n2;
norm_udivmod32(&q1, &n1, a, b.lo);
}
a.lo = n1, a.hi = n2;
norm_udivmod32(&q1, &n1, a, b.lo);
}
/* n1 != b.lo... */
/* n1 != b.lo... */
a.lo = n0, a.hi = n1;
norm_udivmod32(&q0, &n0, a, b.lo);
a.lo = n0, a.hi = n1;
norm_udivmod32(&q0, &n0, a, b.lo);
/* remainder in n0 >> lsh */
}
/* remainder in n0 >> lsh */
}
if (rp) {
rp->lo = n0 >> lsh;
rp->hi = 0;
}
if (rp) {
rp->lo = n0 >> lsh;
rp->hi = 0;
}
} else {
if (b.hi > n1) {
/* (0 0) = (n1 n0) / (D1 d0) */
if (b.hi > n1) {
/* (0 0) = (n1 n0) / (D1 d0) */
q0 = 0;
q1 = 0;
q0 = 0;
q1 = 0;
/* remainder in (n1 n0) */
if (rp) {
rp->lo = n0;
rp->hi = n1;
}
} else {
/* (0 q0) = (n1 n0) / (d1 d0) */
/* remainder in (n1 n0) */
if (rp) {
rp->lo = n0;
rp->hi = n1;
}
} else {
/* (0 q0) = (n1 n0) / (d1 d0) */
lsh = CountLeadingZeros(b.hi);
if (lsh == 0) {
/*
* From (n1 >= b.hi)
* && (the most significant bit of b.hi is set),
* conclude that
* (the most significant bit of n1 is set)
* && (the quotient digit q0 = 0 or 1).
*
* This special case is necessary, not an optimization.
*/
lsh = CountLeadingZeros(b.hi);
if (lsh == 0) {
/*
* From (n1 >= b.hi)
* && (the most significant bit of b.hi is set),
* conclude that
* (the most significant bit of n1 is set)
* && (the quotient digit q0 = 0 or 1).
*
* This special case is necessary, not an optimization.
*/
/*
* The condition on the next line takes advantage of that
* n1 >= b.hi (true due to control flow).
*/
if (n1 > b.hi || n0 >= b.lo) {
q0 = 1;
a.lo = n0, a.hi = n1;
JSLL_SUB(a, a, b);
} else {
q0 = 0;
}
q1 = 0;
/*
* The condition on the next line takes advantage of that
* n1 >= b.hi (true due to control flow).
*/
if (n1 > b.hi || n0 >= b.lo) {
q0 = 1;
a.lo = n0, a.hi = n1;
JSLL_SUB(a, a, b);
} else {
q0 = 0;
}
q1 = 0;
if (rp) {
rp->lo = n0;
rp->hi = n1;
}
} else {
JSInt64 m;
if (rp) {
rp->lo = n0;
rp->hi = n1;
}
} else {
JSInt64 m;
/*
* Normalize.
*/
rsh = 32 - lsh;
/*
* Normalize.
*/
rsh = 32 - lsh;
b.hi = (b.hi << lsh) | (b.lo >> rsh);
b.lo = b.lo << lsh;
n2 = n1 >> rsh;
n1 = (n1 << lsh) | (n0 >> rsh);
n0 = n0 << lsh;
b.hi = (b.hi << lsh) | (b.lo >> rsh);
b.lo = b.lo << lsh;
n2 = n1 >> rsh;
n1 = (n1 << lsh) | (n0 >> rsh);
n0 = n0 << lsh;
a.lo = n1, a.hi = n2;
norm_udivmod32(&q0, &n1, a, b.hi);
JSLL_MUL32(m, q0, b.lo);
a.lo = n1, a.hi = n2;
norm_udivmod32(&q0, &n1, a, b.hi);
JSLL_MUL32(m, q0, b.lo);
if ((m.hi > n1) || ((m.hi == n1) && (m.lo > n0))) {
q0--;
JSLL_SUB(m, m, b);
}
if ((m.hi > n1) || ((m.hi == n1) && (m.lo > n0))) {
q0--;
JSLL_SUB(m, m, b);
}
q1 = 0;
q1 = 0;
/* Remainder is ((n1 n0) - (m1 m0)) >> lsh */
if (rp) {
a.lo = n0, a.hi = n1;
JSLL_SUB(a, a, m);
rp->lo = (a.hi << rsh) | (a.lo >> lsh);
rp->hi = a.hi >> lsh;
}
}
}
/* Remainder is ((n1 n0) - (m1 m0)) >> lsh */
if (rp) {
a.lo = n0, a.hi = n1;
JSLL_SUB(a, a, m);
rp->lo = (a.hi << rsh) | (a.lo >> lsh);
rp->hi = a.hi >> lsh;
}
}
}
}
if (qp) {
qp->lo = q0;
qp->hi = q1;
qp->lo = q0;
qp->hi = q1;
}
}
#endif /* !JS_HAVE_LONG_LONG */

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

@ -56,28 +56,28 @@
#include "jsobj.h"
#ifndef M_E
#define M_E 2.7182818284590452354
#define M_E 2.7182818284590452354
#endif
#ifndef M_LOG2E
#define M_LOG2E 1.4426950408889634074
#define M_LOG2E 1.4426950408889634074
#endif
#ifndef M_LOG10E
#define M_LOG10E 0.43429448190325182765
#define M_LOG10E 0.43429448190325182765
#endif
#ifndef M_LN2
#define M_LN2 0.69314718055994530942
#define M_LN2 0.69314718055994530942
#endif
#ifndef M_LN10
#define M_LN10 2.30258509299404568402
#define M_LN10 2.30258509299404568402
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#define M_PI 3.14159265358979323846
#endif
#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#define M_SQRT2 1.41421356237309504880
#endif
#ifndef M_SQRT1_2
#define M_SQRT1_2 0.70710678118654752440
#define M_SQRT1_2 0.70710678118654752440
#endif
static JSConstDoubleSpec math_constants[] = {
@ -158,9 +158,9 @@ math_atan2(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
jsdouble x, y, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
return JS_FALSE;
if (!js_ValueToNumber(cx, argv[1], &y))
return JS_FALSE;
return JS_FALSE;
z = fd_atan2(x, y);
return js_NewNumberValue(cx, z, rval);
}
@ -288,7 +288,7 @@ math_pow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
jsdouble x, y, z;
if (!js_ValueToNumber(cx, argv[0], &x))
return JS_FALSE;
return JS_FALSE;
if (!js_ValueToNumber(cx, argv[1], &y))
return JS_FALSE;
z = fd_pow(x, y);
@ -316,7 +316,7 @@ random_init(JSRuntime *rt)
/* Do at most once. */
if (rt->rngInitialized)
return;
return;
rt->rngInitialized = JS_TRUE;
/* rt->rngMultiplier = 0x5DEECE66DL */
@ -429,7 +429,7 @@ math_tan(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
#if JS_HAS_TOSOURCE
static JSBool
math_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval)
jsval *rval)
{
*rval = ATOM_KEY(cx->runtime->atomState.MathAtom);
return JS_TRUE;
@ -438,26 +438,26 @@ math_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
static JSFunctionSpec math_static_methods[] = {
#if JS_HAS_TOSOURCE
{js_toSource_str, math_toSource, 0, 0, 0},
{js_toSource_str, math_toSource, 0, 0, 0},
#endif
{"abs", math_abs, 1, 0, 0},
{"acos", math_acos, 1, 0, 0},
{"asin", math_asin, 1, 0, 0},
{"atan", math_atan, 1, 0, 0},
{"atan2", math_atan2, 2, 0, 0},
{"ceil", math_ceil, 1, 0, 0},
{"cos", math_cos, 1, 0, 0},
{"exp", math_exp, 1, 0, 0},
{"floor", math_floor, 1, 0, 0},
{"log", math_log, 1, 0, 0},
{"max", math_max, 2, 0, 0},
{"min", math_min, 2, 0, 0},
{"pow", math_pow, 2, 0, 0},
{"random", math_random, 0, 0, 0},
{"round", math_round, 1, 0, 0},
{"sin", math_sin, 1, 0, 0},
{"sqrt", math_sqrt, 1, 0, 0},
{"tan", math_tan, 1, 0, 0},
{"abs", math_abs, 1, 0, 0},
{"acos", math_acos, 1, 0, 0},
{"asin", math_asin, 1, 0, 0},
{"atan", math_atan, 1, 0, 0},
{"atan2", math_atan2, 2, 0, 0},
{"ceil", math_ceil, 1, 0, 0},
{"cos", math_cos, 1, 0, 0},
{"exp", math_exp, 1, 0, 0},
{"floor", math_floor, 1, 0, 0},
{"log", math_log, 1, 0, 0},
{"max", math_max, 2, 0, 0},
{"min", math_min, 2, 0, 0},
{"pow", math_pow, 2, 0, 0},
{"random", math_random, 0, 0, 0},
{"round", math_round, 1, 0, 0},
{"sin", math_sin, 1, 0, 0},
{"sqrt", math_sqrt, 1, 0, 0},
{"tan", math_tan, 1, 0, 0},
{0,0,0,0,0}
};

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

@ -67,9 +67,9 @@ JS_BEGIN_EXTERN_C
typedef union jsdpun {
struct {
#if defined(IS_LITTLE_ENDIAN) && !defined(CPU_IS_ARM)
uint32 lo, hi;
uint32 lo, hi;
#else
uint32 hi, lo;
uint32 hi, lo;
#endif
} s;
jsdouble d;
@ -124,7 +124,7 @@ typedef union jsdpun {
((JSDOUBLE_HI32(x) & JSDOUBLE_HI32_EXPMASK) != JSDOUBLE_HI32_EXPMASK)
#define JSDOUBLE_IS_NEGZERO(d) (JSDOUBLE_HI32(d) == JSDOUBLE_HI32_SIGNBIT && \
JSDOUBLE_LO32(d) == 0)
JSDOUBLE_LO32(d) == 0)
/*
* JSDOUBLE_IS_INT first checks that d is neither NaN nor infinite, to avoid
@ -134,7 +134,7 @@ typedef union jsdpun {
*/
#define JSDOUBLE_IS_INT(d, i) (JSDOUBLE_IS_FINITE(d) \
&& !JSDOUBLE_IS_NEGZERO(d) \
&& ((d) == (i = (jsint)(d))))
&& ((d) == (i = (jsint)(d))))
#if defined(XP_WIN)
#define JSDOUBLE_COMPARE(LVAL, OP, RVAL, IFNAN) \

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

@ -243,18 +243,18 @@ struct JSSharpObjectMap {
extern JSHashEntry *
js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap,
jschar **sp);
jschar **sp);
extern void
js_LeaveSharpObject(JSContext *cx, JSIdArray **idap);
extern JSBool
js_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
jsval *rval);
extern JSBool
js_obj_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
jsval *rval);
extern JSBool
js_HasOwnPropertyHelper(JSContext *cx, JSObject *obj, JSLookupPropOp lookup,
@ -276,11 +276,11 @@ extern const char js_lookupSetter_str[];
extern void
js_InitObjectMap(JSObjectMap *map, jsrefcount nrefs, JSObjectOps *ops,
JSClass *clasp);
JSClass *clasp);
extern JSObjectMap *
js_NewObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops,
JSClass *clasp, JSObject *obj);
JSClass *clasp, JSObject *obj);
extern void
js_DestroyObjectMap(JSContext *cx, JSObjectMap *map);
@ -338,8 +338,8 @@ js_ChangeNativePropertyAttrs(JSContext *cx, JSObject *obj,
*/
extern JSBool
js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
JSProperty **propp);
JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
JSProperty **propp);
extern JSBool
js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
@ -355,7 +355,7 @@ js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
*/
extern JS_FRIEND_API(JSBool)
js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
JSProperty **propp);
JSProperty **propp);
/*
* Specialized subroutine that allows caller to preset JSRESOLVE_* flags.
@ -366,7 +366,7 @@ js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
extern JS_FRIEND_API(JSBool)
js_FindProperty(JSContext *cx, jsid id, JSObject **objp, JSObject **pobjp,
JSProperty **propp);
JSProperty **propp);
extern JSObject *
js_FindIdentifierBase(JSContext *cx, jsid id);
@ -382,11 +382,11 @@ js_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
extern JSBool
js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
uintN *attrsp);
uintN *attrsp);
extern JSBool
js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
uintN *attrsp);
uintN *attrsp);
extern JSBool
js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval);
@ -402,18 +402,18 @@ js_GrowIdArray(JSContext *cx, JSIdArray *ida, jsint length);
extern JSBool
js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
jsval *statep, jsid *idp);
jsval *statep, jsid *idp);
extern JSBool
js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
jsval *vp, uintN *attrsp);
jsval *vp, uintN *attrsp);
extern JSBool
js_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
extern JSBool
js_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
jsval *rval);
jsval *rval);
extern JSBool
js_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
@ -429,7 +429,7 @@ js_GetClassPrototype(JSContext *cx, const char *name, JSObject **protop);
extern JSBool
js_SetClassPrototype(JSContext *cx, JSObject *ctor, JSObject *proto,
uintN attrs);
uintN attrs);
extern JSBool
js_ValueToObject(JSContext *cx, jsval v, JSObject **objp);
@ -442,7 +442,7 @@ js_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval);
extern JSBool
js_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom,
uintN argc, jsval *argv, jsval *rval);
uintN argc, jsval *argv, jsval *rval);
extern JSBool
js_XDRObject(JSXDRState *xdr, JSObject **objp);

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

@ -357,7 +357,7 @@ Sprint(Sprinter *sp, const char *format, ...)
ptrdiff_t offset;
va_start(ap, format);
bp = JS_vsmprintf(format, ap); /* XXX vsaprintf */
bp = JS_vsmprintf(format, ap); /* XXX vsaprintf */
va_end(ap);
if (!bp) {
JS_ReportOutOfMemory(sp->context);
@ -546,7 +546,7 @@ js_printf(JSPrinter *jp, const char *format, ...)
}
/* Allocate temp space, convert format, and put. */
bp = JS_vsmprintf(format, ap); /* XXX vsaprintf */
bp = JS_vsmprintf(format, ap); /* XXX vsaprintf */
if (fp) {
JS_free(jp->sprinter.context, fp);
format = NULL;
@ -582,7 +582,7 @@ typedef struct SprintStack {
} SprintStack;
/* Gap between stacked strings to allow for insertion of parens and commas. */
#define PAREN_SLOP (2 + 1)
#define PAREN_SLOP (2 + 1)
/*
* These pseudo-ops help js_DecompileValueGenerator decompile JSOP_SETNAME,
@ -851,9 +851,9 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
/*
* Local macros
*/
#define DECOMPILE_CODE(pc,nb) if (!Decompile(ss, pc, nb)) return JS_FALSE
#define POP_STR() OFF2STR(&ss->sprinter, PopOff(ss, op))
#define LOCAL_ASSERT(expr) JS_ASSERT(expr); if (!(expr)) return JS_FALSE
#define DECOMPILE_CODE(pc,nb) if (!Decompile(ss, pc, nb)) return JS_FALSE
#define POP_STR() OFF2STR(&ss->sprinter, PopOff(ss, op))
#define LOCAL_ASSERT(expr) JS_ASSERT(expr); if (!(expr)) return JS_FALSE
/*
* Callers know that ATOM_IS_STRING(atom), and we leave it to the optimizer to
@ -887,7 +887,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
endpc = pc + nb;
forelem_tail = forelem_done = NULL;
tail = -1;
todo = -2; /* NB: different from Sprint() error return. */
todo = -2; /* NB: different from Sprint() error return. */
op = JSOP_NOP;
sn = NULL;
rval = NULL;
@ -2295,7 +2295,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
atom = GET_ATOM(cx, jp->script, pc);
xval = QuoteString(&ss->sprinter, ATOM_TO_STRING(atom),
(jschar)
(ATOM_IS_IDENTIFIER(atom) ? 0 : '\''));
(ATOM_IS_IDENTIFIER(atom) ? 0 : '\''));
if (!xval)
return JS_FALSE;
rval = POP_STR();

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

@ -109,7 +109,7 @@ typedef enum JSOp {
#define JUMP_OFFSET_LO(off) ((jsbytecode)(off))
#define GET_JUMP_OFFSET(pc) ((int16)(((pc)[1] << 8) | (pc)[2]))
#define SET_JUMP_OFFSET(pc,off) ((pc)[1] = JUMP_OFFSET_HI(off), \
(pc)[2] = JUMP_OFFSET_LO(off))
(pc)[2] = JUMP_OFFSET_LO(off))
#define JUMP_OFFSET_MIN ((int16)0x8000)
#define JUMP_OFFSET_MAX ((int16)0x7fff)
@ -126,7 +126,7 @@ typedef enum JSOp {
*/
#define GET_SPANDEP_INDEX(pc) ((uint16)(((pc)[1] << 8) | (pc)[2]))
#define SET_SPANDEP_INDEX(pc,i) ((pc)[1] = JUMP_OFFSET_HI(i), \
(pc)[2] = JUMP_OFFSET_LO(i))
(pc)[2] = JUMP_OFFSET_LO(i))
#define SPANDEP_INDEX_MAX ((uint16)0xfffe)
#define SPANDEP_INDEX_HUGE ((uint16)0xffff)
@ -151,9 +151,9 @@ typedef enum JSOp {
#define ATOM_INDEX_LO(index) ((jsbytecode)(index))
#define GET_ATOM_INDEX(pc) ((jsatomid)(((pc)[1] << 8) | (pc)[2]))
#define SET_ATOM_INDEX(pc,index)((pc)[1] = ATOM_INDEX_HI(index), \
(pc)[2] = ATOM_INDEX_LO(index))
(pc)[2] = ATOM_INDEX_LO(index))
#define GET_ATOM(cx,script,pc) js_GetAtom((cx), &(script)->atomMap, \
GET_ATOM_INDEX(pc))
GET_ATOM_INDEX(pc))
#define ATOM_INDEX_LIMIT_LOG2 16
#define ATOM_INDEX_LIMIT ((uint32)1 << ATOM_INDEX_LIMIT_LOG2)
@ -238,7 +238,7 @@ js_Disassemble(JSContext *cx, JSScript *script, JSBool lines, FILE *fp);
extern JS_FRIEND_API(uintN)
js_Disassemble1(JSContext *cx, JSScript *script, jsbytecode *pc, uintN loc,
JSBool lines, FILE *fp);
JSBool lines, FILE *fp);
#endif /* DEBUG */
/*
@ -268,7 +268,7 @@ js_DecompileFunction(JSPrinter *jp, JSFunction *fun);
*/
extern JSString *
js_DecompileValueGenerator(JSContext *cx, intN spindex, jsval v,
JSString *fallback);
JSString *fallback);
#define JSDVG_IGNORE_STACK 0
#define JSDVG_SEARCH_STACK 1

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

@ -112,14 +112,14 @@ typedef JSInt8 int8;
#endif /* HPUX */
#endif /* AIX && HAVE_SYS_INTTYPES_H */
#endif /* XP_BEOS */
#endif /* XP_BEOS */
typedef JSFloat64 float64;
/* Re: jsbit.h */
#define TEST_BIT JS_TEST_BIT
#define SET_BIT JS_SET_BIT
#define CLEAR_BIT JS_CLEAR_BIT
#define TEST_BIT JS_TEST_BIT
#define SET_BIT JS_SET_BIT
#define CLEAR_BIT JS_CLEAR_BIT
/* Re: prarena.h->plarena.h */
#define PRArena PLArena
@ -200,11 +200,11 @@ typedef JSFloat64 float64;
#define PR_CompareValues PL_CompareValues
#ifdef XP_MAC
#ifndef TRUE /* Mac standard is lower case true */
#define TRUE 1
#ifndef TRUE /* Mac standard is lower case true */
#define TRUE 1
#endif
#ifndef FALSE /* Mac standard is lower case false */
#define FALSE 0
#ifndef FALSE /* Mac standard is lower case false */
#define FALSE 0
#endif
#endif

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

@ -41,19 +41,19 @@
/*
** API for PR printf like routines. Supports the following formats
** %d - decimal
** %u - unsigned decimal
** %x - unsigned hex
** %X - unsigned uppercase hex
** %o - unsigned octal
** %hd, %hu, %hx, %hX, %ho - 16-bit versions of above
** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above
** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above
** %s - string
** %c - character
** %p - pointer (deals with machine dependent pointer size)
** %f - float
** %g - float
** %d - decimal
** %u - unsigned decimal
** %x - unsigned hex
** %X - unsigned uppercase hex
** %o - unsigned octal
** %hd, %hu, %hx, %hX, %ho - 16-bit versions of above
** %ld, %lu, %lx, %lX, %lo - 32-bit versions of above
** %lld, %llu, %llx, %llX, %llo - 64 bit versions of above
** %s - string
** %c - character
** %p - pointer (deals with machine dependent pointer size)
** %f - float
** %g - float
*/
#include "jstypes.h"
#include <stdio.h>

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

@ -128,10 +128,10 @@ typedef struct JSObjectMap JSObjectMap;
typedef struct JSObjectOps JSObjectOps;
typedef struct JSXMLObjectOps JSXMLObjectOps;
typedef struct JSRuntime JSRuntime;
typedef struct JSRuntime JSTaskState; /* XXX deprecated name */
typedef struct JSRuntime JSTaskState; /* XXX deprecated name */
typedef struct JSScript JSScript;
typedef struct JSString JSString;
typedef struct JSXDRState JSXDRState;
typedef struct JSXDRState JSXDRState;
typedef struct JSExceptionState JSExceptionState;
typedef struct JSLocaleCallbacks JSLocaleCallbacks;
@ -545,7 +545,7 @@ typedef struct JSErrorFormatString {
typedef const JSErrorFormatString *
(* JS_DLL_CALLBACK JSErrorCallback)(void *userRef, const char *locale,
const uintN errorNumber);
const uintN errorNumber);
#ifdef va_start
#define JS_ARGUMENT_FORMATTER_DEFINED 1

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

@ -3154,7 +3154,7 @@ regexp_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
JSRegExp *re;
if (!JSVAL_IS_INT(id))
return JS_TRUE;
return JS_TRUE;
slot = JSVAL_TO_INT(id);
if (slot == REGEXP_LAST_INDEX)
return JS_GetReservedSlot(cx, obj, 0, vp);
@ -3162,20 +3162,20 @@ regexp_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
JS_LOCK_OBJ(cx, obj);
re = (JSRegExp *) JS_GetInstancePrivate(cx, obj, &js_RegExpClass, NULL);
if (re) {
switch (slot) {
case REGEXP_SOURCE:
*vp = STRING_TO_JSVAL(re->source);
break;
case REGEXP_GLOBAL:
*vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_GLOB) != 0);
break;
case REGEXP_IGNORE_CASE:
*vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_FOLD) != 0);
break;
case REGEXP_MULTILINE:
*vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_MULTILINE) != 0);
break;
}
switch (slot) {
case REGEXP_SOURCE:
*vp = STRING_TO_JSVAL(re->source);
break;
case REGEXP_GLOBAL:
*vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_GLOB) != 0);
break;
case REGEXP_IGNORE_CASE:
*vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_FOLD) != 0);
break;
case REGEXP_MULTILINE:
*vp = BOOLEAN_TO_JSVAL((re->flags & JSREG_MULTILINE) != 0);
break;
}
}
JS_UNLOCK_OBJ(cx, obj);
return JS_TRUE;
@ -3190,7 +3190,7 @@ regexp_setProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
ok = JS_TRUE;
if (!JSVAL_IS_INT(id))
return ok;
return ok;
slot = JSVAL_TO_INT(id);
if (slot == REGEXP_LAST_INDEX) {
if (!js_ValueToNumber(cx, *vp, &lastIndex))
@ -3636,7 +3636,7 @@ regexp_exec_sub(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
ok = JS_InstanceOf(cx, obj, &js_RegExpClass, argv);
if (!ok)
return JS_FALSE;
return JS_FALSE;
JS_LOCK_OBJ(cx, obj);
re = (JSRegExp *) JS_GetPrivate(cx, obj);
if (!re) {

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

@ -127,7 +127,7 @@ js_DestroyRegExp(JSContext *cx, JSRegExp *re);
*/
extern JSBool
js_ExecuteRegExp(JSContext *cx, JSRegExp *re, JSString *str, size_t *indexp,
JSBool test, jsval *rval);
JSBool test, jsval *rval);
/*
* These two add and remove GC roots, respectively, so their calls must be

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

@ -74,7 +74,7 @@ typedef long ptrdiff_t;
#else /*WIN16*/
#define PTRDIFF(p1, p2, type) \
((p1) - (p2))
((p1) - (p2))
#endif

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

@ -210,44 +210,44 @@ typedef enum JSCharType {
#define JS_CTYPE(c) (JS_CCODE(c) & 0x1F)
#define JS_ISALPHA(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER)) \
>> JS_CTYPE(c)) & 1)
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER)) \
>> JS_CTYPE(c)) & 1)
#define JS_ISALNUM(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_DECIMAL_DIGIT_NUMBER)) \
>> JS_CTYPE(c)) & 1)
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_DECIMAL_DIGIT_NUMBER)) \
>> JS_CTYPE(c)) & 1)
/* A unicode letter, suitable for use in an identifier. */
#define JS_ISLETTER(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_LETTER_NUMBER)) \
>> JS_CTYPE(c)) & 1)
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_LETTER_NUMBER)) \
>> JS_CTYPE(c)) & 1)
/*
* 'IdentifierPart' from ECMA grammar, is Unicode letter or combining mark or
* digit or connector punctuation.
*/
#define JS_ISIDPART(c) ((((1 << JSCT_UPPERCASE_LETTER) | \
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_LETTER_NUMBER) | \
(1 << JSCT_NON_SPACING_MARK) | \
(1 << JSCT_COMBINING_SPACING_MARK) | \
(1 << JSCT_DECIMAL_DIGIT_NUMBER) | \
(1 << JSCT_CONNECTOR_PUNCTUATION)) \
>> JS_CTYPE(c)) & 1)
(1 << JSCT_LOWERCASE_LETTER) | \
(1 << JSCT_TITLECASE_LETTER) | \
(1 << JSCT_MODIFIER_LETTER) | \
(1 << JSCT_OTHER_LETTER) | \
(1 << JSCT_LETTER_NUMBER) | \
(1 << JSCT_NON_SPACING_MARK) | \
(1 << JSCT_COMBINING_SPACING_MARK) | \
(1 << JSCT_DECIMAL_DIGIT_NUMBER) | \
(1 << JSCT_CONNECTOR_PUNCTUATION)) \
>> JS_CTYPE(c)) & 1)
/* Unicode control-format characters, ignored in input */
#define JS_ISFORMAT(c) (((1 << JSCT_FORMAT) >> JS_CTYPE(c)) & 1)
@ -372,7 +372,7 @@ js_ValueToString(JSContext *cx, jsval v);
extern JSString *
js_ValueToSource(JSContext *cx, jsval v);
#ifdef HT_ENUMERATE_NEXT /* XXX don't require jshash.h */
#ifdef HT_ENUMERATE_NEXT /* XXX don't require jshash.h */
/*
* Compute a hash function from str.
*/

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

@ -6557,7 +6557,7 @@ xml_setName(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
xml = CHECK_COPY_ON_WRITE(cx, xml, obj);
if (!xml)
return JS_FALSE;
js_DestroyXMLQName(cx, xml->name);
js_DestroyXMLQName(cx, xml->name);
xml->name = (JSXMLQName *) JS_GetPrivate(cx, nameobj);
return JS_TRUE;
}

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

@ -57,21 +57,21 @@ typedef struct PRMJTime PRMJTime;
* Broken down form of 64 bit time value.
*/
struct PRMJTime {
JSInt32 tm_usec; /* microseconds of second (0-999999) */
JSInt8 tm_sec; /* seconds of minute (0-59) */
JSInt8 tm_min; /* minutes of hour (0-59) */
JSInt8 tm_hour; /* hour of day (0-23) */
JSInt8 tm_mday; /* day of month (1-31) */
JSInt8 tm_mon; /* month of year (0-11) */
JSInt8 tm_wday; /* 0=sunday, 1=monday, ... */
JSInt16 tm_year; /* absolute year, AD */
JSInt16 tm_yday; /* day of year (0 to 365) */
JSInt8 tm_isdst; /* non-zero if DST in effect */
JSInt32 tm_usec; /* microseconds of second (0-999999) */
JSInt8 tm_sec; /* seconds of minute (0-59) */
JSInt8 tm_min; /* minutes of hour (0-59) */
JSInt8 tm_hour; /* hour of day (0-23) */
JSInt8 tm_mday; /* day of month (1-31) */
JSInt8 tm_mon; /* month of year (0-11) */
JSInt8 tm_wday; /* 0=sunday, 1=monday, ... */
JSInt16 tm_year; /* absolute year, AD */
JSInt16 tm_yday; /* day of year (0 to 365) */
JSInt8 tm_isdst; /* non-zero if DST in effect */
};
/* Some handy constants */
#define PRMJ_USEC_PER_SEC 1000000L
#define PRMJ_USEC_PER_MSEC 1000L
#define PRMJ_USEC_PER_SEC 1000000L
#define PRMJ_USEC_PER_MSEC 1000L
/* Return the current local time in micro-seconds */
extern JSInt64