| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 #ifdef DEBUG | 121 #ifdef DEBUG |
| 122 // Check the expected size before generating code to ensure we assume the same | 122 // Check the expected size before generating code to ensure we assume the same |
| 123 // constant pool availability (e.g., whether constant pool is full or not). | 123 // constant pool availability (e.g., whether constant pool is full or not). |
| 124 int expected_size = CallSize(target, rmode, cond); | 124 int expected_size = CallSize(target, rmode, cond); |
| 125 Label start; | 125 Label start; |
| 126 bind(&start); | 126 bind(&start); |
| 127 #endif | 127 #endif |
| 128 // This can likely be optimized to make use of bc() with 24bit relative | 128 // This can likely be optimized to make use of bc() with 24bit relative |
| 129 // | 129 // |
| 130 // RecordRelocInfo(x.rmode_, x.imm_); | 130 // RecordRelocInfo(x.rmode_, x.immediate); |
| 131 // bc( BA, .... offset, LKset); | 131 // bc( BA, .... offset, LKset); |
| 132 // | 132 // |
| 133 | 133 |
| 134 mov(ip, Operand(reinterpret_cast<intptr_t>(target), rmode)); | 134 mov(ip, Operand(reinterpret_cast<intptr_t>(target), rmode)); |
| 135 mtctr(ip); | 135 mtctr(ip); |
| 136 bctrl(); | 136 bctrl(); |
| 137 | 137 |
| 138 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); | 138 DCHECK_EQ(expected_size, SizeOfCodeGeneratedSince(&start)); |
| 139 } | 139 } |
| 140 | 140 |
| (...skipping 3469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 cmplw(src1, scratch, cr); | 3610 cmplw(src1, scratch, cr); |
| 3611 } | 3611 } |
| 3612 } | 3612 } |
| 3613 | 3613 |
| 3614 | 3614 |
| 3615 void MacroAssembler::And(Register ra, Register rs, const Operand& rb, | 3615 void MacroAssembler::And(Register ra, Register rs, const Operand& rb, |
| 3616 RCBit rc) { | 3616 RCBit rc) { |
| 3617 if (rb.is_reg()) { | 3617 if (rb.is_reg()) { |
| 3618 and_(ra, rs, rb.rm(), rc); | 3618 and_(ra, rs, rb.rm(), rc); |
| 3619 } else { | 3619 } else { |
| 3620 if (is_uint16(rb.imm_) && RelocInfo::IsNone(rb.rmode_) && rc == SetRC) { | 3620 if (is_uint16(rb.immediate()) && RelocInfo::IsNone(rb.rmode_) && |
| 3621 rc == SetRC) { |
| 3621 andi(ra, rs, rb); | 3622 andi(ra, rs, rb); |
| 3622 } else { | 3623 } else { |
| 3623 // mov handles the relocation. | 3624 // mov handles the relocation. |
| 3624 DCHECK(!rs.is(r0)); | 3625 DCHECK(!rs.is(r0)); |
| 3625 mov(r0, rb); | 3626 mov(r0, rb); |
| 3626 and_(ra, rs, r0, rc); | 3627 and_(ra, rs, r0, rc); |
| 3627 } | 3628 } |
| 3628 } | 3629 } |
| 3629 } | 3630 } |
| 3630 | 3631 |
| 3631 | 3632 |
| 3632 void MacroAssembler::Or(Register ra, Register rs, const Operand& rb, RCBit rc) { | 3633 void MacroAssembler::Or(Register ra, Register rs, const Operand& rb, RCBit rc) { |
| 3633 if (rb.is_reg()) { | 3634 if (rb.is_reg()) { |
| 3634 orx(ra, rs, rb.rm(), rc); | 3635 orx(ra, rs, rb.rm(), rc); |
| 3635 } else { | 3636 } else { |
| 3636 if (is_uint16(rb.imm_) && RelocInfo::IsNone(rb.rmode_) && rc == LeaveRC) { | 3637 if (is_uint16(rb.immediate()) && RelocInfo::IsNone(rb.rmode_) && |
| 3638 rc == LeaveRC) { |
| 3637 ori(ra, rs, rb); | 3639 ori(ra, rs, rb); |
| 3638 } else { | 3640 } else { |
| 3639 // mov handles the relocation. | 3641 // mov handles the relocation. |
| 3640 DCHECK(!rs.is(r0)); | 3642 DCHECK(!rs.is(r0)); |
| 3641 mov(r0, rb); | 3643 mov(r0, rb); |
| 3642 orx(ra, rs, r0, rc); | 3644 orx(ra, rs, r0, rc); |
| 3643 } | 3645 } |
| 3644 } | 3646 } |
| 3645 } | 3647 } |
| 3646 | 3648 |
| 3647 | 3649 |
| 3648 void MacroAssembler::Xor(Register ra, Register rs, const Operand& rb, | 3650 void MacroAssembler::Xor(Register ra, Register rs, const Operand& rb, |
| 3649 RCBit rc) { | 3651 RCBit rc) { |
| 3650 if (rb.is_reg()) { | 3652 if (rb.is_reg()) { |
| 3651 xor_(ra, rs, rb.rm(), rc); | 3653 xor_(ra, rs, rb.rm(), rc); |
| 3652 } else { | 3654 } else { |
| 3653 if (is_uint16(rb.imm_) && RelocInfo::IsNone(rb.rmode_) && rc == LeaveRC) { | 3655 if (is_uint16(rb.immediate()) && RelocInfo::IsNone(rb.rmode_) && |
| 3656 rc == LeaveRC) { |
| 3654 xori(ra, rs, rb); | 3657 xori(ra, rs, rb); |
| 3655 } else { | 3658 } else { |
| 3656 // mov handles the relocation. | 3659 // mov handles the relocation. |
| 3657 DCHECK(!rs.is(r0)); | 3660 DCHECK(!rs.is(r0)); |
| 3658 mov(r0, rb); | 3661 mov(r0, rb); |
| 3659 xor_(ra, rs, r0, rc); | 3662 xor_(ra, rs, r0, rc); |
| 3660 } | 3663 } |
| 3661 } | 3664 } |
| 3662 } | 3665 } |
| 3663 | 3666 |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4258 } | 4261 } |
| 4259 if (mag.shift > 0) srawi(result, result, mag.shift); | 4262 if (mag.shift > 0) srawi(result, result, mag.shift); |
| 4260 ExtractBit(r0, dividend, 31); | 4263 ExtractBit(r0, dividend, 31); |
| 4261 add(result, result, r0); | 4264 add(result, result, r0); |
| 4262 } | 4265 } |
| 4263 | 4266 |
| 4264 } // namespace internal | 4267 } // namespace internal |
| 4265 } // namespace v8 | 4268 } // namespace v8 |
| 4266 | 4269 |
| 4267 #endif // V8_TARGET_ARCH_PPC | 4270 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |