| 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 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 Register slot, Register temp) { | 1867 Register slot, Register temp) { |
| 1868 const int count_offset = FixedArray::kHeaderSize + kPointerSize; | 1868 const int count_offset = FixedArray::kHeaderSize + kPointerSize; |
| 1869 __ SmiToPtrArrayOffset(temp, slot); | 1869 __ SmiToPtrArrayOffset(temp, slot); |
| 1870 __ AddP(feedback_vector, feedback_vector, temp); | 1870 __ AddP(feedback_vector, feedback_vector, temp); |
| 1871 __ LoadP(slot, FieldMemOperand(feedback_vector, count_offset)); | 1871 __ LoadP(slot, FieldMemOperand(feedback_vector, count_offset)); |
| 1872 __ AddSmiLiteral(slot, slot, Smi::FromInt(1), temp); | 1872 __ AddSmiLiteral(slot, slot, Smi::FromInt(1), temp); |
| 1873 __ StoreP(slot, FieldMemOperand(feedback_vector, count_offset), temp); | 1873 __ StoreP(slot, FieldMemOperand(feedback_vector, count_offset), temp); |
| 1874 } | 1874 } |
| 1875 | 1875 |
| 1876 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { | 1876 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
| 1877 // r2 - number of arguments |
| 1877 // r3 - function | 1878 // r3 - function |
| 1878 // r5 - slot id | 1879 // r5 - slot id |
| 1879 // r4 - vector | 1880 // r4 - vector |
| 1880 // r6 - allocation site (loaded from vector[slot]) | 1881 // r6 - allocation site (loaded from vector[slot]) |
| 1881 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7); | 1882 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7); |
| 1882 __ CmpP(r3, r7); | 1883 __ CmpP(r3, r7); |
| 1883 __ bne(miss); | 1884 __ bne(miss); |
| 1884 | 1885 |
| 1885 // Increment the call count for monomorphic function calls. | 1886 // Increment the call count for monomorphic function calls. |
| 1886 IncrementCallCount(masm, r4, r5, r1); | 1887 IncrementCallCount(masm, r4, r5, r1); |
| 1887 | 1888 |
| 1888 __ LoadRR(r4, r6); | 1889 __ LoadRR(r4, r6); |
| 1889 __ LoadRR(r5, r3); | 1890 __ LoadRR(r5, r3); |
| 1890 __ mov(r2, Operand(arg_count())); | |
| 1891 ArrayConstructorStub stub(masm->isolate()); | 1891 ArrayConstructorStub stub(masm->isolate()); |
| 1892 __ TailCallStub(&stub); | 1892 __ TailCallStub(&stub); |
| 1893 } | 1893 } |
| 1894 | 1894 |
| 1895 void CallICStub::Generate(MacroAssembler* masm) { | 1895 void CallICStub::Generate(MacroAssembler* masm) { |
| 1896 // r2 - number of arguments |
| 1896 // r3 - function | 1897 // r3 - function |
| 1897 // r5 - slot id (Smi) | 1898 // r5 - slot id (Smi) |
| 1898 // r4 - vector | 1899 // r4 - vector |
| 1899 Label extra_checks_or_miss, call, call_function, call_count_incremented; | 1900 Label extra_checks_or_miss, call, call_function, call_count_incremented; |
| 1900 int argc = arg_count(); | |
| 1901 ParameterCount actual(argc); | |
| 1902 | 1901 |
| 1903 // The checks. First, does r3 match the recorded monomorphic target? | 1902 // The checks. First, does r3 match the recorded monomorphic target? |
| 1904 __ SmiToPtrArrayOffset(r8, r5); | 1903 __ SmiToPtrArrayOffset(r8, r5); |
| 1905 __ AddP(r8, r4, r8); | 1904 __ AddP(r8, r4, r8); |
| 1906 __ LoadP(r6, FieldMemOperand(r8, FixedArray::kHeaderSize)); | 1905 __ LoadP(r6, FieldMemOperand(r8, FixedArray::kHeaderSize)); |
| 1907 | 1906 |
| 1908 // We don't know that we have a weak cell. We might have a private symbol | 1907 // We don't know that we have a weak cell. We might have a private symbol |
| 1909 // or an AllocationSite, but the memory is safe to examine. | 1908 // or an AllocationSite, but the memory is safe to examine. |
| 1910 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | 1909 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
| 1911 // FixedArray. | 1910 // FixedArray. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1925 | 1924 |
| 1926 // The compare above could have been a SMI/SMI comparison. Guard against this | 1925 // The compare above could have been a SMI/SMI comparison. Guard against this |
| 1927 // convincing us that we have a monomorphic JSFunction. | 1926 // convincing us that we have a monomorphic JSFunction. |
| 1928 __ JumpIfSmi(r3, &extra_checks_or_miss); | 1927 __ JumpIfSmi(r3, &extra_checks_or_miss); |
| 1929 | 1928 |
| 1930 __ bind(&call_function); | 1929 __ bind(&call_function); |
| 1931 | 1930 |
| 1932 // Increment the call count for monomorphic function calls. | 1931 // Increment the call count for monomorphic function calls. |
| 1933 IncrementCallCount(masm, r4, r5, r1); | 1932 IncrementCallCount(masm, r4, r5, r1); |
| 1934 | 1933 |
| 1935 __ mov(r2, Operand(argc)); | |
| 1936 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), | 1934 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), |
| 1937 tail_call_mode()), | 1935 tail_call_mode()), |
| 1938 RelocInfo::CODE_TARGET); | 1936 RelocInfo::CODE_TARGET); |
| 1939 | 1937 |
| 1940 __ bind(&extra_checks_or_miss); | 1938 __ bind(&extra_checks_or_miss); |
| 1941 Label uninitialized, miss, not_allocation_site; | 1939 Label uninitialized, miss, not_allocation_site; |
| 1942 | 1940 |
| 1943 __ CompareRoot(r6, Heap::kmegamorphic_symbolRootIndex); | 1941 __ CompareRoot(r6, Heap::kmegamorphic_symbolRootIndex); |
| 1944 __ beq(&call); | 1942 __ beq(&call); |
| 1945 | 1943 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1969 __ bne(&miss); | 1967 __ bne(&miss); |
| 1970 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); | 1968 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
| 1971 __ StoreP(ip, FieldMemOperand(r8, FixedArray::kHeaderSize), r0); | 1969 __ StoreP(ip, FieldMemOperand(r8, FixedArray::kHeaderSize), r0); |
| 1972 | 1970 |
| 1973 __ bind(&call); | 1971 __ bind(&call); |
| 1974 | 1972 |
| 1975 // Increment the call count for megamorphic function calls. | 1973 // Increment the call count for megamorphic function calls. |
| 1976 IncrementCallCount(masm, r4, r5, r1); | 1974 IncrementCallCount(masm, r4, r5, r1); |
| 1977 | 1975 |
| 1978 __ bind(&call_count_incremented); | 1976 __ bind(&call_count_incremented); |
| 1979 __ mov(r2, Operand(argc)); | |
| 1980 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), | 1977 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), |
| 1981 RelocInfo::CODE_TARGET); | 1978 RelocInfo::CODE_TARGET); |
| 1982 | 1979 |
| 1983 __ bind(&uninitialized); | 1980 __ bind(&uninitialized); |
| 1984 | 1981 |
| 1985 // We are going monomorphic, provided we actually have a JSFunction. | 1982 // We are going monomorphic, provided we actually have a JSFunction. |
| 1986 __ JumpIfSmi(r3, &miss); | 1983 __ JumpIfSmi(r3, &miss); |
| 1987 | 1984 |
| 1988 // Goto miss case if we do not have a function. | 1985 // Goto miss case if we do not have a function. |
| 1989 __ CompareObjectType(r3, r6, r6, JS_FUNCTION_TYPE); | 1986 __ CompareObjectType(r3, r6, r6, JS_FUNCTION_TYPE); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2002 __ CmpP(r6, ip); | 1999 __ CmpP(r6, ip); |
| 2003 __ bne(&miss); | 2000 __ bne(&miss); |
| 2004 | 2001 |
| 2005 // Store the function. Use a stub since we need a frame for allocation. | 2002 // Store the function. Use a stub since we need a frame for allocation. |
| 2006 // r4 - vector | 2003 // r4 - vector |
| 2007 // r5 - slot | 2004 // r5 - slot |
| 2008 // r3 - function | 2005 // r3 - function |
| 2009 { | 2006 { |
| 2010 FrameScope scope(masm, StackFrame::INTERNAL); | 2007 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2011 CreateWeakCellStub create_stub(masm->isolate()); | 2008 CreateWeakCellStub create_stub(masm->isolate()); |
| 2012 __ Push(r4); | 2009 __ SmiTag(r2); |
| 2013 __ Push(r5); | 2010 __ Push(r2, r4, r5, cp, r3); |
| 2014 __ Push(cp, r3); | |
| 2015 __ CallStub(&create_stub); | 2011 __ CallStub(&create_stub); |
| 2016 __ Pop(cp, r3); | 2012 __ Pop(r4, r5, cp, r3); |
| 2017 __ Pop(r5); | 2013 __ Pop(r2); |
| 2018 __ Pop(r4); | 2014 __ SmiUntag(r2); |
| 2019 } | 2015 } |
| 2020 | 2016 |
| 2021 __ b(&call_function); | 2017 __ b(&call_function); |
| 2022 | 2018 |
| 2023 // We are here because tracing is on or we encountered a MISS case we can't | 2019 // We are here because tracing is on or we encountered a MISS case we can't |
| 2024 // handle here. | 2020 // handle here. |
| 2025 __ bind(&miss); | 2021 __ bind(&miss); |
| 2026 GenerateMiss(masm); | 2022 GenerateMiss(masm); |
| 2027 | 2023 |
| 2028 __ b(&call_count_incremented); | 2024 __ b(&call_count_incremented); |
| 2029 } | 2025 } |
| 2030 | 2026 |
| 2031 void CallICStub::GenerateMiss(MacroAssembler* masm) { | 2027 void CallICStub::GenerateMiss(MacroAssembler* masm) { |
| 2032 FrameScope scope(masm, StackFrame::INTERNAL); | 2028 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2033 | 2029 |
| 2034 // Push the function and feedback info. | 2030 // Preserve the number of arguments as Smi. |
| 2035 __ Push(r3, r4, r5); | 2031 __ SmiTag(r2); |
| 2032 |
| 2033 // Push the receiver and the function and feedback info. |
| 2034 __ Push(r2, r3, r4, r5); |
| 2036 | 2035 |
| 2037 // Call the entry. | 2036 // Call the entry. |
| 2038 __ CallRuntime(Runtime::kCallIC_Miss); | 2037 __ CallRuntime(Runtime::kCallIC_Miss); |
| 2039 | 2038 |
| 2040 // Move result to r3 and exit the internal frame. | 2039 // Move result to r3 and exit the internal frame. |
| 2041 __ LoadRR(r3, r2); | 2040 __ LoadRR(r3, r2); |
| 2041 |
| 2042 // Restore number of arguments. |
| 2043 __ Pop(r2); |
| 2044 __ SmiUntag(r2); |
| 2042 } | 2045 } |
| 2043 | 2046 |
| 2044 // StringCharCodeAtGenerator | 2047 // StringCharCodeAtGenerator |
| 2045 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { | 2048 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { |
| 2046 // If the receiver is a smi trigger the non-string case. | 2049 // If the receiver is a smi trigger the non-string case. |
| 2047 if (check_mode_ == RECEIVER_IS_UNKNOWN) { | 2050 if (check_mode_ == RECEIVER_IS_UNKNOWN) { |
| 2048 __ JumpIfSmi(object_, receiver_not_string_); | 2051 __ JumpIfSmi(object_, receiver_not_string_); |
| 2049 | 2052 |
| 2050 // Fetch the instance type of the receiver into result register. | 2053 // Fetch the instance type of the receiver into result register. |
| 2051 __ LoadP(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); | 2054 __ LoadP(result_, FieldMemOperand(object_, HeapObject::kMapOffset)); |
| (...skipping 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5056 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5059 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
| 5057 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5060 kStackUnwindSpace, NULL, return_value_operand, NULL); |
| 5058 } | 5061 } |
| 5059 | 5062 |
| 5060 #undef __ | 5063 #undef __ |
| 5061 | 5064 |
| 5062 } // namespace internal | 5065 } // namespace internal |
| 5063 } // namespace v8 | 5066 } // namespace v8 |
| 5064 | 5067 |
| 5065 #endif // V8_TARGET_ARCH_S390 | 5068 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |