ladybird/Libraries/LibJS/Bytecode/Register.h
Andreas Kling 984d3033e9 LibJS: Remove obsolete bytecode dump formatting helpers
The Rust bytecode dumper now formats exception handler labels, raw
operands, builtins, labels, and registers. Remove the C++ dump-only
formatters and flatten Operand to expose only the runtime value-array
layout that C++ still observes.
2026-06-15 02:41:57 +02:00

62 lines
1.3 KiB
C++

/*
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
namespace JS::Bytecode {
class Register {
public:
constexpr static u32 accumulator_index = 0;
static constexpr Register accumulator()
{
return Register(accumulator_index);
}
static constexpr u32 exception_index = 1;
static constexpr Register exception()
{
return Register(exception_index);
}
static constexpr Register this_value()
{
constexpr u32 this_value_index = 2;
return Register(this_value_index);
}
static constexpr Register return_value()
{
constexpr u32 return_value_index = 3;
return Register(return_value_index);
}
static constexpr Register saved_lexical_environment()
{
constexpr u32 saved_lexical_environment_index = 4;
return Register(saved_lexical_environment_index);
}
static constexpr u32 reserved_register_count = 5;
constexpr explicit Register(u32 index)
: m_index(index)
{
}
constexpr bool operator==(Register reg) const { return m_index == reg.index(); }
constexpr u32 index() const { return m_index; }
private:
u32 m_index;
};
}