Index: src/compiler/typer.cc |
diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc |
index 4b3a8830a0fff9cbed6694b9588742225d262814..1f783fd1824facb37d2f1b72c1b6c5a7a4a3c5aa 100644 |
--- a/src/compiler/typer.cc |
+++ b/src/compiler/typer.cc |
@@ -916,11 +916,17 @@ Type* Typer::Visitor::JSShiftRightTyper(Type* lhs, Type* rhs, Typer* t) { |
// Right-shifting a non-negative value cannot make it negative, nor larger. |
min = std::max(min, 0.0); |
max = std::min(max, lhs->Max()); |
+ if (rhs->Min() > 0 && rhs->Max() <= 31) { |
+ max = static_cast<int>(max) >> static_cast<int>(rhs->Min()); |
+ } |
} |
if (lhs->Max() < 0) { |
// Right-shifting a negative value cannot make it non-negative, nor smaller. |
min = std::max(min, lhs->Min()); |
max = std::min(max, -1.0); |
+ if (rhs->Min() > 0 && rhs->Max() <= 31) { |
+ min = static_cast<int>(min) >> static_cast<int>(rhs->Min()); |
+ } |
} |
if (rhs->Min() > 0 && rhs->Max() <= 31) { |
// Right-shifting by a positive value yields a small integer value. |