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
Owner:
Closed: Aug 2014
Cc:
HW: ----
NextAction: ----
OS: ----
Priority: ----
Type: FeatureRequest

Blocked on:
issue 3566



Sign in to add a comment

Implement Harmony iterators

Project Member Reported by arv@chromium.org, Jul 2 2012

Issue description

http://wiki.ecmascript.org/doku.php?id=harmony:iterators

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
Cc: rossberg@chromium.org
Labels: Type-FeatureRequest
Owner: mstarzinger@chromium.org
Status: Accepted

Comment 3 by wi...@igalia.com, May 27 2013

Cc: wi...@igalia.com

Comment 4 by arv@chromium.org, 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 arv@chromium.org, Sep 16 2013

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

Comment 8 by wi...@igalia.com, 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 get...@gmail.com, Jan 27 2014

Bump.

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 arv@chromium.org, 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 arv@chromium.org, May 8 2014

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

Comment 14 by wi...@igalia.com, Aug 25 2014

Status: Fixed
Shipped in M38.

Comment 15 by rekt...@gmail.com, Aug 25 2014

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

Comment 16 by wi...@igalia.com, 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 bugdroid1@chromium.org, Feb 18 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/cb1bf4af3c961093e9a75a22089f78daf7959304

commit cb1bf4af3c961093e9a75a22089f78daf7959304
Author: rossberg <rossberg@chromium.org>
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 parser.cc 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 (http://crrev.com/1695583003), 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 
LOG=Y

Review URL: https://codereview.chromium.org/1695393003

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

[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/ast/ast-value-factory.h
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/ast/ast.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/ast/ast.h
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/ast/prettyprinter.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/ast/prettyprinter.h
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/ast/scopes.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/bootstrapper.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/flag-definitions.h
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/messages.h
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/parsing/parser.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/parsing/parser.h
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/src/parsing/rewriter.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/test/cctest/interpreter/test-bytecode-generator.cc
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/test/mjsunit/harmony/destructuring.js
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/test/mjsunit/harmony/generators.js
[add] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/test/mjsunit/harmony/iterator-close.js
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/test/mjsunit/mjsunit.status
[modify] http://crrev.com/cb1bf4af3c961093e9a75a22089f78daf7959304/test/mjsunit/strong/for-in.js

Comment 21 by tar...@gmail.com, 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 tar...@gmail.com, Feb 19 2016

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

Comment 24 by adamk@chromium.org, Feb 19 2016

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

Sign in to add a comment