Index: runtime/vm/intermediate_language_mips.cc |
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc |
index 2c3ac3969bed4ad116b7e666bb08aff7a826aa18..6a2c6238e6224b9f54936756983e32456b0d1687 100644 |
--- a/runtime/vm/intermediate_language_mips.cc |
+++ b/runtime/vm/intermediate_language_mips.cc |
@@ -3039,6 +3039,26 @@ void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
case Token::kBIT_XOR: |
__ xor_(result, left, right); |
break; |
+ case Token::kSHL: |
+ ASSERT(result != left); |
+ ASSERT(result != right); |
+ __ BranchUnsignedGreater(right, Immediate(Smi::RawValue(Smi::kBits)), |
+ slow_path->entry_label()); |
+ // Check for overflow by shifting left and shifting back arithmetically. |
+ // If the result is different from the original, there was overflow. |
+ __ delay_slot()->SmiUntag(TMP, right); |
+ __ sllv(result, left, TMP); |
+ __ srav(CMPRES1, result, TMP); |
+ __ bne(CMPRES1, left, slow_path->entry_label()); |
+ break; |
+ case Token::kSHR: |
+ __ BranchUnsignedGreater(right, Immediate(Smi::RawValue(Smi::kBits)), |
+ slow_path->entry_label()); |
+ __ delay_slot()->SmiUntag(result, right); |
+ __ SmiUntag(TMP, left); |
+ __ srav(result, TMP, result); |
+ __ SmiTag(result); |
+ break; |
default: |
UNIMPLEMENTED(); |
} |