summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-01-13 13:11:42 +0100
committerMichaël Zasso <targos@protonmail.com>2021-02-11 19:10:53 +0100
commit577ff9fee5a4d583ce7fd8a5c6056756b6f40c9f (patch)
tree5516b3b2b1423ce73d5dbd97deab457e5a9eb452
parent00e1c7ea83b6e2cc098e3b123800149047c30c7d (diff)
downloadnode-new-577ff9fee5a4d583ce7fd8a5c6056756b6f40c9f.tar.gz
deps: V8: cherry-pick deb0813166f3
Original commit message: [heap] Add proper rebind support to StrongRootBlockAllocator MSVC's STL in debug mode rebinds the allocator passed to vectors to allocate helper structures, so we need StrongRootBlockAllocator to have proper rebind support rather than assuming it always rebinds to Address. Bug: v8:11241 Change-Id: I15688e43fe2c71ec4ff0c287a03e36ca57427417 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2622915 Auto-Submit: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#72060} Refs: https://github.com/v8/v8/commit/deb0813166f3fcb72c742f76e3c7228f23568bf1 PR-URL: https://github.com/nodejs/node/pull/36139 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com>
-rw-r--r--common.gypi2
-rw-r--r--deps/v8/src/heap/heap.h22
2 files changed, 19 insertions, 5 deletions
diff --git a/common.gypi b/common.gypi
index 16165ed5c9..7a461f7cf6 100644
--- a/common.gypi
+++ b/common.gypi
@@ -36,7 +36,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.19',
+ 'v8_embedder_string': '-node.20',
##### V8 defaults for Node.js #####
diff --git a/deps/v8/src/heap/heap.h b/deps/v8/src/heap/heap.h
index 18064ac731..70e2e14993 100644
--- a/deps/v8/src/heap/heap.h
+++ b/deps/v8/src/heap/heap.h
@@ -2610,10 +2610,7 @@ class StrongRootBlockAllocator {
using size_type = size_t;
using difference_type = ptrdiff_t;
template <class U>
- struct rebind {
- STATIC_ASSERT((std::is_same<Address, U>::value));
- using other = StrongRootBlockAllocator;
- };
+ struct rebind;
explicit StrongRootBlockAllocator(Heap* heap) : heap_(heap) {}
@@ -2624,6 +2621,23 @@ class StrongRootBlockAllocator {
Heap* heap_;
};
+// Rebinding to Address gives another StrongRootBlockAllocator.
+template <>
+struct StrongRootBlockAllocator::rebind<Address> {
+ using other = StrongRootBlockAllocator;
+};
+
+// Rebinding to something other than Address gives a std::allocator that
+// is copy-constructable from StrongRootBlockAllocator.
+template <class U>
+struct StrongRootBlockAllocator::rebind {
+ class other : public std::allocator<U> {
+ public:
+ // NOLINTNEXTLINE
+ other(const StrongRootBlockAllocator&) {}
+ };
+};
+
} // namespace internal
} // namespace v8