зеркало из https://github.com/mozilla/pjs.git
Better control flow for catch clause code generation (r=shaver).
This commit is contained in:
Родитель
6eeacdea31
Коммит
53389789d1
|
@ -1464,7 +1464,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||||
case TOK_TRY: {
|
case TOK_TRY: {
|
||||||
ptrdiff_t start, end;
|
ptrdiff_t start, end;
|
||||||
ptrdiff_t catchStart = -1, finallyCatch = -1, catchjmp = -1;
|
ptrdiff_t catchStart = -1, finallyCatch = -1, catchjmp = -1;
|
||||||
JSParseNode *iter = pn;
|
JSParseNode *iter;
|
||||||
uint16 depth;
|
uint16 depth;
|
||||||
|
|
||||||
/* Emit JSOP_GOTO that points to the first op after the catch/finally blocks */
|
/* Emit JSOP_GOTO that points to the first op after the catch/finally blocks */
|
||||||
|
@ -1528,7 +1528,8 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||||
end = CG_OFFSET(cg);
|
end = CG_OFFSET(cg);
|
||||||
|
|
||||||
/* If this try has a catch block, emit it. */
|
/* If this try has a catch block, emit it. */
|
||||||
if (pn->pn_kid2) {
|
iter = pn->pn_kid2;
|
||||||
|
if (iter) {
|
||||||
catchStart = end;
|
catchStart = end;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1558,9 +1559,6 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||||
JSParseNode *disc;
|
JSParseNode *disc;
|
||||||
ptrdiff_t guardnote;
|
ptrdiff_t guardnote;
|
||||||
|
|
||||||
iter = iter->pn_kid2;
|
|
||||||
disc = iter->pn_kid1;
|
|
||||||
|
|
||||||
if (!UpdateLinenoNotes(cx, cg, iter))
|
if (!UpdateLinenoNotes(cx, cg, iter))
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
|
@ -1596,6 +1594,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initcatchvar <atomIndex> */
|
/* initcatchvar <atomIndex> */
|
||||||
|
disc = iter->pn_kid1;
|
||||||
ale = js_IndexAtom(cx, disc->pn_atom, &cg->atomList);
|
ale = js_IndexAtom(cx, disc->pn_atom, &cg->atomList);
|
||||||
if (!ale)
|
if (!ale)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
@ -1654,10 +1653,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||||
EMIT_CATCH_GOTO(cx, cg, jmp);
|
EMIT_CATCH_GOTO(cx, cg, jmp);
|
||||||
if (jmp < 0)
|
if (jmp < 0)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
} while ((iter = iter->pn_kid2) != NULL);
|
||||||
if (!iter->pn_kid2)
|
|
||||||
break;
|
|
||||||
} while (iter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче