Skip to content

Commit

Permalink
deps: V8: fix filename manipulation for Windows
Browse files Browse the repository at this point in the history
Backport-PR-URL: #28005
PR-URL: #27375
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
refack authored and targos committed Jun 4, 2019
1 parent 018159d commit 4a61bdb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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.0',
'v8_embedder_string': '-node.1',

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

Expand Down
6 changes: 5 additions & 1 deletion deps/v8/src/snapshot/embedded-file-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,11 @@ void PlatformDependentEmbeddedFileWriter::DeclareExternalFilename(
// Replace any Windows style paths (backslashes) with forward
// slashes.
std::string fixed_filename(filename);
std::replace(fixed_filename.begin(), fixed_filename.end(), '\\', '/');
for (auto& c : fixed_filename) {
if (c == '\\') {
c = '/';
}
}
fprintf(fp_, ".file %d \"%s\"\n", fileid, fixed_filename.c_str());
}

Expand Down
6 changes: 5 additions & 1 deletion deps/v8/src/torque/csa-generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ Stack<std::string> CSAGenerator::EmitBlock(const Block* block) {
}

void CSAGenerator::EmitSourcePosition(SourcePosition pos, bool always_emit) {
const std::string& file = SourceFileMap::GetSource(pos.source);
std::string file = SourceFileMap::GetSource(pos.source);
if (always_emit || !previous_position_.CompareStartIgnoreColumn(pos)) {
// Lines in Torque SourcePositions are zero-based, while the
// CodeStubAssembler and downwind systems are one-based.
for (auto& c : file) {
if (c == '\\')
c = '/';
}
out_ << " ca_.SetSourcePosition(\"" << file << "\", "
<< (pos.start.line + 1) << ");\n";
previous_position_ = pos;
Expand Down

0 comments on commit 4a61bdb

Please sign in to comment.