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

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

Issue 1991203002: [generators] Replace some runtime functions with Turbofan JS operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/graph-reducer.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 22299de3b83af5ff0c7f77efe729b39f36ab0dda..74120095a4f71b73b406133c6cccaa18fd5c143d 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -1377,15 +1377,19 @@ void BytecodeGraphBuilder::VisitSuspendGenerator() {
Node* generator = environment()->LookupRegister(
bytecode_iterator().GetRegisterOperand(0));
- for (int i = 0; i < environment()->register_count(); ++i) {
- Node* value = environment()->LookupRegister(interpreter::Register(i));
- NewNode(javascript()->CallRuntime(Runtime::kGeneratorStoreRegister),
- generator, jsgraph()->Constant(i), value);
+ int register_count = environment()->register_count();
+ int value_input_count = 2 + register_count;
+
+ Node** value_inputs = local_zone()->NewArray<Node*>(value_input_count);
+ value_inputs[0] = generator;
+ value_inputs[1] = state;
+ for (int i = 0; i < register_count; ++i) {
+ value_inputs[2 + i] =
+ environment()->LookupRegister(interpreter::Register(i));
}
- NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContext), generator);
- NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation),
- generator, state);
+ MakeNode(javascript()->GeneratorStore(register_count), value_input_count,
+ value_inputs, false);
}
void BytecodeGraphBuilder::VisitResumeGenerator() {
@@ -1393,23 +1397,16 @@ void BytecodeGraphBuilder::VisitResumeGenerator() {
Node* generator = environment()->LookupRegister(
bytecode_iterator().GetRegisterOperand(0));
- Node* state = NewNode(javascript()->CallRuntime(
- Runtime::kGeneratorGetContinuation), generator);
// Bijection between registers and array indices must match that used in
// InterpreterAssembler::ExportRegisterFile.
for (int i = 0; i < environment()->register_count(); ++i) {
- Node* value = NewNode(
- javascript()->CallRuntime(Runtime::kGeneratorLoadRegister),
- generator, jsgraph()->Constant(i));
+ Node* value = NewNode(javascript()->GeneratorRestoreRegister(i), generator);
environment()->BindRegister(interpreter::Register(i), value);
-
- NewNode(javascript()->CallRuntime(Runtime::kGeneratorStoreRegister),
- generator, jsgraph()->Constant(i), jsgraph()->StaleRegisterConstant());
}
- NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation),
- generator, jsgraph()->Constant(JSGeneratorObject::kGeneratorExecuting));
+ Node* state =
+ NewNode(javascript()->GeneratorRestoreContinuation(), generator);
environment()->BindAccumulator(state, &states);
}
« no previous file with comments | « src/compiler/access-builder.cc ('k') | src/compiler/graph-reducer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698