1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

LibJS: Reduce copying of string data in RegExp.prototype

In addition to invoking js_string() with existing UTF-16 strings when
possible, RegExpExec now takes a Utf16String instead of a Utf16View. The
view was previously fully copied into the returned result object, so
this prevents potentially large copies of string data.
This commit is contained in:
Timothy Flynn 2021-08-09 12:55:08 -04:00 committed by Andreas Kling
parent 6c45620709
commit 34bd25f6c2
4 changed files with 39 additions and 49 deletions

View file

@ -22,7 +22,7 @@ public:
virtual ~RegExpStringIterator() override = default;
Object& regexp_object() { return m_regexp_object; }
Utf16View string() const { return m_string.view(); }
Utf16String string() const { return m_string; }
bool global() const { return m_global; }
bool unicode() const { return m_unicode; }