OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 | 1125 |
1126 | 1126 |
1127 ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { | 1127 ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { |
1128 const Object& obj = EXECUTE_TEST_CODE_OBJECT(test->code()); | 1128 const Object& obj = EXECUTE_TEST_CODE_OBJECT(test->code()); |
1129 EXPECT(obj.IsArray()); | 1129 EXPECT(obj.IsArray()); |
1130 Array& array = Array::Handle(); | 1130 Array& array = Array::Handle(); |
1131 array ^= obj.raw(); | 1131 array ^= obj.raw(); |
1132 EXPECT_EQ(10, array.Length()); | 1132 EXPECT_EQ(10, array.Length()); |
1133 } | 1133 } |
1134 | 1134 |
| 1135 |
| 1136 // - CheckSmi rA |
| 1137 // |
| 1138 // If FP[rA] is a Smi, then skip the next instruction. |
| 1139 ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { |
| 1140 __ Frame(1); |
| 1141 __ PushConstant(Smi::Handle(Smi::New(42))); |
| 1142 __ LoadConstant(0, Smi::Handle(Smi::New(0))); |
| 1143 __ CheckSmi(0); |
| 1144 __ PushConstant(Smi::Handle(Smi::New(-1))); |
| 1145 __ ReturnTOS(); |
| 1146 } |
| 1147 |
| 1148 |
| 1149 ASSEMBLER_TEST_RUN(CheckSmiPass, test) { |
| 1150 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1151 } |
| 1152 |
| 1153 |
| 1154 ASSEMBLER_TEST_GENERATE(CheckSmiFail, assembler) { |
| 1155 __ Frame(1); |
| 1156 __ PushConstant(Smi::Handle(Smi::New(-1))); |
| 1157 __ LoadConstant(0, Bool::True()); |
| 1158 __ CheckSmi(0); |
| 1159 __ PushConstant(Smi::Handle(Smi::New(42))); |
| 1160 __ ReturnTOS(); |
| 1161 } |
| 1162 |
| 1163 |
| 1164 ASSEMBLER_TEST_RUN(CheckSmiFail, test) { |
| 1165 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1166 } |
| 1167 |
1135 } // namespace dart | 1168 } // namespace dart |
1136 | 1169 |
1137 #endif // defined(TARGET_ARCH_DBC) | 1170 #endif // defined(TARGET_ARCH_DBC) |
OLD | NEW |