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

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

Issue 531033003: MIPS: Minor-key-ify four stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 735
736 // On entry a1 and a2 are the values to be compared. 736 // On entry a1 and a2 are the values to be compared.
737 // On exit a0 is 0, positive or negative to indicate the result of 737 // On exit a0 is 0, positive or negative to indicate the result of
738 // the comparison. 738 // the comparison.
739 void ICCompareStub::GenerateGeneric(MacroAssembler* masm) { 739 void ICCompareStub::GenerateGeneric(MacroAssembler* masm) {
740 Register lhs = a1; 740 Register lhs = a1;
741 Register rhs = a0; 741 Register rhs = a0;
742 Condition cc = GetCondition(); 742 Condition cc = GetCondition();
743 743
744 Label miss; 744 Label miss;
745 ICCompareStub_CheckInputType(masm, lhs, a2, left_, &miss); 745 ICCompareStub_CheckInputType(masm, lhs, a2, left(), &miss);
746 ICCompareStub_CheckInputType(masm, rhs, a3, right_, &miss); 746 ICCompareStub_CheckInputType(masm, rhs, a3, right(), &miss);
747 747
748 Label slow; // Call builtin. 748 Label slow; // Call builtin.
749 Label not_smis, both_loaded_as_doubles; 749 Label not_smis, both_loaded_as_doubles;
750 750
751 Label not_two_smis, smi_done; 751 Label not_two_smis, smi_done;
752 __ Or(a2, a1, a0); 752 __ Or(a2, a1, a0);
753 __ JumpIfNotSmi(a2, &not_two_smis); 753 __ JumpIfNotSmi(a2, &not_two_smis);
754 __ sra(a1, a1, 1); 754 __ sra(a1, a1, 1);
755 __ sra(a0, a0, 1); 755 __ sra(a0, a0, 1);
756 __ Ret(USE_DELAY_SLOT); 756 __ Ret(USE_DELAY_SLOT);
(...skipping 2884 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 } 3641 }
3642 3642
3643 // Tail call into the stub that handles binary operations with allocation 3643 // Tail call into the stub that handles binary operations with allocation
3644 // sites. 3644 // sites.
3645 BinaryOpWithAllocationSiteStub stub(isolate(), state()); 3645 BinaryOpWithAllocationSiteStub stub(isolate(), state());
3646 __ TailCallStub(&stub); 3646 __ TailCallStub(&stub);
3647 } 3647 }
3648 3648
3649 3649
3650 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { 3650 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
3651 DCHECK(state_ == CompareIC::SMI); 3651 DCHECK(state() == CompareIC::SMI);
3652 Label miss; 3652 Label miss;
3653 __ Or(a2, a1, a0); 3653 __ Or(a2, a1, a0);
3654 __ JumpIfNotSmi(a2, &miss); 3654 __ JumpIfNotSmi(a2, &miss);
3655 3655
3656 if (GetCondition() == eq) { 3656 if (GetCondition() == eq) {
3657 // For equality we do not care about the sign of the result. 3657 // For equality we do not care about the sign of the result.
3658 __ Ret(USE_DELAY_SLOT); 3658 __ Ret(USE_DELAY_SLOT);
3659 __ Subu(v0, a0, a1); 3659 __ Subu(v0, a0, a1);
3660 } else { 3660 } else {
3661 // Untag before subtracting to avoid handling overflow. 3661 // Untag before subtracting to avoid handling overflow.
3662 __ SmiUntag(a1); 3662 __ SmiUntag(a1);
3663 __ SmiUntag(a0); 3663 __ SmiUntag(a0);
3664 __ Ret(USE_DELAY_SLOT); 3664 __ Ret(USE_DELAY_SLOT);
3665 __ Subu(v0, a1, a0); 3665 __ Subu(v0, a1, a0);
3666 } 3666 }
3667 3667
3668 __ bind(&miss); 3668 __ bind(&miss);
3669 GenerateMiss(masm); 3669 GenerateMiss(masm);
3670 } 3670 }
3671 3671
3672 3672
3673 void ICCompareStub::GenerateNumbers(MacroAssembler* masm) { 3673 void ICCompareStub::GenerateNumbers(MacroAssembler* masm) {
3674 DCHECK(state_ == CompareIC::NUMBER); 3674 DCHECK(state() == CompareIC::NUMBER);
3675 3675
3676 Label generic_stub; 3676 Label generic_stub;
3677 Label unordered, maybe_undefined1, maybe_undefined2; 3677 Label unordered, maybe_undefined1, maybe_undefined2;
3678 Label miss; 3678 Label miss;
3679 3679
3680 if (left_ == CompareIC::SMI) { 3680 if (left() == CompareIC::SMI) {
3681 __ JumpIfNotSmi(a1, &miss); 3681 __ JumpIfNotSmi(a1, &miss);
3682 } 3682 }
3683 if (right_ == CompareIC::SMI) { 3683 if (right() == CompareIC::SMI) {
3684 __ JumpIfNotSmi(a0, &miss); 3684 __ JumpIfNotSmi(a0, &miss);
3685 } 3685 }
3686 3686
3687 // Inlining the double comparison and falling back to the general compare 3687 // Inlining the double comparison and falling back to the general compare
3688 // stub if NaN is involved. 3688 // stub if NaN is involved.
3689 // Load left and right operand. 3689 // Load left and right operand.
3690 Label done, left, left_smi, right_smi; 3690 Label done, left, left_smi, right_smi;
3691 __ JumpIfSmi(a0, &right_smi); 3691 __ JumpIfSmi(a0, &right_smi);
3692 __ CheckMap(a0, a2, Heap::kHeapNumberMapRootIndex, &maybe_undefined1, 3692 __ CheckMap(a0, a2, Heap::kHeapNumberMapRootIndex, &maybe_undefined1,
3693 DONT_DO_SMI_CHECK); 3693 DONT_DO_SMI_CHECK);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 __ bind(&fpu_eq); 3731 __ bind(&fpu_eq);
3732 __ Ret(USE_DELAY_SLOT); 3732 __ Ret(USE_DELAY_SLOT);
3733 __ li(v0, Operand(EQUAL)); 3733 __ li(v0, Operand(EQUAL));
3734 3734
3735 __ bind(&fpu_lt); 3735 __ bind(&fpu_lt);
3736 __ Ret(USE_DELAY_SLOT); 3736 __ Ret(USE_DELAY_SLOT);
3737 __ li(v0, Operand(LESS)); 3737 __ li(v0, Operand(LESS));
3738 3738
3739 __ bind(&unordered); 3739 __ bind(&unordered);
3740 __ bind(&generic_stub); 3740 __ bind(&generic_stub);
3741 ICCompareStub stub(isolate(), op_, CompareIC::GENERIC, CompareIC::GENERIC, 3741 ICCompareStub stub(isolate(), op(), CompareIC::GENERIC, CompareIC::GENERIC,
3742 CompareIC::GENERIC); 3742 CompareIC::GENERIC);
3743 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); 3743 __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
3744 3744
3745 __ bind(&maybe_undefined1); 3745 __ bind(&maybe_undefined1);
3746 if (Token::IsOrderedRelationalCompareOp(op_)) { 3746 if (Token::IsOrderedRelationalCompareOp(op())) {
3747 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 3747 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
3748 __ Branch(&miss, ne, a0, Operand(at)); 3748 __ Branch(&miss, ne, a0, Operand(at));
3749 __ JumpIfSmi(a1, &unordered); 3749 __ JumpIfSmi(a1, &unordered);
3750 __ GetObjectType(a1, a2, a2); 3750 __ GetObjectType(a1, a2, a2);
3751 __ Branch(&maybe_undefined2, ne, a2, Operand(HEAP_NUMBER_TYPE)); 3751 __ Branch(&maybe_undefined2, ne, a2, Operand(HEAP_NUMBER_TYPE));
3752 __ jmp(&unordered); 3752 __ jmp(&unordered);
3753 } 3753 }
3754 3754
3755 __ bind(&maybe_undefined2); 3755 __ bind(&maybe_undefined2);
3756 if (Token::IsOrderedRelationalCompareOp(op_)) { 3756 if (Token::IsOrderedRelationalCompareOp(op())) {
3757 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 3757 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
3758 __ Branch(&unordered, eq, a1, Operand(at)); 3758 __ Branch(&unordered, eq, a1, Operand(at));
3759 } 3759 }
3760 3760
3761 __ bind(&miss); 3761 __ bind(&miss);
3762 GenerateMiss(masm); 3762 GenerateMiss(masm);
3763 } 3763 }
3764 3764
3765 3765
3766 void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) { 3766 void ICCompareStub::GenerateInternalizedStrings(MacroAssembler* masm) {
3767 DCHECK(state_ == CompareIC::INTERNALIZED_STRING); 3767 DCHECK(state() == CompareIC::INTERNALIZED_STRING);
3768 Label miss; 3768 Label miss;
3769 3769
3770 // Registers containing left and right operands respectively. 3770 // Registers containing left and right operands respectively.
3771 Register left = a1; 3771 Register left = a1;
3772 Register right = a0; 3772 Register right = a0;
3773 Register tmp1 = a2; 3773 Register tmp1 = a2;
3774 Register tmp2 = a3; 3774 Register tmp2 = a3;
3775 3775
3776 // Check that both operands are heap objects. 3776 // Check that both operands are heap objects.
3777 __ JumpIfEitherSmi(left, right, &miss); 3777 __ JumpIfEitherSmi(left, right, &miss);
(...skipping 19 matching lines...) Expand all
3797 DCHECK(is_int16(EQUAL)); 3797 DCHECK(is_int16(EQUAL));
3798 __ Ret(USE_DELAY_SLOT); 3798 __ Ret(USE_DELAY_SLOT);
3799 __ li(v0, Operand(Smi::FromInt(EQUAL))); 3799 __ li(v0, Operand(Smi::FromInt(EQUAL)));
3800 3800
3801 __ bind(&miss); 3801 __ bind(&miss);
3802 GenerateMiss(masm); 3802 GenerateMiss(masm);
3803 } 3803 }
3804 3804
3805 3805
3806 void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) { 3806 void ICCompareStub::GenerateUniqueNames(MacroAssembler* masm) {
3807 DCHECK(state_ == CompareIC::UNIQUE_NAME); 3807 DCHECK(state() == CompareIC::UNIQUE_NAME);
3808 DCHECK(GetCondition() == eq); 3808 DCHECK(GetCondition() == eq);
3809 Label miss; 3809 Label miss;
3810 3810
3811 // Registers containing left and right operands respectively. 3811 // Registers containing left and right operands respectively.
3812 Register left = a1; 3812 Register left = a1;
3813 Register right = a0; 3813 Register right = a0;
3814 Register tmp1 = a2; 3814 Register tmp1 = a2;
3815 Register tmp2 = a3; 3815 Register tmp2 = a3;
3816 3816
3817 // Check that both operands are heap objects. 3817 // Check that both operands are heap objects.
(...skipping 23 matching lines...) Expand all
3841 __ li(v0, Operand(Smi::FromInt(EQUAL))); 3841 __ li(v0, Operand(Smi::FromInt(EQUAL)));
3842 __ bind(&done); 3842 __ bind(&done);
3843 __ Ret(); 3843 __ Ret();
3844 3844
3845 __ bind(&miss); 3845 __ bind(&miss);
3846 GenerateMiss(masm); 3846 GenerateMiss(masm);
3847 } 3847 }
3848 3848
3849 3849
3850 void ICCompareStub::GenerateStrings(MacroAssembler* masm) { 3850 void ICCompareStub::GenerateStrings(MacroAssembler* masm) {
3851 DCHECK(state_ == CompareIC::STRING); 3851 DCHECK(state() == CompareIC::STRING);
3852 Label miss; 3852 Label miss;
3853 3853
3854 bool equality = Token::IsEqualityOp(op_); 3854 bool equality = Token::IsEqualityOp(op());
3855 3855
3856 // Registers containing left and right operands respectively. 3856 // Registers containing left and right operands respectively.
3857 Register left = a1; 3857 Register left = a1;
3858 Register right = a0; 3858 Register right = a0;
3859 Register tmp1 = a2; 3859 Register tmp1 = a2;
3860 Register tmp2 = a3; 3860 Register tmp2 = a3;
3861 Register tmp3 = t0; 3861 Register tmp3 = t0;
3862 Register tmp4 = t1; 3862 Register tmp4 = t1;
3863 Register tmp5 = t2; 3863 Register tmp5 = t2;
3864 3864
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3927 } else { 3927 } else {
3928 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 3928 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
3929 } 3929 }
3930 3930
3931 __ bind(&miss); 3931 __ bind(&miss);
3932 GenerateMiss(masm); 3932 GenerateMiss(masm);
3933 } 3933 }
3934 3934
3935 3935
3936 void ICCompareStub::GenerateObjects(MacroAssembler* masm) { 3936 void ICCompareStub::GenerateObjects(MacroAssembler* masm) {
3937 DCHECK(state_ == CompareIC::OBJECT); 3937 DCHECK(state() == CompareIC::OBJECT);
3938 Label miss; 3938 Label miss;
3939 __ And(a2, a1, Operand(a0)); 3939 __ And(a2, a1, Operand(a0));
3940 __ JumpIfSmi(a2, &miss); 3940 __ JumpIfSmi(a2, &miss);
3941 3941
3942 __ GetObjectType(a0, a2, a2); 3942 __ GetObjectType(a0, a2, a2);
3943 __ Branch(&miss, ne, a2, Operand(JS_OBJECT_TYPE)); 3943 __ Branch(&miss, ne, a2, Operand(JS_OBJECT_TYPE));
3944 __ GetObjectType(a1, a2, a2); 3944 __ GetObjectType(a1, a2, a2);
3945 __ Branch(&miss, ne, a2, Operand(JS_OBJECT_TYPE)); 3945 __ Branch(&miss, ne, a2, Operand(JS_OBJECT_TYPE));
3946 3946
3947 DCHECK(GetCondition() == eq); 3947 DCHECK(GetCondition() == eq);
(...skipping 23 matching lines...) Expand all
3971 3971
3972 3972
3973 void ICCompareStub::GenerateMiss(MacroAssembler* masm) { 3973 void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
3974 { 3974 {
3975 // Call the runtime system in a fresh internal frame. 3975 // Call the runtime system in a fresh internal frame.
3976 ExternalReference miss = 3976 ExternalReference miss =
3977 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate()); 3977 ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate());
3978 FrameScope scope(masm, StackFrame::INTERNAL); 3978 FrameScope scope(masm, StackFrame::INTERNAL);
3979 __ Push(a1, a0); 3979 __ Push(a1, a0);
3980 __ Push(ra, a1, a0); 3980 __ Push(ra, a1, a0);
3981 __ li(t0, Operand(Smi::FromInt(op_))); 3981 __ li(t0, Operand(Smi::FromInt(op())));
3982 __ addiu(sp, sp, -kPointerSize); 3982 __ addiu(sp, sp, -kPointerSize);
3983 __ CallExternalReference(miss, 3, USE_DELAY_SLOT); 3983 __ CallExternalReference(miss, 3, USE_DELAY_SLOT);
3984 __ sw(t0, MemOperand(sp)); // In the delay slot. 3984 __ sw(t0, MemOperand(sp)); // In the delay slot.
3985 // Compute the entry point of the rewritten stub. 3985 // Compute the entry point of the rewritten stub.
3986 __ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); 3986 __ Addu(a2, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
3987 // Restore registers. 3987 // Restore registers.
3988 __ Pop(a1, a0, ra); 3988 __ Pop(a1, a0, ra);
3989 } 3989 }
3990 __ Jump(a2); 3990 __ Jump(a2);
3991 } 3991 }
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
5064 MemOperand(fp, 6 * kPointerSize), 5064 MemOperand(fp, 6 * kPointerSize),
5065 NULL); 5065 NULL);
5066 } 5066 }
5067 5067
5068 5068
5069 #undef __ 5069 #undef __
5070 5070
5071 } } // namespace v8::internal 5071 } } // namespace v8::internal
5072 5072
5073 #endif // V8_TARGET_ARCH_MIPS 5073 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698