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()); |