GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: backport bbd800c6e359 · nodejs/node@e972ff7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8
    • src/heap
      • new-spaces.cc
    • test/mjsunit/regress
      • regress-12657.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
# Reset this number to 0 on major V8 upgrades.
3939
# Increment by one for each non-official patch applied to deps/v8.
40-
'v8_embedder_string': '-node.23',
40+
'v8_embedder_string': '-node.24',
4141

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

Collapse file

‎deps/v8/src/heap/new-spaces.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/new-spaces.cc
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ bool SemiSpace::EnsureCurrentCapacity() {
5454
// Free all overallocated pages which are behind current_page.
5555
while (current_page) {
5656
MemoryChunk* next_current = current_page->list_node().next();
57+
AccountUncommitted(Page::kPageSize);
5758
memory_chunk_list_.Remove(current_page);
5859
// Clear new space flags to avoid this page being treated as a new
5960
// space page that is potentially being swept.
@@ -74,6 +75,7 @@ bool SemiSpace::EnsureCurrentCapacity() {
7475
NOT_EXECUTABLE);
7576
if (current_page == nullptr) return false;
7677
DCHECK_NOT_NULL(current_page);
78+
AccountCommitted(Page::kPageSize);
7779
memory_chunk_list_.PushBack(current_page);
7880
marking_state->ClearLiveness(current_page);
7981
current_page->SetFlags(first_page()->GetFlags(),
@@ -106,6 +108,7 @@ void SemiSpace::TearDown() {
106108

107109
bool SemiSpace::Commit() {
108110
DCHECK(!IsCommitted());
111+
DCHECK_EQ(CommittedMemory(), size_t(0));
109112
const int num_pages = static_cast<int>(target_capacity_ / Page::kPageSize);
110113
DCHECK(num_pages);
111114
for (int pages_added = 0; pages_added < num_pages; pages_added++) {
@@ -134,14 +137,19 @@ bool SemiSpace::Commit() {
134137

135138
bool SemiSpace::Uncommit() {
136139
DCHECK(IsCommitted());
140+
int actual_pages = 0;
137141
while (!memory_chunk_list_.Empty()) {
142+
actual_pages++;
138143
MemoryChunk* chunk = memory_chunk_list_.front();
139144
memory_chunk_list_.Remove(chunk);
140145
heap()->memory_allocator()->Free<MemoryAllocator::kPooledAndQueue>(chunk);
141146
}
142147
current_page_ = nullptr;
143148
current_capacity_ = 0;
144-
AccountUncommitted(target_capacity_);
149+
size_t removed_page_size =
150+
static_cast<size_t>(actual_pages * Page::kPageSize);
151+
DCHECK_EQ(CommittedMemory(), removed_page_size);
152+
AccountUncommitted(removed_page_size);
145153
heap()->memory_allocator()->unmapper()->FreeQueuedChunks();
146154
DCHECK(!IsCommitted());
147155
return true;
@@ -246,6 +254,7 @@ void SemiSpace::RemovePage(Page* page) {
246254
}
247255
}
248256
memory_chunk_list_.Remove(page);
257+
AccountUncommitted(Page::kPageSize);
249258
for (size_t i = 0; i < ExternalBackingStoreType::kNumTypes; i++) {
250259
ExternalBackingStoreType t = static_cast<ExternalBackingStoreType>(i);
251260
DecrementExternalBackingStoreBytes(t, page->ExternalBackingStoreBytes(t));
@@ -258,6 +267,7 @@ void SemiSpace::PrependPage(Page* page) {
258267
page->set_owner(this);
259268
memory_chunk_list_.PushFront(page);
260269
current_capacity_ += Page::kPageSize;
270+
AccountCommitted(Page::kPageSize);
261271
for (size_t i = 0; i < ExternalBackingStoreType::kNumTypes; i++) {
262272
ExternalBackingStoreType t = static_cast<ExternalBackingStoreType>(i);
263273
IncrementExternalBackingStoreBytes(t, page->ExternalBackingStoreBytes(t));
@@ -319,6 +329,7 @@ void SemiSpace::Verify() {
319329
external_backing_store_bytes[static_cast<ExternalBackingStoreType>(i)] = 0;
320330
}
321331

332+
int actual_pages = 0;
322333
for (Page* page : *this) {
323334
CHECK_EQ(page->owner(), this);
324335
CHECK(page->InNewSpace());
@@ -344,7 +355,11 @@ void SemiSpace::Verify() {
344355

345356
CHECK_IMPLIES(page->list_node().prev(),
346357
page->list_node().prev()->list_node().next() == page);
358+
359+
actual_pages++;
347360
}
361+
CHECK_EQ(actual_pages * size_t(Page::kPageSize), CommittedMemory());
362+
348363
for (int i = 0; i < kNumTypes; i++) {
349364
ExternalBackingStoreType t = static_cast<ExternalBackingStoreType>(i);
350365
CHECK_EQ(external_backing_store_bytes[t], ExternalBackingStoreBytes(t));
Collapse file

‎deps/v8/test/mjsunit/regress/regress-12657.js‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Copyright 2022 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --gc-global --expose-statistics --max-semi-space-size=1
6+
7+
const a = new Array();
8+
for (var i = 0; i < 50000; i++) {
9+
a[i] = new Object();
10+
}
11+
assertTrue(getV8Statistics().new_space_commited_bytes <= 2 * 1024 * 1024);

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.