Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ul> <li>In V8 <code>null</code>, <code>undefined</code>, <code>true</code> and <code>false</code> internally are <a href="https://github.com/v8/v8/blob/c736a452575f406c9a05a8c202b0708cb60d43e5/src/objects.h#L9368" rel="nofollow noreferrer">heap allocated objects</a>. If you are comming from Java you can say that <code>true</code> and <code>false</code> in V8 are more like <code>Boolean.TRUE</code> and <code>Boolean.FALSE</code> in Java.</li> <li>There is an important difference between <em>real</em> local variables and variables that are captured by closures or shadowed by eval/with. Captures variables are stored in a special heap allocated structure called <a href="http://code.google.com/p/v8/source/browse/trunk/src/contexts.h?r=12394#165" rel="nofollow noreferrer">Context</a> and are accessed indirectly. For more details about <em>real</em> vs. context allocates variables see <a href="https://stackoverflow.com/questions/5326300/garbage-collection-with-node-js/5328761#5328761">my answer to a different question</a></li> <li><p>V8 has two compilers: non-optimizing (aka full) and optimizing one:</p> <ul> <li>Non-optimizing compiler can't store floating point numbers and integers beyond 31-bit (32-bit on x64) on the stack it always boxes them into <a href="http://code.google.com/p/v8/source/browse/trunk/src/objects.h?r=12408#1297" rel="nofollow noreferrer">HeapNumber</a>s. It does not try to do register allocation and stores <em>real</em> local variables on the stack.</li> <li>Optimizing compiler is much smarter. It does register allocation (linear scan) and can keep full 32-bit integers and floating point numbers on the stack and in the registers (including XMM registers).</li> </ul></li> <li><p>Speaking of JVM: it can perform so called <em>stack allocation</em> and allocate a non-escaping object on the stack instead of the heap. A more generic optimization (<em>scalar replacement</em>) can sometimes completely eliminate allocation of non-escaping object and explode it into separate fields.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload