Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/arm64/code-stubs-arm64.cc

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

Powered by Google App Engine
This is Rietveld 408576698