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

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

Issue 2412453005: [stubs] Refactor the CallICStub to pass the number of arguments. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 __ add(feedback_vector, feedback_vector, 1777 __ add(feedback_vector, feedback_vector,
1778 Operand::PointerOffsetFromSmiKey(slot)); 1778 Operand::PointerOffsetFromSmiKey(slot));
1779 __ add(feedback_vector, feedback_vector, 1779 __ add(feedback_vector, feedback_vector,
1780 Operand(FixedArray::kHeaderSize + kPointerSize)); 1780 Operand(FixedArray::kHeaderSize + kPointerSize));
1781 __ ldr(slot, FieldMemOperand(feedback_vector, 0)); 1781 __ ldr(slot, FieldMemOperand(feedback_vector, 0));
1782 __ add(slot, slot, Operand(Smi::FromInt(1))); 1782 __ add(slot, slot, Operand(Smi::FromInt(1)));
1783 __ str(slot, FieldMemOperand(feedback_vector, 0)); 1783 __ str(slot, FieldMemOperand(feedback_vector, 0));
1784 } 1784 }
1785 1785
1786 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { 1786 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
1787 // r0 - number of arguments
1787 // r1 - function 1788 // r1 - function
1788 // r3 - slot id 1789 // r3 - slot id
1789 // r2 - vector 1790 // r2 - vector
1790 // r4 - allocation site (loaded from vector[slot]) 1791 // r4 - allocation site (loaded from vector[slot])
1791 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5); 1792 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5);
1792 __ cmp(r1, r5); 1793 __ cmp(r1, r5);
1793 __ b(ne, miss); 1794 __ b(ne, miss);
1794 1795
1795 // Increment the call count for monomorphic function calls. 1796 // Increment the call count for monomorphic function calls.
1796 IncrementCallCount(masm, r2, r3); 1797 IncrementCallCount(masm, r2, r3);
1797 1798
1798 __ mov(r2, r4); 1799 __ mov(r2, r4);
1799 __ mov(r3, r1); 1800 __ mov(r3, r1);
1800 __ mov(r0, Operand(arg_count()));
1801 ArrayConstructorStub stub(masm->isolate()); 1801 ArrayConstructorStub stub(masm->isolate());
1802 __ TailCallStub(&stub); 1802 __ TailCallStub(&stub);
1803 } 1803 }
1804 1804
1805 1805
1806 void CallICStub::Generate(MacroAssembler* masm) { 1806 void CallICStub::Generate(MacroAssembler* masm) {
1807 // r0 - number of arguments
1807 // r1 - function 1808 // r1 - function
1808 // r3 - slot id (Smi) 1809 // r3 - slot id (Smi)
1809 // r2 - vector 1810 // r2 - vector
1810 Label extra_checks_or_miss, call, call_function, call_count_incremented; 1811 Label extra_checks_or_miss, call, call_function, call_count_incremented;
1811 int argc = arg_count();
1812 ParameterCount actual(argc);
1813 1812
1814 // The checks. First, does r1 match the recorded monomorphic target? 1813 // The checks. First, does r1 match the recorded monomorphic target?
1815 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 1814 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
1816 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); 1815 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize));
1817 1816
1818 // We don't know that we have a weak cell. We might have a private symbol 1817 // We don't know that we have a weak cell. We might have a private symbol
1819 // or an AllocationSite, but the memory is safe to examine. 1818 // or an AllocationSite, but the memory is safe to examine.
1820 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to 1819 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to
1821 // FixedArray. 1820 // FixedArray.
1822 // WeakCell::kValueOffset - contains a JSFunction or Smi(0) 1821 // WeakCell::kValueOffset - contains a JSFunction or Smi(0)
(...skipping 12 matching lines...) Expand all
1835 1834
1836 // The compare above could have been a SMI/SMI comparison. Guard against this 1835 // The compare above could have been a SMI/SMI comparison. Guard against this
1837 // convincing us that we have a monomorphic JSFunction. 1836 // convincing us that we have a monomorphic JSFunction.
1838 __ JumpIfSmi(r1, &extra_checks_or_miss); 1837 __ JumpIfSmi(r1, &extra_checks_or_miss);
1839 1838
1840 __ bind(&call_function); 1839 __ bind(&call_function);
1841 1840
1842 // Increment the call count for monomorphic function calls. 1841 // Increment the call count for monomorphic function calls.
1843 IncrementCallCount(masm, r2, r3); 1842 IncrementCallCount(masm, r2, r3);
1844 1843
1845 __ mov(r0, Operand(argc));
1846 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), 1844 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
1847 tail_call_mode()), 1845 tail_call_mode()),
1848 RelocInfo::CODE_TARGET); 1846 RelocInfo::CODE_TARGET);
1849 1847
1850 __ bind(&extra_checks_or_miss); 1848 __ bind(&extra_checks_or_miss);
1851 Label uninitialized, miss, not_allocation_site; 1849 Label uninitialized, miss, not_allocation_site;
1852 1850
1853 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); 1851 __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex);
1854 __ b(eq, &call); 1852 __ b(eq, &call);
1855 1853
(...skipping 24 matching lines...) Expand all
1880 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); 1878 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3));
1881 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); 1879 __ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex);
1882 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); 1880 __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize));
1883 1881
1884 __ bind(&call); 1882 __ bind(&call);
1885 1883
1886 // Increment the call count for megamorphic function calls. 1884 // Increment the call count for megamorphic function calls.
1887 IncrementCallCount(masm, r2, r3); 1885 IncrementCallCount(masm, r2, r3);
1888 1886
1889 __ bind(&call_count_incremented); 1887 __ bind(&call_count_incremented);
1890 __ mov(r0, Operand(argc));
1891 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), 1888 __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
1892 RelocInfo::CODE_TARGET); 1889 RelocInfo::CODE_TARGET);
1893 1890
1894 __ bind(&uninitialized); 1891 __ bind(&uninitialized);
1895 1892
1896 // We are going monomorphic, provided we actually have a JSFunction. 1893 // We are going monomorphic, provided we actually have a JSFunction.
1897 __ JumpIfSmi(r1, &miss); 1894 __ JumpIfSmi(r1, &miss);
1898 1895
1899 // Goto miss case if we do not have a function. 1896 // Goto miss case if we do not have a function.
1900 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); 1897 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE);
(...skipping 12 matching lines...) Expand all
1913 __ cmp(r4, ip); 1910 __ cmp(r4, ip);
1914 __ b(ne, &miss); 1911 __ b(ne, &miss);
1915 1912
1916 // Store the function. Use a stub since we need a frame for allocation. 1913 // Store the function. Use a stub since we need a frame for allocation.
1917 // r2 - vector 1914 // r2 - vector
1918 // r3 - slot 1915 // r3 - slot
1919 // r1 - function 1916 // r1 - function
1920 { 1917 {
1921 FrameScope scope(masm, StackFrame::INTERNAL); 1918 FrameScope scope(masm, StackFrame::INTERNAL);
1922 CreateWeakCellStub create_stub(masm->isolate()); 1919 CreateWeakCellStub create_stub(masm->isolate());
1923 __ Push(r2); 1920 __ SmiTag(r0);
1924 __ Push(r3); 1921 __ Push(r0, r2, r3, cp, r1);
1925 __ Push(cp, r1);
1926 __ CallStub(&create_stub); 1922 __ CallStub(&create_stub);
1927 __ Pop(cp, r1); 1923 __ Pop(r2, r3, cp, r1);
1928 __ Pop(r3); 1924 __ Pop(r0);
1929 __ Pop(r2); 1925 __ SmiUntag(r0);
1930 } 1926 }
1931 1927
1932 __ jmp(&call_function); 1928 __ jmp(&call_function);
1933 1929
1934 // We are here because tracing is on or we encountered a MISS case we can't 1930 // We are here because tracing is on or we encountered a MISS case we can't
1935 // handle here. 1931 // handle here.
1936 __ bind(&miss); 1932 __ bind(&miss);
1937 GenerateMiss(masm); 1933 GenerateMiss(masm);
1938 1934
1939 __ jmp(&call_count_incremented); 1935 __ jmp(&call_count_incremented);
1940 } 1936 }
1941 1937
1942 1938
1943 void CallICStub::GenerateMiss(MacroAssembler* masm) { 1939 void CallICStub::GenerateMiss(MacroAssembler* masm) {
1944 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); 1940 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1945 1941
1942 // Preserve the number of arguments as Smi.
1943 __ SmiTag(r0);
1944
1946 // Push the receiver and the function and feedback info. 1945 // Push the receiver and the function and feedback info.
1947 __ Push(r1, r2, r3); 1946 __ Push(r0, r1, r2, r3);
1948 1947
1949 // Call the entry. 1948 // Call the entry.
1950 __ CallRuntime(Runtime::kCallIC_Miss); 1949 __ CallRuntime(Runtime::kCallIC_Miss);
1951 1950
1952 // Move result to edi and exit the internal frame. 1951 // Move result to edi and exit the internal frame.
1953 __ mov(r1, r0); 1952 __ mov(r1, r0);
1953
1954 // Restore number of arguments.
1955 __ Pop(r0);
1956 __ SmiUntag(r0);
1954 } 1957 }
1955 1958
1956 1959
1957 // StringCharCodeAtGenerator 1960 // StringCharCodeAtGenerator
1958 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 1961 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
1959 // If the receiver is a smi trigger the non-string case. 1962 // If the receiver is a smi trigger the non-string case.
1960 if (check_mode_ == RECEIVER_IS_UNKNOWN) { 1963 if (check_mode_ == RECEIVER_IS_UNKNOWN) {
1961 __ JumpIfSmi(object_, receiver_not_string_); 1964 __ JumpIfSmi(object_, receiver_not_string_);
1962 1965
1963 // Fetch the instance type of the receiver into result register. 1966 // Fetch the instance type of the receiver into result register.
(...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after
4888 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4891 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4889 kStackUnwindSpace, NULL, return_value_operand, NULL); 4892 kStackUnwindSpace, NULL, return_value_operand, NULL);
4890 } 4893 }
4891 4894
4892 #undef __ 4895 #undef __
4893 4896
4894 } // namespace internal 4897 } // namespace internal
4895 } // namespace v8 4898 } // namespace v8
4896 4899
4897 #endif // V8_TARGET_ARCH_ARM 4900 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698