Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Issue 13542002: Calling a generator function returns a generator object (Closed)

Created:
7 years, 8 months ago by wingo
Modified:
7 years, 8 months ago
Base URL:
git://github.com/v8/v8.git@master
Visibility:
Public.

Description

Calling a generator function returns a generator object * src/heap.h: * src/heap.cc: * src/objects-debug.cc: * src/objects-inl.h: * src/objects-printer.cc: * src/objects-visiting.cc: * src/objects.cc: * src/objects.h: Define a new object type, JSGeneratorObject. * src/factory.h: * src/factory.cc (NewFunctionFromSharedFunctionInfo): Generator function inital maps construct the new JS_GENERATOR_OBJECT_TYPE objects, not generic JSObjects. * src/runtime.h: * src/runtime.cc (Runtime_CreateJSGeneratorObject): * src/arm/full-codegen-arm.cc (Generate): * src/ia32/full-codegen-ia32.cc (Generate): * src/x64/full-codegen-x64.cc (Generate): Before visiting generator bodies, arrange to construct and return a generator object. * test/mjsunit/harmony/generators-objects.js: Add tests for the properties and prototype of generator objects. BUG=v8:2355 TEST=mjsunit/harmony/generators-objects Committed: http://code.google.com/p/v8/source/detail?r=14264

Patch Set 1 #

Patch Set 2 : Fix whitespace; more tests #

Total comments: 1

Patch Set 3 : Link generator iterator definitions and uses through local variable #

Total comments: 11

Patch Set 4 : rename to JSGeneratorObject; address review comments #

Patch Set 5 : Rebase based on updates from https://codereview.chromium.org/13192004/ #

Patch Set 6 : Rebased to apply to bleeding_edge #

Total comments: 14

Patch Set 7 : Fix nits #

