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

Unified Diff: src/full-codegen/arm64/full-codegen-arm64.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/arm/full-codegen-arm.cc ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b7f87e12c44acacca830ad554a7101e9ee0ccb3e..71dedb371e4d7a5da303e63431cc2473b523e87b 100644
--- a/src/full-codegen/arm64/full-codegen-arm64.cc
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc
@@ -4343,8 +4343,17 @@ void FullCodeGenerator::VisitYield(Yield* expr) {
// 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();
- __ B(&resume);
+ __ Pop(x1);
+ __ Cmp(x1, Smi::FromInt(JSGeneratorObject::RETURN));
+ __ B(ne, &resume);
+ __ Push(result_register());
+ EmitCreateIteratorResult(true);
+ EmitUnwindBeforeReturn();
+ EmitReturnSequence();
__ Bind(&suspend);
VisitForAccumulatorValue(expr->generator_object());
@@ -4571,6 +4580,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ Mov(x12, Smi::FromInt(JSGeneratorObject::kGeneratorExecuting));
__ Str(x12, FieldMemOperand(generator_object,
JSGeneratorObject::kContinuationOffset));
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
__ Br(x10);
__ Bind(&slow_resume);
@@ -4581,6 +4591,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
__ PushMultipleTimes(the_hole, operand_stack_size);
__ Mov(x10, Smi::FromInt(resume_mode));
+ __ Push(Smi::FromInt(resume_mode)); // Consumed in continuation.
__ Push(generator_object, result_register(), x10);
__ CallRuntime(Runtime::kResumeJSGeneratorObject);
// Not reached: the runtime call returns elsewhere.
« no previous file with comments | « src/full-codegen/arm/full-codegen-arm.cc ('k') | src/full-codegen/full-codegen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698