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: #28955
PR-URL: #28016
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Refael Ackermann (רפאל פלחי) <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
  • Loading branch information
refack authored and targos committed Aug 16, 2019
1 parent b04f9e1 commit 040e7da
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 @@ -569,7 +569,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::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 040e7da

Please sign in to comment.