Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| =================================================================== |
| --- src/hydrogen-instructions.cc (revision 10369) |
| +++ src/hydrogen-instructions.cc (working copy) |
| @@ -788,6 +788,25 @@ |
| } |
| +HValue* HBitwise::Canonicalize() { |
| + if (!representation().IsInteger32()) return this; |
| + if (op() == Token::BIT_XOR) return this; |
|
Sven Panne
2012/01/11 09:54:03
I don't think we need this special case, because '
fschneider
2012/01/11 10:00:30
Done.
|
| + // If x is an int32, x & -1 == x and x | 0 == x. |
| + int nop_constant = (op() == Token::BIT_AND) ? -1 : 0; |
|
Sven Panne
2012/01/11 09:54:03
Use int32_t, not int.
fschneider
2012/01/11 10:00:30
Done.
|
| + if (left()->IsConstant() && |
| + HConstant::cast(left())->HasInteger32Value() && |
| + HConstant::cast(left())->Integer32Value() == nop_constant) { |
| + return right(); |
| + } |
| + if (right()->IsConstant() && |
| + HConstant::cast(right())->HasInteger32Value() && |
| + HConstant::cast(right())->Integer32Value() == nop_constant) { |
| + return left(); |
| + } |
| + return this; |
| +} |
| + |
| + |
| void HTypeof::PrintDataTo(StringStream* stream) { |
| value()->PrintNameTo(stream); |
| } |