Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: src/mips/macro-assembler-mips.cc

Issue 1448033002: MIPS: Fix trampoline pool handling in MacroAssembler::BranchShort() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc
index 14d8ed8e1e024289391ec97f4d0ad98ab8e96072..272f8147b94185aac05ed5dd75d18940e2fb7e03 100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -2374,121 +2374,122 @@ bool MacroAssembler::BranchShortHelper(int16_t offset, Label* L, Condition cond,
// Be careful to always use shifted_branch_offset only just before the
// branch instruction, as the location will be remember for patching the
// target.
- BlockTrampolinePoolScope block_trampoline_pool(this);
- switch (cond) {
- case cc_always:
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- b(offset32);
- break;
- case eq:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(rs, zero_reg, offset32);
- } else {
- // We don't want any other register but scratch clobbered.
- scratch = GetRtAsRegisterHelper(rt, scratch);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(rs, scratch, offset32);
- }
- break;
- case ne:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(rs, zero_reg, offset32);
- } else {
- // We don't want any other register but scratch clobbered.
- scratch = GetRtAsRegisterHelper(rt, scratch);
+ {
+ BlockTrampolinePoolScope block_trampoline_pool(this);
+ switch (cond) {
+ case cc_always:
offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(rs, scratch, offset32);
- }
- break;
+ b(offset32);
+ break;
+ case eq:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(rs, zero_reg, offset32);
+ } else {
+ // We don't want any other register but scratch clobbered.
+ scratch = GetRtAsRegisterHelper(rt, scratch);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(rs, scratch, offset32);
+ }
+ break;
+ case ne:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(rs, zero_reg, offset32);
+ } else {
+ // We don't want any other register but scratch clobbered.
+ scratch = GetRtAsRegisterHelper(rt, scratch);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(rs, scratch, offset32);
+ }
+ break;
- // Signed comparison.
- case greater:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bgtz(rs, offset32);
- } else {
- Slt(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(scratch, zero_reg, offset32);
- }
- break;
- case greater_equal:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bgez(rs, offset32);
- } else {
- Slt(scratch, rs, rt);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(scratch, zero_reg, offset32);
- }
- break;
- case less:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bltz(rs, offset32);
- } else {
- Slt(scratch, rs, rt);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(scratch, zero_reg, offset32);
- }
- break;
- case less_equal:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- blez(rs, offset32);
- } else {
- Slt(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(scratch, zero_reg, offset32);
- }
- break;
+ // Signed comparison.
+ case greater:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bgtz(rs, offset32);
+ } else {
+ Slt(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(scratch, zero_reg, offset32);
+ }
+ break;
+ case greater_equal:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bgez(rs, offset32);
+ } else {
+ Slt(scratch, rs, rt);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(scratch, zero_reg, offset32);
+ }
+ break;
+ case less:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bltz(rs, offset32);
+ } else {
+ Slt(scratch, rs, rt);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(scratch, zero_reg, offset32);
+ }
+ break;
+ case less_equal:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ blez(rs, offset32);
+ } else {
+ Slt(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(scratch, zero_reg, offset32);
+ }
+ break;
- // Unsigned comparison.
- case Ugreater:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(rs, zero_reg, offset32);
- } else {
- Sltu(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(scratch, zero_reg, offset32);
- }
- break;
- case Ugreater_equal:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- b(offset32);
- } else {
- Sltu(scratch, rs, rt);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(scratch, zero_reg, offset32);
- }
- break;
- case Uless:
- if (IsZero(rt)) {
- return true; // No code needs to be emitted.
- } else {
- Sltu(scratch, rs, rt);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- bne(scratch, zero_reg, offset32);
- }
- break;
- case Uless_equal:
- if (IsZero(rt)) {
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(rs, zero_reg, offset32);
- } else {
- Sltu(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
- offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
- beq(scratch, zero_reg, offset32);
- }
- break;
- default:
- UNREACHABLE();
+ // Unsigned comparison.
+ case Ugreater:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(rs, zero_reg, offset32);
+ } else {
+ Sltu(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(scratch, zero_reg, offset32);
+ }
+ break;
+ case Ugreater_equal:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ b(offset32);
+ } else {
+ Sltu(scratch, rs, rt);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(scratch, zero_reg, offset32);
+ }
+ break;
+ case Uless:
+ if (IsZero(rt)) {
+ return true; // No code needs to be emitted.
+ } else {
+ Sltu(scratch, rs, rt);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ bne(scratch, zero_reg, offset32);
+ }
+ break;
+ case Uless_equal:
+ if (IsZero(rt)) {
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(rs, zero_reg, offset32);
+ } else {
+ Sltu(scratch, GetRtAsRegisterHelper(rt, scratch), rs);
+ offset32 = GetOffset(offset, L, OffsetSize::kOffset16);
+ beq(scratch, zero_reg, offset32);
+ }
+ break;
+ default:
+ UNREACHABLE();
+ }
}
-
// Emit a nop in the branch delay slot if required.
if (bdslot == PROTECT)
nop();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698