1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

LibJS: Avoid unnecessary StringImpl copy in StringOrSymbol(String)

This commit is contained in:
Andreas Kling 2020-10-04 17:21:46 +02:00
parent 5de5af60c1
commit cfd141b4f9

View file

@ -51,8 +51,10 @@ public:
}
StringOrSymbol(const String& string)
: m_ptr(StringImpl::create(string.characters(), string.length()).leak_ref())
: m_ptr(string.impl())
{
ASSERT(!string.is_null());
static_cast<const StringImpl*>(m_ptr)->ref();
}
~StringOrSymbol()