Index: src/full-codegen/mips64/full-codegen-mips64.cc |
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc |
index 9f32a88ce72170e75ad5eec05729e81bc38bc84a..aa36b98fb913c02d4edea1aab9d9d447ec9557f0 100644 |
--- a/src/full-codegen/mips64/full-codegen-mips64.cc |
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc |
@@ -1114,9 +1114,9 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
// We got a fixed array in register v0. Iterate through that. |
__ bind(&fixed_array); |
+ int const vector_index = SmiFromSlot(slot)->value(); |
__ EmitLoadTypeFeedbackVector(a1); |
__ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
- int vector_index = SmiFromSlot(slot)->value(); |
__ sd(a2, FieldMemOperand(a1, FixedArray::OffsetOfElementAt(vector_index))); |
__ li(a1, Operand(Smi::FromInt(1))); // Smi(1) indicates slow check |
@@ -1154,6 +1154,16 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
__ ld(a4, FieldMemOperand(a1, HeapObject::kMapOffset)); |
__ Branch(&update_each, eq, a4, Operand(a2)); |
+ // 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(a0); |
+ __ li(a2, Operand(TypeFeedbackVector::MegamorphicSentinel(isolate()))); |
+ __ sd(a2, FieldMemOperand(a0, FixedArray::OffsetOfElementAt(vector_index))); |
+ |
// Convert the entry to a string or (smi) 0 if it isn't a property |
// any more. If the property has been removed while iterating, we |
// just skip it. |