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

Unified Diff: runtime/vm/assembler_mips_test.cc

Issue 735543003: Range feedback for binary integer operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 6 years 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 | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_mips_test.cc
diff --git a/runtime/vm/assembler_mips_test.cc b/runtime/vm/assembler_mips_test.cc
index 399b1bb31478d6a673c0476991ec7ffdf90ad2ef..2ef09b2f74e120bffe933a5714ca4a9aaf8985fd 100644
--- a/runtime/vm/assembler_mips_test.cc
+++ b/runtime/vm/assembler_mips_test.cc
@@ -2066,6 +2066,58 @@ ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) {
__ Ret();
}
+
+ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) {
+ Label miss, done;
+ __ ComputeRange(V0, A0, &miss);
+ __ b(&done);
+
+ __ Bind(&miss);
+ __ LoadImmediate(V0, -1);
+
+ __ Bind(&done);
+ __ Ret();
+}
+
+
+ASSEMBLER_TEST_RUN(ComputeRange, test) {
+ typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED;
+
+#define RANGE_OF(v) \
+ (EXECUTE_TEST_CODE_INTPTR_INTPTR( \
+ ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v)))
+
+ EXPECT_EQ(0, RANGE_OF(Smi::New(0)));
+ EXPECT_EQ(0, RANGE_OF(Smi::New(1)));
+ EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(-1)));
+ EXPECT_EQ(0, RANGE_OF(Smi::New(Smi::kMaxValue)));
+ EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(Smi::kMinValue)));
+
+ EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(Smi::kMaxValue + 1)));
+ EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit,
+ RANGE_OF(Integer::New(Smi::kMinValue - 1)));
+ EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(kMaxInt32)));
+ EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit,
+ RANGE_OF(Integer::New(kMinInt32)));
+
+ EXPECT_EQ(ICData::kUint32RangeBit,
+ RANGE_OF(Integer::New(static_cast<int64_t>(kMaxInt32) + 1)));
+ EXPECT_EQ(ICData::kUint32RangeBit,
+ RANGE_OF(Integer::New(kMaxUint32)));
+
+ EXPECT_EQ(ICData::kInt64RangeBit,
+ RANGE_OF(Integer::New(static_cast<int64_t>(kMaxUint32) + 1)));
+ EXPECT_EQ(ICData::kInt64RangeBit,
+ RANGE_OF(Integer::New(static_cast<int64_t>(kMinInt32) - 1)));
+ EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMaxInt64)));
+ EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64)));
+
+ EXPECT_EQ(-1, RANGE_OF(Bool::True().raw()));
+
+#undef RANGE_OF
+}
+
+
} // namespace dart
#endif // defined TARGET_ARCH_MIPS
« no previous file with comments | « runtime/vm/assembler_mips.cc ('k') | runtime/vm/assembler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698