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

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

Issue 107003008: MIPS: Avoid unnecessary branches in array constructor stubs. (Closed) Base URL: https://github.com/v8/v8.git@gbl
Patch Set: Created 6 years, 11 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/mips/macro-assembler-mips.h » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5665 matching lines...) Expand 10 before | Expand all | Expand 10 after
5676 AllocationSiteOverrideMode mode) { 5676 AllocationSiteOverrideMode mode) {
5677 if (mode == DISABLE_ALLOCATION_SITES) { 5677 if (mode == DISABLE_ALLOCATION_SITES) {
5678 T stub(GetInitialFastElementsKind(), 5678 T stub(GetInitialFastElementsKind(),
5679 CONTEXT_CHECK_REQUIRED, 5679 CONTEXT_CHECK_REQUIRED,
5680 mode); 5680 mode);
5681 __ TailCallStub(&stub); 5681 __ TailCallStub(&stub);
5682 } else if (mode == DONT_OVERRIDE) { 5682 } else if (mode == DONT_OVERRIDE) {
5683 int last_index = GetSequenceIndexFromFastElementsKind( 5683 int last_index = GetSequenceIndexFromFastElementsKind(
5684 TERMINAL_FAST_ELEMENTS_KIND); 5684 TERMINAL_FAST_ELEMENTS_KIND);
5685 for (int i = 0; i <= last_index; ++i) { 5685 for (int i = 0; i <= last_index; ++i) {
5686 Label next;
5687 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5686 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5688 __ Branch(&next, ne, a3, Operand(kind));
5689 T stub(kind); 5687 T stub(kind);
5690 __ TailCallStub(&stub); 5688 __ TailCallStub(&stub, eq, a3, Operand(kind));
5691 __ bind(&next);
5692 } 5689 }
5693 5690
5694 // If we reached this point there is a problem. 5691 // If we reached this point there is a problem.
5695 __ Abort(kUnexpectedElementsKindInArrayConstructor); 5692 __ Abort(kUnexpectedElementsKindInArrayConstructor);
5696 } else { 5693 } else {
5697 UNREACHABLE(); 5694 UNREACHABLE();
5698 } 5695 }
5699 } 5696 }
5700 5697
5701 5698
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
5757 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 5754 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5758 __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); 5755 __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset));
5759 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); 5756 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley)));
5760 __ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); 5757 __ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset));
5761 5758
5762 5759
5763 __ bind(&normal_sequence); 5760 __ bind(&normal_sequence);
5764 int last_index = GetSequenceIndexFromFastElementsKind( 5761 int last_index = GetSequenceIndexFromFastElementsKind(
5765 TERMINAL_FAST_ELEMENTS_KIND); 5762 TERMINAL_FAST_ELEMENTS_KIND);
5766 for (int i = 0; i <= last_index; ++i) { 5763 for (int i = 0; i <= last_index; ++i) {
5767 Label next;
5768 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5764 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5769 __ Branch(&next, ne, a3, Operand(kind));
5770 ArraySingleArgumentConstructorStub stub(kind); 5765 ArraySingleArgumentConstructorStub stub(kind);
5771 __ TailCallStub(&stub); 5766 __ TailCallStub(&stub, eq, a3, Operand(kind));
5772 __ bind(&next);
5773 } 5767 }
5774 5768
5775 // If we reached this point there is a problem. 5769 // If we reached this point there is a problem.
5776 __ Abort(kUnexpectedElementsKindInArrayConstructor); 5770 __ Abort(kUnexpectedElementsKindInArrayConstructor);
5777 } else { 5771 } else {
5778 UNREACHABLE(); 5772 UNREACHABLE();
5779 } 5773 }
5780 } 5774 }
5781 5775
5782 5776
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
5904 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); 5898 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask));
5905 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5899 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5906 5900
5907 __ bind(&no_info); 5901 __ bind(&no_info);
5908 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5902 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5909 } 5903 }
5910 5904
5911 5905
5912 void InternalArrayConstructorStub::GenerateCase( 5906 void InternalArrayConstructorStub::GenerateCase(
5913 MacroAssembler* masm, ElementsKind kind) { 5907 MacroAssembler* masm, ElementsKind kind) {
5914 Label not_zero_case, not_one_case;
5915 Label normal_sequence;
5916 5908
5917 __ Branch(&not_zero_case, ne, a0, Operand(zero_reg));
5918 InternalArrayNoArgumentConstructorStub stub0(kind); 5909 InternalArrayNoArgumentConstructorStub stub0(kind);
5919 __ TailCallStub(&stub0); 5910 __ TailCallStub(&stub0, lo, a0, Operand(1));
5920 5911
5921 __ bind(&not_zero_case); 5912 InternalArrayNArgumentsConstructorStub stubN(kind);
5922 __ Branch(&not_one_case, gt, a0, Operand(1)); 5913 __ TailCallStub(&stubN, hi, a0, Operand(1));
5923 5914
5924 if (IsFastPackedElementsKind(kind)) { 5915 if (IsFastPackedElementsKind(kind)) {
5925 // We might need to create a holey array 5916 // We might need to create a holey array
5926 // look at the first argument. 5917 // look at the first argument.
5927 __ lw(at, MemOperand(sp, 0)); 5918 __ lw(at, MemOperand(sp, 0));
5928 __ Branch(&normal_sequence, eq, at, Operand(zero_reg));
5929 5919
5930 InternalArraySingleArgumentConstructorStub 5920 InternalArraySingleArgumentConstructorStub
5931 stub1_holey(GetHoleyElementsKind(kind)); 5921 stub1_holey(GetHoleyElementsKind(kind));
5932 __ TailCallStub(&stub1_holey); 5922 __ TailCallStub(&stub1_holey, ne, at, Operand(zero_reg));
5933 } 5923 }
5934 5924
5935 __ bind(&normal_sequence);
5936 InternalArraySingleArgumentConstructorStub stub1(kind); 5925 InternalArraySingleArgumentConstructorStub stub1(kind);
5937 __ TailCallStub(&stub1); 5926 __ TailCallStub(&stub1);
5938
5939 __ bind(&not_one_case);
5940 InternalArrayNArgumentsConstructorStub stubN(kind);
5941 __ TailCallStub(&stubN);
5942 } 5927 }
5943 5928
5944 5929
5945 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { 5930 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) {
5946 // ----------- S t a t e ------------- 5931 // ----------- S t a t e -------------
5947 // -- a0 : argc 5932 // -- a0 : argc
5948 // -- a1 : constructor 5933 // -- a1 : constructor
5949 // -- sp[0] : return address 5934 // -- sp[0] : return address
5950 // -- sp[4] : last argument 5935 // -- sp[4] : last argument
5951 // ----------------------------------- 5936 // -----------------------------------
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
5990 __ bind(&fast_elements_case); 5975 __ bind(&fast_elements_case);
5991 GenerateCase(masm, FAST_ELEMENTS); 5976 GenerateCase(masm, FAST_ELEMENTS);
5992 } 5977 }
5993 5978
5994 5979
5995 #undef __ 5980 #undef __
5996 5981
5997 } } // namespace v8::internal 5982 } } // namespace v8::internal
5998 5983
5999 #endif // V8_TARGET_ARCH_MIPS 5984 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698