| 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 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 | 1599 |
| 1600 ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { | 1600 ASSEMBLER_TEST_RUN(CreateArrayTOS, test) { |
| 1601 const Object& obj = EXECUTE_TEST_CODE_OBJECT(test->code()); | 1601 const Object& obj = EXECUTE_TEST_CODE_OBJECT(test->code()); |
| 1602 EXPECT(obj.IsArray()); | 1602 EXPECT(obj.IsArray()); |
| 1603 Array& array = Array::Handle(); | 1603 Array& array = Array::Handle(); |
| 1604 array ^= obj.raw(); | 1604 array ^= obj.raw(); |
| 1605 EXPECT_EQ(10, array.Length()); | 1605 EXPECT_EQ(10, array.Length()); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 | 1608 |
| 1609 // - TestSmi rA, rD |
| 1610 // |
| 1611 // If FP[rA] & FP[rD] != 0, then skip the next instruction. FP[rA] and FP[rD] |
| 1612 // must be Smis. |
| 1613 ASSEMBLER_TEST_GENERATE(TestSmiTrue, assembler) { |
| 1614 Label branch_taken; |
| 1615 __ Frame(2); |
| 1616 __ LoadConstant(0, Smi::Handle(Smi::New(7))); |
| 1617 __ LoadConstant(1, Smi::Handle(Smi::New(3))); |
| 1618 __ TestSmi(0, 1); |
| 1619 __ Jump(&branch_taken); |
| 1620 __ PushConstant(Bool::True()); |
| 1621 __ ReturnTOS(); |
| 1622 __ Bind(&branch_taken); |
| 1623 __ PushConstant(Bool::False()); |
| 1624 __ ReturnTOS(); |
| 1625 } |
| 1626 |
| 1627 |
| 1628 ASSEMBLER_TEST_RUN(TestSmiTrue, test) { |
| 1629 EXPECT(EXECUTE_TEST_CODE_BOOL(test->code())); |
| 1630 } |
| 1631 |
| 1632 |
| 1633 ASSEMBLER_TEST_GENERATE(TestSmiFalse, assembler) { |
| 1634 Label branch_taken; |
| 1635 __ Frame(2); |
| 1636 __ LoadConstant(0, Smi::Handle(Smi::New(8))); |
| 1637 __ LoadConstant(1, Smi::Handle(Smi::New(4))); |
| 1638 __ TestSmi(0, 1); |
| 1639 __ Jump(&branch_taken); |
| 1640 __ PushConstant(Bool::True()); |
| 1641 __ ReturnTOS(); |
| 1642 __ Bind(&branch_taken); |
| 1643 __ PushConstant(Bool::False()); |
| 1644 __ ReturnTOS(); |
| 1645 } |
| 1646 |
| 1647 |
| 1648 ASSEMBLER_TEST_RUN(TestSmiFalse, test) { |
| 1649 EXPECT(!EXECUTE_TEST_CODE_BOOL(test->code())); |
| 1650 } |
| 1651 |
| 1652 |
| 1609 // - CheckSmi rA | 1653 // - CheckSmi rA |
| 1610 // | 1654 // |
| 1611 // If FP[rA] is a Smi, then skip the next instruction. | 1655 // If FP[rA] is a Smi, then skip the next instruction. |
| 1612 ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { | 1656 ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { |
| 1613 __ Frame(1); | 1657 __ Frame(1); |
| 1614 __ PushConstant(Smi::Handle(Smi::New(42))); | 1658 __ PushConstant(Smi::Handle(Smi::New(42))); |
| 1615 __ LoadConstant(0, Smi::Handle(Smi::New(0))); | 1659 __ LoadConstant(0, Smi::Handle(Smi::New(0))); |
| 1616 __ CheckSmi(0); | 1660 __ CheckSmi(0); |
| 1617 __ PushConstant(Smi::Handle(Smi::New(-1))); | 1661 __ PushConstant(Smi::Handle(Smi::New(-1))); |
| 1618 __ ReturnTOS(); | 1662 __ ReturnTOS(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1744 } | 1788 } |
| 1745 | 1789 |
| 1746 | 1790 |
| 1747 ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) { | 1791 ASSEMBLER_TEST_RUN(IfNeNullNotNull, test) { |
| 1748 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); | 1792 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1749 } | 1793 } |
| 1750 | 1794 |
| 1751 } // namespace dart | 1795 } // namespace dart |
| 1752 | 1796 |
| 1753 #endif // defined(TARGET_ARCH_DBC) | 1797 #endif // defined(TARGET_ARCH_DBC) |
| OLD | NEW |