Bug 998167 - IonMonkey: Fix signed integer undefined behavior r=nbp

This commit is contained in:
Dan Gohman 2014-04-18 11:13:44 -07:00
Родитель 8c1c3c1373
Коммит ad4273ba8f
1 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -95,16 +95,14 @@ EvaluateConstantOperands(TempAllocator &alloc, MBinaryInstruction *ins, bool *pt
ret = Int32Value(lhs.toInt32() ^ rhs.toInt32());
break;
case MDefinition::Op_Lsh:
ret = Int32Value(lhs.toInt32() << (rhs.toInt32() & 0x1F));
ret = Int32Value(uint32_t(lhs.toInt32()) << (rhs.toInt32() & 0x1F));
break;
case MDefinition::Op_Rsh:
ret = Int32Value(lhs.toInt32() >> (rhs.toInt32() & 0x1F));
break;
case MDefinition::Op_Ursh: {
uint32_t unsignedLhs = (uint32_t)lhs.toInt32();
ret.setNumber(uint32_t(unsignedLhs >> (rhs.toInt32() & 0x1F)));
case MDefinition::Op_Ursh:
ret.setNumber(uint32_t(lhs.toInt32()) >> (rhs.toInt32() & 0x1F));
break;
}
case MDefinition::Op_Add:
ret.setNumber(lhs.toNumber() + rhs.toNumber());
break;