| Index: runtime/vm/stub_code_x64.cc
|
| diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
|
| index 8d78a52150d1fc3a41259fcfba4b82750d2bd4ab..0b49f5978c34baf945525dcc7fc1ff29b17e9412 100644
|
| --- a/runtime/vm/stub_code_x64.cc
|
| +++ b/runtime/vm/stub_code_x64.cc
|
| @@ -1418,7 +1418,18 @@ void StubCode::GenerateOptimizedUsageCounterIncrement(Assembler* assembler) {
|
| __ popq(func_reg); // Restore.
|
| __ LeaveFrame();
|
| }
|
| + Label is_hot;
|
| + if (FlowGraphCompiler::CanOptimize()) {
|
| + ASSERT(FLAG_optimization_counter_threshold > 1);
|
| + __ cmpq(FieldAddress(func_reg, Function::usage_counter_offset()),
|
| + Immediate(FLAG_optimization_counter_threshold));
|
| + __ j(GREATER_EQUAL, &is_hot, Assembler::kNearJump);
|
| + // As long as VM has no OSR do not optimize in the middle of the function
|
| + // but only at exit so that we have collected all type feedback before
|
| + // optimizing.
|
| + }
|
| __ incq(FieldAddress(func_reg, Function::usage_counter_offset()));
|
| + __ Bind(&is_hot);
|
| }
|
|
|
|
|
| @@ -1429,10 +1440,22 @@ void StubCode::GenerateUsageCounterIncrement(Assembler* assembler,
|
| Register func_reg = temp_reg;
|
| ASSERT(ic_reg != func_reg);
|
| __ movq(func_reg, FieldAddress(ic_reg, ICData::function_offset()));
|
| + Label is_hot;
|
| + if (FlowGraphCompiler::CanOptimize()) {
|
| + ASSERT(FLAG_optimization_counter_threshold > 1);
|
| + // The usage_counter is always less than FLAG_optimization_counter_threshold
|
| + // except when the function gets optimized.
|
| + __ cmpq(FieldAddress(func_reg, Function::usage_counter_offset()),
|
| + Immediate(FLAG_optimization_counter_threshold));
|
| + __ j(EQUAL, &is_hot, Assembler::kNearJump);
|
| + // As long as VM has no OSR do not optimize in the middle of the function
|
| + // but only at exit so that we have collected all type feedback before
|
| + // optimizing.
|
| + }
|
| __ incq(FieldAddress(func_reg, Function::usage_counter_offset()));
|
| + __ Bind(&is_hot);
|
| }
|
|
|
| -
|
| // Generate inline cache check for 'num_args'.
|
| // RBX: Inline cache data object.
|
| // R10: Arguments descriptor array.
|
|
|