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 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 const int kNumCases = 512; | 1665 const int kNumCases = 512; |
1666 int values[kNumCases]; | 1666 int values[kNumCases]; |
1667 isolate->random_number_generator()->NextBytes(values, sizeof(values)); | 1667 isolate->random_number_generator()->NextBytes(values, sizeof(values)); |
1668 Label labels[kNumCases]; | 1668 Label labels[kNumCases]; |
1669 | 1669 |
1670 __ addiu(sp, sp, -4); | 1670 __ addiu(sp, sp, -4); |
1671 __ sw(ra, MemOperand(sp)); | 1671 __ sw(ra, MemOperand(sp)); |
1672 | 1672 |
1673 Label done; | 1673 Label done; |
1674 { | 1674 { |
| 1675 __ BlockTrampolinePoolFor(kNumCases + 7); |
1675 PredictableCodeSizeScope predictable( | 1676 PredictableCodeSizeScope predictable( |
1676 &assm, (kNumCases + 7) * Assembler::kInstrSize); | 1677 &assm, (kNumCases + 7) * Assembler::kInstrSize); |
1677 Label here; | 1678 Label here; |
1678 | 1679 |
1679 __ bal(&here); | 1680 __ bal(&here); |
1680 __ nop(); | 1681 __ nop(); |
1681 __ bind(&here); | 1682 __ bind(&here); |
1682 __ sll(at, a0, 2); | 1683 __ sll(at, a0, 2); |
1683 __ addu(at, at, ra); | 1684 __ addu(at, at, ra); |
1684 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 1685 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 for (int i = 0; i < kNumCases; ++i) { | 1742 for (int i = 0; i < kNumCases; ++i) { |
1742 __ bind(&labels[i]); | 1743 __ bind(&labels[i]); |
1743 __ lui(v0, (values[i] >> 16) & 0xffff); | 1744 __ lui(v0, (values[i] >> 16) & 0xffff); |
1744 __ ori(v0, v0, values[i] & 0xffff); | 1745 __ ori(v0, v0, values[i] & 0xffff); |
1745 __ b(&done); | 1746 __ b(&done); |
1746 __ nop(); | 1747 __ nop(); |
1747 } | 1748 } |
1748 | 1749 |
1749 __ bind(&dispatch); | 1750 __ bind(&dispatch); |
1750 { | 1751 { |
| 1752 __ BlockTrampolinePoolFor(kNumCases + 7); |
1751 PredictableCodeSizeScope predictable( | 1753 PredictableCodeSizeScope predictable( |
1752 &assm, (kNumCases + 7) * Assembler::kInstrSize); | 1754 &assm, (kNumCases + 7) * Assembler::kInstrSize); |
1753 Label here; | 1755 Label here; |
1754 | 1756 |
1755 __ bal(&here); | 1757 __ bal(&here); |
1756 __ nop(); | 1758 __ nop(); |
1757 __ bind(&here); | 1759 __ bind(&here); |
1758 __ sll(at, a0, 2); | 1760 __ sll(at, a0, 2); |
1759 __ addu(at, at, ra); | 1761 __ addu(at, at, ra); |
1760 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 1762 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1816 obj = *values[i]; | 1818 obj = *values[i]; |
1817 imm32 = reinterpret_cast<intptr_t>(obj); | 1819 imm32 = reinterpret_cast<intptr_t>(obj); |
1818 __ lui(v0, (imm32 >> 16) & 0xffff); | 1820 __ lui(v0, (imm32 >> 16) & 0xffff); |
1819 __ ori(v0, v0, imm32 & 0xffff); | 1821 __ ori(v0, v0, imm32 & 0xffff); |
1820 __ b(&done); | 1822 __ b(&done); |
1821 __ nop(); | 1823 __ nop(); |
1822 } | 1824 } |
1823 | 1825 |
1824 __ bind(&dispatch); | 1826 __ bind(&dispatch); |
1825 { | 1827 { |
| 1828 __ BlockTrampolinePoolFor(kNumCases + 7); |
1826 PredictableCodeSizeScope predictable( | 1829 PredictableCodeSizeScope predictable( |
1827 &assm, (kNumCases + 7) * Assembler::kInstrSize); | 1830 &assm, (kNumCases + 7) * Assembler::kInstrSize); |
1828 Label here; | 1831 Label here; |
1829 | 1832 |
1830 __ bal(&here); | 1833 __ bal(&here); |
1831 __ nop(); | 1834 __ nop(); |
1832 __ bind(&here); | 1835 __ bind(&here); |
1833 __ sll(at, a0, 2); | 1836 __ sll(at, a0, 2); |
1834 __ addu(at, at, ra); | 1837 __ addu(at, at, ra); |
1835 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); | 1838 __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize)); |
(...skipping 24 matching lines...) Expand all Loading... |
1860 ::printf("f(%d) = ", i); | 1863 ::printf("f(%d) = ", i); |
1861 result->Print(std::cout); | 1864 result->Print(std::cout); |
1862 ::printf("\n"); | 1865 ::printf("\n"); |
1863 #endif | 1866 #endif |
1864 CHECK(values[i].is_identical_to(result)); | 1867 CHECK(values[i].is_identical_to(result)); |
1865 } | 1868 } |
1866 } | 1869 } |
1867 | 1870 |
1868 | 1871 |
1869 #undef __ | 1872 #undef __ |
OLD | NEW |