Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index c7264eac851dcbc2a30d71c15ffe95630ab120a1..5629b5cfdb7a5b7c5a8c20e23568071b66296893 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -601,6 +601,14 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode() { |
MakeBytecodeBody(); |
} |
+ // In generator functions, we may not have visited every yield in the AST |
+ // since we skip some obviously dead code. Hence the generated bytecode may |
+ // contain jumps to unbound labels (resume points that will never be used). |
+ // We bind these now. |
+ for (auto& label : generator_resume_points_) { |
+ if (!label.is_bound()) builder()->Bind(&label); |
+ } |
+ |
builder()->EnsureReturn(); |
return builder()->ToBytecodeArray(); |
} |