Commit 6d0d8695 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[maglev] Use 16bit for Opcode and align input count

Bug: v8:7700
Change-Id: Id4294fdfad414b34606a1f15e97dbd5485b8e23a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3804868
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82160}
parent d195ce14
...@@ -216,7 +216,7 @@ class CompactInterpreterFrameState; ...@@ -216,7 +216,7 @@ class CompactInterpreterFrameState;
// Define the opcode enum. // Define the opcode enum.
#define DEF_OPCODES(type) k##type, #define DEF_OPCODES(type) k##type,
enum class Opcode : uint8_t { NODE_BASE_LIST(DEF_OPCODES) }; enum class Opcode : uint16_t { NODE_BASE_LIST(DEF_OPCODES) };
#undef DEF_OPCODES #undef DEF_OPCODES
#define PLUS_ONE(type) +1 #define PLUS_ONE(type) +1
static constexpr int kOpcodeCount = NODE_BASE_LIST(PLUS_ONE); static constexpr int kOpcodeCount = NODE_BASE_LIST(PLUS_ONE);
...@@ -563,17 +563,20 @@ const T* ObjectPtrBeforeAddress(const void* address) { ...@@ -563,17 +563,20 @@ const T* ObjectPtrBeforeAddress(const void* address) {
class NodeBase : public ZoneObject { class NodeBase : public ZoneObject {
private: private:
// Bitfield specification. // Bitfield specification.
using OpcodeField = base::BitField64<Opcode, 0, 7>; using OpcodeField = base::BitField64<Opcode, 0, 16>;
static_assert(OpcodeField::is_valid(kLastOpcode)); static_assert(OpcodeField::is_valid(kLastOpcode));
using OpPropertiesField = using OpPropertiesField =
OpcodeField::Next<OpProperties, OpProperties::kSize>; OpcodeField::Next<OpProperties, OpProperties::kSize>;
using InputCountField = OpPropertiesField::Next<size_t, 17>; using NumTemporariesNeededField = OpPropertiesField::Next<uint8_t, 2>;
using NumTemporariesNeededField = InputCountField::Next<uint8_t, 2>; // Align input count to 32-bit.
using UnusedField = NumTemporariesNeededField::Next<uint8_t, 4>;
using InputCountField = UnusedField::Next<size_t, 17>;
static_assert(InputCountField::kShift == 32);
protected: protected:
// Subclasses may use the remaining bitfield bits. // Subclasses may use the remaining bitfield bits.
template <class T, int size> template <class T, int size>
using NextBitField = NumTemporariesNeededField::Next<T, size>; using NextBitField = InputCountField::Next<T, size>;
template <class T> template <class T>
static constexpr Opcode opcode_of = detail::opcode_of_helper<T>::value; static constexpr Opcode opcode_of = detail::opcode_of_helper<T>::value;
......
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