Index: src/full-codegen/x87/full-codegen-x87.cc |
diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc |
index 664f1d4b842d44de9e09ea52e3e0044efc2e67b8..1360a21e767f1128a95d7b106291170239c4ccfc 100644 |
--- a/src/full-codegen/x87/full-codegen-x87.cc |
+++ b/src/full-codegen/x87/full-codegen-x87.cc |
@@ -1758,64 +1758,44 @@ 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(ebx); |
- __ cmp(ebx, Immediate(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())); |
- __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
- Immediate(Smi::FromInt(continuation.pos()))); |
- __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
- __ mov(ecx, esi); |
- __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
- kDontSaveFPRegs); |
- __ lea(ebx, Operand(ebp, StandardFrameConstants::kExpressionsOffset)); |
- __ cmp(esp, ebx); |
- __ j(equal, &post_runtime); |
- __ push(eax); // generator object |
- __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
- __ mov(context_register(), |
- Operand(ebp, 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(ebx); |
+ __ cmp(ebx, Immediate(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())); |
+ __ mov(FieldOperand(eax, JSGeneratorObject::kContinuationOffset), |
+ Immediate(Smi::FromInt(continuation.pos()))); |
+ __ mov(FieldOperand(eax, JSGeneratorObject::kContextOffset), esi); |
+ __ mov(ecx, esi); |
+ __ RecordWriteField(eax, JSGeneratorObject::kContextOffset, ecx, edx, |
+ kDontSaveFPRegs); |
+ __ lea(ebx, Operand(ebp, StandardFrameConstants::kExpressionsOffset)); |
+ __ cmp(esp, ebx); |
+ __ j(equal, &post_runtime); |
+ __ push(eax); // generator object |
+ __ CallRuntime(Runtime::kSuspendJSGeneratorObject, 1); |
+ __ mov(context_register(), |
+ Operand(ebp, StandardFrameConstants::kContextOffset)); |
+ __ bind(&post_runtime); |
+ PopOperand(result_register()); |
+ EmitReturnSequence(); |
+ |
+ __ bind(&resume); |
+ context()->Plug(result_register()); |
} |