| Index: src/full-codegen/arm64/full-codegen-arm64.cc
|
| diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc
|
| index de16f16a54821df31770ed30503b4f8751902f3f..4b36d45b435b956852a125fb194d69f98ce8f07f 100644
|
| --- a/src/full-codegen/arm64/full-codegen-arm64.cc
|
| +++ b/src/full-codegen/arm64/full-codegen-arm64.cc
|
| @@ -3822,66 +3822,46 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
|
| // and suchlike. The implementation changes a little by bleeding_edge so I
|
| // don't want to spend too much time on it now.
|
|
|
| - 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;
|
| -
|
| - __ B(&suspend);
|
| - // TODO(jbramley): This label is bound here because the following code
|
| - // looks at its pos(). Is it possible to do something more efficient here,
|
| - // perhaps using Adr?
|
| - __ 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(x1);
|
| - __ Cmp(x1, Smi::FromInt(JSGeneratorObject::RETURN));
|
| - __ B(ne, &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()));
|
| - __ Mov(x1, Smi::FromInt(continuation.pos()));
|
| - __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset));
|
| - __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset));
|
| - __ Mov(x1, cp);
|
| - __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2,
|
| - kLRHasBeenSaved, kDontSaveFPRegs);
|
| - __ Add(x1, fp, StandardFrameConstants::kExpressionsOffset);
|
| - __ Cmp(__ StackPointer(), x1);
|
| - __ B(eq, &post_runtime);
|
| - __ Push(x0); // generator object
|
| - __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
|
| - __ Ldr(cp, MemOperand(fp, 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;
|
| - }
|
| + Label suspend, continuation, post_runtime, resume;
|
| +
|
| + __ B(&suspend);
|
| + // TODO(jbramley): This label is bound here because the following code
|
| + // looks at its pos(). Is it possible to do something more efficient here,
|
| + // perhaps using Adr?
|
| + __ 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(x1);
|
| + __ Cmp(x1, Smi::FromInt(JSGeneratorObject::RETURN));
|
| + __ B(ne, &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()));
|
| + __ Mov(x1, Smi::FromInt(continuation.pos()));
|
| + __ Str(x1, FieldMemOperand(x0, JSGeneratorObject::kContinuationOffset));
|
| + __ Str(cp, FieldMemOperand(x0, JSGeneratorObject::kContextOffset));
|
| + __ Mov(x1, cp);
|
| + __ RecordWriteField(x0, JSGeneratorObject::kContextOffset, x1, x2,
|
| + kLRHasBeenSaved, kDontSaveFPRegs);
|
| + __ Add(x1, fp, StandardFrameConstants::kExpressionsOffset);
|
| + __ Cmp(__ StackPointer(), x1);
|
| + __ B(eq, &post_runtime);
|
| + __ Push(x0); // generator object
|
| + __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1);
|
| + __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
|
| + __ Bind(&post_runtime);
|
| + PopOperand(result_register());
|
| + EmitReturnSequence();
|
|
|
| - case Yield::kDelegating:
|
| - UNREACHABLE();
|
| - }
|
| + __ Bind(&resume);
|
| + context()->Plug(result_register());
|
| }
|
|
|
|
|
|
|