libv8-node 15.5.1.0.beta1-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/ext/libv8-node/.location.yml +1 -0
- data/ext/libv8-node/location.rb +76 -0
- data/ext/libv8-node/paths.rb +30 -0
- data/lib/libv8-node.rb +1 -0
- data/lib/libv8/node.rb +11 -0
- data/lib/libv8/node/version.rb +7 -0
- data/vendor/v8/include/cppgc/allocation.h +173 -0
- data/vendor/v8/include/cppgc/common.h +26 -0
- data/vendor/v8/include/cppgc/custom-space.h +62 -0
- data/vendor/v8/include/cppgc/default-platform.h +76 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +116 -0
- data/vendor/v8/include/cppgc/heap.h +139 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
- data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +67 -0
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +45 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +134 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
- data/vendor/v8/include/cppgc/internal/process-heap.h +34 -0
- data/vendor/v8/include/cppgc/internal/write-barrier.h +78 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +68 -0
- data/vendor/v8/include/cppgc/macros.h +24 -0
- data/vendor/v8/include/cppgc/member.h +226 -0
- data/vendor/v8/include/cppgc/persistent.h +341 -0
- data/vendor/v8/include/cppgc/platform.h +130 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
- data/vendor/v8/include/cppgc/source-location.h +91 -0
- data/vendor/v8/include/cppgc/trace-trait.h +111 -0
- data/vendor/v8/include/cppgc/type-traits.h +109 -0
- data/vendor/v8/include/cppgc/visitor.h +213 -0
- data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
- data/vendor/v8/include/libplatform/libplatform.h +106 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +332 -0
- data/vendor/v8/include/v8-cppgc.h +226 -0
- data/vendor/v8/include/v8-fast-api-calls.h +388 -0
- data/vendor/v8/include/v8-inspector-protocol.h +13 -0
- data/vendor/v8/include/v8-inspector.h +327 -0
- data/vendor/v8/include/v8-internal.h +427 -0
- data/vendor/v8/include/v8-metrics.h +133 -0
- data/vendor/v8/include/v8-platform.h +684 -0
- data/vendor/v8/include/v8-profiler.h +1059 -0
- data/vendor/v8/include/v8-util.h +652 -0
- data/vendor/v8/include/v8-value-serializer-version.h +24 -0
- data/vendor/v8/include/v8-version-string.h +38 -0
- data/vendor/v8/include/v8-version.h +20 -0
- data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
- data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
- data/vendor/v8/include/v8.h +12098 -0
- data/vendor/v8/include/v8config.h +484 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
- metadata +126 -0
@@ -0,0 +1,116 @@
|
|
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
|
+
|
5
|
+
#ifndef INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
|
6
|
+
#define INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
|
7
|
+
|
8
|
+
#include <type_traits>
|
9
|
+
|
10
|
+
#include "cppgc/internal/api-constants.h"
|
11
|
+
#include "cppgc/platform.h"
|
12
|
+
#include "cppgc/trace-trait.h"
|
13
|
+
#include "cppgc/type-traits.h"
|
14
|
+
|
15
|
+
namespace cppgc {
|
16
|
+
|
17
|
+
class Visitor;
|
18
|
+
|
19
|
+
namespace internal {
|
20
|
+
|
21
|
+
class GarbageCollectedBase {
|
22
|
+
public:
|
23
|
+
// Must use MakeGarbageCollected.
|
24
|
+
void* operator new(size_t) = delete;
|
25
|
+
void* operator new[](size_t) = delete;
|
26
|
+
// The garbage collector is taking care of reclaiming the object. Also,
|
27
|
+
// virtual destructor requires an unambiguous, accessible 'operator delete'.
|
28
|
+
void operator delete(void*) {
|
29
|
+
#ifdef V8_ENABLE_CHECKS
|
30
|
+
internal::Abort();
|
31
|
+
#endif // V8_ENABLE_CHECKS
|
32
|
+
}
|
33
|
+
void operator delete[](void*) = delete;
|
34
|
+
|
35
|
+
protected:
|
36
|
+
GarbageCollectedBase() = default;
|
37
|
+
};
|
38
|
+
|
39
|
+
} // namespace internal
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Base class for managed objects. Only descendent types of GarbageCollected
|
43
|
+
* can be constructed using MakeGarbageCollected. Must be inherited from as
|
44
|
+
* left-most base class.
|
45
|
+
*
|
46
|
+
* Types inheriting from GarbageCollected must provide a method of
|
47
|
+
* signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
|
48
|
+
* pointers to the visitor and delegates to garbage-collected base classes.
|
49
|
+
* The method must be virtual if the type is not directly a child of
|
50
|
+
* GarbageCollected and marked as final.
|
51
|
+
*
|
52
|
+
* \code
|
53
|
+
* // Example using final class.
|
54
|
+
* class FinalType final : public GarbageCollected<FinalType> {
|
55
|
+
* public:
|
56
|
+
* void Trace(cppgc::Visitor* visitor) const {
|
57
|
+
* // Dispatch using visitor->Trace(...);
|
58
|
+
* }
|
59
|
+
* };
|
60
|
+
*
|
61
|
+
* // Example using non-final base class.
|
62
|
+
* class NonFinalBase : public GarbageCollected<NonFinalBase> {
|
63
|
+
* public:
|
64
|
+
* virtual void Trace(cppgc::Visitor*) const {}
|
65
|
+
* };
|
66
|
+
*
|
67
|
+
* class FinalChild final : public NonFinalBase {
|
68
|
+
* public:
|
69
|
+
* void Trace(cppgc::Visitor* visitor) const final {
|
70
|
+
* // Dispatch using visitor->Trace(...);
|
71
|
+
* NonFinalBase::Trace(visitor);
|
72
|
+
* }
|
73
|
+
* };
|
74
|
+
* \endcode
|
75
|
+
*/
|
76
|
+
template <typename>
|
77
|
+
class GarbageCollected : public internal::GarbageCollectedBase {
|
78
|
+
public:
|
79
|
+
using IsGarbageCollectedTypeMarker = void;
|
80
|
+
|
81
|
+
protected:
|
82
|
+
GarbageCollected() = default;
|
83
|
+
};
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Base class for managed mixin objects. Such objects cannot be constructed
|
87
|
+
* directly but must be mixed into the inheritance hierarchy of a
|
88
|
+
* GarbageCollected object.
|
89
|
+
*
|
90
|
+
* Types inheriting from GarbageCollectedMixin must override a virtual method
|
91
|
+
* of signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
|
92
|
+
* pointers to the visitor and delegates to base classes.
|
93
|
+
*
|
94
|
+
* \code
|
95
|
+
* class Mixin : public GarbageCollectedMixin {
|
96
|
+
* public:
|
97
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
98
|
+
* // Dispatch using visitor->Trace(...);
|
99
|
+
* }
|
100
|
+
* };
|
101
|
+
* \endcode
|
102
|
+
*/
|
103
|
+
class GarbageCollectedMixin : public internal::GarbageCollectedBase {
|
104
|
+
public:
|
105
|
+
using IsGarbageCollectedMixinTypeMarker = void;
|
106
|
+
|
107
|
+
/**
|
108
|
+
* This Trace method must be overriden by objects inheriting from
|
109
|
+
* GarbageCollectedMixin.
|
110
|
+
*/
|
111
|
+
virtual void Trace(cppgc::Visitor*) const {}
|
112
|
+
};
|
113
|
+
|
114
|
+
} // namespace cppgc
|
115
|
+
|
116
|
+
#endif // INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
|
@@ -0,0 +1,139 @@
|
|
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
|
+
|
5
|
+
#ifndef INCLUDE_CPPGC_HEAP_H_
|
6
|
+
#define INCLUDE_CPPGC_HEAP_H_
|
7
|
+
|
8
|
+
#include <memory>
|
9
|
+
#include <vector>
|
10
|
+
|
11
|
+
#include "cppgc/common.h"
|
12
|
+
#include "cppgc/custom-space.h"
|
13
|
+
#include "cppgc/platform.h"
|
14
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
15
|
+
|
16
|
+
/**
|
17
|
+
* cppgc - A C++ garbage collection library.
|
18
|
+
*/
|
19
|
+
namespace cppgc {
|
20
|
+
|
21
|
+
class AllocationHandle;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Implementation details of cppgc. Those details are considered internal and
|
25
|
+
* may change at any point in time without notice. Users should never rely on
|
26
|
+
* the contents of this namespace.
|
27
|
+
*/
|
28
|
+
namespace internal {
|
29
|
+
class Heap;
|
30
|
+
} // namespace internal
|
31
|
+
|
32
|
+
class V8_EXPORT Heap {
|
33
|
+
public:
|
34
|
+
/**
|
35
|
+
* Specifies the stack state the embedder is in.
|
36
|
+
*/
|
37
|
+
using StackState = EmbedderStackState;
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Specifies whether conservative stack scanning is supported.
|
41
|
+
*/
|
42
|
+
enum class StackSupport : uint8_t {
|
43
|
+
/**
|
44
|
+
* Conservative stack scan is supported.
|
45
|
+
*/
|
46
|
+
kSupportsConservativeStackScan,
|
47
|
+
/**
|
48
|
+
* Conservative stack scan is not supported. Embedders may use this option
|
49
|
+
* when using custom infrastructure that is unsupported by the library.
|
50
|
+
*/
|
51
|
+
kNoConservativeStackScan,
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Constraints for a Heap setup.
|
56
|
+
*/
|
57
|
+
struct ResourceConstraints {
|
58
|
+
/**
|
59
|
+
* Allows the heap to grow to some initial size in bytes before triggering
|
60
|
+
* garbage collections. This is useful when it is known that applications
|
61
|
+
* need a certain minimum heap to run to avoid repeatedly invoking the
|
62
|
+
* garbage collector when growing the heap.
|
63
|
+
*/
|
64
|
+
size_t initial_heap_size_bytes = 0;
|
65
|
+
};
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Options specifying Heap properties (e.g. custom spaces) when initializing a
|
69
|
+
* heap through Heap::Create().
|
70
|
+
*/
|
71
|
+
struct HeapOptions {
|
72
|
+
/**
|
73
|
+
* Creates reasonable defaults for instantiating a Heap.
|
74
|
+
*
|
75
|
+
* \returns the HeapOptions that can be passed to Heap::Create().
|
76
|
+
*/
|
77
|
+
static HeapOptions Default() { return {}; }
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Custom spaces added to heap are required to have indices forming a
|
81
|
+
* numbered sequence starting at 0, i.e., their kSpaceIndex must correspond
|
82
|
+
* to the index they reside in the vector.
|
83
|
+
*/
|
84
|
+
std::vector<std::unique_ptr<CustomSpaceBase>> custom_spaces;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Specifies whether conserative stack scan is supported. When conservative
|
88
|
+
* stack scan is not supported, the collector may try to invoke
|
89
|
+
* garbage collections using non-nestable task, which are guaranteed to have
|
90
|
+
* no interesting stack, through the provided Platform. If such tasks are
|
91
|
+
* not supported by the Platform, the embedder must take care of invoking
|
92
|
+
* the GC through ForceGarbageCollectionSlow().
|
93
|
+
*/
|
94
|
+
StackSupport stack_support = StackSupport::kSupportsConservativeStackScan;
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Resource constraints specifying various properties that the internal
|
98
|
+
* GC scheduler follows.
|
99
|
+
*/
|
100
|
+
ResourceConstraints resource_constraints;
|
101
|
+
};
|
102
|
+
|
103
|
+
/**
|
104
|
+
* Creates a new heap that can be used for object allocation.
|
105
|
+
*
|
106
|
+
* \param platform implemented and provided by the embedder.
|
107
|
+
* \param options HeapOptions specifying various properties for the Heap.
|
108
|
+
* \returns a new Heap instance.
|
109
|
+
*/
|
110
|
+
static std::unique_ptr<Heap> Create(
|
111
|
+
std::shared_ptr<Platform> platform,
|
112
|
+
HeapOptions options = HeapOptions::Default());
|
113
|
+
|
114
|
+
virtual ~Heap() = default;
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Forces garbage collection.
|
118
|
+
*
|
119
|
+
* \param source String specifying the source (or caller) triggering a
|
120
|
+
* forced garbage collection.
|
121
|
+
* \param reason String specifying the reason for the forced garbage
|
122
|
+
* collection.
|
123
|
+
* \param stack_state The embedder stack state, see StackState.
|
124
|
+
*/
|
125
|
+
void ForceGarbageCollectionSlow(
|
126
|
+
const char* source, const char* reason,
|
127
|
+
StackState stack_state = StackState::kMayContainHeapPointers);
|
128
|
+
|
129
|
+
AllocationHandle& GetAllocationHandle();
|
130
|
+
|
131
|
+
private:
|
132
|
+
Heap() = default;
|
133
|
+
|
134
|
+
friend class internal::Heap;
|
135
|
+
};
|
136
|
+
|
137
|
+
} // namespace cppgc
|
138
|
+
|
139
|
+
#endif // INCLUDE_CPPGC_HEAP_H_
|
@@ -0,0 +1,47 @@
|
|
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
|
+
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
|
7
|
+
|
8
|
+
#include <stddef.h>
|
9
|
+
#include <stdint.h>
|
10
|
+
|
11
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
12
|
+
|
13
|
+
namespace cppgc {
|
14
|
+
namespace internal {
|
15
|
+
|
16
|
+
// Embedders should not rely on this code!
|
17
|
+
|
18
|
+
// Internal constants to avoid exposing internal types on the API surface.
|
19
|
+
namespace api_constants {
|
20
|
+
|
21
|
+
constexpr size_t kKB = 1024;
|
22
|
+
constexpr size_t kMB = kKB * 1024;
|
23
|
+
constexpr size_t kGB = kMB * 1024;
|
24
|
+
|
25
|
+
// Offset of the uint16_t bitfield from the payload contaning the
|
26
|
+
// in-construction bit. This is subtracted from the payload pointer to get
|
27
|
+
// to the right bitfield.
|
28
|
+
static constexpr size_t kFullyConstructedBitFieldOffsetFromPayload =
|
29
|
+
2 * sizeof(uint16_t);
|
30
|
+
// Mask for in-construction bit.
|
31
|
+
static constexpr size_t kFullyConstructedBitMask = size_t{1};
|
32
|
+
|
33
|
+
static constexpr size_t kPageSize = size_t{1} << 17;
|
34
|
+
|
35
|
+
static constexpr size_t kLargeObjectSizeThreshold = kPageSize / 2;
|
36
|
+
|
37
|
+
#if defined(CPPGC_CAGED_HEAP)
|
38
|
+
constexpr size_t kCagedHeapReservationSize = static_cast<size_t>(4) * kGB;
|
39
|
+
constexpr size_t kCagedHeapReservationAlignment = kCagedHeapReservationSize;
|
40
|
+
#endif
|
41
|
+
|
42
|
+
} // namespace api_constants
|
43
|
+
|
44
|
+
} // namespace internal
|
45
|
+
} // namespace cppgc
|
46
|
+
|
47
|
+
#endif // INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
|
@@ -0,0 +1,48 @@
|
|
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
|
+
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_ATOMIC_ENTRY_FLAG_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_ATOMIC_ENTRY_FLAG_H_
|
7
|
+
|
8
|
+
#include <atomic>
|
9
|
+
|
10
|
+
namespace cppgc {
|
11
|
+
namespace internal {
|
12
|
+
|
13
|
+
// A flag which provides a fast check whether a scope may be entered on the
|
14
|
+
// current thread, without needing to access thread-local storage or mutex. Can
|
15
|
+
// have false positives (i.e., spuriously report that it might be entered), so
|
16
|
+
// it is expected that this will be used in tandem with a precise check that the
|
17
|
+
// scope is in fact entered on that thread.
|
18
|
+
//
|
19
|
+
// Example:
|
20
|
+
// g_frobnicating_flag.MightBeEntered() &&
|
21
|
+
// ThreadLocalFrobnicator().IsFrobnicating()
|
22
|
+
//
|
23
|
+
// Relaxed atomic operations are sufficient, since:
|
24
|
+
// - all accesses remain atomic
|
25
|
+
// - each thread must observe its own operations in order
|
26
|
+
// - no thread ever exits the flag more times than it enters (if used correctly)
|
27
|
+
// And so if a thread observes zero, it must be because it has observed an equal
|
28
|
+
// number of exits as entries.
|
29
|
+
class AtomicEntryFlag final {
|
30
|
+
public:
|
31
|
+
void Enter() { entries_.fetch_add(1, std::memory_order_relaxed); }
|
32
|
+
void Exit() { entries_.fetch_sub(1, std::memory_order_relaxed); }
|
33
|
+
|
34
|
+
// Returns false only if the current thread is not between a call to Enter
|
35
|
+
// and a call to Exit. Returns true if this thread or another thread may
|
36
|
+
// currently be in the scope guarded by this flag.
|
37
|
+
bool MightBeEntered() const {
|
38
|
+
return entries_.load(std::memory_order_relaxed) != 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
private:
|
42
|
+
std::atomic_int entries_{0};
|
43
|
+
};
|
44
|
+
|
45
|
+
} // namespace internal
|
46
|
+
} // namespace cppgc
|
47
|
+
|
48
|
+
#endif // INCLUDE_CPPGC_INTERNAL_ATOMIC_ENTRY_FLAG_H_
|
@@ -0,0 +1,67 @@
|
|
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
|
+
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_
|
7
|
+
|
8
|
+
#include <array>
|
9
|
+
|
10
|
+
#include "cppgc/internal/api-constants.h"
|
11
|
+
#include "cppgc/internal/logging.h"
|
12
|
+
#include "cppgc/platform.h"
|
13
|
+
|
14
|
+
namespace cppgc {
|
15
|
+
namespace internal {
|
16
|
+
|
17
|
+
class HeapBase;
|
18
|
+
|
19
|
+
#if defined(CPPGC_YOUNG_GENERATION)
|
20
|
+
|
21
|
+
// AgeTable contains entries that correspond to 4KB memory regions. Each entry
|
22
|
+
// can be in one of three states: kOld, kYoung or kUnknown.
|
23
|
+
class AgeTable final {
|
24
|
+
static constexpr size_t kGranularityBits = 12; // 4KiB per byte.
|
25
|
+
|
26
|
+
public:
|
27
|
+
enum class Age : uint8_t { kOld, kYoung, kUnknown };
|
28
|
+
|
29
|
+
static constexpr size_t kEntrySizeInBytes = 1 << kGranularityBits;
|
30
|
+
|
31
|
+
Age& operator[](uintptr_t offset) { return table_[entry(offset)]; }
|
32
|
+
Age operator[](uintptr_t offset) const { return table_[entry(offset)]; }
|
33
|
+
|
34
|
+
void Reset(PageAllocator* allocator);
|
35
|
+
|
36
|
+
private:
|
37
|
+
static constexpr size_t kAgeTableSize =
|
38
|
+
api_constants::kCagedHeapReservationSize >> kGranularityBits;
|
39
|
+
|
40
|
+
size_t entry(uintptr_t offset) const {
|
41
|
+
const size_t entry = offset >> kGranularityBits;
|
42
|
+
CPPGC_DCHECK(table_.size() > entry);
|
43
|
+
return entry;
|
44
|
+
}
|
45
|
+
|
46
|
+
std::array<Age, kAgeTableSize> table_;
|
47
|
+
};
|
48
|
+
|
49
|
+
static_assert(sizeof(AgeTable) == 1 * api_constants::kMB,
|
50
|
+
"Size of AgeTable is 1MB");
|
51
|
+
|
52
|
+
#endif // CPPGC_YOUNG_GENERATION
|
53
|
+
|
54
|
+
struct CagedHeapLocalData final {
|
55
|
+
explicit CagedHeapLocalData(HeapBase* heap_base) : heap_base(heap_base) {}
|
56
|
+
|
57
|
+
bool is_marking_in_progress = false;
|
58
|
+
HeapBase* heap_base = nullptr;
|
59
|
+
#if defined(CPPGC_YOUNG_GENERATION)
|
60
|
+
AgeTable age_table;
|
61
|
+
#endif
|
62
|
+
};
|
63
|
+
|
64
|
+
} // namespace internal
|
65
|
+
} // namespace cppgc
|
66
|
+
|
67
|
+
#endif // INCLUDE_CPPGC_INTERNAL_CAGED_HEAP_LOCAL_DATA_H_
|
@@ -0,0 +1,38 @@
|
|
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
|
+
|
5
|
+
#ifndef INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
|
7
|
+
|
8
|
+
namespace cppgc {
|
9
|
+
|
10
|
+
#if defined(__has_attribute)
|
11
|
+
#define CPPGC_HAS_ATTRIBUTE(FEATURE) __has_attribute(FEATURE)
|
12
|
+
#else
|
13
|
+
#define CPPGC_HAS_ATTRIBUTE(FEATURE) 0
|
14
|
+
#endif
|
15
|
+
|
16
|
+
#if defined(__has_cpp_attribute)
|
17
|
+
#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) __has_cpp_attribute(FEATURE)
|
18
|
+
#else
|
19
|
+
#define CPPGC_HAS_CPP_ATTRIBUTE(FEATURE) 0
|
20
|
+
#endif
|
21
|
+
|
22
|
+
// [[no_unique_address]] comes in C++20 but supported in clang with -std >=
|
23
|
+
// c++11.
|
24
|
+
#if CPPGC_HAS_CPP_ATTRIBUTE(no_unique_address) // NOLINTNEXTLINE
|
25
|
+
#define CPPGC_NO_UNIQUE_ADDRESS [[no_unique_address]]
|
26
|
+
#else
|
27
|
+
#define CPPGC_NO_UNIQUE_ADDRESS
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#if CPPGC_HAS_ATTRIBUTE(unused) // NOLINTNEXTLINE
|
31
|
+
#define CPPGC_UNUSED __attribute__((unused))
|
32
|
+
#else
|
33
|
+
#define CPPGC_UNUSED
|
34
|
+
#endif
|
35
|
+
|
36
|
+
} // namespace cppgc
|
37
|
+
|
38
|
+
#endif // INCLUDE_CPPGC_INTERNAL_COMPILER_SPECIFIC_H_
|