mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1233101 - Use MOZ_LIKELY in js_new etc to help branch prediction; r=terrence
This commit is contained in:
parent
e56f1b5f60
commit
bde15e81a7
@ -302,12 +302,12 @@ static inline char* js_strdup(const char* s)
|
||||
* Note: Do not add a ; at the end of a use of JS_DECLARE_NEW_METHODS,
|
||||
* or the build will break.
|
||||
*/
|
||||
#define JS_DECLARE_NEW_METHODS(NEWNAME, ALLOCATOR, QUALIFIERS)\
|
||||
#define JS_DECLARE_NEW_METHODS(NEWNAME, ALLOCATOR, QUALIFIERS) \
|
||||
template <class T, typename... Args> \
|
||||
QUALIFIERS T * \
|
||||
NEWNAME(Args&&... args) MOZ_HEAP_ALLOCATOR { \
|
||||
void* memory = ALLOCATOR(sizeof(T)); \
|
||||
return memory \
|
||||
return MOZ_LIKELY(memory) \
|
||||
? new(memory) T(mozilla::Forward<Args>(args)...) \
|
||||
: nullptr; \
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user