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

Unified Diff: src/ia32/full-codegen-ia32.cc

Issue 13704010: Generator objects can suspend (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Tighten typing on generator object contexts Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 19989b1c626dd3ea85f6cb9c3c44d7bfab8dffa9..bdff49852c2d900ff3100c6acf5d0e62d770389b 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -1883,6 +1883,46 @@ void FullCodeGenerator::VisitAssignment(Assignment* expr) {
}
+void FullCodeGenerator::VisitYield(Yield* expr) {
+ Comment cmnt(masm_, "[ Yield");
+ // Evaluate yielded value first; the initial iterator definition depends on
+ // this. It stays on the stack while we update the iterator.
+ VisitForStackValue(expr->expression());
+ VisitForStackValue(expr->generator_object());
+
+ if (expr->kind() == Yield::FINAL) {
Michael Starzinger 2013/04/17 13:43:48 For the record: I think it will be best to just pa
+ // TODO(wingo): Mark the iterator as closed.
+ } else {
+ __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
+ __ mov(context_register(),
+ Operand(ebp, StandardFrameConstants::kContextOffset));
+ }
+
+ Label resume;
+ __ CompareRoot(result_register(), Heap::kTheHoleValueRootIndex);
+ __ j(not_equal, &resume);
+ switch (expr->kind()) {
+ case Yield::INITIAL:
+ __ pop(result_register());
+ break;
+ case Yield::SUSPEND:
+ // TODO(wingo): Box into { value: VALUE, done: false }.
+ __ pop(result_register());
+ break;
+ case Yield::FINAL:
+ // TODO(wingo): Box into { value: VALUE, done: true }.
+ __ pop(result_register());
+ break;
+ case Yield::DELEGATING:
+ UNIMPLEMENTED();
+ }
+ EmitReturnSequence();
+
+ __ bind(&resume);
+ context()->Plug(result_register());
+}
+
+
void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
SetSourcePosition(prop->position());
Literal* key = prop->key()->AsLiteral();

Powered by Google App Engine
This is Rietveld 408576698