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

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

Issue 2894293003: Save/restore only live registers in the generator suspend/resume. (Closed)
Patch Set: Tweak Created 3 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/bytecode-analysis.cc ('k') | src/compiler/js-operator.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 14c97c832f18c2e9aa329f44c3e7838c6f31bfd3..d5e3ffd5d05559d316caf92ea91acddb8df1f5cf 100644
--- a/src/compiler/bytecode-graph-builder.cc
+++ b/src/compiler/bytecode-graph-builder.cc
@@ -2277,15 +2277,20 @@ void BytecodeGraphBuilder::VisitSuspendGenerator() {
Node* state = environment()->LookupAccumulator();
Node* generator = environment()->LookupRegister(
bytecode_iterator().GetRegisterOperand(0));
+ interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
+ // We assume we are storing a range starting from index 0.
+ CHECK_EQ(0, first_reg.index());
+ int register_count =
+ static_cast<int>(bytecode_iterator().GetRegisterCountOperand(2));
SuspendFlags flags = interpreter::SuspendGeneratorBytecodeFlags::Decode(
- bytecode_iterator().GetFlagOperand(1));
+ bytecode_iterator().GetFlagOperand(3));
+
// 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);
@@ -2301,21 +2306,31 @@ void BytecodeGraphBuilder::VisitSuspendGenerator() {
value_input_count, value_inputs, false);
}
-void BytecodeGraphBuilder::VisitResumeGenerator() {
+void BytecodeGraphBuilder::VisitRestoreGeneratorState() {
Node* generator = environment()->LookupRegister(
bytecode_iterator().GetRegisterOperand(0));
+ Node* state =
+ NewNode(javascript()->GeneratorRestoreContinuation(), generator);
+
+ environment()->BindAccumulator(state, Environment::kAttachFrameState);
+}
+
+void BytecodeGraphBuilder::VisitRestoreGeneratorRegisters() {
+ Node* generator =
+ environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0));
+ interpreter::Register first_reg = bytecode_iterator().GetRegisterOperand(1);
+ // We assume we are restoring registers starting fromm index 0.
+ CHECK_EQ(0, first_reg.index());
+ int register_count =
+ static_cast<int>(bytecode_iterator().GetRegisterCountOperand(2));
+
// Bijection between registers and array indices must match that used in
// InterpreterAssembler::ExportRegisterFile.
- for (int i = 0; i < environment()->register_count(); ++i) {
+ for (int i = 0; i < register_count; ++i) {
Node* value = NewNode(javascript()->GeneratorRestoreRegister(i), generator);
environment()->BindRegister(interpreter::Register(i), value);
}
-
- Node* state =
- NewNode(javascript()->GeneratorRestoreContinuation(), generator);
-
- environment()->BindAccumulator(state);
}
void BytecodeGraphBuilder::VisitWide() {
« no previous file with comments | « src/compiler/bytecode-analysis.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698