Bug 1143194 - Emit JSTRY_FOR_OF notes for for-of loops. (r=jorendorff)

This commit is contained in:
Shu-yu Guo 2015-03-21 14:11:14 -07:00
parent 2b21b4db17
commit 8f681cbcb3
3 changed files with 5 additions and 1 deletions

View File

@ -4956,6 +4956,9 @@ BytecodeEmitter::emitForOf(StmtType type, ParseNode *pn, ptrdiff_t top)
// For STMT_SPREAD, just pop pc->topStmt.
popStatement();
if (!tryNoteList.append(JSTRY_FOR_OF, stackDepth, top, offset()))
return false;
if (letDecl) {
if (!LeaveNestedScope(cx, this, &letStmt))
return false;

View File

@ -67,6 +67,7 @@ enum JSTryNoteKind {
JSTRY_CATCH,
JSTRY_FINALLY,
JSTRY_ITER,
JSTRY_FOR_OF,
JSTRY_LOOP
};

View File

@ -2184,7 +2184,7 @@ JS_STATIC_ASSERT(JSTRY_CATCH == 0);
JS_STATIC_ASSERT(JSTRY_FINALLY == 1);
JS_STATIC_ASSERT(JSTRY_ITER == 2);
static const char* const TryNoteNames[] = { "catch", "finally", "iter", "loop" };
static const char* const TryNoteNames[] = { "catch", "finally", "iter", "for-of", "loop" };
static bool
TryNotes(JSContext *cx, HandleScript script, Sprinter *sp)