| 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 d84678040ed3570855ab95e3970df82961bf9944..99b2355583981ebc099834dbc98aa0ab590f0f59 100644
|
| --- a/src/full-codegen/mips/full-codegen-mips.cc
|
| +++ b/src/full-codegen/mips/full-codegen-mips.cc
|
| @@ -1838,7 +1838,7 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| // this. It stays on the stack while we update the iterator.
|
| VisitForStackValue(expr->expression());
|
|
|
| - Label suspend, continuation, post_runtime, resume;
|
| + Label suspend, continuation, post_runtime, resume, exception;
|
|
|
| __ jmp(&suspend);
|
| __ bind(&continuation);
|
| @@ -1847,11 +1847,16 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| // respective resume operation).
|
| __ RecordGeneratorContinuation();
|
| __ pop(a1);
|
| - __ Branch(&resume, ne, a1, Operand(Smi::FromInt(JSGeneratorObject::RETURN)));
|
| - __ push(result_register());
|
| + __ Branch(&resume, eq, a1, Operand(Smi::FromInt(JSGeneratorObject::kNext)));
|
| + __ Push(result_register());
|
| + __ Branch(&exception, eq, a1,
|
| + Operand(Smi::FromInt(JSGeneratorObject::kThrow)));
|
| EmitCreateIteratorResult(true);
|
| EmitUnwindAndReturn();
|
|
|
| + __ bind(&exception);
|
| + __ CallRuntime(Runtime::kThrow);
|
| +
|
| __ bind(&suspend);
|
| OperandStackDepthIncrement(1); // Not popped on this path.
|
| VisitForAccumulatorValue(expr->generator_object());
|
| @@ -1875,103 +1880,6 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| context()->Plug(result_register());
|
| }
|
|
|
| -
|
| -void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
|
| - Expression *value,
|
| - JSGeneratorObject::ResumeMode resume_mode) {
|
| - // The value stays in a0, and is ultimately read by the resumed generator, as
|
| - // if CallRuntime(Runtime::kSuspendJSGeneratorObject) returned it. Or it
|
| - // is read to throw the value when the resumed generator is already closed.
|
| - // a1 will hold the generator object until the activation has been resumed.
|
| - VisitForStackValue(generator);
|
| - VisitForAccumulatorValue(value);
|
| - PopOperand(a1);
|
| -
|
| - // Store input value into generator object.
|
| - __ sw(result_register(),
|
| - FieldMemOperand(a1, JSGeneratorObject::kInputOffset));
|
| - __ mov(a2, result_register());
|
| - __ RecordWriteField(a1, JSGeneratorObject::kInputOffset, a2, a3,
|
| - kRAHasBeenSaved, kDontSaveFPRegs);
|
| -
|
| - // Load suspended function and context.
|
| - __ lw(cp, FieldMemOperand(a1, JSGeneratorObject::kContextOffset));
|
| - __ lw(t0, FieldMemOperand(a1, JSGeneratorObject::kFunctionOffset));
|
| -
|
| - // Load receiver and store as the first argument.
|
| - __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kReceiverOffset));
|
| - __ push(a2);
|
| -
|
| - // Push holes for arguments to generator function. Since the parser forced
|
| - // context allocation for any variables in generators, the actual argument
|
| - // values have already been copied into the context and these dummy values
|
| - // will never be used.
|
| - __ lw(a3, FieldMemOperand(t0, JSFunction::kSharedFunctionInfoOffset));
|
| - __ lw(a3,
|
| - FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset));
|
| - __ LoadRoot(a2, Heap::kTheHoleValueRootIndex);
|
| - Label push_argument_holes, push_frame;
|
| - __ bind(&push_argument_holes);
|
| - __ Subu(a3, a3, Operand(Smi::FromInt(1)));
|
| - __ Branch(&push_frame, lt, a3, Operand(zero_reg));
|
| - __ push(a2);
|
| - __ jmp(&push_argument_holes);
|
| -
|
| - // Enter a new JavaScript frame, and initialize its slots as they were when
|
| - // the generator was suspended.
|
| - Label resume_frame, done;
|
| - __ bind(&push_frame);
|
| - __ Call(&resume_frame);
|
| - __ jmp(&done);
|
| - __ bind(&resume_frame);
|
| - // ra = return address.
|
| - // fp = caller's frame pointer.
|
| - // cp = callee's context,
|
| - // t0 = callee's JS function.
|
| - __ PushStandardFrame(t0);
|
| -
|
| - // Load the operand stack size.
|
| - __ lw(a3, FieldMemOperand(a1, JSGeneratorObject::kOperandStackOffset));
|
| - __ lw(a3, FieldMemOperand(a3, FixedArray::kLengthOffset));
|
| - __ SmiUntag(a3);
|
| -
|
| - // If we are sending a value and there is no operand stack, we can jump back
|
| - // in directly.
|
| - if (resume_mode == JSGeneratorObject::NEXT) {
|
| - Label slow_resume;
|
| - __ Branch(&slow_resume, ne, a3, Operand(zero_reg));
|
| - __ lw(a3, FieldMemOperand(t0, JSFunction::kCodeEntryOffset));
|
| - __ lw(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
|
| - __ SmiUntag(a2);
|
| - __ 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);
|
| - }
|
| -
|
| - // Otherwise, we push holes for the operand stack and call the runtime to fix
|
| - // up the stack and the handlers.
|
| - Label push_operand_holes, call_resume;
|
| - __ bind(&push_operand_holes);
|
| - __ Subu(a3, a3, Operand(1));
|
| - __ Branch(&call_resume, lt, a3, Operand(zero_reg));
|
| - __ 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));
|
| - __ CallRuntime(Runtime::kResumeJSGeneratorObject);
|
| - // Not reached: the runtime call returns elsewhere.
|
| - __ stop("not-reached");
|
| -
|
| - __ bind(&done);
|
| - context()->Plug(result_register());
|
| -}
|
| -
|
| void FullCodeGenerator::PushOperands(Register reg1, Register reg2) {
|
| OperandStackDepthIncrement(2);
|
| __ Push(reg1, reg2);
|
|
|