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

Side by Side Diff: src/x64/macro-assembler-x64.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_X64 5 #if V8_TARGET_ARCH_X64
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 5597 matching lines...) Expand 10 before | Expand all | Expand 10 after
5608 movp(rcx, FieldOperand(rbx, Map::kPrototypeOffset)); 5608 movp(rcx, FieldOperand(rbx, Map::kPrototypeOffset));
5609 CompareRoot(rcx, Heap::kNullValueRootIndex); 5609 CompareRoot(rcx, Heap::kNullValueRootIndex);
5610 j(not_equal, &next); 5610 j(not_equal, &next);
5611 } 5611 }
5612 5612
5613 5613
5614 void MacroAssembler::TestJSArrayForAllocationMemento( 5614 void MacroAssembler::TestJSArrayForAllocationMemento(
5615 Register receiver_reg, 5615 Register receiver_reg,
5616 Register scratch_reg, 5616 Register scratch_reg,
5617 Label* no_memento_found) { 5617 Label* no_memento_found) {
5618 ExternalReference new_space_start = 5618 Label map_check;
5619 ExternalReference::new_space_start(isolate());
5620 ExternalReference new_space_allocation_top = 5619 ExternalReference new_space_allocation_top =
5621 ExternalReference::new_space_allocation_top_address(isolate()); 5620 ExternalReference::new_space_allocation_top_address(isolate());
5621 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag;
5622 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize;
5622 5623
5623 leap(scratch_reg, Operand(receiver_reg, 5624 // Bail out if the object sits on the page boundary as no memento can follow
5624 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); 5625 // and we cannot touch the memory following it.
5625 Move(kScratchRegister, new_space_start); 5626 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
5626 cmpp(scratch_reg, kScratchRegister); 5627 xorp(scratch_reg, receiver_reg);
5627 j(less, no_memento_found); 5628 cmpp(scratch_reg, Immediate(Page::kPageSize));
5629 j(greater, no_memento_found);
5630 // Bail out if the object is not in new space.
5631 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
5632 JumpIfNotInNewSpace(scratch_reg, scratch_reg, no_memento_found);
5633 // If the object is in new space, we need to check whether it is on the same
5634 // page as the current top.
5635 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
5636 xorp(scratch_reg, ExternalOperand(new_space_allocation_top));
5637 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask));
5638 // If top is not on the same page as the current object, we can just continue
5639 // with the map check.
5640 j(not_zero, &map_check);
5641 // Otherwise, we have to check whether we are still below top, to ensure that
5642 // we are not checking against a stale memento.
5643 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset));
5628 cmpp(scratch_reg, ExternalOperand(new_space_allocation_top)); 5644 cmpp(scratch_reg, ExternalOperand(new_space_allocation_top));
5629 j(greater, no_memento_found); 5645 j(greater, no_memento_found);
5630 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), 5646 bind(&map_check);
5647 CompareRoot(MemOperand(receiver_reg, kMementoMapOffset),
5631 Heap::kAllocationMementoMapRootIndex); 5648 Heap::kAllocationMementoMapRootIndex);
5632 } 5649 }
5633 5650
5634 5651
5635 void MacroAssembler::JumpIfDictionaryInPrototypeChain( 5652 void MacroAssembler::JumpIfDictionaryInPrototypeChain(
5636 Register object, 5653 Register object,
5637 Register scratch0, 5654 Register scratch0,
5638 Register scratch1, 5655 Register scratch1,
5639 Label* found) { 5656 Label* found) {
5640 DCHECK(!(scratch0.is(kScratchRegister) && scratch1.is(kScratchRegister))); 5657 DCHECK(!(scratch0.is(kScratchRegister) && scratch1.is(kScratchRegister)));
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
5681 movl(rax, dividend); 5698 movl(rax, dividend);
5682 shrl(rax, Immediate(31)); 5699 shrl(rax, Immediate(31));
5683 addl(rdx, rax); 5700 addl(rdx, rax);
5684 } 5701 }
5685 5702
5686 5703
5687 } // namespace internal 5704 } // namespace internal
5688 } // namespace v8 5705 } // namespace v8
5689 5706
5690 #endif // V8_TARGET_ARCH_X64 5707 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698