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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2004 Register function = x1; | 2004 Register function = x1; |
2005 Register feedback_vector = x2; | 2005 Register feedback_vector = x2; |
2006 Register index = x3; | 2006 Register index = x3; |
2007 Register allocation_site = x4; | 2007 Register allocation_site = x4; |
2008 Register scratch = x5; | 2008 Register scratch = x5; |
2009 | 2009 |
2010 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch); | 2010 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch); |
2011 __ Cmp(function, scratch); | 2011 __ Cmp(function, scratch); |
2012 __ B(ne, miss); | 2012 __ B(ne, miss); |
2013 | 2013 |
2014 __ Mov(x0, Operand(arg_count())); | |
2015 | |
2016 // Increment the call count for monomorphic function calls. | 2014 // Increment the call count for monomorphic function calls. |
2017 IncrementCallCount(masm, feedback_vector, index); | 2015 IncrementCallCount(masm, feedback_vector, index); |
2018 | 2016 |
2019 // Set up arguments for the array constructor stub. | 2017 // Set up arguments for the array constructor stub. |
2020 Register allocation_site_arg = feedback_vector; | 2018 Register allocation_site_arg = feedback_vector; |
2021 Register new_target_arg = index; | 2019 Register new_target_arg = index; |
2022 __ Mov(allocation_site_arg, allocation_site); | 2020 __ Mov(allocation_site_arg, allocation_site); |
2023 __ Mov(new_target_arg, function); | 2021 __ Mov(new_target_arg, function); |
2024 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2022 __ Mov(x0, Operand(arg_count())); |
| 2023 ArrayConstructorStub stub(masm->isolate()); |
2025 __ TailCallStub(&stub); | 2024 __ TailCallStub(&stub); |
2026 } | 2025 } |
2027 | 2026 |
2028 | 2027 |
2029 void CallICStub::Generate(MacroAssembler* masm) { | 2028 void CallICStub::Generate(MacroAssembler* masm) { |
2030 ASM_LOCATION("CallICStub"); | 2029 ASM_LOCATION("CallICStub"); |
2031 | 2030 |
2032 // x1 - function | 2031 // x1 - function |
2033 // x3 - slot id (Smi) | 2032 // x3 - slot id (Smi) |
2034 // x2 - vector | 2033 // x2 - vector |
(...skipping 1853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3888 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 3887 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
3889 stubh2.GetCode(); | 3888 stubh2.GetCode(); |
3890 } | 3889 } |
3891 } | 3890 } |
3892 | 3891 |
3893 | 3892 |
3894 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 3893 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
3895 MacroAssembler* masm, | 3894 MacroAssembler* masm, |
3896 AllocationSiteOverrideMode mode) { | 3895 AllocationSiteOverrideMode mode) { |
3897 Register argc = x0; | 3896 Register argc = x0; |
3898 if (argument_count() == ANY) { | 3897 Label zero_case, n_case; |
3899 Label zero_case, n_case; | 3898 __ Cbz(argc, &zero_case); |
3900 __ Cbz(argc, &zero_case); | 3899 __ Cmp(argc, 1); |
3901 __ Cmp(argc, 1); | 3900 __ B(ne, &n_case); |
3902 __ B(ne, &n_case); | |
3903 | 3901 |
3904 // One argument. | 3902 // One argument. |
3905 CreateArrayDispatchOneArgument(masm, mode); | 3903 CreateArrayDispatchOneArgument(masm, mode); |
3906 | 3904 |
3907 __ Bind(&zero_case); | 3905 __ Bind(&zero_case); |
3908 // No arguments. | 3906 // No arguments. |
3909 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | 3907 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
3910 | 3908 |
3911 __ Bind(&n_case); | 3909 __ Bind(&n_case); |
3912 // N arguments. | 3910 // N arguments. |
3913 ArrayNArgumentsConstructorStub stub(masm->isolate()); | 3911 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
3914 __ TailCallStub(&stub); | 3912 __ TailCallStub(&stub); |
3915 } else if (argument_count() == NONE) { | |
3916 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3917 } else if (argument_count() == ONE) { | |
3918 CreateArrayDispatchOneArgument(masm, mode); | |
3919 } else if (argument_count() == MORE_THAN_ONE) { | |
3920 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
3921 __ TailCallStub(&stub); | |
3922 } else { | |
3923 UNREACHABLE(); | |
3924 } | |
3925 } | 3913 } |
3926 | 3914 |
3927 | 3915 |
3928 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 3916 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
3929 ASM_LOCATION("ArrayConstructorStub::Generate"); | 3917 ASM_LOCATION("ArrayConstructorStub::Generate"); |
3930 // ----------- S t a t e ------------- | 3918 // ----------- S t a t e ------------- |
3931 // -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 3919 // -- x0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
3932 // -- x1 : constructor | 3920 // -- x1 : constructor |
3933 // -- x2 : AllocationSite or undefined | 3921 // -- x2 : AllocationSite or undefined |
3934 // -- x3 : new target | 3922 // -- x3 : new target |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3974 UntagSmiFieldMemOperand(allocation_site, | 3962 UntagSmiFieldMemOperand(allocation_site, |
3975 AllocationSite::kTransitionInfoOffset)); | 3963 AllocationSite::kTransitionInfoOffset)); |
3976 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); | 3964 __ And(kind, kind, AllocationSite::ElementsKindBits::kMask); |
3977 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 3965 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
3978 | 3966 |
3979 __ Bind(&no_info); | 3967 __ Bind(&no_info); |
3980 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 3968 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
3981 | 3969 |
3982 // Subclassing support. | 3970 // Subclassing support. |
3983 __ Bind(&subclassing); | 3971 __ Bind(&subclassing); |
3984 switch (argument_count()) { | 3972 __ Poke(constructor, Operand(x0, LSL, kPointerSizeLog2)); |
3985 case ANY: | 3973 __ Add(x0, x0, Operand(3)); |
3986 case MORE_THAN_ONE: | |
3987 __ Poke(constructor, Operand(x0, LSL, kPointerSizeLog2)); | |
3988 __ Add(x0, x0, Operand(3)); | |
3989 break; | |
3990 case NONE: | |
3991 __ Poke(constructor, 0 * kPointerSize); | |
3992 __ Mov(x0, Operand(3)); | |
3993 break; | |
3994 case ONE: | |
3995 __ Poke(constructor, 1 * kPointerSize); | |
3996 __ Mov(x0, Operand(4)); | |
3997 break; | |
3998 } | |
3999 __ Push(new_target, allocation_site); | 3974 __ Push(new_target, allocation_site); |
4000 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 3975 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
4001 } | 3976 } |
4002 | 3977 |
4003 | 3978 |
4004 void InternalArrayConstructorStub::GenerateCase( | 3979 void InternalArrayConstructorStub::GenerateCase( |
4005 MacroAssembler* masm, ElementsKind kind) { | 3980 MacroAssembler* masm, ElementsKind kind) { |
4006 Label zero_case, n_case; | 3981 Label zero_case, n_case; |
4007 Register argc = x0; | 3982 Register argc = x0; |
4008 | 3983 |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5244 kStackUnwindSpace, NULL, spill_offset, | 5219 kStackUnwindSpace, NULL, spill_offset, |
5245 return_value_operand, NULL); | 5220 return_value_operand, NULL); |
5246 } | 5221 } |
5247 | 5222 |
5248 #undef __ | 5223 #undef __ |
5249 | 5224 |
5250 } // namespace internal | 5225 } // namespace internal |
5251 } // namespace v8 | 5226 } // namespace v8 |
5252 | 5227 |
5253 #endif // V8_TARGET_ARCH_ARM64 | 5228 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |