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

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

Issue 1845463003: Remove usages of Heap::NewSpaceStart and its external reference (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Do not access mementos when the array is allocated on a page boundary Created 4 years, 8 months 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
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 3156 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset)); 3167 mov(ecx, FieldOperand(ebx, Map::kPrototypeOffset));
3168 cmp(ecx, isolate()->factory()->null_value()); 3168 cmp(ecx, isolate()->factory()->null_value());
3169 j(not_equal, &next); 3169 j(not_equal, &next);
3170 } 3170 }
3171 3171
3172 3172
3173 void MacroAssembler::TestJSArrayForAllocationMemento( 3173 void MacroAssembler::TestJSArrayForAllocationMemento(
3174 Register receiver_reg, 3174 Register receiver_reg,
3175 Register scratch_reg, 3175 Register scratch_reg,
3176 Label* no_memento_found) { 3176 Label* no_memento_found) {
3177 ExternalReference new_space_start = 3177 Label map_check;
3178 ExternalReference::new_space_start(isolate());
3179 ExternalReference new_space_allocation_top = 3178 ExternalReference new_space_allocation_top =
3180 ExternalReference::new_space_allocation_top_address(isolate()); 3179 ExternalReference::new_space_allocation_top_address(isolate());
3180 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
3181 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize;
3181 3182
3182 lea(scratch_reg, Operand(receiver_reg, 3183 // Bail out if the object sits on the page boundary as no memento can follow
3183 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); 3184 // and we cannot touch the memory following it.
3184 cmp(scratch_reg, Immediate(new_space_start)); 3185 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
3185 j(less, no_memento_found); 3186 xor_(scratch_reg, receiver_reg);
3187 cmp(scratch_reg, Immediate(Page::kPageSize));
3188 j(greater, no_memento_found);
3189 // Bail out if the object is not in new space.
3190 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
3191 JumpIfNotInNewSpace(scratch_reg, scratch_reg, no_memento_found);
3192 // If the object is in new space, we need to check whether it is on the same
3193 // page as the current top.
3194 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
3195 xor_(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
3196 test(scratch_reg, Immediate(~Page::kPageAlignmentMask));
3197 // If top is not on the same page as the current object, we can just continue
3198 // with the map check.
3199 j(not_zero, &map_check);
3200 // Otherwise, we have to check whether we are still below top, to ensure that
3201 // we are not checking against a stale memento.
3202 lea(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
3186 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top)); 3203 cmp(scratch_reg, Operand::StaticVariable(new_space_allocation_top));
3187 j(greater, no_memento_found); 3204 j(greater, no_memento_found);
3188 cmp(MemOperand(scratch_reg, -AllocationMemento::kSize), 3205 bind(&map_check);
3206 cmp(MemOperand(receiver_reg, kMementoMapOffset),
3189 Immediate(isolate()->factory()->allocation_memento_map())); 3207 Immediate(isolate()->factory()->allocation_memento_map()));
3190 } 3208 }
3191 3209
3192 3210
3193 void MacroAssembler::JumpIfDictionaryInPrototypeChain( 3211 void MacroAssembler::JumpIfDictionaryInPrototypeChain(
3194 Register object, 3212 Register object,
3195 Register scratch0, 3213 Register scratch0,
3196 Register scratch1, 3214 Register scratch1,
3197 Label* found) { 3215 Label* found) {
3198 DCHECK(!scratch1.is(scratch0)); 3216 DCHECK(!scratch1.is(scratch0));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
3240 mov(eax, dividend); 3258 mov(eax, dividend);
3241 shr(eax, 31); 3259 shr(eax, 31);
3242 add(edx, eax); 3260 add(edx, eax);
3243 } 3261 }
3244 3262
3245 3263
3246 } // namespace internal 3264 } // namespace internal
3247 } // namespace v8 3265 } // namespace v8
3248 3266
3249 #endif // V8_TARGET_ARCH_X87 3267 #endif // V8_TARGET_ARCH_X87
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698