Backed out changeset a40f2117bcc0

This commit is contained in:
Andreas Gal
2008-11-12 17:39:48 -08:00
parent 7b8d11c0f0
commit fd9de39309
21 changed files with 215 additions and 827 deletions

View File

@@ -612,8 +612,12 @@ js_CallIteratorNext(JSContext *cx, JSObject *iterobj, jsval *rval)
return JS_FALSE;
if (!js_InternalCall(cx, iterobj, *rval, 0, NULL, rval)) {
/* Check for StopIteration. */
if (!cx->throwing || !js_ValueIsStopIteration(cx->exception))
if (!cx->throwing ||
JSVAL_IS_PRIMITIVE(cx->exception) ||
OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(cx->exception))
!= &js_StopIterationClass) {
return JS_FALSE;
}
/* Inline JS_ClearPendingException(cx). */
cx->throwing = JS_FALSE;
@@ -629,7 +633,8 @@ js_CallIteratorNext(JSContext *cx, JSObject *iterobj, jsval *rval)
static JSBool
stopiter_hasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
{
*bp = js_ValueIsStopIteration(v);
*bp = !JSVAL_IS_PRIMITIVE(v) &&
OBJ_GET_CLASS(cx, JSVAL_TO_OBJECT(v)) == &js_StopIterationClass;
return JS_TRUE;
}
@@ -712,7 +717,7 @@ JSObject *
js_NewGenerator(JSContext *cx, JSStackFrame *fp)
{
JSObject *obj;
uintN argc, nargs, nslots;
uintN argc, nargs, nvars, nslots;
JSGenerator *gen;
jsval *slots;
@@ -724,6 +729,7 @@ js_NewGenerator(JSContext *cx, JSStackFrame *fp)
/* Load and compute stack slot counts. */
argc = fp->argc;
nargs = JS_MAX(argc, fp->fun->nargs);
nvars = fp->fun->u.i.nvars;
nslots = 2 + nargs + fp->script->nslots;
/* Allocate obj's private data struct. */
@@ -774,7 +780,6 @@ js_NewGenerator(JSContext *cx, JSStackFrame *fp)
gen->frame.annotation = NULL;
gen->frame.scopeChain = fp->scopeChain;
gen->frame.imacpc = NULL;
gen->frame.slots = slots;
JS_ASSERT(StackBase(fp) == fp->regs->sp);
gen->savedRegs.sp = slots + fp->script->nfixed;