mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:27:45 +00:00
LibJS: Optimize PropertyName and StringPrototype for size
We can reduce the amount of padding the compiler adds in order to ensure data alignment of member variables by ordering the types in a struct by size in decending order. Found By PVS-Studio: https://pvs-studio.com/en/docs/warnings/v802/
This commit is contained in:
parent
d347432a9e
commit
1b00ddf07e
3 changed files with 9 additions and 9 deletions
|
@ -74,8 +74,8 @@ public:
|
|||
}
|
||||
|
||||
PropertyName(FlyString string, StringMayBeNumber string_may_be_number = StringMayBeNumber::Yes)
|
||||
: m_type(Type::String)
|
||||
, m_string_may_be_number(string_may_be_number == StringMayBeNumber::Yes)
|
||||
: m_string_may_be_number(string_may_be_number == StringMayBeNumber::Yes)
|
||||
, m_type(Type::String)
|
||||
, m_string(move(string))
|
||||
{
|
||||
VERIFY(!m_string.is_null());
|
||||
|
@ -184,11 +184,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
Type m_type { Type::Invalid };
|
||||
bool m_string_may_be_number { true };
|
||||
Type m_type { Type::Invalid };
|
||||
u32 m_number { 0 };
|
||||
FlyString m_string;
|
||||
Symbol* m_symbol { nullptr };
|
||||
u32 m_number { 0 };
|
||||
};
|
||||
|
||||
struct PropertyNameTraits : public Traits<PropertyName> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue