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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
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/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 3746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3757 // Second chance, the object may be using the empty slow element dictionary. | 3757 // Second chance, the object may be using the empty slow element dictionary. |
3758 CompareRoot(r2, Heap::kEmptySlowElementDictionaryRootIndex); | 3758 CompareRoot(r2, Heap::kEmptySlowElementDictionaryRootIndex); |
3759 b(ne, call_runtime); | 3759 b(ne, call_runtime); |
3760 | 3760 |
3761 bind(&no_elements); | 3761 bind(&no_elements); |
3762 ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset)); | 3762 ldr(r2, FieldMemOperand(r1, Map::kPrototypeOffset)); |
3763 cmp(r2, null_value); | 3763 cmp(r2, null_value); |
3764 b(ne, &next); | 3764 b(ne, &next); |
3765 } | 3765 } |
3766 | 3766 |
3767 | |
3768 void MacroAssembler::TestJSArrayForAllocationMemento( | 3767 void MacroAssembler::TestJSArrayForAllocationMemento( |
3769 Register receiver_reg, | 3768 Register receiver_reg, |
3770 Register scratch_reg, | 3769 Register scratch_reg, |
3771 Label* no_memento_found) { | 3770 Label* no_memento_found) { |
3772 ExternalReference new_space_start = | 3771 Label map_check; |
3773 ExternalReference::new_space_start(isolate()); | 3772 Label top_check; |
3774 ExternalReference new_space_allocation_top = | 3773 ExternalReference new_space_allocation_top = |
3775 ExternalReference::new_space_allocation_top_address(isolate()); | 3774 ExternalReference::new_space_allocation_top_address(isolate()); |
3776 add(scratch_reg, receiver_reg, | 3775 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
3777 Operand(JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); | 3776 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
3778 cmp(scratch_reg, Operand(new_space_start)); | 3777 |
3779 b(lt, no_memento_found); | 3778 // Bail out if the object is not in new space. |
3780 mov(ip, Operand(new_space_allocation_top)); | 3779 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); |
3781 ldr(ip, MemOperand(ip)); | 3780 // If the object is in new space, we need to check whether it is on the same |
3782 cmp(scratch_reg, ip); | 3781 // page as the current top. |
| 3782 add(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 3783 eor(scratch_reg, scratch_reg, Operand(new_space_allocation_top)); |
| 3784 tst(scratch_reg, Operand(~Page::kPageAlignmentMask)); |
| 3785 b(eq, &top_check); |
| 3786 // The object is on a different page than allocation top. Bail out if the |
| 3787 // object sits on the page boundary as no memento can follow and we cannot |
| 3788 // touch the memory following it. |
| 3789 add(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 3790 eor(scratch_reg, scratch_reg, Operand(receiver_reg)); |
| 3791 tst(scratch_reg, Operand(~Page::kPageAlignmentMask)); |
| 3792 b(ne, no_memento_found); |
| 3793 // Continue with the actual map check. |
| 3794 jmp(&map_check); |
| 3795 // If top is on the same page as the current object, we need to check whether |
| 3796 // we are below top. |
| 3797 bind(&top_check); |
| 3798 add(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 3799 cmp(scratch_reg, Operand(new_space_allocation_top)); |
3783 b(gt, no_memento_found); | 3800 b(gt, no_memento_found); |
3784 ldr(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize)); | 3801 // Memento map check. |
3785 cmp(scratch_reg, | 3802 bind(&map_check); |
3786 Operand(isolate()->factory()->allocation_memento_map())); | 3803 ldr(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); |
| 3804 cmp(scratch_reg, Operand(isolate()->factory()->allocation_memento_map())); |
3787 } | 3805 } |
3788 | 3806 |
3789 | |
3790 Register GetRegisterThatIsNotOneOf(Register reg1, | 3807 Register GetRegisterThatIsNotOneOf(Register reg1, |
3791 Register reg2, | 3808 Register reg2, |
3792 Register reg3, | 3809 Register reg3, |
3793 Register reg4, | 3810 Register reg4, |
3794 Register reg5, | 3811 Register reg5, |
3795 Register reg6) { | 3812 Register reg6) { |
3796 RegList regs = 0; | 3813 RegList regs = 0; |
3797 if (reg1.is_valid()) regs |= reg1.bit(); | 3814 if (reg1.is_valid()) regs |= reg1.bit(); |
3798 if (reg2.is_valid()) regs |= reg2.bit(); | 3815 if (reg2.is_valid()) regs |= reg2.bit(); |
3799 if (reg3.is_valid()) regs |= reg3.bit(); | 3816 if (reg3.is_valid()) regs |= reg3.bit(); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3942 } | 3959 } |
3943 } | 3960 } |
3944 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3961 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3945 add(result, result, Operand(dividend, LSR, 31)); | 3962 add(result, result, Operand(dividend, LSR, 31)); |
3946 } | 3963 } |
3947 | 3964 |
3948 } // namespace internal | 3965 } // namespace internal |
3949 } // namespace v8 | 3966 } // namespace v8 |
3950 | 3967 |
3951 #endif // V8_TARGET_ARCH_ARM | 3968 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |