| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 // Initialize the JSValue. | 1815 // Initialize the JSValue. |
| 1816 LoadGlobalFunctionInitialMap(constructor, scratch); | 1816 LoadGlobalFunctionInitialMap(constructor, scratch); |
| 1817 mov(FieldOperand(result, HeapObject::kMapOffset), scratch); | 1817 mov(FieldOperand(result, HeapObject::kMapOffset), scratch); |
| 1818 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); | 1818 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); |
| 1819 mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); | 1819 mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); |
| 1820 mov(FieldOperand(result, JSObject::kElementsOffset), scratch); | 1820 mov(FieldOperand(result, JSObject::kElementsOffset), scratch); |
| 1821 mov(FieldOperand(result, JSValue::kValueOffset), value); | 1821 mov(FieldOperand(result, JSValue::kValueOffset), value); |
| 1822 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 1822 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 | |
| 1826 // Copy memory, byte-by-byte, from source to destination. Not optimized for | |
| 1827 // long or aligned copies. The contents of scratch and length are destroyed. | |
| 1828 // Source and destination are incremented by length. | |
| 1829 // Many variants of movsb, loop unrolling, word moves, and indexed operands | |
| 1830 // have been tried here already, and this is fastest. | |
| 1831 // A simpler loop is faster on small copies, but 30% slower on large ones. | |
| 1832 // The cld() instruction must have been emitted, to set the direction flag(), | |
| 1833 // before calling this function. | |
| 1834 void MacroAssembler::CopyBytes(Register source, | |
| 1835 Register destination, | |
| 1836 Register length, | |
| 1837 Register scratch) { | |
| 1838 Label short_loop, len4, len8, len12, done, short_string; | |
| 1839 DCHECK(source.is(esi)); | |
| 1840 DCHECK(destination.is(edi)); | |
| 1841 DCHECK(length.is(ecx)); | |
| 1842 cmp(length, Immediate(4)); | |
| 1843 j(below, &short_string, Label::kNear); | |
| 1844 | |
| 1845 // Because source is 4-byte aligned in our uses of this function, | |
| 1846 // we keep source aligned for the rep_movs call by copying the odd bytes | |
| 1847 // at the end of the ranges. | |
| 1848 mov(scratch, Operand(source, length, times_1, -4)); | |
| 1849 mov(Operand(destination, length, times_1, -4), scratch); | |
| 1850 | |
| 1851 cmp(length, Immediate(8)); | |
| 1852 j(below_equal, &len4, Label::kNear); | |
| 1853 cmp(length, Immediate(12)); | |
| 1854 j(below_equal, &len8, Label::kNear); | |
| 1855 cmp(length, Immediate(16)); | |
| 1856 j(below_equal, &len12, Label::kNear); | |
| 1857 | |
| 1858 mov(scratch, ecx); | |
| 1859 shr(ecx, 2); | |
| 1860 rep_movs(); | |
| 1861 and_(scratch, Immediate(0x3)); | |
| 1862 add(destination, scratch); | |
| 1863 jmp(&done, Label::kNear); | |
| 1864 | |
| 1865 bind(&len12); | |
| 1866 mov(scratch, Operand(source, 8)); | |
| 1867 mov(Operand(destination, 8), scratch); | |
| 1868 bind(&len8); | |
| 1869 mov(scratch, Operand(source, 4)); | |
| 1870 mov(Operand(destination, 4), scratch); | |
| 1871 bind(&len4); | |
| 1872 mov(scratch, Operand(source, 0)); | |
| 1873 mov(Operand(destination, 0), scratch); | |
| 1874 add(destination, length); | |
| 1875 jmp(&done, Label::kNear); | |
| 1876 | |
| 1877 bind(&short_string); | |
| 1878 test(length, length); | |
| 1879 j(zero, &done, Label::kNear); | |
| 1880 | |
| 1881 bind(&short_loop); | |
| 1882 mov_b(scratch, Operand(source, 0)); | |
| 1883 mov_b(Operand(destination, 0), scratch); | |
| 1884 inc(source); | |
| 1885 inc(destination); | |
| 1886 dec(length); | |
| 1887 j(not_zero, &short_loop); | |
| 1888 | |
| 1889 bind(&done); | |
| 1890 } | |
| 1891 | |
| 1892 | |
| 1893 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, | 1825 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, |
| 1894 Register end_address, | 1826 Register end_address, |
| 1895 Register filler) { | 1827 Register filler) { |
| 1896 Label loop, entry; | 1828 Label loop, entry; |
| 1897 jmp(&entry, Label::kNear); | 1829 jmp(&entry, Label::kNear); |
| 1898 bind(&loop); | 1830 bind(&loop); |
| 1899 mov(Operand(current_address, 0), filler); | 1831 mov(Operand(current_address, 0), filler); |
| 1900 add(current_address, Immediate(kPointerSize)); | 1832 add(current_address, Immediate(kPointerSize)); |
| 1901 bind(&entry); | 1833 bind(&entry); |
| 1902 cmp(current_address, end_address); | 1834 cmp(current_address, end_address); |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3200 mov(eax, dividend); | 3132 mov(eax, dividend); |
| 3201 shr(eax, 31); | 3133 shr(eax, 31); |
| 3202 add(edx, eax); | 3134 add(edx, eax); |
| 3203 } | 3135 } |
| 3204 | 3136 |
| 3205 | 3137 |
| 3206 } // namespace internal | 3138 } // namespace internal |
| 3207 } // namespace v8 | 3139 } // namespace v8 |
| 3208 | 3140 |
| 3209 #endif // V8_TARGET_ARCH_X87 | 3141 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |