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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1904933002: Introduce bytecodes for assisting generator suspend and resume. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nix Created 4 years, 8 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/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 71e9eefd17fa76831a0669c5e98c5ff29bffa650..ba5b97d254e84a06e2757fa5d2840467737c7818 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -644,8 +644,7 @@ void BytecodeGenerator::VisitGeneratorPrologue() {
RegisterAllocationScope register_scope(this);
Register state = register_allocator()->NewRegister();
builder()
- ->CallRuntime(Runtime::kResumeIgnitionGenerator, Register::new_target(),
- 1)
+ ->ResumeGenerator(Register::new_target())
.StoreAccumulatorInRegister(state);
// TODO(neis): Optimize this by using a proper jump table.
@@ -2218,16 +2217,12 @@ void BytecodeGenerator::VisitYield(Yield* expr) {
builder()->SetExpressionPosition(expr);
Register value = VisitForRegisterValue(expr->expression());
- register_allocator()->PrepareForConsecutiveAllocations(2);
- Register generator = register_allocator()->NextConsecutiveRegister();
- Register state = register_allocator()->NextConsecutiveRegister();
+ Register generator = VisitForRegisterValue(expr->generator_object());
// Save context, registers, and state. Then return.
- VisitForRegisterValue(expr->generator_object(), generator);
builder()
->LoadLiteral(Smi::FromInt(id))
- .StoreAccumulatorInRegister(state)
- .CallRuntime(Runtime::kSuspendIgnitionGenerator, generator, 2)
+ .SuspendGenerator(generator)
.LoadAccumulatorWithRegister(value)
.Return(); // Hard return (ignore any finally blocks).
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698