Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: src/full-codegen/x87/full-codegen-x87.cc

Issue 1671783002: X87: [generators] Implement Generator.prototype.return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d0e0b3d52e74e23320d9256d8ee6268eea888ce3..a035fff72d69698cad1644252770a214075104e5 100644
--- a/src/full-codegen/x87/full-codegen-x87.cc
+++ b/src/full-codegen/x87/full-codegen-x87.cc
@@ -1842,8 +1842,17 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
__ 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();
- __ jmp(&resume);
+ __ pop(ebx);
+ __ cmp(ebx, Immediate(Smi::FromInt(JSGeneratorObject::RETURN)));
+ __ j(not_equal, &resume);
+ __ push(result_register());
+ EmitCreateIteratorResult(true);
+ EmitUnwindBeforeReturn();
+ EmitReturnSequence();
__ bind(&suspend);
VisitForAccumulatorValue(expr->generator_object());
@@ -2004,8 +2013,8 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
// Store input value into generator object.
__ mov(FieldOperand(ebx, JSGeneratorObject::kInputOffset), result_register());
- __ mov(edx, result_register());
- __ RecordWriteField(ebx, JSGeneratorObject::kInputOffset, edx, ecx,
+ __ mov(ecx, result_register());
+ __ RecordWriteField(ebx, JSGeneratorObject::kInputOffset, ecx, edx,
kDontSaveFPRegs);
// Load suspended function and context.
@@ -2056,6 +2065,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ add(edx, ecx);
__ mov(FieldOperand(ebx, JSGeneratorObject::kContinuationOffset),
Immediate(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
__ jmp(edx);
__ bind(&slow_resume);
}
@@ -2069,6 +2079,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ push(ecx);
__ jmp(&push_operand_holes);
__ bind(&call_resume);
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
__ push(ebx);
__ push(result_register());
__ Push(Smi::FromInt(resume_mode));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698