Skip to content

Commit be4ff5e

Browse files
Upgrade V8 binaries for 11.1.277.13 version (#373)
1 parent 02e1763 commit be4ff5e

26 files changed

+399
-336
lines changed

deps/include/cppgc/internal/gc-info.h

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <type_traits>
1111

1212
#include "cppgc/internal/finalizer-trait.h"
13+
#include "cppgc/internal/logging.h"
1314
#include "cppgc/internal/name-trait.h"
1415
#include "cppgc/trace-trait.h"
1516
#include "v8config.h" // NOLINT(build/include_directory)
@@ -20,12 +21,12 @@ namespace internal {
2021
using GCInfoIndex = uint16_t;
2122

2223
struct V8_EXPORT EnsureGCInfoIndexTrait final {
23-
// Acquires a new GC info object and returns the index. In addition, also
24-
// updates `registered_index` atomically.
24+
// Acquires a new GC info object and updates `registered_index` with the index
25+
// that identifies that new info accordingly.
2526
template <typename T>
26-
V8_INLINE static GCInfoIndex EnsureIndex(
27+
V8_INLINE static void EnsureIndex(
2728
std::atomic<GCInfoIndex>& registered_index) {
28-
return EnsureGCInfoIndexTraitDispatch<T>{}(registered_index);
29+
EnsureGCInfoIndexTraitDispatch<T>{}(registered_index);
2930
}
3031

3132
private:
@@ -34,38 +35,32 @@ struct V8_EXPORT EnsureGCInfoIndexTrait final {
3435
bool = NameTrait<T>::HasNonHiddenName()>
3536
struct EnsureGCInfoIndexTraitDispatch;
3637

37-
static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic<GCInfoIndex>&,
38-
TraceCallback,
39-
FinalizationCallback,
40-
NameCallback);
41-
static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic<GCInfoIndex>&,
42-
TraceCallback,
43-
FinalizationCallback);
44-
static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic<GCInfoIndex>&,
45-
TraceCallback, NameCallback);
46-
static GCInfoIndex EnsureGCInfoIndexPolymorphic(std::atomic<GCInfoIndex>&,
47-
TraceCallback);
48-
static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic<GCInfoIndex>&,
49-
TraceCallback,
50-
FinalizationCallback,
51-
NameCallback);
52-
static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic<GCInfoIndex>&,
53-
TraceCallback,
54-
FinalizationCallback);
55-
static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic<GCInfoIndex>&,
56-
TraceCallback,
57-
NameCallback);
58-
static GCInfoIndex EnsureGCInfoIndexNonPolymorphic(std::atomic<GCInfoIndex>&,
59-
TraceCallback);
38+
static void V8_PRESERVE_MOST
39+
EnsureGCInfoIndexPolymorphic(std::atomic<GCInfoIndex>&, TraceCallback,
40+
FinalizationCallback, NameCallback);
41+
static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic(
42+
std::atomic<GCInfoIndex>&, TraceCallback, FinalizationCallback);
43+
static void V8_PRESERVE_MOST EnsureGCInfoIndexPolymorphic(
44+
std::atomic<GCInfoIndex>&, TraceCallback, NameCallback);
45+
static void V8_PRESERVE_MOST
46+
EnsureGCInfoIndexPolymorphic(std::atomic<GCInfoIndex>&, TraceCallback);
47+
static void V8_PRESERVE_MOST
48+
EnsureGCInfoIndexNonPolymorphic(std::atomic<GCInfoIndex>&, TraceCallback,
49+
FinalizationCallback, NameCallback);
50+
static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic(
51+
std::atomic<GCInfoIndex>&, TraceCallback, FinalizationCallback);
52+
static void V8_PRESERVE_MOST EnsureGCInfoIndexNonPolymorphic(
53+
std::atomic<GCInfoIndex>&, TraceCallback, NameCallback);
54+
static void V8_PRESERVE_MOST
55+
EnsureGCInfoIndexNonPolymorphic(std::atomic<GCInfoIndex>&, TraceCallback);
6056
};
6157