Patch Set 8 : Fix generator construction via `new' #

Total comments: 9

Patch Set 9 : Fix nits; generator object fields are undefined if not set #

Unified diffs Side-by-side diffs Delta from patch set Stats (+218 lines, -73 lines) Patch
M src/ast.h View 1 2 3 4 5 6 2 chunks +10 lines, -3 lines 0 comments Download
M src/full-codegen.cc View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M src/heap.h View 1 2 3 4 5 8 1 chunk +3 lines, -0 lines 0 comments Download
M src/heap.cc View 1 2 3 4 5 6 7 8 2 chunks +18 lines, -3 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 6 7 8 5 chunks +39 lines, -1 line 0 comments Download
M src/objects.cc View 1 2 3 4 5 2 chunks +5 lines, -0 lines 0 comments Download
M src/objects-debug.cc View 1 2 3 4 5 6 7 8 2 chunks +14 lines, -0 lines 0 comments Download
M src/objects-inl.h View 1 2 3 4 5 6 7 8 3 chunks +16 lines, -0 lines 0 comments Download
M src/objects-printer.cc View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
M src/objects-visiting.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M src/parser.h View 1 2 3 4 5 6 8 3 chunks +16 lines, -5 lines 0 comments Download
M src/parser.cc View 1 2 3 4 5 6 7 8 6 chunks +44 lines, -11 lines 0 comments Download
M src/runtime.h View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M src/runtime.cc View 1 2 3 4 5 6 7 8 1 chunk +25 lines, -0 lines 0 comments Download
D test/mjsunit/harmony/generators-instantiation.js View 1 2 3 4 5 1 chunk +0 lines, -49 lines 0 comments Download
A + test/mjsunit/harmony/generators-objects.js View 1 2 3 4 5 6 1 chunk +20 lines, -1 line 0 comments Download

Messages

Total messages: 22 (0 generated)
wingo
I ended up calling the "generator object" a "generator iterator", to distinguish it from "generator ...
7 years, 8 months ago (2013-04-03 15:37:11 UTC) #1
wingo
https://codereview.chromium.org/13542002/diff/2001/src/x64/full-codegen-x64.cc File src/x64/full-codegen-x64.cc (right): https://codereview.chromium.org/13542002/diff/2001/src/x64/full-codegen-x64.cc#newcode287 src/x64/full-codegen-x64.cc:287: if (function()->is_generator()) { How to communicate this iterator object ...
7 years, 8 months ago (2013-04-03 16:36:24 UTC) #2
wingo
Pushed another patch that links generator definitions and uses through a local variable. Happily this ...
7 years, 8 months ago (2013-04-03 17:51:00 UTC) #3
Michael Starzinger
First round of high-level comment. They are all pretty vague, but the gist of it ...
7 years, 8 months ago (2013-04-08 13:14:05 UTC) #4
wingo
Thanks for the review. I'm reworking some patches but I would like to make sure ...
7 years, 8 months ago (2013-04-09 07:45:32 UTC) #5
rossberg
https://codereview.chromium.org/13542002/diff/5001/src/parser.cc File src/parser.cc (right): https://codereview.chromium.org/13542002/diff/5001/src/parser.cc#newcode1035 src/parser.cc:1035: // For generators, allocate and yield an iterator on ...
7 years, 8 months ago (2013-04-09 09:37:44 UTC) #6
Michael Starzinger
After a longer discussion with Andreas he basically convinced me of the advantages of modelling ...
7 years, 8 months ago (2013-04-09 10:40:13 UTC) #7
wingo
Updated the patch, using the "JSGeneratorObject" name. See the naming discussion in https://codereview.chromium.org/13192004/#msg5 for some ...
7 years, 8 months ago (2013-04-10 10:25:17 UTC) #8
wingo
Rebased to apply to bleeding_edge, so I guess the side-by-side diffs view is the right ...
7 years, 8 months ago (2013-04-11 17:19:42 UTC) #9
wingo
On 2013/04/11 17:19:42, wingo wrote: > Rebased to apply to bleeding_edge, so I guess the ...
7 years, 8 months ago (2013-04-11 17:20:12 UTC) #10
Michael Starzinger
Looking good already, mostly nits. This should be the last round of comments. https://codereview.chromium.org/13542002/diff/33001/src/ast.h File ...
7 years, 8 months ago (2013-04-11 19:17:38 UTC) #11
wingo
Thanks for the review. Updated patch fixes nits. https://codereview.chromium.org/13542002/diff/33001/src/ast.h File src/ast.h (right): https://codereview.chromium.org/13542002/diff/33001/src/ast.h#newcode2967 src/ast.h:2967: Yield* ...
7 years, 8 months ago (2013-04-12 10:50:17 UTC) #12
Michael Starzinger
LGTM. I'll land this.
7 years, 8 months ago (2013-04-12 11:03:58 UTC) #13
Michael Starzinger
As discussed offline, there are still test failures caught by the generator object verification. Will ...
7 years, 8 months ago (2013-04-12 11:32:08 UTC) #14
wingo
On 2013/04/12 11:32:08, Michael Starzinger wrote: > As discussed offline, there are still test failures ...
7 years, 8 months ago (2013-04-12 13:07:41 UTC) #15
wingo
New patch fixes generator construction. There were two bugs. One was that the "this" value ...
7 years, 8 months ago (2013-04-12 16:26:02 UTC) #16
Michael Starzinger
This last patch is going a little bit off-track. There has to be a simpler ...
7 years, 8 months ago (2013-04-12 16:53:31 UTC) #17
wingo
On 2013/04/12 16:53:31, Michael Starzinger wrote: > This last patch is going a little bit ...
7 years, 8 months ago (2013-04-12 18:13:46 UTC) #18
Michael Starzinger
You are right, I totally missed the binding of "this" to the generator when a ...
7 years, 8 months ago (2013-04-14 21:32:50 UTC) #19
wingo
Updated patch to address comments. Apologies for the entropy! https://codereview.chromium.org/13542002/diff/55001/src/objects-debug.cc File src/objects-debug.cc (right): https://codereview.chromium.org/13542002/diff/55001/src/objects-debug.cc#newcode414 src/objects-debug.cc:414: ...
7 years, 8 months ago (2013-04-15 09:24:56 UTC) #20
Michael Starzinger
LGTM again. I'll land this.
7 years, 8 months ago (2013-04-15 12:04:49 UTC) #21
Michael Starzinger
7 years, 8 months ago (2013-04-15 12:30:04 UTC) #22
Message was sent while issue was closed.
Committed patchset #9 manually as r14264 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698