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

Side by Side Diff: src/ia32/macro-assembler-ia32.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/code-stub-assembler.cc ('k') | src/mips/macro-assembler-mips.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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
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 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 3123
3124 void MacroAssembler::TestJSArrayForAllocationMemento( 3124 void MacroAssembler::TestJSArrayForAllocationMemento(
3125 Register receiver_reg, 3125 Register receiver_reg,
3126 Register scratch_reg, 3126 Register scratch_reg,
3127 Label* no_memento_found) { 3127 Label* no_memento_found) {
3128 Label map_check; 3128 Label map_check;
3129 Label top_check; 3129 Label top_check;
3130 ExternalReference new_space_allocation_top = 3130 ExternalReference new_space_allocation_top =
3131 ExternalReference::new_space_allocation_top_address(isolate()); 3131 ExternalReference::new_space_allocation_top_address(isolate());
3132 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; 3132 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
3133 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; 3133 const int kMementoLastWordOffset =
3134 kMementoMapOffset + AllocationMemento::kSize - kPointerSize;
3134 3135
3135 // Bail out if the object is not in new space. 3136 // Bail out if the object is not in new space.
3136 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); 3137 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found);
3137 // If the object is in new space, we need to check whether it is on the same 3138 // If the object is in new space, we need to check whether it is on the same
3138 // page as the current top. 3139 // page as the current top.
3139 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 3140 lea(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
3140 xor_(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); 3141 xor_(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
3141 test(scratch_reg, Immediate(~Page::kPageAlignmentMask)); 3142 test(scratch_reg, Immediate(~Page::kPageAlignmentMask));
3142 j(zero, &top_check); 3143 j(zero, &top_check);
3143 // The object is on a different page than allocation top. Bail out if the 3144 // The object is on a different page than allocation top. Bail out if the
3144 // object sits on the page boundary as no memento can follow and we cannot 3145 // object sits on the page boundary as no memento can follow and we cannot
3145 // touch the memory following it. 3146 // touch the memory following it.
3146 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 3147 lea(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
3147 xor_(scratch_reg, receiver_reg); 3148 xor_(scratch_reg, receiver_reg);
3148 test(scratch_reg, Immediate(~Page::kPageAlignmentMask)); 3149 test(scratch_reg, Immediate(~Page::kPageAlignmentMask));
3149 j(not_zero, no_memento_found); 3150 j(not_zero, no_memento_found);
3150 // Continue with the actual map check. 3151 // Continue with the actual map check.
3151 jmp(&map_check); 3152 jmp(&map_check);
3152 // If top is on the same page as the current object, we need to check whether 3153 // If top is on the same page as the current object, we need to check whether
3153 // we are below top. 3154 // we are below top.
3154 bind(&top_check); 3155 bind(&top_check);
3155 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); 3156 lea(scratch_reg, Operand(receiver_reg, kMementoLastWordOffset));
3156 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); 3157 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
3157 j(greater, no_memento_found); 3158 j(greater_equal, no_memento_found);
3158 // Memento map check. 3159 // Memento map check.
3159 bind(&map_check); 3160 bind(&map_check);
3160 mov(scratch_reg, Operand(receiver_reg, kMementoMapOffset)); 3161 mov(scratch_reg, Operand(receiver_reg, kMementoMapOffset));
3161 cmp(scratch_reg, Immediate(isolate()->factory()->allocation_memento_map())); 3162 cmp(scratch_reg, Immediate(isolate()->factory()->allocation_memento_map()));
3162 } 3163 }
3163 3164
3164 3165
3165 void MacroAssembler::JumpIfDictionaryInPrototypeChain( 3166 void MacroAssembler::JumpIfDictionaryInPrototypeChain(
3166 Register object, 3167 Register object,
3167 Register scratch0, 3168 Register scratch0,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
3212 mov(eax, dividend); 3213 mov(eax, dividend);
3213 shr(eax, 31); 3214 shr(eax, 31);
3214 add(edx, eax); 3215 add(edx, eax);
3215 } 3216 }
3216 3217
3217 3218
3218 } // namespace internal 3219 } // namespace internal
3219 } // namespace v8 3220 } // namespace v8
3220 3221
3221 #endif // V8_TARGET_ARCH_IA32 3222 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/code-stub-assembler.cc ('k') | src/mips/macro-assembler-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698