Skip to content

Commit

Permalink
deps: V8: cherry-pick 373f4ae739ee
Browse files Browse the repository at this point in the history
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 <[email protected]>
    Commit-Queue: Seth Brenith <[email protected]>
    Cr-Commit-Position: refs/heads/master@{#72053}

Refs: v8/v8@373f4ae

PR-URL: #37505
Fixes: #37368
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
  • Loading branch information
richardlau authored and targos committed Feb 28, 2021
1 parent f2aa305 commit 80d3c11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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.26',
'v8_embedder_string': '-node.27',

##### V8 defaults for Node.js #####

Expand Down
4 changes: 3 additions & 1 deletion deps/v8/src/torque/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<char> eos;
old_contents =
std::string(std::istreambuf_iterator<char>(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;
Expand Down

0 comments on commit 80d3c11

Please sign in to comment.