I have evidence of what I would call an impossibility, but it's supported 
by explicit logs that came out of running code, so I'm going to believe the 
logs.  This is from v8 12.2, so I'm interested to know whether a) anyone 
has seen anything like this, b) whether there have been any recent fixes in 
this space, c) if not whether anyone knows what might be up.

Thanks,
Daryl.

Code (not the exact code, but functionally equivalent):
  function f(blob) {
    let logs = [];
    let bits = 0;

    function e() {
      bits -= 6;
      logs.push(`e(), bits = ${bits}`);
    }

    blob.bytes() // native function that returns an array of integers
      .forEach(function (byte) {
        logs.push(`bytes forEach #0, bits = ${bits}`);
        bits += 8;
        logs.push(`bytes forEach #1, bits = ${bits}`);
        e();
        logs.push(`bytes forEach #2, bits = ${bits}`);
        if (6 <= bits) {
          logs.push(`bytes forEach #3, bits = ${bits}`);
          e();
          logs.push(`bytes forEach #4, bits = ${bits}`);
        }
      });

    console.log(logs);
  }

and the logs look like:
  <many occurrences where everything is fine>
  bytes forEach #0, bits = 4
  bytes forEach #1, bits = 12
  e(), bits = 6
  bytes forEach #2, bits = 6
  bytes forEach #3, bits = 6
  e(), bits = 0
  bytes forEach #4, bits = 0
  bytes forEach #0, bits = 0
  bytes forEach #1, bits = 8
  e(), bits = 2
  bytes forEach #2, bits = 8  // <- STALE READ!!
  bytes forEach #3, bits = 8  // <- STALE READ!!
  e(), bits = -4              // <- CORRECT READ
  bytes forEach #4, bits = -4 // <- CORRECT READ
  bytes forEach #0, bits = -4 // <- CORRECT READ
  bytes forEach #1, bits = 4  // <- CORRECT READ
  e(), bits = -2              // <- CORRECT READ
  bytes forEach #2, bits = 4  // <- STALE READ!!
  bytes forEach #0, bits = -2 // <- CORRECT READ
  bytes forEach #1, bits = 6  // <- CORRECT READ
  e(), bits = 0               // <- CORRECT READ
  bytes forEach #2, bits = 6  // <- STALE READ!!
  bytes forEach #3, bits = 6  // <- STALE READ!!
  e(), bits = -6              // <- CORRECT READ
  bytes forEach #4, bits = -6 // <- CORRECT READ
  <from this point, logs #2 and #3 are stale every iteration>

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/681a3f93-83be-48c9-ae07-55db28509b9fn%40googlegroups.com.

Reply via email to