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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
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 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 __ TailCallStub(&stub); | 2820 __ TailCallStub(&stub); |
2821 } | 2821 } |
2822 | 2822 |
2823 | 2823 |
2824 void CallICStub::Generate(MacroAssembler* masm) { | 2824 void CallICStub::Generate(MacroAssembler* masm) { |
2825 ASM_LOCATION("CallICStub"); | 2825 ASM_LOCATION("CallICStub"); |
2826 | 2826 |
2827 // x1 - function | 2827 // x1 - function |
2828 // x3 - slot id (Smi) | 2828 // x3 - slot id (Smi) |
2829 // x2 - vector | 2829 // x2 - vector |
2830 const int with_types_offset = | |
2831 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kWithTypesIndex); | |
2832 const int generic_offset = | |
2833 FixedArray::OffsetOfElementAt(TypeFeedbackVector::kGenericCountIndex); | |
2834 Label extra_checks_or_miss, call, call_function; | 2830 Label extra_checks_or_miss, call, call_function; |
2835 int argc = arg_count(); | 2831 int argc = arg_count(); |
2836 ParameterCount actual(argc); | 2832 ParameterCount actual(argc); |
2837 | 2833 |
2838 Register function = x1; | 2834 Register function = x1; |
2839 Register feedback_vector = x2; | 2835 Register feedback_vector = x2; |
2840 Register index = x3; | 2836 Register index = x3; |
2841 | 2837 |
2842 // The checks. First, does x1 match the recorded monomorphic target? | 2838 // The checks. First, does x1 match the recorded monomorphic target? |
2843 __ Add(x4, feedback_vector, | 2839 __ Add(x4, feedback_vector, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2901 __ JumpIfRoot(x4, Heap::kuninitialized_symbolRootIndex, &miss); | 2897 __ JumpIfRoot(x4, Heap::kuninitialized_symbolRootIndex, &miss); |
2902 | 2898 |
2903 // We are going megamorphic. If the feedback is a JSFunction, it is fine | 2899 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
2904 // to handle it here. More complex cases are dealt with in the runtime. | 2900 // to handle it here. More complex cases are dealt with in the runtime. |
2905 __ AssertNotSmi(x4); | 2901 __ AssertNotSmi(x4); |
2906 __ JumpIfNotObjectType(x4, x5, x5, JS_FUNCTION_TYPE, &miss); | 2902 __ JumpIfNotObjectType(x4, x5, x5, JS_FUNCTION_TYPE, &miss); |
2907 __ Add(x4, feedback_vector, | 2903 __ Add(x4, feedback_vector, |
2908 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 2904 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
2909 __ LoadRoot(x5, Heap::kmegamorphic_symbolRootIndex); | 2905 __ LoadRoot(x5, Heap::kmegamorphic_symbolRootIndex); |
2910 __ Str(x5, FieldMemOperand(x4, FixedArray::kHeaderSize)); | 2906 __ Str(x5, FieldMemOperand(x4, FixedArray::kHeaderSize)); |
2911 // We have to update statistics for runtime profiling. | |
2912 __ Ldr(x4, FieldMemOperand(feedback_vector, with_types_offset)); | |
2913 __ Subs(x4, x4, Operand(Smi::FromInt(1))); | |
2914 __ Str(x4, FieldMemOperand(feedback_vector, with_types_offset)); | |
2915 __ Ldr(x4, FieldMemOperand(feedback_vector, generic_offset)); | |
2916 __ Adds(x4, x4, Operand(Smi::FromInt(1))); | |
2917 __ Str(x4, FieldMemOperand(feedback_vector, generic_offset)); | |
2918 | 2907 |
2919 __ Bind(&call); | 2908 __ Bind(&call); |
2920 __ Mov(x0, argc); | 2909 __ Mov(x0, argc); |
2921 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), | 2910 __ Jump(masm->isolate()->builtins()->Call(convert_mode()), |
2922 RelocInfo::CODE_TARGET); | 2911 RelocInfo::CODE_TARGET); |
2923 | 2912 |
2924 __ bind(&uninitialized); | 2913 __ bind(&uninitialized); |
2925 | 2914 |
2926 // We are going monomorphic, provided we actually have a JSFunction. | 2915 // We are going monomorphic, provided we actually have a JSFunction. |
2927 __ JumpIfSmi(function, &miss); | 2916 __ JumpIfSmi(function, &miss); |
2928 | 2917 |
2929 // Goto miss case if we do not have a function. | 2918 // Goto miss case if we do not have a function. |
2930 __ JumpIfNotObjectType(function, x5, x5, JS_FUNCTION_TYPE, &miss); | 2919 __ JumpIfNotObjectType(function, x5, x5, JS_FUNCTION_TYPE, &miss); |
2931 | 2920 |
2932 // Make sure the function is not the Array() function, which requires special | 2921 // Make sure the function is not the Array() function, which requires special |
2933 // behavior on MISS. | 2922 // behavior on MISS. |
2934 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, x5); | 2923 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, x5); |
2935 __ Cmp(function, x5); | 2924 __ Cmp(function, x5); |
2936 __ B(eq, &miss); | 2925 __ B(eq, &miss); |
2937 | 2926 |
2938 // Make sure the function belongs to the same native context. | 2927 // Make sure the function belongs to the same native context. |
2939 __ Ldr(x4, FieldMemOperand(function, JSFunction::kContextOffset)); | 2928 __ Ldr(x4, FieldMemOperand(function, JSFunction::kContextOffset)); |
2940 __ Ldr(x4, ContextMemOperand(x4, Context::NATIVE_CONTEXT_INDEX)); | 2929 __ Ldr(x4, ContextMemOperand(x4, Context::NATIVE_CONTEXT_INDEX)); |
2941 __ Ldr(x5, NativeContextMemOperand()); | 2930 __ Ldr(x5, NativeContextMemOperand()); |
2942 __ Cmp(x4, x5); | 2931 __ Cmp(x4, x5); |
2943 __ B(ne, &miss); | 2932 __ B(ne, &miss); |
2944 | 2933 |
2945 // Update stats. | |
2946 __ Ldr(x4, FieldMemOperand(feedback_vector, with_types_offset)); | |
2947 __ Adds(x4, x4, Operand(Smi::FromInt(1))); | |
2948 __ Str(x4, FieldMemOperand(feedback_vector, with_types_offset)); | |
2949 | |
2950 // Initialize the call counter. | 2934 // Initialize the call counter. |
2951 __ Mov(x5, Smi::FromInt(CallICNexus::kCallCountIncrement)); | 2935 __ Mov(x5, Smi::FromInt(CallICNexus::kCallCountIncrement)); |
2952 __ Adds(x4, feedback_vector, | 2936 __ Adds(x4, feedback_vector, |
2953 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 2937 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
2954 __ Str(x5, FieldMemOperand(x4, FixedArray::kHeaderSize + kPointerSize)); | 2938 __ Str(x5, FieldMemOperand(x4, FixedArray::kHeaderSize + kPointerSize)); |
2955 | 2939 |
2956 // Store the function. Use a stub since we need a frame for allocation. | 2940 // Store the function. Use a stub since we need a frame for allocation. |
2957 // x2 - vector | 2941 // x2 - vector |
2958 // x3 - slot | 2942 // x3 - slot |
2959 // x1 - function | 2943 // x1 - function |
(...skipping 2848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5808 MemOperand(fp, 6 * kPointerSize), NULL); | 5792 MemOperand(fp, 6 * kPointerSize), NULL); |
5809 } | 5793 } |
5810 | 5794 |
5811 | 5795 |
5812 #undef __ | 5796 #undef __ |
5813 | 5797 |
5814 } // namespace internal | 5798 } // namespace internal |
5815 } // namespace v8 | 5799 } // namespace v8 |
5816 | 5800 |
5817 #endif // V8_TARGET_ARCH_ARM64 | 5801 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |