OLD | NEW |
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 Loading... |
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()); | 5619 Label top_check; |
5620 ExternalReference new_space_allocation_top = | 5620 ExternalReference new_space_allocation_top = |
5621 ExternalReference::new_space_allocation_top_address(isolate()); | 5621 ExternalReference::new_space_allocation_top_address(isolate()); |
| 5622 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
| 5623 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
5622 | 5624 |
5623 leap(scratch_reg, Operand(receiver_reg, | 5625 // Bail out if the object is not in new space. |
5624 JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); | 5626 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); |
5625 Move(kScratchRegister, new_space_start); | 5627 // If the object is in new space, we need to check whether it is on the same |
5626 cmpp(scratch_reg, kScratchRegister); | 5628 // page as the current top. |
5627 j(less, no_memento_found); | 5629 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
| 5630 xorp(scratch_reg, ExternalOperand(new_space_allocation_top)); |
| 5631 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask)); |
| 5632 j(zero, &top_check); |
| 5633 // The object is on a different page than allocation top. Bail out if the |
| 5634 // object sits on the page boundary as no memento can follow and we cannot |
| 5635 // touch the memory following it. |
| 5636 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
| 5637 xorp(scratch_reg, receiver_reg); |
| 5638 testp(scratch_reg, Immediate(~Page::kPageAlignmentMask)); |
| 5639 j(not_zero, no_memento_found); |
| 5640 // Continue with the actual map check. |
| 5641 jmp(&map_check); |
| 5642 // If top is on the same page as the current object, we need to check whether |
| 5643 // we are below top. |
| 5644 bind(&top_check); |
| 5645 leap(scratch_reg, Operand(receiver_reg, kMementoEndOffset)); |
5628 cmpp(scratch_reg, ExternalOperand(new_space_allocation_top)); | 5646 cmpp(scratch_reg, ExternalOperand(new_space_allocation_top)); |
5629 j(greater, no_memento_found); | 5647 j(greater, no_memento_found); |
5630 CompareRoot(MemOperand(scratch_reg, -AllocationMemento::kSize), | 5648 // Memento map check. |
| 5649 bind(&map_check); |
| 5650 CompareRoot(MemOperand(receiver_reg, kMementoMapOffset), |
5631 Heap::kAllocationMementoMapRootIndex); | 5651 Heap::kAllocationMementoMapRootIndex); |
5632 } | 5652 } |
5633 | 5653 |
5634 | 5654 |
5635 void MacroAssembler::JumpIfDictionaryInPrototypeChain( | 5655 void MacroAssembler::JumpIfDictionaryInPrototypeChain( |
5636 Register object, | 5656 Register object, |
5637 Register scratch0, | 5657 Register scratch0, |
5638 Register scratch1, | 5658 Register scratch1, |
5639 Label* found) { | 5659 Label* found) { |
5640 DCHECK(!(scratch0.is(kScratchRegister) && scratch1.is(kScratchRegister))); | 5660 DCHECK(!(scratch0.is(kScratchRegister) && scratch1.is(kScratchRegister))); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5681 movl(rax, dividend); | 5701 movl(rax, dividend); |
5682 shrl(rax, Immediate(31)); | 5702 shrl(rax, Immediate(31)); |
5683 addl(rdx, rax); | 5703 addl(rdx, rax); |
5684 } | 5704 } |
5685 | 5705 |
5686 | 5706 |
5687 } // namespace internal | 5707 } // namespace internal |
5688 } // namespace v8 | 5708 } // namespace v8 |
5689 | 5709 |
5690 #endif // V8_TARGET_ARCH_X64 | 5710 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |