Index: src/runtime/runtime-generator.cc |
diff --git a/src/runtime/runtime-generator.cc b/src/runtime/runtime-generator.cc |
index 54894a013a624d287fe4efe03e04bbc678410527..2999062d14c3ba2d5d8b8d4c38149f3e9e734db1 100644 |
--- a/src/runtime/runtime-generator.cc |
+++ b/src/runtime/runtime-generator.cc |
@@ -87,9 +87,9 @@ RUNTIME_FUNCTION(Runtime_SuspendJSGeneratorObject) { |
// called if the suspended activation had operands on the stack, stack handlers |
// needing rewinding, or if the resume should throw an exception. The fast path |
// is handled directly in FullCodeGenerator::EmitGeneratorResume(), which is |
-// inlined into GeneratorNext and GeneratorThrow. EmitGeneratorResumeResume is |
-// called in any case, as it needs to reconstruct the stack frame and make space |
-// for arguments and operands. |
+// inlined into GeneratorNext, GeneratorReturn, and GeneratorThrow. |
+// EmitGeneratorResume is called in any case, as it needs to reconstruct the |
+// stack frame and make space for arguments and operands. |
RUNTIME_FUNCTION(Runtime_ResumeJSGeneratorObject) { |
SealHandleScope shs(isolate); |
DCHECK(args.length() == 3); |
@@ -125,7 +125,10 @@ RUNTIME_FUNCTION(Runtime_ResumeJSGeneratorObject) { |
JSGeneratorObject::ResumeMode resume_mode = |
static_cast<JSGeneratorObject::ResumeMode>(resume_mode_int); |
switch (resume_mode) { |
+ // Note: this looks like NEXT and RETURN are the same but RETURN receives |
+ // special treatment in the generator code (to which we return here). |
case JSGeneratorObject::NEXT: |
+ case JSGeneratorObject::RETURN: |
return value; |
case JSGeneratorObject::THROW: |
return isolate->Throw(value); |
@@ -212,6 +215,12 @@ RUNTIME_FUNCTION(Runtime_GeneratorNext) { |
} |
+RUNTIME_FUNCTION(Runtime_GeneratorReturn) { |
+ UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
+ return NULL; |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_GeneratorThrow) { |
UNREACHABLE(); // Optimization disabled in SetUpGenerators(). |
return NULL; |