mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:57:35 +00:00
LibJS: Add fast paths for bitwise ops on 2x Int32 JS::Value
~9% speed-up on Kraken/stanford-crypto-aes.js :^)
This commit is contained in:
parent
1efe4b58aa
commit
0cb9c9e81e
2 changed files with 35 additions and 11 deletions
|
@ -428,6 +428,17 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
// A double is any Value which does not have the full exponent and top mantissa bit set or has
|
||||
// exactly only those bits set.
|
||||
bool is_double() const { return (m_value.encoded & CANON_NAN_BITS) != CANON_NAN_BITS || (m_value.encoded == CANON_NAN_BITS); }
|
||||
bool is_int32() const { return m_value.tag == INT32_TAG; }
|
||||
|
||||
i32 as_i32() const
|
||||
{
|
||||
VERIFY(is_int32());
|
||||
return static_cast<i32>(m_value.encoded & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
private:
|
||||
Value(u64 tag, u64 val)
|
||||
{
|
||||
|
@ -459,17 +470,6 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
// A double is any Value which does not have the full exponent and top mantissa bit set or has
|
||||
// exactly only those bits set.
|
||||
bool is_double() const { return (m_value.encoded & CANON_NAN_BITS) != CANON_NAN_BITS || (m_value.encoded == CANON_NAN_BITS); }
|
||||
bool is_int32() const { return m_value.tag == INT32_TAG; }
|
||||
|
||||
i32 as_i32() const
|
||||
{
|
||||
VERIFY(is_int32());
|
||||
return static_cast<i32>(m_value.encoded & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
template<typename PointerType>
|
||||
PointerType* extract_pointer() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue