Index: src/compiler/bytecode-graph-builder.cc |
diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc |
index a7b39c209ebb2d1b3fd1094f9cd18131b34b757a..8fb7b69f403ea6cfe7e8a02af70a7a983044675a 100644 |
--- a/src/compiler/bytecode-graph-builder.cc |
+++ b/src/compiler/bytecode-graph-builder.cc |
@@ -1367,11 +1367,45 @@ void BytecodeGraphBuilder::VisitForInStep() { |
} |
void BytecodeGraphBuilder::VisitSuspendGenerator() { |
- UNIMPLEMENTED(); |
+ Node* state = environment()->LookupAccumulator(); |
+ 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); |
+ } |
+ |
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContext), generator); |
+ NewNode(javascript()->CallRuntime(Runtime::kGeneratorSetContinuation), |
+ generator, state); |
} |
void BytecodeGraphBuilder::VisitResumeGenerator() { |
- UNIMPLEMENTED(); |
+ FrameStateBeforeAndAfter states(this); |
+ |
+ 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)); |
+ 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)); |
+ |
+ environment()->BindAccumulator(state, &states); |
} |
void BytecodeGraphBuilder::VisitWide() { |
@@ -1385,8 +1419,8 @@ void BytecodeGraphBuilder::VisitExtraWide() { |
} |
void BytecodeGraphBuilder::VisitIllegal() { |
- // Never present in valid bytecode. |
- UNREACHABLE(); |
+ NewNode(javascript()->CallRuntime(Runtime::kAbort), |
+ jsgraph()->Constant(kIllegalBytecode)); |
} |
void BytecodeGraphBuilder::SwitchToMergeEnvironment(int current_offset) { |