From 1f9566bd68b6803e799a438e5e309b5af89ec36a Mon Sep 17 00:00:00 2001 From: Matheus Marchini Date: Tue, 26 May 2020 11:52:59 -0700 Subject: [PATCH] deps: V8: backport fb26d0bb1835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [objects] Compact and shrink script_list So far creating scripts always grew the script_list without ever reusing cleared slots or shrinking. While this is probably not a problem with script_list in practice, this is still a memory leak. Fix this leak by using WeakArrayList::Append instead of AddToEnd. Append adds to the end of the array, but potentially compacts and shrinks the list as well. Other WeakArrayLists can use this method as well, as long as they are not using indices into this array. Bug: v8:10031 Change-Id: If743c4cc3f8d67ab735522f0ded038b2fb43e437 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1967385 Commit-Queue: Dominik Inführ Reviewed-by: Ulan Degenbaev Cr-Commit-Position: refs/heads/master@{#65640} Refs: https://github.com/v8/v8/commit/fb26d0bb1835dd18d175128fcb18590bee4ec218 --- common.gypi | 2 +- deps/v8/src/heap/factory.cc | 67 ++++++++++++++--- deps/v8/src/heap/factory.h | 11 +++ deps/v8/src/objects/fixed-array.h | 18 +++++ deps/v8/src/objects/objects.cc | 73 ++++++++++++++++++- deps/v8/test/unittests/BUILD.gn | 1 + .../objects/weakarraylist-unittest.cc | 59 +++++++++++++++ 7 files changed, 215 insertions(+), 16 deletions(-) create mode 100644 deps/v8/test/unittests/objects/weakarraylist-unittest.cc diff --git a/common.gypi b/common.gypi index 3b9cc3e885b254..cebf2121ff9130 100644 --- a/common.gypi +++ b/common.gypi @@ -34,7 +34,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.38', + 'v8_embedder_string': '-node.39', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/heap/factory.cc b/deps/v8/src/heap/factory.cc index 92728341054758..a7ecc417496a60 100644 --- a/deps/v8/src/heap/factory.cc +++ b/deps/v8/src/heap/factory.cc @@ -1677,8 +1677,8 @@ Handle