Index: src/full-codegen/ia32/full-codegen-ia32.cc |
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc |
index 03704d71cd2008a2362002c57665ee9c972692f0..5762c030e5819accdc6e42d2b93de1c362d94b93 100644 |
--- a/src/full-codegen/ia32/full-codegen-ia32.cc |
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc |
@@ -1047,8 +1047,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
__ bind(&fixed_array); |
// No need for a write barrier, we are storing a Smi in the feedback vector. |
+ int const vector_index = SmiFromSlot(slot)->value(); |
__ EmitLoadTypeFeedbackVector(ebx); |
- int vector_index = SmiFromSlot(slot)->value(); |
__ mov(FieldOperand(ebx, FixedArray::OffsetOfElementAt(vector_index)), |
Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
__ push(Immediate(Smi::FromInt(1))); // Smi(1) indicates slow check |
@@ -1081,6 +1081,16 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
__ cmp(edx, FieldOperand(ecx, HeapObject::kMapOffset)); |
__ j(equal, &update_each, Label::kNear); |
+ // We might get here from TurboFan or Crankshaft when something in the |
+ // for-in loop body deopts and only now notice in fullcodegen, that we |
+ // can now longer use the enum cache, i.e. left fast mode. So better record |
+ // this information here, in case we later OSR back into this loop or |
+ // reoptimize the whole function w/o rerunning the loop with the slow |
+ // mode object in fullcodegen (which would result in a deopt loop). |
+ __ EmitLoadTypeFeedbackVector(edx); |
+ __ mov(FieldOperand(edx, FixedArray::OffsetOfElementAt(vector_index)), |
+ Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
+ |
// Convert the entry to a string or null if it isn't a property |
// anymore. If the property has been removed while iterating, we |
// just skip it. |