Chromium Code Reviews| Index: runtime/vm/intermediate_language.cc | 
| diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc | 
| index c0a4f039a25d4b5e34924d59808fd7a33b2e1c88..fbc492221942fa0a6d9e85cae6f73b59a8f3280c 100644 | 
| --- a/runtime/vm/intermediate_language.cc | 
| +++ b/runtime/vm/intermediate_language.cc | 
| @@ -1260,11 +1260,41 @@ bool BinaryIntegerOpInstr::RightIsPowerOfTwoConstant() const { | 
| } | 
| +static intptr_t RepresentationBits(Representation r) { | 
| + switch (r) { | 
| + case kTagged: | 
| + return kBitsPerWord - 1; | 
| + case kUnboxedInt32: | 
| + case kUnboxedUint32: | 
| + return 32; | 
| + case kUnboxedMint: | 
| + return 64; | 
| + default: | 
| + UNREACHABLE(); | 
| + return 0; | 
| + } | 
| +} | 
| + | 
| + | 
| +static int64_t RepresentationMask(Representation r) { | 
| + return static_cast<int64_t>( | 
| + static_cast<uint64_t>(-1) >> (64 - RepresentationBits(r))); | 
| +} | 
| + | 
| + | 
| static bool ToIntegerConstant(Value* value, int64_t* result) { | 
| if (!value->BindsToConstant()) { | 
| UnboxInstr* unbox = value->definition()->AsUnbox(); | 
| - if ((unbox != NULL) && (unbox->representation() == kUnboxedDouble)) { | 
| - return ToIntegerConstant(unbox->value(), result); | 
| + if (unbox != NULL) { | 
| + if (unbox->representation() == kUnboxedDouble) { | 
| + return ToIntegerConstant(unbox->value(), result); | 
| + } else if (unbox->representation() == kUnboxedUint32) { | 
| 
 
Florian Schneider
2014/11/10 16:10:47
Why are kUnboxedInt32 and kInboxedMint not handled
 
 | 
| + if (ToIntegerConstant(unbox->value(), result)) { | 
| + *result &= RepresentationMask(kUnboxedUint32); | 
| + return true; | 
| + } | 
| + return false; | 
| + } | 
| } | 
| return false; | 
| } | 
| @@ -1392,28 +1422,6 @@ static bool IsCommutative(Token::Kind op) { | 
| } | 
| -static intptr_t RepresentationBits(Representation r) { | 
| - switch (r) { | 
| - case kTagged: | 
| - return kBitsPerWord - 1; | 
| - case kUnboxedInt32: | 
| - case kUnboxedUint32: | 
| - return 32; | 
| - case kUnboxedMint: | 
| - return 64; | 
| - default: | 
| - UNREACHABLE(); | 
| - return 0; | 
| - } | 
| -} | 
| - | 
| - | 
| -static int64_t RepresentationMask(Representation r) { | 
| - return static_cast<int64_t>( | 
| - static_cast<uint64_t>(-1) >> (64 - RepresentationBits(r))); | 
| -} | 
| - | 
| - | 
| UnaryIntegerOpInstr* UnaryIntegerOpInstr::Make(Representation representation, | 
| Token::Kind op_kind, | 
| Value* value, |