Skip to content

Commit f058231

Browse files
committed
Revert "deps: V8: cherry-pick 687d865fe251"
This reverts commit 0e21c1e. It landed without a proper v8_embedder_string bump, reverting to re-land cleanly. Refs: 0e21c1e Refs: nodejs#31007
1 parent befff8f commit f058231

File tree

4 files changed

+12
-45
lines changed

4 files changed

+12
-45
lines changed

deps/v8/src/heap/heap.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,14 +2761,6 @@ HeapObject Heap::AlignWithFiller(HeapObject object, int object_size,
27612761

27622762
void* Heap::AllocateExternalBackingStore(
27632763
const std::function<void*(size_t)>& allocate, size_t byte_length) {
2764-
size_t new_space_backing_store_bytes =
2765-
new_space()->ExternalBackingStoreBytes();
2766-
if (new_space_backing_store_bytes >= 2 * kMaxSemiSpaceSize &&
2767-
new_space_backing_store_bytes >= byte_length) {
2768-
// Performing a young generation GC amortizes over the allocated backing
2769-
// store bytes and may free enough external bytes for this allocation.
2770-
CollectGarbage(NEW_SPACE, GarbageCollectionReason::kExternalMemoryPressure);
2771-
}
27722764
// TODO(ulan): Perform GCs proactively based on the byte_length and
27732765
// the current external backing store counters.
27742766
void* result = allocate(byte_length);

deps/v8/src/heap/heap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1793,6 +1793,10 @@ class Heap {
17931793

17941794
void FinalizePartialMap(Map map);
17951795

1796+
// Allocate empty fixed typed array of given type.
1797+
V8_WARN_UNUSED_RESULT AllocationResult
1798+
AllocateEmptyFixedTypedArray(ExternalArrayType array_type);
1799+
17961800
void set_force_oom(bool value) { force_oom_ = value; }
17971801

17981802
// ===========================================================================

deps/v8/src/heap/spaces.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,14 +2804,14 @@ class V8_EXPORT_PRIVATE NewSpace
28042804
void Shrink();
28052805

28062806
// Return the allocated bytes in the active semispace.
2807-
size_t Size() final {
2807+
size_t Size() override {
28082808
DCHECK_GE(top(), to_space_.page_low());
28092809
return to_space_.pages_used() *
28102810
MemoryChunkLayout::AllocatableMemoryInDataPage() +
28112811
static_cast<size_t>(top() - to_space_.page_low());
28122812
}
28132813

2814-
size_t SizeOfObjects() final { return Size(); }
2814+
size_t SizeOfObjects() override { return Size(); }
28152815

28162816
// Return the allocatable capacity of a semispace.
28172817
size_t Capacity() {
@@ -2829,38 +2829,30 @@ class V8_EXPORT_PRIVATE NewSpace
28292829

28302830
// Committed memory for NewSpace is the committed memory of both semi-spaces
28312831
// combined.
2832-
size_t CommittedMemory() final {
2832+
size_t CommittedMemory() override {
28332833
return from_space_.CommittedMemory() + to_space_.CommittedMemory();
28342834
}
28352835

2836-
size_t MaximumCommittedMemory() final {
2836+
size_t MaximumCommittedMemory() override {
28372837
return from_space_.MaximumCommittedMemory() +
28382838
to_space_.MaximumCommittedMemory();
28392839
}
28402840

28412841
// Approximate amount of physical memory committed for this space.
2842-
size_t CommittedPhysicalMemory() final;
2842+
size_t CommittedPhysicalMemory() override;
28432843

28442844
// Return the available bytes without growing.
2845-
size_t Available() final {
2845+
size_t Available() override {
28462846
DCHECK_GE(Capacity(), Size());
28472847
return Capacity() - Size();
28482848
}
28492849

2850-
size_t ExternalBackingStoreBytes(ExternalBackingStoreType type) const final {
2850+
size_t ExternalBackingStoreBytes(
2851+
ExternalBackingStoreType type) const override {
28512852
DCHECK_EQ(0, from_space_.ExternalBackingStoreBytes(type));
28522853
return to_space_.ExternalBackingStoreBytes(type);
28532854
}
28542855

2855-
size_t ExternalBackingStoreBytes() {
2856-
size_t result = 0;
2857-
for (int i = 0; i < ExternalBackingStoreType::kNumTypes; i++) {
2858-
result +=
2859-
ExternalBackingStoreBytes(static_cast<ExternalBackingStoreType>(i));
2860-
}
2861-
return result;
2862-
}
2863-
28642856
size_t AllocatedSinceLastGC() {
28652857
const Address age_mark = to_space_.age_mark();
28662858
DCHECK_NE(age_mark, kNullAddress);

deps/v8/test/cctest/heap/test-heap.cc

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6823,27 +6823,6 @@ TEST(CodeObjectRegistry) {
68236823
CHECK(MemoryChunk::FromAddress(code2_address)->Contains(code2_address));
68246824
}
68256825

6826-
TEST(Regress9701) {
6827-
ManualGCScope manual_gc_scope;
6828-
if (!FLAG_incremental_marking) return;
6829-
CcTest::InitializeVM();
6830-
Heap* heap = CcTest::heap();
6831-
// Start with an empty new space.
6832-
CcTest::CollectGarbage(NEW_SPACE);
6833-
CcTest::CollectGarbage(NEW_SPACE);
6834-
6835-
int mark_sweep_count_before = heap->ms_count();
6836-
// Allocate many short living array buffers.
6837-
for (int i = 0; i < 1000; i++) {
6838-
HandleScope scope(heap->isolate());
6839-
CcTest::i_isolate()->factory()->NewJSArrayBufferAndBackingStore(
6840-
64 * KB, InitializedFlag::kZeroInitialized);
6841-
}
6842-
int mark_sweep_count_after = heap->ms_count();
6843-
// We expect only scavenges, no full GCs.
6844-
CHECK_EQ(mark_sweep_count_before, mark_sweep_count_after);
6845-
}
6846-
68476826
} // namespace heap
68486827
} // namespace internal
68496828
} // namespace v8

0 commit comments

Comments
 (0)