New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 2214 link

Starred by 63 users

Issue metadata

Status: Fixed
Closed: Aug 2014
HW: ----
NextAction: ----
OS: ----
Priority: ----
Type: FeatureRequest

Blocked on:
issue 3566

Sign in to add a comment

Implement Harmony iterators

Project Member Reported by, Jul 2 2012

Issue description

Even though a lot of these are specced in terms of generators the details of generators are not required to be implemented to do for-of loops.
Labels: Harmony
Labels: Type-FeatureRequest
Status: Accepted

Comment 3 by, May 27 2013


Comment 4 by, Jun 30 2013

What is this bug about? Is this about exposing @@iterator?

It's about for-of loops and iteration functions on collections. Default iterators via @@iterator are just a corner case.
Maps and Sets are useless without iterators at least according to current harmony spec..

Comment 7 by, Sep 16 2013

Also, see  issue 2323  about Map.prototype.forEach and Set.prototype.forEach

Comment 8 by, Sep 17 2013

I'm happy to fix the @@iterator thing, but it will take me a couple weeks to clear my plate.

Comment 9 Deleted

Comment 10 by, Jan 27 2014


Would really like to see a `for..of` implementation drop in chrome soon. It's been in firefox for awhile, but we need at least 2 parallel implementations so we can call out bugs in either/both implementations easier.

NOTE: this also needs `Symbol.iterator` at a minimum (don't need a full Symbol implementation yet).

Comment 11 by, Jan 27 2014

We have Symbol working but we do not have the Symbol register which is needed to allow cross realm iterators to work. Symbol.iterator needs to be the same value in all realms/globals.

Comment 12 by, May 8 2014

We now have a symbol registry. We should be able to update for-of to use that.

Comment 14 by, Aug 25 2014

Status: Fixed
Shipped in M38.

Comment 15 by, Aug 25 2014

I'd be interested to see the commit/commits for this. Thanks Andy & all!

Comment 16 by, Aug 26 2014

Unfortunately it's not that easy to isolate them -- there were many!  Some can be found via

  git log --follow test/mjsunit/es6/iteration-semantics.js

similarly for other files in that directory.
Blockedon: v8:3566
Blockedon: v8:3565
Blockedon: -v8:3565
Project Member

Comment 20 by, Feb 18 2016

The following revision refers to this bug:

commit cb1bf4af3c961093e9a75a22089f78daf7959304
Author: rossberg <>
Date: Thu Feb 18 10:49:07 2016

[es6] Implement for-of iterator finalization

Implements iterator finalisation by desugaring for-of loops with an additional try-finally wrapper. See comment in for details.

Also improved some AST printing facilities while there.

@Ross, I had to disable the bytecode generation test for for-of, because it got completely out of hand after this change (the new bytecode has 150+ lines). See the TODO that I assigned to you.

Patch set 1 is WIP patch by Georg (, patch set 2 relative changes.

@Georg, FYI, I changed the following:

- Moved try-finally out of the loop body, for performance, and in order to be able to handle `continue` correctly.
- Fixed scope management in ParseForStatement, which was the cause for the variable allocation failure.
- Fixed pre-existing zone initialisation bug in rewriter, which caused the crashes.
- Enabled all tests, adjusted a few others, added a couple more.

BUG= v8:2214 

Review URL:

Cr-Commit-Position: refs/heads/master@{#34111}


Comment 21 by, Feb 19 2016

Hm, the test on kangax isn't working even when I enable harmony in about:flags. (50.0.2655.0 canary)

Is the test there wrong?
@ #20: which test? All for-of tests work for me, except the ones requiring iterator closing, which is expected.

Comment 23 by, Feb 19 2016

My apologies, I thought iterator finalization was the same as iterator closing. Is there a bug tracking closing?

Comment 24 by, Feb 19 2016

Closing is being tracked (at least some of the work, anyway) in  issue 3566 .

Sign in to add a comment