6258
#define DISPATCH(is_polymorphic, has_finalizer, has_non_hidden_name, function) \
6359
template <typename T> \
6460
struct EnsureGCInfoIndexTrait::EnsureGCInfoIndexTraitDispatch< \
6561
T, is_polymorphic, has_finalizer, has_non_hidden_name> { \
66-
V8_INLINE GCInfoIndex \
67-
operator()(std::atomic<GCInfoIndex>& registered_index) { \
68-
return function; \
62+
V8_INLINE void operator()(std::atomic<GCInfoIndex>& registered_index) { \
63+
function; \
6964
} \
7065
};
7166

@@ -143,9 +138,16 @@ struct GCInfoTrait final {
143138
static_assert(sizeof(T), "T must be fully defined");
144139
static std::atomic<GCInfoIndex>
145140
registered_index; // Uses zero initialization.
146-
const GCInfoIndex index = registered_index.load(std::memory_order_acquire);
147-
return index ? index
148-
: EnsureGCInfoIndexTrait::EnsureIndex<T>(registered_index);
141+
GCInfoIndex index = registered_index.load(std::memory_order_acquire);
142+
if (V8_UNLIKELY(!index)) {
143+
EnsureGCInfoIndexTrait::EnsureIndex<T>(registered_index);
144+
// Slow path call uses V8_PRESERVE_MOST which does not support return
145+
// values (also preserves RAX). Avoid out parameter by just reloading the
146+
// value here which at this point is guaranteed to be set.
147+
index = registered_index.load(std::memory_order_acquire);
148+
CPPGC_DCHECK(index != 0);
149+
}
150+
return index;
149151
}
150152
};
151153

deps/include/cppgc/internal/pointer-policies.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,28 @@ struct DijkstraWriteBarrierPolicy {
3434
}
3535

3636
V8_INLINE static void AssigningBarrier(const void* slot, const void* value) {
37+
#ifdef CPPGC_SLIM_WRITE_BARRIER
38+
if (V8_UNLIKELY(WriteBarrier::IsEnabled()))
39+
WriteBarrier::CombinedWriteBarrierSlow(slot);
40+
#else // !CPPGC_SLIM_WRITE_BARRIER
3741
WriteBarrier::Params params;
3842
const WriteBarrier::Type type =
3943
WriteBarrier::GetWriteBarrierType(slot, value, params);
4044
WriteBarrier(type, params, slot, value);
45+
#endif // !CPPGC_SLIM_WRITE_BARRIER
4146
}
4247

4348
V8_INLINE static void AssigningBarrier(const void* slot,
4449
MemberStorage storage) {
50+
#ifdef CPPGC_SLIM_WRITE_BARRIER
51+
if (V8_UNLIKELY(WriteBarrier::IsEnabled()))
52+
WriteBarrier::CombinedWriteBarrierSlow(slot);
53+
#else // !CPPGC_SLIM_WRITE_BARRIER
4554
WriteBarrier::Params params;
4655
const WriteBarrier::Type type =
4756
WriteBarrier::GetWriteBarrierType(slot, storage, params);
4857
WriteBarrier(type, params, slot, storage.Load());
58+
#endif // !CPPGC_SLIM_WRITE_BARRIER
4959
}
5060

5161
private:

deps/include/cppgc/internal/write-barrier.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ class V8_EXPORT WriteBarrier final {
7979
// Returns the required write barrier for a given `value`.
8080
static V8_INLINE Type GetWriteBarrierType(const void* value, Params& params);
8181

82+
#ifdef CPPGC_SLIM_WRITE_BARRIER
83+
// A write barrier that combines `GenerationalBarrier()` and
84+
// `DijkstraMarkingBarrier()`. We only pass a single parameter here to clobber
85+
// as few registers as possible.
86+
static V8_NOINLINE void V8_PRESERVE_MOST
87+
CombinedWriteBarrierSlow(const void* slot);
88+
#endif // CPPGC_SLIM_WRITE_BARRIER
89+
8290
static V8_INLINE void DijkstraMarkingBarrier(const Params& params,
8391
const void* object);
8492
static V8_INLINE void DijkstraMarkingBarrierRange(

deps/include/cppgc/visitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ class V8_EXPORT Visitor {
229229
}
230230

231231
/**
232-
* Trace method for retaining containers weakly.
232+
* Trace method for retaining containers weakly. Note that weak containers
233+
* should emit write barriers.
233234
*
234235
* \param object reference to the container.
235236
* \param callback to be invoked.

deps/include/js_protocol.pdl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,13 @@ domain Runtime
14021402
optional string objectGroup
14031403
# Whether to throw an exception if side effect cannot be ruled out during evaluation.
14041404
experimental optional boolean throwOnSideEffect
1405+
# An alternative way to specify the execution context to call function on.
1406+
# Compared to contextId that may be reused across processes, this is guaranteed to be
1407+
# system-unique, so it can be used to prevent accidental function call
1408+
# in context different than intended (e.g. as a result of navigation across process
1409+
# boundaries).
1410+
# This is mutually exclusive with `executionContextId`.
1411+
experimental optional string uniqueContextId
14051412
# Whether the result should contain `webDriverValue`, serialized according to
14061413
# https://w3c.github.io/webdriver-bidi. This is mutually exclusive with `returnByValue`, but
14071414
# resulting `objectId` is still provided.
@@ -1734,7 +1741,9 @@ domain Runtime
17341741
event executionContextDestroyed
17351742
parameters
17361743
# Id of the destroyed context
1737-
ExecutionContextId executionContextId
1744+
deprecated ExecutionContextId executionContextId
1745+
# Unique Id of the destroyed context
1746+
experimental string executionContextUniqueId
17381747

17391748
# Issued when all executionContexts were cleared in browser
17401749
event executionContextsCleared

deps/include/libplatform/v8-tracing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ class V8_PLATFORM_EXPORT TracingController
282282
const char* name, uint64_t handle) override;
283283

284284
static const char* GetCategoryGroupName(const uint8_t* category_enabled_flag);
285-
#endif // !defined(V8_USE_PERFETTO)
286285

287286
void AddTraceStateObserver(
288287
v8::TracingController::TraceStateObserver* observer) override;
289288
void RemoveTraceStateObserver(
290289
v8::TracingController::TraceStateObserver* observer) override;
290+
#endif // !defined(V8_USE_PERFETTO)
291291

292292
void StartTracing(TraceConfig* trace_config);
293293
void StopTracing();
@@ -307,7 +307,6 @@ class V8_PLATFORM_EXPORT TracingController
307307
std::unique_ptr<base::Mutex> mutex_;
308308
std::unique_ptr<TraceConfig> trace_config_;
309309
std::atomic_bool recording_{false};
310-
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
311310

312311
#if defined(V8_USE_PERFETTO)
313312
std::ostream* output_stream_ = nullptr;
@@ -316,6 +315,7 @@ class V8_PLATFORM_EXPORT TracingController
316315
TraceEventListener* listener_for_testing_ = nullptr;
317316
std::unique_ptr<perfetto::TracingSession> tracing_session_;
318317
#else // !defined(V8_USE_PERFETTO)
318+
std::unordered_set<v8::TracingController::TraceStateObserver*> observers_;
319319
std::unique_ptr<TraceBuffer> trace_buffer_;
320320
#endif // !defined(V8_USE_PERFETTO)
321321

deps/include/v8-array-buffer.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,28 @@ class V8_EXPORT BackingStore : public v8::internal::BackingStoreBase {
5353
*/
5454
size_t ByteLength() const;
5555

56+
/**
57+
* The maximum length (in bytes) that this backing store may grow to.
58+
*
59+
* If this backing store was created for a resizable ArrayBuffer or a growable
60+
* SharedArrayBuffer, it is >= ByteLength(). Otherwise it is ==
61+
* ByteLength().
62+
*/
63+
size_t MaxByteLength() const;
64+
5665
/**
5766
* Indicates whether the backing store was created for an ArrayBuffer or
5867
* a SharedArrayBuffer.
5968
*/
6069
bool IsShared() const;
6170

71+
/**
72+
* Indicates whether the backing store was created for a resizable ArrayBuffer
73+
* or a growable SharedArrayBuffer, and thus may be resized by user JavaScript
74+
* code.
75+
*/
76+
bool IsResizableByUserJavaScript() const;
77+
6278
/**
6379
* Prevent implicit instantiation of operator delete with size_t argument.
6480
* The size_t argument would be incorrect because ptr points to the
@@ -189,6 +205,11 @@ class V8_EXPORT ArrayBuffer : public Object {
189205
*/
190206
size_t ByteLength() const;
191207

208+
/**
209+
* Maximum length in bytes.
210+
*/
211+
size_t MaxByteLength() const;
212+
192213
/**
193214
* Create a new ArrayBuffer. Allocate |byte_length| bytes.
194215
* Allocated memory will be owned by a created ArrayBuffer and
@@ -235,6 +256,21 @@ class V8_EXPORT ArrayBuffer : public Object {
235256
void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter,
236257
void* deleter_data);
237258

259+
/**
260+
* Returns a new resizable standalone BackingStore that is allocated using the
261+
* array buffer allocator of the isolate. The result can be later passed to
262+
* ArrayBuffer::New.
263+
*
264+
* |byte_length| must be <= |max_byte_length|.
265+
*
266+
* This function is usable without an isolate. Unlike |NewBackingStore| calls
267+
* with an isolate, GCs cannot be triggered, and there are no
268+
* retries. Allocation failure will cause the function to crash with an
269+
* out-of-memory error.
270+
*/
271+
static std::unique_ptr<BackingStore> NewResizableBackingStore(
272+
size_t byte_length, size_t max_byte_length);
273+
238274
/**
239275
* Returns true if this ArrayBuffer may be detached.
240276
*/
@@ -392,6 +428,11 @@ class V8_EXPORT SharedArrayBuffer : public Object {
392428
*/
393429
size_t ByteLength() const;
394430

431+
/**
432+
* Maximum length in bytes.
433+
*/
434+
size_t MaxByteLength() const;
435+
395436
/**
396437
* Create a new SharedArrayBuffer. Allocate |byte_length| bytes.
397438
* Allocated memory will be owned by a created SharedArrayBuffer and

deps/include/v8-callbacks.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ using WasmSimdEnabledCallback = bool (*)(Local<Context> context);
328328
// --- Callback for checking if WebAssembly exceptions are enabled ---
329329
using WasmExceptionsEnabledCallback = bool (*)(Local<Context> context);
330330

331+
// --- Callback for checking if WebAssembly GC is enabled ---
332+
// If the callback returns true, it will also enable Wasm stringrefs.
333+
using WasmGCEnabledCallback = bool (*)(Local<Context> context);
334+
331335
// --- Callback for checking if the SharedArrayBuffer constructor is enabled ---
332336
using SharedArrayBufferConstructorEnabledCallback =
333337
bool (*)(Local<Context> context);

deps/include/v8-cppgc.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ struct WrapperDescriptor final {
7777
};
7878

7979
struct V8_EXPORT CppHeapCreateParams {
80+
CppHeapCreateParams(
81+
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces,
82+
WrapperDescriptor wrapper_descriptor)
83+
: custom_spaces(std::move(custom_spaces)),
84+
wrapper_descriptor(wrapper_descriptor) {}
85+
86+
CppHeapCreateParams(const CppHeapCreateParams&) = delete;
87+
CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete;
88+
8089
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces;
8190
WrapperDescriptor wrapper_descriptor;
8291
/**

0 commit comments

Comments
 (0)