Browse Source

ci: auto-3way patches and detect changes (#23033)

Jeremy Apthorp 5 years ago
parent
commit
bafcac7913
32 changed files with 308 additions and 352 deletions
  1. 23 1
      .circleci/config.yml
  2. 2 0
      DEPS
  3. 2 2
      patches/angle/gles2_use_constant_initialization_for_g_mutex.patch
  4. 1 1
      patches/chromium/.patches
  5. 0 114
      patches/chromium/cherry-pick-db71a0afc1d0.patch
  6. 5 8
      patches/chromium/handle_err_cache_race_in_dodoneheadersaddtoentrycomplete.patch
  7. 1 1
      patches/node/build_add_gn_build_files.patch
  8. 1 1
      patches/node/build_bring_back_node_with_ltcg_configuration.patch
  9. 3 3
      patches/node/chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch
  10. 2 2
      patches/node/export_environment_knodecontexttagptr.patch
  11. 1 1
      patches/node/fix_enable_worker_threads.patch
  12. 13 13
      patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch
  13. 12 9
      patches/node/fix_uv_fs_mkdir_for_invalid_names.patch
  14. 1 1
      patches/node/fixme_revert_crypto_add_support_for_rsa-pss_keys.patch
  15. 7 4
      patches/node/fsevents-regression-in-watching.patch
  16. 7 4
      patches/node/fsevents-stop-using-fsevents-to-watch-files.patch
  17. 6 6
      patches/node/win-fix-uv_spawn-ENOMEM-on-empty-env.patch
  18. 1 1
      patches/perfetto/metatrace_remove_memset_and_trivial_ctor_assumption.patch
  19. 1 1
      patches/quiche/include_ostream_in_quic_ip_address_h.patch
  20. 3 3
      patches/v8/add_realloc.patch
  21. 3 3
      patches/v8/build_gn.patch
  22. 4 4
      patches/v8/dcheck.patch
  23. 25 25
      patches/v8/deps_provide_more_v8_backwards_compatibility.patch
  24. 1 1
      patches/v8/do_not_export_private_v8_symbols_on_windows.patch
  25. 1 1
      patches/v8/export_symbols_needed_for_windows_build.patch
  26. 2 2
      patches/v8/expose_mksnapshot.patch
  27. 2 2
      patches/v8/fix_bug_in_receiver_maps_inference.patch
  28. 1 1
      patches/v8/include_string_in_v8_h.patch
  29. 1 1
      patches/v8/objects_fix_memory_leak_in_prototypeusers_add.patch
  30. 31 0
      script/export_all_patches.py
  31. 2 135
      script/git-export-patches
  32. 143 1
      script/lib/git.py

+ 23 - 1
.circleci/config.yml

@@ -217,7 +217,25 @@ step-gclient-sync: &step-gclient-sync
           $GCLIENT_EXTRA_ARGS \
           "$CIRCLE_REPOSITORY_URL"
 
-        gclient sync --with_branch_heads --with_tags
+        ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 gclient sync --with_branch_heads --with_tags
+        # Re-export all the patches to check if there were changes.
+        python src/electron/script/export_all_patches.py src/electron/patches/config.json
+        cd src/electron
+        git update-index --refresh || true
+        if ! git diff-index --quiet HEAD --; then
+          # There are changes to the patches. Make a git commit with the updated patches
+          git add patches
+          GIT_COMMITTER_NAME="Electron Bot" GIT_COMMITTER_EMAIL="[email protected]" git commit -m "update patches" --author="Electron Bot <[email protected]>"
+          # Export it
+          mkdir -p ../../patches
+          git format-patch -1 --stdout --keep-subject --no-stat --full-index > ../../patches/update-patches.patch
+          echo
+          echo "======================================================================"
+          echo "There were changes to the patches when applying."
+          echo "Check the CI artifacts for a patch you can apply to fix it."
+          echo "======================================================================"
+          exit 1
+        fi
       fi
 
 step-setup-env-for-build: &step-setup-env-for-build
@@ -764,6 +782,8 @@ steps-checkout-fast: &steps-checkout-fast
     - *step-set-git-cache-path
     # This sync call only runs if .circle-sync-done is an EMPTY file
     - *step-gclient-sync
+    - store_artifacts:
+        path: patches
     # These next few steps reset Electron to the correct commit regardless of which cache was restored
     - run:
         name: Wipe Electron
@@ -795,6 +815,8 @@ steps-checkout-and-save-cache: &steps-checkout-and-save-cache
     - *step-set-git-cache-path
     # This sync call only runs if .circle-sync-done is an EMPTY file
     - *step-gclient-sync
+    - store_artifacts:
+        path: patches
     - *step-save-git-cache
     # These next few steps reset Electron to the correct commit regardless of which cache was restored
     - run:

+ 2 - 0
DEPS

@@ -152,3 +152,5 @@ hooks = [
 recursedeps = [
   'src',
 ]
+
+# Touch DEPS to bust cache

+ 2 - 2
patches/angle/gles2_use_constant_initialization_for_g_mutex.patch

@@ -28,10 +28,10 @@ index ab39ee01a47c15da57b531d2c711649f1685091b..7a0f3b32b101b34195c57637b227062d
  Nick Shaforostov
 +Jaime Bernardo
 diff --git a/src/common/angleutils.h b/src/common/angleutils.h
-index 131d5796da4399df1144bc349c506cde8220973a..3a1391e29b72e7ec356e44c7ced202cc29773fb3 100644
+index d5d3ca8312a61e2debf304cac21f3536ef6cb472..3c93d1bfdca21bab33168c144ea5fb6002bff5ee 100644
 --- a/src/common/angleutils.h
 +++ b/src/common/angleutils.h
-@@ -345,4 +345,10 @@ std::string ToString(const T &value)
+@@ -333,4 +333,10 @@ std::string ToString(const T &value)
  #    define ANGLE_MAYBE_UNUSED
  #endif  // __has_cpp_attribute(maybe_unused)
  

+ 1 - 1
patches/chromium/.patches

@@ -100,4 +100,4 @@ move_readablestream_requests_onto_the_stack_before_iteration.patch
 streams_convert_state_dchecks_to_checks.patch
 audiocontext_haspendingactivity_unless_it_s_closed.patch
 protect_automatic_pull_handlers_with_mutex.patch
-cherry-pick-adc8f05aa3ab.patch
+handle_err_cache_race_in_dodoneheadersaddtoentrycomplete.patch

+ 0 - 114
patches/chromium/cherry-pick-db71a0afc1d0.patch

@@ -1,114 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Raymond Toy <[email protected]>
-Date: Thu, 19 Mar 2020 21:54:36 +0000
-Subject: Clear context from orphan handlers when BaseAudioContext is going
- away
-
-When preparing to collect a BaseAudioContext, go through all the
-rendering_orphan_handlers_ and deletable_orphan_handlers_ and remove
-the context from the handler.  This ensures that these handlers no
-longer have references to the context when the BaseAudioContext is
-destroyed because in some cases, these orphan handlers will get pulled
-and access the context, which is already gone.
-
-Clearing these in a prefinalizer ensures these orphan handlers don't
-try to touch the context.
-
-Manually verified that the repro case no longer reproduces.
-
-Bug: 1062247
-Change-Id: I50d083743903eb9544e09aa1ee912fc880331501
-Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107806
-Reviewed-by: Kentaro Hara <[email protected]>
-Reviewed-by: Hongchan Choi <[email protected]>
-Commit-Queue: Raymond Toy <[email protected]>
-Cr-Commit-Position: refs/heads/master@{#751814}
-
-diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc
-index 34adef56ced1effd3af5a50e091f58440a53e6a7..200776395f7d3c978d8ae76959ce472002f7a284 100644
---- a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc
-+++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc
-@@ -179,6 +179,12 @@ void BaseAudioContext::Uninitialize() {
-   DCHECK_EQ(resume_resolvers_.size(), 0u);
- }
- 
-+void BaseAudioContext::Dispose() {
-+  // BaseAudioContext is going away, so remove the context from the orphan
-+  // handlers.
-+  GetDeferredTaskHandler().ClearContextFromOrphanHandlers();
-+}
-+
- void BaseAudioContext::ContextLifecycleStateChanged(
-     mojom::FrameLifecycleState state) {
-   // Don't need to do anything for an offline context.
-diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.h b/third_party/blink/renderer/modules/webaudio/base_audio_context.h
-index d5aadf7e58ea8a67df7d0a83e5ed5b9b1d7772bb..0cd91cf7e7fad97f1af38c5eb63c8e6afa7d276a 100644
---- a/third_party/blink/renderer/modules/webaudio/base_audio_context.h
-+++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.h
-@@ -96,6 +96,7 @@ class MODULES_EXPORT BaseAudioContext
-       public InspectorHelperMixin {
-   USING_GARBAGE_COLLECTED_MIXIN(BaseAudioContext);
-   DEFINE_WRAPPERTYPEINFO();
-+  USING_PRE_FINALIZER(BaseAudioContext, Dispose);
- 
-  public:
-   // The state of an audio context.  On creation, the state is Suspended. The
-@@ -115,6 +116,8 @@ class MODULES_EXPORT BaseAudioContext
-     return dest ? dest->GetAudioDestinationHandler().IsInitialized() : false;
-   }
- 
-+  void Dispose();
-+
-   // Document notification
-   void ContextLifecycleStateChanged(mojom::FrameLifecycleState) override;
-   void ContextDestroyed(ExecutionContext*) override;
-diff --git a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc
-index 9fd38f0dde71b5c773a861992f0e989ba6a9d5e0..28d67536bb706552453effa0d9126ffa789c0504 100644
---- a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc
-+++ b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc
-@@ -293,10 +293,7 @@ void DeferredTaskHandler::HandleDeferredTasks() {
- }
- 
- void DeferredTaskHandler::ContextWillBeDestroyed() {
--  for (auto& handler : rendering_orphan_handlers_)
--    handler->ClearContext();
--  for (auto& handler : deletable_orphan_handlers_)
--    handler->ClearContext();
-+  ClearContextFromOrphanHandlers();
-   ClearHandlersToBeDeleted();
-   // Some handlers might live because of their cross thread tasks.
- }
-@@ -359,6 +356,19 @@ void DeferredTaskHandler::ClearHandlersToBeDeleted() {
-   active_source_handlers_.clear();
- }
- 
-+void DeferredTaskHandler::ClearContextFromOrphanHandlers() {
-+  DCHECK(IsMainThread());
-+
-+  // |rendering_orphan_handlers_| and |deletable_orphan_handlers_| can
-+  // be modified on the audio thread.
-+  GraphAutoLocker locker(*this);
-+
-+  for (auto& handler : rendering_orphan_handlers_)
-+    handler->ClearContext();
-+  for (auto& handler : deletable_orphan_handlers_)
-+    handler->ClearContext();
-+}
-+
- void DeferredTaskHandler::SetAudioThreadToCurrentThread() {
-   DCHECK(!IsMainThread());
-   audio_thread_.store(CurrentThread(), std::memory_order_relaxed);
-diff --git a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h
-index 0ede5f5b5dabeeef9decc94c94d91ddc7351c722..2900b0f7cf3c47c8e92cc3ad4dda665eabdc479f 100644
---- a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h
-+++ b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h
-@@ -109,6 +109,9 @@ class MODULES_EXPORT DeferredTaskHandler final
-   void RequestToDeleteHandlersOnMainThread();
-   void ClearHandlersToBeDeleted();
- 
-+  // Clear the context from the rendering and deletable orphan handlers.
-+  void ClearContextFromOrphanHandlers();
-+
-   bool AcceptsTailProcessing() const { return accepts_tail_processing_; }
-   void StopAcceptingTailProcessing() { accepts_tail_processing_ = false; }
- 

+ 5 - 8
patches/chromium/cherry-pick-adc8f05aa3ab.patch → patches/chromium/handle_err_cache_race_in_dodoneheadersaddtoentrycomplete.patch

@@ -1,7 +1,7 @@
-From adc8f05aa3abbde50a7b9171c7311aba08c07b00 Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Alex Turner <[email protected]>
 Date: Fri, 20 Sep 2019 20:21:41 +0000
-Subject: [PATCH] Handle ERR_CACHE_RACE in DoDoneHeadersAddToEntryComplete
+Subject: Handle ERR_CACHE_RACE in DoDoneHeadersAddToEntryComplete
 
 Crashes have been observed in the wild that may be due to
 ERR_CACHE_RACE being sent to STATE_DONE_HEADERS_ADD_TO_ENTRY_COMPLETE.
@@ -16,15 +16,12 @@ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814843
 Commit-Queue: Alex Turner <[email protected]>
 Reviewed-by: Shivani Sharma <[email protected]>
 Cr-Commit-Position: refs/heads/master@{#698597}
----
- net/http/http_cache_transaction.cc | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
 
 diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
-index 6f2577de617ec..bc1193f4b7d43 100644
+index b1249dfda91060aa1792ee6841b54eaaa2bf95da..05c2e8a52860cb718ee2dbbfc1210956492d8db9 100644
 --- a/net/http/http_cache_transaction.cc
 +++ b/net/http/http_cache_transaction.cc
-@@ -1430,8 +1430,15 @@ int HttpCache::Transaction::DoDoneHeadersAddToEntryComplete(int result) {
+@@ -1433,8 +1433,15 @@ int HttpCache::Transaction::DoDoneHeadersAddToEntryComplete(int result) {
    DCHECK(response_.headers);
  
    cache_pending_ = false;
@@ -41,7 +38,7 @@ index 6f2577de617ec..bc1193f4b7d43 100644
    DCHECK_NE(response_.headers->response_code(), 304);
    DCHECK(cache_->CanTransactionWriteResponseHeaders(
        entry_, this, partial_ != nullptr, false));
-@@ -2078,6 +2085,7 @@ int HttpCache::Transaction::DoHeadersPhaseCannotProceed(int result) {
+@@ -2081,6 +2088,7 @@ int HttpCache::Transaction::DoHeadersPhaseCannotProceed(int result) {
    SetRequest(net_log_);
  
    entry_ = nullptr;

+ 1 - 1
patches/node/build_add_gn_build_files.patch

@@ -1534,7 +1534,7 @@ index 0000000000000000000000000000000000000000..f3c5c798c0aefcb8cf9b1570a7b4817c
 +  args = rebase_path(inputs + outputs, root_build_dir)
 +}
 diff --git a/src/node_version.h b/src/node_version.h
-index 2d105483ba10533d992de3265121e6ab9edce2ed..8a8fd5f7fad4a69b65e06d67225a398385d3bbbf 100644
+index f09ac411472981efec6d186a032aa46d9fca7fd1..dcddea36bfafa49a6a02f2e4c6cf26d3be7fb5c6 100644
 --- a/src/node_version.h
 +++ b/src/node_version.h
 @@ -89,7 +89,10 @@

+ 1 - 1
patches/node/build_bring_back_node_with_ltcg_configuration.patch

@@ -10,7 +10,7 @@ THe fix for this should land in node-gyp as discussed in above issue,
 landing this as temporary patch.
 
 diff --git a/common.gypi b/common.gypi
-index bde7d7300f44596abe5cdfac0639ecb1bb4d885f..412f613e7cfcf563fa6a000b932723166ab567da 100644
+index f07e65f719a1a5939997dfcae7bc787ee6391f4d..f4d03a2fdfd47a4e6a71c7146d92ce7cbc44993d 100644
 --- a/common.gypi
 +++ b/common.gypi
 @@ -19,7 +19,7 @@

+ 3 - 3
patches/node/chore_add_ability_to_prevent_warn_non_context-aware_native_modules.patch

@@ -5,10 +5,10 @@ Subject: chore: add ability to prevent / warn non context-aware native modules
  being loaded
 
 diff --git a/src/env.h b/src/env.h
-index 2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2..ecb845803776f5ff6e7eec712ec7a5ebea2e8d0a 100644
+index fe0f52a0a95d67a89b79c34983975060e971e15e..0500fce2610f2a3fe3ce975fd60cc94d571af07c 100644
 --- a/src/env.h
 +++ b/src/env.h
-@@ -884,6 +884,15 @@ class Environment : public MemoryRetainer {
+@@ -885,6 +885,15 @@ class Environment : public MemoryRetainer {
                uint64_t thread_id = kNoThreadId);
    ~Environment();
  
@@ -24,7 +24,7 @@ index 2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2..ecb845803776f5ff6e7eec712ec7a5eb
    void InitializeLibuv(bool start_profiler_idle_notifier);
    inline const std::vector<std::string>& exec_argv();
    inline const std::vector<std::string>& argv();
-@@ -1234,6 +1243,9 @@ class Environment : public MemoryRetainer {
+@@ -1235,6 +1244,9 @@ class Environment : public MemoryRetainer {
    inline void ThrowError(v8::Local<v8::Value> (*fun)(v8::Local<v8::String>),
                           const char* errmsg);
  

+ 2 - 2
patches/node/export_environment_knodecontexttagptr.patch

@@ -5,10 +5,10 @@ Subject: export Environment::kNodeContextTagPtr
 
 
 diff --git a/src/env.h b/src/env.h
-index 82ed066f9cde4851fa3375d0faffe4bfcf2bf411..2dd6bdb75f02e2ccb07129996d16df99c0c4ccf2 100644
+index 8647c5408f9eac006df6d655918eedc53b936d72..fe0f52a0a95d67a89b79c34983975060e971e15e 100644
 --- a/src/env.h
 +++ b/src/env.h
-@@ -1304,7 +1304,7 @@ class Environment : public MemoryRetainer {
+@@ -1305,7 +1305,7 @@ class Environment : public MemoryRetainer {
    uint64_t thread_id_;
    std::unordered_set<worker::Worker*> sub_worker_contexts_;
  

+ 1 - 1
patches/node/fix_enable_worker_threads.patch

@@ -12,7 +12,7 @@ This commit fixes this problem by changing node_worker to use the three-arg
 implementation of `NewIsolate` to prevent it trying to use a possibly-null ptr.
 
 diff --git a/src/node_worker.cc b/src/node_worker.cc
-index 8f97f5c351..2bfbb28e61 100644
+index 8f97f5c3514639ab799c316b67bd782dfbda17f8..edc5a7fcaf8995df790151037ca0c6894fb1885c 100644
 --- a/src/node_worker.cc
 +++ b/src/node_worker.cc
 @@ -112,7 +112,10 @@ class WorkerThreadData {

+ 13 - 13
patches/node/fix_extern_the_nativemoduleenv_and_options_parser_for_debug_builds.patch

@@ -17,6 +17,19 @@ index b91a5059cd1f19d87e5876c372f3ded60681a5df..f81cf8dfb892a8ddd9084c5d9477b178
   public:
    static void Initialize(v8::Local<v8::Object> target,
                           v8::Local<v8::Value> unused,
+diff --git a/src/node_options.cc b/src/node_options.cc
+index 01dddb979042c098326a8b1ff37397642733f49b..f91a23c1d7ee8a141d349c486b7520c175094b8b 100644
+--- a/src/node_options.cc
++++ b/src/node_options.cc
+@@ -237,7 +237,7 @@ const EnvironmentOptionsParser _eop_instance{_dop_instance};
+ 
+ // This Parse is not dead code. It is used by embedders (e.g., Electron).
+ template <>
+-void Parse(
++void NODE_EXTERN Parse(
+   StringVector* const args, StringVector* const exec_args,
+   StringVector* const v8_args,
+   DebugOptions* const options,
 diff --git a/src/node_options.h b/src/node_options.h
 index ce86827024126c6b0d8462c811360057c298ec5b..d53307f9589d4487c220526b8e49b6c7fbd29daf 100644
 --- a/src/node_options.h
@@ -39,16 +52,3 @@ index ce86827024126c6b0d8462c811360057c298ec5b..d53307f9589d4487c220526b8e49b6c7
    StringVector* const args, StringVector* const exec_args,
    StringVector* const v8_args, OptionsType* const options,
    OptionEnvvarSettings required_env_settings, StringVector* const errors);
-diff --git a/src/node_options.cc b/src/node_options.cc
-index 01dddb979042c098326a8b1ff37397642733f49b..f91a23c1d7ee8a141d349c486b7520c175094b8b 100644
---- a/src/node_options.cc
-+++ b/src/node_options.cc
-@@ -237,7 +237,7 @@ const EnvironmentOptionsParser _eop_instance{_dop_instance};
- 
- // This Parse is not dead code. It is used by embedders (e.g., Electron).
- template <>
--void Parse(
-+void NODE_EXTERN Parse(
-   StringVector* const args, StringVector* const exec_args,
-   StringVector* const v8_args,
-   DebugOptions* const options,

+ 12 - 9
patches/node/fix_uv_fs_mkdir_for_invalid_names.patch

@@ -1,7 +1,10 @@
-From ecff27857dafe3f5d30a6ab8646ea69a93e4940a Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Bartosz Sosnowski <[email protected]>
 Date: Thu, 11 Jul 2019 12:45:38 +0200
-Subject: [PATCH] win, fs: mkdir return UV_EINVAL for invalid names
+Subject: win, fs: mkdir return UV_EINVAL for invalid names
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 Makes uv_fs_mkdir return UV_EINVAL for invalid filenames instead of
 UV_ENOENT.
@@ -14,10 +17,10 @@ Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
 Reviewed-By: Colin Ihrig <[email protected]>
 
 diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
-index 15094121..31242b51 100644
+index 7d78d466c8738f6f0741c0a8e8fd439c7e854730..0c4bbacd0acfe59b3f66cf5f54b528c1d5c80145 100644
 --- a/deps/uv/src/win/fs.c
 +++ b/deps/uv/src/win/fs.c
-@@ -1180,8 +1180,13 @@ void fs__unlink(uv_fs_t* req) {
+@@ -850,8 +850,13 @@ void fs__unlink(uv_fs_t* req) {
  
  void fs__mkdir(uv_fs_t* req) {
    /* TODO: use req->mode. */
@@ -34,10 +37,10 @@ index 15094121..31242b51 100644
  
  
 diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c
-index 35a992d8..95f6b5e9 100644
+index 2cf8f287fe331d15bfab06179824d63f7cd19280..649ff0a3804ef81d3aa41ce6201b738f6b0b006a 100644
 --- a/deps/uv/test/test-fs.c
 +++ b/deps/uv/test/test-fs.c
-@@ -4060,4 +4060,16 @@ TEST_IMPL(fs_fchmod_archive_readonly) {
+@@ -3873,4 +3873,16 @@ TEST_IMPL(fs_fchmod_archive_readonly) {
  
      return 0;
  }
@@ -55,10 +58,10 @@ index 35a992d8..95f6b5e9 100644
 +}
  #endif
 diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
-index 3c5f21b9..ffa7e545 100644
+index a48f6f3806806af6bf844558d08fa9679e268112..911426f7e1d2d84452a8d247b46e93ed65e5ffdd 100644
 --- a/deps/uv/test/test-list.h
 +++ b/deps/uv/test/test-list.h
-@@ -380,6 +380,7 @@ TEST_DECLARE   (fs_exclusive_sharing_mode)
+@@ -374,6 +374,7 @@ TEST_DECLARE   (fs_exclusive_sharing_mode)
  TEST_DECLARE   (fs_file_flag_no_buffering)
  TEST_DECLARE   (fs_open_readonly_acl)
  TEST_DECLARE   (fs_fchmod_archive_readonly)
@@ -66,7 +69,7 @@ index 3c5f21b9..ffa7e545 100644
  #endif
  TEST_DECLARE   (strscpy)
  TEST_DECLARE   (threadpool_queue_work_simple)
-@@ -973,6 +974,7 @@ TASK_LIST_START
+@@ -961,6 +962,7 @@ TASK_LIST_START
    TEST_ENTRY  (fs_file_flag_no_buffering)
    TEST_ENTRY  (fs_open_readonly_acl)
    TEST_ENTRY  (fs_fchmod_archive_readonly)

+ 1 - 1
patches/node/fixme_revert_crypto_add_support_for_rsa-pss_keys.patch

@@ -110,7 +110,7 @@ index b6a3376e735094f970ef61a52ef9bb6d6101647a..bb70c2305fd44cfea46a8df5e65d1af5
  
  Sign.prototype.sign = function sign(options, encoding) {
 diff --git a/src/env.h b/src/env.h
-index ecb845803776f5ff6e7eec712ec7a5ebea2e8d0a..1516d77be8514ce55d8d21b78a7cd85ead2cb95f 100644
+index 0500fce2610f2a3fe3ce975fd60cc94d571af07c..7ce3d3f467e9a44c33d24df5968f16e09558f2ec 100644
 --- a/src/env.h
 +++ b/src/env.h
 @@ -173,7 +173,6 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;

+ 7 - 4
patches/node/fsevents-regression-in-watching.patch

@@ -1,7 +1,10 @@
-From ae12376dbb56fa080b699f00840c7b9c5230a85f Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Jameson Nash <[email protected]>
 Date: Sat, 7 Sep 2019 20:45:39 -0400
-Subject: [PATCH] fsevents: regression in watching /
+Subject: fsevents: regression in watching /
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 This case got lost by accident in
 https://github.com/libuv/libuv/pull/2082,
@@ -13,7 +16,7 @@ Reviewed-By: Ben Noordhuis <[email protected]>
 Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
 
 diff --git a/deps/uv/src/unix/fsevents.c b/deps/uv/src/unix/fsevents.c
-index ddacda31..deeaa63d 100644
+index ddacda31fef87eee131fc2ee2ff46cc88be429d9..deeaa63d4730de9aa17ee87923acd96d6507a55d 100644
 --- a/deps/uv/src/unix/fsevents.c
 +++ b/deps/uv/src/unix/fsevents.c
 @@ -263,10 +263,12 @@ static void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
@@ -32,7 +35,7 @@ index ddacda31..deeaa63d 100644
  
        if (memcmp(path, handle->realpath, handle->realpath_len) != 0)
 diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c
-index 4b8bb1ef..7725c3af 100644
+index 4b8bb1ef03e54407cba8eef85179039632cc3f28..7725c3af94edd5d62bb960912262d38aefa6676e 100644
 --- a/deps/uv/test/test-fs-event.c
 +++ b/deps/uv/test/test-fs-event.c
 @@ -47,6 +47,7 @@ static const char file_prefix[] = "fsevent-";

+ 7 - 4
patches/node/fsevents-stop-using-fsevents-to-watch-files.patch

@@ -1,7 +1,10 @@
-From 97b85e8b75b8f3df774b6e008dbaa143daa412b7 Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Jameson Nash <[email protected]>
 Date: Sat, 7 Sep 2019 14:55:40 -0400
-Subject: [PATCH] fsevents: stop using fsevents to watch files
+Subject: fsevents: stop using fsevents to watch files
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
 
 Goes back to just using it to watch folders,
 but keeps the other logic changes around.
@@ -17,7 +20,7 @@ Reviewed-By: Ben Noordhuis <[email protected]>
 Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
 
 diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c
-index c04e7a48..ad09f403 100644
+index c04e7a485cf992beec501144e04ff068c17b9494..ad09f4031318cafe08faed3f0a6373e2bb598672 100644
 --- a/deps/uv/src/unix/kqueue.c
 +++ b/deps/uv/src/unix/kqueue.c
 @@ -454,10 +454,26 @@ int uv_fs_event_start(uv_fs_event_t* handle,
@@ -102,7 +105,7 @@ index c04e7a48..ad09f403 100644
  #endif
  
 diff --git a/deps/uv/test/test-fs-event.c b/deps/uv/test/test-fs-event.c
-index ea34bd63..4b8bb1ef 100644
+index ea34bd63a70625c3e2c60d5a1bbb087c5f0bbb2e..4b8bb1ef03e54407cba8eef85179039632cc3f28 100644
 --- a/deps/uv/test/test-fs-event.c
 +++ b/deps/uv/test/test-fs-event.c
 @@ -656,6 +656,12 @@ TEST_IMPL(fs_event_watch_file_current_dir) {

+ 6 - 6
patches/node/win-fix-uv_spawn-ENOMEM-on-empty-env.patch

@@ -1,7 +1,7 @@
-From 1fc72276f91c7d378f14dfd0bb6b0ca8667e4bc5 Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Ben Noordhuis <[email protected]>
 Date: Fri, 9 Aug 2019 13:34:20 +0200
-Subject: [PATCH] win: fix uv_spawn() ENOMEM on empty env
+Subject: win: fix uv_spawn() ENOMEM on empty env
 
 Commit ba780231 ("unix,win: handle zero-sized allocations uniformly")
 makes `uv__malloc()` return NULL when `size == 0`.
@@ -17,7 +17,7 @@ Reviewed-By: Jameson Nash <[email protected]>
 Reviewed-By: Bartosz Sosnowski <[email protected]>
 
 diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c
-index f9c53de0..9b7fdc1d 100644
+index fa1a76a2e6626e15bdd0681626fc82c9ca6907fe..e1010d1248a95a3927d6ed1a1affbb545c1d7201 100644
 --- a/deps/uv/src/win/process.c
 +++ b/deps/uv/src/win/process.c
 @@ -714,7 +714,7 @@ int make_program_env(char* env_block[], WCHAR** dst_ptr) {
@@ -39,7 +39,7 @@ index f9c53de0..9b7fdc1d 100644
    /* sort our (UTF-16) copy */
    qsort(env_copy, env_block_count-1, sizeof(wchar_t*), qsort_wcscmp);
 diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
-index 3f94360f..6eb8ecad 100644
+index 911426f7e1d2d84452a8d247b46e93ed65e5ffdd..4849f89f78261c53b3f1336dfe02efa57ba4418e 100644
 --- a/deps/uv/test/test-list.h
 +++ b/deps/uv/test/test-list.h
 @@ -264,6 +264,7 @@ TEST_DECLARE   (spawn_fails)
@@ -50,7 +50,7 @@ index 3f94360f..6eb8ecad 100644
  TEST_DECLARE   (spawn_exit_code)
  TEST_DECLARE   (spawn_stdout)
  TEST_DECLARE   (spawn_stdin)
-@@ -829,6 +830,7 @@ TASK_LIST_START
+@@ -822,6 +823,7 @@ TASK_LIST_START
  #ifndef _WIN32
    TEST_ENTRY  (spawn_fails_check_for_waitpid_cleanup)
  #endif
@@ -59,7 +59,7 @@ index 3f94360f..6eb8ecad 100644
    TEST_ENTRY  (spawn_stdout)
    TEST_ENTRY  (spawn_stdin)
 diff --git a/deps/uv/test/test-spawn.c b/deps/uv/test/test-spawn.c
-index fea1165d..fec610bf 100644
+index fea1165d89e08e9e56257cded55048b09c27d1d0..fec610bfdef97eff778c28158c2360ef02cb08e5 100644
 --- a/deps/uv/test/test-spawn.c
 +++ b/deps/uv/test/test-spawn.c
 @@ -232,6 +232,34 @@ TEST_IMPL(spawn_fails_check_for_waitpid_cleanup) {

+ 1 - 1
patches/perfetto/metatrace_remove_memset_and_trivial_ctor_assumption.patch

@@ -13,7 +13,7 @@ Bug: chromium:1010616
 Change-Id: I971ff888306d6bdbaf6e6b886f9ca506ddc1b30a
 
 diff --git a/include/perfetto/ext/base/metatrace.h b/include/perfetto/ext/base/metatrace.h
-index 3858f68ec5eaf130aafa7d33f52a00e370395204..2c587c3fc63093f71a05e4c757def5c6384bf703 100644
+index ceb4bfb1cd1a58c9a011a043d2d6904e9d15bee4..d626039d4da0beb41433f7c4807f78269c86d848 100644
 --- a/include/perfetto/ext/base/metatrace.h
 +++ b/include/perfetto/ext/base/metatrace.h
 @@ -116,22 +116,33 @@ struct Record {

+ 1 - 1
patches/quiche/include_ostream_in_quic_ip_address_h.patch

@@ -1,7 +1,7 @@
 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: vasilvv <[email protected]>
 Date: Thu, 3 Oct 2019 09:37:10 -0700
-Subject: [build] Include ostream in quic_ip_address.h
+Subject: Include ostream in quic_ip_address.h
 
 Explicitly #include <ostream> in quic/platform/api/quic_ip_address.h, since std::ostream is referenced in it. In the C++ STL shipped with Visual Studio 2019, none of the headers included in quic_ip_address.h ends up including the required templates, which caused a compile error.
 

+ 3 - 3
patches/v8/add_realloc.patch

@@ -12,10 +12,10 @@ when we override ReallocateBufferMemory, so we therefore need to implement
 Realloc on the v8 side.
 
 diff --git a/include/v8.h b/include/v8.h
-index da0ad413bdee2c89ea6f4b07944a2ddde20b2bca..01344fec995e38d741b89a062f5fa5c7a9d9b821 100644
+index d66f360c990d3ea22e3277558dde5958e5609573..60496de0596d8879d5a0215c25aebf1b62bb53ec 100644
 --- a/include/v8.h
 +++ b/include/v8.h
-@@ -4711,6 +4711,13 @@ class V8_EXPORT ArrayBuffer : public Object {
+@@ -4748,6 +4748,13 @@ class V8_EXPORT ArrayBuffer : public Object {
       */
      virtual void* AllocateUninitialized(size_t length) = 0;
  
@@ -30,7 +30,7 @@ index da0ad413bdee2c89ea6f4b07944a2ddde20b2bca..01344fec995e38d741b89a062f5fa5c7
       * Free the memory block of size |length|, pointed to by |data|.
       * That memory is guaranteed to be previously allocated by |Allocate|.
 diff --git a/src/api/api.cc b/src/api/api.cc
-index c9f3860fb92be616a3087e55eed045322225eeab..fc8246b47c4cc6b5b3a22570c37840cbeafa7811 100644
+index 30eceb6223377f28fb546c0a339e66e17b01638f..2c0cfcf8ddf10baf1bd504437e5bb4fe0999683e 100644
 --- a/src/api/api.cc
 +++ b/src/api/api.cc
 @@ -513,6 +513,10 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {

+ 3 - 3
patches/v8/build_gn.patch

@@ -5,7 +5,7 @@ Subject: build_gn.patch
 
 
 diff --git a/BUILD.gn b/BUILD.gn
-index 3b22ed0cca91ae6f07ae8f756604a9a8944a2627..4b852fdb298f47ee3bce814c243a6cd4671cdb81 100644
+index c486f1a1c86abc23a8587a5ff7bc312001d3bec4..92c15b34b9a593ac3c1db1d543168622b92c1c02 100644
 --- a/BUILD.gn
 +++ b/BUILD.gn
 @@ -284,7 +284,7 @@ config("internal_config") {
@@ -17,7 +17,7 @@ index 3b22ed0cca91ae6f07ae8f756604a9a8944a2627..4b852fdb298f47ee3bce814c243a6cd4
      defines += [ "BUILDING_V8_SHARED" ]
    }
  }
-@@ -3826,7 +3826,7 @@ if (current_toolchain == v8_generator_toolchain) {
+@@ -3831,7 +3831,7 @@ if (current_toolchain == v8_generator_toolchain) {
        "src/interpreter/bytecodes.h",
      ]
  
@@ -26,7 +26,7 @@ index 3b22ed0cca91ae6f07ae8f756604a9a8944a2627..4b852fdb298f47ee3bce814c243a6cd4
  
      deps = [
        ":v8_libbase",
-@@ -3857,6 +3857,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
+@@ -3862,6 +3862,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
  
      configs = [ ":internal_config" ]
  

+ 4 - 4
patches/v8/dcheck.patch

@@ -5,10 +5,10 @@ Subject: dcheck.patch
 
 
 diff --git a/src/api/api.cc b/src/api/api.cc
-index 01e47df41cd1d3d1a59b495d60688ee035845e06..d8cec37cf4744f1bced3e426caae9e29837cce02 100644
+index 5c261b536de83a57ad29e006058f98c951251c2a..47a2bce6ed84146ac559bde5efe13d304520340d 100644
 --- a/src/api/api.cc
 +++ b/src/api/api.cc
-@@ -8353,7 +8353,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
+@@ -8363,7 +8363,7 @@ void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) {
  }
  
  void Isolate::RunMicrotasks() {
@@ -18,10 +18,10 @@ index 01e47df41cd1d3d1a59b495d60688ee035845e06..d8cec37cf4744f1bced3e426caae9e29
    isolate->default_microtask_queue()->RunMicrotasks(isolate);
  }
 diff --git a/src/heap/heap.cc b/src/heap/heap.cc
-index 2fc041effd710c8797df846de7b16cf086deb6be..b1b0a2631d66c79c23431a9f7ae918848f97fc05 100644
+index ff3b34cfb4f29bbd89cf1bd771985b84b14b371a..050a6139807b8c210e02bed9f8a464f49ad2453c 100644
 --- a/src/heap/heap.cc
 +++ b/src/heap/heap.cc
-@@ -5304,9 +5304,9 @@ void Heap::TearDown() {
+@@ -5300,9 +5300,9 @@ void Heap::TearDown() {
  void Heap::AddGCPrologueCallback(v8::Isolate::GCCallbackWithData callback,
                                   GCType gc_type, void* data) {
    DCHECK_NOT_NULL(callback);

+ 25 - 25
patches/v8/deps_provide_more_v8_backwards_compatibility.patch

@@ -22,10 +22,10 @@ Reviewed-By: Yang Guo <[email protected]>
 Reviewed-By: Michaël Zasso <[email protected]>
 
 diff --git a/include/v8.h b/include/v8.h
-index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882d08e2aaf 100644
+index 60496de0596d8879d5a0215c25aebf1b62bb53ec..f5b6caaee19b7abb0ee4d98615988d1d8b14035c 100644
 --- a/include/v8.h
 +++ b/include/v8.h
-@@ -1167,6 +1167,10 @@ class V8_EXPORT PrimitiveArray {
+@@ -1195,6 +1195,10 @@ class V8_EXPORT PrimitiveArray {
   public:
    static Local<PrimitiveArray> New(Isolate* isolate, int length);
    int Length() const;
@@ -36,7 +36,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
    void Set(Isolate* isolate, int index, Local<Primitive> item);
    Local<Primitive> Get(Isolate* isolate, int index);
  };
-@@ -1907,6 +1911,8 @@ class V8_EXPORT StackTrace {
+@@ -1935,6 +1939,8 @@ class V8_EXPORT StackTrace {
    /**
     * Returns a StackFrame at a particular index.
     */
@@ -45,7 +45,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
    Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
  
    /**
-@@ -2601,6 +2607,13 @@ class V8_EXPORT Value : public Data {
+@@ -2629,6 +2635,13 @@ class V8_EXPORT Value : public Data {
  
    Local<Boolean> ToBoolean(Isolate* isolate) const;
  
@@ -59,7 +59,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
    /**
     * Attempts to convert a string to an array index.
     * Returns an empty handle if the conversion fails.
-@@ -2617,7 +2630,14 @@ class V8_EXPORT Value : public Data {
+@@ -2645,7 +2658,14 @@ class V8_EXPORT Value : public Data {
        Local<Context> context) const;
    V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
  
@@ -74,7 +74,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
    V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context,
                                             Local<Value> that) const;
    bool StrictEquals(Local<Value> that) const;
-@@ -2724,6 +2744,8 @@ class V8_EXPORT String : public Name {
+@@ -2752,6 +2772,8 @@ class V8_EXPORT String : public Name {
     * Returns the number of bytes in the UTF-8 encoded
     * representation of this string.
     */
@@ -83,7 +83,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
    int Utf8Length(Isolate* isolate) const;
  
    /**
-@@ -2780,12 +2802,23 @@ class V8_EXPORT String : public Name {
+@@ -2808,12 +2830,23 @@ class V8_EXPORT String : public Name {
    // 16-bit character codes.
    int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
              int options = NO_OPTIONS) const;
@@ -107,7 +107,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
  
    /**
     * A zero length string.
-@@ -2953,6 +2986,9 @@ class V8_EXPORT String : public Name {
+@@ -2981,6 +3014,9 @@ class V8_EXPORT String : public Name {
     */
    static Local<String> Concat(Isolate* isolate, Local<String> left,
                                Local<String> right);
@@ -117,7 +117,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
  
    /**
     * Creates a new external string using the data defined in the given
-@@ -3017,6 +3053,8 @@ class V8_EXPORT String : public Name {
+@@ -3045,6 +3081,8 @@ class V8_EXPORT String : public Name {
     */
    class V8_EXPORT Utf8Value {
     public:
@@ -126,7 +126,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
      Utf8Value(Isolate* isolate, Local<v8::Value> obj);
      ~Utf8Value();
      char* operator*() { return str_; }
-@@ -3040,6 +3078,7 @@ class V8_EXPORT String : public Name {
+@@ -3068,6 +3106,7 @@ class V8_EXPORT String : public Name {
     */
    class V8_EXPORT Value {
     public:
@@ -134,7 +134,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
      Value(Isolate* isolate, Local<v8::Value> obj);
      ~Value();
      uint16_t* operator*() { return str_; }
-@@ -5368,6 +5407,8 @@ class V8_EXPORT BooleanObject : public Object {
+@@ -5405,6 +5444,8 @@ class V8_EXPORT BooleanObject : public Object {
  class V8_EXPORT StringObject : public Object {
   public:
    static Local<Value> New(Isolate* isolate, Local<String> value);
@@ -143,7 +143,7 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
  
    Local<String> ValueOf() const;
  
-@@ -10688,6 +10729,29 @@ template <class T> Value* Value::Cast(T* value) {
+@@ -10739,6 +10780,29 @@ template <class T> Value* Value::Cast(T* value) {
  }
  
  
@@ -174,10 +174,10 @@ index 01344fec995e38d741b89a062f5fa5c7a9d9b821..7b183a64e71be4916f721c1b804f4882
  #ifdef V8_ENABLE_CHECKS
    CheckCast(value);
 diff --git a/src/api/api.cc b/src/api/api.cc
-index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee035845e06 100644
+index 2c0cfcf8ddf10baf1bd504437e5bb4fe0999683e..5c261b536de83a57ad29e006058f98c951251c2a 100644
 --- a/src/api/api.cc
 +++ b/src/api/api.cc
-@@ -2196,6 +2196,10 @@ int PrimitiveArray::Length() const {
+@@ -2201,6 +2201,10 @@ int PrimitiveArray::Length() const {
    return array->length();
  }
  
@@ -188,7 +188,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  void PrimitiveArray::Set(Isolate* v8_isolate, int index,
                           Local<Primitive> item) {
    i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
-@@ -2209,6 +2213,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
+@@ -2214,6 +2218,10 @@ void PrimitiveArray::Set(Isolate* v8_isolate, int index,
    array->set(index, *i_item);
  }
  
@@ -199,7 +199,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  Local<Primitive> PrimitiveArray::Get(Isolate* v8_isolate, int index) {
    i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
    i::Handle<i::FixedArray> array = Utils::OpenHandle(this);
-@@ -2950,6 +2958,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
+@@ -2955,6 +2963,10 @@ void Message::PrintCurrentStackTrace(Isolate* isolate, FILE* out) {
  
  // --- S t a c k T r a c e ---
  
@@ -210,7 +210,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  Local<StackFrame> StackTrace::GetFrame(Isolate* v8_isolate,
                                         uint32_t index) const {
    i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
-@@ -3537,6 +3549,34 @@ MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
+@@ -3542,6 +3554,34 @@ MaybeLocal<BigInt> Value::ToBigInt(Local<Context> context) const {
    RETURN_ESCAPED(result);
  }
  
@@ -245,7 +245,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  bool Value::BooleanValue(Isolate* v8_isolate) const {
    return Utils::OpenHandle(this)->BooleanValue(
        reinterpret_cast<i::Isolate*>(v8_isolate));
-@@ -3884,6 +3924,11 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
+@@ -3889,6 +3929,11 @@ MaybeLocal<Uint32> Value::ToArrayIndex(Local<Context> context) const {
    return Local<Uint32>();
  }
  
@@ -257,7 +257,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  Maybe<bool> Value::Equals(Local<Context> context, Local<Value> that) const {
    i::Isolate* isolate = Utils::OpenHandle(*context)->GetIsolate();
    auto self = Utils::OpenHandle(this);
-@@ -5096,6 +5141,10 @@ bool String::ContainsOnlyOneByte() const {
+@@ -5106,6 +5151,10 @@ bool String::ContainsOnlyOneByte() const {
    return helper.Check(*str);
  }
  
@@ -268,7 +268,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  int String::Utf8Length(Isolate* isolate) const {
    i::Handle<i::String> str = Utils::OpenHandle(this);
    str = i::String::Flatten(reinterpret_cast<i::Isolate*>(isolate), str);
-@@ -5248,6 +5297,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
+@@ -5258,6 +5307,14 @@ static int WriteUtf8Impl(i::Vector<const Char> string, char* write_start,
  }
  }  // anonymous namespace
  
@@ -283,7 +283,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  int String::WriteUtf8(Isolate* v8_isolate, char* buffer, int capacity,
                        int* nchars_ref, int options) const {
    i::Handle<i::String> str = Utils::OpenHandle(this);
-@@ -5286,6 +5343,17 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
+@@ -5296,6 +5353,17 @@ static inline int WriteHelper(i::Isolate* isolate, const String* string,
    return end - start;
  }
  
@@ -301,7 +301,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  int String::WriteOneByte(Isolate* isolate, uint8_t* buffer, int start,
                           int length, int options) const {
    return WriteHelper(reinterpret_cast<i::Isolate*>(isolate), this, buffer,
-@@ -6203,6 +6271,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
+@@ -6213,6 +6281,11 @@ MaybeLocal<String> String::NewFromTwoByte(Isolate* isolate,
    return result;
  }
  
@@ -313,7 +313,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  Local<String> v8::String::Concat(Isolate* v8_isolate, Local<String> left,
                                   Local<String> right) {
    i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
-@@ -6473,6 +6546,10 @@ bool v8::BooleanObject::ValueOf() const {
+@@ -6483,6 +6556,10 @@ bool v8::BooleanObject::ValueOf() const {
    return js_primitive_wrapper->value().IsTrue(isolate);
  }
  
@@ -324,7 +324,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  Local<v8::Value> v8::StringObject::New(Isolate* v8_isolate,
                                         Local<String> value) {
    i::Handle<i::String> string = Utils::OpenHandle(*value);
-@@ -8726,6 +8803,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
+@@ -8736,6 +8813,9 @@ bool MicrotasksScope::IsRunningMicrotasks(Isolate* v8_isolate) {
    return microtask_queue->IsRunningMicrotasks();
  }
  
@@ -334,7 +334,7 @@ index fc8246b47c4cc6b5b3a22570c37840cbeafa7811..01e47df41cd1d3d1a59b495d60688ee0
  String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
      : str_(nullptr), length_(0) {
    if (obj.IsEmpty()) return;
-@@ -8743,6 +8823,9 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
+@@ -8753,6 +8833,9 @@ String::Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> obj)
  
  String::Utf8Value::~Utf8Value() { i::DeleteArray(str_); }
  

+ 1 - 1
patches/v8/do_not_export_private_v8_symbols_on_windows.patch

@@ -12,7 +12,7 @@ This patch can be safely removed if, when it is removed, `node.lib` does not
 contain any standard C++ library exports (e.g. `std::ostringstream`).
 
 diff --git a/BUILD.gn b/BUILD.gn
-index 5abaa35c6d9de73e69c26e298335446b9e6f3ef6..c2c36f3be95b5882066e462dfcd552858babec6e 100644
+index e7dae0313523382624ffbb7c4cd33e80cfc315ef..fa7aac386b04973681dbc556841b01c4b19e100d 100644
 --- a/BUILD.gn
 +++ b/BUILD.gn
 @@ -284,6 +284,10 @@ config("internal_config") {

+ 1 - 1
patches/v8/export_symbols_needed_for_windows_build.patch

@@ -19,7 +19,7 @@ index b4e78a19377df73051c2e6e650d5b654ca435c6b..93de4136f2a0498038d17866f99f72ea
    explicit inline Relocatable(Isolate* isolate);
    inline virtual ~Relocatable();
 diff --git a/src/objects/ordered-hash-table.h b/src/objects/ordered-hash-table.h
-index 66dc36e81fce469d8cf07abe70f827737a9b61e4..d1838ce6df18b99a8476b7b4fc705e786e031fdf 100644
+index 21decaeba72246ef95be0f031c605c7f840715b1..d661a11cf48f51eb6080cc086a7a26b4bd497cae 100644
 --- a/src/objects/ordered-hash-table.h
 +++ b/src/objects/ordered-hash-table.h
 @@ -60,7 +60,7 @@ namespace internal {

+ 2 - 2
patches/v8/expose_mksnapshot.patch

@@ -6,10 +6,10 @@ Subject: expose_mksnapshot.patch
 Needed in order to target mksnapshot for mksnapshot zip.
 
 diff --git a/BUILD.gn b/BUILD.gn
-index 4b852fdb298f47ee3bce814c243a6cd4671cdb81..5abaa35c6d9de73e69c26e298335446b9e6f3ef6 100644
+index 92c15b34b9a593ac3c1db1d543168622b92c1c02..e7dae0313523382624ffbb7c4cd33e80cfc315ef 100644
 --- a/BUILD.gn
 +++ b/BUILD.gn
-@@ -3837,7 +3837,6 @@ if (current_toolchain == v8_generator_toolchain) {
+@@ -3842,7 +3842,6 @@ if (current_toolchain == v8_generator_toolchain) {
  
  if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
    v8_executable("mksnapshot") {

+ 2 - 2
patches/v8/fix_bug_in_receiver_maps_inference.patch

@@ -6,10 +6,10 @@ Subject: Fix bug in receiver maps inference
 Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2062404
 
 diff --git a/src/compiler/node-properties.cc b/src/compiler/node-properties.cc
-index f43a348bb2d5b803270e42f64a3c790c52a3581b..ab4ced69ab60d6078aeb27c3d8b97e87400687ce 100644
+index 7ba3a59f6f98d596ac64c39846ad5f5a3df8f662..3108b5578408f7502f9a1d9924fb63533dec2d3c 100644
 --- a/src/compiler/node-properties.cc
 +++ b/src/compiler/node-properties.cc
-@@ -386,6 +386,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMapsUnsafe(
+@@ -448,6 +448,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMapsUnsafe(
            // We reached the allocation of the {receiver}.
            return kNoReceiverMaps;
          }

+ 1 - 1
patches/v8/include_string_in_v8_h.patch

@@ -16,7 +16,7 @@ Commit-Queue: Adam Klein <[email protected]>
 Cr-Commit-Position: refs/heads/master@{#64074}
 
 diff --git a/include/v8.h b/include/v8.h
-index f0c47907292b9da438347276ac240541577899ad..a8010f4dadef1636697d08888a4c5e2da68f884a 100644
+index f5b6caaee19b7abb0ee4d98615988d1d8b14035c..36017a0a974ed6afd10c9df932e10812ed1e9769 100644
 --- a/include/v8.h
 +++ b/include/v8.h
 @@ -19,6 +19,7 @@

+ 1 - 1
patches/v8/objects_fix_memory_leak_in_prototypeusers_add.patch

@@ -1,7 +1,7 @@
 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Dominik=20Inf=C3=BChr?= <[email protected]>
 Date: Fri, 13 Dec 2019 14:13:21 +0100
-Subject: [objects] Fix memory leak in PrototypeUsers::Add
+Subject: Fix memory leak in PrototypeUsers::Add
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit

+ 31 - 0
script/export_all_patches.py

@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import argparse
+import json
+import os
+import sys
+
+from lib import git
+
+
+def export_patches(dirs):
+  for patch_dir, repo in dirs.iteritems():
+    git.export_patches(repo=repo, out_dir=patch_dir)
+
+
+def parse_args():
+  parser = argparse.ArgumentParser(description='Export Electron patches')
+  parser.add_argument('config', nargs='+',
+                      type=argparse.FileType('r'),
+                      help='patches\' config(s) in the JSON format')
+  return parser.parse_args()
+
+
+def main():
+  configs = parse_args().config
+  for config_json in configs:
+    export_patches(json.load(config_json))
+
+
+if __name__ == '__main__':
+  main()

+ 2 - 135
script/git-export-patches

@@ -6,115 +6,7 @@ import re
 import subprocess
 import sys
 
-
-def guess_base_commit(repo):
-  """Guess which commit the patches might be based on"""
-  try:
-    args = [
-      'git',
-      '-C',
-      repo,
-      'rev-parse',
-      '--verify',
-      'refs/patches/upstream-head',
-    ]
-    upstream_head = subprocess.check_output(args).strip()
-    args = [
-      'git',
-      '-C',
-      repo,
-      'rev-list',
-      '--count',
-      upstream_head + '..',
-    ]
-    num_commits = subprocess.check_output(args).strip()
-    return [upstream_head, num_commits]
-  except subprocess.CalledProcessError:
-    args = [
-      'git',
-      '-C',
-      repo,
-      'describe',
-      '--tags',
-    ]
-    return subprocess.check_output(args).rsplit('-', 2)[0:2]
-
-
-def format_patch(repo, since):
-  args = [
-    'git',
-    '-C',
-    repo,
-    '-c',
-    'core.attributesfile=' + os.path.join(os.path.dirname(os.path.realpath(__file__)), '.electron.attributes'),
-    # Ensure it is not possible to match anything
-    # Disabled for now as we have consistent chunk headers
-    # '-c',
-    # 'diff.electron.xfuncname=$^',
-    'format-patch',
-    '--keep-subject',
-    '--no-stat',
-    '--stdout',
-
-    # Per RFC 3676 the signature is separated from the body by a line with
-    # '-- ' on it. If the signature option is omitted the signature defaults
-    # to the Git version number.
-    '--no-signature',
-
-    # The name of the parent commit object isn't useful information in this
-    # context, so zero it out to avoid needless patch-file churn.
-    '--zero-commit',
-
-    # Some versions of git print out different numbers of characters in the
-    # 'index' line of patches, so pass --full-index to get consistent
-    # behaviour.
-    '--full-index',
-    since
-  ]
-  return subprocess.check_output(args)
-
-
-def split_patches(patch_data):
-  """Split a concatenated series of patches into N separate patches"""
-  patches = []
-  patch_start = re.compile('^From [0-9a-f]+ ')
-  for line in patch_data.splitlines():
-    if patch_start.match(line):
-      patches.append([])
-    patches[-1].append(line)
-  return patches
-
-
-def munge_subject_to_filename(subject):
-  """Derive a suitable filename from a commit's subject"""
-  if subject.endswith('.patch'):
-    subject = subject[:-6]
-  return re.sub(r'[^A-Za-z0-9-]+', '_', subject).strip('_').lower() + '.patch'
-
-
-def get_file_name(patch):
-  """Return the name of the file to which the patch should be written"""
-  for line in patch:
-    if line.startswith('Patch-Filename: '):
-      return line[len('Patch-Filename: '):]
-  # If no patch-filename header, munge the subject.
-  for line in patch:
-    if line.startswith('Subject: '):
-      return munge_subject_to_filename(line[len('Subject: '):])
-
-
-def remove_patch_filename(patch):
-  """Strip out the Patch-Filename trailer from a patch's message body"""
-  force_keep_next_line = False
-  for i, l in enumerate(patch):
-    is_patchfilename = l.startswith('Patch-Filename: ')
-    next_is_patchfilename = i < len(patch) - 1 and patch[i+1].startswith('Patch-Filename: ')
-    if not force_keep_next_line and (is_patchfilename or (next_is_patchfilename and len(l.rstrip()) == 0)):
-      pass # drop this line
-    else:
-      yield l
-    force_keep_next_line = l.startswith('Subject: ')
-
+from lib import git
 
 def main(argv):
   parser = argparse.ArgumentParser()
@@ -127,32 +19,7 @@ def main(argv):
            "most recent tag or remote branch.")
   args = parser.parse_args(argv)
 
-  repo = '.'
-  patch_range = args.patch_range
-  if patch_range is None:
-    patch_range, num_patches = guess_base_commit(repo)
-    sys.stderr.write("Exporting {} patches since {}\n".format(num_patches, patch_range))
-  patch_data = format_patch(repo, patch_range)
-  patches = split_patches(patch_data)
-
-  out_dir = args.output
-  try:
-    os.mkdir(out_dir)
-  except OSError:
-    pass
-
-  # remove old patches, so that deleted commits are correctly reflected in the
-  # patch files (as a removed file)
-  for p in os.listdir(out_dir):
-    if p.endswith('.patch'):
-      os.remove(os.path.join(out_dir, p))
-
-  with open(os.path.join(out_dir, '.patches'), 'w') as pl:
-    for patch in patches:
-      filename = get_file_name(patch)
-      with open(os.path.join(out_dir, filename), 'w') as f:
-        f.write('\n'.join(remove_patch_filename(patch)).rstrip('\n') + '\n')
-      pl.write(filename + '\n')
+  git.export_patches('.', args.output, patch_range=args.patch_range)
 
 
 if __name__ == '__main__':

+ 143 - 1
script/lib/git.py

@@ -7,7 +7,9 @@ structure, or make assumptions about the passed arguments or calls' outcomes.
 """
 
 import os
+import re
 import subprocess
+import sys
 
 
 def is_repo_root(path):
@@ -126,7 +128,7 @@ def reset(repo):
 
 
 def commit(repo, author, message):
-  """ Commit whatever in the index is now."""
+  """Commit whatever in the index is now."""
 
   # Let's setup committer info so git won't complain about it being missing.
   # TODO: Is there a better way to set committer's name and email?
@@ -142,3 +144,143 @@ def commit(repo, author, message):
   return_code = subprocess.call(args, env=env)
   committed_successfully = (return_code == 0)
   return committed_successfully
+
+def get_upstream_head(repo):
+  args = [
+    'git',
+    '-C',
+    repo,
+    'rev-parse',
+    '--verify',
+    'refs/patches/upstream-head',
+  ]
+  return subprocess.check_output(args).strip()
+
+def get_commit_count(repo, commit_range):
+  args = [
+    'git',
+    '-C',
+    repo,
+    'rev-list',
+    '--count',
+    commit_range
+  ]
+  return int(subprocess.check_output(args).strip())
+
+def guess_base_commit(repo):
+  """Guess which commit the patches might be based on"""
+  try:
+    upstream_head = get_upstream_head(repo)
+    num_commits = get_commit_count(repo, upstream_head + '..')
+    return [upstream_head, num_commits]
+  except subprocess.CalledProcessError:
+    args = [
+      'git',
+      '-C',
+      repo,
+      'describe',
+      '--tags',
+    ]
+    return subprocess.check_output(args).rsplit('-', 2)[0:2]
+
+
+def format_patch(repo, since):
+  args = [
+    'git',
+    '-C',
+    repo,
+    '-c',
+    'core.attributesfile=' + os.path.join(os.path.dirname(os.path.realpath(__file__)), '.electron.attributes'),
+    # Ensure it is not possible to match anything
+    # Disabled for now as we have consistent chunk headers
+    # '-c',
+    # 'diff.electron.xfuncname=$^',
+    'format-patch',
+    '--keep-subject',
+    '--no-stat',
+    '--stdout',
+
+    # Per RFC 3676 the signature is separated from the body by a line with
+    # '-- ' on it. If the signature option is omitted the signature defaults
+    # to the Git version number.
+    '--no-signature',
+
+    # The name of the parent commit object isn't useful information in this
+    # context, so zero it out to avoid needless patch-file churn.
+    '--zero-commit',
+
+    # Some versions of git print out different numbers of characters in the
+    # 'index' line of patches, so pass --full-index to get consistent
+    # behaviour.
+    '--full-index',
+    since
+  ]
+  return subprocess.check_output(args)
+
+
+def split_patches(patch_data):
+  """Split a concatenated series of patches into N separate patches"""
+  patches = []
+  patch_start = re.compile('^From [0-9a-f]+ ')
+  for line in patch_data.splitlines():
+    if patch_start.match(line):
+      patches.append([])
+    patches[-1].append(line)
+  return patches
+
+
+def munge_subject_to_filename(subject):
+  """Derive a suitable filename from a commit's subject"""
+  if subject.endswith('.patch'):
+    subject = subject[:-6]
+  return re.sub(r'[^A-Za-z0-9-]+', '_', subject).strip('_').lower() + '.patch'
+
+
+def get_file_name(patch):
+  """Return the name of the file to which the patch should be written"""
+  for line in patch:
+    if line.startswith('Patch-Filename: '):
+      return line[len('Patch-Filename: '):]
+  # If no patch-filename header, munge the subject.
+  for line in patch:
+    if line.startswith('Subject: '):
+      return munge_subject_to_filename(line[len('Subject: '):])
+
+
+def remove_patch_filename(patch):
+  """Strip out the Patch-Filename trailer from a patch's message body"""
+  force_keep_next_line = False
+  for i, l in enumerate(patch):
+    is_patchfilename = l.startswith('Patch-Filename: ')
+    next_is_patchfilename = i < len(patch) - 1 and patch[i+1].startswith('Patch-Filename: ')
+    if not force_keep_next_line and (is_patchfilename or (next_is_patchfilename and len(l.rstrip()) == 0)):
+      pass # drop this line
+    else:
+      yield l
+    force_keep_next_line = l.startswith('Subject: ')
+
+
+def export_patches(repo, out_dir, patch_range=None):
+  if patch_range is None:
+    patch_range, num_patches = guess_base_commit(repo)
+    sys.stderr.write("Exporting {} patches since {}\n".format(num_patches, patch_range))
+  patch_data = format_patch(repo, patch_range)
+  patches = split_patches(patch_data)
+
+  try:
+    os.mkdir(out_dir)
+  except OSError:
+    pass
+
+  # remove old patches, so that deleted commits are correctly reflected in the
+  # patch files (as a removed file)
+  for p in os.listdir(out_dir):
+    if p.endswith('.patch'):
+      os.remove(os.path.join(out_dir, p))
+
+  with open(os.path.join(out_dir, '.patches'), 'w') as pl:
+    for patch in patches:
+      filename = get_file_name(patch)
+      with open(os.path.join(out_dir, filename), 'w') as f:
+        f.write('\n'.join(remove_patch_filename(patch)).rstrip('\n') + '\n')
+      pl.write(filename + '\n')