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: #30109
PR-URL: #28016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
  • Loading branch information
refack authored and BethGriggs committed Feb 6, 2020
1 parent a91ed2e commit fdad5b6
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
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,11 @@ void PlatformEmbeddedFileWriterWin::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::AbsolutePath(pos.source);
std::string file = SourceFileMap::AbsolutePath(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 fdad5b6

Please sign in to comment.