Bug 1143194 - Emit JSTRY_FOR_OF notes for for-of loops. (r=jorendorff)
authorShu-yu Guo <shu@rfrn.org>
Sat, 21 Mar 2015 14:11:14 -0700
changeset 265247 aa10cd6d6ea0ffafd0a5dd6b659d3a9096c3c263
parent 265246 92b51483ea56d06db65b234bc8894074db1a56c2
child 265248 117d8de21ad5fbf88a7270493cb822f03a7b7dcd
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1143194
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1143194 - Emit JSTRY_FOR_OF notes for for-of loops. (r=jorendorff)
js/src/frontend/BytecodeEmitter.cpp
js/src/jsscript.h
js/src/shell/js.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -4951,16 +4951,19 @@ BytecodeEmitter::emitForOf(StmtType type
     // Let Ion know where the closing jump of this loop is.
     if (!setSrcNoteOffset(unsigned(noteIndex), 0, beq - jmp))
         return false;
 
     // Fixup breaks and continues.
     // 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;
     }
 
     if (type == STMT_SPREAD) {
         if (!emit2(JSOP_PICK, (jsbytecode)3))      // ARR I RESULT ITER
             return false;
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -62,16 +62,17 @@ namespace frontend {
  * for-in and other kinds of loops. Non-for-in loops do not need these notes
  * for exception unwinding, but storing their boundaries here is helpful for
  * heuristics that need to know whether a given op is inside a loop.
  */
 enum JSTryNoteKind {
     JSTRY_CATCH,
     JSTRY_FINALLY,
     JSTRY_ITER,
+    JSTRY_FOR_OF,
     JSTRY_LOOP
 };
 
 /*
  * Exception handling record.
  */
 struct JSTryNote {
     uint8_t         kind;       /* one of JSTryNoteKind */
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -2179,17 +2179,17 @@ Notes(JSContext *cx, unsigned argc, jsva
     args.rval().setString(str);
     return true;
 }
 
 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)
 {
     JSTryNote *tn, *tnlimit;
 
     if (!script->hasTrynotes())
         return true;