DescriptionDon't use one-bit bit fields for enums -- they misbehave in VC++, unless you force the enum's type to be unsigned. enum bit fields may also waste space.
The bug is that direct comparisons of STORE_TO_INITIALIZED_ENTRY with store_mode_ would always fail, so this is a behavior-altering change.
One-bit bit fields in VC++ default to being signed so their only possible values are zero
and *negative* one. /analyze warned that such a bit field was being
compared to one which can never succeed.
Also, the bit field in particular was falling afoul of the VC++ bit field layout
rules and the two one-bit bit fields were actually taking up 64-bits.
Fixed by removing some bit field specifiers and specifying the enum's type as being unsigned char. This saves four bytes in both places the enum was used, and the lack of bit fields means that access to the variables will be faster, and the sign problem will be avoided.
In some cases it would be nice to use unsigned-char enums together with bit fields but gcc warns on that. Luckily that combination is not needed for this fix.
Here is the /analyze warning which I confirmed in a test app is a real bug:
v8\src\hydrogen-instructions.h(6845) : warning C6299: Explicitly comparing a bit field to a Boolean type will yield unexpected results.
BUG=427616
LOG=n
Patch Set 1 #Patch Set 2 : Marked the enum's type as unsigned char to save space and removed some bit fields. #Patch Set 3 : Comment fix. #Messages
Total messages: 13 (3 generated)
|