Reviewers: Yang,
Message:
Yang - this patch caught the bad use of 'at' register in our port of your
string
slices commit.
Description:
MIPS: Added ASSERTs to BranchShort to detect bad use of 'at' register.
Make sure 'at' and an immediate operand can't be used together in cases
where 'at' would be overwritten by li.
BUG=
TEST=
Please review this at http://codereview.chromium.org/7791019/
Affected files:
M src/mips/macro-assembler-mips.cc
Index: src/mips/macro-assembler-mips.cc
diff --git a/src/mips/macro-assembler-mips.cc
b/src/mips/macro-assembler-mips.cc
index
8e4b8ef9737624a6f6d723acf08e752284c8adda..c7f727bef604e1e0eff71ff0987b00b57f5d2c56
100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -1557,12 +1557,14 @@ void MacroAssembler::BranchShort(Label* L,
Condition cond, Register rs,
b(offset);
break;
case eq:
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
offset = shifted_branch_offset(L, false);
beq(rs, r2, offset);
break;
case ne:
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
offset = shifted_branch_offset(L, false);
@@ -1574,6 +1576,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
bgtz(rs, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
slt(scratch, r2, rs);
@@ -1590,6 +1593,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
beq(scratch, zero_reg, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
slt(scratch, rs, r2);
@@ -1606,6 +1610,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
bne(scratch, zero_reg, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
slt(scratch, rs, r2);
@@ -1618,6 +1623,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
blez(rs, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
slt(scratch, r2, rs);
@@ -1631,6 +1637,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
bgtz(rs, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
sltu(scratch, r2, rs);
@@ -1647,6 +1654,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
beq(scratch, zero_reg, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
sltu(scratch, rs, r2);
@@ -1663,6 +1671,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
bne(scratch, zero_reg, offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
sltu(scratch, rs, r2);
@@ -1675,6 +1684,7 @@ void MacroAssembler::BranchShort(Label* L, Condition
cond, Register rs,
offset = shifted_branch_offset(L, false);
b(offset);
} else {
+ ASSERT(!scratch.is(rs));
r2 = scratch;
li(r2, rt);
sltu(scratch, r2, rs);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev