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
Notes: sideshowbarker 2024-07-19 02:03:48 +09:00

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()