| Index: src/full-codegen/x64/full-codegen-x64.cc
|
| diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc
|
| index c920fab2c5cff6a3e359b113f17c5b44a6ee602b..267ae73ece52a3ba53fdefe0ad427d65a29ba07b 100644
|
| --- a/src/full-codegen/x64/full-codegen-x64.cc
|
| +++ b/src/full-codegen/x64/full-codegen-x64.cc
|
| @@ -1789,65 +1789,45 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| // this. It stays on the stack while we update the iterator.
|
| VisitForStackValue(expr->expression());
|
|
|
| - switch (expr->yield_kind()) {
|
| - case Yield::kSuspend:
|
| - // Pop value from top-of-stack slot; box result into result register.
|
| - EmitCreateIteratorResult(false);
|
| - PushOperand(result_register());
|
| - // Fall through.
|
| - case Yield::kInitial: {
|
| - Label suspend, continuation, post_runtime, resume;
|
| -
|
| - __ 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();
|
| - __ Pop(rbx);
|
| - __ SmiCompare(rbx, Smi::FromInt(JSGeneratorObject::RETURN));
|
| - __ j(not_equal, &resume);
|
| - __ Push(result_register());
|
| - EmitCreateIteratorResult(true);
|
| - EmitUnwindAndReturn();
|
| -
|
| - __ bind(&suspend);
|
| - OperandStackDepthIncrement(1); // Not popped on this path.
|
| - VisitForAccumulatorValue(expr->generator_object());
|
| - DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
|
| - __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset),
|
| - Smi::FromInt(continuation.pos()));
|
| - __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi);
|
| - __ movp(rcx, rsi);
|
| - __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx,
|
| - kDontSaveFPRegs);
|
| - __ leap(rbx, Operand(rbp, StandardFrameConstants::kExpressionsOffset));
|
| - __ cmpp(rsp, rbx);
|
| - __ j(equal, &post_runtime);
|
| - __ Push(rax); // generator object
|
| - __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
|
| - __ movp(context_register(),
|
| - Operand(rbp, StandardFrameConstants::kContextOffset));
|
| - __ bind(&post_runtime);
|
| -
|
| - PopOperand(result_register());
|
| - EmitReturnSequence();
|
| -
|
| - __ bind(&resume);
|
| - context()->Plug(result_register());
|
| - break;
|
| - }
|
| -
|
| - case Yield::kFinal: {
|
| - // Pop value from top-of-stack slot, box result into result register.
|
| - EmitCreateIteratorResult(true);
|
| - EmitUnwindAndReturn();
|
| - break;
|
| - }
|
| -
|
| - case Yield::kDelegating:
|
| - UNREACHABLE();
|
| - }
|
| + Label suspend, continuation, post_runtime, resume;
|
| +
|
| + __ 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();
|
| + __ Pop(rbx);
|
| + __ SmiCompare(rbx, Smi::FromInt(JSGeneratorObject::RETURN));
|
| + __ j(not_equal, &resume);
|
| + __ Push(result_register());
|
| + EmitCreateIteratorResult(true);
|
| + EmitUnwindAndReturn();
|
| +
|
| + __ bind(&suspend);
|
| + OperandStackDepthIncrement(1); // Not popped on this path.
|
| + VisitForAccumulatorValue(expr->generator_object());
|
| + DCHECK(continuation.pos() > 0 && Smi::IsValid(continuation.pos()));
|
| + __ Move(FieldOperand(rax, JSGeneratorObject::kContinuationOffset),
|
| + Smi::FromInt(continuation.pos()));
|
| + __ movp(FieldOperand(rax, JSGeneratorObject::kContextOffset), rsi);
|
| + __ movp(rcx, rsi);
|
| + __ RecordWriteField(rax, JSGeneratorObject::kContextOffset, rcx, rdx,
|
| + kDontSaveFPRegs);
|
| + __ leap(rbx, Operand(rbp, StandardFrameConstants::kExpressionsOffset));
|
| + __ cmpp(rsp, rbx);
|
| + __ j(equal, &post_runtime);
|
| + __ Push(rax); // generator object
|
| + __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
|
| + __ movp(context_register(),
|
| + Operand(rbp, StandardFrameConstants::kContextOffset));
|
| + __ bind(&post_runtime);
|
| +
|
| + PopOperand(result_register());
|
| + EmitReturnSequence();
|
| +
|
| + __ bind(&resume);
|
| + context()->Plug(result_register());
|
| }
|
|
|
|
|
|
|