From 448de26d7b19562d548aef6af03e82459c386947 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 24 Feb 2021 18:50:11 +0000 Subject: [PATCH] deps: V8: cherry-pick 373f4ae739ee MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message: [torque] Don't replace unmodified empty files To improve incremental builds. Bug: v8:7793 Change-Id: I6990a97e058d22d34acd1f609167cd30ca7518ad Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2596789 Reviewed-by: Nico Hartmann Commit-Queue: Seth Brenith Cr-Commit-Position: refs/heads/master@{#72053} Refs: https://github.com/v8/v8/commit/373f4ae739eeae0e4d2224b15002be35f1470312 PR-URL: https://github.com/nodejs/node/pull/37505 Fixes: https://github.com/nodejs/node/issues/37368 Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott Reviewed-By: Michaƫl Zasso Reviewed-By: Jiawen Geng --- common.gypi | 2 +- deps/v8/src/torque/utils.cc | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common.gypi b/common.gypi index 2a82642e350028..d81bac25e30fb6 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,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.15', + 'v8_embedder_string': '-node.16', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/torque/utils.cc b/deps/v8/src/torque/utils.cc index 312adcfb24a34b..6118341e1e0d41 100644 --- a/deps/v8/src/torque/utils.cc +++ b/deps/v8/src/torque/utils.cc @@ -317,13 +317,15 @@ void ReplaceFileContentsIfDifferent(const std::string& file_path, const std::string& contents) { std::ifstream old_contents_stream(file_path.c_str()); std::string old_contents; + bool file_exists = false; if (old_contents_stream.good()) { + file_exists = true; std::istreambuf_iterator eos; old_contents = std::string(std::istreambuf_iterator(old_contents_stream), eos); old_contents_stream.close(); } - if (old_contents.length() == 0 || old_contents != contents) { + if (!file_exists || old_contents != contents) { std::ofstream new_contents_stream; new_contents_stream.open(file_path.c_str()); new_contents_stream << contents;