OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 } | 1913 } |
1914 | 1914 |
1915 | 1915 |
1916 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1916 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
1917 // eax : number of arguments to the construct function | 1917 // eax : number of arguments to the construct function |
1918 // ebx : Feedback vector | 1918 // ebx : Feedback vector |
1919 // edx : slot in feedback vector (Smi) | 1919 // edx : slot in feedback vector (Smi) |
1920 // edi : the function to call | 1920 // edi : the function to call |
1921 FrameScope scope(masm, StackFrame::INTERNAL); | 1921 FrameScope scope(masm, StackFrame::INTERNAL); |
1922 | 1922 |
1923 // Arguments register must be smi-tagged to call out. | 1923 // Number-of-arguments register must be smi-tagged to call out. |
1924 __ SmiTag(eax); | 1924 __ SmiTag(eax); |
1925 __ push(eax); | 1925 __ push(eax); |
1926 __ push(edi); | 1926 __ push(edi); |
1927 __ push(edx); | 1927 __ push(edx); |
1928 __ push(ebx); | 1928 __ push(ebx); |
1929 | 1929 |
1930 __ CallStub(stub); | 1930 __ CallStub(stub); |
1931 | 1931 |
1932 __ pop(ebx); | 1932 __ pop(ebx); |
1933 __ pop(edx); | 1933 __ pop(edx); |
(...skipping 13 matching lines...) Expand all Loading... |
1947 // edi : the function to call | 1947 // edi : the function to call |
1948 Isolate* isolate = masm->isolate(); | 1948 Isolate* isolate = masm->isolate(); |
1949 Label initialize, done, miss, megamorphic, not_array_function; | 1949 Label initialize, done, miss, megamorphic, not_array_function; |
1950 | 1950 |
1951 // Load the cache state into ecx. | 1951 // Load the cache state into ecx. |
1952 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1952 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
1953 FixedArray::kHeaderSize)); | 1953 FixedArray::kHeaderSize)); |
1954 | 1954 |
1955 // A monomorphic cache hit or an already megamorphic state: invoke the | 1955 // A monomorphic cache hit or an already megamorphic state: invoke the |
1956 // function without changing the state. | 1956 // function without changing the state. |
| 1957 // We don't know if ecx is a WeakCell or a Symbol, but it's harmless to read |
| 1958 // at this position in a symbol (see static asserts in |
| 1959 // type-feedback-vector.h). |
1957 Label check_allocation_site; | 1960 Label check_allocation_site; |
1958 __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); | 1961 __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); |
1959 __ j(equal, &done, Label::kFar); | 1962 __ j(equal, &done, Label::kFar); |
1960 __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex); | 1963 __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex); |
1961 __ j(equal, &done, Label::kFar); | 1964 __ j(equal, &done, Label::kFar); |
1962 __ CompareRoot(FieldOperand(ecx, 0), Heap::kWeakCellMapRootIndex); | 1965 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), |
| 1966 Heap::kWeakCellMapRootIndex); |
1963 __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); | 1967 __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); |
1964 | 1968 |
1965 // If edi is not equal to the weak cell value, and the weak cell value is | 1969 // If the weak cell is cleared, we have a new chance to become monomorphic. |
1966 // cleared, we have a new chance to become monomorphic. | |
1967 __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize); | 1970 __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize); |
1968 __ jmp(&megamorphic); | 1971 __ jmp(&megamorphic); |
1969 | 1972 |
1970 if (!FLAG_pretenuring_call_new) { | 1973 if (!FLAG_pretenuring_call_new) { |
1971 __ bind(&check_allocation_site); | 1974 __ bind(&check_allocation_site); |
1972 // If we came here, we need to see if we are the array function. | 1975 // If we came here, we need to see if we are the array function. |
1973 // If we didn't have a matching function, and we didn't find the megamorph | 1976 // If we didn't have a matching function, and we didn't find the megamorph |
1974 // sentinel, then we have in the slot either some other function or an | 1977 // sentinel, then we have in the slot either some other function or an |
1975 // AllocationSite. Do a map check on the object in ecx. | 1978 // AllocationSite. |
1976 __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex); | 1979 __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex); |
1977 __ j(not_equal, &miss); | 1980 __ j(not_equal, &miss); |
1978 | 1981 |
1979 // Make sure the function is the Array() function | 1982 // Make sure the function is the Array() function |
1980 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 1983 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
1981 __ cmp(edi, ecx); | 1984 __ cmp(edi, ecx); |
1982 __ j(not_equal, &megamorphic); | 1985 __ j(not_equal, &megamorphic); |
1983 __ jmp(&done, Label::kFar); | 1986 __ jmp(&done, Label::kFar); |
1984 } | 1987 } |
1985 | 1988 |
(...skipping 3422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5408 ApiParameterOperand(2), kStackSpace, nullptr, | 5411 ApiParameterOperand(2), kStackSpace, nullptr, |
5409 Operand(ebp, 7 * kPointerSize), NULL); | 5412 Operand(ebp, 7 * kPointerSize), NULL); |
5410 } | 5413 } |
5411 | 5414 |
5412 | 5415 |
5413 #undef __ | 5416 #undef __ |
5414 | 5417 |
5415 } } // namespace v8::internal | 5418 } } // namespace v8::internal |
5416 | 5419 |
5417 #endif // V8_TARGET_ARCH_IA32 | 5420 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |