Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 43bea6b

Browse filesBrowse files
tunztunamagur0
authored andcommitted
deps: V8: cherry-pick c172ffc5bf54
Original commit message: Compact retained maps array more often When we add maps to the retained maps array, we compacted the array if it's full. But, since we are now adding maps in a batch, it's unlikely to meet the condition. Thus, update the condition to check whether new size exceeds the capacity. Bug: 398528460 Change-Id: I89caa47b69532c6397596edfe5caf7c7d24768cc Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6330019 Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Commit-Queue: Choongwoo Han <choongwoo.han@microsoft.com> Cr-Commit-Position: refs/heads/main@{#99163} Refs: v8/v8@c172ffc PR-URL: #57437 Fixes: #57412 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Co-Authored-By: tunamagur0 <47546832+tunamagur0@users.noreply.github.com>
1 parent 91a824e commit 43bea6b
Copy full SHA for 43bea6b

File tree

Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed
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
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.13',
41+
'v8_embedder_string': '-node.14',
4242

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

Collapse file

‎deps/v8/src/heap/heap.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/heap.cc
+7-6Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6376,12 +6376,13 @@ void Heap::AddRetainedMaps(DirectHandle<NativeContext> context,
63766376
GlobalHandleVector<Map> maps) {
63776377
Handle<WeakArrayList> array(Cast<WeakArrayList>(context->retained_maps()),
63786378
isolate());
6379-
if (array->IsFull()) {
6379+
int new_maps_size = static_cast<int>(maps.size()) * kRetainMapEntrySize;
6380+
if (array->length() + new_maps_size > array->capacity()) {
63806381
CompactRetainedMaps(*array);
63816382
}
63826383
int cur_length = array->length();
6383-
array = WeakArrayList::EnsureSpace(
6384-
isolate(), array, cur_length + static_cast<int>(maps.size()) * 2);
6384+
array =
6385+
WeakArrayList::EnsureSpace(isolate(), array, cur_length + new_maps_size);
63856386
if (*array != context->retained_maps()) {
63866387
context->set_retained_maps(*array);
63876388
}
@@ -6399,7 +6400,7 @@ void Heap::AddRetainedMaps(DirectHandle<NativeContext> context,
63996400
raw_array->Set(cur_length, MakeWeak(*map));
64006401
raw_array->Set(cur_length + 1,
64016402
Smi::FromInt(v8_flags.retain_maps_for_n_gc));
6402-
cur_length += 2;
6403+
cur_length += kRetainMapEntrySize;
64036404
raw_array->set_length(cur_length);
64046405

64056406
map->set_is_in_retained_map_list(true);
@@ -6411,7 +6412,7 @@ void Heap::CompactRetainedMaps(Tagged<WeakArrayList> retained_maps) {
64116412
int length = retained_maps->length();
64126413
int new_length = 0;
64136414
// This loop compacts the array by removing cleared weak cells.
6414-
for (int i = 0; i < length; i += 2) {
6415+
for (int i = 0; i < length; i += kRetainMapEntrySize) {
64156416
Tagged<MaybeObject> maybe_object = retained_maps->Get(i);
64166417
if (maybe_object.IsCleared()) {
64176418
continue;
@@ -6425,7 +6426,7 @@ void Heap::CompactRetainedMaps(Tagged<WeakArrayList> retained_maps) {
64256426
retained_maps->Set(new_length, maybe_object);
64266427
retained_maps->Set(new_length + 1, age);
64276428
}
6428-
new_length += 2;
6429+
new_length += kRetainMapEntrySize;
64296430
}
64306431
Tagged<HeapObject> undefined = ReadOnlyRoots(this).undefined_value();
64316432
for (int i = new_length; i < length; i++) {
Collapse file

‎deps/v8/src/heap/heap.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/heap/heap.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,6 +1830,8 @@ class Heap final {
18301830
void AddToRingBuffer(const char* string);
18311831
void GetFromRingBuffer(char* buffer);
18321832

1833+
static constexpr int kRetainMapEntrySize = 2;
1834+
18331835
void CompactRetainedMaps(Tagged<WeakArrayList> retained_maps);
18341836

18351837
void CollectGarbageOnMemoryPressure();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.