Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: test/cctest/test-code-stubs.cc

Issue 2157373002: Fix cctest/test-code-stubs-mips64/ConvertDToI failure on big-endian architectures (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-code-stubs.cc
diff --git a/test/cctest/test-code-stubs.cc b/test/cctest/test-code-stubs.cc
index c8c48ecc657820dd8e1b3207f90736053dcf3391..273f57ef0e3f0ad4607dbcc26a45f3da4941a0b8 100644
--- a/test/cctest/test-code-stubs.cc
+++ b/test/cctest/test-code-stubs.cc
@@ -42,9 +42,18 @@ using namespace v8::internal;
int STDCALL ConvertDToICVersion(double d) {
+#if defined(V8_TARGET_BIG_ENDIAN)
+ const int kExponentIndex = 0;
+ const int kMantissaIndex = 1;
+#elif defined(V8_TARGET_LITTLE_ENDIAN)
+ const int kExponentIndex = 1;
+ const int kMantissaIndex = 0;
+#else
+#error Unsupported endianness
+#endif
union { double d; uint32_t u[2]; } dbl;
dbl.d = d;
- uint32_t exponent_bits = dbl.u[1];
+ uint32_t exponent_bits = dbl.u[kExponentIndex];
int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32);
int32_t exponent = (((exponent_bits & shifted_mask) >>
(Double::kPhysicalSignificandSize - 32)) -
@@ -58,7 +67,8 @@ int STDCALL ConvertDToICVersion(double d) {
static_cast<uint32_t>(Double::kPhysicalSignificandSize);
if (unsigned_exponent >= max_exponent) {
if ((exponent - Double::kPhysicalSignificandSize) < 32) {
- result = dbl.u[0] << (exponent - Double::kPhysicalSignificandSize);
+ result = dbl.u[kMantissaIndex]
+ << (exponent - Double::kPhysicalSignificandSize);
}
} else {
uint64_t big_result =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698