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