Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/s390/macro-assembler-s390.cc

Issue 1929673002: S390: Get rid of AllocationFlags::TAG_OBJECT (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 blt(gc_required); 1808 blt(gc_required);
1809 AddP(result_end, result, Operand(object_size)); 1809 AddP(result_end, result, Operand(object_size));
1810 } else { 1810 } else {
1811 mov(result_end, Operand(object_size)); 1811 mov(result_end, Operand(object_size));
1812 CmpP(r0, result_end); 1812 CmpP(r0, result_end);
1813 blt(gc_required); 1813 blt(gc_required);
1814 AddP(result_end, result, result_end); 1814 AddP(result_end, result, result_end);
1815 } 1815 }
1816 StoreP(result_end, MemOperand(top_address)); 1816 StoreP(result_end, MemOperand(top_address));
1817 1817
1818 // Tag object if requested. 1818 // Tag object.
1819 if ((flags & TAG_OBJECT) != 0) { 1819 AddP(result, result, Operand(kHeapObjectTag));
1820 AddP(result, result, Operand(kHeapObjectTag));
1821 }
1822 } 1820 }
1823 1821
1824 void MacroAssembler::Allocate(Register object_size, Register result, 1822 void MacroAssembler::Allocate(Register object_size, Register result,
1825 Register result_end, Register scratch, 1823 Register result_end, Register scratch,
1826 Label* gc_required, AllocationFlags flags) { 1824 Label* gc_required, AllocationFlags flags) {
1827 if (!FLAG_inline_new) { 1825 if (!FLAG_inline_new) {
1828 if (emit_debug_code()) { 1826 if (emit_debug_code()) {
1829 // Trash the registers to simulate an allocation failure. 1827 // Trash the registers to simulate an allocation failure.
1830 LoadImmP(result, Operand(0x7091)); 1828 LoadImmP(result, Operand(0x7091));
1831 LoadImmP(scratch, Operand(0x7191)); 1829 LoadImmP(scratch, Operand(0x7191));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 AddP(result_end, result, object_size); 1906 AddP(result_end, result, object_size);
1909 } 1907 }
1910 1908
1911 // Update allocation top. result temporarily holds the new top. 1909 // Update allocation top. result temporarily holds the new top.
1912 if (emit_debug_code()) { 1910 if (emit_debug_code()) {
1913 AndP(r0, result_end, Operand(kObjectAlignmentMask)); 1911 AndP(r0, result_end, Operand(kObjectAlignmentMask));
1914 Check(eq, kUnalignedAllocationInNewSpace, cr0); 1912 Check(eq, kUnalignedAllocationInNewSpace, cr0);
1915 } 1913 }
1916 StoreP(result_end, MemOperand(top_address)); 1914 StoreP(result_end, MemOperand(top_address));
1917 1915
1918 // Tag object if requested. 1916 // Tag object.
1919 if ((flags & TAG_OBJECT) != 0) { 1917 AddP(result, result, Operand(kHeapObjectTag));
1920 AddP(result, result, Operand(kHeapObjectTag));
1921 }
1922 } 1918 }
1923 1919
1924 void MacroAssembler::AllocateTwoByteString(Register result, Register length, 1920 void MacroAssembler::AllocateTwoByteString(Register result, Register length,
1925 Register scratch1, Register scratch2, 1921 Register scratch1, Register scratch2,
1926 Register scratch3, 1922 Register scratch3,
1927 Label* gc_required) { 1923 Label* gc_required) {
1928 // Calculate the number of bytes needed for the characters in the string while 1924 // Calculate the number of bytes needed for the characters in the string while
1929 // observing object alignment. 1925 // observing object alignment.
1930 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); 1926 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
1931 1927
1932 ShiftLeft(scratch1, length, Operand(1)); // Length in bytes, not chars. 1928 ShiftLeft(scratch1, length, Operand(1)); // Length in bytes, not chars.
1933 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); 1929 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize));
1934 1930
1935 AndP(scratch1, Operand(~kObjectAlignmentMask)); 1931 AndP(scratch1, Operand(~kObjectAlignmentMask));
1936 1932
1937 // Allocate two-byte string in new space. 1933 // Allocate two-byte string in new space.
1938 Allocate(scratch1, result, scratch2, scratch3, gc_required, TAG_OBJECT); 1934 Allocate(scratch1, result, scratch2, scratch3, gc_required,
1935 NO_ALLOCATION_FLAGS);
1939 1936
1940 // Set the map, length and hash field. 1937 // Set the map, length and hash field.
1941 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1, 1938 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1,
1942 scratch2); 1939 scratch2);
1943 } 1940 }
1944 1941
1945 void MacroAssembler::AllocateOneByteString(Register result, Register length, 1942 void MacroAssembler::AllocateOneByteString(Register result, Register length,
1946 Register scratch1, Register scratch2, 1943 Register scratch1, Register scratch2,
1947 Register scratch3, 1944 Register scratch3,
1948 Label* gc_required) { 1945 Label* gc_required) {
1949 // Calculate the number of bytes needed for the characters in the string while 1946 // Calculate the number of bytes needed for the characters in the string while
1950 // observing object alignment. 1947 // observing object alignment.
1951 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0); 1948 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0);
1952 DCHECK(kCharSize == 1); 1949 DCHECK(kCharSize == 1);
1953 AddP(scratch1, length, 1950 AddP(scratch1, length,
1954 Operand(kObjectAlignmentMask + SeqOneByteString::kHeaderSize)); 1951 Operand(kObjectAlignmentMask + SeqOneByteString::kHeaderSize));
1955 AndP(scratch1, Operand(~kObjectAlignmentMask)); 1952 AndP(scratch1, Operand(~kObjectAlignmentMask));
1956 1953
1957 // Allocate one-byte string in new space. 1954 // Allocate one-byte string in new space.
1958 Allocate(scratch1, result, scratch2, scratch3, gc_required, TAG_OBJECT); 1955 Allocate(scratch1, result, scratch2, scratch3, gc_required,
1956 NO_ALLOCATION_FLAGS);
1959 1957
1960 // Set the map, length and hash field. 1958 // Set the map, length and hash field.
1961 InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, 1959 InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex,
1962 scratch1, scratch2); 1960 scratch1, scratch2);
1963 } 1961 }
1964 1962
1965 void MacroAssembler::AllocateTwoByteConsString(Register result, Register length, 1963 void MacroAssembler::AllocateTwoByteConsString(Register result, Register length,
1966 Register scratch1, 1964 Register scratch1,
1967 Register scratch2, 1965 Register scratch2,
1968 Label* gc_required) { 1966 Label* gc_required) {
1969 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, 1967 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
1970 TAG_OBJECT); 1968 NO_ALLOCATION_FLAGS);
1971 1969
1972 InitializeNewString(result, length, Heap::kConsStringMapRootIndex, scratch1, 1970 InitializeNewString(result, length, Heap::kConsStringMapRootIndex, scratch1,
1973 scratch2); 1971 scratch2);
1974 } 1972 }
1975 1973
1976 void MacroAssembler::AllocateOneByteConsString(Register result, Register length, 1974 void MacroAssembler::AllocateOneByteConsString(Register result, Register length,
1977 Register scratch1, 1975 Register scratch1,
1978 Register scratch2, 1976 Register scratch2,
1979 Label* gc_required) { 1977 Label* gc_required) {
1980 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, 1978 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required,
1981 TAG_OBJECT); 1979 NO_ALLOCATION_FLAGS);
1982 1980
1983 InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, 1981 InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex,
1984 scratch1, scratch2); 1982 scratch1, scratch2);
1985 } 1983 }
1986 1984
1987 void MacroAssembler::AllocateTwoByteSlicedString(Register result, 1985 void MacroAssembler::AllocateTwoByteSlicedString(Register result,
1988 Register length, 1986 Register length,
1989 Register scratch1, 1987 Register scratch1,
1990 Register scratch2, 1988 Register scratch2,
1991 Label* gc_required) { 1989 Label* gc_required) {
1992 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, 1990 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
1993 TAG_OBJECT); 1991 NO_ALLOCATION_FLAGS);
1994 1992
1995 InitializeNewString(result, length, Heap::kSlicedStringMapRootIndex, scratch1, 1993 InitializeNewString(result, length, Heap::kSlicedStringMapRootIndex, scratch1,
1996 scratch2); 1994 scratch2);
1997 } 1995 }
1998 1996
1999 void MacroAssembler::AllocateOneByteSlicedString(Register result, 1997 void MacroAssembler::AllocateOneByteSlicedString(Register result,
2000 Register length, 1998 Register length,
2001 Register scratch1, 1999 Register scratch1,
2002 Register scratch2, 2000 Register scratch2,
2003 Label* gc_required) { 2001 Label* gc_required) {
2004 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, 2002 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required,
2005 TAG_OBJECT); 2003 NO_ALLOCATION_FLAGS);
2006 2004
2007 InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, 2005 InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex,
2008 scratch1, scratch2); 2006 scratch1, scratch2);
2009 } 2007 }
2010 2008
2011 void MacroAssembler::CompareObjectType(Register object, Register map, 2009 void MacroAssembler::CompareObjectType(Register object, Register map,
2012 Register type_reg, InstanceType type) { 2010 Register type_reg, InstanceType type) {
2013 const Register temp = type_reg.is(no_reg) ? r0 : type_reg; 2011 const Register temp = type_reg.is(no_reg) ? r0 : type_reg;
2014 2012
2015 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset)); 2013 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset));
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 2960
2963 bind(&succeed); 2961 bind(&succeed);
2964 } 2962 }
2965 2963
2966 // Allocates a heap number or jumps to the need_gc label if the young space 2964 // Allocates a heap number or jumps to the need_gc label if the young space
2967 // is full and a scavenge is needed. 2965 // is full and a scavenge is needed.
2968 void MacroAssembler::AllocateHeapNumber(Register result, Register scratch1, 2966 void MacroAssembler::AllocateHeapNumber(Register result, Register scratch1,
2969 Register scratch2, 2967 Register scratch2,
2970 Register heap_number_map, 2968 Register heap_number_map,
2971 Label* gc_required, 2969 Label* gc_required,
2972 TaggingMode tagging_mode,
2973 MutableMode mode) { 2970 MutableMode mode) {
2974 // Allocate an object in the heap for the heap number and tag it as a heap 2971 // Allocate an object in the heap for the heap number and tag it as a heap
2975 // object. 2972 // object.
2976 Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required, 2973 Allocate(HeapNumber::kSize, result, scratch1, scratch2, gc_required,
2977 tagging_mode == TAG_RESULT ? TAG_OBJECT : NO_ALLOCATION_FLAGS); 2974 NO_ALLOCATION_FLAGS);
2978 2975
2979 Heap::RootListIndex map_index = mode == MUTABLE 2976 Heap::RootListIndex map_index = mode == MUTABLE
2980 ? Heap::kMutableHeapNumberMapRootIndex 2977 ? Heap::kMutableHeapNumberMapRootIndex
2981 : Heap::kHeapNumberMapRootIndex; 2978 : Heap::kHeapNumberMapRootIndex;
2982 AssertIsRoot(heap_number_map, map_index); 2979 AssertIsRoot(heap_number_map, map_index);
2983 2980
2984 // Store heap number map in the allocated object. 2981 // Store heap number map in the allocated object.
2985 if (tagging_mode == TAG_RESULT) {
2986 StoreP(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset)); 2982 StoreP(heap_number_map, FieldMemOperand(result, HeapObject::kMapOffset));
2987 } else {
2988 StoreP(heap_number_map, MemOperand(result, HeapObject::kMapOffset));
2989 }
2990 } 2983 }
2991 2984
2992 void MacroAssembler::AllocateHeapNumberWithValue( 2985 void MacroAssembler::AllocateHeapNumberWithValue(
2993 Register result, DoubleRegister value, Register scratch1, Register scratch2, 2986 Register result, DoubleRegister value, Register scratch1, Register scratch2,
2994 Register heap_number_map, Label* gc_required) { 2987 Register heap_number_map, Label* gc_required) {
2995 AllocateHeapNumber(result, scratch1, scratch2, heap_number_map, gc_required); 2988 AllocateHeapNumber(result, scratch1, scratch2, heap_number_map, gc_required);
2996 StoreDouble(value, FieldMemOperand(result, HeapNumber::kValueOffset)); 2989 StoreDouble(value, FieldMemOperand(result, HeapNumber::kValueOffset));
2997 } 2990 }
2998 2991
2999 void MacroAssembler::AllocateJSValue(Register result, Register constructor, 2992 void MacroAssembler::AllocateJSValue(Register result, Register constructor,
3000 Register value, Register scratch1, 2993 Register value, Register scratch1,
3001 Register scratch2, Label* gc_required) { 2994 Register scratch2, Label* gc_required) {
3002 DCHECK(!result.is(constructor)); 2995 DCHECK(!result.is(constructor));
3003 DCHECK(!result.is(scratch1)); 2996 DCHECK(!result.is(scratch1));
3004 DCHECK(!result.is(scratch2)); 2997 DCHECK(!result.is(scratch2));
3005 DCHECK(!result.is(value)); 2998 DCHECK(!result.is(value));
3006 2999
3007 // Allocate JSValue in new space. 3000 // Allocate JSValue in new space.
3008 Allocate(JSValue::kSize, result, scratch1, scratch2, gc_required, TAG_OBJECT); 3001 Allocate(JSValue::kSize, result, scratch1, scratch2, gc_required,
3002 NO_ALLOCATION_FLAGS);
3009 3003
3010 // Initialize the JSValue. 3004 // Initialize the JSValue.
3011 LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2); 3005 LoadGlobalFunctionInitialMap(constructor, scratch1, scratch2);
3012 StoreP(scratch1, FieldMemOperand(result, HeapObject::kMapOffset), r0); 3006 StoreP(scratch1, FieldMemOperand(result, HeapObject::kMapOffset), r0);
3013 LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex); 3007 LoadRoot(scratch1, Heap::kEmptyFixedArrayRootIndex);
3014 StoreP(scratch1, FieldMemOperand(result, JSObject::kPropertiesOffset), r0); 3008 StoreP(scratch1, FieldMemOperand(result, JSObject::kPropertiesOffset), r0);
3015 StoreP(scratch1, FieldMemOperand(result, JSObject::kElementsOffset), r0); 3009 StoreP(scratch1, FieldMemOperand(result, JSObject::kElementsOffset), r0);
3016 StoreP(value, FieldMemOperand(result, JSValue::kValueOffset), r0); 3010 StoreP(value, FieldMemOperand(result, JSValue::kValueOffset), r0);
3017 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); 3011 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize);
3018 } 3012 }
(...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after
5424 } 5418 }
5425 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); 5419 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift));
5426 ExtractBit(r0, dividend, 31); 5420 ExtractBit(r0, dividend, 31);
5427 AddP(result, r0); 5421 AddP(result, r0);
5428 } 5422 }
5429 5423
5430 } // namespace internal 5424 } // namespace internal
5431 } // namespace v8 5425 } // namespace v8
5432 5426
5433 #endif // V8_TARGET_ARCH_S390 5427 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/s390/macro-assembler-s390.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698