[vm] Make Shift MayThrow more precise

After https://dart-review.googlesource.com/c/sdk/+/245061,
multiplications guaranteed to not throw, could be turned into shifts
reporting they may throw.

TEST=Existing test suite exercising the new ASSERTs.

Change-Id: Ie464fb1dfe8b0c4c98ac6f462154f909bef53794
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245362
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 823e4a8..44c61f9 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -2405,6 +2405,12 @@
                 new Range(RangeBoundary::FromConstant(shift_amount),
                           RangeBoundary::FromConstant(shift_amount)));
           }
+          if (!MayThrow()) {
+            ASSERT(!shift->MayThrow());
+          }
+          if (!CanDeoptimize()) {
+            ASSERT(!shift->CanDeoptimize());
+          }
           flow_graph->InsertBefore(this, shift, env(), FlowGraph::kValue);
           return shift;
         }
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 55899ac..08971e8 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -8162,7 +8162,7 @@
     return kNotSpeculative;
   }
   virtual bool ComputeCanDeoptimize() const { return false; }
-  virtual bool MayThrow() const { return true; }
+  virtual bool MayThrow() const { return !IsShiftCountInRange(); }
 
   virtual Representation representation() const { return kUnboxedInt64; }