libv8-node 16.10.0.0-arm64-darwin → 18.8.0.0-arm64-darwin
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 +4 -4
- data/ext/libv8-node/paths.rb +1 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +100 -22
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +114 -33
- data/vendor/v8/include/cppgc/default-platform.h +2 -10
- data/vendor/v8/include/cppgc/explicit-management.h +22 -4
- data/vendor/v8/include/cppgc/garbage-collected.h +15 -26
- data/vendor/v8/include/cppgc/heap-consistency.h +30 -0
- data/vendor/v8/include/cppgc/heap-state.h +12 -0
- data/vendor/v8/include/cppgc/heap.h +7 -2
- data/vendor/v8/include/cppgc/internal/api-constants.h +8 -0
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +25 -14
- data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
- data/vendor/v8/include/cppgc/internal/gc-info.h +90 -10
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/name-trait.h +11 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +73 -29
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +26 -15
- data/vendor/v8/include/cppgc/internal/write-barrier.h +62 -23
- data/vendor/v8/include/cppgc/liveness-broker.h +4 -1
- data/vendor/v8/include/cppgc/member.h +7 -2
- data/vendor/v8/include/cppgc/persistent.h +38 -33
- data/vendor/v8/include/cppgc/platform.h +4 -1
- data/vendor/v8/include/cppgc/prefinalizer.h +35 -12
- data/vendor/v8/include/cppgc/testing.h +9 -2
- data/vendor/v8/include/cppgc/type-traits.h +6 -13
- data/vendor/v8/include/cppgc/visitor.h +9 -7
- data/vendor/v8/include/libplatform/libplatform.h +0 -11
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +445 -0
- data/vendor/v8/include/v8-callbacks.h +397 -0
- data/vendor/v8/include/v8-container.h +129 -0
- data/vendor/v8/include/v8-context.h +407 -0
- data/vendor/v8/include/v8-cppgc.h +21 -128
- data/vendor/v8/include/v8-data.h +80 -0
- data/vendor/v8/include/v8-date.h +43 -0
- data/vendor/v8/include/v8-debug.h +168 -0
- data/vendor/v8/include/v8-embedder-heap.h +218 -0
- data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
- data/vendor/v8/include/v8-exception.h +217 -0
- data/vendor/v8/include/v8-extension.h +62 -0
- data/vendor/v8/include/v8-external.h +37 -0
- data/vendor/v8/include/v8-fast-api-calls.h +172 -24
- data/vendor/v8/include/v8-forward.h +81 -0
- data/vendor/v8/include/v8-function-callback.h +475 -0
- data/vendor/v8/include/v8-function.h +125 -0
- data/vendor/v8/include/v8-initialization.h +315 -0
- data/vendor/v8/include/v8-inspector.h +56 -28
- data/vendor/v8/include/v8-internal.h +217 -55
- data/vendor/v8/include/v8-isolate.h +1709 -0
- data/vendor/v8/include/v8-json.h +47 -0
- data/vendor/v8/include/v8-local-handle.h +455 -0
- data/vendor/v8/include/v8-locker.h +149 -0
- data/vendor/v8/include/v8-maybe.h +137 -0
- data/vendor/v8/include/v8-memory-span.h +43 -0
- data/vendor/v8/include/v8-message.h +216 -0
- data/vendor/v8/include/v8-metrics.h +69 -16
- data/vendor/v8/include/v8-microtask-queue.h +152 -0
- data/vendor/v8/include/v8-microtask.h +28 -0
- data/vendor/v8/include/v8-object.h +775 -0
- data/vendor/v8/include/v8-persistent-handle.h +590 -0
- data/vendor/v8/include/v8-platform.h +400 -17
- data/vendor/v8/include/v8-primitive-object.h +118 -0
- data/vendor/v8/include/v8-primitive.h +866 -0
- data/vendor/v8/include/v8-profiler.h +88 -13
- data/vendor/v8/include/v8-promise.h +174 -0
- data/vendor/v8/include/v8-proxy.h +50 -0
- data/vendor/v8/include/v8-regexp.h +105 -0
- data/vendor/v8/include/v8-script.h +747 -0
- data/vendor/v8/include/v8-snapshot.h +196 -0
- data/vendor/v8/include/v8-statistics.h +217 -0
- data/vendor/v8/include/v8-template.h +1079 -0
- data/vendor/v8/include/v8-traced-handle.h +420 -0
- data/vendor/v8/include/v8-typed-array.h +282 -0
- data/vendor/v8/include/v8-unwinder-state.h +4 -3
- data/vendor/v8/include/v8-unwinder.h +132 -0
- data/vendor/v8/include/v8-util.h +7 -1
- data/vendor/v8/include/v8-value-serializer-version.h +1 -1
- data/vendor/v8/include/v8-value-serializer.h +279 -0
- data/vendor/v8/include/v8-value.h +526 -0
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +257 -0
- data/vendor/v8/include/v8-weak-callback-info.h +87 -0
- data/vendor/v8/include/v8.h +41 -12601
- data/vendor/v8/include/v8config.h +102 -12
- metadata +47 -5
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
@@ -15,9 +15,12 @@
|
|
15
15
|
|
16
16
|
namespace v8 {
|
17
17
|
|
18
|
+
class Array;
|
18
19
|
class Context;
|
19
20
|
class Data;
|
20
21
|
class Isolate;
|
22
|
+
template <typename T>
|
23
|
+
class Local;
|
21
24
|
|
22
25
|
namespace internal {
|
23
26
|
|
@@ -26,6 +29,13 @@ class Isolate;
|
|
26
29
|
typedef uintptr_t Address;
|
27
30
|
static const Address kNullAddress = 0;
|
28
31
|
|
32
|
+
constexpr int KB = 1024;
|
33
|
+
constexpr int MB = KB * 1024;
|
34
|
+
constexpr int GB = MB * 1024;
|
35
|
+
#ifdef V8_TARGET_ARCH_X64
|
36
|
+
constexpr size_t TB = size_t{GB} * 1024;
|
37
|
+
#endif
|
38
|
+
|
29
39
|
/**
|
30
40
|
* Configuration of tagging scheme.
|
31
41
|
*/
|
@@ -33,6 +43,7 @@ const int kApiSystemPointerSize = sizeof(void*);
|
|
33
43
|
const int kApiDoubleSize = sizeof(double);
|
34
44
|
const int kApiInt32Size = sizeof(int32_t);
|
35
45
|
const int kApiInt64Size = sizeof(int64_t);
|
46
|
+
const int kApiSizetSize = sizeof(size_t);
|
36
47
|
|
37
48
|
// Tag information for HeapObject.
|
38
49
|
const int kHeapObjectTag = 1;
|
@@ -105,6 +116,11 @@ struct SmiTagging<8> {
|
|
105
116
|
};
|
106
117
|
|
107
118
|
#ifdef V8_COMPRESS_POINTERS
|
119
|
+
// See v8:7703 or src/common/ptr-compr-inl.h for details about pointer
|
120
|
+
// compression.
|
121
|
+
constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32;
|
122
|
+
constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
|
123
|
+
|
108
124
|
static_assert(
|
109
125
|
kApiSystemPointerSize == kApiInt64Size,
|
110
126
|
"Pointer compression can be enabled only for 64-bit architectures");
|
@@ -117,39 +133,6 @@ constexpr bool PointerCompressionIsEnabled() {
|
|
117
133
|
return kApiTaggedSize != kApiSystemPointerSize;
|
118
134
|
}
|
119
135
|
|
120
|
-
constexpr bool HeapSandboxIsEnabled() {
|
121
|
-
#ifdef V8_HEAP_SANDBOX
|
122
|
-
return true;
|
123
|
-
#else
|
124
|
-
return false;
|
125
|
-
#endif
|
126
|
-
}
|
127
|
-
|
128
|
-
using ExternalPointer_t = Address;
|
129
|
-
|
130
|
-
// If the heap sandbox is enabled, these tag values will be ORed with the
|
131
|
-
// external pointers in the external pointer table to prevent use of pointers of
|
132
|
-
// the wrong type. When a pointer is loaded, it is ANDed with the inverse of the
|
133
|
-
// expected type's tag. The tags are constructed in a way that guarantees that a
|
134
|
-
// failed type check will result in one or more of the top bits of the pointer
|
135
|
-
// to be set, rendering the pointer inacessible. This construction allows
|
136
|
-
// performing the type check and removing GC marking bits from the pointer at
|
137
|
-
// the same time.
|
138
|
-
enum ExternalPointerTag : uint64_t {
|
139
|
-
kExternalPointerNullTag = 0x0000000000000000,
|
140
|
-
kArrayBufferBackingStoreTag = 0x00ff000000000000, // 0b000000011111111
|
141
|
-
kTypedArrayExternalPointerTag = 0x017f000000000000, // 0b000000101111111
|
142
|
-
kDataViewDataPointerTag = 0x01bf000000000000, // 0b000000110111111
|
143
|
-
kExternalStringResourceTag = 0x01df000000000000, // 0b000000111011111
|
144
|
-
kExternalStringResourceDataTag = 0x01ef000000000000, // 0b000000111101111
|
145
|
-
kForeignForeignAddressTag = 0x01f7000000000000, // 0b000000111110111
|
146
|
-
kNativeContextMicrotaskQueueTag = 0x01fb000000000000, // 0b000000111111011
|
147
|
-
kEmbedderDataSlotPayloadTag = 0x01fd000000000000, // 0b000000111111101
|
148
|
-
kCodeEntryPointTag = 0x01fe000000000000, // 0b000000111111110
|
149
|
-
};
|
150
|
-
|
151
|
-
constexpr uint64_t kExternalPointerTagMask = 0xffff000000000000;
|
152
|
-
|
153
136
|
#ifdef V8_31BIT_SMIS_ON_64BIT_ARCH
|
154
137
|
using PlatformSmiTagging = SmiTagging<kApiInt32Size>;
|
155
138
|
#else
|
@@ -170,6 +153,164 @@ V8_INLINE static constexpr internal::Address IntToSmi(int value) {
|
|
170
153
|
kSmiTag;
|
171
154
|
}
|
172
155
|
|
156
|
+
/*
|
157
|
+
* Sandbox related types, constants, and functions.
|
158
|
+
*/
|
159
|
+
constexpr bool SandboxIsEnabled() {
|
160
|
+
#ifdef V8_SANDBOX
|
161
|
+
return true;
|
162
|
+
#else
|
163
|
+
return false;
|
164
|
+
#endif
|
165
|
+
}
|
166
|
+
|
167
|
+
constexpr bool SandboxedExternalPointersAreEnabled() {
|
168
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
169
|
+
return true;
|
170
|
+
#else
|
171
|
+
return false;
|
172
|
+
#endif
|
173
|
+
}
|
174
|
+
|
175
|
+
// SandboxedPointers are guaranteed to point into the sandbox. This is achieved
|
176
|
+
// for example by storing them as offset rather than as raw pointers.
|
177
|
+
using SandboxedPointer_t = Address;
|
178
|
+
|
179
|
+
// ExternalPointers point to objects located outside the sandbox. When sandboxed
|
180
|
+
// external pointers are enabled, these are stored in an external pointer table
|
181
|
+
// and referenced from HeapObjects through indices.
|
182
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
183
|
+
using ExternalPointer_t = uint32_t;
|
184
|
+
#else
|
185
|
+
using ExternalPointer_t = Address;
|
186
|
+
#endif
|
187
|
+
|
188
|
+
#ifdef V8_SANDBOX_IS_AVAILABLE
|
189
|
+
|
190
|
+
// Size of the sandbox, excluding the guard regions surrounding it.
|
191
|
+
constexpr size_t kSandboxSizeLog2 = 40; // 1 TB
|
192
|
+
constexpr size_t kSandboxSize = 1ULL << kSandboxSizeLog2;
|
193
|
+
|
194
|
+
// Required alignment of the sandbox. For simplicity, we require the
|
195
|
+
// size of the guard regions to be a multiple of this, so that this specifies
|
196
|
+
// the alignment of the sandbox including and excluding surrounding guard
|
197
|
+
// regions. The alignment requirement is due to the pointer compression cage
|
198
|
+
// being located at the start of the sandbox.
|
199
|
+
constexpr size_t kSandboxAlignment = kPtrComprCageBaseAlignment;
|
200
|
+
|
201
|
+
// Sandboxed pointers are stored inside the heap as offset from the sandbox
|
202
|
+
// base shifted to the left. This way, it is guaranteed that the offset is
|
203
|
+
// smaller than the sandbox size after shifting it to the right again. This
|
204
|
+
// constant specifies the shift amount.
|
205
|
+
constexpr uint64_t kSandboxedPointerShift = 64 - kSandboxSizeLog2;
|
206
|
+
|
207
|
+
// Size of the guard regions surrounding the sandbox. This assumes a worst-case
|
208
|
+
// scenario of a 32-bit unsigned index used to access an array of 64-bit
|
209
|
+
// values.
|
210
|
+
constexpr size_t kSandboxGuardRegionSize = 32ULL * GB;
|
211
|
+
|
212
|
+
static_assert((kSandboxGuardRegionSize % kSandboxAlignment) == 0,
|
213
|
+
"The size of the guard regions around the sandbox must be a "
|
214
|
+
"multiple of its required alignment.");
|
215
|
+
|
216
|
+
// Minimum size of the sandbox, excluding the guard regions surrounding it. If
|
217
|
+
// the virtual memory reservation for the sandbox fails, its size is currently
|
218
|
+
// halved until either the reservation succeeds or the minimum size is reached.
|
219
|
+
// A minimum of 32GB allows the 4GB pointer compression region as well as the
|
220
|
+
// ArrayBuffer partition and two 10GB Wasm memory cages to fit into the
|
221
|
+
// sandbox. 32GB should also be the minimum possible size of the userspace
|
222
|
+
// address space as there are some machine configurations with only 36 virtual
|
223
|
+
// address bits.
|
224
|
+
constexpr size_t kSandboxMinimumSize = 32ULL * GB;
|
225
|
+
|
226
|
+
static_assert(kSandboxMinimumSize <= kSandboxSize,
|
227
|
+
"The minimal size of the sandbox must be smaller or equal to the "
|
228
|
+
"regular size.");
|
229
|
+
|
230
|
+
// On OSes where reserving virtual memory is too expensive to reserve the
|
231
|
+
// entire address space backing the sandbox, notably Windows pre 8.1, we create
|
232
|
+
// a partially reserved sandbox that doesn't actually reserve most of the
|
233
|
+
// memory, and so doesn't have the desired security properties as unrelated
|
234
|
+
// memory allocations could end up inside of it, but which still ensures that
|
235
|
+
// objects that should be located inside the sandbox are allocated within
|
236
|
+
// kSandboxSize bytes from the start of the sandbox. The minimum size of the
|
237
|
+
// region that is actually reserved for such a sandbox is specified by this
|
238
|
+
// constant and should be big enough to contain the pointer compression cage as
|
239
|
+
// well as the ArrayBuffer partition.
|
240
|
+
constexpr size_t kSandboxMinimumReservationSize = 8ULL * GB;
|
241
|
+
|
242
|
+
static_assert(kSandboxMinimumSize > kPtrComprCageReservationSize,
|
243
|
+
"The sandbox must be larger than the pointer compression cage "
|
244
|
+
"contained within it.");
|
245
|
+
static_assert(kSandboxMinimumReservationSize > kPtrComprCageReservationSize,
|
246
|
+
"The minimum reservation size for a sandbox must be larger than "
|
247
|
+
"the pointer compression cage contained within it.");
|
248
|
+
|
249
|
+
// For now, even if the sandbox is enabled, we still allow backing stores to be
|
250
|
+
// allocated outside of it as fallback. This will simplify the initial rollout.
|
251
|
+
// However, if sandboxed pointers are also enabled, we must always place
|
252
|
+
// backing stores inside the sandbox as they will be referenced though them.
|
253
|
+
#ifdef V8_SANDBOXED_POINTERS
|
254
|
+
constexpr bool kAllowBackingStoresOutsideSandbox = false;
|
255
|
+
#else
|
256
|
+
constexpr bool kAllowBackingStoresOutsideSandbox = true;
|
257
|
+
#endif // V8_SANDBOXED_POINTERS
|
258
|
+
|
259
|
+
// The size of the virtual memory reservation for an external pointer table.
|
260
|
+
// This determines the maximum number of entries in a table. Using a maximum
|
261
|
+
// size allows omitting bounds checks on table accesses if the indices are
|
262
|
+
// guaranteed (e.g. through shifting) to be below the maximum index. This
|
263
|
+
// value must be a power of two.
|
264
|
+
static const size_t kExternalPointerTableReservationSize = 128 * MB;
|
265
|
+
|
266
|
+
// The maximum number of entries in an external pointer table.
|
267
|
+
static const size_t kMaxSandboxedExternalPointers =
|
268
|
+
kExternalPointerTableReservationSize / kApiSystemPointerSize;
|
269
|
+
|
270
|
+
// The external pointer table indices stored in HeapObjects as external
|
271
|
+
// pointers are shifted to the left by this amount to guarantee that they are
|
272
|
+
// smaller than the maximum table size.
|
273
|
+
static const uint32_t kExternalPointerIndexShift = 8;
|
274
|
+
static_assert((1 << (32 - kExternalPointerIndexShift)) ==
|
275
|
+
kMaxSandboxedExternalPointers,
|
276
|
+
"kExternalPointerTableReservationSize and "
|
277
|
+
"kExternalPointerIndexShift don't match");
|
278
|
+
|
279
|
+
#endif // V8_SANDBOX_IS_AVAILABLE
|
280
|
+
|
281
|
+
// If sandboxed external pointers are enabled, these tag values will be ORed
|
282
|
+
// with the external pointers in the external pointer table to prevent use of
|
283
|
+
// pointers of the wrong type. When a pointer is loaded, it is ANDed with the
|
284
|
+
// inverse of the expected type's tag. The tags are constructed in a way that
|
285
|
+
// guarantees that a failed type check will result in one or more of the top
|
286
|
+
// bits of the pointer to be set, rendering the pointer inacessible. Besides
|
287
|
+
// the type tag bits (48 through 62), the tags also have the GC mark bit (63)
|
288
|
+
// set, so that the mark bit is automatically set when a pointer is written
|
289
|
+
// into the external pointer table (in which case it is clearly alive) and is
|
290
|
+
// cleared when the pointer is loaded. The exception to this is the free entry
|
291
|
+
// tag, which doesn't have the mark bit set, as the entry is not alive. This
|
292
|
+
// construction allows performing the type check and removing GC marking bits
|
293
|
+
// (the MSB) from the pointer at the same time.
|
294
|
+
// Note: this scheme assumes a 48-bit address space and will likely break if
|
295
|
+
// more virtual address bits are used.
|
296
|
+
constexpr uint64_t kExternalPointerTagMask = 0xffff000000000000;
|
297
|
+
constexpr uint64_t kExternalPointerTagShift = 48;
|
298
|
+
#define MAKE_TAG(v) (static_cast<uint64_t>(v) << kExternalPointerTagShift)
|
299
|
+
// clang-format off
|
300
|
+
enum ExternalPointerTag : uint64_t {
|
301
|
+
kExternalPointerNullTag = MAKE_TAG(0b0000000000000000),
|
302
|
+
kExternalPointerFreeEntryTag = MAKE_TAG(0b0111111110000000),
|
303
|
+
kExternalStringResourceTag = MAKE_TAG(0b1000000011111111),
|
304
|
+
kExternalStringResourceDataTag = MAKE_TAG(0b1000000101111111),
|
305
|
+
kForeignForeignAddressTag = MAKE_TAG(0b1000000110111111),
|
306
|
+
kNativeContextMicrotaskQueueTag = MAKE_TAG(0b1000000111011111),
|
307
|
+
kEmbedderDataSlotPayloadTag = MAKE_TAG(0b1000000111101111),
|
308
|
+
kCodeEntryPointTag = MAKE_TAG(0b1000000111110111),
|
309
|
+
kExternalObjectValueTag = MAKE_TAG(0b1000000111111011),
|
310
|
+
};
|
311
|
+
// clang-format on
|
312
|
+
#undef MAKE_TAG
|
313
|
+
|
173
314
|
// Converts encoded external pointer to address.
|
174
315
|
V8_EXPORT Address DecodeExternalPointerImpl(const Isolate* isolate,
|
175
316
|
ExternalPointer_t pointer,
|
@@ -184,6 +325,8 @@ V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
|
|
184
325
|
// language mode is strict.
|
185
326
|
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate* isolate);
|
186
327
|
|
328
|
+
V8_EXPORT bool CanHaveInternalField(int instance_type);
|
329
|
+
|
187
330
|
/**
|
188
331
|
* This class exports constants and functionality from within v8 that
|
189
332
|
* is necessary to implement inline functions in the v8 api. Don't
|
@@ -211,35 +354,46 @@ class Internals {
|
|
211
354
|
static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize;
|
212
355
|
static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize;
|
213
356
|
static const int kEmbedderDataSlotSize = kApiSystemPointerSize;
|
214
|
-
#ifdef
|
357
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
215
358
|
static const int kEmbedderDataSlotRawPayloadOffset = kApiTaggedSize;
|
216
359
|
#endif
|
217
360
|
static const int kNativeContextEmbedderDataOffset = 6 * kApiTaggedSize;
|
218
|
-
static const int
|
361
|
+
static const int kStringRepresentationAndEncodingMask = 0x0f;
|
219
362
|
static const int kStringEncodingMask = 0x8;
|
220
363
|
static const int kExternalTwoByteRepresentationTag = 0x02;
|
221
364
|
static const int kExternalOneByteRepresentationTag = 0x0a;
|
222
365
|
|
223
366
|
static const uint32_t kNumIsolateDataSlots = 4;
|
367
|
+
static const int kStackGuardSize = 7 * kApiSystemPointerSize;
|
368
|
+
static const int kBuiltinTier0EntryTableSize = 10 * kApiSystemPointerSize;
|
369
|
+
static const int kBuiltinTier0TableSize = 10 * kApiSystemPointerSize;
|
224
370
|
|
225
371
|
// IsolateData layout guarantees.
|
226
|
-
static const int
|
372
|
+
static const int kIsolateCageBaseOffset = 0;
|
373
|
+
static const int kIsolateStackGuardOffset =
|
374
|
+
kIsolateCageBaseOffset + kApiSystemPointerSize;
|
375
|
+
static const int kBuiltinTier0EntryTableOffset =
|
376
|
+
kIsolateStackGuardOffset + kStackGuardSize;
|
377
|
+
static const int kBuiltinTier0TableOffset =
|
378
|
+
kBuiltinTier0EntryTableOffset + kBuiltinTier0EntryTableSize;
|
379
|
+
static const int kIsolateEmbedderDataOffset =
|
380
|
+
kBuiltinTier0TableOffset + kBuiltinTier0TableSize;
|
227
381
|
static const int kIsolateFastCCallCallerFpOffset =
|
228
|
-
kNumIsolateDataSlots * kApiSystemPointerSize;
|
382
|
+
kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize;
|
229
383
|
static const int kIsolateFastCCallCallerPcOffset =
|
230
384
|
kIsolateFastCCallCallerFpOffset + kApiSystemPointerSize;
|
231
385
|
static const int kIsolateFastApiCallTargetOffset =
|
232
386
|
kIsolateFastCCallCallerPcOffset + kApiSystemPointerSize;
|
233
|
-
static const int
|
387
|
+
static const int kIsolateLongTaskStatsCounterOffset =
|
234
388
|
kIsolateFastApiCallTargetOffset + kApiSystemPointerSize;
|
235
389
|
static const int kIsolateRootsOffset =
|
236
|
-
|
390
|
+
kIsolateLongTaskStatsCounterOffset + kApiSizetSize;
|
237
391
|
|
238
392
|
static const int kExternalPointerTableBufferOffset = 0;
|
239
|
-
static const int kExternalPointerTableLengthOffset =
|
240
|
-
kExternalPointerTableBufferOffset + kApiSystemPointerSize;
|
241
393
|
static const int kExternalPointerTableCapacityOffset =
|
242
|
-
|
394
|
+
kExternalPointerTableBufferOffset + kApiSystemPointerSize;
|
395
|
+
static const int kExternalPointerTableFreelistHeadOffset =
|
396
|
+
kExternalPointerTableCapacityOffset + kApiInt32Size;
|
243
397
|
|
244
398
|
static const int kUndefinedValueRootIndex = 4;
|
245
399
|
static const int kTheHoleValueRootIndex = 5;
|
@@ -254,12 +408,13 @@ class Internals {
|
|
254
408
|
static const int kNodeStateIsWeakValue = 2;
|
255
409
|
static const int kNodeStateIsPendingValue = 3;
|
256
410
|
|
257
|
-
static const int kFirstNonstringType =
|
258
|
-
static const int kOddballType =
|
259
|
-
static const int kForeignType =
|
411
|
+
static const int kFirstNonstringType = 0x80;
|
412
|
+
static const int kOddballType = 0x83;
|
413
|
+
static const int kForeignType = 0xcc;
|
260
414
|
static const int kJSSpecialApiObjectType = 0x410;
|
261
|
-
static const int kJSApiObjectType = 0x420;
|
262
415
|
static const int kJSObjectType = 0x421;
|
416
|
+
static const int kFirstJSApiObjectType = 0x422;
|
417
|
+
static const int kLastJSApiObjectType = 0x80A;
|
263
418
|
|
264
419
|
static const int kUndefinedOddballKind = 5;
|
265
420
|
static const int kNullOddballKind = 3;
|
@@ -322,7 +477,7 @@ class Internals {
|
|
322
477
|
}
|
323
478
|
|
324
479
|
V8_INLINE static bool IsExternalTwoByteString(int instance_type) {
|
325
|
-
int representation = (instance_type &
|
480
|
+
int representation = (instance_type & kStringRepresentationAndEncodingMask);
|
326
481
|
return representation == kExternalTwoByteRepresentationTag;
|
327
482
|
}
|
328
483
|
|
@@ -364,6 +519,12 @@ class Internals {
|
|
364
519
|
return *reinterpret_cast<void* const*>(addr);
|
365
520
|
}
|
366
521
|
|
522
|
+
V8_INLINE static void IncrementLongTasksStatsCounter(v8::Isolate* isolate) {
|
523
|
+
internal::Address addr = reinterpret_cast<internal::Address>(isolate) +
|
524
|
+
kIsolateLongTaskStatsCounterOffset;
|
525
|
+
++(*reinterpret_cast<size_t*>(addr));
|
526
|
+
}
|
527
|
+
|
367
528
|
V8_INLINE static internal::Address* GetRoot(v8::Isolate* isolate, int index) {
|
368
529
|
internal::Address addr = reinterpret_cast<internal::Address>(isolate) +
|
369
530
|
kIsolateRootsOffset +
|
@@ -411,9 +572,9 @@ class Internals {
|
|
411
572
|
#endif
|
412
573
|
}
|
413
574
|
|
414
|
-
V8_INLINE static internal::Isolate*
|
575
|
+
V8_INLINE static internal::Isolate* GetIsolateForSandbox(
|
415
576
|
internal::Address obj) {
|
416
|
-
#ifdef
|
577
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
417
578
|
return internal::IsolateFromNeverReadOnlySpaceObject(obj);
|
418
579
|
#else
|
419
580
|
// Not used in non-sandbox mode.
|
@@ -424,7 +585,7 @@ class Internals {
|
|
424
585
|
V8_INLINE static Address DecodeExternalPointer(
|
425
586
|
const Isolate* isolate, ExternalPointer_t encoded_pointer,
|
426
587
|
ExternalPointerTag tag) {
|
427
|
-
#ifdef
|
588
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
428
589
|
return internal::DecodeExternalPointerImpl(isolate, encoded_pointer, tag);
|
429
590
|
#else
|
430
591
|
return encoded_pointer;
|
@@ -434,7 +595,7 @@ class Internals {
|
|
434
595
|
V8_INLINE static internal::Address ReadExternalPointerField(
|
435
596
|
internal::Isolate* isolate, internal::Address heap_object_ptr, int offset,
|
436
597
|
ExternalPointerTag tag) {
|
437
|
-
#ifdef
|
598
|
+
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
|
438
599
|
internal::ExternalPointer_t encoded_value =
|
439
600
|
ReadRawField<uint32_t>(heap_object_ptr, offset);
|
440
601
|
// We currently have to treat zero as nullptr in embedder slots.
|
@@ -446,10 +607,6 @@ class Internals {
|
|
446
607
|
}
|
447
608
|
|
448
609
|
#ifdef V8_COMPRESS_POINTERS
|
449
|
-
// See v8:7703 or src/ptr-compr.* for details about pointer compression.
|
450
|
-
static constexpr size_t kPtrComprCageReservationSize = size_t{1} << 32;
|
451
|
-
static constexpr size_t kPtrComprCageBaseAlignment = size_t{1} << 32;
|
452
|
-
|
453
610
|
V8_INLINE static internal::Address GetPtrComprCageBaseFromOnHeapAddress(
|
454
611
|
internal::Address addr) {
|
455
612
|
return addr & -static_cast<intptr_t>(kPtrComprCageBaseAlignment);
|
@@ -493,7 +650,12 @@ V8_INLINE void PerformCastCheck(T* data) {
|
|
493
650
|
// how static casts work with std::shared_ptr.
|
494
651
|
class BackingStoreBase {};
|
495
652
|
|
653
|
+
// The maximum value in enum GarbageCollectionReason, defined in heap.h.
|
654
|
+
// This is needed for histograms sampling garbage collection reasons.
|
655
|
+
constexpr int kGarbageCollectionReasonMaxValue = 25;
|
656
|
+
|
496
657
|
} // namespace internal
|
658
|
+
|
497
659
|
} // namespace v8
|
498
660
|
|
499
661
|
#endif // INCLUDE_V8_INTERNAL_H_
|