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_PPC | 8 #if V8_TARGET_ARCH_PPC |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 4454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4465 int offset = mem.offset(); | 4465 int offset = mem.offset(); |
4466 | 4466 |
4467 if (!is_int16(offset)) { | 4467 if (!is_int16(offset)) { |
4468 mov(scratch, Operand(offset)); | 4468 mov(scratch, Operand(offset)); |
4469 stfdx(src, MemOperand(base, scratch)); | 4469 stfdx(src, MemOperand(base, scratch)); |
4470 } else { | 4470 } else { |
4471 stfd(src, mem); | 4471 stfd(src, mem); |
4472 } | 4472 } |
4473 } | 4473 } |
4474 | 4474 |
4475 | |
4476 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, | 4475 void MacroAssembler::TestJSArrayForAllocationMemento(Register receiver_reg, |
4477 Register scratch_reg, | 4476 Register scratch_reg, |
| 4477 Register scratch2_reg, |
4478 Label* no_memento_found) { | 4478 Label* no_memento_found) { |
4479 ExternalReference new_space_start = | 4479 Label map_check; |
4480 ExternalReference::new_space_start(isolate()); | 4480 Label top_check; |
4481 ExternalReference new_space_allocation_top = | 4481 ExternalReference new_space_allocation_top = |
4482 ExternalReference::new_space_allocation_top_address(isolate()); | 4482 ExternalReference::new_space_allocation_top_address(isolate()); |
4483 addi(scratch_reg, receiver_reg, | 4483 const int kMementoMapOffset = JSArray::kSize - kHeapObjectTag; |
4484 Operand(JSArray::kSize + AllocationMemento::kSize - kHeapObjectTag)); | 4484 const int kMementoEndOffset = kMementoMapOffset + AllocationMemento::kSize; |
4485 Cmpi(scratch_reg, Operand(new_space_start), r0); | 4485 Register mask = scratch2_reg; |
4486 blt(no_memento_found); | 4486 |
4487 mov(ip, Operand(new_space_allocation_top)); | 4487 DCHECK(!AreAliased(receiver_reg, scratch_reg, mask)); |
4488 LoadP(ip, MemOperand(ip)); | 4488 |
4489 cmp(scratch_reg, ip); | 4489 // Bail out if the object is not in new space. |
| 4490 JumpIfNotInNewSpace(receiver_reg, scratch_reg, no_memento_found); |
| 4491 |
| 4492 DCHECK((~Page::kPageAlignmentMask & 0xffff) == 0); |
| 4493 lis(mask, Operand((~Page::kPageAlignmentMask >> 16))); |
| 4494 addi(scratch_reg, receiver_reg, Operand(kMementoEndOffset)); |
| 4495 |
| 4496 // If the object is in new space, we need to check whether it is on the same |
| 4497 // page as the current top. |
| 4498 Xor(r0, scratch_reg, Operand(new_space_allocation_top)); |
| 4499 and_(r0, r0, mask, SetRC); |
| 4500 beq(&top_check, cr0); |
| 4501 // The object is on a different page than allocation top. Bail out if the |
| 4502 // object sits on the page boundary as no memento can follow and we cannot |
| 4503 // touch the memory following it. |
| 4504 xor_(r0, scratch_reg, receiver_reg); |
| 4505 and_(r0, r0, mask, SetRC); |
| 4506 bne(no_memento_found, cr0); |
| 4507 // Continue with the actual map check. |
| 4508 b(&map_check); |
| 4509 // If top is on the same page as the current object, we need to check whether |
| 4510 // we are below top. |
| 4511 bind(&top_check); |
| 4512 Cmpi(scratch_reg, Operand(new_space_allocation_top), r0); |
4490 bgt(no_memento_found); | 4513 bgt(no_memento_found); |
4491 LoadP(scratch_reg, MemOperand(scratch_reg, -AllocationMemento::kSize)); | 4514 // Memento map check. |
| 4515 bind(&map_check); |
| 4516 LoadP(scratch_reg, MemOperand(receiver_reg, kMementoMapOffset)); |
4492 Cmpi(scratch_reg, Operand(isolate()->factory()->allocation_memento_map()), | 4517 Cmpi(scratch_reg, Operand(isolate()->factory()->allocation_memento_map()), |
4493 r0); | 4518 r0); |
4494 } | 4519 } |
4495 | 4520 |
4496 | |
4497 Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2, Register reg3, | 4521 Register GetRegisterThatIsNotOneOf(Register reg1, Register reg2, Register reg3, |
4498 Register reg4, Register reg5, | 4522 Register reg4, Register reg5, |
4499 Register reg6) { | 4523 Register reg6) { |
4500 RegList regs = 0; | 4524 RegList regs = 0; |
4501 if (reg1.is_valid()) regs |= reg1.bit(); | 4525 if (reg1.is_valid()) regs |= reg1.bit(); |
4502 if (reg2.is_valid()) regs |= reg2.bit(); | 4526 if (reg2.is_valid()) regs |= reg2.bit(); |
4503 if (reg3.is_valid()) regs |= reg3.bit(); | 4527 if (reg3.is_valid()) regs |= reg3.bit(); |
4504 if (reg4.is_valid()) regs |= reg4.bit(); | 4528 if (reg4.is_valid()) regs |= reg4.bit(); |
4505 if (reg5.is_valid()) regs |= reg5.bit(); | 4529 if (reg5.is_valid()) regs |= reg5.bit(); |
4506 if (reg6.is_valid()) regs |= reg6.bit(); | 4530 if (reg6.is_valid()) regs |= reg6.bit(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4644 } | 4668 } |
4645 if (mag.shift > 0) srawi(result, result, mag.shift); | 4669 if (mag.shift > 0) srawi(result, result, mag.shift); |
4646 ExtractBit(r0, dividend, 31); | 4670 ExtractBit(r0, dividend, 31); |
4647 add(result, result, r0); | 4671 add(result, result, r0); |
4648 } | 4672 } |
4649 | 4673 |
4650 } // namespace internal | 4674 } // namespace internal |
4651 } // namespace v8 | 4675 } // namespace v8 |
4652 | 4676 |
4653 #endif // V8_TARGET_ARCH_PPC | 4677 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |