| Index: runtime/vm/intermediate_language_x64.cc
|
| diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
|
| index ce0e77830cc73faeb7de4c7330780391facc2fdf..abda1da081e185f3ed9ce1e14354b62109cc043c 100644
|
| --- a/runtime/vm/intermediate_language_x64.cc
|
| +++ b/runtime/vm/intermediate_language_x64.cc
|
| @@ -2139,10 +2139,13 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| __ j(BELOW_EQUAL, slow_path->entry_label());
|
| if (compiler->CanOSRFunction() && in_loop()) {
|
| // In unoptimized code check the usage counter to trigger OSR at loop
|
| - // stack checks.
|
| + // stack checks. Use progressively higher thresholds for more deeply
|
| + // nested loops to attempt to hit outer loops with OSR when possible.
|
| __ LoadObject(temp, compiler->parsed_function().function());
|
| + intptr_t threshold =
|
| + FLAG_optimization_counter_threshold * (loop_depth() + 1);
|
| __ cmpq(FieldAddress(temp, Function::usage_counter_offset()),
|
| - Immediate(2 * FLAG_optimization_counter_threshold));
|
| + Immediate(threshold));
|
| __ j(GREATER_EQUAL, slow_path->entry_label());
|
| }
|
| __ Bind(slow_path->exit_label());
|
|
|