Status: New
Owner: ----

New issue 3813 by rsturg...@google.com: v8 fails to learn types of bit twiddly function and deopts all over the place
https://code.google.com/p/v8/issues/detail?id=3813

I have a function (see repro below) which turns a pair of 32 bit numbers (representing the low and high parts of a 64 bit int) into a variable length byte encoding.

This function is called by several other functions and ends up inlined all over the place. But this code repeatedly deopts until finally optimizations are disabled (for callers as well as this function, due to the inlining). This is a real bummer.

--------- begin repro

// lowBits and highBits are integers in the range [0, 2^32-1]
function writeVarInt(lowBits, highBits, buff) {
  while (highBits > 0 || lowBits > 127) {
    buff.push((lowBits & 0x7f) | 0x80);
    lowBits = ((lowBits >>> 7) | (highBits << 25)) >>> 0;
    highBits = highBits >>> 7;
  }
  buff.push(lowBits);
}

function writeVarIntHelper(lowBits, highBits, buff) {
  writeVarInt(lowBits, highBits, buff);
}

function test() {
  for (var i = 0; i < 10000; i++) {
    var buff = [];
    writeVarIntHelper(i, 0, buff);
    writeVarIntHelper(0xffffffff, 0xffffffff, buff);
  }
}

for (var j = 0; j < 100; j++) {
  test();
}


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

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

Reply via email to