Skip to content

Commit 64d5be2

Browse files
committed
deps: V8: cherry-pick 1648e050cade
Original commit message: torque: workaround stod() limitations on Solaris std::stod() on Solaris does not currently handle hex strings. This commit provides a workaround based on strtol() until proper stod() support is available. This was encountered while updating Node.js to V8 8.8. For more details see the following comment: #36139 (comment) Change-Id: I16ed80a817f6d9105e7153b10824b1fee8520432 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2692746 Reviewed-by: Michael Stanton <[email protected]> Commit-Queue: Michael Stanton <[email protected]> Cr-Commit-Position: refs/heads/master@{#73255} Refs: v8/v8@1648e05 PR-URL: #37587 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent 621b544 commit 64d5be2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
# Reset this number to 0 on major V8 upgrades.
3838
# Increment by one for each non-official patch applied to deps/v8.
39-
'v8_embedder_string': '-node.6',
39+
'v8_embedder_string': '-node.7',
4040

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/torque/torque-parser.cc

+11
Original file line numberDiff line numberDiff line change
@@ -1834,7 +1834,18 @@ base::Optional<ParseResult> MakeNumberLiteralExpression(
18341834
// Meanwhile, we type it as constexpr float64 when out of int32 range.
18351835
double value = 0;
18361836
try {
1837+
#if defined(V8_OS_SOLARIS)
1838+
// stod() on Solaris does not currently support hex strings. Use strtol()
1839+
// specifically for hex literals until stod() support is available.
1840+
if (number.find("0x") == std::string::npos &&
1841+
number.find("0X") == std::string::npos) {
1842+
value = std::stod(number);
1843+
} else {
1844+
value = static_cast<double>(strtol(number.c_str(), nullptr, 0));
1845+
}
1846+
#else
18371847
value = std::stod(number);
1848+
#endif // !defined(V8_OS_SOLARIS)
18381849
} catch (const std::out_of_range&) {
18391850
Error("double literal out-of-range").Throw();
18401851
}

0 commit comments

Comments
 (0)