Generator objects can suspend
authormstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 19 Apr 2013 14:11:23 +0000 (14:11 +0000)
committermstarzinger@chromium.org <mstarzinger@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 19 Apr 2013 14:11:23 +0000 (14:11 +0000)
commit0f348e5592d92700750c57a791a9d64d88e6e3df
treec9558dd2e050458c0a7e94852b62f37fbfbe94f9
parentbc04544f02a0ffc15c9bd9097b622792f9660bc9
Generator objects can suspend

* src/ast.h:
* src/parser.cc: Differentiate between the different kinds of yields, in
  anticipation of boxing return values.  Parse `return' into `yield' in
  a generator.

* src/runtime.h:
* src/runtime.cc (Runtime_SuspendJSGeneratorObject): New horrible
  runtime function: saves continuation, context, and operands into the
  generator object.

* src/arm/full-codegen-arm.cc (VisitYield):
* src/ia32/full-codegen-ia32.cc (VisitYield):
* src/x64/full-codegen-x64.cc (VisitYield): Arrange to call
  SuspendJSGeneratorObject.  If the call returns the hole, we suspend.
  Otherwise we resume.

BUG=v8:2355
TEST=These codepaths are tested when the generator is first invoked, and so
are covered by mjsunit/harmony/generators-objects.js.

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

Patch from Andy Wingo <wingo@igalia.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14353 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
src/arm/full-codegen-arm.cc
src/ast.h
src/full-codegen.cc
src/ia32/full-codegen-ia32.cc
src/objects-inl.h
src/objects.h
src/parser.cc
src/runtime.cc
src/runtime.h
src/x64/full-codegen-x64.cc
test/mjsunit/harmony/generators-parsing.js