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

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

Issue 2410183002: PPC/s390: [stubs] Simplify the ArrayConstructorStub. (Closed)
Patch Set: Created 4 years, 2 months 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/ppc/code-stubs-ppc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_S390 5 #if V8_TARGET_ARCH_S390
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/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 1875
1876 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { 1876 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
1877 // r3 - function 1877 // r3 - function
1878 // r5 - slot id 1878 // r5 - slot id
1879 // r4 - vector 1879 // r4 - vector
1880 // r6 - allocation site (loaded from vector[slot]) 1880 // r6 - allocation site (loaded from vector[slot])
1881 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7); 1881 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r7);
1882 __ CmpP(r3, r7); 1882 __ CmpP(r3, r7);
1883 __ bne(miss); 1883 __ bne(miss);
1884 1884
1885 __ mov(r2, Operand(arg_count()));
1886
1887 // Increment the call count for monomorphic function calls. 1885 // Increment the call count for monomorphic function calls.
1888 IncrementCallCount(masm, r4, r5, r1); 1886 IncrementCallCount(masm, r4, r5, r1);
1889 1887
1890 __ LoadRR(r4, r6); 1888 __ LoadRR(r4, r6);
1891 __ LoadRR(r5, r3); 1889 __ LoadRR(r5, r3);
1892 ArrayConstructorStub stub(masm->isolate(), arg_count()); 1890 __ mov(r2, Operand(arg_count()));
1891 ArrayConstructorStub stub(masm->isolate());
1893 __ TailCallStub(&stub); 1892 __ TailCallStub(&stub);
1894 } 1893 }
1895 1894
1896 void CallICStub::Generate(MacroAssembler* masm) { 1895 void CallICStub::Generate(MacroAssembler* masm) {
1897 // r3 - function 1896 // r3 - function
1898 // r5 - slot id (Smi) 1897 // r5 - slot id (Smi)
1899 // r4 - vector 1898 // r4 - vector
1900 Label extra_checks_or_miss, call, call_function, call_count_incremented; 1899 Label extra_checks_or_miss, call, call_function, call_count_incremented;
1901 int argc = arg_count(); 1900 int argc = arg_count();
1902 ParameterCount actual(argc); 1901 ParameterCount actual(argc);
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after
3788 // For internal arrays we only need a few things 3787 // For internal arrays we only need a few things
3789 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); 3788 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]);
3790 stubh1.GetCode(); 3789 stubh1.GetCode();
3791 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); 3790 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
3792 stubh2.GetCode(); 3791 stubh2.GetCode();
3793 } 3792 }
3794 } 3793 }
3795 3794
3796 void ArrayConstructorStub::GenerateDispatchToArrayStub( 3795 void ArrayConstructorStub::GenerateDispatchToArrayStub(
3797 MacroAssembler* masm, AllocationSiteOverrideMode mode) { 3796 MacroAssembler* masm, AllocationSiteOverrideMode mode) {
3798 if (argument_count() == ANY) { 3797 Label not_zero_case, not_one_case;
3799 Label not_zero_case, not_one_case; 3798 __ CmpP(r2, Operand::Zero());
3800 __ CmpP(r2, Operand::Zero()); 3799 __ bne(&not_zero_case);
3801 __ bne(&not_zero_case); 3800 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
3802 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
3803 3801
3804 __ bind(&not_zero_case); 3802 __ bind(&not_zero_case);
3805 __ CmpP(r2, Operand(1)); 3803 __ CmpP(r2, Operand(1));
3806 __ bgt(&not_one_case); 3804 __ bgt(&not_one_case);
3807 CreateArrayDispatchOneArgument(masm, mode); 3805 CreateArrayDispatchOneArgument(masm, mode);
3808 3806
3809 __ bind(&not_one_case); 3807 __ bind(&not_one_case);
3810 ArrayNArgumentsConstructorStub stub(masm->isolate()); 3808 ArrayNArgumentsConstructorStub stub(masm->isolate());
3811 __ TailCallStub(&stub); 3809 __ TailCallStub(&stub);
3812 } else if (argument_count() == NONE) {
3813 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
3814 } else if (argument_count() == ONE) {
3815 CreateArrayDispatchOneArgument(masm, mode);
3816 } else if (argument_count() == MORE_THAN_ONE) {
3817 ArrayNArgumentsConstructorStub stub(masm->isolate());
3818 __ TailCallStub(&stub);
3819 } else {
3820 UNREACHABLE();
3821 }
3822 } 3810 }
3823 3811
3824 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 3812 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
3825 // ----------- S t a t e ------------- 3813 // ----------- S t a t e -------------
3826 // -- r2 : argc (only if argument_count() == ANY) 3814 // -- r2 : argc (only if argument_count() == ANY)
3827 // -- r3 : constructor 3815 // -- r3 : constructor
3828 // -- r4 : AllocationSite or undefined 3816 // -- r4 : AllocationSite or undefined
3829 // -- r5 : new target 3817 // -- r5 : new target
3830 // -- sp[0] : return address 3818 // -- sp[0] : return address
3831 // -- sp[4] : last argument 3819 // -- sp[4] : last argument
(...skipping 30 matching lines...) Expand all
3862 __ LoadP(r5, FieldMemOperand(r4, AllocationSite::kTransitionInfoOffset)); 3850 __ LoadP(r5, FieldMemOperand(r4, AllocationSite::kTransitionInfoOffset));
3863 __ SmiUntag(r5); 3851 __ SmiUntag(r5);
3864 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 3852 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
3865 __ AndP(r5, Operand(AllocationSite::ElementsKindBits::kMask)); 3853 __ AndP(r5, Operand(AllocationSite::ElementsKindBits::kMask));
3866 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 3854 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
3867 3855
3868 __ bind(&no_info); 3856 __ bind(&no_info);
3869 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 3857 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
3870 3858
3871 __ bind(&subclassing); 3859 __ bind(&subclassing);
3872 switch (argument_count()) { 3860 __ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2));
3873 case ANY: 3861 __ StoreP(r3, MemOperand(sp, r1));
3874 case MORE_THAN_ONE: 3862 __ AddP(r2, r2, Operand(3));
3875 __ ShiftLeftP(r1, r2, Operand(kPointerSizeLog2));
3876 __ StoreP(r3, MemOperand(sp, r1));
3877 __ AddP(r2, r2, Operand(3));
3878 break;
3879 case NONE:
3880 __ StoreP(r3, MemOperand(sp, 0 * kPointerSize));
3881 __ LoadImmP(r2, Operand(3));
3882 break;
3883 case ONE:
3884 __ StoreP(r3, MemOperand(sp, 1 * kPointerSize));
3885 __ LoadImmP(r2, Operand(4));
3886 break;
3887 }
3888
3889 __ Push(r5, r4); 3863 __ Push(r5, r4);
3890 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); 3864 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate()));
3891 } 3865 }
3892 3866
3893 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, 3867 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm,
3894 ElementsKind kind) { 3868 ElementsKind kind) {
3895 __ CmpLogicalP(r2, Operand(1)); 3869 __ CmpLogicalP(r2, Operand(1));
3896 3870
3897 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); 3871 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind);
3898 __ TailCallStub(&stub0, lt); 3872 __ TailCallStub(&stub0, lt);
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
5082 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 5056 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
5083 kStackUnwindSpace, NULL, return_value_operand, NULL); 5057 kStackUnwindSpace, NULL, return_value_operand, NULL);
5084 } 5058 }
5085 5059
5086 #undef __ 5060 #undef __
5087 5061
5088 } // namespace internal 5062 } // namespace internal
5089 } // namespace v8 5063 } // namespace v8
5090 5064
5091 #endif // V8_TARGET_ARCH_S390 5065 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/ppc/code-stubs-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698