| Index: src/mips/full-codegen-mips.cc
|
| diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
|
| index 56c6dee8478df6cd7ad5c20fa564ad247c2afaa8..f8af6611d86998f9f670f3602f77743d4516c577 100644
|
| --- a/src/mips/full-codegen-mips.cc
|
| +++ b/src/mips/full-codegen-mips.cc
|
| @@ -2035,6 +2035,19 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| EmitReturnSequence();
|
|
|
| __ bind(&resume);
|
| + Label init_value_check_done;
|
| + if (expr->yield_kind() == Yield::INITIAL) {
|
| + // When value is provided and it is not undefined, throw error.
|
| + __ LoadRoot(a1, Heap::kUndefinedValueRootIndex);
|
| + __ Branch(&init_value_check_done, eq, result_register(), Operand(a1));
|
| + // This error should be raised from the Generator.prototype.next side.
|
| + // So in this case, we return the hole value as a marker. The caller
|
| + // checks the result value and if it is the hole value, the caller
|
| + // throws error.
|
| + __ Push(isolate()->factory()->the_hole_value());
|
| + __ jmp(&suspend);
|
| + }
|
| + __ bind(&init_value_check_done);
|
| context()->Plug(result_register());
|
| break;
|
| }
|
| @@ -2257,7 +2270,17 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
|
| __ push(a1);
|
| __ CallRuntime(Runtime::kThrowGeneratorStateError, 1);
|
|
|
| + // Throw error if we attempt to pass a value to an unborn generator.
|
| + Label wrong_start;
|
| + __ bind(&wrong_start);
|
| + __ CallRuntime(Runtime::kThrowGeneratorStartError, 0);
|
| +
|
| __ bind(&done);
|
| + // When a value is passed to an unborn generator, the result becomes the hole
|
| + // value. And we need to throw GeneratorStartError in the caller side.
|
| + // (Generator.prototype.next)
|
| + __ LoadRoot(a2, Heap::kTheHoleValueRootIndex);
|
| + __ Branch(&wrong_start, eq, result_register(), Operand(a2));
|
| context()->Plug(result_register());
|
| }
|
|
|
|
|