Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index ca533df2c88578dd8708b649949145a4e7d76fb8..bd0b74284e4cfb17c709edd97dc9e7170769d4d9 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -8530,16 +8530,11 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) { |
if (args.length() == 2 && |
unoptimized->kind() == Code::FUNCTION) { |
CONVERT_ARG_HANDLE_CHECKED(String, type, 1); |
- if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr"))) { |
+ if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("osr")) && FLAG_use_osr) { |
// Start patching from the currently patched loop nesting level. |
- int current_level = unoptimized->allow_osr_at_loop_nesting_level(); |
- ASSERT(BackEdgeTable::Verify(isolate, unoptimized, current_level)); |
- if (FLAG_use_osr) { |
- for (int i = current_level + 1; i <= Code::kMaxLoopNestingMarker; i++) { |
- unoptimized->set_allow_osr_at_loop_nesting_level(i); |
- isolate->runtime_profiler()->AttemptOnStackReplacement(*function); |
- } |
- } |
+ ASSERT(BackEdgeTable::Verify(isolate, unoptimized)); |
+ isolate->runtime_profiler()->AttemptOnStackReplacement( |
+ *function, Code::kMaxLoopNestingMarker); |
} else if (type->IsOneByteEqualTo(STATIC_ASCII_VECTOR("concurrent")) && |
isolate->concurrent_recompilation_enabled()) { |
function->MarkForConcurrentOptimization(); |