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

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

Issue 1639343005: [generators] Implement Generator.prototype.return. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@yield-star
Patch Set: Another rebase 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 | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/mips64/full-codegen-mips64.cc
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc
index 576b3dddf7025af6c0a7bb29b5382e331d5e7e52..09146aaf56e6da0683cdc11b30b72f18582f9f0b 100644
--- a/src/full-codegen/mips64/full-codegen-mips64.cc
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc
@@ -1936,8 +1936,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(a1);
+ __ Branch(&resume, ne, a1,
+ Operand(Smi::FromInt(JSGeneratorObject::RETURN)));
+ __ push(result_register());
+ EmitCreateIteratorResult(true);
+ EmitUnwindBeforeReturn();
+ EmitReturnSequence();
__ bind(&suspend);
VisitForAccumulatorValue(expr->generator_object());
@@ -2154,6 +2163,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ Daddu(a3, a3, Operand(a2));
__ li(a2, Operand(Smi::FromInt(JSGeneratorObject::kGeneratorExecuting)));
__ sd(a2, FieldMemOperand(a1, JSGeneratorObject::kContinuationOffset));
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
__ Jump(a3);
__ bind(&slow_resume);
}
@@ -2167,6 +2177,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ 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));
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698