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

Unified Diff: runtime/vm/assembler_dbc_test.cc

Issue 2113523002: DBC: Implement TestSmi instruction. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: . Created 4 years, 6 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 | runtime/vm/constants_dbc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_dbc_test.cc
diff --git a/runtime/vm/assembler_dbc_test.cc b/runtime/vm/assembler_dbc_test.cc
index 74841e3eb90998b8655a837b926d31d1fd6cf7eb..180437ef89f1aaa57e84f812911c7c44cb6eda3a 100644
--- a/runtime/vm/assembler_dbc_test.cc
+++ b/runtime/vm/assembler_dbc_test.cc
@@ -1606,6 +1606,50 @@ ASSEMBLER_TEST_RUN(CreateArrayTOS, test) {
}
+// - TestSmi rA, rD
+//
+// If FP[rA] & FP[rD] != 0, then skip the next instruction. FP[rA] and FP[rD]
+// must be Smis.
+ASSEMBLER_TEST_GENERATE(TestSmiTrue, assembler) {
+ Label branch_taken;
+ __ Frame(2);
+ __ LoadConstant(0, Smi::Handle(Smi::New(7)));
+ __ LoadConstant(1, Smi::Handle(Smi::New(3)));
+ __ TestSmi(0, 1);
+ __ Jump(&branch_taken);
+ __ PushConstant(Bool::True());
+ __ ReturnTOS();
+ __ Bind(&branch_taken);
+ __ PushConstant(Bool::False());
+ __ ReturnTOS();
+}
+
+
+ASSEMBLER_TEST_RUN(TestSmiTrue, test) {
+ EXPECT(EXECUTE_TEST_CODE_BOOL(test->code()));
+}
+
+
+ASSEMBLER_TEST_GENERATE(TestSmiFalse, assembler) {
+ Label branch_taken;
+ __ Frame(2);
+ __ LoadConstant(0, Smi::Handle(Smi::New(8)));
+ __ LoadConstant(1, Smi::Handle(Smi::New(4)));
+ __ TestSmi(0, 1);
+ __ Jump(&branch_taken);
+ __ PushConstant(Bool::True());
+ __ ReturnTOS();
+ __ Bind(&branch_taken);
+ __ PushConstant(Bool::False());
+ __ ReturnTOS();
+}
+
+
+ASSEMBLER_TEST_RUN(TestSmiFalse, test) {
+ EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code()));
+}
+
+
// - CheckSmi rA
//
// If FP[rA] is a Smi, then skip the next instruction.
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698