Skip to content

Commit 577ff9f

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: #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 00e1c7e commit 577ff9f

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

Diff for: 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.19',
39+
'v8_embedder_string': '-node.20',
4040

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

Diff for: deps/v8/src/heap/heap.h

+18-4
Original file line numberDiff line numberDiff line change
@@ -2610,10 +2610,7 @@ class StrongRootBlockAllocator {
26102610
using size_type = size_t;
26112611
using difference_type = ptrdiff_t;
26122612
template <class U>
2613-
struct rebind {
2614-
STATIC_ASSERT((std::is_same<Address, U>::value));
2615-
using other = StrongRootBlockAllocator;
2616-
};
2613+
struct rebind;
26172614

26182615
explicit StrongRootBlockAllocator(Heap* heap) : heap_(heap) {}
26192616

@@ -2624,6 +2621,23 @@ class StrongRootBlockAllocator {
26242621
Heap* heap_;
26252622
};
26262623

2624+
// Rebinding to Address gives another StrongRootBlockAllocator.
2625+
template <>
2626+
struct StrongRootBlockAllocator::rebind<Address> {
2627+
using other = StrongRootBlockAllocator;
2628+
};
2629+
2630+
// Rebinding to something other than Address gives a std::allocator that
2631+
// is copy-constructable from StrongRootBlockAllocator.
2632+
template <class U>
2633+
struct StrongRootBlockAllocator::rebind {
2634+
class other : public std::allocator<U> {
2635+
public:
2636+
// NOLINTNEXTLINE
2637+
other(const StrongRootBlockAllocator&) {}
2638+
};
2639+
};
2640+
26272641
} // namespace internal
26282642
} // namespace v8
26292643

0 commit comments

Comments
 (0)