Commit e47f9200 authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

cppgc: Inline allocation fast path across api boundary

Bug: chromium:1239030, chromium:1056170
Change-Id: I4a559027e63ebbd99e51344aa659d4fb284df88f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3190094
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77124}
parent c872728c
......@@ -9,20 +9,36 @@
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/object-allocator.h"
#if defined(__clang__)
#if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
#define CPPGC_FORCE_ALWAYS_INLINE __attribute__((always_inline))
#elif !defined(DEBUG) && V8_HAS___FORCEINLINE
#define CPPGC_FORCE_ALWAYS_INLINE __forceinline
#else
#define CPPGC_FORCE_ALWAYS_INLINE
#endif
#else
#define CPPGC_FORCE_ALWAYS_INLINE V8_INLINE
#endif
namespace cppgc {
namespace internal {
STATIC_ASSERT(api_constants::kLargeObjectSizeThreshold ==
kLargeObjectSizeThreshold);
// Using CPPGC_FORCE_ALWAYS_INLINE to guide LTO for inlining the allocation
// fast path.
// static
void* MakeGarbageCollectedTraitInternal::Allocate(
CPPGC_FORCE_ALWAYS_INLINE void* MakeGarbageCollectedTraitInternal::Allocate(
cppgc::AllocationHandle& handle, size_t size, GCInfoIndex index) {
return static_cast<ObjectAllocator&>(handle).AllocateObject(size, index);
}
// Using CPPGC_FORCE_ALWAYS_INLINE to guide LTO for inlining the allocation
// fast path.
// static
void* MakeGarbageCollectedTraitInternal::Allocate(
CPPGC_FORCE_ALWAYS_INLINE void* MakeGarbageCollectedTraitInternal::Allocate(
cppgc::AllocationHandle& handle, size_t size, GCInfoIndex index,
CustomSpaceIndex space_index) {
return static_cast<ObjectAllocator&>(handle).AllocateObject(size, index,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment