-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug on array spread operator on NodeJS 6.10.0 with --optimize_for_size #11545
Comments
I could reproduce it on:
v7.6.0 seems to be unaffacted.
|
/cc @nodejs/v8 |
The error was caused by a bug on NodeJS 6.9.5 (possibly 6.x), reported on nodejs/node#11545. opentrials/opentrials#693
The error was caused by a bug on NodeJS 6.9.5 (possibly 6.x), reported on nodejs/node#11545. opentrials/opentrials#693
Interesting bug. I can reproduce and a quick investigation suggests it might have something to do with allocation site pretenuring in Crankshaft.
It sometimes passes without the flags too so there is a timing aspect to it as well but I'm reasonably sure allocation site pretenuring is involved somehow. |
I can't reproduce with d8 (5.1.281.75) |
@nodejs/v8 FYI I built several |
Is this still a bug in Node.js 6.11.1? (Bug isn't tripped on my operating system, so I'm guessing it's Linux-specific.) |
I can still reproduce, on MacOS too. Try running it in a loop:
|
Works as expected 6.14.0 so I guess this did get fixed at some point. |
The following code causes an error:
Note that on each loop of the
reduce
we add 2 elements to the result array. As it starts as an empty array (i.e. with 0 elements), at the end we expect thatbulkBody.length == 2 * entities.length
. This isn't what happens. See:I tested both on 6.10.0 and 6.9.5 and the error is the same. Note that the code has many no-op operations. If you remove the
if (false) {}
clause, for example, the error isn't triggered. If you change theentities
array length from 1000 to 10000 (for example), the error isn't triggered either. Even if you change thefoobar: undefined
tofoobar: 30
, the error isn't triggered.It seems like that Node is optimizing a very specific code and, if we change even no-op code, the bug isn't triggered.
The text was updated successfully, but these errors were encountered: