Commit 8aefac35 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC: fix debug build error

R=joransiu@ca.ibm.com

Change-Id: I28c7f3d018a03adb843b0426510c2ba669324b76
Reviewed-on: https://chromium-review.googlesource.com/996593Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#52413}
parent ad221d14
...@@ -2326,7 +2326,8 @@ void CodeGenerator::AssembleReturn(InstructionOperand* pop) { ...@@ -2326,7 +2326,8 @@ void CodeGenerator::AssembleReturn(InstructionOperand* pop) {
// Constant pool is unavailable since the frame has been destructed // Constant pool is unavailable since the frame has been destructed
ConstantPoolUnavailableScope constant_pool_unavailable(tasm()); ConstantPoolUnavailableScope constant_pool_unavailable(tasm());
if (pop->IsImmediate()) { if (pop->IsImmediate()) {
DCHECK_EQ(Constant::kInt32, g.ToConstant(pop).type()); DCHECK(Constant::kInt32 == g.ToConstant(pop).type() ||
Constant::kInt64 == g.ToConstant(pop).type());
pop_count += g.ToConstant(pop).ToInt32(); pop_count += g.ToConstant(pop).ToInt32();
} else { } else {
__ Drop(g.ToRegister(pop)); __ Drop(g.ToRegister(pop));
......
...@@ -427,11 +427,11 @@ const int kEndOfChain = -4; ...@@ -427,11 +427,11 @@ const int kEndOfChain = -4;
enum { enum {
kUnboundMovLabelOffsetOpcode = 0 << 26, kUnboundMovLabelOffsetOpcode = 0 << 26,
kUnboundAddLabelOffsetOpcode = 1 << 26, kUnboundAddLabelOffsetOpcode = 1 << 26,
kUnboundMovLabelAddrOpcode = 2 << 26, kUnboundAddLabelLongOffsetOpcode = 2 << 26,
kUnboundJumpTableEntryOpcode = 3 << 26 kUnboundMovLabelAddrOpcode = 3 << 26,
kUnboundJumpTableEntryOpcode = 4 << 26
}; };
int Assembler::target_at(int pos) { int Assembler::target_at(int pos) {
Instr instr = instr_at(pos); Instr instr = instr_at(pos);
// check which type of branch this is 16 or 26 bit offset // check which type of branch this is 16 or 26 bit offset
...@@ -448,6 +448,7 @@ int Assembler::target_at(int pos) { ...@@ -448,6 +448,7 @@ int Assembler::target_at(int pos) {
break; break;
case kUnboundMovLabelOffsetOpcode: case kUnboundMovLabelOffsetOpcode:
case kUnboundAddLabelOffsetOpcode: case kUnboundAddLabelOffsetOpcode:
case kUnboundAddLabelLongOffsetOpcode:
case kUnboundMovLabelAddrOpcode: case kUnboundMovLabelAddrOpcode:
case kUnboundJumpTableEntryOpcode: case kUnboundJumpTableEntryOpcode:
link = SIGN_EXT_IMM26(instr & kImm26Mask); link = SIGN_EXT_IMM26(instr & kImm26Mask);
...@@ -508,15 +509,21 @@ void Assembler::target_at_put(int pos, int target_pos, bool* is_branch) { ...@@ -508,15 +509,21 @@ void Assembler::target_at_put(int pos, int target_pos, bool* is_branch) {
patcher.bitwise_mov32(dst, offset); patcher.bitwise_mov32(dst, offset);
break; break;
} }
case kUnboundAddLabelLongOffsetOpcode:
case kUnboundAddLabelOffsetOpcode: { case kUnboundAddLabelOffsetOpcode: {
// dst = base + position + immediate // dst = base + position + immediate
Instr operands = instr_at(pos + kInstrSize); Instr operands = instr_at(pos + kInstrSize);
Register dst = Register::from_code((operands >> 21) & 0x1F); Register dst = Register::from_code((operands >> 27) & 0x1F);
Register base = Register::from_code((operands >> 16) & 0x1F); Register base = Register::from_code((operands >> 22) & 0x1F);
int32_t offset = target_pos + SIGN_EXT_IMM16(operands & kImm16Mask); int32_t delta = (opcode == kUnboundAddLabelLongOffsetOpcode)
PatchingAssembler patcher(isolate_data(), ? static_cast<int32_t>(instr_at(pos + 2 * kInstrSize))
reinterpret_cast<byte*>(buffer_ + pos), 2); : (SIGN_EXT_IMM22(operands & kImm22Mask));
int32_t offset = target_pos + delta;
PatchingAssembler patcher(
isolate_data(), reinterpret_cast<byte*>(buffer_ + pos),
2 + static_cast<int32_t>(opcode == kUnboundAddLabelLongOffsetOpcode));
patcher.bitwise_add32(dst, base, offset); patcher.bitwise_add32(dst, base, offset);
if (opcode == kUnboundAddLabelLongOffsetOpcode) patcher.nop();
break; break;
} }
case kUnboundMovLabelAddrOpcode: { case kUnboundMovLabelAddrOpcode: {
...@@ -1483,11 +1490,16 @@ void Assembler::add_label_offset(Register dst, Register base, Label* label, ...@@ -1483,11 +1490,16 @@ void Assembler::add_label_offset(Register dst, Register base, Label* label,
DCHECK_EQ(0, link & 3); DCHECK_EQ(0, link & 3);
link >>= 2; link >>= 2;
DCHECK(is_int26(link)); DCHECK(is_int26(link));
DCHECK(is_int16(delta));
BlockTrampolinePoolScope block_trampoline_pool(this); BlockTrampolinePoolScope block_trampoline_pool(this);
emit(kUnboundAddLabelOffsetOpcode | (link & kImm26Mask));
emit(dst.code() * B21 | base.code() * B16 | (delta & kImm16Mask)); emit((is_int22(delta) ? kUnboundAddLabelOffsetOpcode
: kUnboundAddLabelLongOffsetOpcode) |
(link & kImm26Mask));
emit(dst.code() * B27 | base.code() * B22 | (delta & kImm22Mask));
if (!is_int22(delta)) {
emit(delta);
}
} }
} }
......
...@@ -39,6 +39,9 @@ const int kLoadDoubleMaxReachBits = 15; ...@@ -39,6 +39,9 @@ const int kLoadDoubleMaxReachBits = 15;
// sign-extend the least significant 16-bits of value <imm> // sign-extend the least significant 16-bits of value <imm>
#define SIGN_EXT_IMM16(imm) ((static_cast<int>(imm) << 16) >> 16) #define SIGN_EXT_IMM16(imm) ((static_cast<int>(imm) << 16) >> 16)
// sign-extend the least significant 22-bits of value <imm>
#define SIGN_EXT_IMM22(imm) ((static_cast<int>(imm) << 10) >> 10)
// sign-extend the least significant 26-bits of value <imm> // sign-extend the least significant 26-bits of value <imm>
#define SIGN_EXT_IMM26(imm) ((static_cast<int>(imm) << 6) >> 6) #define SIGN_EXT_IMM26(imm) ((static_cast<int>(imm) << 6) >> 6)
...@@ -2596,6 +2599,7 @@ enum { ...@@ -2596,6 +2599,7 @@ enum {
kImm24Mask = (1 << 24) - 1, kImm24Mask = (1 << 24) - 1,
kOff16Mask = (1 << 16) - 1, kOff16Mask = (1 << 16) - 1,
kImm16Mask = (1 << 16) - 1, kImm16Mask = (1 << 16) - 1,
kImm22Mask = (1 << 22) - 1,
kImm26Mask = (1 << 26) - 1, kImm26Mask = (1 << 26) - 1,
kBOfieldMask = 0x1f << 21, kBOfieldMask = 0x1f << 21,
kOpcodeMask = 0x3f << 26, kOpcodeMask = 0x3f << 26,
......
...@@ -840,8 +840,9 @@ void TurboAssembler::LoadPC(Register dst) { ...@@ -840,8 +840,9 @@ void TurboAssembler::LoadPC(Register dst) {
void TurboAssembler::LoadConstantPoolPointerRegister() { void TurboAssembler::LoadConstantPoolPointerRegister() {
LoadPC(kConstantPoolRegister); LoadPC(kConstantPoolRegister);
int32_t delta = -pc_offset() + 4;
add_label_offset(kConstantPoolRegister, kConstantPoolRegister, add_label_offset(kConstantPoolRegister, kConstantPoolRegister,
ConstantPoolPosition(), -pc_offset() + 4); ConstantPoolPosition(), delta);
} }
void TurboAssembler::StubPrologue(StackFrame::Type type) { void TurboAssembler::StubPrologue(StackFrame::Type type) {
...@@ -1750,7 +1751,7 @@ void MacroAssembler::AssertConstructor(Register object) { ...@@ -1750,7 +1751,7 @@ void MacroAssembler::AssertConstructor(Register object) {
if (emit_debug_code()) { if (emit_debug_code()) {
STATIC_ASSERT(kSmiTag == 0); STATIC_ASSERT(kSmiTag == 0);
TestIfSmi(object, r0); TestIfSmi(object, r0);
Check(ne, AbortReason::kOperandIsASmiAndNotAConstructor); Check(ne, AbortReason::kOperandIsASmiAndNotAConstructor, cr0);
push(object); push(object);
LoadP(object, FieldMemOperand(object, HeapObject::kMapOffset)); LoadP(object, FieldMemOperand(object, HeapObject::kMapOffset));
lbz(object, FieldMemOperand(object, Map::kBitFieldOffset)); lbz(object, FieldMemOperand(object, Map::kBitFieldOffset));
...@@ -2410,7 +2411,7 @@ void TurboAssembler::LoadP(Register dst, const MemOperand& mem, ...@@ -2410,7 +2411,7 @@ void TurboAssembler::LoadP(Register dst, const MemOperand& mem,
if (!is_int16(offset)) { if (!is_int16(offset)) {
/* cannot use d-form */ /* cannot use d-form */
DCHECK_EQ(scratch, no_reg); DCHECK_NE(scratch, no_reg);
mov(scratch, Operand(offset)); mov(scratch, Operand(offset));
LoadPX(dst, MemOperand(mem.ra(), scratch)); LoadPX(dst, MemOperand(mem.ra(), scratch));
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment