On Fri, Mar 13, 2015 at 6:14 PM, Malek Musleh <malek.mus...@gmail.com> wrote:
> Hi,
>
> I am trying to get a better understanding of when the OSR optimization
> is invoked. As per my understanding, CrankShaft is only invoked for
> functions which have been seen at least 2, based on the parameter
> kProfilerTicksBeforeOptimization = 2 in runtime-profiler.cc. But
> because there might be functions that get invoked only once, because
> they may be "long running", there is opportunity for optimizing the
> long running function via on stack replacement.
>
> My specific question is how does the runtime profiler determine if the
> function in question is "long enough" to attempt OSR? I can see OSR is
> not attempted if there are too many formal parameters, but not where
> it is decided that it passes the checks?
>
>
> Malek

If I understand your question right: V8 inserts checks in function
prologs and around loop edges where it calls into the run-time.[0]  If
the run-time sees the same JS function at the top of the stack several
times in a row, and if that function meets all criteria, it will
optimize it.

Hope that helps.  Let me know if I need to go into more detail.

[0]  That's the "call StackCheck" and "call InterruptCheck"
instructions you see in the generated machine code.  The stack check
doubles as an interrupt check.

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to