summaryrefslogtreecommitdiff
path: root/common.gypi
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-10-24 13:50:43 +0200
committerMichaël Zasso <targos@protonmail.com>2019-11-08 15:50:50 +0100
commitda9695390eafa5df00b2d897fb82cd158194b39f (patch)
tree0b8626c398df2bea072aa87d0b4c75a082ffaf86 /common.gypi
parent7484a3863e6d98bfef759bcae260e67637542fe2 (diff)
downloadandroid-node-v8-da9695390eafa5df00b2d897fb82cd158194b39f.tar.gz
android-node-v8-da9695390eafa5df00b2d897fb82cd158194b39f.tar.bz2
android-node-v8-da9695390eafa5df00b2d897fb82cd158194b39f.zip
deps: V8: cherry-pick 6b0a953
Original commit message: [api] Add possibility for BackingStore to keep Allocator alive Add an `array_buffer_allocator_shared` field to the `Isolate::CreateParams` struct that allows embedders to share ownership of the ArrayBuffer::Allocator with V8, and which in particular means that when this method is used that the BackingStore deleter will not perform an use-after-free access to the Allocator under certain circumstances. For Background: tl;dr: This is necessary for Node.js to perform the transition to V8 7.9, because of the way that ArrayBuffer::Allocators and their lifetimes currently work there. In Node.js, each Worker thread has its own ArrayBuffer::Allocator. Changing that would currently be impractical, as each allocator depends on per-Isolate state. However, now that backing stores are managed globally and keep a pointer to the original ArrayBuffer::Allocator, this means that when transferring an ArrayBuffer (e.g. from one Worker to another through postMessage()), the original Allocator has to be kept alive until the ArrayBuffer no longer exists in the receiving Isolate (or until that Isolate is disposed). See [1] for an example Node.js test that fails with V8 7.9. This problem also existed for SharedArrayBuffers, where Node.js was broken by V8 earlier for the same reasons (see [2] for the bug report on that and [3] for the resolution in Node.js). For SharedArrayBuffers, we already had extensive tracking logic, so adding a shared_ptr to keep alive the ArrayBuffer::Allocator was not a significant amount of work. However, the mechanism for transferring non-shared ArrayBuffers is quite different, and it seems both easier for us and better for V8 from an API standpoint to keep the Allocator alive from where it is being referenced. By sharing memory with the custom deleter function/data pair, this comes at no memory overhead. [1]: https://github.com/nodejs/node/pull/30044 [2]: https://github.com/nodejs/node-v8/issues/115 [3]: https://github.com/nodejs/node/pull/29637 Bug: v8:9380 Change-Id: Ibc2c4fb6341b53653cbd637bd8cb3d4ac43809c7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1874347 Commit-Queue: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/master@{#64542} Refs: https://github.com/v8/v8/commit/6b0a9535e6983a626420d864b45582167cd61540 PR-URL: https://github.com/nodejs/node/pull/30020 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'common.gypi')
-rw-r--r--common.gypi2
1 files changed, 1 insertions, 1 deletions
diff --git a/common.gypi b/common.gypi
index ca1f853172..10b4ecfc52 100644
--- a/common.gypi
+++ b/common.gypi
@@ -39,7 +39,7 @@
# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
- 'v8_embedder_string': '-node.12',
+ 'v8_embedder_string': '-node.13',
##### V8 defaults for Node.js #####