| 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/os.h" | 9 #include "vm/os.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 } | 2514 } |
| 2515 | 2515 |
| 2516 | 2516 |
| 2517 ASSEMBLER_TEST_RUN(TestAlignLarge, test) { | 2517 ASSEMBLER_TEST_RUN(TestAlignLarge, test) { |
| 2518 typedef int (*TestAlignLarge)(); | 2518 typedef int (*TestAlignLarge)(); |
| 2519 int res = reinterpret_cast<TestAlignLarge>(test->entry())(); | 2519 int res = reinterpret_cast<TestAlignLarge>(test->entry())(); |
| 2520 EXPECT_EQ(16, res); // 16 bytes emitted. | 2520 EXPECT_EQ(16, res); // 16 bytes emitted. |
| 2521 } | 2521 } |
| 2522 | 2522 |
| 2523 | 2523 |
| 2524 ASSEMBLER_TEST_GENERATE(TestRepMovsBytes, assembler) { |
| 2525 // Preserve registers. |
| 2526 __ pushl(ESI); |
| 2527 __ pushl(EDI); |
| 2528 __ pushl(ECX); |
| 2529 __ movl(ESI, Address(ESP, 4 * kWordSize)); // from. |
| 2530 __ movl(EDI, Address(ESP, 5 * kWordSize)); // to. |
| 2531 __ movl(ECX, Address(ESP, 6 * kWordSize)); // count. |
| 2532 __ rep_movsb(); |
| 2533 __ popl(ECX); |
| 2534 __ popl(EDI); |
| 2535 __ popl(ESI); |
| 2536 __ ret(); |
| 2537 } |
| 2538 |
| 2539 |
| 2540 ASSEMBLER_TEST_RUN(TestRepMovsBytes, test) { |
| 2541 const char* from = "0123456789"; |
| 2542 const char* to = new char[10]; |
| 2543 typedef void (*TestRepMovsBytes)(const char* from, const char* to, int count); |
| 2544 reinterpret_cast<TestRepMovsBytes>(test->entry())(from, to, 10); |
| 2545 EXPECT_EQ(to[0], '0'); |
| 2546 for (int i = 0; i < 10; i++) { |
| 2547 EXPECT_EQ(from[i], to[i]); |
| 2548 } |
| 2549 delete [] to; |
| 2550 } |
| 2551 |
| 2552 |
| 2524 // Called from assembler_test.cc. | 2553 // Called from assembler_test.cc. |
| 2525 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 2554 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
| 2526 __ pushl(CTX); | 2555 __ pushl(CTX); |
| 2527 __ movl(CTX, Address(ESP, 2 * kWordSize)); | 2556 __ movl(CTX, Address(ESP, 2 * kWordSize)); |
| 2528 __ movl(EAX, Address(ESP, 3 * kWordSize)); | 2557 __ movl(EAX, Address(ESP, 3 * kWordSize)); |
| 2529 __ movl(ECX, Address(ESP, 4 * kWordSize)); | 2558 __ movl(ECX, Address(ESP, 4 * kWordSize)); |
| 2530 __ pushl(EAX); | 2559 __ pushl(EAX); |
| 2531 __ StoreIntoObject(ECX, | 2560 __ StoreIntoObject(ECX, |
| 2532 FieldAddress(ECX, GrowableObjectArray::data_offset()), | 2561 FieldAddress(ECX, GrowableObjectArray::data_offset()), |
| 2533 EAX); | 2562 EAX); |
| 2534 __ popl(EAX); | 2563 __ popl(EAX); |
| 2535 __ popl(CTX); | 2564 __ popl(CTX); |
| 2536 __ ret(); | 2565 __ ret(); |
| 2537 } | 2566 } |
| 2538 | 2567 |
| 2539 | |
| 2540 } // namespace dart | 2568 } // namespace dart |
| 2541 | 2569 |
| 2542 #endif // defined TARGET_ARCH_IA32 | 2570 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |