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

Side by Side Diff: src/x87/macro-assembler-x87.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 | « src/x64/macro-assembler-x64.cc ('k') | no next file » | 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 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 2970
2971 void MacroAssembler::TestJSArrayForAllocationMemento( 2971 void MacroAssembler::TestJSArrayForAllocationMemento(
2972 Register receiver_reg, 2972 Register receiver_reg,
2973 Register scratch_reg, 2973 Register scratch_reg,
2974 Label* no_memento_found) { 2974 Label* no_memento_found) {
2975 Label map_check; 2975 Label map_check;
2976 Label top_check; 2976 Label top_check;
2977 ExternalReference new_space_allocation_top = 2977 ExternalReference new_space_allocation_top =
2978 ExternalReference::new_space_allocation_top_address(isolate()); 2978 ExternalReference::new_space_allocation_top_address(isolate());
2979 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; 2979 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
2980 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; 2980 const int kMementoLastWordOffset =
2981 kMementoMapOffset + AllocationMemento::kSize - kPointerSize;
2981 2982
2982 // Bail out if the object is not in new space. 2983 // Bail out if the object is not in new space.
2983 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); 2984 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
2984 // If the object is in new space, we need to check whether it is on the same 2985 // If the object is in new space, we need to check whether it is on the same
2985 // page as the current top. 2986 // page as the current top.
2986 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 2987 lea(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
2987 xor_(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); 2988 xor_(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
2988 test(scratch_reg, Immediate(~Page::kPageAlignmentMask)); 2989 test(scratch_reg, Immediate(~Page::kPageAlignmentMask));
2989 j(zero, &top_check); 2990 j(zero, &top_check);
2990 // The object is on a different page than allocation top. Bail out if the 2991 // The object is on a different page than allocation top. Bail out if the
2991 // object sits on the page boundary as no memento can follow and we cannot 2992 // object sits on the page boundary as no memento can follow and we cannot
2992 // touch the memory following it. 2993 // touch the memory following it.
2993 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 2994 lea(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
2994 xor_(scratch_reg, receiver_reg); 2995 xor_(scratch_reg, receiver_reg);
2995 test(scratch_reg, Immediate(~Page::kPageAlignmentMask)); 2996 test(scratch_reg, Immediate(~Page::kPageAlignmentMask));
2996 j(not_zero, no_memento_found); 2997 j(not_zero, no_memento_found);
2997 // Continue with the actual map check. 2998 // Continue with the actual map check.
2998 jmp(&map_check); 2999 jmp(&map_check);
2999 // If top is on the same page as the current object, we need to check whether 3000 // If top is on the same page as the current object, we need to check whether
3000 // we are below top. 3001 // we are below top.
3001 bind(&top_check); 3002 bind(&top_check);
3002 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 3003 lea(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
3003 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); 3004 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
3004 j(greater, no_memento_found); 3005 j(greater_equal, no_memento_found);
3005 // Memento map check. 3006 // Memento map check.
3006 bind(&map_check); 3007 bind(&map_check);
3007 mov(scratch_reg, Operand(receiver_reg, kMementoMapOffset)); 3008 mov(scratch_reg, Operand(receiver_reg, kMementoMapOffset));
3008 cmp(scratch_reg, Immediate(isolate()->factory()->allocation_memento_map())); 3009 cmp(scratch_reg, Immediate(isolate()->factory()->allocation_memento_map()));
3009 } 3010 }
3010 3011
3011 3012
3012 void MacroAssembler::JumpIfDictionaryInPrototypeChain( 3013 void MacroAssembler::JumpIfDictionaryInPrototypeChain(
3013 Register object, 3014 Register object,
3014 Register scratch0, 3015 Register scratch0,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 mov(eax, dividend); 3060 mov(eax, dividend);
3060 shr(eax, 31); 3061 shr(eax, 31);
3061 add(edx, eax); 3062 add(edx, eax);
3062 } 3063 }
3063 3064
3064 3065
3065 } // namespace internal 3066 } // namespace internal
3066 } // namespace v8 3067 } // namespace v8
3067 3068
3068 #endif // V8_TARGET_ARCH_X87 3069 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698