Commit 2d055a1f authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

Check that there are some opcodes left unused

This ensures that we have enough slack to land or merge important fixes
(and temporarily coming closer to the limit).
If the static assertion is ever violated, we should immediately create a
tracking bug to free some opcode space. Temporarily reducing the
required slack (16 in this CL) is OK then.

R=zhin@chromium.org

Bug: v8:12093
Change-Id: I0934061c38cefb713ae83ccc4d81791dc4b2d312
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3097281Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76323}
parent 0d0e29f3
......@@ -279,6 +279,9 @@ using ArchOpcodeField = base::BitField<ArchOpcode, 0, 9>;
static_assert(ArchOpcodeField::is_valid(kLastArchOpcode),
"All opcodes must fit in the 9-bit ArchOpcodeField.");
using AddressingModeField = base::BitField<AddressingMode, 9, 5>;
static_assert(
AddressingModeField::is_valid(kLastAddressingMode),
"All addressing modes must fit in the 5-bit AddressingModeField.");
using FlagsModeField = base::BitField<FlagsMode, 14, 3>;
using FlagsConditionField = base::BitField<FlagsCondition, 17, 5>;
using DeoptImmedArgsCountField = base::BitField<int, 22, 2>;
......@@ -293,6 +296,17 @@ using AccessModeField = base::BitField<MemoryAccessMode, 30, 2>;
using AtomicWidthField = base::BitField<AtomicWidth, 22, 2>;
using MiscField = base::BitField<int, 22, 10>;
// This static assertion serves as an early warning if we are about to exhaust
// the available opcode space. If we are about to exhaust it, we should start
// looking into options to compress some opcodes (see
// https://crbug.com/v8/12093) before we fully run out of available opcodes.
// Otherwise we risk being unable to land an important security fix or merge
// back fixes that add new opcodes.
// It is OK to temporarily reduce the required slack if we have a tracking bug
// to reduce the number of used opcodes again.
static_assert(ArchOpcodeField::kMax - kLastArchOpcode >= 16,
"We are running close to the number of available opcodes.");
} // namespace compiler
} // namespace internal
} // namespace v8
......
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