libv8 6.2.414.42.1-universal-darwin-16 → 8.4.255.0-universal-darwin-16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/libv8/paths.rb +5 -18
- data/lib/libv8/version.rb +1 -1
- data/vendor/v8/include/cppgc/allocation.h +124 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +192 -0
- data/vendor/v8/include/cppgc/heap.h +50 -0
- data/vendor/v8/include/cppgc/internal/accessors.h +26 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +44 -0
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +26 -0
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +43 -0
- data/vendor/v8/include/cppgc/internal/logging.h +50 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +109 -0
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +133 -0
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +31 -0
- data/vendor/v8/include/cppgc/liveness-broker.h +50 -0
- data/vendor/v8/include/cppgc/macros.h +26 -0
- data/vendor/v8/include/cppgc/member.h +206 -0
- data/vendor/v8/include/cppgc/persistent.h +304 -0
- data/vendor/v8/include/cppgc/platform.h +31 -0
- data/vendor/v8/include/cppgc/prefinalizer.h +54 -0
- data/vendor/v8/include/cppgc/source-location.h +59 -0
- data/vendor/v8/include/cppgc/trace-trait.h +67 -0
- data/vendor/v8/include/cppgc/type-traits.h +109 -0
- data/vendor/v8/include/cppgc/visitor.h +137 -0
- data/vendor/v8/include/libplatform/libplatform.h +15 -13
- data/vendor/v8/include/libplatform/v8-tracing.h +69 -21
- data/vendor/v8/include/v8-fast-api-calls.h +412 -0
- data/vendor/v8/include/v8-inspector-protocol.h +4 -4
- data/vendor/v8/include/v8-inspector.h +95 -35
- data/vendor/v8/include/v8-internal.h +389 -0
- data/vendor/v8/include/v8-platform.h +388 -52
- data/vendor/v8/include/v8-profiler.h +363 -213
- data/vendor/v8/include/v8-util.h +33 -36
- data/vendor/v8/include/v8-version-string.h +10 -5
- data/vendor/v8/include/v8-version.h +4 -4
- 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 +3566 -1925
- data/vendor/v8/include/v8config.h +162 -114
- data/vendor/v8/out.gn/libv8/obj/libv8_libbase.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_libplatform.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/icu/libicui18n.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/icu/libicuuc.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/zlib/google/libcompression_utils_portable.a +0 -0
- data/vendor/v8/out.gn/libv8/obj/third_party/zlib/libchrome_zlib.a +0 -0
- metadata +51 -30
- data/ext/libv8/arch.rb +0 -20
- data/vendor/v8/include/v8-debug.h +0 -255
- data/vendor/v8/include/v8-testing.h +0 -48
- data/vendor/v8/out/x64.release/libv8_base.a +0 -0
- data/vendor/v8/out/x64.release/libv8_builtins_generators.a +0 -0
- data/vendor/v8/out/x64.release/libv8_builtins_setup.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libbase.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libplatform.a +0 -0
- data/vendor/v8/out/x64.release/libv8_libsampler.a +0 -0
- data/vendor/v8/out/x64.release/libv8_nosnapshot.a +0 -0
- data/vendor/v8/out/x64.release/libv8_snapshot.a +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8829f5926bd749011670ae7361ee7e4cc8f28fcfbb450671e05ffd3abf65fff3
|
4
|
+
data.tar.gz: fd6bca9eb73d8b5adb403c5ae17fbdfa080dde029ec50be797ee1bd4761eee43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43d3c3e77e48f8792e55f3b39a4c222208d0770aa3c627e142b82785106802702eb5da723cc5f6d29804c3b8ced56b51de71e33af687b1a7115e9429b4dc93e6
|
7
|
+
data.tar.gz: 6f28b2098d2b30e2aee1664023c8c78ee67bf715fc6aa131e92351a99cb31fe2fe383ebce5bf63d765ece9d8e338dfdc6ff7b0d244c5274546940c886d8a47f6
|
data/ext/libv8/paths.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'rbconfig'
|
2
2
|
require 'shellwords'
|
3
|
-
require File.expand_path '../arch', __FILE__
|
4
3
|
|
5
4
|
module Libv8
|
6
5
|
module Paths
|
@@ -11,29 +10,17 @@ module Libv8
|
|
11
10
|
end
|
12
11
|
|
13
12
|
def object_paths
|
14
|
-
[
|
15
|
-
|
16
|
-
|
13
|
+
[Shellwords.escape(File.join(vendored_source_path,
|
14
|
+
'out.gn',
|
15
|
+
'libv8',
|
16
|
+
'obj',
|
17
|
+
"libv8_monolith.#{config['LIBEXT']}"))]
|
17
18
|
end
|
18
19
|
|
19
20
|
def config
|
20
21
|
RbConfig::MAKEFILE_CONFIG
|
21
22
|
end
|
22
23
|
|
23
|
-
def libv8_object(name)
|
24
|
-
filename = "#{libv8_profile}/libv8_#{name}.#{config['LIBEXT']}"
|
25
|
-
unless File.exist? filename
|
26
|
-
filename = "#{libv8_profile}/obj.target/tools/gyp/libv8_#{name}.#{config['LIBEXT']}"
|
27
|
-
end
|
28
|
-
return filename
|
29
|
-
end
|
30
|
-
|
31
|
-
def libv8_profile
|
32
|
-
base = "#{vendored_source_path}/out/#{Libv8::Arch.libv8_arch}"
|
33
|
-
debug = "#{base}.debug"
|
34
|
-
File.exist?(debug) ? debug : "#{base}.release"
|
35
|
-
end
|
36
|
-
|
37
24
|
def vendored_source_path
|
38
25
|
File.expand_path "../../../vendor/v8", __FILE__
|
39
26
|
end
|
data/lib/libv8/version.rb
CHANGED
@@ -0,0 +1,124 @@
|
|
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_ALLOCATION_H_
|
6
|
+
#define INCLUDE_CPPGC_ALLOCATION_H_
|
7
|
+
|
8
|
+
#include <stdint.h>
|
9
|
+
#include <atomic>
|
10
|
+
|
11
|
+
#include "cppgc/garbage-collected.h"
|
12
|
+
#include "cppgc/heap.h"
|
13
|
+
#include "cppgc/internal/api-constants.h"
|
14
|
+
#include "cppgc/internal/gc-info.h"
|
15
|
+
|
16
|
+
namespace cppgc {
|
17
|
+
|
18
|
+
template <typename T>
|
19
|
+
class MakeGarbageCollectedTraitBase;
|
20
|
+
|
21
|
+
namespace internal {
|
22
|
+
|
23
|
+
class V8_EXPORT MakeGarbageCollectedTraitInternal {
|
24
|
+
protected:
|
25
|
+
static inline void MarkObjectAsFullyConstructed(const void* payload) {
|
26
|
+
// See api_constants for an explanation of the constants.
|
27
|
+
std::atomic<uint16_t>* atomic_mutable_bitfield =
|
28
|
+
reinterpret_cast<std::atomic<uint16_t>*>(
|
29
|
+
const_cast<uint16_t*>(reinterpret_cast<const uint16_t*>(
|
30
|
+
reinterpret_cast<const uint8_t*>(payload) -
|
31
|
+
api_constants::kFullyConstructedBitFieldOffsetFromPayload)));
|
32
|
+
uint16_t value = atomic_mutable_bitfield->load(std::memory_order_relaxed);
|
33
|
+
value = value | api_constants::kFullyConstructedBitMask;
|
34
|
+
atomic_mutable_bitfield->store(value, std::memory_order_release);
|
35
|
+
}
|
36
|
+
|
37
|
+
static void* Allocate(cppgc::Heap* heap, size_t size, GCInfoIndex index);
|
38
|
+
|
39
|
+
friend class HeapObjectHeader;
|
40
|
+
};
|
41
|
+
|
42
|
+
} // namespace internal
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Base trait that provides utilities for advancers users that have custom
|
46
|
+
* allocation needs (e.g., overriding size). It's expected that users override
|
47
|
+
* MakeGarbageCollectedTrait (see below) and inherit from
|
48
|
+
* MakeGarbageCollectedTraitBase and make use of the low-level primitives
|
49
|
+
* offered to allocate and construct an object.
|
50
|
+
*/
|
51
|
+
template <typename T>
|
52
|
+
class MakeGarbageCollectedTraitBase
|
53
|
+
: private internal::MakeGarbageCollectedTraitInternal {
|
54
|
+
protected:
|
55
|
+
/**
|
56
|
+
* Allocates memory for an object of type T.
|
57
|
+
*
|
58
|
+
* \param heap The heap to allocate this object on.
|
59
|
+
* \param size The size that should be reserved for the object.
|
60
|
+
* \returns the memory to construct an object of type T on.
|
61
|
+
*/
|
62
|
+
static void* Allocate(Heap* heap, size_t size) {
|
63
|
+
// TODO(chromium:1056170): Allow specifying arena for specific embedder
|
64
|
+
// uses.
|
65
|
+
return internal::MakeGarbageCollectedTraitInternal::Allocate(
|
66
|
+
heap, size, internal::GCInfoTrait<T>::Index());
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Marks an object as fully constructed, resulting in precise handling by the
|
71
|
+
* garbage collector.
|
72
|
+
*
|
73
|
+
* \param payload The base pointer the object is allocated at.
|
74
|
+
*/
|
75
|
+
static void MarkObjectAsFullyConstructed(const void* payload) {
|
76
|
+
internal::MakeGarbageCollectedTraitInternal::MarkObjectAsFullyConstructed(
|
77
|
+
payload);
|
78
|
+
}
|
79
|
+
};
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Default trait class that specifies how to construct an object of type T.
|
83
|
+
* Advanced users may override how an object is constructed using the utilities
|
84
|
+
* that are provided through MakeGarbageCollectedTraitBase.
|
85
|
+
*
|
86
|
+
* Any trait overriding construction must
|
87
|
+
* - allocate through MakeGarbageCollectedTraitBase<T>::Allocate;
|
88
|
+
* - mark the object as fully constructed using
|
89
|
+
* MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed;
|
90
|
+
*/
|
91
|
+
template <typename T>
|
92
|
+
class MakeGarbageCollectedTrait : public MakeGarbageCollectedTraitBase<T> {
|
93
|
+
public:
|
94
|
+
template <typename... Args>
|
95
|
+
static T* Call(Heap* heap, Args&&... args) {
|
96
|
+
static_assert(internal::IsGarbageCollectedType<T>::value,
|
97
|
+
"T needs to be a garbage collected object");
|
98
|
+
static_assert(
|
99
|
+
!internal::IsGarbageCollectedMixinType<T>::value ||
|
100
|
+
sizeof(T) <= internal::api_constants::kLargeObjectSizeThreshold,
|
101
|
+
"GarbageCollectedMixin may not be a large object");
|
102
|
+
void* memory = MakeGarbageCollectedTraitBase<T>::Allocate(heap, sizeof(T));
|
103
|
+
T* object = ::new (memory) T(std::forward<Args>(args)...);
|
104
|
+
MakeGarbageCollectedTraitBase<T>::MarkObjectAsFullyConstructed(object);
|
105
|
+
return object;
|
106
|
+
}
|
107
|
+
};
|
108
|
+
|
109
|
+
/**
|
110
|
+
* Constructs a managed object of type T where T transitively inherits from
|
111
|
+
* GarbageCollected.
|
112
|
+
*
|
113
|
+
* \param args List of arguments with which an instance of T will be
|
114
|
+
* constructed.
|
115
|
+
* \returns an instance of type T.
|
116
|
+
*/
|
117
|
+
template <typename T, typename... Args>
|
118
|
+
T* MakeGarbageCollected(Heap* heap, Args&&... args) {
|
119
|
+
return MakeGarbageCollectedTrait<T>::Call(heap, std::forward<Args>(args)...);
|
120
|
+
}
|
121
|
+
|
122
|
+
} // namespace cppgc
|
123
|
+
|
124
|
+
#endif // INCLUDE_CPPGC_ALLOCATION_H_
|
@@ -0,0 +1,192 @@
|
|
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/macros.h"
|
12
|
+
#include "cppgc/platform.h"
|
13
|
+
#include "cppgc/trace-trait.h"
|
14
|
+
#include "cppgc/type-traits.h"
|
15
|
+
|
16
|
+
namespace cppgc {
|
17
|
+
|
18
|
+
class Visitor;
|
19
|
+
|
20
|
+
namespace internal {
|
21
|
+
|
22
|
+
class GarbageCollectedBase {
|
23
|
+
public:
|
24
|
+
// Must use MakeGarbageCollected.
|
25
|
+
void* operator new(size_t) = delete;
|
26
|
+
void* operator new[](size_t) = delete;
|
27
|
+
// The garbage collector is taking care of reclaiming the object. Also,
|
28
|
+
// virtual destructor requires an unambiguous, accessible 'operator delete'.
|
29
|
+
void operator delete(void*) {
|
30
|
+
#ifdef V8_ENABLE_CHECKS
|
31
|
+
internal::Abort();
|
32
|
+
#endif // V8_ENABLE_CHECKS
|
33
|
+
}
|
34
|
+
void operator delete[](void*) = delete;
|
35
|
+
|
36
|
+
protected:
|
37
|
+
GarbageCollectedBase() = default;
|
38
|
+
};
|
39
|
+
|
40
|
+
} // namespace internal
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Base class for managed objects. Only descendent types of GarbageCollected
|
44
|
+
* can be constructed using MakeGarbageCollected. Must be inherited from as
|
45
|
+
* left-most base class.
|
46
|
+
*
|
47
|
+
* Types inheriting from GarbageCollected must provide a method of
|
48
|
+
* signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
|
49
|
+
* pointers to the visitor and delegates to garbage-collected base classes.
|
50
|
+
* The method must be virtual if the type is not directly a child of
|
51
|
+
* GarbageCollected and marked as final.
|
52
|
+
*
|
53
|
+
* \code
|
54
|
+
* // Example using final class.
|
55
|
+
* class FinalType final : public GarbageCollected<FinalType> {
|
56
|
+
* public:
|
57
|
+
* void Trace(cppgc::Visitor* visitor) const {
|
58
|
+
* // Dispatch using visitor->Trace(...);
|
59
|
+
* }
|
60
|
+
* };
|
61
|
+
*
|
62
|
+
* // Example using non-final base class.
|
63
|
+
* class NonFinalBase : public GarbageCollected<NonFinalBase> {
|
64
|
+
* public:
|
65
|
+
* virtual void Trace(cppgc::Visitor*) const {}
|
66
|
+
* };
|
67
|
+
*
|
68
|
+
* class FinalChild final : public NonFinalBase {
|
69
|
+
* public:
|
70
|
+
* void Trace(cppgc::Visitor* visitor) const final {
|
71
|
+
* // Dispatch using visitor->Trace(...);
|
72
|
+
* NonFinalBase::Trace(visitor);
|
73
|
+
* }
|
74
|
+
* };
|
75
|
+
* \endcode
|
76
|
+
*/
|
77
|
+
template <typename>
|
78
|
+
class GarbageCollected : public internal::GarbageCollectedBase {
|
79
|
+
public:
|
80
|
+
using IsGarbageCollectedTypeMarker = void;
|
81
|
+
|
82
|
+
protected:
|
83
|
+
GarbageCollected() = default;
|
84
|
+
};
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Base class for managed mixin objects. Such objects cannot be constructed
|
88
|
+
* directly but must be mixed into the inheritance hierarchy of a
|
89
|
+
* GarbageCollected object.
|
90
|
+
*
|
91
|
+
* Types inheriting from GarbageCollectedMixin must override a virtual method
|
92
|
+
* of signature `void Trace(cppgc::Visitor*) const` that dispatchs all managed
|
93
|
+
* pointers to the visitor and delegates to base classes.
|
94
|
+
*
|
95
|
+
* \code
|
96
|
+
* class Mixin : public GarbageCollectedMixin {
|
97
|
+
* public:
|
98
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
99
|
+
* // Dispatch using visitor->Trace(...);
|
100
|
+
* }
|
101
|
+
* };
|
102
|
+
* \endcode
|
103
|
+
*/
|
104
|
+
class GarbageCollectedMixin : public internal::GarbageCollectedBase {
|
105
|
+
public:
|
106
|
+
using IsGarbageCollectedMixinTypeMarker = void;
|
107
|
+
|
108
|
+
// Sentinel used to mark not-fully-constructed mixins.
|
109
|
+
static constexpr void* kNotFullyConstructedObject = nullptr;
|
110
|
+
|
111
|
+
// Provide default implementation that indicate that the vtable is not yet
|
112
|
+
// set up properly. This is used to to get GCInfo objects for mixins so that
|
113
|
+
// these objects can be processed later on.
|
114
|
+
virtual TraceDescriptor GetTraceDescriptor() const {
|
115
|
+
return {kNotFullyConstructedObject, nullptr};
|
116
|
+
}
|
117
|
+
|
118
|
+
/**
|
119
|
+
* This Trace method must be overriden by objects inheriting from
|
120
|
+
* GarbageCollectedMixin.
|
121
|
+
*/
|
122
|
+
virtual void Trace(cppgc::Visitor*) const {}
|
123
|
+
};
|
124
|
+
|
125
|
+
/**
|
126
|
+
* Macro defines all methods and markers needed for handling mixins. Must be
|
127
|
+
* used on the type that is inheriting from GarbageCollected *and*
|
128
|
+
* GarbageCollectedMixin.
|
129
|
+
*
|
130
|
+
* \code
|
131
|
+
* class Mixin : public GarbageCollectedMixin {
|
132
|
+
* public:
|
133
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
134
|
+
* // Dispatch using visitor->Trace(...);
|
135
|
+
* }
|
136
|
+
* };
|
137
|
+
*
|
138
|
+
* class Foo : public GarbageCollected<Foo>, public Mixin {
|
139
|
+
* USING_GARBAGE_COLLECTED_MIXIN();
|
140
|
+
* public:
|
141
|
+
* void Trace(cppgc::Visitor* visitor) const override {
|
142
|
+
* // Dispatch using visitor->Trace(...);
|
143
|
+
* Mixin::Trace(visitor);
|
144
|
+
* }
|
145
|
+
* };
|
146
|
+
* \endcode
|
147
|
+
*/
|
148
|
+
#define USING_GARBAGE_COLLECTED_MIXIN() \
|
149
|
+
public: \
|
150
|
+
/* Marker is used by clang to check for proper usages of the macro. */ \
|
151
|
+
typedef int HasUsingGarbageCollectedMixinMacro; \
|
152
|
+
\
|
153
|
+
TraceDescriptor GetTraceDescriptor() const override { \
|
154
|
+
static_assert( \
|
155
|
+
internal::IsSubclassOfTemplate< \
|
156
|
+
std::remove_const_t<std::remove_pointer_t<decltype(this)>>, \
|
157
|
+
cppgc::GarbageCollected>::value, \
|
158
|
+
"Only garbage collected objects can have garbage collected mixins"); \
|
159
|
+
return {this, TraceTrait<std::remove_const_t< \
|
160
|
+
std::remove_pointer_t<decltype(this)>>>::Trace}; \
|
161
|
+
} \
|
162
|
+
\
|
163
|
+
private: \
|
164
|
+
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Merge two or more Mixins into one.
|
168
|
+
*
|
169
|
+
* \code
|
170
|
+
* class A : public GarbageCollectedMixin {};
|
171
|
+
* class B : public GarbageCollectedMixin {};
|
172
|
+
* class C : public A, public B {
|
173
|
+
* MERGE_GARBAGE_COLLECTED_MIXINS();
|
174
|
+
* public:
|
175
|
+
* };
|
176
|
+
* \endcode
|
177
|
+
*/
|
178
|
+
#define MERGE_GARBAGE_COLLECTED_MIXINS() \
|
179
|
+
public: \
|
180
|
+
/* When using multiple mixins the methods become */ \
|
181
|
+
/* ambigous. Providing additional implementations */ \
|
182
|
+
/* disambiguate them again. */ \
|
183
|
+
TraceDescriptor GetTraceDescriptor() const override { \
|
184
|
+
return {kNotFullyConstructedObject, nullptr}; \
|
185
|
+
} \
|
186
|
+
\
|
187
|
+
private: \
|
188
|
+
friend class internal::__thisIsHereToForceASemicolonAfterThisMacro
|
189
|
+
|
190
|
+
} // namespace cppgc
|
191
|
+
|
192
|
+
#endif // INCLUDE_CPPGC_GARBAGE_COLLECTED_H_
|
@@ -0,0 +1,50 @@
|
|
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
|
+
|
10
|
+
#include "v8config.h" // NOLINT(build/include_directory)
|
11
|
+
|
12
|
+
namespace cppgc {
|
13
|
+
namespace internal {
|
14
|
+
class Heap;
|
15
|
+
} // namespace internal
|
16
|
+
|
17
|
+
class V8_EXPORT Heap {
|
18
|
+
public:
|
19
|
+
// Normal spaces are used to store objects of different size classes:
|
20
|
+
// - kNormal1: < 32 bytes
|
21
|
+
// - kNormal2: < 64 bytes
|
22
|
+
// - kNormal3: < 128 bytes
|
23
|
+
// - kNormal4: >= 128 bytes
|
24
|
+
// Objects of size greater than 2^16 get stored in the large space. Users can
|
25
|
+
// register up to 4 arenas for application specific needs.
|
26
|
+
enum class SpaceType {
|
27
|
+
kNormal1,
|
28
|
+
kNormal2,
|
29
|
+
kNormal3,
|
30
|
+
kNormal4,
|
31
|
+
kLarge,
|
32
|
+
kUserDefined1,
|
33
|
+
kUserDefined2,
|
34
|
+
kUserDefined3,
|
35
|
+
kUserDefined4,
|
36
|
+
};
|
37
|
+
|
38
|
+
static std::unique_ptr<Heap> Create();
|
39
|
+
|
40
|
+
virtual ~Heap() = default;
|
41
|
+
|
42
|
+
private:
|
43
|
+
Heap() = default;
|
44
|
+
|
45
|
+
friend class internal::Heap;
|
46
|
+
};
|
47
|
+
|
48
|
+
} // namespace cppgc
|
49
|
+
|
50
|
+
#endif // INCLUDE_CPPGC_HEAP_H_
|
@@ -0,0 +1,26 @@
|
|
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_ACCESSORS_H_
|
6
|
+
#define INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
|
7
|
+
|
8
|
+
#include "cppgc/internal/api-constants.h"
|
9
|
+
|
10
|
+
namespace cppgc {
|
11
|
+
|
12
|
+
class Heap;
|
13
|
+
|
14
|
+
namespace internal {
|
15
|
+
|
16
|
+
inline cppgc::Heap* GetHeapFromPayload(const void* payload) {
|
17
|
+
return *reinterpret_cast<cppgc::Heap**>(
|
18
|
+
((reinterpret_cast<uintptr_t>(payload) & api_constants::kPageBaseMask) +
|
19
|
+
api_constants::kGuardPageSize) +
|
20
|
+
api_constants::kHeapOffset);
|
21
|
+
}
|
22
|
+
|
23
|
+
} // namespace internal
|
24
|
+
} // namespace cppgc
|
25
|
+
|
26
|
+
#endif // INCLUDE_CPPGC_INTERNAL_ACCESSORS_H_
|