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

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

Issue 151163005: A64: Synchronize with r16356. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 | « test/cctest/test-code-stubs.h ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | 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 405069626bec4d076173f9a1441b62b3554e0498..db00e9ac5a9f6980825c4a619e2de5b6614f2e6c 100644
--- a/test/cctest/test-code-stubs.cc
+++ b/test/cctest/test-code-stubs.cc
@@ -42,8 +42,9 @@ using namespace v8::internal;
int STDCALL ConvertDToICVersion(double d) {
- Address double_ptr = reinterpret_cast<Address>(&d);
- uint32_t exponent_bits = Memory::uint32_at(double_ptr + kDoubleSize / 2);
+ union { double d; uint32_t u[2]; } dbl;
+ dbl.d = d;
+ uint32_t exponent_bits = dbl.u[1];
int32_t shifted_mask = static_cast<int32_t>(Double::kExponentMask >> 32);
int32_t exponent = (((exponent_bits & shifted_mask) >>
(Double::kPhysicalSignificandSize - 32)) -
@@ -54,8 +55,7 @@ int STDCALL ConvertDToICVersion(double d) {
static_cast<uint32_t>(Double::kPhysicalSignificandSize);
if (unsigned_exponent >= max_exponent) {
if ((exponent - Double::kPhysicalSignificandSize) < 32) {
- result = Memory::uint32_at(double_ptr) <<
- (exponent - Double::kPhysicalSignificandSize);
+ result = dbl.u[0] << (exponent - Double::kPhysicalSignificandSize);
}
} else {
uint64_t big_result =
@@ -71,22 +71,37 @@ int STDCALL ConvertDToICVersion(double d) {
}
-void RunOneTruncationTestWithTest(ConvertDToIFunc func,
+void RunOneTruncationTestWithTest(ConvertDToICallWrapper callWrapper,
+ ConvertDToIFunc func,
double from,
double raw) {
uint64_t to = static_cast<int64_t>(raw);
- int result = (*func)(from);
+ int result = (*callWrapper)(func, from);
CHECK_EQ(static_cast<int>(to), result);
}
+int32_t DefaultCallWrapper(ConvertDToIFunc func,
+ double from) {
+ return (*func)(from);
+}
+
+
// #define NaN and Infinity so that it's possible to cut-and-paste these tests
// directly to a .js file and run them.
#define NaN (OS::nan_value())
#define Infinity (std::numeric_limits<double>::infinity())
-#define RunOneTruncationTest(p1, p2) RunOneTruncationTestWithTest(func, p1, p2)
+#define RunOneTruncationTest(p1, p2) \
+ RunOneTruncationTestWithTest(callWrapper, func, p1, p2)
+
void RunAllTruncationTests(ConvertDToIFunc func) {
+ RunAllTruncationTests(DefaultCallWrapper, func);
+}
+
+
+void RunAllTruncationTests(ConvertDToICallWrapper callWrapper,
+ ConvertDToIFunc func) {
RunOneTruncationTest(0, 0);
RunOneTruncationTest(0.5, 0);
RunOneTruncationTest(-0.5, 0);
« no previous file with comments | « test/cctest/test-code-stubs.h ('k') | test/cctest/test-code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698