Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 2466573002: [stubs] Fix allocation memento detection. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm64/macro-assembler-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3786 matching lines...) Expand 10 before | Expand all | Expand 10 after
3797 3797
3798 void MacroAssembler::TestJSArrayForAllocationMemento( 3798 void MacroAssembler::TestJSArrayForAllocationMemento(
3799 Register receiver_reg, 3799 Register receiver_reg,
3800 Register scratch_reg, 3800 Register scratch_reg,
3801 Label* no_memento_found) { 3801 Label* no_memento_found) {
3802 Label map_check; 3802 Label map_check;
3803 Label top_check; 3803 Label top_check;
3804 ExternalReference new_space_allocation_top_adr = 3804 ExternalReference new_space_allocation_top_adr =
3805 ExternalReference::new_space_allocation_top_address(isolate()); 3805 ExternalReference::new_space_allocation_top_address(isolate());
3806 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; 3806 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
3807 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; 3807 const int kMementoLastWordOffset =
3808 kMementoMapOffset + AllocationMemento::kSize - kPointerSize;
3808 3809
3809 // Bail out if the object is not in new space. 3810 // Bail out if the object is not in new space.
3810 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); 3811 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
3811 // If the object is in new space, we need to check whether it is on the same 3812 // If the object is in new space, we need to check whether it is on the same
3812 // page as the current top. 3813 // page as the current top.
3813 add(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); 3814 add(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
3814 mov(ip, Operand(new_space_allocation_top_adr)); 3815 mov(ip, Operand(new_space_allocation_top_adr));
3815 ldr(ip, MemOperand(ip)); 3816 ldr(ip, MemOperand(ip));
3816 eor(scratch_reg, scratch_reg, Operand(ip)); 3817 eor(scratch_reg, scratch_reg, Operand(ip));
3817 tst(scratch_reg, Operand(~Page::kPageAlignmentMask)); 3818 tst(scratch_reg, Operand(~Page::kPageAlignmentMask));
3818 b(eq, &top_check); 3819 b(eq, &top_check);
3819 // The object is on a different page than allocation top. Bail out if the 3820 // The object is on a different page than allocation top. Bail out if the
3820 // object sits on the page boundary as no memento can follow and we cannot 3821 // object sits on the page boundary as no memento can follow and we cannot
3821 // touch the memory following it. 3822 // touch the memory following it.
3822 add(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); 3823 add(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
3823 eor(scratch_reg, scratch_reg, Operand(receiver_reg)); 3824 eor(scratch_reg, scratch_reg, Operand(receiver_reg));
3824 tst(scratch_reg, Operand(~Page::kPageAlignmentMask)); 3825 tst(scratch_reg, Operand(~Page::kPageAlignmentMask));
3825 b(ne, no_memento_found); 3826 b(ne, no_memento_found);
3826 // Continue with the actual map check. 3827 // Continue with the actual map check.
3827 jmp(&map_check); 3828 jmp(&map_check);
3828 // If top is on the same page as the current object, we need to check whether 3829 // If top is on the same page as the current object, we need to check whether
3829 // we are below top. 3830 // we are below top.
3830 bind(&top_check); 3831 bind(&top_check);
3831 add(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); 3832 add(scratch_reg, receiver_reg, Operand(kMementoLastWordOffset));
3832 mov(ip, Operand(new_space_allocation_top_adr)); 3833 mov(ip, Operand(new_space_allocation_top_adr));
3833 ldr(ip, MemOperand(ip)); 3834 ldr(ip, MemOperand(ip));
3834 cmp(scratch_reg, ip); 3835 cmp(scratch_reg, ip);
3835 b(gt, no_memento_found); 3836 b(ge, no_memento_found);
3836 // Memento map check. 3837 // Memento map check.
3837 bind(&map_check); 3838 bind(&map_check);
3838 ldr(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); 3839 ldr(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset));
3839 cmp(scratch_reg, Operand(isolate()->factory()->allocation_memento_map())); 3840 cmp(scratch_reg, Operand(isolate()->factory()->allocation_memento_map()));
3840 } 3841 }
3841 3842
3842 Register GetRegisterThatIsNotOneOf(Register reg1, 3843 Register GetRegisterThatIsNotOneOf(Register reg1,
3843 Register reg2, 3844 Register reg2,
3844 Register reg3, 3845 Register reg3,
3845 Register reg4, 3846 Register reg4,
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 } 3998 }
3998 } 3999 }
3999 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); 4000 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift));
4000 add(result, result, Operand(dividend, LSR, 31)); 4001 add(result, result, Operand(dividend, LSR, 31));
4001 } 4002 }
4002 4003
4003 } // namespace internal 4004 } // namespace internal
4004 } // namespace v8 4005 } // namespace v8
4005 4006
4006 #endif // V8_TARGET_ARCH_ARM 4007 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/macro-assembler-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698