You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to V8's public API documentation, local handles (i.e.,
objects of type v8::Local<T>) "should never be allocated on the heap".
This disallows heap-allocated data structures containing instances of
v8::Local, like std::vector<v8::Local<v8::String>>. It is unfortunate
that the V8 API itself requires the usage of such data structures.
This CL starts a deprecation of such data structures from V8's public
API. It replaces the std::vector<Local<String>>, used as parameter to
Module::CreateSyntheticModule, with a MemorySpan<const Local<String>>.
This stands for a (contiguously allocated) array of local handles to
strings, which will not be modified. The size of the array is known,
as part of the MemorySpan object. The CL also replaces some vectors
of locals with arrays of locals in API tests.
Moreover, the CL adds some functionality to the existing
v8::MemorySpan class, so that it behaves more like the upcoming (in
C++20) std::span<T, std::dynamic_extent>. In particular, it makes
spans subscriptable, iterable, and allows implicit conversion from
arrays. It also introduces a helper function template v8::to_array<T>
(the upcoming std::to_array<T>, in C++20), to better support automatic
deduction of array size without omitting the element type.
Bug: chromium:1454114
Change-Id: Iaa36da8199428a9120259aa2a3a4543e261fbc60
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4866222
Commit-Queue: Nikolaos Papaspyrou <[email protected]>
Reviewed-by: Anton Bikineev <[email protected]>
Reviewed-by: Michael Lippautz <[email protected]>
Cr-Commit-Position: refs/heads/main@{#90056}
0 commit comments