| 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 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1794 // x0 alloc_obj pointer to allocated objects (param map, backing | 1794 // x0 alloc_obj pointer to allocated objects (param map, backing |
| 1795 // store, arguments) | 1795 // store, arguments) |
| 1796 // x1 function function pointer | 1796 // x1 function function pointer |
| 1797 // x2 arg_count_smi number of function arguments (smi) | 1797 // x2 arg_count_smi number of function arguments (smi) |
| 1798 // x3 recv_arg pointer to receiver arguments | 1798 // x3 recv_arg pointer to receiver arguments |
| 1799 // x4 mapped_params number of mapped parameters, min(params, args) | 1799 // x4 mapped_params number of mapped parameters, min(params, args) |
| 1800 // x7 param_count number of function parameters | 1800 // x7 param_count number of function parameters |
| 1801 // x11 sloppy_args_map offset to args (or aliased args) map (uninit) | 1801 // x11 sloppy_args_map offset to args (or aliased args) map (uninit) |
| 1802 // x14 arg_count number of function arguments | 1802 // x14 arg_count number of function arguments |
| 1803 | 1803 |
| 1804 Register global_object = x10; |
| 1804 Register global_ctx = x10; | 1805 Register global_ctx = x10; |
| 1805 Register sloppy_args_map = x11; | 1806 Register sloppy_args_map = x11; |
| 1806 Register aliased_args_map = x10; | 1807 Register aliased_args_map = x10; |
| 1807 __ Ldr(global_ctx, NativeContextMemOperand()); | 1808 __ Ldr(global_object, GlobalObjectMemOperand()); |
| 1809 __ Ldr(global_ctx, |
| 1810 FieldMemOperand(global_object, JSGlobalObject::kNativeContextOffset)); |
| 1808 | 1811 |
| 1809 __ Ldr(sloppy_args_map, | 1812 __ Ldr(sloppy_args_map, |
| 1810 ContextMemOperand(global_ctx, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); | 1813 ContextMemOperand(global_ctx, Context::SLOPPY_ARGUMENTS_MAP_INDEX)); |
| 1811 __ Ldr( | 1814 __ Ldr( |
| 1812 aliased_args_map, | 1815 aliased_args_map, |
| 1813 ContextMemOperand(global_ctx, Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX)); | 1816 ContextMemOperand(global_ctx, Context::FAST_ALIASED_ARGUMENTS_MAP_INDEX)); |
| 1814 __ Cmp(mapped_params, 0); | 1817 __ Cmp(mapped_params, 0); |
| 1815 __ CmovX(sloppy_args_map, aliased_args_map, ne); | 1818 __ CmovX(sloppy_args_map, aliased_args_map, ne); |
| 1816 | 1819 |
| 1817 // Copy the JS object part. | 1820 // Copy the JS object part. |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 __ CzeroX(size, eq); | 2040 __ CzeroX(size, eq); |
| 2038 __ Add(size, size, Heap::kStrictArgumentsObjectSize / kPointerSize); | 2041 __ Add(size, size, Heap::kStrictArgumentsObjectSize / kPointerSize); |
| 2039 | 2042 |
| 2040 // Do the allocation of both objects in one go. Assign this to x0, as it will | 2043 // Do the allocation of both objects in one go. Assign this to x0, as it will |
| 2041 // be returned to the caller. | 2044 // be returned to the caller. |
| 2042 Register alloc_obj = x0; | 2045 Register alloc_obj = x0; |
| 2043 __ Allocate(size, alloc_obj, x11, x12, &runtime, | 2046 __ Allocate(size, alloc_obj, x11, x12, &runtime, |
| 2044 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2047 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
| 2045 | 2048 |
| 2046 // Get the arguments boilerplate from the current (native) context. | 2049 // Get the arguments boilerplate from the current (native) context. |
| 2050 Register global_object = x10; |
| 2051 Register global_ctx = x10; |
| 2047 Register strict_args_map = x4; | 2052 Register strict_args_map = x4; |
| 2048 __ LoadNativeContextSlot(Context::STRICT_ARGUMENTS_MAP_INDEX, | 2053 __ Ldr(global_object, GlobalObjectMemOperand()); |
| 2049 strict_args_map); | 2054 __ Ldr(global_ctx, |
| 2055 FieldMemOperand(global_object, JSGlobalObject::kNativeContextOffset)); |
| 2056 __ Ldr(strict_args_map, |
| 2057 ContextMemOperand(global_ctx, Context::STRICT_ARGUMENTS_MAP_INDEX)); |
| 2050 | 2058 |
| 2051 // x0 alloc_obj pointer to allocated objects: parameter array and | 2059 // x0 alloc_obj pointer to allocated objects: parameter array and |
| 2052 // arguments object | 2060 // arguments object |
| 2053 // x1 function function pointer | 2061 // x1 function function pointer |
| 2054 // x2 param_count_smi number of parameters passed to function (smi) | 2062 // x2 param_count_smi number of parameters passed to function (smi) |
| 2055 // x3 params pointer to parameters | 2063 // x3 params pointer to parameters |
| 2056 // x4 strict_args_map offset to arguments map | 2064 // x4 strict_args_map offset to arguments map |
| 2057 // x13 param_count number of parameters passed to function | 2065 // x13 param_count number of parameters passed to function |
| 2058 __ Str(strict_args_map, FieldMemOperand(alloc_obj, JSObject::kMapOffset)); | 2066 __ Str(strict_args_map, FieldMemOperand(alloc_obj, JSObject::kMapOffset)); |
| 2059 __ LoadRoot(x5, Heap::kEmptyFixedArrayRootIndex); | 2067 __ LoadRoot(x5, Heap::kEmptyFixedArrayRootIndex); |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 __ B(&megamorphic); | 2686 __ B(&megamorphic); |
| 2679 | 2687 |
| 2680 __ bind(&check_allocation_site); | 2688 __ bind(&check_allocation_site); |
| 2681 // If we came here, we need to see if we are the array function. | 2689 // If we came here, we need to see if we are the array function. |
| 2682 // If we didn't have a matching function, and we didn't find the megamorph | 2690 // If we didn't have a matching function, and we didn't find the megamorph |
| 2683 // sentinel, then we have in the slot either some other function or an | 2691 // sentinel, then we have in the slot either some other function or an |
| 2684 // AllocationSite. | 2692 // AllocationSite. |
| 2685 __ JumpIfNotRoot(feedback_map, Heap::kAllocationSiteMapRootIndex, &miss); | 2693 __ JumpIfNotRoot(feedback_map, Heap::kAllocationSiteMapRootIndex, &miss); |
| 2686 | 2694 |
| 2687 // Make sure the function is the Array() function | 2695 // Make sure the function is the Array() function |
| 2688 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch1); | 2696 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch1); |
| 2689 __ Cmp(function, scratch1); | 2697 __ Cmp(function, scratch1); |
| 2690 __ B(ne, &megamorphic); | 2698 __ B(ne, &megamorphic); |
| 2691 __ B(&done); | 2699 __ B(&done); |
| 2692 | 2700 |
| 2693 __ Bind(&miss); | 2701 __ Bind(&miss); |
| 2694 | 2702 |
| 2695 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 2703 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
| 2696 // megamorphic. | 2704 // megamorphic. |
| 2697 __ JumpIfRoot(scratch1, Heap::kuninitialized_symbolRootIndex, &initialize); | 2705 __ JumpIfRoot(scratch1, Heap::kuninitialized_symbolRootIndex, &initialize); |
| 2698 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 2706 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
| 2699 // write-barrier is needed. | 2707 // write-barrier is needed. |
| 2700 __ Bind(&megamorphic); | 2708 __ Bind(&megamorphic); |
| 2701 __ Add(scratch1, feedback_vector, | 2709 __ Add(scratch1, feedback_vector, |
| 2702 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 2710 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 2703 __ LoadRoot(scratch2, Heap::kmegamorphic_symbolRootIndex); | 2711 __ LoadRoot(scratch2, Heap::kmegamorphic_symbolRootIndex); |
| 2704 __ Str(scratch2, FieldMemOperand(scratch1, FixedArray::kHeaderSize)); | 2712 __ Str(scratch2, FieldMemOperand(scratch1, FixedArray::kHeaderSize)); |
| 2705 __ B(&done); | 2713 __ B(&done); |
| 2706 | 2714 |
| 2707 // An uninitialized cache is patched with the function or sentinel to | 2715 // An uninitialized cache is patched with the function or sentinel to |
| 2708 // indicate the ElementsKind if function is the Array constructor. | 2716 // indicate the ElementsKind if function is the Array constructor. |
| 2709 __ Bind(&initialize); | 2717 __ Bind(&initialize); |
| 2710 | 2718 |
| 2711 // Make sure the function is the Array() function | 2719 // Make sure the function is the Array() function |
| 2712 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch1); | 2720 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch1); |
| 2713 __ Cmp(function, scratch1); | 2721 __ Cmp(function, scratch1); |
| 2714 __ B(ne, ¬_array_function); | 2722 __ B(ne, ¬_array_function); |
| 2715 | 2723 |
| 2716 // The target function is the Array constructor, | 2724 // The target function is the Array constructor, |
| 2717 // Create an AllocationSite if we don't already have it, store it in the | 2725 // Create an AllocationSite if we don't already have it, store it in the |
| 2718 // slot. | 2726 // slot. |
| 2719 CreateAllocationSiteStub create_stub(masm->isolate()); | 2727 CreateAllocationSiteStub create_stub(masm->isolate()); |
| 2720 CallStubInRecordCallTarget(masm, &create_stub, argc, function, | 2728 CallStubInRecordCallTarget(masm, &create_stub, argc, function, |
| 2721 feedback_vector, index, new_target); | 2729 feedback_vector, index, new_target); |
| 2722 __ B(&done); | 2730 __ B(&done); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 // x1 - function | 2786 // x1 - function |
| 2779 // x3 - slot id | 2787 // x3 - slot id |
| 2780 // x2 - vector | 2788 // x2 - vector |
| 2781 // x4 - allocation site (loaded from vector[slot]) | 2789 // x4 - allocation site (loaded from vector[slot]) |
| 2782 Register function = x1; | 2790 Register function = x1; |
| 2783 Register feedback_vector = x2; | 2791 Register feedback_vector = x2; |
| 2784 Register index = x3; | 2792 Register index = x3; |
| 2785 Register allocation_site = x4; | 2793 Register allocation_site = x4; |
| 2786 Register scratch = x5; | 2794 Register scratch = x5; |
| 2787 | 2795 |
| 2788 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch); | 2796 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, scratch); |
| 2789 __ Cmp(function, scratch); | 2797 __ Cmp(function, scratch); |
| 2790 __ B(ne, miss); | 2798 __ B(ne, miss); |
| 2791 | 2799 |
| 2792 __ Mov(x0, Operand(arg_count())); | 2800 __ Mov(x0, Operand(arg_count())); |
| 2793 | 2801 |
| 2794 // Increment the call count for monomorphic function calls. | 2802 // Increment the call count for monomorphic function calls. |
| 2795 __ Add(feedback_vector, feedback_vector, | 2803 __ Add(feedback_vector, feedback_vector, |
| 2796 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); | 2804 Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
| 2797 __ Add(feedback_vector, feedback_vector, | 2805 __ Add(feedback_vector, feedback_vector, |
| 2798 Operand(FixedArray::kHeaderSize + kPointerSize)); | 2806 Operand(FixedArray::kHeaderSize + kPointerSize)); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2913 __ bind(&uninitialized); | 2921 __ bind(&uninitialized); |
| 2914 | 2922 |
| 2915 // We are going monomorphic, provided we actually have a JSFunction. | 2923 // We are going monomorphic, provided we actually have a JSFunction. |
| 2916 __ JumpIfSmi(function, &miss); | 2924 __ JumpIfSmi(function, &miss); |
| 2917 | 2925 |
| 2918 // Goto miss case if we do not have a function. | 2926 // Goto miss case if we do not have a function. |
| 2919 __ JumpIfNotObjectType(function, x5, x5, JS_FUNCTION_TYPE, &miss); | 2927 __ JumpIfNotObjectType(function, x5, x5, JS_FUNCTION_TYPE, &miss); |
| 2920 | 2928 |
| 2921 // Make sure the function is not the Array() function, which requires special | 2929 // Make sure the function is not the Array() function, which requires special |
| 2922 // behavior on MISS. | 2930 // behavior on MISS. |
| 2923 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, x5); | 2931 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, x5); |
| 2924 __ Cmp(function, x5); | 2932 __ Cmp(function, x5); |
| 2925 __ B(eq, &miss); | 2933 __ B(eq, &miss); |
| 2926 | 2934 |
| 2927 // Make sure the function belongs to the same native context. | 2935 // Make sure the function belongs to the same native context (which implies |
| 2936 // the same global object). |
| 2928 __ Ldr(x4, FieldMemOperand(function, JSFunction::kContextOffset)); | 2937 __ Ldr(x4, FieldMemOperand(function, JSFunction::kContextOffset)); |
| 2929 __ Ldr(x4, ContextMemOperand(x4, Context::NATIVE_CONTEXT_INDEX)); | 2938 __ Ldr(x4, ContextMemOperand(x4, Context::GLOBAL_OBJECT_INDEX)); |
| 2930 __ Ldr(x5, NativeContextMemOperand()); | 2939 __ Ldr(x4, GlobalObjectMemOperand()); |
| 2931 __ Cmp(x4, x5); | 2940 __ Cmp(x4, x5); |
| 2932 __ B(ne, &miss); | 2941 __ B(ne, &miss); |
| 2933 | 2942 |
| 2934 // Update stats. | 2943 // Update stats. |
| 2935 __ Ldr(x4, FieldMemOperand(feedback_vector, with_types_offset)); | 2944 __ Ldr(x4, FieldMemOperand(feedback_vector, with_types_offset)); |
| 2936 __ Adds(x4, x4, Operand(Smi::FromInt(1))); | 2945 __ Adds(x4, x4, Operand(Smi::FromInt(1))); |
| 2937 __ Str(x4, FieldMemOperand(feedback_vector, with_types_offset)); | 2946 __ Str(x4, FieldMemOperand(feedback_vector, with_types_offset)); |
| 2938 | 2947 |
| 2939 // Initialize the call counter. | 2948 // Initialize the call counter. |
| 2940 __ Mov(x5, Smi::FromInt(CallICNexus::kCallCountIncrement)); | 2949 __ Mov(x5, Smi::FromInt(CallICNexus::kCallCountIncrement)); |
| (...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5793 MemOperand(fp, 6 * kPointerSize), NULL); | 5802 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5794 } | 5803 } |
| 5795 | 5804 |
| 5796 | 5805 |
| 5797 #undef __ | 5806 #undef __ |
| 5798 | 5807 |
| 5799 } // namespace internal | 5808 } // namespace internal |
| 5800 } // namespace v8 | 5809 } // namespace v8 |
| 5801 | 5810 |
| 5802 #endif // V8_TARGET_ARCH_ARM64 | 5811 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |