OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 __ mov(r4, Operand(r0)); | 1368 __ mov(r4, Operand(r0)); |
1369 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src0))); | 1369 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src0))); |
1370 __ ldr(r1, MemOperand(r4, OFFSET_OF(T, src1))); | 1370 __ ldr(r1, MemOperand(r4, OFFSET_OF(T, src1))); |
1371 | 1371 |
1372 __ pkhbt(r2, r0, Operand(r1, LSL, 8)); | 1372 __ pkhbt(r2, r0, Operand(r1, LSL, 8)); |
1373 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst0))); | 1373 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst0))); |
1374 | 1374 |
1375 __ pkhtb(r2, r0, Operand(r1, ASR, 8)); | 1375 __ pkhtb(r2, r0, Operand(r1, ASR, 8)); |
1376 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst1))); | 1376 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst1))); |
1377 | 1377 |
1378 __ uxtb16(r2, Operand(r0, ROR, 8)); | 1378 __ uxtb16(r2, r0, 8); |
1379 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst2))); | 1379 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst2))); |
1380 | 1380 |
1381 __ uxtb(r2, Operand(r0, ROR, 8)); | 1381 __ uxtb(r2, r0, 8); |
1382 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst3))); | 1382 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst3))); |
1383 | 1383 |
1384 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src2))); | 1384 __ ldr(r0, MemOperand(r4, OFFSET_OF(T, src2))); |
1385 __ uxtab(r2, r0, Operand(r1, ROR, 8)); | 1385 __ uxtab(r2, r0, r1, 8); |
1386 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst4))); | 1386 __ str(r2, MemOperand(r4, OFFSET_OF(T, dst4))); |
1387 | 1387 |
1388 __ ldm(ia_w, sp, r4.bit() | pc.bit()); | 1388 __ ldm(ia_w, sp, r4.bit() | pc.bit()); |
1389 | 1389 |
1390 CodeDesc desc; | 1390 CodeDesc desc; |
1391 assm.GetCode(&desc); | 1391 assm.GetCode(&desc); |
1392 Handle<Code> code = isolate->factory()->NewCode( | 1392 Handle<Code> code = isolate->factory()->NewCode( |
1393 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); | 1393 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
1394 #ifdef DEBUG | 1394 #ifdef DEBUG |
1395 OFStream os(stdout); | 1395 OFStream os(stdout); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1599 F3 f = FUNCTION_CAST<F3>(code->entry()); | 1599 F3 f = FUNCTION_CAST<F3>(code->entry()); |
1600 for (size_t i = 0; i < 128; ++i) { | 1600 for (size_t i = 0; i < 128; ++i) { |
1601 int32_t r, x = rng->NextInt(), y = rng->NextInt(); | 1601 int32_t r, x = rng->NextInt(), y = rng->NextInt(); |
1602 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); | 1602 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); |
1603 CHECK_EQ(bits::SignedMulHigh32(x, y), r); | 1603 CHECK_EQ(bits::SignedMulHigh32(x, y), r); |
1604 USE(dummy); | 1604 USE(dummy); |
1605 } | 1605 } |
1606 } | 1606 } |
1607 | 1607 |
1608 | 1608 |
| 1609 TEST(sxtb) { |
| 1610 CcTest::InitializeVM(); |
| 1611 Isolate* const isolate = CcTest::i_isolate(); |
| 1612 HandleScope scope(isolate); |
| 1613 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1614 Assembler assm(isolate, nullptr, 0); |
| 1615 __ sxtb(r1, r1); |
| 1616 __ str(r1, MemOperand(r0)); |
| 1617 __ bx(lr); |
| 1618 CodeDesc desc; |
| 1619 assm.GetCode(&desc); |
| 1620 Handle<Code> code = isolate->factory()->NewCode( |
| 1621 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1622 #ifdef OBJECT_PRINT |
| 1623 code->Print(std::cout); |
| 1624 #endif |
| 1625 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1626 for (size_t i = 0; i < 128; ++i) { |
| 1627 int32_t r, x = rng->NextInt(); |
| 1628 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); |
| 1629 CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)), r); |
| 1630 USE(dummy); |
| 1631 } |
| 1632 } |
| 1633 |
| 1634 |
| 1635 TEST(sxtab) { |
| 1636 CcTest::InitializeVM(); |
| 1637 Isolate* const isolate = CcTest::i_isolate(); |
| 1638 HandleScope scope(isolate); |
| 1639 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1640 Assembler assm(isolate, nullptr, 0); |
| 1641 __ sxtab(r1, r2, r1); |
| 1642 __ str(r1, MemOperand(r0)); |
| 1643 __ bx(lr); |
| 1644 CodeDesc desc; |
| 1645 assm.GetCode(&desc); |
| 1646 Handle<Code> code = isolate->factory()->NewCode( |
| 1647 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1648 #ifdef OBJECT_PRINT |
| 1649 code->Print(std::cout); |
| 1650 #endif |
| 1651 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1652 for (size_t i = 0; i < 128; ++i) { |
| 1653 int32_t r, x = rng->NextInt(), y = rng->NextInt(); |
| 1654 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); |
| 1655 CHECK_EQ(static_cast<int32_t>(static_cast<int8_t>(x)) + y, r); |
| 1656 USE(dummy); |
| 1657 } |
| 1658 } |
| 1659 |
| 1660 |
| 1661 TEST(sxth) { |
| 1662 CcTest::InitializeVM(); |
| 1663 Isolate* const isolate = CcTest::i_isolate(); |
| 1664 HandleScope scope(isolate); |
| 1665 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1666 Assembler assm(isolate, nullptr, 0); |
| 1667 __ sxth(r1, r1); |
| 1668 __ str(r1, MemOperand(r0)); |
| 1669 __ bx(lr); |
| 1670 CodeDesc desc; |
| 1671 assm.GetCode(&desc); |
| 1672 Handle<Code> code = isolate->factory()->NewCode( |
| 1673 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1674 #ifdef OBJECT_PRINT |
| 1675 code->Print(std::cout); |
| 1676 #endif |
| 1677 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1678 for (size_t i = 0; i < 128; ++i) { |
| 1679 int32_t r, x = rng->NextInt(); |
| 1680 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); |
| 1681 CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)), r); |
| 1682 USE(dummy); |
| 1683 } |
| 1684 } |
| 1685 |
| 1686 |
| 1687 TEST(sxtah) { |
| 1688 CcTest::InitializeVM(); |
| 1689 Isolate* const isolate = CcTest::i_isolate(); |
| 1690 HandleScope scope(isolate); |
| 1691 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1692 Assembler assm(isolate, nullptr, 0); |
| 1693 __ sxtah(r1, r2, r1); |
| 1694 __ str(r1, MemOperand(r0)); |
| 1695 __ bx(lr); |
| 1696 CodeDesc desc; |
| 1697 assm.GetCode(&desc); |
| 1698 Handle<Code> code = isolate->factory()->NewCode( |
| 1699 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1700 #ifdef OBJECT_PRINT |
| 1701 code->Print(std::cout); |
| 1702 #endif |
| 1703 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1704 for (size_t i = 0; i < 128; ++i) { |
| 1705 int32_t r, x = rng->NextInt(), y = rng->NextInt(); |
| 1706 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); |
| 1707 CHECK_EQ(static_cast<int32_t>(static_cast<int16_t>(x)) + y, r); |
| 1708 USE(dummy); |
| 1709 } |
| 1710 } |
| 1711 |
| 1712 |
| 1713 TEST(uxtb) { |
| 1714 CcTest::InitializeVM(); |
| 1715 Isolate* const isolate = CcTest::i_isolate(); |
| 1716 HandleScope scope(isolate); |
| 1717 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1718 Assembler assm(isolate, nullptr, 0); |
| 1719 __ uxtb(r1, r1); |
| 1720 __ str(r1, MemOperand(r0)); |
| 1721 __ bx(lr); |
| 1722 CodeDesc desc; |
| 1723 assm.GetCode(&desc); |
| 1724 Handle<Code> code = isolate->factory()->NewCode( |
| 1725 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1726 #ifdef OBJECT_PRINT |
| 1727 code->Print(std::cout); |
| 1728 #endif |
| 1729 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1730 for (size_t i = 0; i < 128; ++i) { |
| 1731 int32_t r, x = rng->NextInt(); |
| 1732 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); |
| 1733 CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)), r); |
| 1734 USE(dummy); |
| 1735 } |
| 1736 } |
| 1737 |
| 1738 |
| 1739 TEST(uxtab) { |
| 1740 CcTest::InitializeVM(); |
| 1741 Isolate* const isolate = CcTest::i_isolate(); |
| 1742 HandleScope scope(isolate); |
| 1743 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1744 Assembler assm(isolate, nullptr, 0); |
| 1745 __ uxtab(r1, r2, r1); |
| 1746 __ str(r1, MemOperand(r0)); |
| 1747 __ bx(lr); |
| 1748 CodeDesc desc; |
| 1749 assm.GetCode(&desc); |
| 1750 Handle<Code> code = isolate->factory()->NewCode( |
| 1751 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1752 #ifdef OBJECT_PRINT |
| 1753 code->Print(std::cout); |
| 1754 #endif |
| 1755 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1756 for (size_t i = 0; i < 128; ++i) { |
| 1757 int32_t r, x = rng->NextInt(), y = rng->NextInt(); |
| 1758 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); |
| 1759 CHECK_EQ(static_cast<int32_t>(static_cast<uint8_t>(x)) + y, r); |
| 1760 USE(dummy); |
| 1761 } |
| 1762 } |
| 1763 |
| 1764 |
| 1765 TEST(uxth) { |
| 1766 CcTest::InitializeVM(); |
| 1767 Isolate* const isolate = CcTest::i_isolate(); |
| 1768 HandleScope scope(isolate); |
| 1769 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1770 Assembler assm(isolate, nullptr, 0); |
| 1771 __ uxth(r1, r1); |
| 1772 __ str(r1, MemOperand(r0)); |
| 1773 __ bx(lr); |
| 1774 CodeDesc desc; |
| 1775 assm.GetCode(&desc); |
| 1776 Handle<Code> code = isolate->factory()->NewCode( |
| 1777 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1778 #ifdef OBJECT_PRINT |
| 1779 code->Print(std::cout); |
| 1780 #endif |
| 1781 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1782 for (size_t i = 0; i < 128; ++i) { |
| 1783 int32_t r, x = rng->NextInt(); |
| 1784 Object* dummy = CALL_GENERATED_CODE(f, &r, x, 0, 0, 0); |
| 1785 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)), r); |
| 1786 USE(dummy); |
| 1787 } |
| 1788 } |
| 1789 |
| 1790 |
| 1791 TEST(uxtah) { |
| 1792 CcTest::InitializeVM(); |
| 1793 Isolate* const isolate = CcTest::i_isolate(); |
| 1794 HandleScope scope(isolate); |
| 1795 RandomNumberGenerator* const rng = isolate->random_number_generator(); |
| 1796 Assembler assm(isolate, nullptr, 0); |
| 1797 __ uxtah(r1, r2, r1); |
| 1798 __ str(r1, MemOperand(r0)); |
| 1799 __ bx(lr); |
| 1800 CodeDesc desc; |
| 1801 assm.GetCode(&desc); |
| 1802 Handle<Code> code = isolate->factory()->NewCode( |
| 1803 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); |
| 1804 #ifdef OBJECT_PRINT |
| 1805 code->Print(std::cout); |
| 1806 #endif |
| 1807 F3 f = FUNCTION_CAST<F3>(code->entry()); |
| 1808 for (size_t i = 0; i < 128; ++i) { |
| 1809 int32_t r, x = rng->NextInt(), y = rng->NextInt(); |
| 1810 Object* dummy = CALL_GENERATED_CODE(f, &r, x, y, 0, 0); |
| 1811 CHECK_EQ(static_cast<int32_t>(static_cast<uint16_t>(x)) + y, r); |
| 1812 USE(dummy); |
| 1813 } |
| 1814 } |
| 1815 |
| 1816 |
1609 TEST(code_relative_offset) { | 1817 TEST(code_relative_offset) { |
1610 // Test extracting the offset of a label from the beginning of the code | 1818 // Test extracting the offset of a label from the beginning of the code |
1611 // in a register. | 1819 // in a register. |
1612 CcTest::InitializeVM(); | 1820 CcTest::InitializeVM(); |
1613 Isolate* isolate = CcTest::i_isolate(); | 1821 Isolate* isolate = CcTest::i_isolate(); |
1614 HandleScope scope(isolate); | 1822 HandleScope scope(isolate); |
1615 // Initialize a code object that will contain the code. | 1823 // Initialize a code object that will contain the code. |
1616 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate); | 1824 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate); |
1617 | 1825 |
1618 Assembler assm(isolate, NULL, 0); | 1826 Assembler assm(isolate, NULL, 0); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1766 CHECK_VRINT(inf, inf, inf, inf, inf, inf) | 1974 CHECK_VRINT(inf, inf, inf, inf, inf, inf) |
1767 CHECK_VRINT(-inf, -inf, -inf, -inf, -inf, -inf) | 1975 CHECK_VRINT(-inf, -inf, -inf, -inf, -inf, -inf) |
1768 CHECK_VRINT(-0.0, -0.0, -0.0, -0.0, -0.0, -0.0) | 1976 CHECK_VRINT(-0.0, -0.0, -0.0, -0.0, -0.0, -0.0) |
1769 double nan = std::numeric_limits<double>::quiet_NaN(); | 1977 double nan = std::numeric_limits<double>::quiet_NaN(); |
1770 CHECK_VRINT(nan, nan, nan, nan, nan, nan) | 1978 CHECK_VRINT(nan, nan, nan, nan, nan, nan) |
1771 | 1979 |
1772 #undef CHECK_VRINT | 1980 #undef CHECK_VRINT |
1773 } | 1981 } |
1774 } | 1982 } |
1775 #undef __ | 1983 #undef __ |
OLD | NEW |