Commit a2bcfd41 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: Implement ComputeCodeStartAddress in TurboAssembler

R=joransiu@ca.ibm.com

Change-Id: Ie7387c92f9994cd72d6f0ba660ba7bd275dd429a
Reviewed-on: https://chromium-review.googlesource.com/1001496Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#52496}
parent 1fac51a8
......@@ -794,12 +794,7 @@ void CodeGenerator::AssembleTailCallAfterGap(Instruction* instr,
// Check that {kJavaScriptCallCodeStartRegister} is correct.
void CodeGenerator::AssembleCodeStartRegisterCheck() {
Register scratch = kScratchReg;
Label current_pc;
__ mov_label_addr(scratch, &current_pc);
__ bind(&current_pc);
__ subi(scratch, scratch, Operand(__ pc_offset()));
__ ComputeCodeStartAddress(scratch);
__ cmp(scratch, kJavaScriptCallCodeStartRegister);
__ Assert(eq, AbortReason::kWrongFunctionCodeStart);
}
......@@ -814,11 +809,7 @@ void CodeGenerator::AssembleCodeStartRegisterCheck() {
void CodeGenerator::BailoutIfDeoptimized() {
if (FLAG_debug_code) {
// Check that {kJavaScriptCallCodeStartRegister} is correct.
Label current_pc;
__ mov_label_addr(ip, &current_pc);
__ bind(&current_pc);
__ subi(ip, ip, Operand(__ pc_offset()));
__ ComputeCodeStartAddress(ip);
__ cmp(ip, kJavaScriptCallCodeStartRegister);
__ Assert(eq, AbortReason::kWrongFunctionCodeStart);
}
......
......@@ -1041,8 +1041,7 @@ void CodeGenerator::AssembleTailCallAfterGap(Instruction* instr,
// Check that {kJavaScriptCallCodeStartRegister} is correct.
void CodeGenerator::AssembleCodeStartRegisterCheck() {
Register scratch = r1;
int pc_offset = __ pc_offset();
__ larl(scratch, Operand(-pc_offset/2));
__ ComputeCodeStartAddress(scratch);
__ CmpP(scratch, kJavaScriptCallCodeStartRegister);
__ Assert(eq, AbortReason::kWrongFunctionCodeStart);
}
......@@ -1057,8 +1056,7 @@ void CodeGenerator::AssembleCodeStartRegisterCheck() {
void CodeGenerator::BailoutIfDeoptimized() {
if (FLAG_debug_code) {
// Check that {kJavaScriptCallCodeStartRegister} is correct.
int pc_offset = __ pc_offset();
__ larl(ip, Operand(-pc_offset/2));
__ ComputeCodeStartAddress(ip);
__ CmpP(ip, kJavaScriptCallCodeStartRegister);
__ Assert(eq, AbortReason::kWrongFunctionCodeStart);
}
......
......@@ -838,6 +838,14 @@ void TurboAssembler::LoadPC(Register dst) {
mflr(dst);
}
void TurboAssembler::ComputeCodeStartAddress(Register dst) {
Label current_pc;
mov_label_addr(dst, &current_pc);
bind(&current_pc);
subi(dst, dst, Operand(pc_offset()));
}
void TurboAssembler::LoadConstantPoolPointerRegister() {
LoadPC(kConstantPoolRegister);
int32_t delta = -pc_offset() + 4;
......
......@@ -217,6 +217,7 @@ class TurboAssembler : public Assembler {
void LoadSingleU(DoubleRegister dst, const MemOperand& mem,
Register scratch = no_reg);
void LoadPC(Register dst);
void ComputeCodeStartAddress(Register dst);
void StoreDouble(DoubleRegister src, const MemOperand& mem,
Register scratch = no_reg);
......
......@@ -4293,6 +4293,10 @@ void TurboAssembler::ResetSpeculationPoisonRegister() {
mov(kSpeculationPoisonRegister, Operand(-1));
}
void TurboAssembler::ComputeCodeStartAddress(Register dst) {
larl(dst, Operand(-pc_offset() / 2));
}
} // namespace internal
} // namespace v8
......
......@@ -1011,6 +1011,7 @@ class TurboAssembler : public Assembler {
Label* condition_met);
void ResetSpeculationPoisonRegister();
void ComputeCodeStartAddress(Register dst);
private:
static const int kSmiShift = kSmiTagSize + kSmiShiftSize;
......
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