| Index: src/hydrogen-instructions.cc
|
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
|
| index 0aabfbc43229198f181ec9f76d4aaf4724228f4f..cb50de6d984bf5cc49a4546373b835e27b4a3d47 100644
|
| --- a/src/hydrogen-instructions.cc
|
| +++ b/src/hydrogen-instructions.cc
|
| @@ -648,6 +648,11 @@ int32_t HValue::GetInteger32Constant() {
|
| }
|
|
|
|
|
| +bool HValue::EqualsInteger32Constant(int32_t value) {
|
| + return IsInteger32Constant() && GetInteger32Constant() == value;
|
| +}
|
| +
|
| +
|
| void HValue::SetOperandAt(int index, HValue* value) {
|
| RegisterUse(index, value);
|
| InternalSetOperandAt(index, value);
|
| @@ -1393,15 +1398,11 @@ HValue* HBitwise::Canonicalize() {
|
| if (!representation().IsInteger32()) return this;
|
| // If x is an int32, then x & -1 == x, x | 0 == x and x ^ 0 == x.
|
| int32_t nop_constant = (op() == Token::BIT_AND) ? -1 : 0;
|
| - if (left()->IsConstant() &&
|
| - HConstant::cast(left())->HasInteger32Value() &&
|
| - HConstant::cast(left())->Integer32Value() == nop_constant &&
|
| + if (left()->EqualsInteger32Constant(nop_constant) &&
|
| !right()->CheckFlag(kUint32)) {
|
| return right();
|
| }
|
| - if (right()->IsConstant() &&
|
| - HConstant::cast(right())->HasInteger32Value() &&
|
| - HConstant::cast(right())->Integer32Value() == nop_constant &&
|
| + if (right()->EqualsInteger32Constant(nop_constant) &&
|
| !left()->CheckFlag(kUint32)) {
|
| return left();
|
| }
|
| @@ -1439,8 +1440,7 @@ HValue* HSub::Canonicalize() {
|
| // TODO(svenpanne) Use this in other Canonicalize() functions.
|
| static bool IsIdentityOperation(HValue* arg1, HValue* arg2, int32_t identity) {
|
| return arg1->representation().IsSpecialization() &&
|
| - arg2->IsInteger32Constant() &&
|
| - arg2->GetInteger32Constant() == identity;
|
| + arg2->EqualsInteger32Constant(identity);
|
| }
|
|
|
|
|
|
|