Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 5fb120def80393b05a29466908ad279c33e77b1f..8369b65ea2c9f6c0863531dc336b1858ab1a564e 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -714,6 +714,16 @@ void BytecodeGenerator::VisitIterationHeader(IterationStatement* stmt, |
loop_builder->LoopHeader(&resume_points_in_loop); |
+ // Insert an explicit {OsrPoll} right after the loop header, to trigger |
+ // on-stack replacement when armed for the given loop nesting depth. |
+ if (FLAG_ignition_osr) { |
+ // TODO(4764): Merge this with another bytecode (e.g. {Jump} back edge). |
+ // TODO(4764): Investigate interaction with generators. |
+ // TODO(4764): Track and pass correct loop depth. |
+ DCHECK_EQ(0, stmt->yield_count()); |
+ builder()->OsrPoll(0); |
+ } |
+ |
if (stmt->yield_count() > 0) { |
// If we are not resuming, fall through to loop body. |
// If we are resuming, perform state dispatch. |