mirror of
https://github.com/gperftools/gperftools
synced 2024-12-24 00:02:12 +00:00
tell compiler that non-empty hooks are unlikely
This commit is contained in:
parent
8cc75acd1f
commit
04df911915
@ -44,6 +44,8 @@
|
|||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include <gperftools/malloc_hook.h>
|
#include <gperftools/malloc_hook.h>
|
||||||
|
|
||||||
|
#include "common.h" // for UNLIKELY
|
||||||
|
|
||||||
namespace base { namespace internal {
|
namespace base { namespace internal {
|
||||||
|
|
||||||
// Capacity of 8 means that HookList is 9 words.
|
// Capacity of 8 means that HookList is 9 words.
|
||||||
@ -121,7 +123,7 @@ inline MallocHook::NewHook MallocHook::GetNewHook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void MallocHook::InvokeNewHook(const void* p, size_t s) {
|
inline void MallocHook::InvokeNewHook(const void* p, size_t s) {
|
||||||
if (!base::internal::new_hooks_.empty()) {
|
if (UNLIKELY(!base::internal::new_hooks_.empty())) {
|
||||||
InvokeNewHookSlow(p, s);
|
InvokeNewHookSlow(p, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -132,7 +134,7 @@ inline MallocHook::DeleteHook MallocHook::GetDeleteHook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void MallocHook::InvokeDeleteHook(const void* p) {
|
inline void MallocHook::InvokeDeleteHook(const void* p) {
|
||||||
if (!base::internal::delete_hooks_.empty()) {
|
if (UNLIKELY(!base::internal::delete_hooks_.empty())) {
|
||||||
InvokeDeleteHookSlow(p);
|
InvokeDeleteHookSlow(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user