Index: runtime/vm/assembler_dbc_test.cc |
diff --git a/runtime/vm/assembler_dbc_test.cc b/runtime/vm/assembler_dbc_test.cc |
index 3d5b7514249bef94e77a36f5181e68c69cebebd4..0542ae697d50bcfdbd9ffdc1ebbf927344455535 100644 |
--- a/runtime/vm/assembler_dbc_test.cc |
+++ b/runtime/vm/assembler_dbc_test.cc |
@@ -1132,6 +1132,39 @@ ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { |
EXPECT_EQ(10, array.Length()); |
} |
+ |
+// - CheckSmi rA |
+// |
+// If FP[rA] is a Smi, then skip the next instruction. |
+ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { |
+ __ Frame(1); |
+ __ PushConstant(Smi::Handle(Smi::New(42))); |
+ __ LoadConstant(0, Smi::Handle(Smi::New(0))); |
+ __ CheckSmi(0); |
+ __ PushConstant(Smi::Handle(Smi::New(-1))); |
+ __ ReturnTOS(); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(CheckSmiPass, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
+ |
+ASSEMBLER_TEST_GENERATE(CheckSmiFail, assembler) { |
+ __ Frame(1); |
+ __ PushConstant(Smi::Handle(Smi::New(-1))); |
+ __ LoadConstant(0, Bool::True()); |
+ __ CheckSmi(0); |
+ __ PushConstant(Smi::Handle(Smi::New(42))); |
+ __ ReturnTOS(); |
+} |
+ |
+ |
+ASSEMBLER_TEST_RUN(CheckSmiFail, test) { |
+ EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
+} |
+ |
} // namespace dart |
#endif // defined(TARGET_ARCH_DBC) |