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 #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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2801 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); | 2801 __ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); |
2802 __ Addu(at, a2, Operand(at)); | 2802 __ Addu(at, a2, Operand(at)); |
2803 __ lw(t0, FieldMemOperand(at, FixedArray::kHeaderSize)); | 2803 __ lw(t0, FieldMemOperand(at, FixedArray::kHeaderSize)); |
2804 | 2804 |
2805 // Verify that t0 contains an AllocationSite | 2805 // Verify that t0 contains an AllocationSite |
2806 __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset)); | 2806 __ lw(t1, FieldMemOperand(t0, HeapObject::kMapOffset)); |
2807 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 2807 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
2808 __ Branch(&miss, ne, t1, Operand(at)); | 2808 __ Branch(&miss, ne, t1, Operand(at)); |
2809 | 2809 |
2810 __ mov(a2, t0); | 2810 __ mov(a2, t0); |
2811 __ mov(a3, a1); | |
2812 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2811 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
2813 __ TailCallStub(&stub); | 2812 __ TailCallStub(&stub); |
2814 | 2813 |
2815 __ bind(&miss); | 2814 __ bind(&miss); |
2816 GenerateMiss(masm); | 2815 GenerateMiss(masm); |
2817 | 2816 |
2818 // The slow case, we need this no matter what to complete a call after a miss. | 2817 // The slow case, we need this no matter what to complete a call after a miss. |
2819 CallFunctionNoFeedback(masm, | 2818 CallFunctionNoFeedback(masm, |
2820 arg_count(), | 2819 arg_count(), |
2821 true, | 2820 true, |
(...skipping 1971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4793 UNREACHABLE(); | 4792 UNREACHABLE(); |
4794 } | 4793 } |
4795 } | 4794 } |
4796 | 4795 |
4797 | 4796 |
4798 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4797 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
4799 // ----------- S t a t e ------------- | 4798 // ----------- S t a t e ------------- |
4800 // -- a0 : argc (only if argument_count() == ANY) | 4799 // -- a0 : argc (only if argument_count() == ANY) |
4801 // -- a1 : constructor | 4800 // -- a1 : constructor |
4802 // -- a2 : AllocationSite or undefined | 4801 // -- a2 : AllocationSite or undefined |
4803 // -- a3 : Original constructor | |
4804 // -- sp[0] : return address | 4802 // -- sp[0] : return address |
4805 // -- sp[4] : last argument | 4803 // -- sp[4] : last argument |
4806 // ----------------------------------- | 4804 // ----------------------------------- |
4807 | 4805 |
4808 if (FLAG_debug_code) { | 4806 if (FLAG_debug_code) { |
4809 // The array construct code is only set for the global and natives | 4807 // The array construct code is only set for the global and natives |
4810 // builtin Array functions which always have maps. | 4808 // builtin Array functions which always have maps. |
4811 | 4809 |
4812 // Initial map for the builtin Array function should be a map. | 4810 // Initial map for the builtin Array function should be a map. |
4813 __ lw(t0, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 4811 __ lw(t0, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
4814 // Will both indicate a NULL and a Smi. | 4812 // Will both indicate a NULL and a Smi. |
4815 __ SmiTst(t0, at); | 4813 __ SmiTst(t0, at); |
4816 __ Assert(ne, kUnexpectedInitialMapForArrayFunction, | 4814 __ Assert(ne, kUnexpectedInitialMapForArrayFunction, |
4817 at, Operand(zero_reg)); | 4815 at, Operand(zero_reg)); |
4818 __ GetObjectType(t0, t0, t1); | 4816 __ GetObjectType(t0, t0, t1); |
4819 __ Assert(eq, kUnexpectedInitialMapForArrayFunction, | 4817 __ Assert(eq, kUnexpectedInitialMapForArrayFunction, |
4820 t1, Operand(MAP_TYPE)); | 4818 t1, Operand(MAP_TYPE)); |
4821 | 4819 |
4822 // We should either have undefined in a2 or a valid AllocationSite | 4820 // We should either have undefined in a2 or a valid AllocationSite |
4823 __ AssertUndefinedOrAllocationSite(a2, t0); | 4821 __ AssertUndefinedOrAllocationSite(a2, t0); |
4824 } | 4822 } |
4825 | 4823 |
4826 Label subclassing; | |
4827 __ Branch(&subclassing, ne, a1, Operand(a3)); | |
4828 | |
4829 Label no_info; | 4824 Label no_info; |
4830 // Get the elements kind and case on that. | 4825 // Get the elements kind and case on that. |
4831 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 4826 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
4832 __ Branch(&no_info, eq, a2, Operand(at)); | 4827 __ Branch(&no_info, eq, a2, Operand(at)); |
4833 | 4828 |
4834 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); | 4829 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); |
4835 __ SmiUntag(a3); | 4830 __ SmiUntag(a3); |
4836 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 4831 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
4837 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); | 4832 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); |
4838 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 4833 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
4839 | 4834 |
4840 __ bind(&no_info); | 4835 __ bind(&no_info); |
4841 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 4836 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
4842 | |
4843 __ bind(&subclassing); | |
4844 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); | |
4845 } | 4837 } |
4846 | 4838 |
4847 | 4839 |
4848 void InternalArrayConstructorStub::GenerateCase( | 4840 void InternalArrayConstructorStub::GenerateCase( |
4849 MacroAssembler* masm, ElementsKind kind) { | 4841 MacroAssembler* masm, ElementsKind kind) { |
4850 | 4842 |
4851 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 4843 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4852 __ TailCallStub(&stub0, lo, a0, Operand(1)); | 4844 __ TailCallStub(&stub0, lo, a0, Operand(1)); |
4853 | 4845 |
4854 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); | 4846 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5222 kStackUnwindSpace, kInvalidStackOffset, | 5214 kStackUnwindSpace, kInvalidStackOffset, |
5223 MemOperand(fp, 6 * kPointerSize), NULL); | 5215 MemOperand(fp, 6 * kPointerSize), NULL); |
5224 } | 5216 } |
5225 | 5217 |
5226 | 5218 |
5227 #undef __ | 5219 #undef __ |
5228 | 5220 |
5229 } } // namespace v8::internal | 5221 } } // namespace v8::internal |
5230 | 5222 |
5231 #endif // V8_TARGET_ARCH_MIPS | 5223 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |