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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 | 1821 |
1822 void CallICStub::Generate(MacroAssembler* masm) { | 1822 void CallICStub::Generate(MacroAssembler* masm) { |
1823 // edi - function | 1823 // edi - function |
1824 // edx - slot id | 1824 // edx - slot id |
1825 // ebx - vector | 1825 // ebx - vector |
1826 Isolate* isolate = masm->isolate(); | 1826 Isolate* isolate = masm->isolate(); |
1827 const int with_types_offset = | 1827 const int with_types_offset = |
1828 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 1828 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
1829 const int generic_offset = | 1829 const int generic_offset = |
1830 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 1830 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
1831 Label extra_checks_or_miss, call; | 1831 Label extra_checks_or_miss, call, call_function; |
1832 int argc = arg_count(); | 1832 int argc = arg_count(); |
1833 ParameterCount actual(argc); | 1833 ParameterCount actual(argc); |
1834 | 1834 |
1835 // The checks. First, does edi match the recorded monomorphic target? | 1835 // The checks. First, does edi match the recorded monomorphic target? |
1836 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1836 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
1837 FixedArray::kHeaderSize)); | 1837 FixedArray::kHeaderSize)); |
1838 | 1838 |
1839 // We don't know that we have a weak cell. We might have a private symbol | 1839 // We don't know that we have a weak cell. We might have a private symbol |
1840 // or an AllocationSite, but the memory is safe to examine. | 1840 // or an AllocationSite, but the memory is safe to examine. |
1841 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to | 1841 // AllocationSite::kTransitionInfoOffset - contains a Smi or pointer to |
(...skipping 13 matching lines...) Expand all Loading... |
1855 | 1855 |
1856 // The compare above could have been a SMI/SMI comparison. Guard against this | 1856 // The compare above could have been a SMI/SMI comparison. Guard against this |
1857 // convincing us that we have a monomorphic JSFunction. | 1857 // convincing us that we have a monomorphic JSFunction. |
1858 __ JumpIfSmi(edi, &extra_checks_or_miss); | 1858 __ JumpIfSmi(edi, &extra_checks_or_miss); |
1859 | 1859 |
1860 // Increment the call count for monomorphic function calls. | 1860 // Increment the call count for monomorphic function calls. |
1861 __ add(FieldOperand(ebx, edx, times_half_pointer_size, | 1861 __ add(FieldOperand(ebx, edx, times_half_pointer_size, |
1862 FixedArray::kHeaderSize + kPointerSize), | 1862 FixedArray::kHeaderSize + kPointerSize), |
1863 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); | 1863 Immediate(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
1864 | 1864 |
1865 __ bind(&call); | 1865 __ bind(&call_function); |
1866 __ Set(eax, argc); | 1866 __ Set(eax, argc); |
1867 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1867 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()), |
| 1868 RelocInfo::CODE_TARGET); |
1868 | 1869 |
1869 __ bind(&extra_checks_or_miss); | 1870 __ bind(&extra_checks_or_miss); |
1870 Label uninitialized, miss, not_allocation_site; | 1871 Label uninitialized, miss, not_allocation_site; |
1871 | 1872 |
1872 __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); | 1873 __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
1873 __ j(equal, &call); | 1874 __ j(equal, &call); |
1874 | 1875 |
1875 // Check if we have an allocation site. | 1876 // Check if we have an allocation site. |
1876 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), | 1877 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), |
1877 Heap::kAllocationSiteMapRootIndex); | 1878 Heap::kAllocationSiteMapRootIndex); |
(...skipping 17 matching lines...) Expand all Loading... |
1895 // to handle it here. More complex cases are dealt with in the runtime. | 1896 // to handle it here. More complex cases are dealt with in the runtime. |
1896 __ AssertNotSmi(ecx); | 1897 __ AssertNotSmi(ecx); |
1897 __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); | 1898 __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); |
1898 __ j(not_equal, &miss); | 1899 __ j(not_equal, &miss); |
1899 __ mov( | 1900 __ mov( |
1900 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), | 1901 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), |
1901 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); | 1902 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
1902 // We have to update statistics for runtime profiling. | 1903 // We have to update statistics for runtime profiling. |
1903 __ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); | 1904 __ sub(FieldOperand(ebx, with_types_offset), Immediate(Smi::FromInt(1))); |
1904 __ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1))); | 1905 __ add(FieldOperand(ebx, generic_offset), Immediate(Smi::FromInt(1))); |
1905 __ jmp(&call); | 1906 |
| 1907 __ bind(&call); |
| 1908 __ Set(eax, argc); |
| 1909 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 1910 RelocInfo::CODE_TARGET); |
1906 | 1911 |
1907 __ bind(&uninitialized); | 1912 __ bind(&uninitialized); |
1908 | 1913 |
1909 // We are going monomorphic, provided we actually have a JSFunction. | 1914 // We are going monomorphic, provided we actually have a JSFunction. |
1910 __ JumpIfSmi(edi, &miss); | 1915 __ JumpIfSmi(edi, &miss); |
1911 | 1916 |
1912 // Goto miss case if we do not have a function. | 1917 // Goto miss case if we do not have a function. |
1913 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 1918 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
1914 __ j(not_equal, &miss); | 1919 __ j(not_equal, &miss); |
1915 | 1920 |
(...skipping 23 matching lines...) Expand all Loading... |
1939 // edx - slot | 1944 // edx - slot |
1940 // edi - function | 1945 // edi - function |
1941 { | 1946 { |
1942 FrameScope scope(masm, StackFrame::INTERNAL); | 1947 FrameScope scope(masm, StackFrame::INTERNAL); |
1943 CreateWeakCellStub create_stub(isolate); | 1948 CreateWeakCellStub create_stub(isolate); |
1944 __ push(edi); | 1949 __ push(edi); |
1945 __ CallStub(&create_stub); | 1950 __ CallStub(&create_stub); |
1946 __ pop(edi); | 1951 __ pop(edi); |
1947 } | 1952 } |
1948 | 1953 |
1949 __ jmp(&call); | 1954 __ jmp(&call_function); |
1950 | 1955 |
1951 // We are here because tracing is on or we encountered a MISS case we can't | 1956 // We are here because tracing is on or we encountered a MISS case we can't |
1952 // handle here. | 1957 // handle here. |
1953 __ bind(&miss); | 1958 __ bind(&miss); |
1954 GenerateMiss(masm); | 1959 GenerateMiss(masm); |
1955 | 1960 |
1956 __ jmp(&call); | 1961 __ jmp(&call); |
1957 | 1962 |
1958 // Unreachable | 1963 // Unreachable |
1959 __ int3(); | 1964 __ int3(); |
(...skipping 3388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5348 Operand(ebp, 7 * kPointerSize), NULL); | 5353 Operand(ebp, 7 * kPointerSize), NULL); |
5349 } | 5354 } |
5350 | 5355 |
5351 | 5356 |
5352 #undef __ | 5357 #undef __ |
5353 | 5358 |
5354 } // namespace internal | 5359 } // namespace internal |
5355 } // namespace v8 | 5360 } // namespace v8 |
5356 | 5361 |
5357 #endif // V8_TARGET_ARCH_X87 | 5362 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |