Skip to content

Commit fdad5b6

Browse files
refackBethGriggs
authored andcommitted
deps: V8: fix filename manipulation for Windows
Backport-PR-URL: #30109 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]>
1 parent a91ed2e commit fdad5b6

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.0',
41+
'v8_embedder_string': '-node.1',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/src/snapshot/embedded/platform-embedded-file-writer-win.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,11 @@ void PlatformEmbeddedFileWriterWin::DeclareExternalFilename(
669669
// Replace any Windows style paths (backslashes) with forward
670670
// slashes.
671671
std::string fixed_filename(filename);
672-
std::replace(fixed_filename.begin(), fixed_filename.end(), '\\', '/');
672+
for (auto& c : fixed_filename) {
673+
if (c == '\\') {
674+
c = '/';
675+
}
676+
}
673677
fprintf(fp_, ".file %d \"%s\"\n", fileid, fixed_filename.c_str());
674678
}
675679

deps/v8/src/torque/csa-generator.cc

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,14 @@ Stack<std::string> CSAGenerator::EmitBlock(const Block* block) {
5656
}
5757

5858
void CSAGenerator::EmitSourcePosition(SourcePosition pos, bool always_emit) {
59-
const std::string& file = SourceFileMap::AbsolutePath(pos.source);
59+
std::string file = SourceFileMap::AbsolutePath(pos.source);
6060
if (always_emit || !previous_position_.CompareStartIgnoreColumn(pos)) {
6161
// Lines in Torque SourcePositions are zero-based, while the
6262
// CodeStubAssembler and downwind systems are one-based.
63+
for (auto& c : file) {
64+
if (c == '\\')
65+
c = '/';
66+
}
6367
out_ << " ca_.SetSourcePosition(\"" << file << "\", "
6468
<< (pos.start.line + 1) << ");\n";
6569
previous_position_ = pos;

0 commit comments

Comments
 (0)