OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_S390 | 8 #if V8_TARGET_ARCH_S390 |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 3686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3697 AssertNotSmi(src); | 3697 AssertNotSmi(src); |
3698 } else if (r.IsSmi()) { | 3698 } else if (r.IsSmi()) { |
3699 AssertSmi(src); | 3699 AssertSmi(src); |
3700 } | 3700 } |
3701 StoreP(src, mem, scratch); | 3701 StoreP(src, mem, scratch); |
3702 } | 3702 } |
3703 } | 3703 } |
3704 | 3704 |
3705 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, | 3705 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
3706 Register scratch_reg, | 3706 Register scratch_reg, |
| 3707 Register scratch2_reg, |
3707 Label* no_memento_found) { | 3708 Label* no_memento_found) { |
3708 ExternalReference new_space_start = | 3709 Label map_check; |
3709 ExternalReference::new_space_start(isolate()); | 3710 Label top_check; |
3710 ExternalReference new_space_allocation_top = | 3711 ExternalReference new_space_allocation_top = |
3711 ExternalReference::new_space_allocation_top_address(isolate()); | 3712 ExternalReference::new_space_allocation_top_address(isolate()); |
3712 AddP(scratch_reg, receiver_reg, | 3713 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
3713 Operand(JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); | 3714 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
3714 CmpP(scratch_reg, Operand(new_space_start)); | 3715 Register mask = scratch2_reg; |
3715 blt(no_memento_found); | 3716 |
3716 mov(ip, Operand(new_space_allocation_top)); | 3717 DCHECK(!AreAliased(receiver_reg, scratch_reg, mask)); |
3717 LoadP(ip, MemOperand(ip)); | 3718 |
3718 CmpP(scratch_reg, ip); | 3719 // Bail out if the object is not in new space. |
| 3720 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); |
| 3721 |
| 3722 DCHECK((~Page::kPageAlignmentMask & 0xffff) == 0); |
| 3723 LoadImmP(mask, Operand((~Page::kPageAlignmentMask >> 16))); |
| 3724 AddP(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 3725 |
| 3726 // If the object is in new space, we need to check whether it is on the same |
| 3727 // page as the current top. |
| 3728 XorP(r0, scratch_reg, Operand(new_space_allocation_top)); |
| 3729 AndP(r0, r0, mask); |
| 3730 beq(&top_check, Label::kNear); |
| 3731 // The object is on a different page than allocation top. Bail out if the |
| 3732 // object sits on the page boundary as no memento can follow and we cannot |
| 3733 // touch the memory following it. |
| 3734 XorP(r0, scratch_reg, receiver_reg); |
| 3735 AndP(r0, r0, mask); |
| 3736 bne(no_memento_found); |
| 3737 // Continue with the actual map check. |
| 3738 b(&map_check, Label::kNear); |
| 3739 // If top is on the same page as the current object, we need to check whether |
| 3740 // we are below top. |
| 3741 bind(&top_check); |
| 3742 CmpP(scratch_reg, Operand(new_space_allocation_top)); |
3719 bgt(no_memento_found); | 3743 bgt(no_memento_found); |
3720 LoadP(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize)); | 3744 // Memento map check. |
| 3745 bind(&map_check); |
| 3746 LoadP(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); |
3721 CmpP(scratch_reg, Operand(isolate()->factory()->allocation_memento_map())); | 3747 CmpP(scratch_reg, Operand(isolate()->factory()->allocation_memento_map())); |
3722 } | 3748 } |
3723 | 3749 |
3724 Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2, Register reg3, | 3750 Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2, Register reg3, |
3725 Register reg4, Register reg5, | 3751 Register reg4, Register reg5, |
3726 Register reg6) { | 3752 Register reg6) { |
3727 RegList regs = 0; | 3753 RegList regs = 0; |
3728 if (reg1.is_valid()) regs |= reg1.bit(); | 3754 if (reg1.is_valid()) regs |= reg1.bit(); |
3729 if (reg2.is_valid()) regs |= reg2.bit(); | 3755 if (reg2.is_valid()) regs |= reg2.bit(); |
3730 if (reg3.is_valid()) regs |= reg3.bit(); | 3756 if (reg3.is_valid()) regs |= reg3.bit(); |
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5527 } | 5553 } |
5528 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); | 5554 if (mag.shift > 0) ShiftRightArith(result, result, Operand(mag.shift)); |
5529 ExtractBit(r0, dividend, 31); | 5555 ExtractBit(r0, dividend, 31); |
5530 AddP(result, r0); | 5556 AddP(result, r0); |
5531 } | 5557 } |
5532 | 5558 |
5533 } // namespace internal | 5559 } // namespace internal |
5534 } // namespace v8 | 5560 } // namespace v8 |
5535 | 5561 |
5536 #endif // V8_TARGET_ARCH_S390 | 5562 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |