void NonTieredCompPolicy::reset_counter_for_back_branch_event(methodHandle m) {
    // Delay next back-branch event but pump up invocation counter to triger
    // whole method compilation.
    InvocationCounter* i = m->invocation_counter();
    InvocationCounter* b = m->backedge_counter();

    // Don't set invocation_counter's value too low otherwise the method will
    // look like immature (ic < ~5300) which prevents the inlining based on
    // the type profiling.
    i->set(i->state(), CompileThreshold);
    // Don't reset counter too low - it is used to check if OSR method is ready.
    b->set(b->state(), CompileThreshold / 2);
}
void NonTieredCompPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) {
    ScopeDesc* sd = trap_scope;
    for (; !sd->is_top(); sd = sd->sender()) {
        // Reset ICs of inlined methods, since they can trigger compilations also.
        sd->method()->invocation_counter()->reset();
    }
    InvocationCounter* c = sd->method()->invocation_counter();
    if (is_osr) {
        // It was an OSR method, so bump the count higher.
        c->set(c->state(), CompileThreshold);
    } else {
        c->reset();
    }
    sd->method()->backedge_counter()->reset();
}