mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
Revert "LibJS: Revert common error types to only hold a single string"
This reverts commit 695bbcb991.
Despite improving performance on my Linux machine, this managed to tank
performance on the Linux benchmark machine.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
b81d3e813c
commit
5ec70bd00a
Notes:
github-actions[bot]
2025-08-18 11:43:29 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/5ec70bd00a0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5895 Reviewed-by: https://github.com/gmta ✅
@@ -9,8 +9,15 @@
|
||||
namespace JS {
|
||||
|
||||
#define __ENUMERATE_JS_ERROR(name, message) \
|
||||
const ErrorType ErrorType::name = ErrorType(message##_utf16);
|
||||
const ErrorType ErrorType::name = ErrorType(message##sv);
|
||||
JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR)
|
||||
#undef __ENUMERATE_JS_ERROR
|
||||
|
||||
Utf16String const& ErrorType::message() const
|
||||
{
|
||||
if (m_message.is_empty())
|
||||
m_message = Utf16String::from_utf8_without_validation(m_format);
|
||||
return m_message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -314,16 +314,17 @@ public:
|
||||
JS_ENUMERATE_ERROR_TYPES(__ENUMERATE_JS_ERROR)
|
||||
#undef __ENUMERATE_JS_ERROR
|
||||
|
||||
StringView format() const { return m_message.ascii_view(); }
|
||||
Utf16String const& message() const { return m_message; }
|
||||
StringView format() const { return m_format; }
|
||||
Utf16String const& message() const;
|
||||
|
||||
private:
|
||||
explicit ErrorType(Utf16String message)
|
||||
: m_message(move(message))
|
||||
explicit ErrorType(StringView format)
|
||||
: m_format(format)
|
||||
{
|
||||
}
|
||||
|
||||
Utf16String m_message;
|
||||
StringView m_format;
|
||||
mutable Utf16String m_message;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user