LibJS: Cache length-in-code-units in SourceCode

This avoids some bit twiddling whenever accessing the length in code
units in the lexer.
This commit is contained in:
Andreas Kling 2025-11-08 22:57:01 +01:00 committed by Andreas Kling
parent 7c7a035347
commit 201803f601
Notes: github-actions[bot] 2025-11-09 11:15:02 +00:00
3 changed files with 16 additions and 13 deletions

View file

@ -21,6 +21,7 @@ SourceCode::SourceCode(String filename, Utf16String code)
: m_filename(move(filename))
, m_code(move(code))
, m_code_view(m_code.utf16_view())
, m_length_in_code_units(m_code_view.length_in_code_units())
{
}