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

Side by Side Diff: src/s390/code-stubs-s390.cc

Issue 2356483002: PPC/s390: Record call counts also for megamorphic calls. (Closed)
Patch Set: PPC/s390: Record call counts also for megamorphic calls. Created 4 years, 3 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/ppc/code-stubs-ppc.cc ('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 #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 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); 1855 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
1856 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset)); 1856 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset));
1857 __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); 1857 __ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
1858 __ JumpToJSEntry(ip); 1858 __ JumpToJSEntry(ip);
1859 1859
1860 __ bind(&non_function); 1860 __ bind(&non_function);
1861 __ LoadRR(r5, r3); 1861 __ LoadRR(r5, r3);
1862 __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 1862 __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
1863 } 1863 }
1864 1864
1865 // Note: feedback_vector and slot are clobbered after the call.
1866 static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
1867 Register slot, Register temp) {
1868 const int count_offset = FixedArray::kHeaderSize + kPointerSize;
1869 __ SmiToPtrArrayOffset(temp, slot);
1870 __ AddP(feedback_vector, feedback_vector, temp);
1871 __ LoadP(slot, FieldMemOperand(feedback_vector, count_offset));
1872 __ AddSmiLiteral(slot, slot, Smi::FromInt(1), temp);
1873 __ StoreP(slot, FieldMemOperand(feedback_vector, count_offset), temp);
1874 }
1875
1865 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { 1876 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
1866 // r3 - function 1877 // r3 - function
1867 // r5 - slot id 1878 // r5 - slot id
1868 // r4 - vector 1879 // r4 - vector
1869 // r6 - allocation site (loaded from vector[slot]) 1880 // r6 - allocation site (loaded from vector[slot])
1870 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7); 1881 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7);
1871 __ CmpP(r3, r7); 1882 __ CmpP(r3, r7);
1872 __ bne(miss); 1883 __ bne(miss);
1873 1884
1874 __ mov(r2, Operand(arg_count())); 1885 __ mov(r2, Operand(arg_count()));
1875 1886
1876 // Increment the call count for monomorphic function calls. 1887 // Increment the call count for monomorphic function calls.
1877 const int count_offset = FixedArray::kHeaderSize + kPointerSize; 1888 IncrementCallCount(masm, r4, r5, r1);
1878 __ SmiToPtrArrayOffset(r7, r5);
1879 __ AddP(r4, r4, r7);
1880 __ LoadP(r5, FieldMemOperand(r4, count_offset));
1881 __ AddSmiLiteral(r5, r5, Smi::FromInt(1), r0);
1882 __ StoreP(r5, FieldMemOperand(r4, count_offset), r0);
1883 1889
1884 __ LoadRR(r4, r6); 1890 __ LoadRR(r4, r6);
1885 __ LoadRR(r5, r3); 1891 __ LoadRR(r5, r3);
1886 ArrayConstructorStub stub(masm->isolate(), arg_count()); 1892 ArrayConstructorStub stub(masm->isolate(), arg_count());
1887 __ TailCallStub(&stub); 1893 __ TailCallStub(&stub);
1888 } 1894 }
1889 1895
1890 void CallICStub::Generate(MacroAssembler* masm) { 1896 void CallICStub::Generate(MacroAssembler* masm) {
1891 // r3 - function 1897 // r3 - function
1892 // r5 - slot id (Smi) 1898 // r5 - slot id (Smi)
1893 // r4 - vector 1899 // r4 - vector
1894 Label extra_checks_or_miss, call, call_function; 1900 Label extra_checks_or_miss, call, call_function, call_count_incremented;
1895 int argc = arg_count(); 1901 int argc = arg_count();
1896 ParameterCount actual(argc); 1902 ParameterCount actual(argc);
1897 1903
1898 // The checks. First, does r3 match the recorded monomorphic target? 1904 // The checks. First, does r3 match the recorded monomorphic target?
1899 __ SmiToPtrArrayOffset(r8, r5); 1905 __ SmiToPtrArrayOffset(r8, r5);
1900 __ AddP(r8, r4, r8); 1906 __ AddP(r8, r4, r8);
1901 __ LoadP(r6, FieldMemOperand(r8, FixedArray::kHeaderSize)); 1907 __ LoadP(r6, FieldMemOperand(r8, FixedArray::kHeaderSize));
1902 1908
1903 // We don't know that we have a weak cell. We might have a private symbol 1909 // We don't know that we have a weak cell. We might have a private symbol
1904 // or an AllocationSite, but the memory is safe to examine. 1910 // or an AllocationSite, but the memory is safe to examine.
(...skipping 10 matching lines...) Expand all
1915 WeakCell::kValueOffset == Symbol::kHashFieldSlot); 1921 WeakCell::kValueOffset == Symbol::kHashFieldSlot);
1916 1922
1917 __ LoadP(r7, FieldMemOperand(r6, WeakCell::kValueOffset)); 1923 __ LoadP(r7, FieldMemOperand(r6, WeakCell::kValueOffset));
1918 __ CmpP(r3, r7); 1924 __ CmpP(r3, r7);
1919 __ bne(&extra_checks_or_miss, Label::kNear); 1925 __ bne(&extra_checks_or_miss, Label::kNear);
1920 1926
1921 // The compare above could have been a SMI/SMI comparison. Guard against this 1927 // The compare above could have been a SMI/SMI comparison. Guard against this
1922 // convincing us that we have a monomorphic JSFunction. 1928 // convincing us that we have a monomorphic JSFunction.
1923 __ JumpIfSmi(r3, &extra_checks_or_miss); 1929 __ JumpIfSmi(r3, &extra_checks_or_miss);
1924 1930
1931 __ bind(&call_function);
1932
1925 // Increment the call count for monomorphic function calls. 1933 // Increment the call count for monomorphic function calls.
1926 const int count_offset = FixedArray::kHeaderSize + kPointerSize; 1934 IncrementCallCount(masm, r4, r5, r1);
1927 __ LoadP(r5, FieldMemOperand(r8, count_offset));
1928 __ AddSmiLiteral(r5, r5, Smi::FromInt(1), r0);
1929 __ StoreP(r5, FieldMemOperand(r8, count_offset), r0);
1930 1935
1931 __ bind(&call_function);
1932 __ mov(r2, Operand(argc)); 1936 __ mov(r2, Operand(argc));
1933 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), 1937 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
1934 tail_call_mode()), 1938 tail_call_mode()),
1935 RelocInfo::CODE_TARGET); 1939 RelocInfo::CODE_TARGET);
1936 1940
1937 __ bind(&extra_checks_or_miss); 1941 __ bind(&extra_checks_or_miss);
1938 Label uninitialized, miss, not_allocation_site; 1942 Label uninitialized, miss, not_allocation_site;
1939 1943
1940 __ CompareRoot(r6, Heap::kmegamorphic_symbolRootIndex); 1944 __ CompareRoot(r6, Heap::kmegamorphic_symbolRootIndex);
1941 __ beq(&call); 1945 __ beq(&call);
(...skipping 19 matching lines...) Expand all
1961 1965
1962 // We are going megamorphic. If the feedback is a JSFunction, it is fine 1966 // We are going megamorphic. If the feedback is a JSFunction, it is fine
1963 // to handle it here. More complex cases are dealt with in the runtime. 1967 // to handle it here. More complex cases are dealt with in the runtime.
1964 __ AssertNotSmi(r6); 1968 __ AssertNotSmi(r6);
1965 __ CompareObjectType(r6, r7, r7, JS_FUNCTION_TYPE); 1969 __ CompareObjectType(r6, r7, r7, JS_FUNCTION_TYPE);
1966 __ bne(&miss); 1970 __ bne(&miss);
1967 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); 1971 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex);
1968 __ StoreP(ip, FieldMemOperand(r8, FixedArray::kHeaderSize), r0); 1972 __ StoreP(ip, FieldMemOperand(r8, FixedArray::kHeaderSize), r0);
1969 1973
1970 __ bind(&call); 1974 __ bind(&call);
1975
1976 // Increment the call count for megamorphic function calls.
1977 IncrementCallCount(masm, r4, r5, r1);
1978
1979 __ bind(&call_count_incremented);
1971 __ mov(r2, Operand(argc)); 1980 __ mov(r2, Operand(argc));
1972 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), 1981 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
1973 RelocInfo::CODE_TARGET); 1982 RelocInfo::CODE_TARGET);
1974 1983
1975 __ bind(&uninitialized); 1984 __ bind(&uninitialized);
1976 1985
1977 // We are going monomorphic, provided we actually have a JSFunction. 1986 // We are going monomorphic, provided we actually have a JSFunction.
1978 __ JumpIfSmi(r3, &miss); 1987 __ JumpIfSmi(r3, &miss);
1979 1988
1980 // Goto miss case if we do not have a function. 1989 // Goto miss case if we do not have a function.
1981 __ CompareObjectType(r3, r6, r6, JS_FUNCTION_TYPE); 1990 __ CompareObjectType(r3, r6, r6, JS_FUNCTION_TYPE);
1982 __ bne(&miss); 1991 __ bne(&miss);
1983 1992
1984 // Make sure the function is not the Array() function, which requires special 1993 // Make sure the function is not the Array() function, which requires special
1985 // behavior on MISS. 1994 // behavior on MISS.
1986 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r6); 1995 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r6);
1987 __ CmpP(r3, r6); 1996 __ CmpP(r3, r6);
1988 __ beq(&miss); 1997 __ beq(&miss);
1989 1998
1990 // Make sure the function belongs to the same native context. 1999 // Make sure the function belongs to the same native context.
1991 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kContextOffset)); 2000 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kContextOffset));
1992 __ LoadP(r6, ContextMemOperand(r6, Context::NATIVE_CONTEXT_INDEX)); 2001 __ LoadP(r6, ContextMemOperand(r6, Context::NATIVE_CONTEXT_INDEX));
1993 __ LoadP(ip, NativeContextMemOperand()); 2002 __ LoadP(ip, NativeContextMemOperand());
1994 __ CmpP(r6, ip); 2003 __ CmpP(r6, ip);
1995 __ bne(&miss); 2004 __ bne(&miss);
1996 2005
1997 // Initialize the call counter.
1998 __ LoadSmiLiteral(r7, Smi::FromInt(1));
1999 __ StoreP(r7, FieldMemOperand(r8, count_offset), r0);
2000
2001 // Store the function. Use a stub since we need a frame for allocation. 2006 // Store the function. Use a stub since we need a frame for allocation.
2002 // r4 - vector 2007 // r4 - vector
2003 // r5 - slot 2008 // r5 - slot
2004 // r3 - function 2009 // r3 - function
2005 { 2010 {
2006 FrameScope scope(masm, StackFrame::INTERNAL); 2011 FrameScope scope(masm, StackFrame::INTERNAL);
2007 CreateWeakCellStub create_stub(masm->isolate()); 2012 CreateWeakCellStub create_stub(masm->isolate());
2013 __ Push(r4);
2014 __ Push(r5);
2008 __ Push(cp, r3); 2015 __ Push(cp, r3);
2009 __ CallStub(&create_stub); 2016 __ CallStub(&create_stub);
2010 __ Pop(cp, r3); 2017 __ Pop(cp, r3);
2018 __ Pop(r5);
2019 __ Pop(r4);
2011 } 2020 }
2012 2021
2013 __ b(&call_function); 2022 __ b(&call_function);
2014 2023
2015 // We are here because tracing is on or we encountered a MISS case we can't 2024 // We are here because tracing is on or we encountered a MISS case we can't
2016 // handle here. 2025 // handle here.
2017 __ bind(&miss); 2026 __ bind(&miss);
2018 GenerateMiss(masm); 2027 GenerateMiss(masm);
2019 2028
2020 __ b(&call); 2029 __ b(&call_count_incremented);
2021 } 2030 }
2022 2031
2023 void CallICStub::GenerateMiss(MacroAssembler* masm) { 2032 void CallICStub::GenerateMiss(MacroAssembler* masm) {
2024 FrameScope scope(masm, StackFrame::INTERNAL); 2033 FrameScope scope(masm, StackFrame::INTERNAL);
2025 2034
2026 // Push the function and feedback info. 2035 // Push the function and feedback info.
2027 __ Push(r3, r4, r5); 2036 __ Push(r3, r4, r5);
2028 2037
2029 // Call the entry. 2038 // Call the entry.
2030 __ CallRuntime(Runtime::kCallIC_Miss); 2039 __ CallRuntime(Runtime::kCallIC_Miss);
(...skipping 3315 matching lines...) Expand 10 before | Expand all | Expand 10 after
5346 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5355 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5347 kStackUnwindSpace, NULL, return_value_operand, NULL); 5356 kStackUnwindSpace, NULL, return_value_operand, NULL);
5348 } 5357 }
5349 5358
5350 #undef __ 5359 #undef __
5351 5360
5352 } // namespace internal 5361 } // namespace internal
5353 } // namespace v8 5362 } // namespace v8
5354 5363
5355 #endif // V8_TARGET_ARCH_S390 5364 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/ppc/code-stubs-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698