| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 91a824e commit 43bea6b
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | 39 | # Reset this number to 0 on major V8 upgrades. | |
| 40 | 40 | # Increment by one for each non-official patch applied to deps/v8. | |
| 41 | - 'v8_embedder_string': '-node.13', | ||
| 41 | + 'v8_embedder_string': '-node.14', | ||
| 42 | 42 | ||
| 43 | 43 | ##### V8 defaults for Node.js ##### | |
| 44 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6376,12 +6376,13 @@ void Heap::AddRetainedMaps(DirectHandle<NativeContext> context, | |||
| 6376 | 6376 | GlobalHandleVector<Map> maps) { | |
| 6377 | 6377 | Handle<WeakArrayList> array(Cast<WeakArrayList>(context->retained_maps()), | |
| 6378 | 6378 | 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()) { | ||
| 6380 | 6381 | CompactRetainedMaps(*array); | |
| 6381 | 6382 | } | |
| 6382 | 6383 | 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); | ||
| 6385 | 6386 | if (*array != context->retained_maps()) { | |
| 6386 | 6387 | context->set_retained_maps(*array); | |
| 6387 | 6388 | } | |
@@ -6399,7 +6400,7 @@ void Heap::AddRetainedMaps(DirectHandle<NativeContext> context, | |||
| 6399 | 6400 | raw_array->Set(cur_length, MakeWeak(*map)); | |
| 6400 | 6401 | raw_array->Set(cur_length + 1, | |
| 6401 | 6402 | Smi::FromInt(v8_flags.retain_maps_for_n_gc)); | |
| 6402 | - cur_length += 2; | ||
| 6403 | + cur_length += kRetainMapEntrySize; | ||
| 6403 | 6404 | raw_array->set_length(cur_length); | |
| 6404 | 6405 | ||
| 6405 | 6406 | map->set_is_in_retained_map_list(true); | |
@@ -6411,7 +6412,7 @@ void Heap::CompactRetainedMaps(Tagged<WeakArrayList> retained_maps) { | |||
| 6411 | 6412 | int length = retained_maps->length(); | |
| 6412 | 6413 | int new_length = 0; | |
| 6413 | 6414 | // 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) { | ||
| 6415 | 6416 | Tagged<MaybeObject> maybe_object = retained_maps->Get(i); | |
| 6416 | 6417 | if (maybe_object.IsCleared()) { | |
| 6417 | 6418 | continue; | |
@@ -6425,7 +6426,7 @@ void Heap::CompactRetainedMaps(Tagged<WeakArrayList> retained_maps) { | |||
| 6425 | 6426 | retained_maps->Set(new_length, maybe_object); | |
| 6426 | 6427 | retained_maps->Set(new_length + 1, age); | |
| 6427 | 6428 | } | |
| 6428 | - new_length += 2; | ||
| 6429 | + new_length += kRetainMapEntrySize; | ||
| 6429 | 6430 | } | |
| 6430 | 6431 | Tagged<HeapObject> undefined = ReadOnlyRoots(this).undefined_value(); | |
| 6431 | 6432 | for (int i = new_length; i < length; i++) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1830,6 +1830,8 @@ class Heap final { | |||
| 1830 | 1830 | void AddToRingBuffer(const char* string); | |
| 1831 | 1831 | void GetFromRingBuffer(char* buffer); | |
| 1832 | 1832 | ||
| 1833 | + static constexpr int kRetainMapEntrySize = 2; | ||
| 1834 | + | ||
| 1833 | 1835 | void CompactRetainedMaps(Tagged<WeakArrayList> retained_maps); | |
| 1834 | 1836 | ||
| 1835 | 1837 | void CollectGarbageOnMemoryPressure(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments