mirror of
https://github.com/RGBCube/serenity
synced 2025-06-24 23:02:07 +00:00
LibJS/Bytecode: Make Bytecode::Register constexpr
A trivial change for 2% speed-up on Kraken/ai-astar.js :^)
This commit is contained in:
parent
3476cf0fcb
commit
acd8c94e88
1 changed files with 5 additions and 6 deletions
|
@ -14,20 +14,19 @@ class Register {
|
||||||
public:
|
public:
|
||||||
constexpr static u32 accumulator_index = 0;
|
constexpr static u32 accumulator_index = 0;
|
||||||
|
|
||||||
static Register accumulator()
|
static constexpr Register accumulator()
|
||||||
{
|
{
|
||||||
static Register accumulator(accumulator_index);
|
return Register(accumulator_index);
|
||||||
return accumulator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit Register(u32 index)
|
constexpr explicit Register(u32 index)
|
||||||
: m_index(index)
|
: m_index(index)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(Register reg) const { return m_index == reg.index(); }
|
constexpr bool operator==(Register reg) const { return m_index == reg.index(); }
|
||||||
|
|
||||||
u32 index() const { return m_index; }
|
constexpr u32 index() const { return m_index; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 m_index;
|
u32 m_index;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue