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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 // Calculate new top using result. | 1840 // Calculate new top using result. |
1841 AddP(result_end, result, Operand(object_size)); | 1841 AddP(result_end, result, Operand(object_size)); |
1842 | 1842 |
1843 // The top pointer is not updated for allocation folding dominators. | 1843 // The top pointer is not updated for allocation folding dominators. |
1844 StoreP(result_end, MemOperand(top_address)); | 1844 StoreP(result_end, MemOperand(top_address)); |
1845 | 1845 |
1846 // Tag object. | 1846 // Tag object. |
1847 AddP(result, result, Operand(kHeapObjectTag)); | 1847 AddP(result, result, Operand(kHeapObjectTag)); |
1848 } | 1848 } |
1849 | 1849 |
1850 void MacroAssembler::AllocateTwoByteString(Register result, Register length, | |
1851 Register scratch1, Register scratch2, | |
1852 Register scratch3, | |
1853 Label* gc_required) { | |
1854 // Calculate the number of bytes needed for the characters in the string while | |
1855 // observing object alignment. | |
1856 DCHECK((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
1857 | |
1858 ShiftLeftP(scratch1, length, Operand(1)); // Length in bytes, not chars. | |
1859 AddP(scratch1, Operand(kObjectAlignmentMask + SeqTwoByteString::kHeaderSize)); | |
1860 | |
1861 AndP(scratch1, Operand(~kObjectAlignmentMask)); | |
1862 | |
1863 // Allocate two-byte string in new space. | |
1864 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
1865 NO_ALLOCATION_FLAGS); | |
1866 | |
1867 // Set the map, length and hash field. | |
1868 InitializeNewString(result, length, Heap::kStringMapRootIndex, scratch1, | |
1869 scratch2); | |
1870 } | |
1871 | |
1872 void MacroAssembler::AllocateOneByteString(Register result, Register length, | |
1873 Register scratch1, Register scratch2, | |
1874 Register scratch3, | |
1875 Label* gc_required) { | |
1876 // Calculate the number of bytes needed for the characters in the string while | |
1877 // observing object alignment. | |
1878 DCHECK((SeqOneByteString::kHeaderSize & kObjectAlignmentMask) == 0); | |
1879 DCHECK(kCharSize == 1); | |
1880 AddP(scratch1, length, | |
1881 Operand(kObjectAlignmentMask + SeqOneByteString::kHeaderSize)); | |
1882 AndP(scratch1, Operand(~kObjectAlignmentMask)); | |
1883 | |
1884 // Allocate one-byte string in new space. | |
1885 Allocate(scratch1, result, scratch2, scratch3, gc_required, | |
1886 NO_ALLOCATION_FLAGS); | |
1887 | |
1888 // Set the map, length and hash field. | |
1889 InitializeNewString(result, length, Heap::kOneByteStringMapRootIndex, | |
1890 scratch1, scratch2); | |
1891 } | |
1892 | |
1893 void MacroAssembler::AllocateTwoByteConsString(Register result, Register length, | |
1894 Register scratch1, | |
1895 Register scratch2, | |
1896 Label* gc_required) { | |
1897 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
1898 NO_ALLOCATION_FLAGS); | |
1899 | |
1900 InitializeNewString(result, length, Heap::kConsStringMapRootIndex, scratch1, | |
1901 scratch2); | |
1902 } | |
1903 | |
1904 void MacroAssembler::AllocateOneByteConsString(Register result, Register length, | |
1905 Register scratch1, | |
1906 Register scratch2, | |
1907 Label* gc_required) { | |
1908 Allocate(ConsString::kSize, result, scratch1, scratch2, gc_required, | |
1909 NO_ALLOCATION_FLAGS); | |
1910 | |
1911 InitializeNewString(result, length, Heap::kConsOneByteStringMapRootIndex, | |
1912 scratch1, scratch2); | |
1913 } | |
1914 | |
1915 void MacroAssembler::AllocateTwoByteSlicedString(Register result, | |
1916 Register length, | |
1917 Register scratch1, | |
1918 Register scratch2, | |
1919 Label* gc_required) { | |
1920 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
1921 NO_ALLOCATION_FLAGS); | |
1922 | |
1923 InitializeNewString(result, length, Heap::kSlicedStringMapRootIndex, scratch1, | |
1924 scratch2); | |
1925 } | |
1926 | |
1927 void MacroAssembler::AllocateOneByteSlicedString(Register result, | |
1928 Register length, | |
1929 Register scratch1, | |
1930 Register scratch2, | |
1931 Label* gc_required) { | |
1932 Allocate(SlicedString::kSize, result, scratch1, scratch2, gc_required, | |
1933 NO_ALLOCATION_FLAGS); | |
1934 | |
1935 InitializeNewString(result, length, Heap::kSlicedOneByteStringMapRootIndex, | |
1936 scratch1, scratch2); | |
1937 } | |
1938 | |
1939 void MacroAssembler::CompareObjectType(Register object, Register map, | 1850 void MacroAssembler::CompareObjectType(Register object, Register map, |
1940 Register type_reg, InstanceType type) { | 1851 Register type_reg, InstanceType type) { |
1941 const Register temp = type_reg.is(no_reg) ? r0 : type_reg; | 1852 const Register temp = type_reg.is(no_reg) ? r0 : type_reg; |
1942 | 1853 |
1943 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 1854 LoadP(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
1944 CompareInstanceType(map, temp, type); | 1855 CompareInstanceType(map, temp, type); |
1945 } | 1856 } |
1946 | 1857 |
1947 void MacroAssembler::CompareInstanceType(Register map, Register type_reg, | 1858 void MacroAssembler::CompareInstanceType(Register map, Register type_reg, |
1948 InstanceType type) { | 1859 InstanceType type) { |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 if (!scratch1.is(first)) LoadRR(scratch1, first); | 2697 if (!scratch1.is(first)) LoadRR(scratch1, first); |
2787 if (!scratch2.is(second)) LoadRR(scratch2, second); | 2698 if (!scratch2.is(second)) LoadRR(scratch2, second); |
2788 nilf(scratch1, Operand(kFlatOneByteStringMask)); | 2699 nilf(scratch1, Operand(kFlatOneByteStringMask)); |
2789 CmpP(scratch1, Operand(kFlatOneByteStringTag)); | 2700 CmpP(scratch1, Operand(kFlatOneByteStringTag)); |
2790 bne(failure); | 2701 bne(failure); |
2791 nilf(scratch2, Operand(kFlatOneByteStringMask)); | 2702 nilf(scratch2, Operand(kFlatOneByteStringMask)); |
2792 CmpP(scratch2, Operand(kFlatOneByteStringTag)); | 2703 CmpP(scratch2, Operand(kFlatOneByteStringTag)); |
2793 bne(failure); | 2704 bne(failure); |
2794 } | 2705 } |
2795 | 2706 |
2796 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialOneByte(Register type, | |
2797 Register scratch, | |
2798 Label* failure) { | |
2799 const int kFlatOneByteStringMask = | |
2800 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | |
2801 const int kFlatOneByteStringTag = | |
2802 kStringTag | kOneByteStringTag | kSeqStringTag; | |
2803 | |
2804 if (!scratch.is(type)) LoadRR(scratch, type); | |
2805 nilf(scratch, Operand(kFlatOneByteStringMask)); | |
2806 CmpP(scratch, Operand(kFlatOneByteStringTag)); | |
2807 bne(failure); | |
2808 } | |
2809 | |
2810 static const int kRegisterPassedArguments = 5; | 2707 static const int kRegisterPassedArguments = 5; |
2811 | 2708 |
2812 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, | 2709 int MacroAssembler::CalculateStackPassedWords(int num_reg_arguments, |
2813 int num_double_arguments) { | 2710 int num_double_arguments) { |
2814 int stack_passed_words = 0; | 2711 int stack_passed_words = 0; |
2815 if (num_double_arguments > DoubleRegister::kNumRegisters) { | 2712 if (num_double_arguments > DoubleRegister::kNumRegisters) { |
2816 stack_passed_words += | 2713 stack_passed_words += |
2817 2 * (num_double_arguments - DoubleRegister::kNumRegisters); | 2714 2 * (num_double_arguments - DoubleRegister::kNumRegisters); |
2818 } | 2715 } |
2819 // Up to five simple arguments are passed in registers r2..r6 | 2716 // Up to five simple arguments are passed in registers r2..r6 |
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5183 } | 5080 } |
5184 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5081 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5185 ExtractBit(r0, dividend, 31); | 5082 ExtractBit(r0, dividend, 31); |
5186 AddP(result, r0); | 5083 AddP(result, r0); |
5187 } | 5084 } |
5188 | 5085 |
5189 } // namespace internal | 5086 } // namespace internal |
5190 } // namespace v8 | 5087 } // namespace v8 |
5191 | 5088 |
5192 #endif // V8_TARGET_ARCH_S390 | 5089 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |