Commit ce17509a authored by Milad Fa's avatar Milad Fa Committed by Commit Bot

S390: enable forced long branches as an option

As an example, kEagerWithResumeDeoptExitSize is always expected to
emit a 6 byte instruction "brcl", however, if the branch offset
is small enough, brc (a 4 byte instruction) might get emitted.

We need a way to force the emission of brcl at times like above.

Change-Id: Ic42c1ad80098067df6a0049bdde20e90f12ef1b0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2578061Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/master@{#71668}
parent 678afa3c
......@@ -633,9 +633,10 @@ void Assembler::load_label_offset(Register r1, Label* L) {
}
// Pseudo op - branch on condition
void Assembler::branchOnCond(Condition c, int branch_offset, bool is_bound) {
void Assembler::branchOnCond(Condition c, int branch_offset, bool is_bound,
bool force_long_branch) {
int offset_in_halfwords = branch_offset / 2;
if (is_bound && is_int16(offset_in_halfwords)) {
if (is_bound && is_int16(offset_in_halfwords) && !force_long_branch) {
brc(c, Operand(offset_in_halfwords)); // short jump
} else {
brcl(c, Operand(offset_in_halfwords)); // long jump
......
......@@ -948,17 +948,20 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
}
// Conditional Branch Instruction - Generates either BRC / BRCL
void branchOnCond(Condition c, int branch_offset, bool is_bound = false);
void branchOnCond(Condition c, int branch_offset, bool is_bound = false,
bool force_long_branch = false);
// Helpers for conditional branch to Label
void b(Condition cond, Label* l, Label::Distance dist = Label::kFar) {
void b(Condition cond, Label* l, Label::Distance dist = Label::kFar,
bool force_long_branch = false) {
branchOnCond(cond, branch_offset(l),
l->is_bound() || (dist == Label::kNear));
l->is_bound() || (dist == Label::kNear), force_long_branch);
}
void bc_short(Condition cond, Label* l, Label::Distance dist = Label::kFar) {
b(cond, l, Label::kNear);
}
void bc_long(Condition cond, Label* l) { b(cond, l, Label::kFar, true); }
// Helpers for conditional branch to Label
void beq(Label* l, Label::Distance dist = Label::kFar) { b(eq, l, dist); }
void bne(Label* l, Label::Distance dist = Label::kFar) { b(ne, l, dist); }
......
......@@ -4707,8 +4707,8 @@ void TurboAssembler::CallForDeoptimization(Builtins::Name target, int,
? Deoptimizer::kLazyDeoptExitSize
: Deoptimizer::kNonLazyDeoptExitSize);
if (kind == DeoptimizeKind::kEagerWithResume) {
b(ret);
DCHECK_LE(SizeOfCodeGeneratedSince(exit),
bc_long(Condition::al, ret);
DCHECK_EQ(SizeOfCodeGeneratedSince(exit),
Deoptimizer::kEagerWithResumeDeoptExitSize);
}
}
......
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