Index: src/interpreter/control-flow-builders.cc |
diff --git a/src/interpreter/control-flow-builders.cc b/src/interpreter/control-flow-builders.cc |
index 56cd481f9cdd50c36e3cc2045a4aaa78ecf309e1..0e71b96cce7b09e1b4b4a6ac663637ddca3a1364 100644 |
--- a/src/interpreter/control-flow-builders.cc |
+++ b/src/interpreter/control-flow-builders.cc |
@@ -60,18 +60,14 @@ void LoopBuilder::LoopHeader(ZoneVector<BytecodeLabel>* additional_labels) { |
} |
} |
-void LoopBuilder::JumpToHeader() { |
+void LoopBuilder::JumpToHeader(int loop_depth) { |
+ // Pass the proper loop nesting level to the backwards branch, to trigger |
+ // on-stack replacement when armed for the given loop nesting depth. |
+ int level = Min(loop_depth, AbstractCode::kMaxLoopNestingMarker - 1); |
// Loop must have closed form, i.e. all loop elements are within the loop, |
// the loop header precedes the body and next elements in the loop. |
DCHECK(loop_header_.is_bound()); |
- builder()->Jump(&loop_header_); |
-} |
- |
-void LoopBuilder::JumpToHeaderIfTrue() { |
- // Loop must have closed form, i.e. all loop elements are within the loop, |
- // the loop header precedes the body and next elements in the loop. |
- DCHECK(loop_header_.is_bound()); |
- builder()->JumpIfTrue(&loop_header_); |
+ builder()->JumpLoop(&loop_header_, level); |
} |
void LoopBuilder::EndLoop() { |