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

Unified Diff: src/full-codegen.cc

Issue 12646003: Add parser support for generators. (Closed) Base URL: git://github.com/v8/v8.git@bleeding_edge
Patch Set: Fix bad initialization list in last preparser commit Created 7 years, 9 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/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index a43f674c33641f1ae9682423494f2c76b9f744e1..f141438ac5e4bbe0b8c4af91eb9b44c62d7618f6 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -232,6 +232,12 @@ void BreakableStatementChecker::VisitAssignment(Assignment* expr) {
}
+void BreakableStatementChecker::VisitYield(Yield* expr) {
+ // Yield is breakable if the expression is.
+ Visit(expr->expression());
+}
+
+
void BreakableStatementChecker::VisitThrow(Throw* expr) {
// Throw is breakable if the expression is.
Visit(expr->exception());
@@ -1537,6 +1543,28 @@ void FullCodeGenerator::VisitSharedFunctionInfoLiteral(
}
+void FullCodeGenerator::VisitYield(Yield* expr) {
+ if (expr->is_delegating_yield())
+ UNIMPLEMENTED();
+
+ Comment cmnt(masm_, "[ Yield");
+ VisitForAccumulatorValue(expr->expression());
+ // TODO(wingo): Assert that the operand stack depth is 0, at least while
+ // general yield expressions are unimplemented.
+
+ // TODO(wingo): What follows is as in VisitReturnStatement. Replace it with a
+ // call to a builtin that will resume the generator.
+ NestedStatement* current = nesting_stack_;
+ int stack_depth = 0;
+ int context_length = 0;
+ while (current != NULL) {
+ current = current->Exit(&stack_depth, &context_length);
+ }
+ __ Drop(stack_depth);
+ EmitReturnSequence();
+}
+
+
void FullCodeGenerator::VisitThrow(Throw* expr) {
Comment cmnt(masm_, "[ Throw");
VisitForStackValue(expr->exception());

Powered by Google App Engine
This is Rietveld 408576698