Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 24081b9535f0d9fa781c56af47070a3f8a0f21a3..6518217b0809a5df87822bb3a105cf25f7f5e9d4 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -2068,6 +2068,15 @@ Reduction JSTypedLowering::ReduceJSForInNext(Node* node) { |
Node* effect = NodeProperties::GetEffectInput(node); |
Node* control = NodeProperties::GetControlInput(node); |
+ // We know that the {index} is in Unsigned32 range here, otherwise executing |
+ // the JSForInNext wouldn't be valid. Unfortunately due to OSR and generators |
+ // this is not always reflected in the types, hence we might need to rename |
+ // the {index} here. |
+ if (!NodeProperties::GetType(index)->Is(Type::Unsigned32())) { |
+ index = graph()->NewNode(common()->TypeGuard(Type::Unsigned32()), index, |
+ control); |
+ } |
+ |
// Load the next {key} from the {cache_array}. |
Node* key = effect = graph()->NewNode( |
simplified()->LoadElement(AccessBuilder::ForFixedArrayElement()), |