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 <nicohartmann@chromium.org>
    Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
    Cr-Commit-Position: refs/heads/master@{#72053}

Refs: v8/v8@373f4ae
  • Loading branch information
richardlau committed Feb 24, 2021
1 parent 76a073b commit a029c74
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.22',
'v8_embedder_string': '-node.23',

##### 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 a029c74

Please sign in to comment.