Fix broken-since-rev-3.6.4.11 forelem normal-termination stack cleanup code-gen (174709, r=shaver, a=chofmann).

This commit is contained in:
brendan%mozilla.org 2004-03-23 02:09:38 +00:00
parent 8ebba422fc
commit 472d45bc48
2 changed files with 3 additions and 17 deletions

View File

@ -2988,23 +2988,8 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
return JS_FALSE;
if (pn2->pn_type == TOK_IN) {
/*
* Generate the object and iterator pop opcodes after popping the
* stmtInfo stack, so breaks will go to this pop bytecode.
*/
if (pn3->pn_type != TOK_LB) {
if (js_Emit1(cx, cg, JSOP_POP2) < 0)
return JS_FALSE;
} else {
/*
* With 'for(x[i]...)', there's only the object on the stack,
* so we need to hide the pop.
*/
if (js_NewSrcNote(cx, cg, SRC_HIDDEN) < 0)
return JS_FALSE;
if (js_Emit1(cx, cg, JSOP_POP) < 0)
return JS_FALSE;
}
if (js_Emit1(cx, cg, JSOP_POP2) < 0)
return JS_FALSE;
}
break;

View File

@ -1924,6 +1924,7 @@ js_Interpret(JSContext *cx, jsval *result)
} else {
/* This is not the first iteration. Recover iterator state. */
propobj = JSVAL_TO_OBJECT(rval);
JS_ASSERT(OBJ_GET_CLASS(cx, propobj) == &prop_iterator_class);
obj = JSVAL_TO_OBJECT(propobj->slots[JSSLOT_PARENT]);
iter_state = propobj->slots[JSSLOT_ITER_STATE];
}