| Index: src/full-codegen/mips/full-codegen-mips.cc
|
| diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc
|
| index c378f96838202cc4c0136c777370a8a5fd431cc7..1dafb091eb76cc591e10bad3f2cd5e8e0bbb8ce9 100644
|
| --- a/src/full-codegen/mips/full-codegen-mips.cc
|
| +++ b/src/full-codegen/mips/full-codegen-mips.cc
|
| @@ -1926,8 +1926,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(a1);
|
| + __ Branch(&resume, ne, a1,
|
| + Operand(Smi::FromInt(JSGeneratorObject::RETURN)));
|
| + __ push(result_register());
|
| + EmitCreateIteratorResult(true);
|
| + EmitUnwindBeforeReturn();
|
| + EmitReturnSequence();
|
|
|
| __ bind(&suspend);
|
| VisitForAccumulatorValue(expr->generator_object());
|
| @@ -1954,9 +1963,6 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
|
|
| case Yield::kFinal: {
|
| VisitForAccumulatorValue(expr->generator_object());
|
| - __ li(a1, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorClosed)));
|
| - __ sw(a1, FieldMemOperand(result_register(),
|
| - JSGeneratorObject::kContinuationOffset));
|
| // Pop value from top-of-stack slot, box result into result register.
|
| EmitCreateIteratorResult(true);
|
| EmitUnwindBeforeReturn();
|
| @@ -2001,6 +2007,10 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| __ jmp(&l_suspend);
|
| __ bind(&l_continuation);
|
| __ RecordGeneratorContinuation();
|
| + __ pop(a1);
|
| + // TODO(neis): Ignoring the resume mode here is clearly wrong. Currently,
|
| + // return is not supported for yield*. The planned desugaring of yield*
|
| + // using do-expressions will naturally solve this.
|
| __ mov(a0, v0);
|
| __ jmp(&l_resume);
|
|
|
| @@ -2140,6 +2150,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
|
| __ Addu(a3, a3, Operand(a2));
|
| __ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
|
| __ sw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
|
| + __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
|
| __ Jump(a3);
|
| __ bind(&slow_resume);
|
| }
|
| @@ -2153,6 +2164,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
|
| __ push(a2);
|
| __ Branch(&push_operand_holes);
|
| __ bind(&call_resume);
|
| + __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
|
| DCHECK(!result_register().is(a1));
|
| __ Push(a1, result_register());
|
| __ Push(Smi::FromInt(resume_mode));
|
|
|