Skip to content

Commit 51eb323

Browse files
targosruyadorno
authored andcommitted
deps: V8: cherry-pick 92a7385171bb
Original commit message: [heap] Fix 32bit msvc builds Size of ActiveSystemPages is 8 bytes even on 32bit builds, thus forcing 8 bytes alignment for MemoryChunk. Change-Id: I5ca1e18329d6e68a8b6811c3c27cb224c765cb63 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3966953 Commit-Queue: Omer Katz <omerkatz@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/main@{#83845} Refs: v8/v8@92a7385 PR-URL: #45230 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 1370b1a commit 51eb323

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
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.4',
39+
'v8_embedder_string': '-node.5',
4040

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

deps/v8/src/heap/memory-chunk-layout.h

+14-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ using ActiveSystemPages = ::heap::base::ActiveSystemPages;
3737

3838
class V8_EXPORT_PRIVATE MemoryChunkLayout {
3939
public:
40-
static const int kNumSets = NUMBER_OF_REMEMBERED_SET_TYPES;
41-
static const int kNumTypes = ExternalBackingStoreType::kNumTypes;
40+
static constexpr int kNumSets = NUMBER_OF_REMEMBERED_SET_TYPES;
41+
static constexpr int kNumTypes = ExternalBackingStoreType::kNumTypes;
42+
#if V8_CC_MSVC && V8_TARGET_ARCH_IA32
43+
static constexpr int kMemoryChunkAlignment = 8;
44+
#else
45+
static constexpr int kMemoryChunkAlignment = sizeof(size_t);
46+
#endif // V8_CC_MSVC && V8_TARGET_ARCH_IA32
4247
#define FIELD(Type, Name) \
4348
k##Name##Offset, k##Name##End = k##Name##Offset + sizeof(Type) - 1
4449
enum Header {
@@ -74,11 +79,17 @@ class V8_EXPORT_PRIVATE MemoryChunkLayout {
7479
#endif // V8_ENABLE_INNER_POINTER_RESOLUTION_OSB
7580
FIELD(size_t, WasUsedForAllocation),
7681
kMarkingBitmapOffset,
77-
kMemoryChunkHeaderSize = kMarkingBitmapOffset,
82+
kMemoryChunkHeaderSize =
83+
kMarkingBitmapOffset +
84+
((kMarkingBitmapOffset % kMemoryChunkAlignment) == 0
85+
? 0
86+
: kMemoryChunkAlignment -
87+
(kMarkingBitmapOffset % kMemoryChunkAlignment)),
7888
kMemoryChunkHeaderStart = kSlotSetOffset,
7989
kBasicMemoryChunkHeaderSize = kMemoryChunkHeaderStart,
8090
kBasicMemoryChunkHeaderStart = 0,
8191
};
92+
#undef FIELD
8293
static size_t CodePageGuardStartOffset();
8394
static size_t CodePageGuardSize();
8495
static intptr_t ObjectStartOffsetInCodePage();

deps/v8/src/heap/memory-chunk.cc

+11
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,17 @@ void MemoryChunk::ValidateOffsets(MemoryChunk* chunk) {
496496
DCHECK_EQ(reinterpret_cast<Address>(&chunk->possibly_empty_buckets_) -
497497
chunk->address(),
498498
MemoryChunkLayout::kPossiblyEmptyBucketsOffset);
499+
DCHECK_EQ(reinterpret_cast<Address>(&chunk->active_system_pages_) -
500+
chunk->address(),
501+
MemoryChunkLayout::kActiveSystemPagesOffset);
502+
#ifdef V8_ENABLE_INNER_POINTER_RESOLUTION_OSB
503+
DCHECK_EQ(reinterpret_cast<Address>(&chunk->object_start_bitmap_) -
504+
chunk->address(),
505+
MemoryChunkLayout::kObjectStartBitmapOffset);
506+
#endif // V8_ENABLE_INNER_POINTER_RESOLUTION_OSB
507+
DCHECK_EQ(reinterpret_cast<Address>(&chunk->was_used_for_allocation_) -
508+
chunk->address(),
509+
MemoryChunkLayout::kWasUsedForAllocationOffset);
499510
}
500511
#endif
501512

0 commit comments

Comments
 (0)