OLD | NEW |
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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 // ----------- S t a t e ------------- | 1952 // ----------- S t a t e ------------- |
1953 // -- rdi - function | 1953 // -- rdi - function |
1954 // -- rdx - slot id | 1954 // -- rdx - slot id |
1955 // -- rbx - vector | 1955 // -- rbx - vector |
1956 // ----------------------------------- | 1956 // ----------------------------------- |
1957 Isolate* isolate = masm->isolate(); | 1957 Isolate* isolate = masm->isolate(); |
1958 const int with_types_offset = | 1958 const int with_types_offset = |
1959 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | 1959 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); |
1960 const int generic_offset = | 1960 const int generic_offset = |
1961 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | 1961 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); |
1962 Label extra_checks_or_miss, call; | 1962 Label extra_checks_or_miss, call, call_function; |
1963 int argc = arg_count(); | 1963 int argc = arg_count(); |
1964 StackArgumentsAccessor args(rsp, argc); | 1964 StackArgumentsAccessor args(rsp, argc); |
1965 ParameterCount actual(argc); | 1965 ParameterCount actual(argc); |
1966 | 1966 |
1967 // The checks. First, does rdi match the recorded monomorphic target? | 1967 // The checks. First, does rdi match the recorded monomorphic target? |
1968 __ SmiToInteger32(rdx, rdx); | 1968 __ SmiToInteger32(rdx, rdx); |
1969 __ movp(rcx, | 1969 __ movp(rcx, |
1970 FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize)); | 1970 FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize)); |
1971 | 1971 |
1972 // We don't know that we have a weak cell. We might have a private symbol | 1972 // We don't know that we have a weak cell. We might have a private symbol |
(...skipping 15 matching lines...) Expand all Loading... |
1988 | 1988 |
1989 // The compare above could have been a SMI/SMI comparison. Guard against this | 1989 // The compare above could have been a SMI/SMI comparison. Guard against this |
1990 // convincing us that we have a monomorphic JSFunction. | 1990 // convincing us that we have a monomorphic JSFunction. |
1991 __ JumpIfSmi(rdi, &extra_checks_or_miss); | 1991 __ JumpIfSmi(rdi, &extra_checks_or_miss); |
1992 | 1992 |
1993 // Increment the call count for monomorphic function calls. | 1993 // Increment the call count for monomorphic function calls. |
1994 __ SmiAddConstant(FieldOperand(rbx, rdx, times_pointer_size, | 1994 __ SmiAddConstant(FieldOperand(rbx, rdx, times_pointer_size, |
1995 FixedArray::kHeaderSize + kPointerSize), | 1995 FixedArray::kHeaderSize + kPointerSize), |
1996 Smi::FromInt(CallICNexus::kCallCountIncrement)); | 1996 Smi::FromInt(CallICNexus::kCallCountIncrement)); |
1997 | 1997 |
1998 __ bind(&call); | 1998 __ bind(&call_function); |
1999 __ Set(rax, argc); | 1999 __ Set(rax, argc); |
2000 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2000 __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode()), |
| 2001 RelocInfo::CODE_TARGET); |
2001 | 2002 |
2002 __ bind(&extra_checks_or_miss); | 2003 __ bind(&extra_checks_or_miss); |
2003 Label uninitialized, miss, not_allocation_site; | 2004 Label uninitialized, miss, not_allocation_site; |
2004 | 2005 |
2005 __ Cmp(rcx, TypeFeedbackVector::MegamorphicSentinel(isolate)); | 2006 __ Cmp(rcx, TypeFeedbackVector::MegamorphicSentinel(isolate)); |
2006 __ j(equal, &call); | 2007 __ j(equal, &call); |
2007 | 2008 |
2008 // Check if we have an allocation site. | 2009 // Check if we have an allocation site. |
2009 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), | 2010 __ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
2010 Heap::kAllocationSiteMapRootIndex); | 2011 Heap::kAllocationSiteMapRootIndex); |
(...skipping 16 matching lines...) Expand all Loading... |
2027 // We are going megamorphic. If the feedback is a JSFunction, it is fine | 2028 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
2028 // to handle it here. More complex cases are dealt with in the runtime. | 2029 // to handle it here. More complex cases are dealt with in the runtime. |
2029 __ AssertNotSmi(rcx); | 2030 __ AssertNotSmi(rcx); |
2030 __ CmpObjectType(rcx, JS_FUNCTION_TYPE, rcx); | 2031 __ CmpObjectType(rcx, JS_FUNCTION_TYPE, rcx); |
2031 __ j(not_equal, &miss); | 2032 __ j(not_equal, &miss); |
2032 __ Move(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize), | 2033 __ Move(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize), |
2033 TypeFeedbackVector::MegamorphicSentinel(isolate)); | 2034 TypeFeedbackVector::MegamorphicSentinel(isolate)); |
2034 // We have to update statistics for runtime profiling. | 2035 // We have to update statistics for runtime profiling. |
2035 __ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(-1)); | 2036 __ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(-1)); |
2036 __ SmiAddConstant(FieldOperand(rbx, generic_offset), Smi::FromInt(1)); | 2037 __ SmiAddConstant(FieldOperand(rbx, generic_offset), Smi::FromInt(1)); |
2037 __ jmp(&call); | 2038 |
| 2039 __ bind(&call); |
| 2040 __ Set(rax, argc); |
| 2041 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
| 2042 RelocInfo::CODE_TARGET); |
2038 | 2043 |
2039 __ bind(&uninitialized); | 2044 __ bind(&uninitialized); |
2040 | 2045 |
2041 // We are going monomorphic, provided we actually have a JSFunction. | 2046 // We are going monomorphic, provided we actually have a JSFunction. |
2042 __ JumpIfSmi(rdi, &miss); | 2047 __ JumpIfSmi(rdi, &miss); |
2043 | 2048 |
2044 // Goto miss case if we do not have a function. | 2049 // Goto miss case if we do not have a function. |
2045 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 2050 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
2046 __ j(not_equal, &miss); | 2051 __ j(not_equal, &miss); |
2047 | 2052 |
(...skipping 25 matching lines...) Expand all Loading... |
2073 { | 2078 { |
2074 FrameScope scope(masm, StackFrame::INTERNAL); | 2079 FrameScope scope(masm, StackFrame::INTERNAL); |
2075 CreateWeakCellStub create_stub(isolate); | 2080 CreateWeakCellStub create_stub(isolate); |
2076 | 2081 |
2077 __ Integer32ToSmi(rdx, rdx); | 2082 __ Integer32ToSmi(rdx, rdx); |
2078 __ Push(rdi); | 2083 __ Push(rdi); |
2079 __ CallStub(&create_stub); | 2084 __ CallStub(&create_stub); |
2080 __ Pop(rdi); | 2085 __ Pop(rdi); |
2081 } | 2086 } |
2082 | 2087 |
2083 __ jmp(&call); | 2088 __ jmp(&call_function); |
2084 | 2089 |
2085 // We are here because tracing is on or we encountered a MISS case we can't | 2090 // We are here because tracing is on or we encountered a MISS case we can't |
2086 // handle here. | 2091 // handle here. |
2087 __ bind(&miss); | 2092 __ bind(&miss); |
2088 GenerateMiss(masm); | 2093 GenerateMiss(masm); |
2089 | 2094 |
2090 __ jmp(&call); | 2095 __ jmp(&call); |
2091 | 2096 |
2092 // Unreachable | 2097 // Unreachable |
2093 __ int3(); | 2098 __ int3(); |
(...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5402 kStackSpace, nullptr, return_value_operand, NULL); | 5407 kStackSpace, nullptr, return_value_operand, NULL); |
5403 } | 5408 } |
5404 | 5409 |
5405 | 5410 |
5406 #undef __ | 5411 #undef __ |
5407 | 5412 |
5408 } // namespace internal | 5413 } // namespace internal |
5409 } // namespace v8 | 5414 } // namespace v8 |
5410 | 5415 |
5411 #endif // V8_TARGET_ARCH_X64 | 5416 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |