Index: src/full-codegen/ia32/full-codegen-ia32.cc |
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc |
index add71bc879454a9baad036d0a656f972b7f64dce..bf5aceec4dbb6f2e4e72212bb182b02aa8618841 100644 |
--- a/src/full-codegen/ia32/full-codegen-ia32.cc |
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc |
@@ -1846,8 +1846,17 @@ void FullCodeGenerator::VisitYield(Yield* expr) { |
__ jmp(&suspend); |
__ bind(&continuation); |
+ // When we arrive here, the stack top is the resume mode and |
+ // result_register() holds the input value (the argument given to the |
+ // respective resume operation). |
__ RecordGeneratorContinuation(); |
- __ jmp(&resume); |
+ __ pop(ebx); |
+ __ cmp(ebx, Immediate(Smi::FromInt(JSGeneratorObject::RETURN))); |
+ __ j(not_equal, &resume); |
+ __ push(result_register()); |
+ EmitCreateIteratorResult(true); |
+ EmitUnwindBeforeReturn(); |
+ EmitReturnSequence(); |
__ bind(&suspend); |
VisitForAccumulatorValue(expr->generator_object()); |
@@ -2060,6 +2069,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
__ add(edx, ecx); |
__ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset), |
Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting))); |
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation. |
__ jmp(edx); |
__ bind(&slow_resume); |
} |
@@ -2073,6 +2083,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, |
__ push(ecx); |
__ jmp(&push_operand_holes); |
__ bind(&call_resume); |
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation. |
__ push(ebx); |
__ push(result_register()); |
__ Push(Smi::FromInt(resume_mode)); |