v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
allocation.cc
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
8#include "src/base/macros.h"
11
12#if defined(__clang__) && !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE
13#define CPPGC_FORCE_ALWAYS_INLINE __attribute__((always_inline))
14#else
15#define CPPGC_FORCE_ALWAYS_INLINE
16#endif
17
18namespace cppgc {
19namespace internal {
20
23
24#if !(defined(V8_HOST_ARCH_32_BIT) && defined(V8_CC_GNU))
25// GCC on x86 has alignof(std::max_align_t) == 16 (quad word) which is not
26// satisfied by Oilpan.
28 alignof(std::max_align_t),
29 "Maximum support alignment must at least cover "
30 "alignof(std::max_align_t).");
31#endif // !(defined(V8_HOST_ARCH_32_BIT) && defined(V8_CC_GNU))
32
33// Using CPPGC_FORCE_ALWAYS_INLINE to guide LTO for inlining the allocation
34// fast path.
35// static
37 cppgc::AllocationHandle& handle, size_t size, GCInfoIndex index) {
38 return static_cast<ObjectAllocator&>(handle).AllocateObject(size, index);
39}
40
41// Using CPPGC_FORCE_ALWAYS_INLINE to guide LTO for inlining the allocation
42// fast path.
43// static
45 cppgc::AllocationHandle& handle, size_t size, AlignVal alignment,
46 GCInfoIndex index) {
47 return static_cast<ObjectAllocator&>(handle).AllocateObject(size, alignment,
48 index);
49}
50
51// Using CPPGC_FORCE_ALWAYS_INLINE to guide LTO for inlining the allocation
52// fast path.
53// static
55 cppgc::AllocationHandle& handle, size_t size, GCInfoIndex index,
56 CustomSpaceIndex space_index) {
57 return static_cast<ObjectAllocator&>(handle).AllocateObject(size, index,
58 space_index);
59}
60
61// Using CPPGC_FORCE_ALWAYS_INLINE to guide LTO for inlining the allocation
62// fast path.
63// static
65 cppgc::AllocationHandle& handle, size_t size, AlignVal alignment,
66 GCInfoIndex index, CustomSpaceIndex space_index) {
67 return static_cast<ObjectAllocator&>(handle).AllocateObject(
68 size, alignment, index, space_index);
69}
70
71} // namespace internal
72} // namespace cppgc
static V8_EXPORT void *CPPGC_DEFAULT_ALIGNED Allocate(cppgc::AllocationHandle &, size_t, GCInfoIndex)
Definition allocation.cc:36
#define CPPGC_FORCE_ALWAYS_INLINE
Definition allocation.cc:15
static constexpr size_t kMaxSupportedAlignment
static constexpr size_t kLargeObjectSizeThreshold
std::align_val_t AlignVal
Definition allocation.h:47
constexpr size_t kLargeObjectSizeThreshold
Definition globals.h:46
uint16_t GCInfoIndex
Definition gc-info.h:21