mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:28:11 +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:
|
||||
constexpr static u32 accumulator_index = 0;
|
||||
|
||||
static Register accumulator()
|
||||
static constexpr Register accumulator()
|
||||
{
|
||||
static Register accumulator(accumulator_index);
|
||||
return accumulator;
|
||||
return Register(accumulator_index);
|
||||
}
|
||||
|
||||
explicit Register(u32 index)
|
||||
constexpr explicit Register(u32 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:
|
||||
u32 m_index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue