OLD | NEW |
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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 } | 1917 } |
1918 | 1918 |
1919 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { | 1919 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
1920 // a1 - function | 1920 // a1 - function |
1921 // a3 - slot id | 1921 // a3 - slot id |
1922 // a2 - vector | 1922 // a2 - vector |
1923 // t0 - loaded from vector[slot] | 1923 // t0 - loaded from vector[slot] |
1924 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); | 1924 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); |
1925 __ Branch(miss, ne, a1, Operand(at)); | 1925 __ Branch(miss, ne, a1, Operand(at)); |
1926 | 1926 |
1927 __ li(a0, Operand(arg_count())); | |
1928 | |
1929 // Increment the call count for monomorphic function calls. | 1927 // Increment the call count for monomorphic function calls. |
1930 IncrementCallCount(masm, a2, a3); | 1928 IncrementCallCount(masm, a2, a3); |
1931 | 1929 |
1932 __ mov(a2, t0); | 1930 __ mov(a2, t0); |
1933 __ mov(a3, a1); | 1931 __ mov(a3, a1); |
1934 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 1932 __ li(a0, Operand(arg_count())); |
| 1933 ArrayConstructorStub stub(masm->isolate()); |
1935 __ TailCallStub(&stub); | 1934 __ TailCallStub(&stub); |
1936 } | 1935 } |
1937 | 1936 |
1938 | 1937 |
1939 void CallICStub::Generate(MacroAssembler* masm) { | 1938 void CallICStub::Generate(MacroAssembler* masm) { |
1940 // a1 - function | 1939 // a1 - function |
1941 // a3 - slot id (Smi) | 1940 // a3 - slot id (Smi) |
1942 // a2 - vector | 1941 // a2 - vector |
1943 Label extra_checks_or_miss, call, call_function, call_count_incremented; | 1942 Label extra_checks_or_miss, call, call_function, call_count_incremented; |
1944 int argc = arg_count(); | 1943 int argc = arg_count(); |
(...skipping 1946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3891 stubh1.GetCode(); | 3890 stubh1.GetCode(); |
3892 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 3891 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
3893 stubh2.GetCode(); | 3892 stubh2.GetCode(); |
3894 } | 3893 } |
3895 } | 3894 } |
3896 | 3895 |
3897 | 3896 |
3898 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 3897 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
3899 MacroAssembler* masm, | 3898 MacroAssembler* masm, |
3900 AllocationSiteOverrideMode mode) { | 3899 AllocationSiteOverrideMode mode) { |
3901 if (argument_count() == ANY) { | 3900 Label not_zero_case, not_one_case; |
3902 Label not_zero_case, not_one_case; | 3901 __ And(at, a0, a0); |
3903 __ And(at, a0, a0); | 3902 __ Branch(¬_zero_case, ne, at, Operand(zero_reg)); |
3904 __ Branch(¬_zero_case, ne, at, Operand(zero_reg)); | 3903 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
3905 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3906 | 3904 |
3907 __ bind(¬_zero_case); | 3905 __ bind(¬_zero_case); |
3908 __ Branch(¬_one_case, gt, a0, Operand(1)); | 3906 __ Branch(¬_one_case, gt, a0, Operand(1)); |
3909 CreateArrayDispatchOneArgument(masm, mode); | 3907 CreateArrayDispatchOneArgument(masm, mode); |
3910 | 3908 |
3911 __ bind(¬_one_case); | 3909 __ bind(¬_one_case); |
3912 ArrayNArgumentsConstructorStub stub(masm->isolate()); | 3910 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
3913 __ TailCallStub(&stub); | 3911 __ TailCallStub(&stub); |
3914 } else if (argument_count() == NONE) { | |
3915 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3916 } else if (argument_count() == ONE) { | |
3917 CreateArrayDispatchOneArgument(masm, mode); | |
3918 } else if (argument_count() == MORE_THAN_ONE) { | |
3919 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
3920 __ TailCallStub(&stub); | |
3921 } else { | |
3922 UNREACHABLE(); | |
3923 } | |
3924 } | 3912 } |
3925 | 3913 |
3926 | 3914 |
3927 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 3915 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
3928 // ----------- S t a t e ------------- | 3916 // ----------- S t a t e ------------- |
3929 // -- a0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 3917 // -- a0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) |
3930 // -- a1 : constructor | 3918 // -- a1 : constructor |
3931 // -- a2 : AllocationSite or undefined | 3919 // -- a2 : AllocationSite or undefined |
3932 // -- a3 : Original constructor | 3920 // -- a3 : Original constructor |
3933 // -- sp[0] : last argument | 3921 // -- sp[0] : last argument |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3966 __ SmiUntag(a3); | 3954 __ SmiUntag(a3); |
3967 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 3955 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
3968 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); | 3956 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); |
3969 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 3957 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
3970 | 3958 |
3971 __ bind(&no_info); | 3959 __ bind(&no_info); |
3972 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 3960 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
3973 | 3961 |
3974 // Subclassing. | 3962 // Subclassing. |
3975 __ bind(&subclassing); | 3963 __ bind(&subclassing); |
3976 switch (argument_count()) { | 3964 __ Lsa(at, sp, a0, kPointerSizeLog2); |
3977 case ANY: | 3965 __ sw(a1, MemOperand(at)); |
3978 case MORE_THAN_ONE: | 3966 __ li(at, Operand(3)); |
3979 __ Lsa(at, sp, a0, kPointerSizeLog2); | 3967 __ addu(a0, a0, at); |
3980 __ sw(a1, MemOperand(at)); | |
3981 __ li(at, Operand(3)); | |
3982 __ addu(a0, a0, at); | |
3983 break; | |
3984 case NONE: | |
3985 __ sw(a1, MemOperand(sp, 0 * kPointerSize)); | |
3986 __ li(a0, Operand(3)); | |
3987 break; | |
3988 case ONE: | |
3989 __ sw(a1, MemOperand(sp, 1 * kPointerSize)); | |
3990 __ li(a0, Operand(4)); | |
3991 break; | |
3992 } | |
3993 __ Push(a3, a2); | 3968 __ Push(a3, a2); |
3994 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 3969 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
3995 } | 3970 } |
3996 | 3971 |
3997 | 3972 |
3998 void InternalArrayConstructorStub::GenerateCase( | 3973 void InternalArrayConstructorStub::GenerateCase( |
3999 MacroAssembler* masm, ElementsKind kind) { | 3974 MacroAssembler* masm, ElementsKind kind) { |
4000 | 3975 |
4001 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 3976 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4002 __ TailCallStub(&stub0, lo, a0, Operand(1)); | 3977 __ TailCallStub(&stub0, lo, a0, Operand(1)); |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5100 kStackUnwindSpace, kInvalidStackOffset, | 5075 kStackUnwindSpace, kInvalidStackOffset, |
5101 return_value_operand, NULL); | 5076 return_value_operand, NULL); |
5102 } | 5077 } |
5103 | 5078 |
5104 #undef __ | 5079 #undef __ |
5105 | 5080 |
5106 } // namespace internal | 5081 } // namespace internal |
5107 } // namespace v8 | 5082 } // namespace v8 |
5108 | 5083 |
5109 #endif // V8_TARGET_ARCH_MIPS | 5084 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |