mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 13:37:10 +09:00
LibJS: Shrink JS::Bytecode::Operand from 8 bytes to 4 bytes
This packs the bytecode much better and gives us a decent performance boost on throughput-focused benchmarks. Measured on my M3 MacBook Pro: - 4.7% speedup on Kraken - 2.3% speedup on Octane - 2.7% speedup on JetStream1
This commit is contained in:
parent
70411a117b
commit
3c2a2bb39f
Notes:
github-actions[bot]
2025-04-06 00:06:20 +00:00
Author: https://github.com/awesomekling
Commit: 3c2a2bb39f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4243
1 changed files with 6 additions and 3 deletions
|
@ -13,7 +13,7 @@ namespace JS::Bytecode {
|
||||||
|
|
||||||
class Operand {
|
class Operand {
|
||||||
public:
|
public:
|
||||||
enum class Type {
|
enum class Type : u8 {
|
||||||
Invalid,
|
Invalid,
|
||||||
Register,
|
Register,
|
||||||
Local,
|
Local,
|
||||||
|
@ -26,6 +26,7 @@ public:
|
||||||
: m_type(type)
|
: m_type(type)
|
||||||
, m_index(index)
|
, m_index(index)
|
||||||
{
|
{
|
||||||
|
VERIFY((index & 0x3fffffff) == index);
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit Operand(Register);
|
explicit Operand(Register);
|
||||||
|
@ -42,10 +43,12 @@ public:
|
||||||
void offset_index_by(u32 offset) { m_index += offset; }
|
void offset_index_by(u32 offset) { m_index += offset; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type m_type {};
|
Type m_type : 2 {};
|
||||||
u32 m_index { 0 };
|
u32 m_index : 30 { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(Operand) == 4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue