LibJS: Cache an Utf16View for the full code string in SourceCode

This avoids doing the ASCII/UTF-16 flag check every time we access
character data from the lexer.
This commit is contained in:
Andreas Kling 2025-11-08 22:49:29 +01:00 committed by Andreas Kling
parent fa44fd58d8
commit 7c7a035347
Notes: github-actions[bot] 2025-11-09 11:15:08 +00:00
4 changed files with 40 additions and 36 deletions

View file

@ -20,6 +20,7 @@ NonnullRefPtr<SourceCode const> SourceCode::create(String filename, Utf16String
SourceCode::SourceCode(String filename, Utf16String code)
: m_filename(move(filename))
, m_code(move(code))
, m_code_view(m_code.utf16_view())
{
}