Jakob, Thanks very much! It helps a lot.

One more question related to your answer, my understanding about
de-optimization is that it happens during execution time when some guard is
compromised, then the de-opt instruction(s) are invoked. In the
compilation/optimization time, the de-opt instruction(s) are inserted at
potential points.  Is this correct?

I read through the hydrogen.cc and I saw some checkXXX instructions. Are
those also used for the potential de-opt points?

Sincerely,
Amy


On Sun, Apr 14, 2013 at 1:22 PM, Jakob Kummerow <[email protected]>wrote:

> There's no direct relationship between AddSimulate() and
> FinishExitWithDeoptimization(). Both are helper methods to add certain
> HInstructions to the Hydrogen instruction graph.
>
> Simulates are "safe points" or "snapshots" of the compiler's
> "environment", which reflects the execution state of the program, live
> values on the stack and such. Simulates have associated program counter
> addresses in both optimized and unoptimized code that can be translated to
> each other. When a deoptimization happens, execution resumes at the address
> in unoptimized code that corresponds to the last simulate *(or basic
> block entry)* before the deopt point. That's why there must generally be
> a simulate after each instruction with observable side effects, i.e. after
> anything that can't just be skipped or re-executed.
>
> FinishExitWithDeoptimization() is just one of many ways of creating
> potential deoptimization points. Its purpose is situations like "insert an
> instruction to compare the hidden class of this object; if it's class A
> jump to block X which will handle that, if it's B jump to block Y;
> otherwise insert an unconditional Deopt instruction and then finish the
> current block".
>
> "The deoptimization stuff" is tricky business involving replacing the
> current stack of the optimized code with what the unoptimized code expects.
> If you're interested in the details, you should look at the source code.
>
> ICs are not related to deoptimization.
>
>
> On Sun, Apr 14, 2013 at 6:26 AM, Amy <[email protected]> wrote:
>
>> From a google v8 video, I heard that the simulate instruction is for the
>> de-optimization. I went through the code and found out there
>> is AddSimulate() appearing in the BasicBlock, GraphBuilder, and
>> CodeStubGraphBuilder, etc., while FinishExitWithDeoptimize() in the
>> OptimizedGraphBuilder.
>>
>> My feeling is that maybe AddSimulate() is like a setLongJump();
>> while FinishExitWithDeoptimize() will do a longJump(). Is this feeling
>> correct?
>>
>> How the de-optimization stuff work?
>>
>> What about IC related to de-optimization?
>>
>> Thanks very much.
>>
>> --
>> --
>> v8-users mailing list
>> [email protected]
>> 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 [email protected].
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "v8-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/v8-users/gE7UZAw8AMs/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
v8-users mailing list
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to