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

Unified Diff: src/compiler/bytecode-graph-builder.cc

Issue 2622833002: WIP [esnext] implement async iteration proposal (Closed)
Patch Set: simplify AsyncIteratorValueUnwrap Created 3 years, 11 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/compiler/access-builder.cc ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/bytecode-graph-builder.cc
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc
index d22746d9ecbfa8378621b4eef81d13f8da7c09cf..53b013040a6ad76a41bbe4f6a0c349fdc123e8d6 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1874,8 +1874,34 @@ void BytecodeGraphBuilder::VisitSuspendGenerator() {
environment()->LookupRegister(interpreter::Register(i));
}
- MakeNode(javascript()->GeneratorStore(register_count), value_input_count,
- value_inputs, false);
+ MakeNode(javascript()->GeneratorStore(register_count, SuspendType::kYield),
+ value_input_count, value_inputs, false);
+}
+
+void BytecodeGraphBuilder::VisitAwaitGenerator() {
+ Node* state = environment()->LookupAccumulator();
+ Node* generator =
+ environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
+ // The offsets used by the bytecode iterator are relative to a different base
+ // than what is used in the interpreter, hence the addition.
+ Node* offset =
+ jsgraph()->Constant(bytecode_iterator().current_offset() +
+ (BytecodeArray::kHeaderSize - kHeapObjectTag));
+
+ int register_count = environment()->register_count();
+ int value_input_count = 3 + register_count;
+
+ Node** value_inputs = local_zone()->NewArray<Node*>(value_input_count);
+ value_inputs[0] = generator;
+ value_inputs[1] = state;
+ value_inputs[2] = offset;
+ for (int i = 0; i < register_count; ++i) {
+ value_inputs[3 + i] =
+ environment()->LookupRegister(interpreter::Register(i));
+ }
+
+ MakeNode(javascript()->GeneratorStore(register_count, SuspendType::kAwait),
+ value_input_count, value_inputs, false);
}
void BytecodeGraphBuilder::VisitResumeGenerator() {
« no previous file with comments | « src/compiler/access-builder.cc ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698