Skip to content

Commit eaefe80

Browse files
committed
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 <[email protected]> Reviewed-by: Ulan Degenbaev <[email protected]> Commit-Queue: Leszek Swirski <[email protected]> Cr-Commit-Position: refs/heads/master@{#72060} Refs: v8/v8@deb0813 PR-URL: nodejs#36139 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent 149079c commit eaefe80

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.10',
39+
'v8_embedder_string': '-node.11',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/heap/heap.h

+18-4
Original file line numberDiff line numberDiff line change
@@ -2649,10 +2649,7 @@ class StrongRootBlockAllocator {
26492649
using size_type = size_t;
26502650
using difference_type = ptrdiff_t;
26512651
template <class U>
2652-
struct rebind {
2653-
STATIC_ASSERT((std::is_same<Address, U>::value));
2654-
using other = StrongRootBlockAllocator;
2655-
};
2652+
struct rebind;
26562653

26572654
explicit StrongRootBlockAllocator(Heap* heap) : heap_(heap) {}
26582655

@@ -2663,6 +2660,23 @@ class StrongRootBlockAllocator {
26632660
Heap* heap_;
26642661
};
26652662

2663+
// Rebinding to Address gives another StrongRootBlockAllocator.
2664+
template <>
2665+
struct StrongRootBlockAllocator::rebind<Address> {
2666+
using other = StrongRootBlockAllocator;
2667+
};
2668+
2669+
// Rebinding to something other than Address gives a std::allocator that
2670+
// is copy-constructable from StrongRootBlockAllocator.
2671+
template <class U>
2672+
struct StrongRootBlockAllocator::rebind {
2673+
class other : public std::allocator<U> {
2674+
public:
2675+
// NOLINTNEXTLINE
2676+
other(const StrongRootBlockAllocator&) {}
2677+
};
2678+
};
2679+
26662680
} // namespace internal
26672681
} // namespace v8
26682682

0 commit comments

Comments
 (0)