Skip to content

Commit a470d4d

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: nodejs#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}
1 parent 4947ce5 commit a470d4d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -1836,14 +1836,15 @@ base::Optional<ParseResult> MakeNumberLiteralExpression(
18361836
#if defined(V8_OS_SOLARIS)
18371837
// stod() on Solaris does not currently support hex strings. Use strtol()
18381838
// specifically for hex literals until stod() support is available.
1839-
if (number.find("0x") || number.find("0X")) {
1840-
value = static_cast<double>(strtol(number.c_str(), nullptr, 0));
1841-
} else {
1839+
if (number.find("0x") == std::string::npos &&
1840+
number.find("0X") == std::string::npos) {
18421841
value = std::stod(number);
1842+
} else {
1843+
value = static_cast<double>(strtol(number.c_str(), nullptr, 0));
18431844
}
18441845
#else
18451846
value = std::stod(number);
1846-
#endif // !defined(V8_OS_SOLARIS)
1847+
#endif // !defined(V8_OS_SOLARIS)
18471848
} catch (const std::out_of_range&) {
18481849
Error("double literal out-of-range").Throw();
18491850
}

0 commit comments

Comments
 (0)