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

Unified Diff: test/cctest/compiler/codegen-tester.cc

Issue 1423133005: Implemented the BufferedRawMachineAssemblerTester. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed the test case parameter values. Created 5 years, 2 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/compiler/codegen-tester.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/codegen-tester.cc
diff --git a/test/cctest/compiler/codegen-tester.cc b/test/cctest/compiler/codegen-tester.cc
index 51f3f248c4d03b712094e44c033dacd207a023cd..ba73822d32a455de16162a1af7db404ad28dccd5 100644
--- a/test/cctest/compiler/codegen-tester.cc
+++ b/test/cctest/compiler/codegen-tester.cc
@@ -570,6 +570,145 @@ TEST(RunBinopTester) {
}
}
+
+#if V8_TARGET_ARCH_64_BIT
+// TODO(ahaas): run int64 tests on all platforms when supported.
+TEST(RunBufferedRawMachineAssemblerTesterTester) {
+ {
+ BufferedRawMachineAssemblerTester<int64_t> m;
+ m.Return(m.Int64Constant(0x12500000000));
+ CHECK_EQ(0x12500000000, m.Call());
+ }
+ {
+ BufferedRawMachineAssemblerTester<double> m(kMachFloat64);
+ m.Return(m.Parameter(0));
+ FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, m.Call(*i)); }
+ }
+ {
+ BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64);
+ m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1)));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(*i + *j, m.Call(*i, *j));
+ CHECK_EQ(*j + *i, m.Call(*j, *i));
+ }
+ }
+ }
+ {
+ BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64,
+ kMachInt64);
+ m.Return(
+ m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(*i + *i + *j, m.Call(*i, *i, *j));
+ CHECK_EQ(*i + *j + *i, m.Call(*i, *j, *i));
+ CHECK_EQ(*j + *i + *i, m.Call(*j, *i, *i));
+ }
+ }
+ }
+ {
+ BufferedRawMachineAssemblerTester<int64_t> m(kMachInt64, kMachInt64,
+ kMachInt64, kMachInt64);
+ m.Return(m.Int64Add(
+ m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)),
+ m.Parameter(3)));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(*i + *i + *i + *j, m.Call(*i, *i, *i, *j));
+ CHECK_EQ(*i + *i + *j + *i, m.Call(*i, *i, *j, *i));
+ CHECK_EQ(*i + *j + *i + *i, m.Call(*i, *j, *i, *i));
+ CHECK_EQ(*j + *i + *i + *i, m.Call(*j, *i, *i, *i));
+ }
+ }
+ }
+ {
+ BufferedRawMachineAssemblerTester<void> m;
+ int64_t result;
+ m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
+ m.Int64Constant(0x12500000000), kNoWriteBarrier);
+ m.Return(m.Int32Constant(0));
+ m.Call();
+ CHECK_EQ(0x12500000000, result);
+ }
+ {
+ BufferedRawMachineAssemblerTester<void> m(kMachFloat64);
+ double result;
+ m.Store(MachineTypeForC<double>(), m.PointerConstant(&result),
+ m.Parameter(0), kNoWriteBarrier);
+ m.Return(m.Int32Constant(0));
+ FOR_FLOAT64_INPUTS(i) {
+ m.Call(*i);
+ CheckDoubleEq(*i, result);
+ }
+ }
+ {
+ BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64);
+ int64_t result;
+ m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
+ m.Int64Add(m.Parameter(0), m.Parameter(1)), kNoWriteBarrier);
+ m.Return(m.Int32Constant(0));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ m.Call(*i, *j);
+ CHECK_EQ(*i + *j, result);
+
+ m.Call(*j, *i);
+ CHECK_EQ(*j + *i, result);
+ }
+ }
+ }
+ {
+ BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64,
+ kMachInt64);
+ int64_t result;
+ m.Store(
+ MachineTypeForC<int64_t>(), m.PointerConstant(&result),
+ m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)),
+ kNoWriteBarrier);
+ m.Return(m.Int32Constant(0));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ m.Call(*i, *i, *j);
+ CHECK_EQ(*i + *i + *j, result);
+
+ m.Call(*i, *j, *i);
+ CHECK_EQ(*i + *j + *i, result);
+
+ m.Call(*j, *i, *i);
+ CHECK_EQ(*j + *i + *i, result);
+ }
+ }
+ }
+ {
+ BufferedRawMachineAssemblerTester<void> m(kMachInt64, kMachInt64,
+ kMachInt64, kMachInt64);
+ int64_t result;
+ m.Store(MachineTypeForC<int64_t>(), m.PointerConstant(&result),
+ m.Int64Add(m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)),
+ m.Parameter(2)),
+ m.Parameter(3)),
+ kNoWriteBarrier);
+ m.Return(m.Int32Constant(0));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ m.Call(*i, *i, *i, *j);
+ CHECK_EQ(*i + *i + *i + *j, result);
+
+ m.Call(*i, *i, *j, *i);
+ CHECK_EQ(*i + *i + *j + *i, result);
+
+ m.Call(*i, *j, *i, *i);
+ CHECK_EQ(*i + *j + *i + *i, result);
+
+ m.Call(*j, *i, *i, *i);
+ CHECK_EQ(*j + *i + *i + *i, result);
+ }
+ }
+ }
+}
+
+#endif
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « test/cctest/compiler/codegen-tester.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698