OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 __ ret(); | 172 __ ret(); |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 ASSEMBLER_TEST_RUN(SimpleLoop, test) { | 176 ASSEMBLER_TEST_RUN(SimpleLoop, test) { |
177 typedef int (*SimpleLoopCode)(); | 177 typedef int (*SimpleLoopCode)(); |
178 EXPECT_EQ(2 * 87, reinterpret_cast<SimpleLoopCode>(test->entry())()); | 178 EXPECT_EQ(2 * 87, reinterpret_cast<SimpleLoopCode>(test->entry())()); |
179 } | 179 } |
180 | 180 |
181 | 181 |
| 182 ASSEMBLER_TEST_GENERATE(Cmpb, assembler) { |
| 183 Label done; |
| 184 __ movl(EAX, Immediate(1)); |
| 185 __ pushl(Immediate(0xffffff11)); |
| 186 __ cmpb(Address(ESP, 0), Immediate(0x11)); |
| 187 __ j(EQUAL, &done, Assembler::kNearJump); |
| 188 __ movl(EAX, Immediate(0)); |
| 189 __ Bind(&done); |
| 190 __ popl(ECX); |
| 191 __ ret(); |
| 192 } |
| 193 |
| 194 |
| 195 ASSEMBLER_TEST_RUN(Cmpb, test) { |
| 196 typedef int (*CmpbCode)(); |
| 197 EXPECT_EQ(1, reinterpret_cast<CmpbCode>(test->entry())()); |
| 198 } |
| 199 |
| 200 |
182 ASSEMBLER_TEST_GENERATE(Increment, assembler) { | 201 ASSEMBLER_TEST_GENERATE(Increment, assembler) { |
183 __ movl(EAX, Immediate(0)); | 202 __ movl(EAX, Immediate(0)); |
184 __ pushl(EAX); | 203 __ pushl(EAX); |
185 __ incl(Address(ESP, 0)); | 204 __ incl(Address(ESP, 0)); |
186 __ movl(ECX, Address(ESP, 0)); | 205 __ movl(ECX, Address(ESP, 0)); |
187 __ incl(ECX); | 206 __ incl(ECX); |
188 __ popl(EAX); | 207 __ popl(EAX); |
189 __ movl(EAX, ECX); | 208 __ movl(EAX, ECX); |
190 __ ret(); | 209 __ ret(); |
191 } | 210 } |
(...skipping 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 | 3341 |
3323 ASSEMBLER_TEST_RUN(BitTest, test) { | 3342 ASSEMBLER_TEST_RUN(BitTest, test) { |
3324 typedef int (*BitTest)(); | 3343 typedef int (*BitTest)(); |
3325 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())()); | 3344 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())()); |
3326 } | 3345 } |
3327 | 3346 |
3328 | 3347 |
3329 } // namespace dart | 3348 } // namespace dart |
3330 | 3349 |
3331 #endif // defined TARGET_ARCH_IA32 | 3350 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |