OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_S390 | 8 #if V8_TARGET_ARCH_S390 |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 | 1618 |
1619 // Compare with allocation limit. | 1619 // Compare with allocation limit. |
1620 CmpLogicalP(result_end, MemOperand(top_address, limit - top)); | 1620 CmpLogicalP(result_end, MemOperand(top_address, limit - top)); |
1621 bge(gc_required); | 1621 bge(gc_required); |
1622 | 1622 |
1623 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { | 1623 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { |
1624 // The top pointer is not updated for allocation folding dominators. | 1624 // The top pointer is not updated for allocation folding dominators. |
1625 StoreP(result_end, MemOperand(top_address)); | 1625 StoreP(result_end, MemOperand(top_address)); |
1626 } | 1626 } |
1627 | 1627 |
1628 // Prefetch the allocation_top's next cache line in advance to | 1628 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
1629 // help alleviate potential cache misses. | 1629 // Prefetch the allocation_top's next cache line in advance to |
1630 // Mode 2 - Prefetch the data into a cache line for store access. | 1630 // help alleviate potential cache misses. |
1631 pfd(r2, MemOperand(result, 256)); | 1631 // Mode 2 - Prefetch the data into a cache line for store access. |
| 1632 pfd(r2, MemOperand(result, 256)); |
| 1633 } |
1632 | 1634 |
1633 // Tag object. | 1635 // Tag object. |
1634 la(result, MemOperand(result, kHeapObjectTag)); | 1636 la(result, MemOperand(result, kHeapObjectTag)); |
1635 } | 1637 } |
1636 | 1638 |
1637 void MacroAssembler::Allocate(Register object_size, Register result, | 1639 void MacroAssembler::Allocate(Register object_size, Register result, |
1638 Register result_end, Register scratch, | 1640 Register result_end, Register scratch, |
1639 Label* gc_required, AllocationFlags flags) { | 1641 Label* gc_required, AllocationFlags flags) { |
1640 DCHECK((flags & ALLOCATION_FOLDED) == 0); | 1642 DCHECK((flags & ALLOCATION_FOLDED) == 0); |
1641 if (!FLAG_inline_new) { | 1643 if (!FLAG_inline_new) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1715 // Update allocation top. result temporarily holds the new top. | 1717 // Update allocation top. result temporarily holds the new top. |
1716 if (emit_debug_code()) { | 1718 if (emit_debug_code()) { |
1717 AndP(r0, result_end, Operand(kObjectAlignmentMask)); | 1719 AndP(r0, result_end, Operand(kObjectAlignmentMask)); |
1718 Check(eq, kUnalignedAllocationInNewSpace, cr0); | 1720 Check(eq, kUnalignedAllocationInNewSpace, cr0); |
1719 } | 1721 } |
1720 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { | 1722 if ((flags & ALLOCATION_FOLDING_DOMINATOR) == 0) { |
1721 // The top pointer is not updated for allocation folding dominators. | 1723 // The top pointer is not updated for allocation folding dominators. |
1722 StoreP(result_end, MemOperand(top_address)); | 1724 StoreP(result_end, MemOperand(top_address)); |
1723 } | 1725 } |
1724 | 1726 |
1725 // Prefetch the allocation_top's next cache line in advance to | 1727 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
1726 // help alleviate potential cache misses. | 1728 // Prefetch the allocation_top's next cache line in advance to |
1727 // Mode 2 - Prefetch the data into a cache line for store access. | 1729 // help alleviate potential cache misses. |
1728 pfd(r2, MemOperand(result, 256)); | 1730 // Mode 2 - Prefetch the data into a cache line for store access. |
| 1731 pfd(r2, MemOperand(result, 256)); |
| 1732 } |
1729 | 1733 |
1730 // Tag object. | 1734 // Tag object. |
1731 la(result, MemOperand(result, kHeapObjectTag)); | 1735 la(result, MemOperand(result, kHeapObjectTag)); |
1732 } | 1736 } |
1733 | 1737 |
1734 void MacroAssembler::FastAllocate(Register object_size, Register result, | 1738 void MacroAssembler::FastAllocate(Register object_size, Register result, |
1735 Register result_end, Register scratch, | 1739 Register result_end, Register scratch, |
1736 AllocationFlags flags) { | 1740 AllocationFlags flags) { |
1737 // |object_size| and |result_end| may overlap if the DOUBLE_ALIGNMENT flag | 1741 // |object_size| and |result_end| may overlap if the DOUBLE_ALIGNMENT flag |
1738 // is not specified. Other registers must not overlap. | 1742 // is not specified. Other registers must not overlap. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 AddP(result_end, result, object_size); | 1777 AddP(result_end, result, object_size); |
1774 } | 1778 } |
1775 | 1779 |
1776 // Update allocation top. result temporarily holds the new top. | 1780 // Update allocation top. result temporarily holds the new top. |
1777 if (emit_debug_code()) { | 1781 if (emit_debug_code()) { |
1778 AndP(r0, result_end, Operand(kObjectAlignmentMask)); | 1782 AndP(r0, result_end, Operand(kObjectAlignmentMask)); |
1779 Check(eq, kUnalignedAllocationInNewSpace, cr0); | 1783 Check(eq, kUnalignedAllocationInNewSpace, cr0); |
1780 } | 1784 } |
1781 StoreP(result_end, MemOperand(top_address)); | 1785 StoreP(result_end, MemOperand(top_address)); |
1782 | 1786 |
1783 // Prefetch the allocation_top's next cache line in advance to | 1787 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
1784 // help alleviate potential cache misses. | 1788 // Prefetch the allocation_top's next cache line in advance to |
1785 // Mode 2 - Prefetch the data into a cache line for store access. | 1789 // help alleviate potential cache misses. |
1786 pfd(r2, MemOperand(result, 256)); | 1790 // Mode 2 - Prefetch the data into a cache line for store access. |
| 1791 pfd(r2, MemOperand(result, 256)); |
| 1792 } |
1787 | 1793 |
1788 // Tag object. | 1794 // Tag object. |
1789 la(result, MemOperand(result, kHeapObjectTag)); | 1795 la(result, MemOperand(result, kHeapObjectTag)); |
1790 } | 1796 } |
1791 | 1797 |
1792 void MacroAssembler::FastAllocate(int object_size, Register result, | 1798 void MacroAssembler::FastAllocate(int object_size, Register result, |
1793 Register scratch1, Register scratch2, | 1799 Register scratch1, Register scratch2, |
1794 AllocationFlags flags) { | 1800 AllocationFlags flags) { |
1795 DCHECK(object_size <= kMaxRegularHeapObjectSize); | 1801 DCHECK(object_size <= kMaxRegularHeapObjectSize); |
1796 DCHECK(!AreAliased(result, scratch1, scratch2, ip)); | 1802 DCHECK(!AreAliased(result, scratch1, scratch2, ip)); |
(...skipping 23 matching lines...) Expand all Loading... |
1820 AndP(result_end, result, Operand(kDoubleAlignmentMask)); | 1826 AndP(result_end, result, Operand(kDoubleAlignmentMask)); |
1821 Label aligned; | 1827 Label aligned; |
1822 beq(&aligned, Label::kNear); | 1828 beq(&aligned, Label::kNear); |
1823 mov(result_end, Operand(isolate()->factory()->one_pointer_filler_map())); | 1829 mov(result_end, Operand(isolate()->factory()->one_pointer_filler_map())); |
1824 StoreW(result_end, MemOperand(result)); | 1830 StoreW(result_end, MemOperand(result)); |
1825 AddP(result, result, Operand(kDoubleSize / 2)); | 1831 AddP(result, result, Operand(kDoubleSize / 2)); |
1826 bind(&aligned); | 1832 bind(&aligned); |
1827 #endif | 1833 #endif |
1828 } | 1834 } |
1829 | 1835 |
| 1836 #if V8_TARGET_ARCH_S390X |
| 1837 // Limit to 64-bit only, as double alignment check above may adjust |
| 1838 // allocation top by an extra kDoubleSize/2. |
1830 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT) && is_int8(object_size)) { | 1839 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT) && is_int8(object_size)) { |
1831 // Update allocation top. | 1840 // Update allocation top. |
1832 AddP(MemOperand(top_address), Operand(object_size)); | 1841 AddP(MemOperand(top_address), Operand(object_size)); |
1833 } else { | 1842 } else { |
1834 // Calculate new top using result. | 1843 // Calculate new top using result. |
1835 AddP(result_end, result, Operand(object_size)); | 1844 AddP(result_end, result, Operand(object_size)); |
1836 | |
1837 // Update allocation top. | 1845 // Update allocation top. |
1838 StoreP(result_end, MemOperand(top_address)); | 1846 StoreP(result_end, MemOperand(top_address)); |
1839 } | 1847 } |
| 1848 #else |
| 1849 // Calculate new top using result. |
| 1850 AddP(result_end, result, Operand(object_size)); |
| 1851 // Update allocation top. |
| 1852 StoreP(result_end, MemOperand(top_address)); |
| 1853 #endif |
1840 | 1854 |
1841 // Prefetch the allocation_top's next cache line in advance to | 1855 if (CpuFeatures::IsSupported(GENERAL_INSTR_EXT)) { |
1842 // help alleviate potential cache misses. | 1856 // Prefetch the allocation_top's next cache line in advance to |
1843 // Mode 2 - Prefetch the data into a cache line for store access. | 1857 // help alleviate potential cache misses. |
1844 pfd(r2, MemOperand(result, 256)); | 1858 // Mode 2 - Prefetch the data into a cache line for store access. |
| 1859 pfd(r2, MemOperand(result, 256)); |
| 1860 } |
1845 | 1861 |
1846 // Tag object. | 1862 // Tag object. |
1847 la(result, MemOperand(result, kHeapObjectTag)); | 1863 la(result, MemOperand(result, kHeapObjectTag)); |
1848 } | 1864 } |
1849 | 1865 |
1850 void MacroAssembler::CompareObjectType(Register object, Register map, | 1866 void MacroAssembler::CompareObjectType(Register object, Register map, |
1851 Register type_reg, InstanceType type) { | 1867 Register type_reg, InstanceType type) { |
1852 const Register temp = type_reg.is(no_reg) ? r0 : type_reg; | 1868 const Register temp = type_reg.is(no_reg) ? r0 : type_reg; |
1853 | 1869 |
1854 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 1870 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
(...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5111 } | 5127 } |
5112 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5128 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5113 ExtractBit(r0, dividend, 31); | 5129 ExtractBit(r0, dividend, 31); |
5114 AddP(result, r0); | 5130 AddP(result, r0); |
5115 } | 5131 } |
5116 | 5132 |
5117 } // namespace internal | 5133 } // namespace internal |
5118 } // namespace v8 | 5134 } // namespace v8 |
5119 | 5135 |
5120 #endif // V8_TARGET_ARCH_S390 | 5136 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |