Commit ca829827 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

ARM: Fix bug introduced in 4783 (2.2.15) that caused the

result of 1 << x to be miscalculated for some inputs.
Review URL: http://codereview.chromium.org/2848021

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4929 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a2fc244d
...@@ -969,45 +969,20 @@ void DeferredInlineSmiOperation::Generate() { ...@@ -969,45 +969,20 @@ void DeferredInlineSmiOperation::Generate() {
case Token::MOD: case Token::MOD:
case Token::BIT_OR: case Token::BIT_OR:
case Token::BIT_XOR: case Token::BIT_XOR:
case Token::BIT_AND: { case Token::BIT_AND:
if (reversed_) {
if (tos_register_.is(r0)) {
__ mov(r1, Operand(Smi::FromInt(value_)));
} else {
ASSERT(tos_register_.is(r1));
__ mov(r0, Operand(Smi::FromInt(value_)));
lhs = r0;
rhs = r1;
}
} else {
if (tos_register_.is(r1)) {
__ mov(r0, Operand(Smi::FromInt(value_)));
} else {
ASSERT(tos_register_.is(r0));
__ mov(r1, Operand(Smi::FromInt(value_)));
lhs = r0;
rhs = r1;
}
}
break;
}
case Token::SHL: case Token::SHL:
case Token::SHR: case Token::SHR:
case Token::SAR: { case Token::SAR: {
if (!reversed_) { if (tos_register_.is(r1)) {
if (tos_register_.is(r1)) { __ mov(r0, Operand(Smi::FromInt(value_)));
__ mov(r0, Operand(Smi::FromInt(value_)));
} else {
ASSERT(tos_register_.is(r0));
__ mov(r1, Operand(Smi::FromInt(value_)));
lhs = r0;
rhs = r1;
}
} else { } else {
ASSERT(op_ == Token::SHL); ASSERT(tos_register_.is(r0));
__ mov(r1, Operand(Smi::FromInt(value_))); __ mov(r1, Operand(Smi::FromInt(value_)));
} }
if (reversed_ == tos_register_.is(r1)) {
lhs = r0;
rhs = r1;
}
break; break;
} }
......
...@@ -685,3 +685,8 @@ assertEquals(24, LeftShiftThreeBy(3)); ...@@ -685,3 +685,8 @@ assertEquals(24, LeftShiftThreeBy(3));
assertEquals(24, LeftShiftThreeBy(35)); assertEquals(24, LeftShiftThreeBy(35));
assertEquals(24, LeftShiftThreeBy(67)); assertEquals(24, LeftShiftThreeBy(67));
assertEquals(24, LeftShiftThreeBy(-29)); assertEquals(24, LeftShiftThreeBy(-29));
// Regression test for a bug in the ARM code generator. For some register
// allocations we got the Smi overflow case wrong.
function f(x, y) { return y + ( 1 << (x & 31)); }
assertEquals(-2147483647, f(31, 1));
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