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

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

Issue 2405203002: [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 | « no previous file | src/arm64/code-stubs-arm64.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_ARM 5 #if V8_TARGET_ARCH_ARM
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 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 1785
1786 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { 1786 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
1787 // r1 - function 1787 // r1 - function
1788 // r3 - slot id 1788 // r3 - slot id
1789 // r2 - vector 1789 // r2 - vector
1790 // r4 - allocation site (loaded from vector[slot]) 1790 // r4 - allocation site (loaded from vector[slot])
1791 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5); 1791 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5);
1792 __ cmp(r1, r5); 1792 __ cmp(r1, r5);
1793 __ b(ne, miss); 1793 __ b(ne, miss);
1794 1794
1795 __ mov(r0, Operand(arg_count()));
1796
1797 // Increment the call count for monomorphic function calls. 1795 // Increment the call count for monomorphic function calls.
1798 IncrementCallCount(masm, r2, r3); 1796 IncrementCallCount(masm, r2, r3);
1799 1797
1800 __ mov(r2, r4); 1798 __ mov(r2, r4);
1801 __ mov(r3, r1); 1799 __ mov(r3, r1);
1802 ArrayConstructorStub stub(masm->isolate(), arg_count()); 1800 __ mov(r0, Operand(arg_count()));
1801 ArrayConstructorStub stub(masm->isolate());
1803 __ TailCallStub(&stub); 1802 __ TailCallStub(&stub);
1804 } 1803 }
1805 1804
1806 1805
1807 void CallICStub::Generate(MacroAssembler* masm) { 1806 void CallICStub::Generate(MacroAssembler* masm) {
1808 // r1 - function 1807 // r1 - function
1809 // r3 - slot id (Smi) 1808 // r3 - slot id (Smi)
1810 // r2 - vector 1809 // r2 - vector
1811 Label extra_checks_or_miss, call, call_function, call_count_incremented; 1810 Label extra_checks_or_miss, call, call_function, call_count_incremented;
1812 int argc = arg_count(); 1811 int argc = arg_count();
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 stubh1.GetCode(); 3698 stubh1.GetCode();
3700 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); 3699 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]);
3701 stubh2.GetCode(); 3700 stubh2.GetCode();
3702 } 3701 }
3703 } 3702 }
3704 3703
3705 3704
3706 void ArrayConstructorStub::GenerateDispatchToArrayStub( 3705 void ArrayConstructorStub::GenerateDispatchToArrayStub(
3707 MacroAssembler* masm, 3706 MacroAssembler* masm,
3708 AllocationSiteOverrideMode mode) { 3707 AllocationSiteOverrideMode mode) {
3709 if (argument_count() == ANY) { 3708 Label not_zero_case, not_one_case;
3710 Label not_zero_case, not_one_case; 3709 __ tst(r0, r0);
3711 __ tst(r0, r0); 3710 __ b(ne, &not_zero_case);
3712 __ b(ne, &not_zero_case); 3711 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
3713 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
3714 3712
3715 __ bind(&not_zero_case); 3713 __ bind(&not_zero_case);
3716 __ cmp(r0, Operand(1)); 3714 __ cmp(r0, Operand(1));
3717 __ b(gt, &not_one_case); 3715 __ b(gt, &not_one_case);
3718 CreateArrayDispatchOneArgument(masm, mode); 3716 CreateArrayDispatchOneArgument(masm, mode);
3719 3717
3720 __ bind(&not_one_case); 3718 __ bind(&not_one_case);
3721 ArrayNArgumentsConstructorStub stub(masm->isolate()); 3719 ArrayNArgumentsConstructorStub stub(masm->isolate());
3722 __ TailCallStub(&stub); 3720 __ TailCallStub(&stub);
3723 } else if (argument_count() == NONE) {
3724 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
3725 } else if (argument_count() == ONE) {
3726 CreateArrayDispatchOneArgument(masm, mode);
3727 } else if (argument_count() == MORE_THAN_ONE) {
3728 ArrayNArgumentsConstructorStub stub(masm->isolate());
3729 __ TailCallStub(&stub);
3730 } else {
3731 UNREACHABLE();
3732 }
3733 } 3721 }
3734 3722
3735 3723
3736 void ArrayConstructorStub::Generate(MacroAssembler* masm) { 3724 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
3737 // ----------- S t a t e ------------- 3725 // ----------- S t a t e -------------
3738 // -- r0 : argc (only if argument_count() == ANY) 3726 // -- r0 : argc (only if argument_count() == ANY)
3739 // -- r1 : constructor 3727 // -- r1 : constructor
3740 // -- r2 : AllocationSite or undefined 3728 // -- r2 : AllocationSite or undefined
3741 // -- r3 : new target 3729 // -- r3 : new target
3742 // -- sp[0] : return address 3730 // -- sp[0] : return address
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3774 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); 3762 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset));
3775 __ SmiUntag(r3); 3763 __ SmiUntag(r3);
3776 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 3764 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
3777 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); 3765 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask));
3778 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 3766 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
3779 3767
3780 __ bind(&no_info); 3768 __ bind(&no_info);
3781 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 3769 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
3782 3770
3783 __ bind(&subclassing); 3771 __ bind(&subclassing);
3784 switch (argument_count()) { 3772 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
3785 case ANY: 3773 __ add(r0, r0, Operand(3));
3786 case MORE_THAN_ONE:
3787 __ str(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2));
3788 __ add(r0, r0, Operand(3));
3789 break;
3790 case NONE:
3791 __ str(r1, MemOperand(sp, 0 * kPointerSize));
3792 __ mov(r0, Operand(3));
3793 break;
3794 case ONE:
3795 __ str(r1, MemOperand(sp, 1 * kPointerSize));
3796 __ mov(r0, Operand(4));
3797 break;
3798 }
3799 __ Push(r3, r2); 3774 __ Push(r3, r2);
3800 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); 3775 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate()));
3801 } 3776 }
3802 3777
3803 3778
3804 void InternalArrayConstructorStub::GenerateCase( 3779 void InternalArrayConstructorStub::GenerateCase(
3805 MacroAssembler* masm, ElementsKind kind) { 3780 MacroAssembler* masm, ElementsKind kind) {
3806 __ cmp(r0, Operand(1)); 3781 __ cmp(r0, Operand(1));
3807 3782
3808 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); 3783 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind);
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
4913 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, 4888 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref,
4914 kStackUnwindSpace, NULL, return_value_operand, NULL); 4889 kStackUnwindSpace, NULL, return_value_operand, NULL);
4915 } 4890 }
4916 4891
4917 #undef __ 4892 #undef __
4918 4893
4919 } // namespace internal 4894 } // namespace internal
4920 } // namespace v8 4895 } // namespace v8
4921 4896
4922 #endif // V8_TARGET_ARCH_ARM 4897 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/code-stubs-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698