Skip to content

Commit b2fd003

Browse files
cjihrigdanielleadams
authored andcommitted
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 <mvstanton@chromium.org> Commit-Queue: Michael Stanton <mvstanton@chromium.org> Cr-Commit-Position: refs/heads/master@{#73255} Refs: v8/v8@1648e05 PR-URL: #37664 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 922f2f0 commit b2fd003

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

+11
Original file line numberDiff line numberDiff line change
@@ -1799,7 +1799,18 @@ base::Optional<ParseResult> MakeNumberLiteralExpression(
17991799
// Meanwhile, we type it as constexpr float64 when out of int32 range.
18001800
double value = 0;
18011801
try {
1802+
#if defined(V8_OS_SOLARIS)
1803+
// stod() on Solaris does not currently support hex strings. Use strtol()
1804+
// specifically for hex literals until stod() support is available.
1805+
if (number.find("0x") == std::string::npos &&
1806+
number.find("0X") == std::string::npos) {
1807+
value = std::stod(number);
1808+
} else {
1809+
value = static_cast<double>(strtol(number.c_str(), nullptr, 0));
1810+
}
1811+
#else
18021812
value = std::stod(number);
1813+
#endif // !defined(V8_OS_SOLARIS)
18031814
} catch (const std::out_of_range&) {
18041815
Error("double literal out-of-range").Throw();
18051816
}

0 commit comments

Comments
 (0)