Commit 3cbb5e48 authored by heimbuef's avatar heimbuef Committed by Commit bot

Added static assert to BitField to ensure the contents fit within the field

Fixed ExtraICStateField which used 1 bits more than were available
BUG=

Review-Url: https://codereview.chromium.org/2258473002
Cr-Commit-Position: refs/heads/master@{#38697}
parent f9763eb2
......@@ -5475,9 +5475,10 @@ class Code: public HeapObject {
: public BitField<CacheHolderFlag, HasUnwindingInfoField::kNext, 2> {};
class KindField : public BitField<Kind, CacheHolderField::kNext, 5> {};
STATIC_ASSERT(NUMBER_OF_KINDS <= KindField::kMax);
class ExtraICStateField : public BitField<ExtraICState, KindField::kNext,
PlatformSmiTagging::kSmiValueSize -
KindField::kNext + 1> {};
class ExtraICStateField
: public BitField<ExtraICState, KindField::kNext,
PlatformSmiTagging::kSmiValueSize - KindField::kNext> {
};
// KindSpecificFlags1 layout (STUB, BUILTIN and OPTIMIZED_FUNCTION)
static const int kStackSlotsFirstBit = 0;
......
......@@ -305,8 +305,9 @@ class BitFieldBase {
static T decode(U value) {
return static_cast<T>((value & kMask) >> shift);
}
};
STATIC_ASSERT((kNext - 1) / 8 < sizeof(U));
};
template <class T, int shift, int size>
class BitField8 : public BitFieldBase<T, shift, size, uint8_t> {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment