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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 __ mov(r0, Operand(arg_count())); | 2656 __ mov(r0, Operand(arg_count())); |
2657 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); | 2657 __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
2658 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); | 2658 __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
2659 | 2659 |
2660 // Verify that r4 contains an AllocationSite | 2660 // Verify that r4 contains an AllocationSite |
2661 __ ldr(r5, FieldMemOperand(r4, HeapObject::kMapOffset)); | 2661 __ ldr(r5, FieldMemOperand(r4, HeapObject::kMapOffset)); |
2662 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 2662 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
2663 __ b(ne, &miss); | 2663 __ b(ne, &miss); |
2664 | 2664 |
2665 __ mov(r2, r4); | 2665 __ mov(r2, r4); |
| 2666 __ mov(r3, r1); |
2666 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2667 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
2667 __ TailCallStub(&stub); | 2668 __ TailCallStub(&stub); |
2668 | 2669 |
2669 __ bind(&miss); | 2670 __ bind(&miss); |
2670 GenerateMiss(masm); | 2671 GenerateMiss(masm); |
2671 | 2672 |
2672 // The slow case, we need this no matter what to complete a call after a miss. | 2673 // The slow case, we need this no matter what to complete a call after a miss. |
2673 CallFunctionNoFeedback(masm, | 2674 CallFunctionNoFeedback(masm, |
2674 arg_count(), | 2675 arg_count(), |
2675 true, | 2676 true, |
(...skipping 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4566 UNREACHABLE(); | 4567 UNREACHABLE(); |
4567 } | 4568 } |
4568 } | 4569 } |
4569 | 4570 |
4570 | 4571 |
4571 void ArrayConstructorStub::Generate(MacroAssembler* masm) { | 4572 void ArrayConstructorStub::Generate(MacroAssembler* masm) { |
4572 // ----------- S t a t e ------------- | 4573 // ----------- S t a t e ------------- |
4573 // -- r0 : argc (only if argument_count() == ANY) | 4574 // -- r0 : argc (only if argument_count() == ANY) |
4574 // -- r1 : constructor | 4575 // -- r1 : constructor |
4575 // -- r2 : AllocationSite or undefined | 4576 // -- r2 : AllocationSite or undefined |
| 4577 // -- r3 : original constructor |
4576 // -- sp[0] : return address | 4578 // -- sp[0] : return address |
4577 // -- sp[4] : last argument | 4579 // -- sp[4] : last argument |
4578 // ----------------------------------- | 4580 // ----------------------------------- |
4579 | 4581 |
4580 if (FLAG_debug_code) { | 4582 if (FLAG_debug_code) { |
4581 // The array construct code is only set for the global and natives | 4583 // The array construct code is only set for the global and natives |
4582 // builtin Array functions which always have maps. | 4584 // builtin Array functions which always have maps. |
4583 | 4585 |
4584 // Initial map for the builtin Array function should be a map. | 4586 // Initial map for the builtin Array function should be a map. |
4585 __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); | 4587 __ ldr(r4, FieldMemOperand(r1, JSFunction::kPrototypeOrInitialMapOffset)); |
4586 // Will both indicate a NULL and a Smi. | 4588 // Will both indicate a NULL and a Smi. |
4587 __ tst(r4, Operand(kSmiTagMask)); | 4589 __ tst(r4, Operand(kSmiTagMask)); |
4588 __ Assert(ne, kUnexpectedInitialMapForArrayFunction); | 4590 __ Assert(ne, kUnexpectedInitialMapForArrayFunction); |
4589 __ CompareObjectType(r4, r4, r5, MAP_TYPE); | 4591 __ CompareObjectType(r4, r4, r5, MAP_TYPE); |
4590 __ Assert(eq, kUnexpectedInitialMapForArrayFunction); | 4592 __ Assert(eq, kUnexpectedInitialMapForArrayFunction); |
4591 | 4593 |
4592 // We should either have undefined in r2 or a valid AllocationSite | 4594 // We should either have undefined in r2 or a valid AllocationSite |
4593 __ AssertUndefinedOrAllocationSite(r2, r4); | 4595 __ AssertUndefinedOrAllocationSite(r2, r4); |
4594 } | 4596 } |
4595 | 4597 |
| 4598 Label subclassing; |
| 4599 __ cmp(r3, r1); |
| 4600 __ b(ne, &subclassing); |
| 4601 |
4596 Label no_info; | 4602 Label no_info; |
4597 // Get the elements kind and case on that. | 4603 // Get the elements kind and case on that. |
4598 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); | 4604 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
4599 __ b(eq, &no_info); | 4605 __ b(eq, &no_info); |
4600 | 4606 |
4601 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); | 4607 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
4602 __ SmiUntag(r3); | 4608 __ SmiUntag(r3); |
4603 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 4609 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
4604 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); | 4610 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); |
4605 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 4611 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
4606 | 4612 |
4607 __ bind(&no_info); | 4613 __ bind(&no_info); |
4608 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 4614 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 4615 |
| 4616 __ bind(&subclassing); |
| 4617 __ TailCallRuntime(Runtime::kThrowArrayNotSubclassableError, 0, 1); |
4609 } | 4618 } |
4610 | 4619 |
4611 | 4620 |
4612 void InternalArrayConstructorStub::GenerateCase( | 4621 void InternalArrayConstructorStub::GenerateCase( |
4613 MacroAssembler* masm, ElementsKind kind) { | 4622 MacroAssembler* masm, ElementsKind kind) { |
4614 __ cmp(r0, Operand(1)); | 4623 __ cmp(r0, Operand(1)); |
4615 | 4624 |
4616 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); | 4625 InternalArrayNoArgumentConstructorStub stub0(isolate(), kind); |
4617 __ TailCallStub(&stub0, lo); | 4626 __ TailCallStub(&stub0, lo); |
4618 | 4627 |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5002 kStackUnwindSpace, NULL, | 5011 kStackUnwindSpace, NULL, |
5003 MemOperand(fp, 6 * kPointerSize), NULL); | 5012 MemOperand(fp, 6 * kPointerSize), NULL); |
5004 } | 5013 } |
5005 | 5014 |
5006 | 5015 |
5007 #undef __ | 5016 #undef __ |
5008 | 5017 |
5009 } } // namespace v8::internal | 5018 } } // namespace v8::internal |
5010 | 5019 |
5011 #endif // V8_TARGET_ARCH_ARM | 5020 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |