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

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

Issue 1489413006: Revert of Provide call counts for constructor calls, surface them as a vector IC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/full-codegen/x64/full-codegen-x64.cc ('k') | src/ia32/interface-descriptors-ia32.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_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 static void GenerateRecordCallTarget(MacroAssembler* masm) { 1930 static void GenerateRecordCallTarget(MacroAssembler* masm) {
1931 // Cache the called function in a feedback vector slot. Cache states 1931 // Cache the called function in a feedback vector slot. Cache states
1932 // are uninitialized, monomorphic (indicated by a JSFunction), and 1932 // are uninitialized, monomorphic (indicated by a JSFunction), and
1933 // megamorphic. 1933 // megamorphic.
1934 // eax : number of arguments to the construct function 1934 // eax : number of arguments to the construct function
1935 // ebx : feedback vector 1935 // ebx : feedback vector
1936 // edx : slot in feedback vector (Smi) 1936 // edx : slot in feedback vector (Smi)
1937 // edi : the function to call 1937 // edi : the function to call
1938 Isolate* isolate = masm->isolate(); 1938 Isolate* isolate = masm->isolate();
1939 Label initialize, done, miss, megamorphic, not_array_function; 1939 Label initialize, done, miss, megamorphic, not_array_function;
1940 Label done_increment_count;
1941 1940
1942 // Load the cache state into ecx. 1941 // Load the cache state into ecx.
1943 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, 1942 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size,
1944 FixedArray::kHeaderSize)); 1943 FixedArray::kHeaderSize));
1945 1944
1946 // A monomorphic cache hit or an already megamorphic state: invoke the 1945 // A monomorphic cache hit or an already megamorphic state: invoke the
1947 // function without changing the state. 1946 // function without changing the state.
1948 // We don't know if ecx is a WeakCell or a Symbol, but it's harmless to read 1947 // We don't know if ecx is a WeakCell or a Symbol, but it's harmless to read
1949 // at this position in a symbol (see static asserts in 1948 // at this position in a symbol (see static asserts in
1950 // type-feedback-vector.h). 1949 // type-feedback-vector.h).
1951 Label check_allocation_site; 1950 Label check_allocation_site;
1952 __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); 1951 __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset));
1953 __ j(equal, &done_increment_count, Label::kFar); 1952 __ j(equal, &done, Label::kFar);
1954 __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex); 1953 __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex);
1955 __ j(equal, &done, Label::kFar); 1954 __ j(equal, &done, Label::kFar);
1956 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), 1955 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset),
1957 Heap::kWeakCellMapRootIndex); 1956 Heap::kWeakCellMapRootIndex);
1958 __ j(not_equal, &check_allocation_site); 1957 __ j(not_equal, &check_allocation_site);
1959 1958
1960 // If the weak cell is cleared, we have a new chance to become monomorphic. 1959 // If the weak cell is cleared, we have a new chance to become monomorphic.
1961 __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize); 1960 __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize);
1962 __ jmp(&megamorphic); 1961 __ jmp(&megamorphic);
1963 1962
1964 __ bind(&check_allocation_site); 1963 __ bind(&check_allocation_site);
1965 // If we came here, we need to see if we are the array function. 1964 // If we came here, we need to see if we are the array function.
1966 // If we didn't have a matching function, and we didn't find the megamorph 1965 // If we didn't have a matching function, and we didn't find the megamorph
1967 // sentinel, then we have in the slot either some other function or an 1966 // sentinel, then we have in the slot either some other function or an
1968 // AllocationSite. 1967 // AllocationSite.
1969 __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex); 1968 __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex);
1970 __ j(not_equal, &miss); 1969 __ j(not_equal, &miss);
1971 1970
1972 // Make sure the function is the Array() function 1971 // Make sure the function is the Array() function
1973 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); 1972 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx);
1974 __ cmp(edi, ecx); 1973 __ cmp(edi, ecx);
1975 __ j(not_equal, &megamorphic); 1974 __ j(not_equal, &megamorphic);
1976 __ jmp(&done_increment_count, Label::kFar); 1975 __ jmp(&done, Label::kFar);
1977 1976
1978 __ bind(&miss); 1977 __ bind(&miss);
1979 1978
1980 // A monomorphic miss (i.e, here the cache is not uninitialized) goes 1979 // A monomorphic miss (i.e, here the cache is not uninitialized) goes
1981 // megamorphic. 1980 // megamorphic.
1982 __ CompareRoot(ecx, Heap::kuninitialized_symbolRootIndex); 1981 __ CompareRoot(ecx, Heap::kuninitialized_symbolRootIndex);
1983 __ j(equal, &initialize); 1982 __ j(equal, &initialize);
1984 // MegamorphicSentinel is an immortal immovable object (undefined) so no 1983 // MegamorphicSentinel is an immortal immovable object (undefined) so no
1985 // write-barrier is needed. 1984 // write-barrier is needed.
1986 __ bind(&megamorphic); 1985 __ bind(&megamorphic);
1987 __ mov( 1986 __ mov(
1988 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), 1987 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize),
1989 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); 1988 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate)));
1990 __ jmp(&done, Label::kFar); 1989 __ jmp(&done, Label::kFar);
1991 1990
1992 // An uninitialized cache is patched with the function or sentinel to 1991 // An uninitialized cache is patched with the function or sentinel to
1993 // indicate the ElementsKind if function is the Array constructor. 1992 // indicate the ElementsKind if function is the Array constructor.
1994 __ bind(&initialize); 1993 __ bind(&initialize);
1995
1996 // Initialize the call counter.
1997 __ mov(FieldOperand(ebx, edx, times_half_pointer_size,
1998 FixedArray::kHeaderSize + kPointerSize),
1999 Immediate(Smi::FromInt(ConstructICNexus::kCallCountIncrement)));
2000
2001 // Make sure the function is the Array() function 1994 // Make sure the function is the Array() function
2002 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); 1995 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx);
2003 __ cmp(edi, ecx); 1996 __ cmp(edi, ecx);
2004 __ j(not_equal, &not_array_function); 1997 __ j(not_equal, &not_array_function);
2005 1998
2006 // The target function is the Array constructor, 1999 // The target function is the Array constructor,
2007 // Create an AllocationSite if we don't already have it, store it in the 2000 // Create an AllocationSite if we don't already have it, store it in the
2008 // slot. 2001 // slot.
2009 CreateAllocationSiteStub create_stub(isolate); 2002 CreateAllocationSiteStub create_stub(isolate);
2010 CallStubInRecordCallTarget(masm, &create_stub); 2003 CallStubInRecordCallTarget(masm, &create_stub);
2011 __ jmp(&done); 2004 __ jmp(&done);
2012 2005
2013 __ bind(&not_array_function); 2006 __ bind(&not_array_function);
2014 CreateWeakCellStub weak_cell_stub(isolate); 2007 CreateWeakCellStub weak_cell_stub(isolate);
2015 CallStubInRecordCallTarget(masm, &weak_cell_stub); 2008 CallStubInRecordCallTarget(masm, &weak_cell_stub);
2016 __ jmp(&done);
2017
2018 __ bind(&done_increment_count);
2019 __ add(FieldOperand(ebx, edx, times_half_pointer_size,
2020 FixedArray::kHeaderSize + kPointerSize),
2021 Immediate(Smi::FromInt(ConstructICNexus::kCallCountIncrement)));
2022
2023 __ bind(&done); 2009 __ bind(&done);
2024 } 2010 }
2025 2011
2026 2012
2027 void ConstructICStub::Generate(MacroAssembler* masm) { 2013 void CallConstructStub::Generate(MacroAssembler* masm) {
2028 // eax : number of arguments 2014 // eax : number of arguments
2029 // ebx : feedback vector 2015 // ebx : feedback vector
2030 // edx : slot in feedback vector (Smi, for RecordCallTarget) 2016 // edx : slot in feedback vector (Smi, for RecordCallTarget)
2031 // edi : constructor function 2017 // edi : constructor function
2032 2018
2033 Label non_function; 2019 Label non_function;
2034 // Check that function is not a smi. 2020 // Check that function is not a smi.
2035 __ JumpIfSmi(edi, &non_function); 2021 __ JumpIfSmi(edi, &non_function);
2036 // Check that function is a JSFunction. 2022 // Check that function is a JSFunction.
2037 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); 2023 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx);
(...skipping 3614 matching lines...) Expand 10 before | Expand all | Expand 10 after
5652 Operand(ebp, 7 * kPointerSize), NULL); 5638 Operand(ebp, 7 * kPointerSize), NULL);
5653 } 5639 }
5654 5640
5655 5641
5656 #undef __ 5642 #undef __
5657 5643
5658 } // namespace internal 5644 } // namespace internal
5659 } // namespace v8 5645 } // namespace v8
5660 5646
5661 #endif // V8_TARGET_ARCH_IA32 5647 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen/x64/full-codegen-x64.cc ('k') | src/ia32/interface-descriptors-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698