OLD | NEW |
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 5687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5698 AllocationSiteOverrideMode mode) { | 5698 AllocationSiteOverrideMode mode) { |
5699 if (mode == DISABLE_ALLOCATION_SITES) { | 5699 if (mode == DISABLE_ALLOCATION_SITES) { |
5700 T stub(GetInitialFastElementsKind(), | 5700 T stub(GetInitialFastElementsKind(), |
5701 CONTEXT_CHECK_REQUIRED, | 5701 CONTEXT_CHECK_REQUIRED, |
5702 mode); | 5702 mode); |
5703 __ TailCallStub(&stub); | 5703 __ TailCallStub(&stub); |
5704 } else if (mode == DONT_OVERRIDE) { | 5704 } else if (mode == DONT_OVERRIDE) { |
5705 int last_index = GetSequenceIndexFromFastElementsKind( | 5705 int last_index = GetSequenceIndexFromFastElementsKind( |
5706 TERMINAL_FAST_ELEMENTS_KIND); | 5706 TERMINAL_FAST_ELEMENTS_KIND); |
5707 for (int i = 0; i <= last_index; ++i) { | 5707 for (int i = 0; i <= last_index; ++i) { |
5708 Label next; | |
5709 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5708 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
5710 __ cmp(r3, Operand(kind)); | 5709 __ cmp(r3, Operand(kind)); |
5711 __ b(ne, &next); | |
5712 T stub(kind); | 5710 T stub(kind); |
5713 __ TailCallStub(&stub); | 5711 __ TailCallStub(&stub, eq); |
5714 __ bind(&next); | |
5715 } | 5712 } |
5716 | 5713 |
5717 // If we reached this point there is a problem. | 5714 // If we reached this point there is a problem. |
5718 __ Abort(kUnexpectedElementsKindInArrayConstructor); | 5715 __ Abort(kUnexpectedElementsKindInArrayConstructor); |
5719 } else { | 5716 } else { |
5720 UNREACHABLE(); | 5717 UNREACHABLE(); |
5721 } | 5718 } |
5722 } | 5719 } |
5723 | 5720 |
5724 | 5721 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5780 // restricted to a portion of the field...upper bits need to be left alone. | 5777 // restricted to a portion of the field...upper bits need to be left alone. |
5781 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5778 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
5782 __ ldr(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5779 __ ldr(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); |
5783 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); | 5780 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); |
5784 __ str(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5781 __ str(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); |
5785 | 5782 |
5786 __ bind(&normal_sequence); | 5783 __ bind(&normal_sequence); |
5787 int last_index = GetSequenceIndexFromFastElementsKind( | 5784 int last_index = GetSequenceIndexFromFastElementsKind( |
5788 TERMINAL_FAST_ELEMENTS_KIND); | 5785 TERMINAL_FAST_ELEMENTS_KIND); |
5789 for (int i = 0; i <= last_index; ++i) { | 5786 for (int i = 0; i <= last_index; ++i) { |
5790 Label next; | |
5791 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5787 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
5792 __ cmp(r3, Operand(kind)); | 5788 __ cmp(r3, Operand(kind)); |
5793 __ b(ne, &next); | |
5794 ArraySingleArgumentConstructorStub stub(kind); | 5789 ArraySingleArgumentConstructorStub stub(kind); |
5795 __ TailCallStub(&stub); | 5790 __ TailCallStub(&stub, eq); |
5796 __ bind(&next); | |
5797 } | 5791 } |
5798 | 5792 |
5799 // If we reached this point there is a problem. | 5793 // If we reached this point there is a problem. |
5800 __ Abort(kUnexpectedElementsKindInArrayConstructor); | 5794 __ Abort(kUnexpectedElementsKindInArrayConstructor); |
5801 } else { | 5795 } else { |
5802 UNREACHABLE(); | 5796 UNREACHABLE(); |
5803 } | 5797 } |
5804 } | 5798 } |
5805 | 5799 |
5806 | 5800 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5927 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); | 5921 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); |
5928 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5922 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
5929 | 5923 |
5930 __ bind(&no_info); | 5924 __ bind(&no_info); |
5931 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5925 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
5932 } | 5926 } |
5933 | 5927 |
5934 | 5928 |
5935 void InternalArrayConstructorStub::GenerateCase( | 5929 void InternalArrayConstructorStub::GenerateCase( |
5936 MacroAssembler* masm, ElementsKind kind) { | 5930 MacroAssembler* masm, ElementsKind kind) { |
5937 Label not_zero_case, not_one_case; | 5931 __ cmp(r0, Operand(1)); |
5938 Label normal_sequence; | |
5939 | 5932 |
5940 __ tst(r0, r0); | |
5941 __ b(ne, ¬_zero_case); | |
5942 InternalArrayNoArgumentConstructorStub stub0(kind); | 5933 InternalArrayNoArgumentConstructorStub stub0(kind); |
5943 __ TailCallStub(&stub0); | 5934 __ TailCallStub(&stub0, lo); |
5944 | 5935 |
5945 __ bind(¬_zero_case); | 5936 InternalArrayNArgumentsConstructorStub stubN(kind); |
5946 __ cmp(r0, Operand(1)); | 5937 __ TailCallStub(&stubN, hi); |
5947 __ b(gt, ¬_one_case); | |
5948 | 5938 |
5949 if (IsFastPackedElementsKind(kind)) { | 5939 if (IsFastPackedElementsKind(kind)) { |
5950 // We might need to create a holey array | 5940 // We might need to create a holey array |
5951 // look at the first argument | 5941 // look at the first argument |
5952 __ ldr(r3, MemOperand(sp, 0)); | 5942 __ ldr(r3, MemOperand(sp, 0)); |
5953 __ cmp(r3, Operand::Zero()); | 5943 __ cmp(r3, Operand::Zero()); |
5954 __ b(eq, &normal_sequence); | |
5955 | 5944 |
5956 InternalArraySingleArgumentConstructorStub | 5945 InternalArraySingleArgumentConstructorStub |
5957 stub1_holey(GetHoleyElementsKind(kind)); | 5946 stub1_holey(GetHoleyElementsKind(kind)); |
5958 __ TailCallStub(&stub1_holey); | 5947 __ TailCallStub(&stub1_holey, ne); |
5959 } | 5948 } |
5960 | 5949 |
5961 __ bind(&normal_sequence); | |
5962 InternalArraySingleArgumentConstructorStub stub1(kind); | 5950 InternalArraySingleArgumentConstructorStub stub1(kind); |
5963 __ TailCallStub(&stub1); | 5951 __ TailCallStub(&stub1); |
5964 | |
5965 __ bind(¬_one_case); | |
5966 InternalArrayNArgumentsConstructorStub stubN(kind); | |
5967 __ TailCallStub(&stubN); | |
5968 } | 5952 } |
5969 | 5953 |
5970 | 5954 |
5971 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { | 5955 void InternalArrayConstructorStub::Generate(MacroAssembler* masm) { |
5972 // ----------- S t a t e ------------- | 5956 // ----------- S t a t e ------------- |
5973 // -- r0 : argc | 5957 // -- r0 : argc |
5974 // -- r1 : constructor | 5958 // -- r1 : constructor |
5975 // -- sp[0] : return address | 5959 // -- sp[0] : return address |
5976 // -- sp[4] : last argument | 5960 // -- sp[4] : last argument |
5977 // ----------------------------------- | 5961 // ----------------------------------- |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6015 __ bind(&fast_elements_case); | 5999 __ bind(&fast_elements_case); |
6016 GenerateCase(masm, FAST_ELEMENTS); | 6000 GenerateCase(masm, FAST_ELEMENTS); |
6017 } | 6001 } |
6018 | 6002 |
6019 | 6003 |
6020 #undef __ | 6004 #undef __ |
6021 | 6005 |
6022 } } // namespace v8::internal | 6006 } } // namespace v8::internal |
6023 | 6007 |
6024 #endif // V8_TARGET_ARCH_ARM | 6008 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |