mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-26 04:35:41 +03:00
AK: Mark the error branch of the TRY() macro as unlikely
This results in a measurable (and free!) 2% improvement in test-js run time.
This commit is contained in:
parent
309d71a66b
commit
8a879e205b
Notes:
sideshowbarker
2024-07-17 20:49:00 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/8a879e205b9 Pull-request: https://github.com/SerenityOS/serenity/pull/11933
12
AK/Try.h
12
AK/Try.h
@ -9,12 +9,12 @@
|
|||||||
// NOTE: This macro works with any result type that has the expected APIs.
|
// NOTE: This macro works with any result type that has the expected APIs.
|
||||||
// It's designed with AK::Result and AK::Error in mind.
|
// It's designed with AK::Result and AK::Error in mind.
|
||||||
|
|
||||||
#define TRY(expression) \
|
#define TRY(expression) \
|
||||||
({ \
|
({ \
|
||||||
auto _temporary_result = (expression); \
|
auto _temporary_result = (expression); \
|
||||||
if (_temporary_result.is_error()) \
|
if (_temporary_result.is_error()) [[unlikely]] \
|
||||||
return _temporary_result.release_error(); \
|
return _temporary_result.release_error(); \
|
||||||
_temporary_result.release_value(); \
|
_temporary_result.release_value(); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define MUST(expression) \
|
#define MUST(expression) \
|
||||||
|
Loading…
Reference in New Issue
Block a user