title: How this piece of ASM.js code should be evaluated by the engine?
body: <p>According to the spec, the type &quot;int&quot; in ASM.js does not have signedness.</p>
  <blockquote>
  <p>The int type is the type of 32-bit integers where the signedness is not known. In asm.js, the type of a variable never has a known signedness. This allows them to be compiled as 32-bit integer registers and memory words. However, this representation creates an overlap between signed and unsigned numbers that causes an ambiguity in determining which JavaScript number they represent. For example, the bit pattern 0xffffffff could represent 4294967295 or -1, depending on the signedness. For this reason, values of the int type are disallowed from escaping into external (non-asm.js) JavaScript code.</p>
  </blockquote>
  <p>So how does the engine evaluate the following piece of ASM.js code? Since the result could be different if the parameters x and y have different signedness. How can we generate AOT code for it?</p>
  <pre><code>function foo(start, end) {
    start = start|0;  // start is int.
    end = end|0;  // start is int.
  
    return +((end - start)|0);
  }
  </code></pre>