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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 } | 1964 } |
1965 | 1965 |
1966 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { | 1966 void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { |
1967 // a1 - function | 1967 // a1 - function |
1968 // a3 - slot id | 1968 // a3 - slot id |
1969 // a2 - vector | 1969 // a2 - vector |
1970 // a4 - allocation site (loaded from vector[slot]) | 1970 // a4 - allocation site (loaded from vector[slot]) |
1971 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); | 1971 __ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, at); |
1972 __ Branch(miss, ne, a1, Operand(at)); | 1972 __ Branch(miss, ne, a1, Operand(at)); |
1973 | 1973 |
1974 __ li(a0, Operand(arg_count())); | |
1975 | |
1976 // Increment the call count for monomorphic function calls. | 1974 // Increment the call count for monomorphic function calls. |
1977 IncrementCallCount(masm, a2, a3); | 1975 IncrementCallCount(masm, a2, a3); |
1978 | 1976 |
1979 __ mov(a2, a4); | 1977 __ mov(a2, a4); |
1980 __ mov(a3, a1); | 1978 __ mov(a3, a1); |
1981 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 1979 __ li(a0, Operand(arg_count())); |
| 1980 ArrayConstructorStub stub(masm->isolate()); |
1982 __ TailCallStub(&stub); | 1981 __ TailCallStub(&stub); |
1983 } | 1982 } |
1984 | 1983 |
1985 | 1984 |
1986 void CallICStub::Generate(MacroAssembler* masm) { | 1985 void CallICStub::Generate(MacroAssembler* masm) { |
1987 // a1 - function | 1986 // a1 - function |
1988 // a3 - slot id (Smi) | 1987 // a3 - slot id (Smi) |
1989 // a2 - vector | 1988 // a2 - vector |
1990 Label extra_checks_or_miss, call, call_function, call_count_incremented; | 1989 Label extra_checks_or_miss, call, call_function, call_count_incremented; |
1991 int argc = arg_count(); | 1990 int argc = arg_count(); |
(...skipping 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 stubh1.GetCode(); | 3895 stubh1.GetCode(); |
3897 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); | 3896 InternalArraySingleArgumentConstructorStub stubh2(isolate, kinds[i]); |
3898 stubh2.GetCode(); | 3897 stubh2.GetCode(); |
3899 } | 3898 } |
3900 } | 3899 } |
3901 | 3900 |
3902 | 3901 |
3903 void ArrayConstructorStub::GenerateDispatchToArrayStub( | 3902 void ArrayConstructorStub::GenerateDispatchToArrayStub( |
3904 MacroAssembler* masm, | 3903 MacroAssembler* masm, |
3905 AllocationSiteOverrideMode mode) { | 3904 AllocationSiteOverrideMode mode) { |
3906 if (argument_count() == ANY) { | 3905 Label not_zero_case, not_one_case; |
3907 Label not_zero_case, not_one_case; | 3906 __ And(at, a0, a0); |
3908 __ And(at, a0, a0); | 3907 __ Branch(¬_zero_case, ne, at, Operand(zero_reg)); |
3909 __ Branch(¬_zero_case, ne, at, Operand(zero_reg)); | 3908 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); |
3910 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3911 | 3909 |
3912 __ bind(¬_zero_case); | 3910 __ bind(¬_zero_case); |
3913 __ Branch(¬_one_case, gt, a0, Operand(1)); | 3911 __ Branch(¬_one_case, gt, a0, Operand(1)); |
3914 CreateArrayDispatchOneArgument(masm, mode); | 3912 CreateArrayDispatchOneArgument(masm, mode); |
3915 | 3913 |
3916 __ bind(¬_one_case); | 3914 __ bind(¬_one_case); |
3917 ArrayNArgumentsConstructorStub stub(masm->isolate()); | 3915 ArrayNArgumentsConstructorStub stub(masm->isolate()); |
3918 __ TailCallStub(&stub); | 3916 __ TailCallStub(&stub); |
3919 } else if (argument_count() == NONE) { | |
3920 CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode); | |
3921 } else if (argument_count() == ONE) { | |
3922 CreateArrayDispatchOneArgument(masm, mode); | |
3923 } else if (argument_count() == MORE_THAN_ONE) { | |
3924 ArrayNArgumentsConstructorStub stub(masm->isolate()); | |
3925 __ TailCallStub(&stub); | |
3926 } else { | |
3927 UNREACHABLE(); | |
3928 } | |
3929 } | 3917 } |
3930 | 3918 |
3931 | 3919 |
3932 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 3920 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
3933 // ----------- S t a t e ------------- | 3921 // ----------- S t a t e ------------- |
3934 // -- a0 : argc (only if argument_count() == ANY) | 3922 // -- a0 : argc (only if argument_count() == ANY) |
3935 // -- a1 : constructor | 3923 // -- a1 : constructor |
3936 // -- a2 : AllocationSite or undefined | 3924 // -- a2 : AllocationSite or undefined |
3937 // -- a3 : new target | 3925 // -- a3 : new target |
3938 // -- sp[0] : last argument | 3926 // -- sp[0] : last argument |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3971 __ SmiUntag(a3); | 3959 __ SmiUntag(a3); |
3972 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 3960 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
3973 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); | 3961 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); |
3974 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 3962 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
3975 | 3963 |
3976 __ bind(&no_info); | 3964 __ bind(&no_info); |
3977 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 3965 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
3978 | 3966 |
3979 // Subclassing. | 3967 // Subclassing. |
3980 __ bind(&subclassing); | 3968 __ bind(&subclassing); |
3981 switch (argument_count()) { | 3969 __ Dlsa(at, sp, a0, kPointerSizeLog2); |
3982 case ANY: | 3970 __ sd(a1, MemOperand(at)); |
3983 case MORE_THAN_ONE: | 3971 __ li(at, Operand(3)); |
3984 __ Dlsa(at, sp, a0, kPointerSizeLog2); | 3972 __ Daddu(a0, a0, at); |
3985 __ sd(a1, MemOperand(at)); | |
3986 __ li(at, Operand(3)); | |
3987 __ Daddu(a0, a0, at); | |
3988 break; | |
3989 case NONE: | |
3990 __ sd(a1, MemOperand(sp, 0 * kPointerSize)); | |
3991 __ li(a0, Operand(3)); | |
3992 break; | |
3993 case ONE: | |
3994 __ sd(a1, MemOperand(sp, 1 * kPointerSize)); | |
3995 __ li(a0, Operand(4)); | |
3996 break; | |
3997 } | |
3998 __ Push(a3, a2); | 3973 __ Push(a3, a2); |
3999 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); | 3974 __ JumpToExternalReference(ExternalReference(Runtime::kNewArray, isolate())); |
4000 } | 3975 } |
4001 | 3976 |
4002 | 3977 |
4003 void InternalArrayConstructorStub::GenerateCase( | 3978 void InternalArrayConstructorStub::GenerateCase( |
4004 MacroAssembler* masm, ElementsKind kind) { | 3979 MacroAssembler* masm, ElementsKind kind) { |
4005 | 3980 |
4006 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 3981 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4007 __ TailCallStub(&stub0, lo, a0, Operand(1)); | 3982 __ TailCallStub(&stub0, lo, a0, Operand(1)); |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5127 kStackUnwindSpace, kInvalidStackOffset, | 5102 kStackUnwindSpace, kInvalidStackOffset, |
5128 return_value_operand, NULL); | 5103 return_value_operand, NULL); |
5129 } | 5104 } |
5130 | 5105 |
5131 #undef __ | 5106 #undef __ |
5132 | 5107 |
5133 } // namespace internal | 5108 } // namespace internal |
5134 } // namespace v8 | 5109 } // namespace v8 |
5135 | 5110 |
5136 #endif // V8_TARGET_ARCH_MIPS64 | 5111 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |