Chromium Code Reviews| 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 | |
| 1653 | |
|
zra
2016/06/29 22:57:01
Extra newline
rmacnak
2016/06/29 23:53:51
Done.
| |
| 1609 // - CheckSmi rA | 1654 // - CheckSmi rA |
| 1610 // | 1655 // |
| 1611 // If FP[rA] is a Smi, then skip the next instruction. | 1656 // If FP[rA] is a Smi, then skip the next instruction. |
| 1612 ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { | 1657 ASSEMBLER_TEST_GENERATE(CheckSmiPass, assembler) { |
| 1613 __ Frame(1); | 1658 __ Frame(1); |
| 1614 __ PushConstant(Smi::Handle(Smi::New(42))); | 1659 __ PushConstant(Smi::Handle(Smi::New(42))); |
| 1615 __ LoadConstant(0, Smi::Handle(Smi::New(0))); | 1660 __ LoadConstant(0, Smi::Handle(Smi::New(0))); |
| 1616 __ CheckSmi(0); | 1661 __ CheckSmi(0); |
| 1617 __ PushConstant(Smi::Handle(Smi::New(-1))); | 1662 __ PushConstant(Smi::Handle(Smi::New(-1))); |
| 1618 __ ReturnTOS(); | 1663 __ ReturnTOS(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1680 } | 1725 } |
| 1681 | 1726 |
| 1682 | 1727 |
| 1683 ASSEMBLER_TEST_RUN(CheckClassIdFail, test) { | 1728 ASSEMBLER_TEST_RUN(CheckClassIdFail, test) { |
| 1684 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); | 1729 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1685 } | 1730 } |
| 1686 | 1731 |
| 1687 } // namespace dart | 1732 } // namespace dart |
| 1688 | 1733 |
| 1689 #endif // defined(TARGET_ARCH_DBC) | 1734 #endif // defined(TARGET_ARCH_DBC) |
| OLD | NEW |