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 4779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4790 } else if (argument_count() == MORE_THAN_ONE) { | 4790 } else if (argument_count() == MORE_THAN_ONE) { |
4791 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); | 4791 CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode); |
4792 } else { | 4792 } else { |
4793 UNREACHABLE(); | 4793 UNREACHABLE(); |
4794 } | 4794 } |
4795 } | 4795 } |
4796 | 4796 |
4797 | 4797 |
4798 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4798 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
4799 // ----------- S t a t e ------------- | 4799 // ----------- S t a t e ------------- |
4800 // -- a0 : argc (only if argument_count() is ANY or MORE_THAN_ONE) | 4800 // -- a0 : argc (only if argument_count() == ANY) |
4801 // -- a1 : constructor | 4801 // -- a1 : constructor |
4802 // -- a2 : AllocationSite or undefined | 4802 // -- a2 : AllocationSite or undefined |
4803 // -- a3 : Original constructor | 4803 // -- a3 : Original constructor |
4804 // -- sp[0] : last argument | 4804 // -- sp[0] : return address |
| 4805 // -- sp[4] : last argument |
4805 // ----------------------------------- | 4806 // ----------------------------------- |
4806 | 4807 |
4807 if (FLAG_debug_code) { | 4808 if (FLAG_debug_code) { |
4808 // The array construct code is only set for the global and natives | 4809 // The array construct code is only set for the global and natives |
4809 // builtin Array functions which always have maps. | 4810 // builtin Array functions which always have maps. |
4810 | 4811 |
4811 // Initial map for the builtin Array function should be a map. | 4812 // Initial map for the builtin Array function should be a map. |
4812 __ lw(t0, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); | 4813 __ lw(t0, FieldMemOperand(a1, JSFunction::kPrototypeOrInitialMapOffset)); |
4813 // Will both indicate a NULL and a Smi. | 4814 // Will both indicate a NULL and a Smi. |
4814 __ SmiTst(t0, at); | 4815 __ SmiTst(t0, at); |
(...skipping 17 matching lines...) Expand all Loading... |
4832 | 4833 |
4833 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); | 4834 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); |
4834 __ SmiUntag(a3); | 4835 __ SmiUntag(a3); |
4835 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 4836 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
4836 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); | 4837 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); |
4837 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 4838 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
4838 | 4839 |
4839 __ bind(&no_info); | 4840 __ bind(&no_info); |
4840 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 4841 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
4841 | 4842 |
4842 // Subclassing. | |
4843 __ bind(&subclassing); | 4843 __ bind(&subclassing); |
4844 __ Push(a1); | 4844 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); |
4845 __ Push(a3); | |
4846 | |
4847 // Adjust argc. | |
4848 switch (argument_count()) { | |
4849 case ANY: | |
4850 case MORE_THAN_ONE: | |
4851 __ li(at, Operand(2)); | |
4852 __ addu(a0, a0, at); | |
4853 break; | |
4854 case NONE: | |
4855 __ li(a0, Operand(2)); | |
4856 break; | |
4857 case ONE: | |
4858 __ li(a0, Operand(3)); | |
4859 break; | |
4860 } | |
4861 | |
4862 __ JumpToExternalReference( | |
4863 ExternalReference(Runtime::kArrayConstructorWithSubclassing, isolate())); | |
4864 } | 4845 } |
4865 | 4846 |
4866 | 4847 |
4867 void InternalArrayConstructorStub::GenerateCase( | 4848 void InternalArrayConstructorStub::GenerateCase( |
4868 MacroAssembler* masm, ElementsKind kind) { | 4849 MacroAssembler* masm, ElementsKind kind) { |
4869 | 4850 |
4870 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 4851 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4871 __ TailCallStub(&stub0, lo, a0, Operand(1)); | 4852 __ TailCallStub(&stub0, lo, a0, Operand(1)); |
4872 | 4853 |
4873 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); | 4854 InternalArrayNArgumentsConstructorStub stubN(isolate(), kind); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5241 kStackUnwindSpace, kInvalidStackOffset, | 5222 kStackUnwindSpace, kInvalidStackOffset, |
5242 MemOperand(fp, 6 * kPointerSize), NULL); | 5223 MemOperand(fp, 6 * kPointerSize), NULL); |
5243 } | 5224 } |
5244 | 5225 |
5245 | 5226 |
5246 #undef __ | 5227 #undef __ |
5247 | 5228 |
5248 } } // namespace v8::internal | 5229 } } // namespace v8::internal |
5249 | 5230 |
5250 #endif // V8_TARGET_ARCH_MIPS | 5231 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |