зеркало из https://github.com/mozilla/gecko-dev.git
Merge from SpiderMonkey140_BRANCH:
Incorporated changes from JS_STABLE_DROP_04261999 to JS_STABLE_DROP_06221999
This commit is contained in:
Родитель
68e87748be
Коммит
51498f2fa6
|
@ -606,7 +606,8 @@ JS_EndRequest(JSContext *cx)
|
|||
JS_LOCK_GC(rt);
|
||||
JS_ASSERT(rt->requestCount > 0);
|
||||
rt->requestCount--;
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
if (rt->requestCount == 0)
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
JS_UNLOCK_GC(rt);
|
||||
}
|
||||
}
|
||||
|
@ -621,7 +622,8 @@ JS_YieldRequest(JSContext *cx)
|
|||
rt = cx->runtime;
|
||||
JS_ASSERT(rt->requestCount > 0);
|
||||
rt->requestCount--;
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
if (rt->requestCount == 0)
|
||||
JS_NOTIFY_REQUEST_DONE(rt);
|
||||
JS_UNLOCK_GC(rt);
|
||||
JS_LOCK_GC(rt);
|
||||
rt->requestCount++;
|
||||
|
@ -687,7 +689,13 @@ JS_NewContext(JSRuntime *rt, size_t stacksize)
|
|||
JS_PUBLIC_API(void)
|
||||
JS_DestroyContext(JSContext *cx)
|
||||
{
|
||||
js_DestroyContext(cx);
|
||||
js_DestroyContext(cx, JS_TRUE);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_DestroyContextNoGC(JSContext *cx)
|
||||
{
|
||||
js_DestroyContext(cx, JS_FALSE);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void*)
|
||||
|
@ -907,7 +915,13 @@ JS_PUBLIC_API(JSBool)
|
|||
JS_RemoveRoot(JSContext *cx, void *rp)
|
||||
{
|
||||
CHECK_REQUEST(cx);
|
||||
return js_RemoveRoot(cx, rp);
|
||||
return js_RemoveRoot(cx->runtime, rp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveRootRT(JSRuntime *rt, void *rp)
|
||||
{
|
||||
return js_RemoveRoot(rt, rp);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
|
|
|
@ -298,6 +298,9 @@ JS_NewContext(JSRuntime *rt, size_t stacksize);
|
|||
extern JS_PUBLIC_API(void)
|
||||
JS_DestroyContext(JSContext *cx);
|
||||
|
||||
extern JS_PUBLIC_API(void)
|
||||
JS_DestroyContextNoGC(JSContext *cx);
|
||||
|
||||
JS_EXTERN_API(void*)
|
||||
JS_GetContextPrivate(JSContext *cx);
|
||||
|
||||
|
@ -359,6 +362,9 @@ JS_AddRoot(JSContext *cx, void *rp);
|
|||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveRoot(JSContext *cx, void *rp);
|
||||
|
||||
JS_PUBLIC_API(JSBool)
|
||||
JS_RemoveRootRT(JSRuntime *rt, void *rp);
|
||||
|
||||
extern JS_PUBLIC_API(JSBool)
|
||||
JS_AddNamedRoot(JSContext *cx, void *rp, const char *name);
|
||||
|
||||
|
|
|
@ -508,10 +508,10 @@ InitArrayObject(JSContext *cx, JSObject *obj, jsuint length, jsval *vector)
|
|||
if (!IndexToValue(cx, length, &v))
|
||||
return JS_FALSE;
|
||||
id = (jsid) cx->runtime->atomState.lengthAtom;
|
||||
if (!js_DefineProperty(cx, obj, id, v,
|
||||
array_length_getter, array_length_setter,
|
||||
JSPROP_PERMANENT,
|
||||
NULL)) {
|
||||
if (!OBJ_DEFINE_PROPERTY(cx, obj, id, v,
|
||||
array_length_getter, array_length_setter,
|
||||
JSPROP_PERMANENT,
|
||||
NULL)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
if (!vector)
|
||||
|
@ -519,10 +519,10 @@ InitArrayObject(JSContext *cx, JSObject *obj, jsuint length, jsval *vector)
|
|||
for (index = 0; index < length; index++) {
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return JS_FALSE;
|
||||
if (!js_DefineProperty(cx, obj, id, vector[index],
|
||||
JS_PropertyStub, JS_PropertyStub,
|
||||
JSPROP_ENUMERATE,
|
||||
NULL)) {
|
||||
if (!OBJ_DEFINE_PROPERTY(cx, obj, id, vector[index],
|
||||
JS_PropertyStub, JS_PropertyStub,
|
||||
JSPROP_ENUMERATE,
|
||||
NULL)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ js_NewContext(JSRuntime *rt, size_t stacksize)
|
|||
|
||||
#if JS_HAS_REGEXPS
|
||||
if (!js_InitRegExpStatics(cx, &cx->regExpStatics)) {
|
||||
js_DestroyContext(cx);
|
||||
js_DestroyContext(cx, JS_TRUE);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
@ -86,7 +86,7 @@ js_NewContext(JSRuntime *rt, size_t stacksize)
|
|||
}
|
||||
|
||||
void
|
||||
js_DestroyContext(JSContext *cx)
|
||||
js_DestroyContext(JSContext *cx, JSBool force_gc)
|
||||
{
|
||||
JSRuntime *rt;
|
||||
JSBool rtempty;
|
||||
|
@ -127,9 +127,14 @@ js_DestroyContext(JSContext *cx)
|
|||
#if JS_HAS_REGEXPS
|
||||
js_FreeRegExpStatics(cx, &cx->regExpStatics);
|
||||
#endif
|
||||
js_ForceGC(cx);
|
||||
|
||||
if (force_gc)
|
||||
js_ForceGC(cx);
|
||||
|
||||
if (rtempty) {
|
||||
if (!force_gc)
|
||||
js_ForceGC(cx);
|
||||
|
||||
/* Free atom state now that we've run the GC. */
|
||||
js_FreeAtomState(cx, &rt->atomState);
|
||||
}
|
||||
|
@ -173,7 +178,13 @@ js_ReportErrorVA(JSContext *cx, uintN flags, const char *format, va_list ap)
|
|||
char *last;
|
||||
|
||||
fp = cx->fp;
|
||||
if (fp && fp->script && fp->pc) {
|
||||
|
||||
/* Walk stack until we find a frame that is associated with
|
||||
some script rather than a native frame. */
|
||||
while (fp && (!fp->script || !fp->pc))
|
||||
fp = fp->down;
|
||||
|
||||
if (fp) {
|
||||
report.filename = fp->script->filename;
|
||||
report.lineno = js_PCToLineNumber(fp->script, fp->pc);
|
||||
/* XXX should fetch line somehow */
|
||||
|
|
|
@ -182,7 +182,7 @@ extern JSContext *
|
|||
js_NewContext(JSRuntime *rt, size_t stacksize);
|
||||
|
||||
extern void
|
||||
js_DestroyContext(JSContext *cx);
|
||||
js_DestroyContext(JSContext *cx, JSBool force_gc);
|
||||
|
||||
extern JSContext *
|
||||
js_ContextIterator(JSRuntime *rt, JSContext **iterp);
|
||||
|
|
|
@ -121,7 +121,7 @@ DestroyTrap(JSContext *cx, JSTrap *trap)
|
|||
{
|
||||
JS_REMOVE_LINK(&trap->links);
|
||||
*trap->pc = (jsbytecode)trap->op;
|
||||
js_RemoveRoot(cx, &trap->closure);
|
||||
js_RemoveRoot(cx->runtime, &trap->closure);
|
||||
JS_free(cx, trap);
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ DropWatchPoint(JSContext *cx, JSWatchPoint *wp)
|
|||
js_DropScopeProperty(cx, (JSScope *)wp->object->map,
|
||||
wp->sprop));
|
||||
JS_REMOVE_LINK(&wp->links);
|
||||
js_RemoveRoot(cx, &wp->closure);
|
||||
js_RemoveRoot(cx->runtime, &wp->closure);
|
||||
JS_free(cx, wp);
|
||||
}
|
||||
|
||||
|
@ -813,10 +813,10 @@ JS_PutPropertyDescArray(JSContext *cx, JSPropertyDescArray *pda)
|
|||
|
||||
pd = pda->array;
|
||||
for (i = 0; i < pda->length; i++) {
|
||||
js_RemoveRoot(cx, &pd[i].id);
|
||||
js_RemoveRoot(cx, &pd[i].value);
|
||||
js_RemoveRoot(cx->runtime, &pd[i].id);
|
||||
js_RemoveRoot(cx->runtime, &pd[i].value);
|
||||
if (pd[i].flags & JSPD_ALIAS)
|
||||
js_RemoveRoot(cx, &pd[i].alias);
|
||||
js_RemoveRoot(cx->runtime, &pd[i].alias);
|
||||
}
|
||||
JS_free(cx, pd);
|
||||
}
|
||||
|
|
|
@ -1990,6 +1990,9 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
if (!js_EmitTree(cx, cg, pn2))
|
||||
return JS_FALSE;
|
||||
|
||||
/* Remember start of callable-object bytecode for decompilation hint. */
|
||||
off = pn2->pn_offset;
|
||||
|
||||
/*
|
||||
* Push the virtual machine's "obj" register, which was set by a name,
|
||||
* property, or element get (or set) bytecode.
|
||||
|
@ -2007,7 +2010,9 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
|||
return JS_FALSE;
|
||||
}
|
||||
argc = pn->pn_count - 1;
|
||||
if (js_Emit3(cx, cg, op, ARGC_HI(argc), ARGC_LO(argc)) < 0)
|
||||
if (js_NewSrcNote2(cx, cg, SRC_PCBASE,
|
||||
(ptrdiff_t)(CG_OFFSET(cg) - off)) < 0 ||
|
||||
js_Emit3(cx, cg, op, ARGC_HI(argc), ARGC_LO(argc)) < 0)
|
||||
return JS_FALSE;
|
||||
break;
|
||||
|
||||
|
|
|
@ -601,7 +601,7 @@ js_ReportUncaughtException(JSContext *cx)
|
|||
}
|
||||
|
||||
if (exnObject != NULL)
|
||||
js_RemoveRoot(cx, &exnObject);
|
||||
js_RemoveRoot(cx->runtime, &exnObject);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1069,18 +1069,19 @@ fun_xdrObject(JSXDRState *xdr, JSObject **objp)
|
|||
return JS_FALSE;
|
||||
|
||||
if (xdr->mode == JSXDR_DECODE) {
|
||||
*objp = fun->object;
|
||||
if (atomstr) {
|
||||
fun->atom = js_AtomizeString(xdr->cx, atomstr, 0);
|
||||
if (!fun->atom)
|
||||
return JS_FALSE;
|
||||
|
||||
if (!OBJ_DEFINE_PROPERTY(xdr->cx, xdr->cx->globalObject,
|
||||
(jsid)fun->atom, OBJECT_TO_JSVAL(*objp),
|
||||
NULL, NULL, JSPROP_ENUMERATE,
|
||||
(JSProperty **)&sprop))
|
||||
return JS_FALSE;
|
||||
JS_UNLOCK_OBJ(xdr->cx, xdr->cx->globalObject);
|
||||
}
|
||||
*objp = fun->object;
|
||||
if (!OBJ_DEFINE_PROPERTY(xdr->cx, xdr->cx->globalObject,
|
||||
(jsid)fun->atom, OBJECT_TO_JSVAL(*objp),
|
||||
NULL, NULL, JSPROP_ENUMERATE,
|
||||
(JSProperty **)&sprop))
|
||||
return JS_FALSE;
|
||||
JS_UNLOCK_OBJ(xdr->cx, xdr->cx->globalObject);
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
|
|
|
@ -156,11 +156,8 @@ js_AddRoot(JSContext *cx, void *rp, const char *name)
|
|||
}
|
||||
|
||||
JSBool
|
||||
js_RemoveRoot(JSContext *cx, void *rp)
|
||||
js_RemoveRoot(JSRuntime *rt, void *rp)
|
||||
{
|
||||
JSRuntime *rt;
|
||||
|
||||
rt = cx->runtime;
|
||||
JS_LOCK_GC_VOID(rt, JS_HashTableRemove(rt->gcRootsHash, rp));
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ extern JSBool
|
|||
js_AddRoot(JSContext *cx, void *rp, const char *name);
|
||||
|
||||
extern JSBool
|
||||
js_RemoveRoot(JSContext *cx, void *rp);
|
||||
js_RemoveRoot(JSRuntime *rt, void *rp);
|
||||
|
||||
extern void *
|
||||
js_AllocGCThing(JSContext *cx, uintN flags);
|
||||
|
|
|
@ -106,7 +106,7 @@ prop_iterator_finalize(JSContext *cx, JSObject *obj)
|
|||
OBJ_ENUMERATE(cx, JSVAL_TO_OBJECT(iteratee), JSENUMERATE_DESTROY,
|
||||
&iter_state, NULL);
|
||||
}
|
||||
js_RemoveRoot(cx, &obj->slots[JSSLOT_PARENT]);
|
||||
js_RemoveRoot(cx->runtime, &obj->slots[JSSLOT_PARENT]);
|
||||
}
|
||||
|
||||
static JSClass prop_iterator_class = {
|
||||
|
@ -701,6 +701,15 @@ out2:
|
|||
/* Store the return value and restore sp just above it. */
|
||||
*vp = frame.rval;
|
||||
fp->sp = vp + 1;
|
||||
|
||||
/* Store the location of JSOP_CALL that generated the return value. */
|
||||
if (fp->script) {
|
||||
JS_ASSERT(JS_UPTRDIFF(vp - fp->script->depth,
|
||||
cx->stackPool.current->base) <
|
||||
JS_UPTRDIFF(cx->stackPool.current->avail,
|
||||
cx->stackPool.current->base));
|
||||
vp[-fp->script->depth] = (jsval)fp->pc;
|
||||
}
|
||||
return ok;
|
||||
|
||||
bad:
|
||||
|
|
|
@ -338,44 +338,46 @@ deleteListOfFatlocks(JSFatLock *m)
|
|||
}
|
||||
}
|
||||
|
||||
static JSFatLockTable _fl_table;
|
||||
static JSFatLockTable* _fl_tables;
|
||||
|
||||
static JSFatLock *
|
||||
allocateFatlock()
|
||||
allocateFatlock(void *id)
|
||||
{
|
||||
JSFatLock *m;
|
||||
|
||||
if (_fl_table.free == NULL) {
|
||||
int i = ((int)id/4)%_nr_of_globals;
|
||||
if (_fl_tables[i].free == NULL) {
|
||||
#ifdef DEBUG
|
||||
printf("Ran out of fat locks!\n");
|
||||
#endif
|
||||
_fl_table.free = listOfFatlocks(10);
|
||||
_fl_tables[i].free = listOfFatlocks(10);
|
||||
}
|
||||
m = _fl_table.free;
|
||||
_fl_table.free = m->next;
|
||||
_fl_table.free->prev = NULL;
|
||||
m = _fl_tables[i].free;
|
||||
_fl_tables[i].free = m->next;
|
||||
_fl_tables[i].free->prev = NULL;
|
||||
m->susp = 0;
|
||||
m->next = _fl_table.taken;
|
||||
m->next = _fl_tables[i].taken;
|
||||
m->prev = NULL;
|
||||
if (_fl_table.taken != NULL)
|
||||
_fl_table.taken->prev = m;
|
||||
_fl_table.taken = m;
|
||||
if (_fl_tables[i].taken != NULL)
|
||||
_fl_tables[i].taken->prev = m;
|
||||
_fl_tables[i].taken = m;
|
||||
return m;
|
||||
}
|
||||
|
||||
static void
|
||||
deallocateFatlock(JSFatLock *m)
|
||||
deallocateFatlock(JSFatLock *m, void *id)
|
||||
{
|
||||
if (m == NULL)
|
||||
int i = ((int)id/4)%_nr_of_globals;
|
||||
if (m == NULL)
|
||||
return;
|
||||
if (m->prev != NULL)
|
||||
if (m->prev != NULL)
|
||||
m->prev->next = m->next;
|
||||
if (m->next != NULL)
|
||||
if (m->next != NULL)
|
||||
m->next->prev = m->prev;
|
||||
if (m == _fl_table.taken)
|
||||
_fl_table.taken = m->next;
|
||||
m->next = _fl_table.free;
|
||||
_fl_table.free = m;
|
||||
if (m == _fl_tables[i].taken)
|
||||
_fl_tables[i].taken = m->next;
|
||||
m->next = _fl_tables[i].free;
|
||||
_fl_tables[i].free = m;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -408,8 +410,12 @@ js_SetupLocks(int l, int g)
|
|||
_compare_and_swap_lock = PR_NewLock();
|
||||
JS_ASSERT(_compare_and_swap_lock);
|
||||
#endif
|
||||
_fl_table.free = listOfFatlocks(l);
|
||||
_fl_table.taken = NULL;
|
||||
_fl_tables = (JSFatLockTable*)malloc(_nr_of_globals * sizeof(JSFatLockTable));
|
||||
JS_ASSERT(_fl_tables != NULL);
|
||||
for (i=0; i<_nr_of_globals; i++) {
|
||||
_fl_tables[i].free = listOfFatlocks(l);
|
||||
_fl_tables[i].taken = NULL;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -419,12 +425,13 @@ js_CleanupLocks()
|
|||
int i;
|
||||
|
||||
if (_global_locks != NULL) {
|
||||
deleteListOfFatlocks(_fl_table.free);
|
||||
_fl_table.free = NULL;
|
||||
deleteListOfFatlocks(_fl_table.taken);
|
||||
_fl_table.taken = NULL;
|
||||
for (i=0; i<_nr_of_globals; i++)
|
||||
for (i=0; i<_nr_of_globals; i++) {
|
||||
PR_DestroyLock(_global_locks[i]);
|
||||
deleteListOfFatlocks(_fl_tables[i].free);
|
||||
_fl_tables[i].free = NULL;
|
||||
deleteListOfFatlocks(_fl_tables[i].taken);
|
||||
_fl_tables[i].taken = NULL;
|
||||
}
|
||||
_global_locks = NULL;
|
||||
#ifdef UsingCounterLock
|
||||
PR_DestroyLock(_counter_lock);
|
||||
|
@ -487,7 +494,7 @@ js_SuspendThread(JSThinLock *p)
|
|||
int o;
|
||||
|
||||
if (p->fat == NULL)
|
||||
fl = p->fat = allocateFatlock();
|
||||
fl = p->fat = allocateFatlock(p);
|
||||
else
|
||||
fl = p->fat;
|
||||
JS_ASSERT(fl->susp >= 0);
|
||||
|
@ -498,6 +505,11 @@ js_SuspendThread(JSThinLock *p)
|
|||
JS_ASSERT(stat != JS_FAILURE);
|
||||
PR_Unlock(fl->slock);
|
||||
js_LockGlobal(p);
|
||||
fl->susp--;
|
||||
if (fl->susp == 0) {
|
||||
deallocateFatlock(fl,p);
|
||||
p->fat = NULL;
|
||||
}
|
||||
return p->fat == NULL;
|
||||
}
|
||||
|
||||
|
@ -513,11 +525,6 @@ js_ResumeThread(JSThinLock *p)
|
|||
|
||||
JS_ASSERT(fl != NULL);
|
||||
JS_ASSERT(fl->susp > 0);
|
||||
fl->susp--;
|
||||
if (fl->susp == 0) {
|
||||
deallocateFatlock(fl);
|
||||
p->fat = NULL;
|
||||
}
|
||||
PR_Lock(fl->slock);
|
||||
js_UnlockGlobal(p);
|
||||
stat = (JSStatus)PR_NotifyCondVar(fl->svar);
|
||||
|
|
|
@ -198,7 +198,8 @@ num_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
{
|
||||
jsval v;
|
||||
jsdouble d;
|
||||
jsint base, ival, dval;
|
||||
jsint base, dval;
|
||||
unsigned int ival;
|
||||
char *bp, buf[32];
|
||||
JSString *str;
|
||||
|
||||
|
@ -219,14 +220,22 @@ num_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
return JS_FALSE;
|
||||
}
|
||||
if (base != 10 && JSDOUBLE_IS_FINITE(d)) {
|
||||
ival = (jsint) js_DoubleToInteger(d);
|
||||
JSBool isNegative;
|
||||
if (isNegative = (d < 0)) d = -d;
|
||||
ival = (unsigned int) js_DoubleToInteger(d);
|
||||
bp = buf + sizeof buf;
|
||||
for (*--bp = '\0'; ival != 0 && --bp >= buf; ival /= base) {
|
||||
for (*--bp = '\0'; ival != 0 && bp > buf; ival /= base) {
|
||||
dval = ival % base;
|
||||
*bp = (char)((dval >= 10) ? 'a' - 10 + dval : '0' + dval);
|
||||
*--bp = (char)((dval >= 10) ? 'a' - 10 + dval : '0' + dval);
|
||||
}
|
||||
if (*bp == '\0')
|
||||
*--bp = '0';
|
||||
if (isNegative)
|
||||
if (bp > buf)
|
||||
*--bp = '-';
|
||||
else
|
||||
/* sacrifice the leading digit or lose the '-' ?*/
|
||||
*bp = '-';
|
||||
str = JS_NewStringCopyZ(cx, bp);
|
||||
} else {
|
||||
str = js_NumberToString(cx, d);
|
||||
|
|
2762
js/src/jsregexp.c
2762
js/src/jsregexp.c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -55,7 +55,7 @@ struct JSRegExp {
|
|||
size_t lastIndex; /* index after last match, for //g iterator */
|
||||
uintN parenCount; /* number of parenthesized submatches */
|
||||
uint8 flags; /* flags, see jsapi.h */
|
||||
jsbytecode program[1]; /* regular expression bytecode */
|
||||
struct RENode *ren; /* regular expression tree root */
|
||||
};
|
||||
|
||||
extern JSRegExp *
|
||||
|
|
|
@ -894,7 +894,7 @@ str_match(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
ok = match_or_replace(cx, obj, argc, argv, match_glob, &mdata.base, rval);
|
||||
if (ok && mdata.arrayobj)
|
||||
*rval = OBJECT_TO_JSVAL(mdata.arrayobj);
|
||||
js_RemoveRoot(cx, &mdata.arrayobj);
|
||||
js_RemoveRoot(cx->runtime, &mdata.arrayobj);
|
||||
return ok;
|
||||
#else
|
||||
return str_nyi(cx, "match");
|
||||
|
|
|
@ -60,15 +60,16 @@ typedef struct JSXDRMemState {
|
|||
#define MEM_NEED(xdr, bytes) \
|
||||
JS_BEGIN_MACRO \
|
||||
if ((xdr)->mode == JSXDR_ENCODE) { \
|
||||
uint32 _new_limit = JS_ROUNDUP(MEM_COUNT(xdr) + bytes, MEM_BLOCK);\
|
||||
if (MEM_LIMIT(xdr) && \
|
||||
MEM_COUNT(xdr) + bytes > MEM_LIMIT(xdr)) { \
|
||||
void *_data = JS_realloc((xdr)->cx, \
|
||||
(xdr)->data, \
|
||||
MEM_LIMIT(xdr) + MEM_BLOCK); \
|
||||
_new_limit); \
|
||||
if (!_data) \
|
||||
return 0; \
|
||||
(xdr)->data = _data; \
|
||||
MEM_LIMIT(xdr) += MEM_BLOCK; \
|
||||
MEM_LIMIT(xdr) = _new_limit; \
|
||||
} \
|
||||
} else { \
|
||||
if (MEM_LIMIT(xdr) < MEM_COUNT(xdr) + bytes) { \
|
||||
|
|
Загрузка…
Ссылка в новой задаче