| 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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 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 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 // Initialize the JSValue. | 1874 // Initialize the JSValue. |
| 1875 LoadGlobalFunctionInitialMap(constructor, scratch); | 1875 LoadGlobalFunctionInitialMap(constructor, scratch); |
| 1876 mov(FieldOperand(result, HeapObject::kMapOffset), scratch); | 1876 mov(FieldOperand(result, HeapObject::kMapOffset), scratch); |
| 1877 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); | 1877 LoadRoot(scratch, Heap::kEmptyFixedArrayRootIndex); |
| 1878 mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); | 1878 mov(FieldOperand(result, JSObject::kPropertiesOffset), scratch); |
| 1879 mov(FieldOperand(result, JSObject::kElementsOffset), scratch); | 1879 mov(FieldOperand(result, JSObject::kElementsOffset), scratch); |
| 1880 mov(FieldOperand(result, JSValue::kValueOffset), value); | 1880 mov(FieldOperand(result, JSValue::kValueOffset), value); |
| 1881 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 1881 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 1882 } | 1882 } |
| 1883 | 1883 |
| 1884 | |
| 1885 // Copy memory, byte-by-byte, from source to destination. Not optimized for | |
| 1886 // long or aligned copies. The contents of scratch and length are destroyed. | |
| 1887 // Source and destination are incremented by length. | |
| 1888 // Many variants of movsb, loop unrolling, word moves, and indexed operands | |
| 1889 // have been tried here already, and this is fastest. | |
| 1890 // A simpler loop is faster on small copies, but 30% slower on large ones. | |
| 1891 // The cld() instruction must have been emitted, to set the direction flag(), | |
| 1892 // before calling this function. | |
| 1893 void MacroAssembler::CopyBytes(Register source, | |
| 1894 Register destination, | |
| 1895 Register length, | |
| 1896 Register scratch) { | |
| 1897 Label short_loop, len4, len8, len12, done, short_string; | |
| 1898 DCHECK(source.is(esi)); | |
| 1899 DCHECK(destination.is(edi)); | |
| 1900 DCHECK(length.is(ecx)); | |
| 1901 cmp(length, Immediate(4)); | |
| 1902 j(below, &short_string, Label::kNear); | |
| 1903 | |
| 1904 // Because source is 4-byte aligned in our uses of this function, | |
| 1905 // we keep source aligned for the rep_movs call by copying the odd bytes | |
| 1906 // at the end of the ranges. | |
| 1907 mov(scratch, Operand(source, length, times_1, -4)); | |
| 1908 mov(Operand(destination, length, times_1, -4), scratch); | |
| 1909 | |
| 1910 cmp(length, Immediate(8)); | |
| 1911 j(below_equal, &len4, Label::kNear); | |
| 1912 cmp(length, Immediate(12)); | |
| 1913 j(below_equal, &len8, Label::kNear); | |
| 1914 cmp(length, Immediate(16)); | |
| 1915 j(below_equal, &len12, Label::kNear); | |
| 1916 | |
| 1917 mov(scratch, ecx); | |
| 1918 shr(ecx, 2); | |
| 1919 rep_movs(); | |
| 1920 and_(scratch, Immediate(0x3)); | |
| 1921 add(destination, scratch); | |
| 1922 jmp(&done, Label::kNear); | |
| 1923 | |
| 1924 bind(&len12); | |
| 1925 mov(scratch, Operand(source, 8)); | |
| 1926 mov(Operand(destination, 8), scratch); | |
| 1927 bind(&len8); | |
| 1928 mov(scratch, Operand(source, 4)); | |
| 1929 mov(Operand(destination, 4), scratch); | |
| 1930 bind(&len4); | |
| 1931 mov(scratch, Operand(source, 0)); | |
| 1932 mov(Operand(destination, 0), scratch); | |
| 1933 add(destination, length); | |
| 1934 jmp(&done, Label::kNear); | |
| 1935 | |
| 1936 bind(&short_string); | |
| 1937 test(length, length); | |
| 1938 j(zero, &done, Label::kNear); | |
| 1939 | |
| 1940 bind(&short_loop); | |
| 1941 mov_b(scratch, Operand(source, 0)); | |
| 1942 mov_b(Operand(destination, 0), scratch); | |
| 1943 inc(source); | |
| 1944 inc(destination); | |
| 1945 dec(length); | |
| 1946 j(not_zero, &short_loop); | |
| 1947 | |
| 1948 bind(&done); | |
| 1949 } | |
| 1950 | |
| 1951 | |
| 1952 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, | 1884 void MacroAssembler::InitializeFieldsWithFiller(Register current_address, |
| 1953 Register end_address, | 1885 Register end_address, |
| 1954 Register filler) { | 1886 Register filler) { |
| 1955 Label loop, entry; | 1887 Label loop, entry; |
| 1956 jmp(&entry, Label::kNear); | 1888 jmp(&entry, Label::kNear); |
| 1957 bind(&loop); | 1889 bind(&loop); |
| 1958 mov(Operand(current_address, 0), filler); | 1890 mov(Operand(current_address, 0), filler); |
| 1959 add(current_address, Immediate(kPointerSize)); | 1891 add(current_address, Immediate(kPointerSize)); |
| 1960 bind(&entry); | 1892 bind(&entry); |
| 1961 cmp(current_address, end_address); | 1893 cmp(current_address, end_address); |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3353 mov(eax, dividend); | 3285 mov(eax, dividend); |
| 3354 shr(eax, 31); | 3286 shr(eax, 31); |
| 3355 add(edx, eax); | 3287 add(edx, eax); |
| 3356 } | 3288 } |
| 3357 | 3289 |
| 3358 | 3290 |
| 3359 } // namespace internal | 3291 } // namespace internal |
| 3360 } // namespace v8 | 3292 } // namespace v8 |
| 3361 | 3293 |
| 3362 #endif // V8_TARGET_ARCH_IA32 | 3294 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |