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

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

Issue 1057613003: Code cleanup in GenerateRecordCallTarget. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Slight comment improvement. Created 5 years, 8 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/mips64/code-stubs-mips64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 } 1778 }
1779 1779
1780 1780
1781 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { 1781 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) {
1782 // eax : number of arguments to the construct function 1782 // eax : number of arguments to the construct function
1783 // ebx : Feedback vector 1783 // ebx : Feedback vector
1784 // edx : slot in feedback vector (Smi) 1784 // edx : slot in feedback vector (Smi)
1785 // edi : the function to call 1785 // edi : the function to call
1786 FrameScope scope(masm, StackFrame::INTERNAL); 1786 FrameScope scope(masm, StackFrame::INTERNAL);
1787 1787
1788 // Arguments register must be smi-tagged to call out. 1788 // Number-of-arguments register must be smi-tagged to call out.
1789 __ Integer32ToSmi(rax, rax); 1789 __ Integer32ToSmi(rax, rax);
1790 __ Push(rax); 1790 __ Push(rax);
1791 __ Push(rdi); 1791 __ Push(rdi);
1792 __ Integer32ToSmi(rdx, rdx); 1792 __ Integer32ToSmi(rdx, rdx);
1793 __ Push(rdx); 1793 __ Push(rdx);
1794 __ Push(rbx); 1794 __ Push(rbx);
1795 1795
1796 __ CallStub(stub); 1796 __ CallStub(stub);
1797 1797
1798 __ Pop(rbx); 1798 __ Pop(rbx);
(...skipping 16 matching lines...) Expand all
1815 Label initialize, done, miss, megamorphic, not_array_function, 1815 Label initialize, done, miss, megamorphic, not_array_function,
1816 done_no_smi_convert; 1816 done_no_smi_convert;
1817 1817
1818 // Load the cache state into rcx. 1818 // Load the cache state into rcx.
1819 __ SmiToInteger32(rdx, rdx); 1819 __ SmiToInteger32(rdx, rdx);
1820 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, 1820 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size,
1821 FixedArray::kHeaderSize)); 1821 FixedArray::kHeaderSize));
1822 1822
1823 // A monomorphic cache hit or an already megamorphic state: invoke the 1823 // A monomorphic cache hit or an already megamorphic state: invoke the
1824 // function without changing the state. 1824 // function without changing the state.
1825 // We don't know if rcx is a WeakCell or a Symbol, but it's harmless to read
1826 // at this position in a symbol (see static asserts in
1827 // type-feedback-vector.h).
1825 Label check_allocation_site; 1828 Label check_allocation_site;
1826 __ cmpp(rdi, FieldOperand(rcx, WeakCell::kValueOffset)); 1829 __ cmpp(rdi, FieldOperand(rcx, WeakCell::kValueOffset));
1827 __ j(equal, &done, Label::kFar); 1830 __ j(equal, &done, Label::kFar);
1828 __ CompareRoot(rcx, Heap::kmegamorphic_symbolRootIndex); 1831 __ CompareRoot(rcx, Heap::kmegamorphic_symbolRootIndex);
1829 __ j(equal, &done, Label::kFar); 1832 __ j(equal, &done, Label::kFar);
1830 __ CompareRoot(FieldOperand(rcx, 0), Heap::kWeakCellMapRootIndex); 1833 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset),
1834 Heap::kWeakCellMapRootIndex);
1831 __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); 1835 __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site);
1832 1836
1833 // If edi is not equal to the weak cell value, and the weak cell value is 1837 // If the weak cell is cleared, we have a new chance to become monomorphic.
1834 // cleared, we have a new chance to become monomorphic. Otherwise, we
1835 // need to go megamorphic.
1836 __ CheckSmi(FieldOperand(rcx, WeakCell::kValueOffset)); 1838 __ CheckSmi(FieldOperand(rcx, WeakCell::kValueOffset));
1837 __ j(equal, &initialize); 1839 __ j(equal, &initialize);
1838 __ jmp(&megamorphic); 1840 __ jmp(&megamorphic);
1839 1841
1840 if (!FLAG_pretenuring_call_new) { 1842 if (!FLAG_pretenuring_call_new) {
1841 __ bind(&check_allocation_site); 1843 __ bind(&check_allocation_site);
1842 // If we came here, we need to see if we are the array function. 1844 // If we came here, we need to see if we are the array function.
1843 // If we didn't have a matching function, and we didn't find the megamorph 1845 // If we didn't have a matching function, and we didn't find the megamorph
1844 // sentinel, then we have in the slot either some other function or an 1846 // sentinel, then we have in the slot either some other function or an
1845 // AllocationSite. Do a map check on the object in rcx. 1847 // AllocationSite.
1846 __ CompareRoot(FieldOperand(rcx, 0), Heap::kAllocationSiteMapRootIndex); 1848 __ CompareRoot(FieldOperand(rcx, 0), Heap::kAllocationSiteMapRootIndex);
1847 __ j(not_equal, &miss); 1849 __ j(not_equal, &miss);
1848 1850
1849 // Make sure the function is the Array() function 1851 // Make sure the function is the Array() function
1850 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); 1852 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx);
1851 __ cmpp(rdi, rcx); 1853 __ cmpp(rdi, rcx);
1852 __ j(not_equal, &megamorphic); 1854 __ j(not_equal, &megamorphic);
1853 __ jmp(&done); 1855 __ jmp(&done);
1854 } 1856 }
1855 1857
(...skipping 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after
5366 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg, 5368 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, getter_arg,
5367 kStackSpace, nullptr, return_value_operand, NULL); 5369 kStackSpace, nullptr, return_value_operand, NULL);
5368 } 5370 }
5369 5371
5370 5372
5371 #undef __ 5373 #undef __
5372 5374
5373 } } // namespace v8::internal 5375 } } // namespace v8::internal
5374 5376
5375 #endif // V8_TARGET_ARCH_X64 5377 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698