mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +00:00
LibJS: Mark ThrowCompletionOr member functions as ALWAYS_INLINE
Some of them stood out in a profile, and they have no business doing so.
This commit is contained in:
parent
3d2794d062
commit
1060c63bd8
1 changed files with 9 additions and 9 deletions
|
@ -272,33 +272,33 @@ template<typename ValueType>
|
||||||
requires(!IsLvalueReference<ValueType>)
|
requires(!IsLvalueReference<ValueType>)
|
||||||
class [[nodiscard]] ThrowCompletionOr {
|
class [[nodiscard]] ThrowCompletionOr {
|
||||||
public:
|
public:
|
||||||
ThrowCompletionOr()
|
ALWAYS_INLINE ThrowCompletionOr()
|
||||||
requires(IsSame<ValueType, Empty>)
|
requires(IsSame<ValueType, Empty>)
|
||||||
: m_value_or_throw_completion(Empty {})
|
: m_value_or_throw_completion(Empty {})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not `explicit` on purpose so that `return vm.throw_completion<Error>(...);` is possible.
|
// Not `explicit` on purpose so that `return vm.throw_completion<Error>(...);` is possible.
|
||||||
ThrowCompletionOr(Completion throw_completion)
|
ALWAYS_INLINE ThrowCompletionOr(Completion throw_completion)
|
||||||
: m_value_or_throw_completion(move(throw_completion))
|
: m_value_or_throw_completion(move(throw_completion))
|
||||||
{
|
{
|
||||||
VERIFY(m_value_or_throw_completion.template get<Completion>().is_error());
|
VERIFY(m_value_or_throw_completion.template get<Completion>().is_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not `explicit` on purpose so that `return value;` is possible.
|
// Not `explicit` on purpose so that `return value;` is possible.
|
||||||
ThrowCompletionOr(ValueType value)
|
ALWAYS_INLINE ThrowCompletionOr(ValueType value)
|
||||||
: m_value_or_throw_completion(move(value))
|
: m_value_or_throw_completion(move(value))
|
||||||
{
|
{
|
||||||
if constexpr (IsSame<ValueType, Value>)
|
if constexpr (IsSame<ValueType, Value>)
|
||||||
VERIFY(!m_value_or_throw_completion.template get<ValueType>().is_empty());
|
VERIFY(!m_value_or_throw_completion.template get<ValueType>().is_empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
ThrowCompletionOr(ThrowCompletionOr const&) = default;
|
ALWAYS_INLINE ThrowCompletionOr(ThrowCompletionOr const&) = default;
|
||||||
ThrowCompletionOr& operator=(ThrowCompletionOr const&) = default;
|
ALWAYS_INLINE ThrowCompletionOr& operator=(ThrowCompletionOr const&) = default;
|
||||||
ThrowCompletionOr(ThrowCompletionOr&&) = default;
|
ALWAYS_INLINE ThrowCompletionOr(ThrowCompletionOr&&) = default;
|
||||||
ThrowCompletionOr& operator=(ThrowCompletionOr&&) = default;
|
ALWAYS_INLINE ThrowCompletionOr& operator=(ThrowCompletionOr&&) = default;
|
||||||
|
|
||||||
ThrowCompletionOr(OptionalNone value)
|
ALWAYS_INLINE ThrowCompletionOr(OptionalNone value)
|
||||||
: m_value_or_throw_completion(ValueType { value })
|
: m_value_or_throw_completion(ValueType { value })
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ public:
|
||||||
// Most commonly: Value from Object* or similar, so we can omit the curly braces from "return { TRY(...) };".
|
// Most commonly: Value from Object* or similar, so we can omit the curly braces from "return { TRY(...) };".
|
||||||
// Disabled for POD types to avoid weird conversion shenanigans.
|
// Disabled for POD types to avoid weird conversion shenanigans.
|
||||||
template<typename WrappedValueType>
|
template<typename WrappedValueType>
|
||||||
ThrowCompletionOr(WrappedValueType&& value)
|
ALWAYS_INLINE ThrowCompletionOr(WrappedValueType&& value)
|
||||||
requires(!IsPOD<ValueType>)
|
requires(!IsPOD<ValueType>)
|
||||||
: m_value_or_throw_completion(ValueType { value })
|
: m_value_or_throw_completion(ValueType { value })
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue