JS_ASSERT(delta < (ptrdiff_t)CGINCR); offset = CG_OFFSET(cg); if ((jsuword)(CG_NEXT(cg) + delta) >= (jsuword)CG_LIMIT(cg)) { length = PTRDIFF(CG_LIMIT(cg), CG_BASE(cg), jsbytecode); cgsize = length * sizeof(jsbytecode); if (CG_BASE(cg)) JS_ARENA_GROW(CG_BASE(cg), &cx->codePool, cgsize, CGINCR_SIZE); else JS_ARENA_ALLOCATE(CG_BASE(cg), &cx->codePool, CGINCR_SIZE); if (!CG_BASE(cg)) { JS_ReportOutOfMemory(cx); return -1; } CG_LIMIT(cg) = CG_CODE(cg, length + CGINCR); CG_NEXT(cg) = CG_CODE(cg, offset);
base = CG_BASE(cg); next = CG_NEXT(cg); limit = CG_LIMIT(cg); offset = PTRDIFF(next, base, jsbytecode); if ((jsuword)(next + delta) > (jsuword)limit) { length = PTRDIFF(limit, base, jsbytecode); delta = JS_ROUNDUP(delta, CGINCR); cgincr = delta * sizeof(jsbytecode); if (base) { cgsize = length * sizeof(jsbytecode); JS_ARENA_GROW(base, &cx->codePool, cgsize, cgincr); } else { JS_ARENA_ALLOCATE(base, &cx->codePool, cgincr); } if (!base) { JS_ReportOutOfMemory(cx); return -1; } CG_BASE(cg) = base; CG_LIMIT(cg) = base + length + delta; CG_NEXT(cg) = base + offset;
EmitCheck(JSContext *cx, JSCodeGenerator *cg, JSOp op, ptrdiff_t delta){    ptrdiff_t offset, length;    size_t cgsize;    JS_ASSERT(delta < (ptrdiff_t)CGINCR);    offset = CG_OFFSET(cg);    if ((jsuword)(CG_NEXT(cg) + delta) >= (jsuword)CG_LIMIT(cg)) {	length = PTRDIFF(CG_LIMIT(cg), CG_BASE(cg), jsbytecode);	cgsize = length * sizeof(jsbytecode);	if (CG_BASE(cg))	    JS_ARENA_GROW(CG_BASE(cg), &cx->codePool, cgsize, CGINCR_SIZE);	else	    JS_ARENA_ALLOCATE(CG_BASE(cg), &cx->codePool, CGINCR_SIZE);	if (!CG_BASE(cg)) {	    JS_ReportOutOfMemory(cx);	    return -1;	}	CG_LIMIT(cg) = CG_CODE(cg, length + CGINCR);	CG_NEXT(cg) = CG_CODE(cg, offset);    }    return offset;}