OLD | NEW |
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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 | 1874 |
1875 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { | 1875 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
1876 // r4 - function | 1876 // r4 - function |
1877 // r6 - slot id | 1877 // r6 - slot id |
1878 // r5 - vector | 1878 // r5 - vector |
1879 // r7 - allocation site (loaded from vector[slot]) | 1879 // r7 - allocation site (loaded from vector[slot]) |
1880 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r8); | 1880 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r8); |
1881 __ cmp(r4, r8); | 1881 __ cmp(r4, r8); |
1882 __ bne(miss); | 1882 __ bne(miss); |
1883 | 1883 |
1884 __ mov(r3, Operand(arg_count())); | |
1885 | |
1886 // Increment the call count for monomorphic function calls. | 1884 // Increment the call count for monomorphic function calls. |
1887 IncrementCallCount(masm, r5, r6, r0); | 1885 IncrementCallCount(masm, r5, r6, r0); |
1888 | 1886 |
1889 __ mr(r5, r7); | 1887 __ mr(r5, r7); |
1890 __ mr(r6, r4); | 1888 __ mr(r6, r4); |
1891 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 1889 __ mov(r3, Operand(arg_count())); |
| 1890 ArrayConstructorStub stub(masm->isolate()); |
1892 __ TailCallStub(&stub); | 1891 __ TailCallStub(&stub); |
1893 } | 1892 } |
1894 | 1893 |
1895 | 1894 |
1896 void CallICStub::Generate(MacroAssembler* masm) { | 1895 void CallICStub::Generate(MacroAssembler* masm) { |
1897 // r4 - function | 1896 // r4 - function |
1898 // r6 - slot id (Smi) | 1897 // r6 - slot id (Smi) |
1899 // r5 - vector | 1898 // r5 - 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(); |
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); | 3854 InternalArrayNoArgumentConstructorStub stubh1(isolate, kinds[i]); |
3856 stubh1.GetCode(); | 3855 stubh1.GetCode(); |
3857 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 3856 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
3858 stubh2.GetCode(); | 3857 stubh2.GetCode(); |
3859 } | 3858 } |
3860 } | 3859 } |
3861 | 3860 |
3862 | 3861 |
3863 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 3862 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
3864 MacroAssembler* masm, AllocationSiteOverrideMode mode) { | 3863 MacroAssembler* masm, AllocationSiteOverrideMode mode) { |
3865 if (argument_count() == ANY) { | 3864 Label not_zero_case, not_one_case; |
3866 Label not_zero_case, not_one_case; | 3865 __ cmpi(r3, Operand::Zero()); |
3867 __ cmpi(r3, Operand::Zero()); | 3866 __ bne(¬_zero_case); |
3868 __ bne(¬_zero_case); | 3867 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
3869 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3870 | 3868 |
3871 __ bind(¬_zero_case); | 3869 __ bind(¬_zero_case); |
3872 __ cmpi(r3, Operand(1)); | 3870 __ cmpi(r3, Operand(1)); |
3873 __ bgt(¬_one_case); | 3871 __ bgt(¬_one_case); |
3874 CreateArrayDispatchOneArgument(masm, mode); | 3872 CreateArrayDispatchOneArgument(masm, mode); |
3875 | 3873 |
3876 __ bind(¬_one_case); | 3874 __ bind(¬_one_case); |
3877 ArrayNArgumentsConstructorStub stub(masm->isolate()); | 3875 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
3878 __ TailCallStub(&stub); | 3876 __ TailCallStub(&stub); |
3879 } else if (argument_count() == NONE) { | |
3880 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3881 } else if (argument_count() == ONE) { | |
3882 CreateArrayDispatchOneArgument(masm, mode); | |
3883 } else if (argument_count() == MORE_THAN_ONE) { | |
3884 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
3885 __ TailCallStub(&stub); | |
3886 } else { | |
3887 UNREACHABLE(); | |
3888 } | |
3889 } | 3877 } |
3890 | 3878 |
3891 | 3879 |
3892 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 3880 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
3893 // ----------- S t a t e ------------- | 3881 // ----------- S t a t e ------------- |
3894 // -- r3 : argc (only if argument_count() == ANY) | 3882 // -- r3 : argc (only if argument_count() == ANY) |
3895 // -- r4 : constructor | 3883 // -- r4 : constructor |
3896 // -- r5 : AllocationSite or undefined | 3884 // -- r5 : AllocationSite or undefined |
3897 // -- r6 : new target | 3885 // -- r6 : new target |
3898 // -- sp[0] : return address | 3886 // -- sp[0] : return address |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3930 __ LoadP(r6, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 3918 __ LoadP(r6, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); |
3931 __ SmiUntag(r6); | 3919 __ SmiUntag(r6); |
3932 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 3920 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
3933 __ And(r6, r6, Operand(AllocationSite::ElementsKindBits::kMask)); | 3921 __ And(r6, r6, Operand(AllocationSite::ElementsKindBits::kMask)); |
3934 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 3922 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
3935 | 3923 |
3936 __ bind(&no_info); | 3924 __ bind(&no_info); |
3937 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 3925 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
3938 | 3926 |
3939 __ bind(&subclassing); | 3927 __ bind(&subclassing); |
3940 switch (argument_count()) { | 3928 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); |
3941 case ANY: | 3929 __ StorePX(r4, MemOperand(sp, r0)); |
3942 case MORE_THAN_ONE: | 3930 __ addi(r3, r3, Operand(3)); |
3943 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); | |
3944 __ StorePX(r4, MemOperand(sp, r0)); | |
3945 __ addi(r3, r3, Operand(3)); | |
3946 break; | |
3947 case NONE: | |
3948 __ StoreP(r4, MemOperand(sp, 0 * kPointerSize)); | |
3949 __ li(r3, Operand(3)); | |
3950 break; | |
3951 case ONE: | |
3952 __ StoreP(r4, MemOperand(sp, 1 * kPointerSize)); | |
3953 __ li(r3, Operand(4)); | |
3954 break; | |
3955 } | |
3956 | |
3957 __ Push(r6, r5); | 3931 __ Push(r6, r5); |
3958 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 3932 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
3959 } | 3933 } |
3960 | 3934 |
3961 | 3935 |
3962 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, | 3936 void InternalArrayConstructorStub::GenerateCase(MacroAssembler* masm, |
3963 ElementsKind kind) { | 3937 ElementsKind kind) { |
3964 __ cmpli(r3, Operand(1)); | 3938 __ cmpli(r3, Operand(1)); |
3965 | 3939 |
3966 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 3940 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5172 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); | 5146 fp, (PropertyCallbackArguments::kReturnValueOffset + 3) * kPointerSize); |
5173 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, | 5147 CallApiFunctionAndReturn(masm, api_function_address, thunk_ref, |
5174 kStackUnwindSpace, NULL, return_value_operand, NULL); | 5148 kStackUnwindSpace, NULL, return_value_operand, NULL); |
5175 } | 5149 } |
5176 | 5150 |
5177 #undef __ | 5151 #undef __ |
5178 } // namespace internal | 5152 } // namespace internal |
5179 } // namespace v8 | 5153 } // namespace v8 |
5180 | 5154 |
5181 #endif // V8_TARGET_ARCH_PPC | 5155 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |